@talend/react-faceted-search
Version:
11,089 lines • 468 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["TalendReactFacetedSearch"] = factory();
else
root["TalendReactFacetedSearch"] = factory();
})(this, () => {
return /******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "../../node_modules/date-fns/_lib/addLeadingZeros.mjs":
/*!************************************************************!*\
!*** ../../node_modules/date-fns/_lib/addLeadingZeros.mjs ***!
\************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ addLeadingZeros: () => (/* binding */ addLeadingZeros)
/* harmony export */ });
function addLeadingZeros(number, targetLength) {
const sign = number < 0 ? "-" : "";
const output = Math.abs(number).toString().padStart(targetLength, "0");
return sign + output;
}
/***/ }),
/***/ "../../node_modules/date-fns/_lib/defaultOptions.mjs":
/*!***********************************************************!*\
!*** ../../node_modules/date-fns/_lib/defaultOptions.mjs ***!
\***********************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ getDefaultOptions: () => (/* binding */ getDefaultOptions),
/* harmony export */ setDefaultOptions: () => (/* binding */ setDefaultOptions)
/* harmony export */ });
let defaultOptions = {};
function getDefaultOptions() {
return defaultOptions;
}
function setDefaultOptions(newOptions) {
defaultOptions = newOptions;
}
/***/ }),
/***/ "../../node_modules/date-fns/_lib/format/formatters.mjs":
/*!**************************************************************!*\
!*** ../../node_modules/date-fns/_lib/format/formatters.mjs ***!
\**************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ formatters: () => (/* binding */ formatters)
/* harmony export */ });
/* harmony import */ var _getDayOfYear_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../getDayOfYear.mjs */ "../../node_modules/date-fns/getDayOfYear.mjs");
/* harmony import */ var _getISOWeek_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../getISOWeek.mjs */ "../../node_modules/date-fns/getISOWeek.mjs");
/* harmony import */ var _getISOWeekYear_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../getISOWeekYear.mjs */ "../../node_modules/date-fns/getISOWeekYear.mjs");
/* harmony import */ var _getWeek_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../getWeek.mjs */ "../../node_modules/date-fns/getWeek.mjs");
/* harmony import */ var _getWeekYear_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../getWeekYear.mjs */ "../../node_modules/date-fns/getWeekYear.mjs");
/* harmony import */ var _addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../addLeadingZeros.mjs */ "../../node_modules/date-fns/_lib/addLeadingZeros.mjs");
/* harmony import */ var _lightFormatters_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lightFormatters.mjs */ "../../node_modules/date-fns/_lib/format/lightFormatters.mjs");
const dayPeriodEnum = {
am: "am",
pm: "pm",
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night",
};
/*
* | | Unit | | Unit |
* |-----|--------------------------------|-----|--------------------------------|
* | a | AM, PM | A* | Milliseconds in day |
* | b | AM, PM, noon, midnight | B | Flexible day period |
* | c | Stand-alone local day of week | C* | Localized hour w/ day period |
* | d | Day of month | D | Day of year |
* | e | Local day of week | E | Day of week |
* | f | | F* | Day of week in month |
* | g* | Modified Julian day | G | Era |
* | h | Hour [1-12] | H | Hour [0-23] |
* | i! | ISO day of week | I! | ISO week of year |
* | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
* | k | Hour [1-24] | K | Hour [0-11] |
* | l* | (deprecated) | L | Stand-alone month |
* | m | Minute | M | Month |
* | n | | N | |
* | o! | Ordinal number modifier | O | Timezone (GMT) |
* | p! | Long localized time | P! | Long localized date |
* | q | Stand-alone quarter | Q | Quarter |
* | r* | Related Gregorian year | R! | ISO week-numbering year |
* | s | Second | S | Fraction of second |
* | t! | Seconds timestamp | T! | Milliseconds timestamp |
* | u | Extended year | U* | Cyclic year |
* | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
* | w | Local week of year | W* | Week of month |
* | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
* | y | Year (abs) | Y | Local week-numbering year |
* | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
*
* Letters marked by * are not implemented but reserved by Unicode standard.
*
* Letters marked by ! are non-standard, but implemented by date-fns:
* - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
* - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
* i.e. 7 for Sunday, 1 for Monday, etc.
* - `I` is ISO week of year, as opposed to `w` which is local week of year.
* - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
* `R` is supposed to be used in conjunction with `I` and `i`
* for universal ISO week-numbering date, whereas
* `Y` is supposed to be used in conjunction with `w` and `e`
* for week-numbering date specific to the locale.
* - `P` is long localized date format
* - `p` is long localized time format
*/
const formatters = {
// Era
G: function (date, token, localize) {
const era = date.getFullYear() > 0 ? 1 : 0;
switch (token) {
// AD, BC
case "G":
case "GG":
case "GGG":
return localize.era(era, { width: "abbreviated" });
// A, B
case "GGGGG":
return localize.era(era, { width: "narrow" });
// Anno Domini, Before Christ
case "GGGG":
default:
return localize.era(era, { width: "wide" });
}
},
// Year
y: function (date, token, localize) {
// Ordinal number
if (token === "yo") {
const signedYear = date.getFullYear();
// Returns 1 for 1 BC (which is year 0 in JavaScript)
const year = signedYear > 0 ? signedYear : 1 - signedYear;
return localize.ordinalNumber(year, { unit: "year" });
}
return _lightFormatters_mjs__WEBPACK_IMPORTED_MODULE_0__.lightFormatters.y(date, token);
},
// Local week-numbering year
Y: function (date, token, localize, options) {
const signedWeekYear = (0,_getWeekYear_mjs__WEBPACK_IMPORTED_MODULE_1__.getWeekYear)(date, options);
// Returns 1 for 1 BC (which is year 0 in JavaScript)
const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
// Two digit year
if (token === "YY") {
const twoDigitYear = weekYear % 100;
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(twoDigitYear, 2);
}
// Ordinal number
if (token === "Yo") {
return localize.ordinalNumber(weekYear, { unit: "year" });
}
// Padding
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(weekYear, token.length);
},
// ISO week-numbering year
R: function (date, token) {
const isoWeekYear = (0,_getISOWeekYear_mjs__WEBPACK_IMPORTED_MODULE_3__.getISOWeekYear)(date);
// Padding
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(isoWeekYear, token.length);
},
// Extended year. This is a single number designating the year of this calendar system.
// The main difference between `y` and `u` localizers are B.C. years:
// | Year | `y` | `u` |
// |------|-----|-----|
// | AC 1 | 1 | 1 |
// | BC 1 | 1 | 0 |
// | BC 2 | 2 | -1 |
// Also `yy` always returns the last two digits of a year,
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
u: function (date, token) {
const year = date.getFullYear();
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(year, token.length);
},
// Quarter
Q: function (date, token, localize) {
const quarter = Math.ceil((date.getMonth() + 1) / 3);
switch (token) {
// 1, 2, 3, 4
case "Q":
return String(quarter);
// 01, 02, 03, 04
case "QQ":
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(quarter, 2);
// 1st, 2nd, 3rd, 4th
case "Qo":
return localize.ordinalNumber(quarter, { unit: "quarter" });
// Q1, Q2, Q3, Q4
case "QQQ":
return localize.quarter(quarter, {
width: "abbreviated",
context: "formatting",
});
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
case "QQQQQ":
return localize.quarter(quarter, {
width: "narrow",
context: "formatting",
});
// 1st quarter, 2nd quarter, ...
case "QQQQ":
default:
return localize.quarter(quarter, {
width: "wide",
context: "formatting",
});
}
},
// Stand-alone quarter
q: function (date, token, localize) {
const quarter = Math.ceil((date.getMonth() + 1) / 3);
switch (token) {
// 1, 2, 3, 4
case "q":
return String(quarter);
// 01, 02, 03, 04
case "qq":
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(quarter, 2);
// 1st, 2nd, 3rd, 4th
case "qo":
return localize.ordinalNumber(quarter, { unit: "quarter" });
// Q1, Q2, Q3, Q4
case "qqq":
return localize.quarter(quarter, {
width: "abbreviated",
context: "standalone",
});
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
case "qqqqq":
return localize.quarter(quarter, {
width: "narrow",
context: "standalone",
});
// 1st quarter, 2nd quarter, ...
case "qqqq":
default:
return localize.quarter(quarter, {
width: "wide",
context: "standalone",
});
}
},
// Month
M: function (date, token, localize) {
const month = date.getMonth();
switch (token) {
case "M":
case "MM":
return _lightFormatters_mjs__WEBPACK_IMPORTED_MODULE_0__.lightFormatters.M(date, token);
// 1st, 2nd, ..., 12th
case "Mo":
return localize.ordinalNumber(month + 1, { unit: "month" });
// Jan, Feb, ..., Dec
case "MMM":
return localize.month(month, {
width: "abbreviated",
context: "formatting",
});
// J, F, ..., D
case "MMMMM":
return localize.month(month, {
width: "narrow",
context: "formatting",
});
// January, February, ..., December
case "MMMM":
default:
return localize.month(month, { width: "wide", context: "formatting" });
}
},
// Stand-alone month
L: function (date, token, localize) {
const month = date.getMonth();
switch (token) {
// 1, 2, ..., 12
case "L":
return String(month + 1);
// 01, 02, ..., 12
case "LL":
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(month + 1, 2);
// 1st, 2nd, ..., 12th
case "Lo":
return localize.ordinalNumber(month + 1, { unit: "month" });
// Jan, Feb, ..., Dec
case "LLL":
return localize.month(month, {
width: "abbreviated",
context: "standalone",
});
// J, F, ..., D
case "LLLLL":
return localize.month(month, {
width: "narrow",
context: "standalone",
});
// January, February, ..., December
case "LLLL":
default:
return localize.month(month, { width: "wide", context: "standalone" });
}
},
// Local week of year
w: function (date, token, localize, options) {
const week = (0,_getWeek_mjs__WEBPACK_IMPORTED_MODULE_4__.getWeek)(date, options);
if (token === "wo") {
return localize.ordinalNumber(week, { unit: "week" });
}
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(week, token.length);
},
// ISO week of year
I: function (date, token, localize) {
const isoWeek = (0,_getISOWeek_mjs__WEBPACK_IMPORTED_MODULE_5__.getISOWeek)(date);
if (token === "Io") {
return localize.ordinalNumber(isoWeek, { unit: "week" });
}
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(isoWeek, token.length);
},
// Day of the month
d: function (date, token, localize) {
if (token === "do") {
return localize.ordinalNumber(date.getDate(), { unit: "date" });
}
return _lightFormatters_mjs__WEBPACK_IMPORTED_MODULE_0__.lightFormatters.d(date, token);
},
// Day of year
D: function (date, token, localize) {
const dayOfYear = (0,_getDayOfYear_mjs__WEBPACK_IMPORTED_MODULE_6__.getDayOfYear)(date);
if (token === "Do") {
return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
}
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(dayOfYear, token.length);
},
// Day of week
E: function (date, token, localize) {
const dayOfWeek = date.getDay();
switch (token) {
// Tue
case "E":
case "EE":
case "EEE":
return localize.day(dayOfWeek, {
width: "abbreviated",
context: "formatting",
});
// T
case "EEEEE":
return localize.day(dayOfWeek, {
width: "narrow",
context: "formatting",
});
// Tu
case "EEEEEE":
return localize.day(dayOfWeek, {
width: "short",
context: "formatting",
});
// Tuesday
case "EEEE":
default:
return localize.day(dayOfWeek, {
width: "wide",
context: "formatting",
});
}
},
// Local day of week
e: function (date, token, localize, options) {
const dayOfWeek = date.getDay();
const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
switch (token) {
// Numerical value (Nth day of week with current locale or weekStartsOn)
case "e":
return String(localDayOfWeek);
// Padded numerical value
case "ee":
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(localDayOfWeek, 2);
// 1st, 2nd, ..., 7th
case "eo":
return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
case "eee":
return localize.day(dayOfWeek, {
width: "abbreviated",
context: "formatting",
});
// T
case "eeeee":
return localize.day(dayOfWeek, {
width: "narrow",
context: "formatting",
});
// Tu
case "eeeeee":
return localize.day(dayOfWeek, {
width: "short",
context: "formatting",
});
// Tuesday
case "eeee":
default:
return localize.day(dayOfWeek, {
width: "wide",
context: "formatting",
});
}
},
// Stand-alone local day of week
c: function (date, token, localize, options) {
const dayOfWeek = date.getDay();
const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
switch (token) {
// Numerical value (same as in `e`)
case "c":
return String(localDayOfWeek);
// Padded numerical value
case "cc":
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(localDayOfWeek, token.length);
// 1st, 2nd, ..., 7th
case "co":
return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
case "ccc":
return localize.day(dayOfWeek, {
width: "abbreviated",
context: "standalone",
});
// T
case "ccccc":
return localize.day(dayOfWeek, {
width: "narrow",
context: "standalone",
});
// Tu
case "cccccc":
return localize.day(dayOfWeek, {
width: "short",
context: "standalone",
});
// Tuesday
case "cccc":
default:
return localize.day(dayOfWeek, {
width: "wide",
context: "standalone",
});
}
},
// ISO day of week
i: function (date, token, localize) {
const dayOfWeek = date.getDay();
const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
switch (token) {
// 2
case "i":
return String(isoDayOfWeek);
// 02
case "ii":
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(isoDayOfWeek, token.length);
// 2nd
case "io":
return localize.ordinalNumber(isoDayOfWeek, { unit: "day" });
// Tue
case "iii":
return localize.day(dayOfWeek, {
width: "abbreviated",
context: "formatting",
});
// T
case "iiiii":
return localize.day(dayOfWeek, {
width: "narrow",
context: "formatting",
});
// Tu
case "iiiiii":
return localize.day(dayOfWeek, {
width: "short",
context: "formatting",
});
// Tuesday
case "iiii":
default:
return localize.day(dayOfWeek, {
width: "wide",
context: "formatting",
});
}
},
// AM or PM
a: function (date, token, localize) {
const hours = date.getHours();
const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
switch (token) {
case "a":
case "aa":
return localize.dayPeriod(dayPeriodEnumValue, {
width: "abbreviated",
context: "formatting",
});
case "aaa":
return localize
.dayPeriod(dayPeriodEnumValue, {
width: "abbreviated",
context: "formatting",
})
.toLowerCase();
case "aaaaa":
return localize.dayPeriod(dayPeriodEnumValue, {
width: "narrow",
context: "formatting",
});
case "aaaa":
default:
return localize.dayPeriod(dayPeriodEnumValue, {
width: "wide",
context: "formatting",
});
}
},
// AM, PM, midnight, noon
b: function (date, token, localize) {
const hours = date.getHours();
let dayPeriodEnumValue;
if (hours === 12) {
dayPeriodEnumValue = dayPeriodEnum.noon;
} else if (hours === 0) {
dayPeriodEnumValue = dayPeriodEnum.midnight;
} else {
dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
}
switch (token) {
case "b":
case "bb":
return localize.dayPeriod(dayPeriodEnumValue, {
width: "abbreviated",
context: "formatting",
});
case "bbb":
return localize
.dayPeriod(dayPeriodEnumValue, {
width: "abbreviated",
context: "formatting",
})
.toLowerCase();
case "bbbbb":
return localize.dayPeriod(dayPeriodEnumValue, {
width: "narrow",
context: "formatting",
});
case "bbbb":
default:
return localize.dayPeriod(dayPeriodEnumValue, {
width: "wide",
context: "formatting",
});
}
},
// in the morning, in the afternoon, in the evening, at night
B: function (date, token, localize) {
const hours = date.getHours();
let dayPeriodEnumValue;
if (hours >= 17) {
dayPeriodEnumValue = dayPeriodEnum.evening;
} else if (hours >= 12) {
dayPeriodEnumValue = dayPeriodEnum.afternoon;
} else if (hours >= 4) {
dayPeriodEnumValue = dayPeriodEnum.morning;
} else {
dayPeriodEnumValue = dayPeriodEnum.night;
}
switch (token) {
case "B":
case "BB":
case "BBB":
return localize.dayPeriod(dayPeriodEnumValue, {
width: "abbreviated",
context: "formatting",
});
case "BBBBB":
return localize.dayPeriod(dayPeriodEnumValue, {
width: "narrow",
context: "formatting",
});
case "BBBB":
default:
return localize.dayPeriod(dayPeriodEnumValue, {
width: "wide",
context: "formatting",
});
}
},
// Hour [1-12]
h: function (date, token, localize) {
if (token === "ho") {
let hours = date.getHours() % 12;
if (hours === 0) hours = 12;
return localize.ordinalNumber(hours, { unit: "hour" });
}
return _lightFormatters_mjs__WEBPACK_IMPORTED_MODULE_0__.lightFormatters.h(date, token);
},
// Hour [0-23]
H: function (date, token, localize) {
if (token === "Ho") {
return localize.ordinalNumber(date.getHours(), { unit: "hour" });
}
return _lightFormatters_mjs__WEBPACK_IMPORTED_MODULE_0__.lightFormatters.H(date, token);
},
// Hour [0-11]
K: function (date, token, localize) {
const hours = date.getHours() % 12;
if (token === "Ko") {
return localize.ordinalNumber(hours, { unit: "hour" });
}
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(hours, token.length);
},
// Hour [1-24]
k: function (date, token, localize) {
let hours = date.getHours();
if (hours === 0) hours = 24;
if (token === "ko") {
return localize.ordinalNumber(hours, { unit: "hour" });
}
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(hours, token.length);
},
// Minute
m: function (date, token, localize) {
if (token === "mo") {
return localize.ordinalNumber(date.getMinutes(), { unit: "minute" });
}
return _lightFormatters_mjs__WEBPACK_IMPORTED_MODULE_0__.lightFormatters.m(date, token);
},
// Second
s: function (date, token, localize) {
if (token === "so") {
return localize.ordinalNumber(date.getSeconds(), { unit: "second" });
}
return _lightFormatters_mjs__WEBPACK_IMPORTED_MODULE_0__.lightFormatters.s(date, token);
},
// Fraction of second
S: function (date, token) {
return _lightFormatters_mjs__WEBPACK_IMPORTED_MODULE_0__.lightFormatters.S(date, token);
},
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
X: function (date, token, _localize) {
const timezoneOffset = date.getTimezoneOffset();
if (timezoneOffset === 0) {
return "Z";
}
switch (token) {
// Hours and optional minutes
case "X":
return formatTimezoneWithOptionalMinutes(timezoneOffset);
// Hours, minutes and optional seconds without `:` delimiter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `XX`
case "XXXX":
case "XX": // Hours and minutes without `:` delimiter
return formatTimezone(timezoneOffset);
// Hours, minutes and optional seconds with `:` delimiter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `XXX`
case "XXXXX":
case "XXX": // Hours and minutes with `:` delimiter
default:
return formatTimezone(timezoneOffset, ":");
}
},
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
x: function (date, token, _localize) {
const timezoneOffset = date.getTimezoneOffset();
switch (token) {
// Hours and optional minutes
case "x":
return formatTimezoneWithOptionalMinutes(timezoneOffset);
// Hours, minutes and optional seconds without `:` delimiter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `xx`
case "xxxx":
case "xx": // Hours and minutes without `:` delimiter
return formatTimezone(timezoneOffset);
// Hours, minutes and optional seconds with `:` delimiter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `xxx`
case "xxxxx":
case "xxx": // Hours and minutes with `:` delimiter
default:
return formatTimezone(timezoneOffset, ":");
}
},
// Timezone (GMT)
O: function (date, token, _localize) {
const timezoneOffset = date.getTimezoneOffset();
switch (token) {
// Short
case "O":
case "OO":
case "OOO":
return "GMT" + formatTimezoneShort(timezoneOffset, ":");
// Long
case "OOOO":
default:
return "GMT" + formatTimezone(timezoneOffset, ":");
}
},
// Timezone (specific non-location)
z: function (date, token, _localize) {
const timezoneOffset = date.getTimezoneOffset();
switch (token) {
// Short
case "z":
case "zz":
case "zzz":
return "GMT" + formatTimezoneShort(timezoneOffset, ":");
// Long
case "zzzz":
default:
return "GMT" + formatTimezone(timezoneOffset, ":");
}
},
// Seconds timestamp
t: function (date, token, _localize) {
const timestamp = Math.trunc(date.getTime() / 1000);
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(timestamp, token.length);
},
// Milliseconds timestamp
T: function (date, token, _localize) {
const timestamp = date.getTime();
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(timestamp, token.length);
},
};
function formatTimezoneShort(offset, delimiter = "") {
const sign = offset > 0 ? "-" : "+";
const absOffset = Math.abs(offset);
const hours = Math.trunc(absOffset / 60);
const minutes = absOffset % 60;
if (minutes === 0) {
return sign + String(hours);
}
return sign + String(hours) + delimiter + (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(minutes, 2);
}
function formatTimezoneWithOptionalMinutes(offset, delimiter) {
if (offset % 60 === 0) {
const sign = offset > 0 ? "-" : "+";
return sign + (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(Math.abs(offset) / 60, 2);
}
return formatTimezone(offset, delimiter);
}
function formatTimezone(offset, delimiter = "") {
const sign = offset > 0 ? "-" : "+";
const absOffset = Math.abs(offset);
const hours = (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(Math.trunc(absOffset / 60), 2);
const minutes = (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_2__.addLeadingZeros)(absOffset % 60, 2);
return sign + hours + delimiter + minutes;
}
/***/ }),
/***/ "../../node_modules/date-fns/_lib/format/lightFormatters.mjs":
/*!*******************************************************************!*\
!*** ../../node_modules/date-fns/_lib/format/lightFormatters.mjs ***!
\*******************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ lightFormatters: () => (/* binding */ lightFormatters)
/* harmony export */ });
/* harmony import */ var _addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../addLeadingZeros.mjs */ "../../node_modules/date-fns/_lib/addLeadingZeros.mjs");
/*
* | | Unit | | Unit |
* |-----|--------------------------------|-----|--------------------------------|
* | a | AM, PM | A* | |
* | d | Day of month | D | |
* | h | Hour [1-12] | H | Hour [0-23] |
* | m | Minute | M | Month |
* | s | Second | S | Fraction of second |
* | y | Year (abs) | Y | |
*
* Letters marked by * are not implemented but reserved by Unicode standard.
*/
const lightFormatters = {
// Year
y(date, token) {
// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
// | Year | y | yy | yyy | yyyy | yyyyy |
// |----------|-------|----|-------|-------|-------|
// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
const signedYear = date.getFullYear();
// Returns 1 for 1 BC (which is year 0 in JavaScript)
const year = signedYear > 0 ? signedYear : 1 - signedYear;
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_0__.addLeadingZeros)(token === "yy" ? year % 100 : year, token.length);
},
// Month
M(date, token) {
const month = date.getMonth();
return token === "M" ? String(month + 1) : (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_0__.addLeadingZeros)(month + 1, 2);
},
// Day of the month
d(date, token) {
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_0__.addLeadingZeros)(date.getDate(), token.length);
},
// AM or PM
a(date, token) {
const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
switch (token) {
case "a":
case "aa":
return dayPeriodEnumValue.toUpperCase();
case "aaa":
return dayPeriodEnumValue;
case "aaaaa":
return dayPeriodEnumValue[0];
case "aaaa":
default:
return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
}
},
// Hour [1-12]
h(date, token) {
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_0__.addLeadingZeros)(date.getHours() % 12 || 12, token.length);
},
// Hour [0-23]
H(date, token) {
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_0__.addLeadingZeros)(date.getHours(), token.length);
},
// Minute
m(date, token) {
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_0__.addLeadingZeros)(date.getMinutes(), token.length);
},
// Second
s(date, token) {
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_0__.addLeadingZeros)(date.getSeconds(), token.length);
},
// Fraction of second
S(date, token) {
const numberOfDigits = token.length;
const milliseconds = date.getMilliseconds();
const fractionalSeconds = Math.trunc(
milliseconds * Math.pow(10, numberOfDigits - 3),
);
return (0,_addLeadingZeros_mjs__WEBPACK_IMPORTED_MODULE_0__.addLeadingZeros)(fractionalSeconds, token.length);
},
};
/***/ }),
/***/ "../../node_modules/date-fns/_lib/format/longFormatters.mjs":
/*!******************************************************************!*\
!*** ../../node_modules/date-fns/_lib/format/longFormatters.mjs ***!
\******************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ longFormatters: () => (/* binding */ longFormatters)
/* harmony export */ });
const dateLongFormatter = (pattern, formatLong) => {
switch (pattern) {
case "P":
return formatLong.date({ width: "short" });
case "PP":
return formatLong.date({ width: "medium" });
case "PPP":
return formatLong.date({ width: "long" });
case "PPPP":
default:
return formatLong.date({ width: "full" });
}
};
const timeLongFormatter = (pattern, formatLong) => {
switch (pattern) {
case "p":
return formatLong.time({ width: "short" });
case "pp":
return formatLong.time({ width: "medium" });
case "ppp":
return formatLong.time({ width: "long" });
case "pppp":
default:
return formatLong.time({ width: "full" });
}
};
const dateTimeLongFormatter = (pattern, formatLong) => {
const matchResult = pattern.match(/(P+)(p+)?/) || [];
const datePattern = matchResult[1];
const timePattern = matchResult[2];
if (!timePattern) {
return dateLongFormatter(pattern, formatLong);
}
let dateTimeFormat;
switch (datePattern) {
case "P":
dateTimeFormat = formatLong.dateTime({ width: "short" });
break;
case "PP":
dateTimeFormat = formatLong.dateTime({ width: "medium" });
break;
case "PPP":
dateTimeFormat = formatLong.dateTime({ width: "long" });
break;
case "PPPP":
default:
dateTimeFormat = formatLong.dateTime({ width: "full" });
break;
}
return dateTimeFormat
.replace("{{date}}", dateLongFormatter(datePattern, formatLong))
.replace("{{time}}", timeLongFormatter(timePattern, formatLong));
};
const longFormatters = {
p: timeLongFormatter,
P: dateTimeLongFormatter,
};
/***/ }),
/***/ "../../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.mjs":
/*!****************************************************************************!*\
!*** ../../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.mjs ***!
\****************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ getTimezoneOffsetInMilliseconds: () => (/* binding */ getTimezoneOffsetInMilliseconds)
/* harmony export */ });
/* harmony import */ var _toDate_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate.mjs */ "../../node_modules/date-fns/toDate.mjs");
/**
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
* They usually appear for dates that denote time before the timezones were introduced
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
* and GMT+01:00:00 after that date)
*
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
* which would lead to incorrect calculations.
*
* This function returns the timezone offset in milliseconds that takes seconds in account.
*/
function getTimezoneOffsetInMilliseconds(date) {
const _date = (0,_toDate_mjs__WEBPACK_IMPORTED_MODULE_0__.toDate)(date);
const utcDate = new Date(
Date.UTC(
_date.getFullYear(),
_date.getMonth(),
_date.getDate(),
_date.getHours(),
_date.getMinutes(),
_date.getSeconds(),
_date.getMilliseconds(),
),
);
utcDate.setUTCFullYear(_date.getFullYear());
return +date - +utcDate;
}
/***/ }),
/***/ "../../node_modules/date-fns/_lib/protectedTokens.mjs":
/*!************************************************************!*\
!*** ../../node_modules/date-fns/_lib/protectedTokens.mjs ***!
\************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ isProtectedDayOfYearToken: () => (/* binding */ isProtectedDayOfYearToken),
/* harmony export */ isProtectedWeekYearToken: () => (/* binding */ isProtectedWeekYearToken),
/* harmony export */ warnOrThrowProtectedError: () => (/* binding */ warnOrThrowProtectedError)
/* harmony export */ });
const dayOfYearTokenRE = /^D+$/;
const weekYearTokenRE = /^Y+$/;
const throwTokens = ["D", "DD", "YY", "YYYY"];
function isProtectedDayOfYearToken(token) {
return dayOfYearTokenRE.test(token);
}
function isProtectedWeekYearToken(token) {
return weekYearTokenRE.test(token);
}
function warnOrThrowProtectedError(token, format, input) {
const _message = message(token, format, input);
console.warn(_message);
if (throwTokens.includes(token)) throw new RangeError(_message);
}
function message(token, format, input) {
const subject = token[0] === "Y" ? "years" : "days of the month";
return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
}
/***/ }),
/***/ "../../node_modules/date-fns/addDays.mjs":
/*!***********************************************!*\
!*** ../../node_modules/date-fns/addDays.mjs ***!
\***********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ addDays: () => (/* binding */ addDays),
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _toDate_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toDate.mjs */ "../../node_modules/date-fns/toDate.mjs");
/* harmony import */ var _constructFrom_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constructFrom.mjs */ "../../node_modules/date-fns/constructFrom.mjs");
/**
* @name addDays
* @category Day Helpers
* @summary Add the specified number of days to the given date.
*
* @description
* Add the specified number of days to the given date.
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The date to be changed
* @param amount - The amount of days to be added.
*
* @returns The new date with the days added
*
* @example
* // Add 10 days to 1 September 2014:
* const result = addDays(new Date(2014, 8, 1), 10)
* //=> Thu Sep 11 2014 00:00:00
*/
function addDays(date, amount) {
const _date = (0,_toDate_mjs__WEBPACK_IMPORTED_MODULE_0__.toDate)(date);
if (isNaN(amount)) return (0,_constructFrom_mjs__WEBPACK_IMPORTED_MODULE_1__.constructFrom)(date, NaN);
if (!amount) {
// If 0 days, no-op to avoid changing times in the hour before end of DST
return _date;
}
_date.setDate(_date.getDate() + amount);
return _date;
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (addDays);
/***/ }),
/***/ "../../node_modules/date-fns/constants.mjs":
/*!*************************************************!*\
!*** ../../node_modules/date-fns/constants.mjs ***!
\*************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ daysInWeek: () => (/* binding */ daysInWeek),
/* harmony export */ daysInYear: () => (/* binding */ daysInYear),
/* harmony export */ maxTime: () => (/* binding */ maxTime),
/* harmony export */ millisecondsInDay: () => (/* binding */ millisecondsInDay),
/* harmony export */ millisecondsInHour: () => (/* binding */ millisecondsInHour),
/* harmony export */ millisecondsInMinute: () => (/* binding */ millisecondsInMinute),
/* harmony export */ millisecondsInSecond: () => (/* binding */ millisecondsInSecond),
/* harmony export */ millisecondsInWeek: () => (/* binding */ millisecondsInWeek),
/* harmony export */ minTime: () => (/* binding */ minTime),
/* harmony export */ minutesInDay: () => (/* binding */ minutesInDay),
/* harmony export */ minutesInHour: () => (/* binding */ minutesInHour),
/* harmony export */ minutesInMonth: () => (/* binding */ minutesInMonth),
/* harmony export */ minutesInYear: () => (/* binding */ minutesInYear),
/* harmony export */ monthsInQuarter: () => (/* binding */ monthsInQuarter),
/* harmony export */ monthsInYear: () => (/* binding */ monthsInYear),
/* harmony export */ quartersInYear: () => (/* binding */ quartersInYear),
/* harmony export */ secondsInDay: () => (/* binding */ secondsInDay),
/* harmony export */ secondsInHour: () => (/* binding */ secondsInHour),
/* harmony export */ secondsInMinute: () => (/* binding */ secondsInMinute),
/* harmony export */ secondsInMonth: () => (/* binding */ secondsInMonth),
/* harmony export */ secondsInQuarter: () => (/* binding */ secondsInQuarter),
/* harmony export */ secondsInWeek: () => (/* binding */ secondsInWeek),
/* harmony export */ secondsInYear: () => (/* binding */ secondsInYear)
/* harmony export */ });
/**
* @module constants
* @summary Useful constants
* @description
* Collection of useful date constants.
*
* The constants could be imported from `date-fns/constants`:
*
* ```ts
* import { maxTime, minTime } from "./constants/date-fns/constants";
*
* function isAllowedTime(time) {
* return time <= maxTime && time >= minTime;
* }
* ```
*/
/**
* @constant
* @name daysInWeek
* @summary Days in 1 week.
*/
const daysInWeek = 7;
/**
* @constant
* @name daysInYear
* @summary Days in 1 year.
*
* @description
* How many days in a year.
*
* One years equals 365.2425 days according to the formula:
*
* > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400.
* > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days
*/
const daysInYear = 365.2425;
/**
* @constant
* @name maxTime
* @summary Maximum allowed time.
*
* @example
* import { maxTime } from "./constants/date-fns/constants";
*
* const isValid = 8640000000000001 <= maxTime;
* //=> false
*
* new Date(8640000000000001);
* //=> Invalid Date
*/
const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;
/**
* @constant
* @name minTime
* @summary Minimum allowed time.
*
* @example
* import { minTime } from "./constants/date-fns/constants";
*
* const isValid = -8640000000000001 >= minTime;
* //=> false
*
* new Date(-8640000000000001)
* //=> Invalid Date
*/
const minTime = -maxTime;
/**
* @constant
* @name millisecondsInWeek
* @summary Milliseconds in 1 week.
*/
const millisecondsInWeek = 604800000;
/**
* @constant
* @name millisecondsInDay
* @summary Milliseconds in 1 day.
*/
const millisecondsInDay = 86400000;
/**
* @constant
* @name millisecondsInMinute
* @summary Milliseconds in 1 minute
*/
const millisecondsInMinute = 60000;
/**
* @constant
* @name millisecondsInHour
* @summary Milliseconds in 1 hour
*/
const millisecondsInHour = 3600000;
/**
* @constant
* @name millisecondsInSecond
* @summary Milliseconds in 1 second
*/
const millisecondsInSecond = 1000;
/**
* @constant
* @name minutesInYear
* @summary Minutes in 1 year.
*/
const minutesInYear = 525600;
/**
* @constant
* @name minutesInMonth
* @summary Minutes in 1 month.
*/
const minutesInMonth = 43200;
/**
* @constant
* @name minutesInDay
* @summary Minutes in 1 day.
*/
const minutesInDay = 1440;
/**
* @constant
* @name minutesInHour
* @summary Minutes in 1 hour.
*/
const minutesInHour = 60;
/**
* @constant
* @name monthsInQuarter
* @summary Months in 1 quarter.
*/
const monthsInQuarter = 3;
/**
* @constant
* @name monthsInYear
* @summary Months in 1 year.
*/
const monthsInYear = 12;
/**
* @constant
* @name quartersInYear
* @summary Quarters in 1 year
*/
const quartersInYear = 4;
/**
* @constant
* @name secondsInHour
* @summary Seconds in 1 hour.
*/
const secondsInHour = 3600;
/**
* @constant
* @name secondsInMinute
* @summary Seconds in 1 minute.
*/
const secondsInMinute = 60;
/**
* @constant
* @name secondsInDay
* @summary Seconds in 1 day.
*/
const secondsInDay = secondsInHour * 24;
/**
* @constant
* @name secondsInWeek
* @summary Seconds in 1 week.
*/
const secondsInWeek = secondsInDay * 7;
/**
* @constant
* @name secondsInYear
* @summary Seconds in 1 year.
*/
const secondsInYear = secondsInDay * daysInYear;
/**
* @constant
* @name secondsInMonth
* @summary Seconds in 1 month
*/
const secondsInMonth = secondsInYear / 12;
/**
* @constant
* @name secondsInQuarter
* @summary Seconds in 1 quarter.
*/
const secondsInQuarter = secondsInMonth * 3;
/***/ }),
/***/ "../../node_modules/date-fns/constructFrom.mjs":
/*!*****************************************************!*\
!*** ../../node_modules/date-fns/constructFrom.mjs ***!
\*****************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ constructFrom: () => (/* binding */ constructFrom),
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/**
* @name constructFrom
* @category Generic Helpers
* @summary Constructs a date using the reference date and the value
*
* @description
* The function constructs a new date using the constructor from the reference
* date and the given value. It helps to build generic functions that accept
* date extensions.
*
* It defaults to `Date` if the passed reference date is a number or a string.
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The reference date to take constructor from
* @param value - The value to create the date
*
* @returns Date initialized using the given date and value
*
* @example
* import { constructFrom } from 'date-fns'
*
* // A function that clones a date preserving the original type
* function cloneDate<DateType extends Date(date: DateType): DateType {
* return constructFrom(
* date, // Use contrustor from the given date
* date.getTime() // Use the date value to create a new date
* )
* }
*/
function constructFrom(date, value) {
if (date instanceof Date) {
return new date.constructor(value);
} else {
return new Date(value);
}
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (constructFrom);
/***/ }),
/***/ "../../node_modules/date-fns/differenceInCalendarDays.mjs":
/*!****************************************************************!*\
!*** ../../node_modules/date-fns/differenceInCalendarDays.mjs ***!
\****************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ differenceInCalendarDays: () => (/* binding */ differenceInCalendarDays)
/* harmony export */ });
/* harmony import */ var _constants_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants.mjs */ "../../node_modules/date-fns/constants.mjs");
/* harmony import */ var _startOfDay_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./startOfDay.mjs */ "../../node_modules/date-fns/startOfDay.mjs");
/* harmony import */ var _lib_getTimezoneOffsetInMilliseconds_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_lib/getTimezoneOffsetInMilliseconds.mjs */ "../../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.mjs");
/**
* @name differenceInCalendarDays
* @category Day Helpers
* @summary Get the number of calendar days between the given dates.
*
* @description
* Get the number of calendar days between the given dates. This means that the times are removed
* from the dates and then the difference in days is calculated.
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param dateLeft - The later date
* @param dateRight - The earlier date
*
* @returns The number of calendar days
*
* @example
* // How many calendar days are between
* // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
* const result = differenceInCalendarDays(
* new Date(2012, 6, 2, 0, 0),
* new Date(2011, 6, 2, 23, 0)
* )
* //=> 366
* // How many calendar days are between
* // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
* const result = differenceInCalendarDays(
* new Date(2011, 6, 3, 0, 1),
* new Date(2011, 6, 2, 23, 59)
* )
* //=> 1
*/
function differenceInCalendarDays(dateLeft, dateRight) {
const startOfDayLeft = (0,_startOfDay_mjs__WEBPACK_IMPORTED_MODULE_0__.startOfDay)(dateLeft);
const startOfDayRight = (0,_startOfDay_mjs__WEBPACK_IMPORTED_MODULE_0__.startOfDay)(dateRight);
const timestampLeft =
+startOfDayLeft - (0,_lib_getTimezoneOffsetInMilliseconds_mjs__WEBPACK_IMPORTED_MODULE_1__.getTimezoneOffsetInMilliseconds)(startOfDayLeft);
const timestampRight =
+startOfDayRight - (0,_lib_getTimezoneOffsetInMilliseconds_mjs__WEBPACK_IMPORTED_MODULE_1__.getTimezoneOffsetInMilliseconds)(startOfDayRight);
// Round the number of days to the nearest integer because the number of
// milliseconds in a day is not constant (e.g. it's different in the week of
// the daylight saving time clock shift).
return Math.round((timestampLeft - timestampRight) / _constants_mjs__WEBPACK_IMPORTED_MODULE_2__.millisecondsInDay);
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (differenceInCalendarDays);
/***/ }),
/***/ "../../node_modules/date-fns/format.mjs":
/*!**********************************************!*\
!*** ../../node_modules/date-fns/format.mjs ***!
\**********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ format: () => (/* binding */ format),
/* harmony export */ formatDate: () => (/* binding */ format),
/* harmony export */ formatters: () => (/* reexport safe */ _lib_format_formatters_mjs__WEBPACK_IMPORTED_MODULE_0__.formatters),
/* harmony export */ longFormatters: () => (/* reexport safe */ _lib_format_longFormatters_mjs__WEBPACK_IMPORTED_MODULE_1__.longFormatters)
/* harmony export */ });
/* harmony import */ var _lib_defaultLocale_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_lib/defaultLocale.mjs */ "../../node_modules/date-fns/locale/en-US.mjs");
/* harmony import */ var _lib_defaultOptions_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_lib/defaultOptions.mjs */ "../../node_modules/date-fns/_lib/defaultOptions.mjs");
/* harmony import */ var _lib_format_formatters_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_lib/format/formatters.mjs */ "../../node_modules/date-fns/_lib/format/formatters.mjs");
/* harmony import */ var _lib_format_longFormatters_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_lib/format/longFormatters.mjs */ "../../node_modules/date-fns/_lib/format/longFormatters.mjs");
/* harmony import */ var _lib_protectedTokens_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./_lib/protectedTokens.mjs */ "../../node_modules/date-fns/_lib/protectedTokens.mjs");
/* harmony import */ var _isValid_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./isValid.mjs */ "../../node_modules/date-fns/isValid.mjs");
/* harmony import */ var _toDate_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./toDate.mjs */ "../../node_modules/date-fns/toDate.mjs");
// Rexports of internal for libraries to use.
// See: https://github.com/date-fns/date-fns/issues/3638#issuecomment-1877082874
// This RegExp consists of three parts separated by `|`:
// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
// (one of the certain letters followed by `o`)
// - (\w)\1* matches any sequences of the same letter
// - '' matches two quote characters in a row
// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
// except a single quote symbol, which ends the sequence.
// Two quote characters do not end the sequence.
// If there is no matching single quote
// then the sequence will continue until the end of the string.
// - . matches any single character unmatched by previous parts of the RegExps
const formattingTokensRegExp =
/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
// This RegExp catches symbols escaped by quotes, and also
// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
const escapedStringRegExp = /^'([^]*?)'?$/;
const doubleQuoteRegExp = /''/g;
const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
/**
* The {@link format} function options.
*/
/**
* @name format
* @alias formatDate
* @category Common Helpers
* @summary Format the date.
*
* @description
* Return the formatted date string in the given format. The result may vary by locale.
*
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
* > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
*
* The characters wrapped between two single quotes characters (') are escaped.
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
* (see the last example)
*
* Format of the string is based on Unicode Technical Standard #35:
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
* with a few additions (see note 7 below the table).
*
* Accepted patterns:
* | Unit | Pattern | Result examples | Notes |
* |---------------------------------|---------|-----------------------------------|-------|
* | Era | G..GGG | AD, BC | |
* | | GGGG | Anno Domini, Before Christ | 2 |
* | | GGGGG | A, B | |
* | Calendar year | y | 44, 1, 1900, 2017 | 5 |
* | | yo | 44th, 1st, 0th, 17th | 5,7 |
* | | yy | 44, 01, 00, 17 | 5 |
* | | yyy | 044, 001, 1900, 2017 | 5 |
* | | yyyy | 0044, 0001, 1900, 2017 | 5 |
* | | yyyyy | ... | 3,5 |
* | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
* | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
* | | YY | 44, 01, 00, 17 | 5,8 |
* | | YYY | 044, 001, 1900, 2017 | 5 |
* | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
* | | YYYYY | ... | 3,5 |
* | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
* | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
* | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
* | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
* | | RRRRR | ... | 3,5,7 |
* | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
* | | uu | -43, 01, 1900, 2017 | 5 |
* | | uuu | -043, 001, 1900, 2017 | 5 |
* | | uuuu | -0043, 0001, 1900, 2017 | 5 |
* | | uuuuu | ... | 3,5 |
* | Quarter (formatting) | Q | 1, 2, 3, 4 | |
* | | Qo | 1st, 2nd, 3rd, 4th | 7 |
* | | QQ | 01, 02, 03, 04 | |
* | | QQQ | Q1, Q2, Q3, Q4 | |
* | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
* | | QQQQQ | 1, 2, 3, 4 | 4 |
* | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
* | | qo | 1st, 2nd, 3rd, 4th | 7 |
* | | qq | 01, 02, 03, 04 | |
* | | qqq | Q1, Q2, Q3, Q4 | |
* | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
* | | qqqqq | 1, 2, 3, 4 | 4 |
* | Month (formatting) | M | 1, 2, ..., 12 | |
* | | Mo | 1st, 2nd, ..., 12th | 7 |
* | | MM | 01, 02, ..., 12 | |
* | | MMM | Jan, Feb, ..., Dec | |
* | | MMMM | January, February, ..., December | 2 |
* | | MMMMM | J, F, ..., D | |
* | Month (stand-alone) | L | 1, 2, ..., 12 | |
* | | Lo | 1st, 2nd, ..., 12th | 7 |
* | | LL | 01, 02, ..., 12 | |
* | | LLL | Jan, Feb, ..., Dec | |
* | | LLLL | January, February, ..., December | 2 |
* | | LLLLL | J, F, ..., D | |
* | Local week of year | w | 1, 2, ..., 53 | |
* | | wo | 1st, 2nd, ..., 53th | 7 |
* | | ww | 01, 02, ..., 53 | |
* | ISO week of year | I | 1, 2, ..., 53 | 7 |
* | | Io | 1st, 2nd, ..., 53th | 7 |
* | | II | 01, 02, ..., 53 | 7 |
* | Day of month | d | 1, 2, ..., 31 | |
* | | do | 1st, 2nd, ..., 31st | 7 |
* | | dd | 01, 02, ..., 31 | |
* | Day of year | D | 1, 2, ..., 365, 366 | 9 |
* | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
* | | DD | 01, 02, ..., 365, 366 | 9 |
* | | DDD | 001, 002, ..., 365, 366 | |
* | | DDDD | ... | 3 |
* | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
* | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
* | | EEEEE | M, T, W, T, F, S, S | |
* | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
* | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
* | | io | 1st, 2nd, ..., 7th | 7 |
* | | ii | 01, 02, ..., 07 | 7 |
* | | iii | Mon, Tue, Wed, ..., Sun | 7 |
* | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
* | | iiiii | M, T, W, T, F, S, S | 7 |
* | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
* | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
* | | eo | 2nd, 3rd, ..., 1st | 7 |
* | | ee | 02, 03, ..., 01 | |
* | | eee | Mon, Tue, Wed, ..., Sun | |
* | | eeee | Monday, Tuesday, ..., Sunday | 2 |
* | | eeeee | M, T, W, T, F, S, S | |
* | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
* | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
* | | co | 2nd, 3rd, ..., 1st | 7 |
* | | cc | 02, 03, ..., 01 | |
* | | ccc | Mon, Tue, Wed, ..., Sun | |
* | | cccc | Monday, Tuesday, ..., Sunday | 2 |
* | | ccccc | M, T, W, T, F, S, S | |
* | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
* | AM, PM | a..aa | AM, PM | |
* | | aaa | am, pm | |
* | | aaaa | a.m., p.m. | 2 |
* | | aaaaa | a, p | |
* | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
* | | bbb | am, pm, noon, midnight | |
* | | bbbb | a.m., p.m., noon, midnight | 2 |
* | | bbbbb | a, p, n, mi | |
* | Flexible day period | B..BBB | at night, in the morning, ... | |
* | | BBBB | at night, in the morning, ... | 2 |
* | | BBBBB | at night, in the morning, ... | |
* | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
* | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
* | | hh | 01, 02, ..., 11, 12 | |
* | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
* | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
* | | HH | 00, 01, 02, ..., 23 | |
* | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
* | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
* | | KK | 01, 02, ..., 11, 00 | |
* | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
* | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
* | | kk | 24, 01, 02, ..., 23 | |
* | Minute | m | 0, 1, ..., 59 | |
* | | mo | 0th, 1st, ..., 59th | 7 |
* | | mm | 00, 01, ..., 59 | |
* | Second | s | 0, 1, ..., 59 | |
* | | so | 0th, 1st, ..., 59th | 7 |
* | | ss | 00, 01, ..., 59 | |
* | Fraction of second | S | 0, 1, ..., 9 | |
* | | SS | 00, 01, ..., 99 | |
* | | SSS | 000, 001, ..., 999 | |
* | | SSSS | ... | 3 |
* | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
* | | XX | -0800, +0530, Z | |
* | | XXX | -08:00, +05:30, Z | |
* | | XXXX | -0800, +0530, Z, +123456 | 2 |
* | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
* | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
* | | xx | -0800, +0530, +0000 | |
* | | xxx | -08:00, +05:30, +00:00 | 2 |
* | | xxxx | -0800, +0530, +0000, +123456 | |
* | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
* | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
* | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
* | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
* | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
* | Seconds timestamp | t | 512969520 | 7 |
* | | tt | ... | 3,7 |
* | Milliseconds timestamp | T | 512969520900 | 7 |
* | | TT | ... | 3,7 |
* | Long localized date | P | 04/29/1453 | 7 |
* | | PP | Apr 29, 1453 | 7 |
* | | PPP | April 29th, 1453 | 7 |
* | | PPPP | Friday, April 29th, 1453 | 2,7 |
* | Long localized time | p | 12:00 AM | 7 |
* | | pp | 12:00:00 AM | 7 |
* | | ppp | 12:00:00 AM GMT+2 | 7 |
* | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
* | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
* | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
* | | PPPppp | April 29th, 1453 at ... | 7 |
* | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
* Notes:
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
* are the same as "stand-alone" units, but are different in some languages.
* "Formatting" units are declined according to the rules of the language
* in the context of a date. "Stand-alone" units are always nominative singular:
*
* `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
*
* `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
*
* 2. Any sequence of the identical letters is a pattern, unless it is escaped by
* the single quote characters (see below).
* If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
* the output will be the same as default pattern for this unit, usually
* the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
* are marked with "2" in the last column of the table.
*
* `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
*
* `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
*
* `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
*
* `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
*
* `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
*
* 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
* The output will be padded with zeros to match the length of the pattern.
*
* `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
*
* 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
* These tokens represent the shortest form of the quarter.
*
* 5. The main difference between `y` and `u` patterns are B.C. years:
*
* | Year | `y` | `u` |
* |------|-----|-----|
* | AC 1 | 1 | 1 |
* | BC 1 | 1 | 0 |
* | BC 2 | 2 | -1 |
*
* Also `yy` always returns the last two digits of a year,
* while `uu` pads single digit years to 2 characters and returns other years unchanged:
*
* | Year | `yy` | `uu` |
* |------|------|------|
* | 1 | 01 | 01 |
* | 14 | 14 | 14 |
* | 376 | 76 | 376 |
* | 1453 | 53 | 1453 |
*
* The same difference is true for local and ISO week-numbering years (`Y` and `R`),
* except local week-numbering years are dependent on `options.weekStartsOn`
* and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)
* and [getWeekYear](https://date-fns.org/docs/getWeekYear)).
*
* 6. Specific non-location timezones are currently unavailable in `date-fns`,
* so right now these tokens fall back to GMT timezones.
*
* 7. These patterns are not in the Unicode Technical Standard #35:
* - `i`: ISO day of week
* - `I`: ISO week of year
* - `R`: ISO week-numbering year
* - `t`: seconds timestamp
* - `T`: milliseconds timestamp
* - `o`: ordinal number modifier
* - `P`: long localized date
* - `p`: long localized time
*
* 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
*
* 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The original date
* @param format - The string of tokens
* @param options - An object with options
*
* @returns The formatted date string
*
* @throws `date` must not be Invalid Date
* @throws `options.locale` must contain `localize` property
* @throws `options.locale` must contain `formatLong` property
* @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* @throws format string contains an unescaped latin alphabet character
*
* @example
* // Represent 11 February 2014 in middle-endian format:
* const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
* //=> '02/11/2014'
*
* @example
* // Represent 2 July 2014 in Esperanto:
* import { eoLocale } from 'date-fns/locale/eo'
* const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
* locale: eoLocale
* })
* //=> '2-a de julio 2014'
*
* @example
* // Escape string by single quote characters:
* const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
* //=> "3 o'clock"
*/
function format(date, formatStr, options) {
const defaultOptions = (0,_lib_defaultOptions_mjs__WEBPACK_IMPORTED_MODULE_2__.getDefaultOptions)();
const locale = options?.locale ?? defaultOptions.locale ?? _lib_defaultLocale_mjs__WEBPACK_IMPORTED_MODULE_3__.enUS;
const firstWeekContainsDate =
options?.firstWeekContainsDate ??
options?.locale?.options?.firstWeekContainsDate ??
defaultOptions.firstWeekContainsDate ??
defaultOptions.locale?.options?.firstWeekContainsDate ??
1;
const weekStartsOn =
options?.weekStartsOn ??
options?.locale?.options?.weekStartsOn ??
defaultOptions.weekStartsOn ??
defaultOptions.locale?.options?.weekStartsOn ??
0;
const originalDate = (0,_toDate_mjs__WEBPACK_IMPORTED_MODULE_4__.toDate)(date);
if (!(0,_isValid_mjs__WEBPACK_IMPORTED_MODULE_5__.isValid)(originalDate)) {
throw new RangeError("Invalid time value");
}
let parts = formatStr
.match(longFormattingTokensRegExp)
.map((substring) => {
const firstCharacter = substring[0];
if (firstCharacter === "p" || firstCharacter === "P") {
const longFormatter = _lib_format_longFormatters_mjs__WEBPACK_IMPORTED_MODULE_1__.longFormatters[firstCharacter];
return longFormatter(substring, locale.formatLong);
}
return substring;
})
.join("")
.match(formattingTokensRegExp)
.map((substring) => {
// Replace two single quote characters with one single quote character
if (substring === "''") {
return { isToken: false, value: "'" };
}
const firstCharacter = substring[0];
if (firstCharacter === "'") {
return { isToken: false, value: cleanEscapedString(substring) };
}
if (_lib_format_formatters_mjs__WEBPACK_IMPORTED_MODULE_0__.formatters[firstCharacter]) {
return { isToken: true, value: substring };
}
if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
throw new RangeError(
"Format string contains an unescaped latin alphabet character `" +
firstCharacter +
"`",
);
}
return { isToken: false, value: substring };
});
// invoke localize preprocessor (only for french locales at the moment)
if (locale.localize.preprocessor) {
parts = locale.localize.preprocessor(originalDate, parts);
}
const formatterOptions = {
firstWeekContainsDate,
weekStartsOn,
locale,
};
return parts
.map((part) => {
if (!part.isToken) return part.value;
const token = part.value;
if (
(!options?.useAdditionalWeekYearTokens &&
(0,_lib_protectedTokens_mjs__WEBPACK_IMPORTED_MODULE_6__.isProtectedWeekYearToken)(token)) ||
(!options?.useAdditionalDayOfYearTokens &&
(0,_lib_protectedTokens_mjs__WEBPACK_IMPORTED_MODULE_6__.isProtectedDayOfYearToken)(token))
) {
(0,_lib_protectedTokens_mjs__WEBPACK_IMPORTED_MODULE_6__.warnOrThrowProtectedError)(token, formatStr, String(date));
}
const formatter = _lib_format_formatters_mjs__WEBPACK_IMPORTED_MODULE_0__.formatters[token[0]];
return formatter(originalDate, token, locale.localize, formatterOptions);
})
.join("");
}
function cleanEscapedString(input) {
const matched = input.match(escapedStringRegExp);
if (!matched) {
return input;
}
return matched[1].replace(doubleQuoteRegExp, "'");
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (format);
/***/ }),
/***/ "../../node_modules/date-fns/getDayOfYear.mjs":
/*!****************************************************!*\
!*** ../../node_modules/date-fns/getDayOfYear.mjs ***!
\****************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ getDayOfYear: () => (/* binding */ getDayOfYear)
/* harmony export */ });
/* harmony import */ var _differenceInCalendarDays_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./differenceInCalendarDays.mjs */ "../../node_modules/date-fns/differenceInCalendarDays.mjs");
/* harmony import */ var _startOfYear_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./startOfYear.mjs */ "../../node_modules/date-fns/startOfYear.mjs");
/* harmony import */ var _toDate_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toDate.mjs */ "../../node_modules/date-fns/toDate.mjs");
/**
* @name getDayOfYear
* @category Day Helpers
* @summary Get the day of the year of the given date.
*
* @description
* Get the day of the year of the given date.
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The given date
*
* @returns The day of year
*
* @example
* // Which day of the year is 2 July 2014?
* const result = getDayOfYear(new Date(2014, 6, 2))
* //=> 183
*/
function getDayOfYear(date) {
const _date = (0,_toDate_mjs__WEBPACK_IMPORTED_MODULE_0__.toDate)(date);
const diff = (0,_differenceInCalendarDays_mjs__WEBPACK_IMPORTED_MODULE_1__.differenceInCalendarDays)(_date, (0,_startOfYear_mjs__WEBPACK_IMPORTED_MODULE_2__.startOfYear)(_date));
const dayOfYear = diff + 1;
return dayOfYear;
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getDayOfYear);
/***/ }),
/***/ "../../node_modules/date-fns/getISOWeek.mjs":
/*!**************************************************!*\
!*** ../../node_modules/date-fns/getISOWeek.mjs ***!
\**************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ getISOWeek: () => (/* binding */ getISOWeek)
/* harmony export */ });
/* harmony import */ var _constants_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants.mjs */ "../../node_modules/date-fns/constants.mjs");
/* harmony import */ var _startOfISOWeek_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./startOfISOWeek.mjs */ "../../node_modules/date-fns/startOfISOWeek.mjs");
/* harmony import */ var _startOfISOWeekYear_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./startOfISOWeekYear.mjs */ "../../node_modules/date-fns/startOfISOWeekYear.mjs");
/* harmony import */ var _toDate_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toDate.mjs */ "../../node_modules/date-fns/toDate.mjs");
/**
* @name getISOWeek
* @category ISO Week Helpers
* @summary Get the ISO week of the given date.
*
* @description
* Get the ISO week of the given date.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The given date
*
* @returns The ISO week
*
* @example
* // Which week of the ISO-week numbering year is 2 January 2005?
* const result = getISOWeek(new Date(2005, 0, 2))
* //=> 53
*/
function getISOWeek(date) {
const _date = (0,_toDate_mjs__WEBPACK_IMPORTED_MODULE_0__.toDate)(date);
const diff = +(0,_startOfISOWeek_mjs__WEBPACK_IMPORTED_MODULE_1__.startOfISOWeek)(_date) - +(0,_startOfISOWeekYear_mjs__WEBPACK_IMPORTED_MODULE_2__.startOfISOWeekYear)(_date);
// Round the number of weeks to the nearest integer because the number of
// milliseconds in a week is not constant (e.g. it's different in the week of
// the daylight saving time clock shift).
return Math.round(diff / _constants_mjs__WEBPACK_IMPORTED_MODULE_3__.millisecondsInWeek) + 1;
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getISOWeek);
/***/ }),
/***/ "../../node_modules/date-fns/getISOWeekYear.mjs":
/*!******************************************************!*\
!*** ../../node_modules/date-fns/getISOWeekYear.mjs ***!
\******************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ getISOWeekYear: () => (/* binding */ getISOWeekYear)
/* harmony export */ });
/* harmony import */ var _constructFrom_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constructFrom.mjs */ "../../node_modules/date-fns/constructFrom.mjs");
/* harmony import */ var _startOfISOWeek_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./startOfISOWeek.mjs */ "../../node_modules/date-fns/startOfISOWeek.mjs");
/* harmony import */ var _toDate_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toDate.mjs */ "../../node_modules/date-fns/toDate.mjs");
/**
* @name getISOWeekYear
* @category ISO Week-Numbering Year Helpers
* @summary Get the ISO week-numbering year of the given date.
*
* @description
* Get the ISO week-numbering year of the given date,
* which always starts 3 days before the year's first Thursday.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The given date
*
* @returns The ISO week-numbering year
*
* @example
* // Which ISO-week numbering year is 2 January 2005?
* const result = getISOWeekYear(new Date(2005, 0, 2))
* //=> 2004
*/
function getISOWeekYear(date) {
const _date = (0,_toDate_mjs__WEBPACK_IMPORTED_MODULE_0__.toDate)(date);
const year = _date.getFullYear();
const fourthOfJanuaryOfNextYear = (0,_constructFrom_mjs__WEBPACK_IMPORTED_MODULE_1__.constructFrom)(date, 0);
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
const startOfNextYear = (0,_startOfISOWeek_mjs__WEBPACK_IMPORTED_MODULE_2__.startOfISOWeek)(fourthOfJanuaryOfNextYear);
const fourthOfJanuaryOfThisYear = (0,_constructFrom_mjs__WEBPACK_IMPORTED_MODULE_1__.constructFrom)(date, 0);
fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
const startOfThisYear = (0,_startOfISOWeek_mjs__WEBPACK_IMPORTED_MODULE_2__.startOfISOWeek)(fourthOfJanuaryOfThisYear);
if (_date.getTime() >= startOfNextYear.getTime()) {
return year + 1;
} else if (_date.getTime() >= startOfThisYear.getTime()) {
return year;
} else {
return year - 1;
}
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getISOWeekYear);
/***/ }),
/***/ "../../node_modules/date-fns/getWeek.mjs":
/*!***********************************************!*\
!*** ../../node_modules/date-fns/getWeek.mjs ***!
\***********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ getWeek: () => (/* binding */ getWeek)
/* harmony export */ });
/* harmony import */ var _constants_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants.mjs */ "../../node_modules/date-fns/constants.mjs");
/* harmony import */ var _startOfWeek_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./startOfWeek.mjs */ "../../node_modules/date-fns/startOfWeek.mjs");
/* harmony import */ var _startOfWeekYear_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./startOfWeekYear.mjs */ "../../node_modules/date-fns/startOfWeekYear.mjs");
/* harmony import */ var _toDate_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toDate.mjs */ "../../node_modules/date-fns/toDate.mjs");
/**
* The {@link getWeek} function options.
*/
/**
* @name getWeek
* @category Week Helpers
* @summary Get the local week index of the given date.
*
* @description
* Get the local week index of the given date.
* The exact calculation depends on the values of
* `options.weekStartsOn` (which is the index of the first day of the week)
* and `options.firstWeekContainsDate` (which is the day of January, which is always in
* the first week of the week-numbering year)
*
* Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The given date
* @param options - An object with options
*
* @returns The week
*
* @example
* // Which week of the local week numbering year is 2 January 2005 with default options?
* const result = getWeek(new Date(2005, 0, 2))
* //=> 2
*
* @example
* // Which week of the local week numbering year is 2 January 2005,
* // if Monday is the first day of the week,
* // and the first week of the year always contains 4 January?
* const result = getWeek(new Date(2005, 0, 2), {
* weekStartsOn: 1,
* firstWeekContainsDate: 4
* })
* //=> 53
*/
function getWeek(date, options) {
const _date = (0,_toDate_mjs__WEBPACK_IMPORTED_MODULE_0__.toDate)(date);
const diff = +(0,_startOfWeek_mjs__WEBPACK_IMPORTED_MODULE_1__.startOfWeek)(_date, options) - +(0,_startOfWeekYear_mjs__WEBPACK_IMPORTED_MODULE_2__.startOfWeekYear)(_date, options);
// Round the number of weeks to the nearest integer because the number of
// milliseconds in a week is not constant (e.g. it's different in the week of
// the daylight saving time clock shift).
return Math.round(diff / _constants_mjs__WEBPACK_IMPORTED_MODULE_3__.millisecondsInWeek) + 1;
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getWeek);
/***/ }),
/***/ "../../node_modules/date-fns/getWeekYear.mjs":
/*!***************************************************!*\
!*** ../../node_modules/date-fns/getWeekYear.mjs ***!
\***************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ getWeekYear: () => (/* binding */ getWeekYear)
/* harmony export */ });
/* harmony import */ var _constructFrom_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constructFrom.mjs */ "../../node_modules/date-fns/constructFrom.mjs");
/* harmony import */ var _startOfWeek_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./startOfWeek.mjs */ "../../node_modules/date-fns/startOfWeek.mjs");
/* harmony import */ var _toDate_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toDate.mjs */ "../../node_modules/date-fns/toDate.mjs");
/* harmony import */ var _lib_defaultOptions_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_lib/defaultOptions.mjs */ "../../node_modules/date-fns/_lib/defaultOptions.mjs");
/**
* The {@link getWeekYear} function options.
*/
/**
* @name getWeekYear
* @category Week-Numbering Year Helpers
* @summary Get the local week-numbering year of the given date.
*
* @description
* Get the local week-numbering year of the given date.
* The exact calculation depends on the values of
* `options.weekStartsOn` (which is the index of the first day of the week)
* and `options.firstWeekContainsDate` (which is the day of January, which is always in
* the first week of the week-numbering year)
*
* Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The given date
* @param options - An object with options.
*
* @returns The local week-numbering year
*
* @example
* // Which week numbering year is 26 December 2004 with the default settings?
* const result = getWeekYear(new Date(2004, 11, 26))
* //=> 2005
*
* @example
* // Which week numbering year is 26 December 2004 if week starts on Saturday?
* const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 })
* //=> 2004
*
* @example
* // Which week numbering year is 26 December 2004 if the first week contains 4 January?
* const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 })
* //=> 2004
*/
function getWeekYear(date, options) {
const _date = (0,_toDate_mjs__WEBPACK_IMPORTED_MODULE_0__.toDate)(date);
const year = _date.getFullYear();
const defaultOptions = (0,_lib_defaultOptions_mjs__WEBPACK_IMPORTED_MODULE_1__.getDefaultOptions)();
const firstWeekContainsDate =
options?.firstWeekContainsDate ??
options?.locale?.options?.firstWeekContainsDate ??
defaultOptions.firstWeekContainsDate ??
defaultOptions.locale?.options?.firstWeekContainsDate ??
1;
const firstWeekOfNextYear = (0,_constructFrom_mjs__WEBPACK_IMPORTED_MODULE_2__.constructFrom)(date, 0);
firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
firstWeekOfNextYear.setHours(0, 0, 0, 0);
const startOfNextYear = (0,_startOfWeek_mjs__WEBPACK_IMPORTED_MODULE_3__.startOfWeek)(firstWeekOfNextYear, options);
const firstWeekOfThisYear = (0,_constructFrom_mjs__WEBPACK_IMPORTED_MODULE_2__.constructFrom)(date, 0);
firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
firstWeekOfThisYear.setHours(0, 0, 0, 0);
const startOfThisYear = (0,_startOfWeek_mjs__WEBPACK_IMPORTED_MODULE_3__.startOfWeek)(firstWeekOfThisYear, options);
if (_date.getTime() >= startOfNextYear.getTime()) {
return year + 1;
} else if (_date.getTime() >= startOfThisYear.getTime()) {
return year;
} else {
return year - 1;
}
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getWeekYear);
/***/ }),
/***/ "../../node_modules/date-fns/isDate.mjs":
/*!**********************************************!*\
!*** ../../node_modules/date-fns/isDate.mjs ***!
\**********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ isDate: () => (/* binding */ isDate)
/* harmony export */ });
/**
* @name isDate
* @category Common Helpers
* @summary Is the given value a date?
*
* @description
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
*
* @param value - The value to check
*
* @returns True if the given value is a date
*
* @example
* // For a valid date:
* const result = isDate(new Date())
* //=> true
*
* @example
* // For an invalid date:
* const result = isDate(new Date(NaN))
* //=> true
*
* @example
* // For some value:
* const result = isDate('2014-02-31')
* //=> false
*
* @example
* // For an object:
* const result = isDate({})
* //=> false
*/
function isDate(value) {
return (
value instanceof Date ||
(typeof value === "object" &&
Object.prototype.toString.call(value) === "[object Date]")
);
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (isDate);
/***/ }),
/***/ "../../node_modules/date-fns/isValid.mjs":
/*!***********************************************!*\
!*** ../../node_modules/date-fns/isValid.mjs ***!
\***********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ isValid: () => (/* binding */ isValid)
/* harmony export */ });
/* harmony import */ var _isDate_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isDate.mjs */ "../../node_modules/date-fns/isDate.mjs");
/* harmony import */ var _toDate_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toDate.mjs */ "../../node_modules/date-fns/toDate.mjs");
/**
* @name isValid
* @category Common Helpers
* @summary Is the given date valid?
*
* @description
* Returns false if argument is Invalid Date and true otherwise.
* Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)
* Invalid Date is a Date, whose time value is NaN.
*
* Time value of Date: http://es5.github.io/#x15.9.1.1
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The date to check
*
* @returns The date is valid
*
* @example
* // For the valid date:
* const result = isValid(new Date(2014, 1, 31))
* //=> true
*
* @example
* // For the value, convertable into a date:
* const result = isValid(1393804800000)
* //=> true
*
* @example
* // For the invalid date:
* const result = isValid(new Date(''))
* //=> false
*/
function isValid(date) {
if (!(0,_isDate_mjs__WEBPACK_IMPORTED_MODULE_0__.isDate)(date) && typeof date !== "number") {
return false;
}
const _date = (0,_toDate_mjs__WEBPACK_IMPORTED_MODULE_1__.toDate)(date);
return !isNaN(Number(_date));
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (isValid);
/***/ }),
/***/ "../../node_modules/date-fns/locale/_lib/buildFormatLongFn.mjs":
/*!*********************************************************************!*\
!*** ../../node_modules/date-fns/locale/_lib/buildFormatLongFn.mjs ***!
\*********************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ buildFormatLongFn: () => (/* binding */ buildFormatLongFn)
/* harmony export */ });
function buildFormatLongFn(args) {
return (options = {}) => {
// TODO: Remove String()
const width = options.width ? String(options.width) : args.defaultWidth;
const format = args.formats[width] || args.formats[args.defaultWidth];
return format;
};
}
/***/ }),
/***/ "../../node_modules/date-fns/locale/_lib/buildLocalizeFn.mjs":
/*!*******************************************************************!*\
!*** ../../node_modules/date-fns/locale/_lib/buildLocalizeFn.mjs ***!
\*******************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ buildLocalizeFn: () => (/* binding */ buildLocalizeFn)
/* harmony export */ });
/* eslint-disable no-unused-vars */
/**
* The localize function argument callback which allows to convert raw value to
* the actual type.
*
* @param value - The value to convert
*
* @returns The converted value
*/
/**
* The map of localized values for each width.
*/
/**
* The index type of the locale unit value. It types conversion of units of
* values that don't start at 0 (i.e. quarters).
*/
/**
* Converts the unit value to the tuple of values.
*/
/**
* The tuple of localized era values. The first element represents BC,
* the second element represents AD.
*/
/**
* The tuple of localized quarter values. The first element represents Q1.
*/
/**
* The tuple of localized day values. The first element represents Sunday.
*/
/**
* The tuple of localized month values. The first element represents January.
*/
function buildLocalizeFn(args) {
return (value, options) => {
const context = options?.context ? String(options.context) : "standalone";
let valuesArray;
if (context === "formatting" && args.formattingValues) {
const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
const width = options?.width ? String(options.width) : defaultWidth;
valuesArray =
args.formattingValues[width] || args.formattingValues[defaultWidth];
} else {
const defaultWidth = args.defaultWidth;
const width = options?.width ? String(options.width) : args.defaultWidth;
valuesArray = args.values[width] || args.values[defaultWidth];
}
const index = args.argumentCallback ? args.argumentCallback(value) : value;
// @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
return valuesArray[index];
};
}
/***/ }),
/***/ "../../node_modules/date-fns/locale/_lib/buildMatchFn.mjs":
/*!****************************************************************!*\
!*** ../../node_modules/date-fns/locale/_lib/buildMatchFn.mjs ***!
\****************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ buildMatchFn: () => (/* binding */ buildMatchFn)
/* harmony export */ });
function buildMatchFn(args) {
return (string, options = {}) => {
const width = options.width;
const matchPattern =
(width && args.matchPatterns[width]) ||
args.matchPatterns[args.defaultMatchWidth];
const matchResult = string.match(matchPattern);
if (!matchResult) {
return null;
}
const matchedString = matchResult[0];
const parsePatterns =
(width && args.parsePatterns[width]) ||
args.parsePatterns[args.defaultParseWidth];
const key = Array.isArray(parsePatterns)
? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))
: // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
findKey(parsePatterns, (pattern) => pattern.test(matchedString));
let value;
value = args.valueCallback ? args.valueCallback(key) : key;
value = options.valueCallback
? // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
options.valueCallback(value)
: value;
const rest = string.slice(matchedString.length);
return { value, rest };
};
}
function findKey(object, predicate) {
for (const key in object) {
if (
Object.prototype.hasOwnProperty.call(object, key) &&
predicate(object[key])
) {
return key;
}
}
return undefined;
}
function findIndex(array, predicate) {
for (let key = 0; key < array.length; key++) {
if (predicate(array[key])) {
return key;
}
}
return undefined;
}
/***/ }),
/***/ "../../node_modules/date-fns/locale/_lib/buildMatchPatternFn.mjs":
/*!***********************************************************************!*\
!*** ../../node_modules/date-fns/locale/_lib/buildMatchPatternFn.mjs ***!
\***********************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ buildMatchPatternFn: () => (/* binding */ buildMatchPatternFn)
/* harmony export */ });
function buildMatchPatternFn(args) {
return (string, options = {}) => {
const matchResult = string.match(args.matchPattern);
if (!matchResult) return null;
const matchedString = matchResult[0];
const parseResult = string.match(args.parsePattern);
if (!parseResult) return null;
let value = args.valueCallback
? args.valueCallback(parseResult[0])
: parseResult[0];
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
value = options.valueCallback ? options.valueCallback(value) : value;
const rest = string.slice(matchedString.length);
return { value, rest };
};
}
/***/ }),
/***/ "../../node_modules/date-fns/locale/en-US.mjs":
/*!****************************************************!*\
!*** ../../node_modules/date-fns/locale/en-US.mjs ***!
\****************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ enUS: () => (/* binding */ enUS)
/* harmony export */ });
/* harmony import */ var _en_US_lib_formatDistance_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./en-US/_lib/formatDistance.mjs */ "../../node_modules/date-fns/locale/en-US/_lib/formatDistance.mjs");
/* harmony import */ var _en_US_lib_formatLong_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./en-US/_lib/formatLong.mjs */ "../../node_modules/date-fns/locale/en-US/_lib/formatLong.mjs");
/* harmony import */ var _en_US_lib_formatRelative_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./en-US/_lib/formatRelative.mjs */ "../../node_modules/date-fns/locale/en-US/_lib/formatRelative.mjs");
/* harmony import */ var _en_US_lib_localize_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./en-US/_lib/localize.mjs */ "../../node_modules/date-fns/locale/en-US/_lib/localize.mjs");
/* harmony import */ var _en_US_lib_match_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./en-US/_lib/match.mjs */ "../../node_modules/date-fns/locale/en-US/_lib/match.mjs");
/**
* @category Locales
* @summary English locale (United States).
* @language English
* @iso-639-2 eng
* @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)
* @author Lesha Koss [@leshakoss](https://github.com/leshakoss)
*/
const enUS = {
code: "en-US",
formatDistance: _en_US_lib_formatDistance_mjs__WEBPACK_IMPORTED_MODULE_0__.formatDistance,
formatLong: _en_US_lib_formatLong_mjs__WEBPACK_IMPORTED_MODULE_1__.formatLong,
formatRelative: _en_US_lib_formatRelative_mjs__WEBPACK_IMPORTED_MODULE_2__.formatRelative,
localize: _en_US_lib_localize_mjs__WEBPACK_IMPORTED_MODULE_3__.localize,
match: _en_US_lib_match_mjs__WEBPACK_IMPORTED_MODULE_4__.match,
options: {
weekStartsOn: 0 /* Sunday */,
firstWeekContainsDate: 1,
},
};
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (enUS);
/***/ }),
/***/ "../../node_modules/date-fns/locale/en-US/_lib/formatDistance.mjs":
/*!************************************************************************!*\
!*** ../../node_modules/date-fns/locale/en-US/_lib/formatDistance.mjs ***!
\************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ formatDistance: () => (/* binding */ formatDistance)
/* harmony export */ });
const formatDistanceLocale = {
lessThanXSeconds: {
one: "less than a second",
other: "less than {{count}} seconds",
},
xSeconds: {
one: "1 second",
other: "{{count}} seconds",
},
halfAMinute: "half a minute",
lessThanXMinutes: {
one: "less than a minute",
other: "less than {{count}} minutes",
},
xMinutes: {
one: "1 minute",
other: "{{count}} minutes",
},
aboutXHours: {
one: "about 1 hour",
other: "about {{count}} hours",
},
xHours: {
one: "1 hour",
other: "{{count}} hours",
},
xDays: {
one: "1 day",
other: "{{count}} days",
},
aboutXWeeks: {
one: "about 1 week",
other: "about {{count}} weeks",
},
xWeeks: {
one: "1 week",
other: "{{count}} weeks",
},
aboutXMonths: {
one: "about 1 month",
other: "about {{count}} months",
},
xMonths: {
one: "1 month",
other: "{{count}} months",
},
aboutXYears: {
one: "about 1 year",
other: "about {{count}} years",
},
xYears: {
one: "1 year",
other: "{{count}} years",
},
overXYears: {
one: "over 1 year",
other: "over {{count}} years",
},
almostXYears: {
one: "almost 1 year",
other: "almost {{count}} years",
},
};
const formatDistance = (token, count, options) => {
let result;
const tokenValue = formatDistanceLocale[token];
if (typeof tokenValue === "string") {
result = tokenValue;
} else if (count === 1) {
result = tokenValue.one;
} else {
result = tokenValue.other.replace("{{count}}", count.toString());
}
if (options?.addSuffix) {
if (options.comparison && options.comparison > 0) {
return "in " + result;
} else {
return result + " ago";
}
}
return result;
};
/***/ }),
/***/ "../../node_modules/date-fns/locale/en-US/_lib/formatLong.mjs":
/*!********************************************************************!*\
!*** ../../node_modules/date-fns/locale/en-US/_lib/formatLong.mjs ***!
\********************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ formatLong: () => (/* binding */ formatLong)
/* harmony export */ });
/* harmony import */ var _lib_buildFormatLongFn_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../_lib/buildFormatLongFn.mjs */ "../../node_modules/date-fns/locale/_lib/buildFormatLongFn.mjs");
const dateFormats = {
full: "EEEE, MMMM do, y",
long: "MMMM do, y",
medium: "MMM d, y",
short: "MM/dd/yyyy",
};
const timeFormats = {
full: "h:mm:ss a zzzz",
long: "h:mm:ss a z",
medium: "h:mm:ss a",
short: "h:mm a",
};
const dateTimeFormats = {
full: "{{date}} 'at' {{time}}",
long: "{{date}} 'at' {{time}}",
medium: "{{date}}, {{time}}",
short: "{{date}}, {{time}}",
};
const formatLong = {
date: (0,_lib_buildFormatLongFn_mjs__WEBPACK_IMPORTED_MODULE_0__.buildFormatLongFn)({
formats: dateFormats,
defaultWidth: "full",
}),
time: (0,_lib_buildFormatLongFn_mjs__WEBPACK_IMPORTED_MODULE_0__.buildFormatLongFn)({
formats: timeFormats,
defaultWidth: "full",
}),
dateTime: (0,_lib_buildFormatLongFn_mjs__WEBPACK_IMPORTED_MODULE_0__.buildFormatLongFn)({
formats: dateTimeFormats,
defaultWidth: "full",
}),
};
/***/ }),
/***/ "../../node_modules/date-fns/locale/en-US/_lib/formatRelative.mjs":
/*!************************************************************************!*\
!*** ../../node_modules/date-fns/locale/en-US/_lib/formatRelative.mjs ***!
\************************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ formatRelative: () => (/* binding */ formatRelative)
/* harmony export */ });
const formatRelativeLocale = {
lastWeek: "'last' eeee 'at' p",
yesterday: "'yesterday at' p",
today: "'today at' p",
tomorrow: "'tomorrow at' p",
nextWeek: "eeee 'at' p",
other: "P",
};
const formatRelative = (token, _date, _baseDate, _options) =>
formatRelativeLocale[token];
/***/ }),
/***/ "../../node_modules/date-fns/locale/en-US/_lib/localize.mjs":
/*!******************************************************************!*\
!*** ../../node_modules/date-fns/locale/en-US/_lib/localize.mjs ***!
\******************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ localize: () => (/* binding */ localize)
/* harmony export */ });
/* harmony import */ var _lib_buildLocalizeFn_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../_lib/buildLocalizeFn.mjs */ "../../node_modules/date-fns/locale/_lib/buildLocalizeFn.mjs");
const eraValues = {
narrow: ["B", "A"],
abbreviated: ["BC", "AD"],
wide: ["Before Christ", "Anno Domini"],
};
const quarterValues = {
narrow: ["1", "2", "3", "4"],
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"],
};
// Note: in English, the names of days of the week and months are capitalized.
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
// Generally, formatted dates should look like they are in the middle of a sentence,
// e.g. in Spanish language the weekdays and months should be in the lowercase.
const monthValues = {
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
abbreviated: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
],
wide: [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
],
};
const dayValues = {
narrow: ["S", "M", "T", "W", "T", "F", "S"],
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
wide: [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
],
};
const dayPeriodValues = {
narrow: {
am: "a",
pm: "p",
midnight: "mi",
noon: "n",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night",
},
abbreviated: {
am: "AM",
pm: "PM",
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night",
},
wide: {
am: "a.m.",
pm: "p.m.",
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night",
},
};
const formattingDayPeriodValues = {
narrow: {
am: "a",
pm: "p",
midnight: "mi",
noon: "n",
morning: "in the morning",
afternoon: "in the afternoon",
evening: "in the evening",
night: "at night",
},
abbreviated: {
am: "AM",
pm: "PM",
midnight: "midnight",
noon: "noon",
morning: "in the morning",
afternoon: "in the afternoon",
evening: "in the evening",
night: "at night",
},
wide: {
am: "a.m.",
pm: "p.m.",
midnight: "midnight",
noon: "noon",
morning: "in the morning",
afternoon: "in the afternoon",
evening: "in the evening",
night: "at night",
},
};
const ordinalNumber = (dirtyNumber, _options) => {
const number = Number(dirtyNumber);
// If ordinal numbers depend on context, for example,
// if they are different for different grammatical genders,
// use `options.unit`.
//
// `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
// 'day', 'hour', 'minute', 'second'.
const rem100 = number % 100;
if (rem100 > 20 || rem100 < 10) {
switch (rem100 % 10) {
case 1:
return number + "st";
case 2:
return number + "nd";
case 3:
return number + "rd";
}
}
return number + "th";
};
const localize = {
ordinalNumber,
era: (0,_lib_buildLocalizeFn_mjs__WEBPACK_IMPORTED_MODULE_0__.buildLocalizeFn)({
values: eraValues,
defaultWidth: "wide",
}),
quarter: (0,_lib_buildLocalizeFn_mjs__WEBPACK_IMPORTED_MODULE_0__.buildLocalizeFn)({
values: quarterValues,
defaultWidth: "wide",
argumentCallback: (quarter) => quarter - 1,
}),
month: (0,_lib_buildLocalizeFn_mjs__WEBPACK_IMPORTED_MODULE_0__.buildLocalizeFn)({
values: monthValues,
defaultWidth: "wide",
}),
day: (0,_lib_buildLocalizeFn_mjs__WEBPACK_IMPORTED_MODULE_0__.buildLocalizeFn)({
values: dayValues,
defaultWidth: "wide",
}),
dayPeriod: (0,_lib_buildLocalizeFn_mjs__WEBPACK_IMPORTED_MODULE_0__.buildLocalizeFn)({
values: dayPeriodValues,
defaultWidth: "wide",
formattingValues: formattingDayPeriodValues,
defaultFormattingWidth: "wide",
}),
};
/***/ }),
/***/ "../../node_modules/date-fns/locale/en-US/_lib/match.mjs":
/*!***************************************************************!*\
!*** ../../node_modules/date-fns/locale/en-US/_lib/match.mjs ***!
\***************************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ match: () => (/* binding */ match)
/* harmony export */ });
/* harmony import */ var _lib_buildMatchFn_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../_lib/buildMatchFn.mjs */ "../../node_modules/date-fns/locale/_lib/buildMatchFn.mjs");
/* harmony import */ var _lib_buildMatchPatternFn_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../_lib/buildMatchPatternFn.mjs */ "../../node_modules/date-fns/locale/_lib/buildMatchPatternFn.mjs");
const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
const parseOrdinalNumberPattern = /\d+/i;
const matchEraPatterns = {
narrow: /^(b|a)/i,
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
wide: /^(before christ|before common era|anno domini|common era)/i,
};
const parseEraPatterns = {
any: [/^b/i, /^(a|c)/i],
};
const matchQuarterPatterns = {
narrow: /^[1234]/i,
abbreviated: /^q[1234]/i,
wide: /^[1234](th|st|nd|rd)? quarter/i,
};
const parseQuarterPatterns = {
any: [/1/i, /2/i, /3/i, /4/i],
};
const matchMonthPatterns = {
narrow: /^[jfmasond]/i,
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i,
};
const parseMonthPatterns = {
narrow: [
/^j/i,
/^f/i,
/^m/i,
/^a/i,
/^m/i,
/^j/i,
/^j/i,
/^a/i,
/^s/i,
/^o/i,
/^n/i,
/^d/i,
],
any: [
/^ja/i,
/^f/i,
/^mar/i,
/^ap/i,
/^may/i,
/^jun/i,
/^jul/i,
/^au/i,
/^s/i,
/^o/i,
/^n/i,
/^d/i,
],
};
const matchDayPatterns = {
narrow: /^[smtwf]/i,
short: /^(su|mo|tu|we|th|fr|sa)/i,
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i,
};
const parseDayPatterns = {
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i],
};
const matchDayPeriodPatterns = {
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i,
};
const parseDayPeriodPatterns = {
any: {
am: /^a/i,
pm: /^p/i,
midnight: /^mi/i,
noon: /^no/i,
morning: /morning/i,
afternoon: /afternoon/i,
evening: /evening/i,
night: /night/i,
},
};
const match = {
ordinalNumber: (0,_lib_buildMatchPatternFn_mjs__WEBPACK_IMPORTED_MODULE_0__.buildMatchPatternFn)({
matchPattern: matchOrdinalNumberPattern,
parsePattern: parseOrdinalNumberPattern,
valueCallback: (value) => parseInt(value, 10),
}),
era: (0,_lib_buildMatchFn_mjs__WEBPACK_IMPORTED_MODULE_1__.buildMatchFn)({
matchPatterns: matchEraPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseEraPatterns,
defaultParseWidth: "any",
}),
quarter: (0,_lib_buildMatchFn_mjs__WEBPACK_IMPORTED_MODULE_1__.buildMatchFn)({
matchPatterns: matchQuarterPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseQuarterPatterns,
defaultParseWidth: "any",
valueCallback: (index) => index + 1,
}),
month: (0,_lib_buildMatchFn_mjs__WEBPACK_IMPORTED_MODULE_1__.buildMatchFn)({
matchPatterns: matchMonthPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseMonthPatterns,
defaultParseWidth: "any",
}),
day: (0,_lib_buildMatchFn_mjs__WEBPACK_IMPORTED_MODULE_1__.buildMatchFn)({
matchPatterns: matchDayPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseDayPatterns,
defaultParseWidth: "any",
}),
dayPeriod: (0,_lib_buildMatchFn_mjs__WEBPACK_IMPORTED_MODULE_1__.buildMatchFn)({
matchPatterns: matchDayPeriodPatterns,
defaultMatchWidth: "any",
parsePatterns: parseDayPeriodPatterns,
defaultParseWidth: "any",
}),
};
/***/ }),
/***/ "../../node_modules/date-fns/parseISO.mjs":
/*!************************************************!*\
!*** ../../node_modules/date-fns/parseISO.mjs ***!
\************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ parseISO: () => (/* binding */ parseISO)
/* harmony export */ });
/* harmony import */ var _constants_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.mjs */ "../../node_modules/date-fns/constants.mjs");
/**
* The {@link parseISO} function options.
*/
/**
* @name parseISO
* @category Common Helpers
* @summary Parse ISO string
*
* @description
* Parse the given string in ISO 8601 format and return an instance of Date.
*
* Function accepts complete ISO 8601 formats as well as partial implementations.
* ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
*
* If the argument isn't a string, the function cannot parse the string or
* the values are invalid, it returns Invalid Date.
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param argument - The value to convert
* @param options - An object with options
*
* @returns The parsed date in the local time zone
*
* @example
* // Convert string '2014-02-11T11:30:30' to date:
* const result = parseISO('2014-02-11T11:30:30')
* //=> Tue Feb 11 2014 11:30:30
*
* @example
* // Convert string '+02014101' to date,
* // if the additional number of digits in the extended year format is 1:
* const result = parseISO('+02014101', { additionalDigits: 1 })
* //=> Fri Apr 11 2014 00:00:00
*/
function parseISO(argument, options) {
const additionalDigits = options?.additionalDigits ?? 2;
const dateStrings = splitDateString(argument);
let date;
if (dateStrings.date) {
const parseYearResult = parseYear(dateStrings.date, additionalDigits);
date = parseDate(parseYearResult.restDateString, parseYearResult.year);
}
if (!date || isNaN(date.getTime())) {
return new Date(NaN);
}
const timestamp = date.getTime();
let time = 0;
let offset;
if (dateStrings.time) {
time = parseTime(dateStrings.time);
if (isNaN(time)) {
return new Date(NaN);
}
}
if (dateStrings.timezone) {
offset = parseTimezone(dateStrings.timezone);
if (isNaN(offset)) {
return new Date(NaN);
}
} else {
const dirtyDate = new Date(timestamp + time);
// JS parsed string assuming it's in UTC timezone
// but we need it to be parsed in our timezone
// so we use utc values to build date in our timezone.
// Year values from 0 to 99 map to the years 1900 to 1999
// so set year explicitly with setFullYear.
const result = new Date(0);
result.setFullYear(
dirtyDate.getUTCFullYear(),
dirtyDate.getUTCMonth(),
dirtyDate.getUTCDate(),
);
result.setHours(
dirtyDate.getUTCHours(),
dirtyDate.getUTCMinutes(),
dirtyDate.getUTCSeconds(),
dirtyDate.getUTCMilliseconds(),
);
return result;
}
return new Date(timestamp + time + offset);
}
const patterns = {
dateTimeDelimiter: /[T ]/,
timeZoneDelimiter: /[Z ]/i,
timezone: /([Z+-].*)$/,
};
const dateRegex =
/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
const timeRegex =
/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
const timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
function splitDateString(dateString) {
const dateStrings = {};
const array = dateString.split(patterns.dateTimeDelimiter);
let timeString;
// The regex match should only return at maximum two array elements.
// [date], [time], or [date, time].
if (array.length > 2) {
return dateStrings;
}
if (/:/.test(array[0])) {
timeString = array[0];
} else {
dateStrings.date = array[0];
timeString = array[1];
if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
timeString = dateString.substr(
dateStrings.date.length,
dateString.length,
);
}
}
if (timeString) {
const token = patterns.timezone.exec(timeString);
if (token) {
dateStrings.time = timeString.replace(token[1], "");
dateStrings.timezone = token[1];
} else {
dateStrings.time = timeString;
}
}
return dateStrings;
}
function parseYear(dateString, additionalDigits) {
const regex = new RegExp(
"^(?:(\\d{4}|[+-]\\d{" +
(4 + additionalDigits) +
"})|(\\d{2}|[+-]\\d{" +
(2 + additionalDigits) +
"})$)",
);
const captures = dateString.match(regex);
// Invalid ISO-formatted year
if (!captures) return { year: NaN, restDateString: "" };
const year = captures[1] ? parseInt(captures[1]) : null;
const century = captures[2] ? parseInt(captures[2]) : null;
// either year or century is null, not both
return {
year: century === null ? year : century * 100,
restDateString: dateString.slice((captures[1] || captures[2]).length),
};
}
function parseDate(dateString, year) {
// Invalid ISO-formatted year
if (year === null) return new Date(NaN);
const captures = dateString.match(dateRegex);
// Invalid ISO-formatted string
if (!captures) return new Date(NaN);
const isWeekDate = !!captures[4];
const dayOfYear = parseDateUnit(captures[1]);
const month = parseDateUnit(captures[2]) - 1;
const day = parseDateUnit(captures[3]);
const week = parseDateUnit(captures[4]);
const dayOfWeek = parseDateUnit(captures[5]) - 1;
if (isWeekDate) {
if (!validateWeekDate(year, week, dayOfWeek)) {
return new Date(NaN);
}
return dayOfISOWeekYear(year, week, dayOfWeek);
} else {
const date = new Date(0);
if (
!validateDate(year, month, day) ||
!validateDayOfYearDate(year, dayOfYear)
) {
return new Date(NaN);
}
date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
return date;
}
}
function parseDateUnit(value) {
return value ? parseInt(value) : 1;
}
function parseTime(timeString) {
const captures = timeString.match(timeRegex);
if (!captures) return NaN; // Invalid ISO-formatted time
const hours = parseTimeUnit(captures[1]);
const minutes = parseTimeUnit(captures[2]);
const seconds = parseTimeUnit(captures[3]);
if (!validateTime(hours, minutes, seconds)) {
return NaN;
}
return (
hours * _constants_mjs__WEBPACK_IMPORTED_MODULE_0__.millisecondsInHour + minutes * _constants_mjs__WEBPACK_IMPORTED_MODULE_0__.millisecondsInMinute + seconds * 1000
);
}
function parseTimeUnit(value) {
return (value && parseFloat(value.replace(",", "."))) || 0;
}
function parseTimezone(timezoneString) {
if (timezoneString === "Z") return 0;
const captures = timezoneString.match(timezoneRegex);
if (!captures) return 0;
const sign = captures[1] === "+" ? -1 : 1;
const hours = parseInt(captures[2]);
const minutes = (captures[3] && parseInt(captures[3])) || 0;
if (!validateTimezone(hours, minutes)) {
return NaN;
}
return sign * (hours * _constants_mjs__WEBPACK_IMPORTED_MODULE_0__.millisecondsInHour + minutes * _constants_mjs__WEBPACK_IMPORTED_MODULE_0__.millisecondsInMinute);
}
function dayOfISOWeekYear(isoWeekYear, week, day) {
const date = new Date(0);
date.setUTCFullYear(isoWeekYear, 0, 4);
const fourthOfJanuaryDay = date.getUTCDay() || 7;
const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
date.setUTCDate(date.getUTCDate() + diff);
return date;
}
// Validation functions
// February is null to handle the leap year (using ||)
const daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
function isLeapYearIndex(year) {
return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0);
}
function validateDate(year, month, date) {
return (
month >= 0 &&
month <= 11 &&
date >= 1 &&
date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28))
);
}
function validateDayOfYearDate(year, dayOfYear) {
return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
}
function validateWeekDate(_year, week, day) {
return week >= 1 && week <= 53 && day >= 0 && day <= 6;
}
function validateTime(hours, minutes, seconds) {
if (hours === 24) {
return minutes === 0 && seconds === 0;
}
return (
seconds >= 0 &&
seconds < 60 &&
minutes >= 0 &&
minutes < 60 &&
hours >= 0 &&
hours < 25
);
}
function validateTimezone(_hours, minutes) {
return minutes >= 0 && minutes <= 59;
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (parseISO);
/***/ }),
/***/ "../../node_modules/date-fns/startOfDay.mjs":
/*!**************************************************!*\
!*** ../../node_modules/date-fns/startOfDay.mjs ***!
\**************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ startOfDay: () => (/* binding */ startOfDay)
/* harmony export */ });
/* harmony import */ var _toDate_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toDate.mjs */ "../../node_modules/date-fns/toDate.mjs");
/**
* @name startOfDay
* @category Day Helpers
* @summary Return the start of a day for the given date.
*
* @description
* Return the start of a day for the given date.
* The result will be in the local timezone.
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The original date
*
* @returns The start of a day
*
* @example
* // The start of a day for 2 September 2014 11:55:00:
* const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
* //=> Tue Sep 02 2014 00:00:00
*/
function startOfDay(date) {
const _date = (0,_toDate_mjs__WEBPACK_IMPORTED_MODULE_0__.toDate)(date);
_date.setHours(0, 0, 0, 0);
return _date;
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (startOfDay);
/***/ }),
/***/ "../../node_modules/date-fns/startOfISOWeek.mjs":
/*!******************************************************!*\
!*** ../../node_modules/date-fns/startOfISOWeek.mjs ***!
\******************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ startOfISOWeek: () => (/* binding */ startOfISOWeek)
/* harmony export */ });
/* harmony import */ var _startOfWeek_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./startOfWeek.mjs */ "../../node_modules/date-fns/startOfWeek.mjs");
/**
* @name startOfISOWeek
* @category ISO Week Helpers
* @summary Return the start of an ISO week for the given date.
*
* @description
* Return the start of an ISO week for the given date.
* The result will be in the local timezone.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The original date
*
* @returns The start of an ISO week
*
* @example
* // The start of an ISO week for 2 September 2014 11:55:00:
* const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
* //=> Mon Sep 01 2014 00:00:00
*/
function startOfISOWeek(date) {
return (0,_startOfWeek_mjs__WEBPACK_IMPORTED_MODULE_0__.startOfWeek)(date, { weekStartsOn: 1 });
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (startOfISOWeek);
/***/ }),
/***/ "../../node_modules/date-fns/startOfISOWeekYear.mjs":
/*!**********************************************************!*\
!*** ../../node_modules/date-fns/startOfISOWeekYear.mjs ***!
\**********************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ startOfISOWeekYear: () => (/* binding */ startOfISOWeekYear)
/* harmony export */ });
/* harmony import */ var _getISOWeekYear_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getISOWeekYear.mjs */ "../../node_modules/date-fns/getISOWeekYear.mjs");
/* harmony import */ var _startOfISOWeek_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./startOfISOWeek.mjs */ "../../node_modules/date-fns/startOfISOWeek.mjs");
/* harmony import */ var _constructFrom_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constructFrom.mjs */ "../../node_modules/date-fns/constructFrom.mjs");
/**
* @name startOfISOWeekYear
* @category ISO Week-Numbering Year Helpers
* @summary Return the start of an ISO week-numbering year for the given date.
*
* @description
* Return the start of an ISO week-numbering year,
* which always starts 3 days before the year's first Thursday.
* The result will be in the local timezone.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The original date
*
* @returns The start of an ISO week-numbering year
*
* @example
* // The start of an ISO week-numbering year for 2 July 2005:
* const result = startOfISOWeekYear(new Date(2005, 6, 2))
* //=> Mon Jan 03 2005 00:00:00
*/
function startOfISOWeekYear(date) {
const year = (0,_getISOWeekYear_mjs__WEBPACK_IMPORTED_MODULE_0__.getISOWeekYear)(date);
const fourthOfJanuary = (0,_constructFrom_mjs__WEBPACK_IMPORTED_MODULE_1__.constructFrom)(date, 0);
fourthOfJanuary.setFullYear(year, 0, 4);
fourthOfJanuary.setHours(0, 0, 0, 0);
return (0,_startOfISOWeek_mjs__WEBPACK_IMPORTED_MODULE_2__.startOfISOWeek)(fourthOfJanuary);
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (startOfISOWeekYear);
/***/ }),
/***/ "../../node_modules/date-fns/startOfWeek.mjs":
/*!***************************************************!*\
!*** ../../node_modules/date-fns/startOfWeek.mjs ***!
\***************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ startOfWeek: () => (/* binding */ startOfWeek)
/* harmony export */ });
/* harmony import */ var _toDate_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toDate.mjs */ "../../node_modules/date-fns/toDate.mjs");
/* harmony import */ var _lib_defaultOptions_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_lib/defaultOptions.mjs */ "../../node_modules/date-fns/_lib/defaultOptions.mjs");
/**
* The {@link startOfWeek} function options.
*/
/**
* @name startOfWeek
* @category Week Helpers
* @summary Return the start of a week for the given date.
*
* @description
* Return the start of a week for the given date.
* The result will be in the local timezone.
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The original date
* @param options - An object with options
*
* @returns The start of a week
*
* @example
* // The start of a week for 2 September 2014 11:55:00:
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
* //=> Sun Aug 31 2014 00:00:00
*
* @example
* // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
* //=> Mon Sep 01 2014 00:00:00
*/
function startOfWeek(date, options) {
const defaultOptions = (0,_lib_defaultOptions_mjs__WEBPACK_IMPORTED_MODULE_0__.getDefaultOptions)();
const weekStartsOn =
options?.weekStartsOn ??
options?.locale?.options?.weekStartsOn ??
defaultOptions.weekStartsOn ??
defaultOptions.locale?.options?.weekStartsOn ??
0;
const _date = (0,_toDate_mjs__WEBPACK_IMPORTED_MODULE_1__.toDate)(date);
const day = _date.getDay();
const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
_date.setDate(_date.getDate() - diff);
_date.setHours(0, 0, 0, 0);
return _date;
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (startOfWeek);
/***/ }),
/***/ "../../node_modules/date-fns/startOfWeekYear.mjs":
/*!*******************************************************!*\
!*** ../../node_modules/date-fns/startOfWeekYear.mjs ***!
\*******************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ startOfWeekYear: () => (/* binding */ startOfWeekYear)
/* harmony export */ });
/* harmony import */ var _constructFrom_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constructFrom.mjs */ "../../node_modules/date-fns/constructFrom.mjs");
/* harmony import */ var _getWeekYear_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getWeekYear.mjs */ "../../node_modules/date-fns/getWeekYear.mjs");
/* harmony import */ var _startOfWeek_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./startOfWeek.mjs */ "../../node_modules/date-fns/startOfWeek.mjs");
/* harmony import */ var _lib_defaultOptions_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_lib/defaultOptions.mjs */ "../../node_modules/date-fns/_lib/defaultOptions.mjs");
/**
* The {@link startOfWeekYear} function options.
*/
/**
* @name startOfWeekYear
* @category Week-Numbering Year Helpers
* @summary Return the start of a local week-numbering year for the given date.
*
* @description
* Return the start of a local week-numbering year.
* The exact calculation depends on the values of
* `options.weekStartsOn` (which is the index of the first day of the week)
* and `options.firstWeekContainsDate` (which is the day of January, which is always in
* the first week of the week-numbering year)
*
* Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The original date
* @param options - An object with options
*
* @returns The start of a week-numbering year
*
* @example
* // The start of an a week-numbering year for 2 July 2005 with default settings:
* const result = startOfWeekYear(new Date(2005, 6, 2))
* //=> Sun Dec 26 2004 00:00:00
*
* @example
* // The start of a week-numbering year for 2 July 2005
* // if Monday is the first day of week
* // and 4 January is always in the first week of the year:
* const result = startOfWeekYear(new Date(2005, 6, 2), {
* weekStartsOn: 1,
* firstWeekContainsDate: 4
* })
* //=> Mon Jan 03 2005 00:00:00
*/
function startOfWeekYear(date, options) {
const defaultOptions = (0,_lib_defaultOptions_mjs__WEBPACK_IMPORTED_MODULE_0__.getDefaultOptions)();
const firstWeekContainsDate =
options?.firstWeekContainsDate ??
options?.locale?.options?.firstWeekContainsDate ??
defaultOptions.firstWeekContainsDate ??
defaultOptions.locale?.options?.firstWeekContainsDate ??
1;
const year = (0,_getWeekYear_mjs__WEBPACK_IMPORTED_MODULE_1__.getWeekYear)(date, options);
const firstWeek = (0,_constructFrom_mjs__WEBPACK_IMPORTED_MODULE_2__.constructFrom)(date, 0);
firstWeek.setFullYear(year, 0, firstWeekContainsDate);
firstWeek.setHours(0, 0, 0, 0);
const _date = (0,_startOfWeek_mjs__WEBPACK_IMPORTED_MODULE_3__.startOfWeek)(firstWeek, options);
return _date;
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (startOfWeekYear);
/***/ }),
/***/ "../../node_modules/date-fns/startOfYear.mjs":
/*!***************************************************!*\
!*** ../../node_modules/date-fns/startOfYear.mjs ***!
\***************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ startOfYear: () => (/* binding */ startOfYear)
/* harmony export */ });
/* harmony import */ var _toDate_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toDate.mjs */ "../../node_modules/date-fns/toDate.mjs");
/* harmony import */ var _constructFrom_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constructFrom.mjs */ "../../node_modules/date-fns/constructFrom.mjs");
/**
* @name startOfYear
* @category Year Helpers
* @summary Return the start of a year for the given date.
*
* @description
* Return the start of a year for the given date.
* The result will be in the local timezone.
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The original date
*
* @returns The start of a year
*
* @example
* // The start of a year for 2 September 2014 11:55:00:
* const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))
* //=> Wed Jan 01 2014 00:00:00
*/
function startOfYear(date) {
const cleanDate = (0,_toDate_mjs__WEBPACK_IMPORTED_MODULE_0__.toDate)(date);
const _date = (0,_constructFrom_mjs__WEBPACK_IMPORTED_MODULE_1__.constructFrom)(date, 0);
_date.setFullYear(cleanDate.getFullYear(), 0, 1);
_date.setHours(0, 0, 0, 0);
return _date;
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (startOfYear);
/***/ }),
/***/ "../../node_modules/date-fns/subDays.mjs":
/*!***********************************************!*\
!*** ../../node_modules/date-fns/subDays.mjs ***!
\***********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ subDays: () => (/* binding */ subDays)
/* harmony export */ });
/* harmony import */ var _addDays_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addDays.mjs */ "../../node_modules/date-fns/addDays.mjs");
/**
* @name subDays
* @category Day Helpers
* @summary Subtract the specified number of days from the given date.
*
* @description
* Subtract the specified number of days from the given date.
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The date to be changed
* @param amount - The amount of days to be subtracted.
*
* @returns The new date with the days subtracted
*
* @example
* // Subtract 10 days from 1 September 2014:
* const result = subDays(new Date(2014, 8, 1), 10)
* //=> Fri Aug 22 2014 00:00:00
*/
function subDays(date, amount) {
return (0,_addDays_mjs__WEBPACK_IMPORTED_MODULE_0__.addDays)(date, -amount);
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (subDays);
/***/ }),
/***/ "../../node_modules/date-fns/toDate.mjs":
/*!**********************************************!*\
!*** ../../node_modules/date-fns/toDate.mjs ***!
\**********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ toDate: () => (/* binding */ toDate)
/* harmony export */ });
/**
* @name toDate
* @category Common Helpers
* @summary Convert the given argument to an instance of Date.
*
* @description
* Convert the given argument to an instance of Date.
*
* If the argument is an instance of Date, the function returns its clone.
*
* If the argument is a number, it is treated as a timestamp.
*
* If the argument is none of the above, the function returns Invalid Date.
*
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param argument - The value to convert
*
* @returns The parsed date in the local time zone
*
* @example
* // Clone the date:
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
* //=> Tue Feb 11 2014 11:30:30
*
* @example
* // Convert the timestamp to date:
* const result = toDate(1392098430000)
* //=> Tue Feb 11 2014 11:30:30
*/
function toDate(argument) {
const argStr = Object.prototype.toString.call(argument);
// Clone the date
if (
argument instanceof Date ||
(typeof argument === "object" && argStr === "[object Date]")
) {
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
return new argument.constructor(+argument);
} else if (
typeof argument === "number" ||
argStr === "[object Number]" ||
typeof argument === "string" ||
argStr === "[object String]"
) {
// TODO: Can we get rid of as?
return new Date(argument);
} else {
// TODO: Can we get rid of as?
return new Date(NaN);
}
}
// Fallback for modularized imports:
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (toDate);
/***/ }),
/***/ "../../node_modules/invariant/browser.js":
/*!***********************************************!*\
!*** ../../node_modules/invariant/browser.js ***!
\***********************************************/
/***/ ((module) => {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var invariant = function(condition, format, a, b, c, d, e, f) {
if (true) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
}
if (!condition) {
var error;
if (format === undefined) {
error = new Error(
'Minified exception occurred; use the non-minified dev environment ' +
'for the full error message and additional helpful warnings.'
);
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(
format.replace(/%s/g, function() { return args[argIndex++]; })
);
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
};
module.exports = invariant;
/***/ }),
/***/ "../../node_modules/react/cjs/react-jsx-runtime.development.js":
/*!*********************************************************************!*\
!*** ../../node_modules/react/cjs/react-jsx-runtime.development.js ***!
\*********************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (true) {
(function() {
'use strict';
var React = __webpack_require__(/*! react */ "react");
// ATTENTION
// When adding new symbols to this file,
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
// The Symbol used to tag the ReactElement-like types.
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
var REACT_MEMO_TYPE = Symbol.for('react.memo');
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator';
function getIteratorFn(maybeIterable) {
if (maybeIterable === null || typeof maybeIterable !== 'object') {
return null;
}
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
if (typeof maybeIterator === 'function') {
return maybeIterator;
}
return null;
}
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function error(format) {
{
{
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
printWarning('error', format, args);
}
}
}
function printWarning(level, format, args) {
// When changing this logic, you might want to also
// update consoleWithStackDev.www.js as well.
{
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
var stack = ReactDebugCurrentFrame.getStackAddendum();
if (stack !== '') {
format += '%s';
args = args.concat([stack]);
} // eslint-disable-next-line react-internal/safe-string-coercion
var argsWithFormat = args.map(function (item) {
return String(item);
}); // Careful: RN currently depends on this prefix
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
// breaks IE9: https://github.com/facebook/react/issues/13610
// eslint-disable-next-line react-internal/no-production-logging
Function.prototype.apply.call(console[level], console, argsWithFormat);
}
}
// -----------------------------------------------------------------------------
var enableScopeAPI = false; // Experimental Create Event Handle API.
var enableCacheElement = false;
var enableTransitionTracing = false; // No known bugs, but needs performance testing
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
// stuff. Intended to enable React core members to more easily debug scheduling
// issues in DEV builds.
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
var REACT_MODULE_REFERENCE;
{
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
}
function isValidElementType(type) {
if (typeof type === 'string' || typeof type === 'function') {
return true;
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
return true;
}
if (typeof type === 'object' && type !== null) {
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
return true;
}
}
return false;
}
function getWrappedName(outerType, innerType, wrapperName) {
var displayName = outerType.displayName;
if (displayName) {
return displayName;
}
var functionName = innerType.displayName || innerType.name || '';
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
} // Keep in sync with react-reconciler/getComponentNameFromFiber
function getContextName(type) {
return type.displayName || 'Context';
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
function getComponentNameFromType(type) {
if (type == null) {
// Host root, text node or just invalid type.
return null;
}
{
if (typeof type.tag === 'number') {
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
}
}
if (typeof type === 'function') {
return type.displayName || type.name || null;
}
if (typeof type === 'string') {
return type;
}
switch (type) {
case REACT_FRAGMENT_TYPE:
return 'Fragment';
case REACT_PORTAL_TYPE:
return 'Portal';
case REACT_PROFILER_TYPE:
return 'Profiler';
case REACT_STRICT_MODE_TYPE:
return 'StrictMode';
case REACT_SUSPENSE_TYPE:
return 'Suspense';
case REACT_SUSPENSE_LIST_TYPE:
return 'SuspenseList';
}
if (typeof type === 'object') {
switch (type.$$typeof) {
case REACT_CONTEXT_TYPE:
var context = type;
return getContextName(context) + '.Consumer';
case REACT_PROVIDER_TYPE:
var provider = type;
return getContextName(provider._context) + '.Provider';
case REACT_FORWARD_REF_TYPE:
return getWrappedName(type, type.render, 'ForwardRef');
case REACT_MEMO_TYPE:
var outerName = type.displayName || null;
if (outerName !== null) {
return outerName;
}
return getComponentNameFromType(type.type) || 'Memo';
case REACT_LAZY_TYPE:
{
var lazyComponent = type;
var payload = lazyComponent._payload;
var init = lazyComponent._init;
try {
return getComponentNameFromType(init(payload));
} catch (x) {
return null;
}
}
// eslint-disable-next-line no-fallthrough
}
}
return null;
}
var assign = Object.assign;
// Helpers to patch console.logs to avoid logging during side-effect free
// replaying on render function. This currently only patches the object
// lazily which won't cover if the log function was extracted eagerly.
// We could also eagerly patch the method.
var disabledDepth = 0;
var prevLog;
var prevInfo;
var prevWarn;
var prevError;
var prevGroup;
var prevGroupCollapsed;
var prevGroupEnd;
function disabledLog() {}
disabledLog.__reactDisabledLog = true;
function disableLogs() {
{
if (disabledDepth === 0) {
/* eslint-disable react-internal/no-production-logging */
prevLog = console.log;
prevInfo = console.info;
prevWarn = console.warn;
prevError = console.error;
prevGroup = console.group;
prevGroupCollapsed = console.groupCollapsed;
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
var props = {
configurable: true,
enumerable: true,
value: disabledLog,
writable: true
}; // $FlowFixMe Flow thinks console is immutable.
Object.defineProperties(console, {
info: props,
log: props,
warn: props,
error: props,
group: props,
groupCollapsed: props,
groupEnd: props
});
/* eslint-enable react-internal/no-production-logging */
}
disabledDepth++;
}
}
function reenableLogs() {
{
disabledDepth--;
if (disabledDepth === 0) {
/* eslint-disable react-internal/no-production-logging */
var props = {
configurable: true,
enumerable: true,
writable: true
}; // $FlowFixMe Flow thinks console is immutable.
Object.defineProperties(console, {
log: assign({}, props, {
value: prevLog
}),
info: assign({}, props, {
value: prevInfo
}),
warn: assign({}, props, {
value: prevWarn
}),
error: assign({}, props, {
value: prevError
}),
group: assign({}, props, {
value: prevGroup
}),
groupCollapsed: assign({}, props, {
value: prevGroupCollapsed
}),
groupEnd: assign({}, props, {
value: prevGroupEnd
})
});
/* eslint-enable react-internal/no-production-logging */
}
if (disabledDepth < 0) {
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
}
}
}
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
var prefix;
function describeBuiltInComponentFrame(name, source, ownerFn) {
{
if (prefix === undefined) {
// Extract the VM specific prefix used by each line.
try {
throw Error();
} catch (x) {
var match = x.stack.trim().match(/\n( *(at )?)/);
prefix = match && match[1] || '';
}
} // We use the prefix to ensure our stacks line up with native stack frames.
return '\n' + prefix + name;
}
}
var reentry = false;
var componentFrameCache;
{
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
componentFrameCache = new PossiblyWeakMap();
}
function describeNativeComponentFrame(fn, construct) {
// If something asked for a stack inside a fake render, it should get ignored.
if ( !fn || reentry) {
return '';
}
{
var frame = componentFrameCache.get(fn);
if (frame !== undefined) {
return frame;
}
}
var control;
reentry = true;
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
Error.prepareStackTrace = undefined;
var previousDispatcher;
{
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
// for warnings.
ReactCurrentDispatcher.current = null;
disableLogs();
}
try {
// This should throw.
if (construct) {
// Something should be setting the props in the constructor.
var Fake = function () {
throw Error();
}; // $FlowFixMe
Object.defineProperty(Fake.prototype, 'props', {
set: function () {
// We use a throwing setter instead of frozen or non-writable props
// because that won't throw in a non-strict mode function.
throw Error();
}
});
if (typeof Reflect === 'object' && Reflect.construct) {
// We construct a different control for this case to include any extra
// frames added by the construct call.
try {
Reflect.construct(Fake, []);
} catch (x) {
control = x;
}
Reflect.construct(fn, [], Fake);
} else {
try {
Fake.call();
} catch (x) {
control = x;
}
fn.call(Fake.prototype);
}
} else {
try {
throw Error();
} catch (x) {
control = x;
}
fn();
}
} catch (sample) {
// This is inlined manually because closure doesn't do it for us.
if (sample && control && typeof sample.stack === 'string') {
// This extracts the first frame from the sample that isn't also in the control.
// Skipping one frame that we assume is the frame that calls the two.
var sampleLines = sample.stack.split('\n');
var controlLines = control.stack.split('\n');
var s = sampleLines.length - 1;
var c = controlLines.length - 1;
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
// We expect at least one stack frame to be shared.
// Typically this will be the root most one. However, stack frames may be
// cut off due to maximum stack limits. In this case, one maybe cut off
// earlier than the other. We assume that the sample is longer or the same
// and there for cut off earlier. So we should find the root most frame in
// the sample somewhere in the control.
c--;
}
for (; s >= 1 && c >= 0; s--, c--) {
// Next we find the first one that isn't the same which should be the
// frame that called our sample function and the control.
if (sampleLines[s] !== controlLines[c]) {
// In V8, the first line is describing the message but other VMs don't.
// If we're about to return the first line, and the control is also on the same
// line, that's a pretty good indicator that our sample threw at same line as
// the control. I.e. before we entered the sample frame. So we ignore this result.
// This can happen if you passed a class to function component, or non-function.
if (s !== 1 || c !== 1) {
do {
s--;
c--; // We may still have similar intermediate frames from the construct call.
// The next one that isn't the same should be our match though.
if (c < 0 || sampleLines[s] !== controlLines[c]) {
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
// but we have a user-provided "displayName"
// splice it in to make the stack more readable.
if (fn.displayName && _frame.includes('<anonymous>')) {
_frame = _frame.replace('<anonymous>', fn.displayName);
}
{
if (typeof fn === 'function') {
componentFrameCache.set(fn, _frame);
}
} // Return the line we found.
return _frame;
}
} while (s >= 1 && c >= 0);
}
break;
}
}
}
} finally {
reentry = false;
{
ReactCurrentDispatcher.current = previousDispatcher;
reenableLogs();
}
Error.prepareStackTrace = previousPrepareStackTrace;
} // Fallback to just using the name if we couldn't make it throw.
var name = fn ? fn.displayName || fn.name : '';
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
{
if (typeof fn === 'function') {
componentFrameCache.set(fn, syntheticFrame);
}
}
return syntheticFrame;
}
function describeFunctionComponentFrame(fn, source, ownerFn) {
{
return describeNativeComponentFrame(fn, false);
}
}
function shouldConstruct(Component) {
var prototype = Component.prototype;
return !!(prototype && prototype.isReactComponent);
}
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
if (type == null) {
return '';
}
if (typeof type === 'function') {
{
return describeNativeComponentFrame(type, shouldConstruct(type));
}
}
if (typeof type === 'string') {
return describeBuiltInComponentFrame(type);
}
switch (type) {
case REACT_SUSPENSE_TYPE:
return describeBuiltInComponentFrame('Suspense');
case REACT_SUSPENSE_LIST_TYPE:
return describeBuiltInComponentFrame('SuspenseList');
}
if (typeof type === 'object') {
switch (type.$$typeof) {
case REACT_FORWARD_REF_TYPE:
return describeFunctionComponentFrame(type.render);
case REACT_MEMO_TYPE:
// Memo may contain any component type so we recursively resolve it.
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
case REACT_LAZY_TYPE:
{
var lazyComponent = type;
var payload = lazyComponent._payload;
var init = lazyComponent._init;
try {
// Lazy may contain any component type so we recursively resolve it.
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
} catch (x) {}
}
}
}
return '';
}
var hasOwnProperty = Object.prototype.hasOwnProperty;
var loggedTypeFailures = {};
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
function setCurrentlyValidatingElement(element) {
{
if (element) {
var owner = element._owner;
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
ReactDebugCurrentFrame.setExtraStackFrame(stack);
} else {
ReactDebugCurrentFrame.setExtraStackFrame(null);
}
}
}
function checkPropTypes(typeSpecs, values, location, componentName, element) {
{
// $FlowFixMe This is okay but Flow doesn't know it.
var has = Function.call.bind(hasOwnProperty);
for (var typeSpecName in typeSpecs) {
if (has(typeSpecs, typeSpecName)) {
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
if (typeof typeSpecs[typeSpecName] !== 'function') {
// eslint-disable-next-line react-internal/prod-error-codes
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
err.name = 'Invariant Violation';
throw err;
}
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
} catch (ex) {
error$1 = ex;
}
if (error$1 && !(error$1 instanceof Error)) {
setCurrentlyValidatingElement(element);
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
setCurrentlyValidatingElement(null);
}
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error$1.message] = true;
setCurrentlyValidatingElement(element);
error('Failed %s type: %s', location, error$1.message);
setCurrentlyValidatingElement(null);
}
}
}
}
}
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
function isArray(a) {
return isArrayImpl(a);
}
/*
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
*
* The functions in this module will throw an easier-to-understand,
* easier-to-debug exception with a clear errors message message explaining the
* problem. (Instead of a confusing exception thrown inside the implementation
* of the `value` object).
*/
// $FlowFixMe only called in DEV, so void return is not possible.
function typeName(value) {
{
// toStringTag is needed for namespaced types like Temporal.Instant
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
return type;
}
} // $FlowFixMe only called in DEV, so void return is not possible.
function willCoercionThrow(value) {
{
try {
testStringCoercion(value);
return false;
} catch (e) {
return true;
}
}
}
function testStringCoercion(value) {
// If you ended up here by following an exception call stack, here's what's
// happened: you supplied an object or symbol value to React (as a prop, key,
// DOM attribute, CSS property, string ref, etc.) and when React tried to
// coerce it to a string using `'' + value`, an exception was thrown.
//
// The most common types that will cause this exception are `Symbol` instances
// and Temporal objects like `Temporal.Instant`. But any object that has a
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
// exception. (Library authors do this to prevent users from using built-in
// numeric operators like `+` or comparison operators like `>=` because custom
// methods are needed to perform accurate arithmetic or comparison.)
//
// To fix the problem, coerce this object or symbol value to a string before
// passing it to React. The most reliable way is usually `String(value)`.
//
// To find which value is throwing, check the browser or debugger console.
// Before this exception was thrown, there should be `console.error` output
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
// problem and how that type was used: key, atrribute, input value prop, etc.
// In most cases, this console output also shows the component and its
// ancestor components where the exception happened.
//
// eslint-disable-next-line react-internal/safe-string-coercion
return '' + value;
}
function checkKeyStringCoercion(value) {
{
if (willCoercionThrow(value)) {
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
}
}
}
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
var RESERVED_PROPS = {
key: true,
ref: true,
__self: true,
__source: true
};
var specialPropKeyWarningShown;
var specialPropRefWarningShown;
var didWarnAboutStringRefs;
{
didWarnAboutStringRefs = {};
}
function hasValidRef(config) {
{
if (hasOwnProperty.call(config, 'ref')) {
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
if (getter && getter.isReactWarning) {
return false;
}
}
}
return config.ref !== undefined;
}
function hasValidKey(config) {
{
if (hasOwnProperty.call(config, 'key')) {
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
if (getter && getter.isReactWarning) {
return false;
}
}
}
return config.key !== undefined;
}
function warnIfStringRefCannotBeAutoConverted(config, self) {
{
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
if (!didWarnAboutStringRefs[componentName]) {
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
didWarnAboutStringRefs[componentName] = true;
}
}
}
}
function defineKeyPropWarningGetter(props, displayName) {
{
var warnAboutAccessingKey = function () {
if (!specialPropKeyWarningShown) {
specialPropKeyWarningShown = true;
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
}
};
warnAboutAccessingKey.isReactWarning = true;
Object.defineProperty(props, 'key', {
get: warnAboutAccessingKey,
configurable: true
});
}
}
function defineRefPropWarningGetter(props, displayName) {
{
var warnAboutAccessingRef = function () {
if (!specialPropRefWarningShown) {
specialPropRefWarningShown = true;
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
}
};
warnAboutAccessingRef.isReactWarning = true;
Object.defineProperty(props, 'ref', {
get: warnAboutAccessingRef,
configurable: true
});
}
}
/**
* Factory method to create a new React element. This no longer adheres to
* the class pattern, so do not use new to call it. Also, instanceof check
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
* if something is a React Element.
*
* @param {*} type
* @param {*} props
* @param {*} key
* @param {string|object} ref
* @param {*} owner
* @param {*} self A *temporary* helper to detect places where `this` is
* different from the `owner` when React.createElement is called, so that we
* can warn. We want to get rid of owner and replace string `ref`s with arrow
* functions, and as long as `this` and owner are the same, there will be no
* change in behavior.
* @param {*} source An annotation object (added by a transpiler or otherwise)
* indicating filename, line number, and/or other information.
* @internal
*/
var ReactElement = function (type, key, ref, self, source, owner, props) {
var element = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: REACT_ELEMENT_TYPE,
// Built-in properties that belong on the element
type: type,
key: key,
ref: ref,
props: props,
// Record the component responsible for creating this element.
_owner: owner
};
{
// The validation flag is currently mutative. We put it on
// an external backing store so that we can freeze the whole object.
// This can be replaced with a WeakMap once they are implemented in
// commonly used development environments.
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
// the validation flag non-enumerable (where possible, which should
// include every environment we run tests in), so the test framework
// ignores it.
Object.defineProperty(element._store, 'validated', {
configurable: false,
enumerable: false,
writable: true,
value: false
}); // self and source are DEV only properties.
Object.defineProperty(element, '_self', {
configurable: false,
enumerable: false,
writable: false,
value: self
}); // Two elements created in two different places should be considered
// equal for testing purposes and therefore we hide it from enumeration.
Object.defineProperty(element, '_source', {
configurable: false,
enumerable: false,
writable: false,
value: source
});
if (Object.freeze) {
Object.freeze(element.props);
Object.freeze(element);
}
}
return element;
};
/**
* https://github.com/reactjs/rfcs/pull/107
* @param {*} type
* @param {object} props
* @param {string} key
*/
function jsxDEV(type, config, maybeKey, source, self) {
{
var propName; // Reserved names are extracted
var props = {};
var key = null;
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
// but as an intermediary step, we will use jsxDEV for everything except
// <div {...props} key="Hi" />, because we aren't currently able to tell if
// key is explicitly declared to be undefined or not.
if (maybeKey !== undefined) {
{
checkKeyStringCoercion(maybeKey);
}
key = '' + maybeKey;
}
if (hasValidKey(config)) {
{
checkKeyStringCoercion(config.key);
}
key = '' + config.key;
}
if (hasValidRef(config)) {
ref = config.ref;
warnIfStringRefCannotBeAutoConverted(config, self);
} // Remaining properties are added to a new props object
for (propName in config) {
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
} // Resolve default props
if (type && type.defaultProps) {
var defaultProps = type.defaultProps;
for (propName in defaultProps) {
if (props[propName] === undefined) {
props[propName] = defaultProps[propName];
}
}
}
if (key || ref) {
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
if (key) {
defineKeyPropWarningGetter(props, displayName);
}
if (ref) {
defineRefPropWarningGetter(props, displayName);
}
}
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
}
}
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
function setCurrentlyValidatingElement$1(element) {
{
if (element) {
var owner = element._owner;
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
} else {
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
}
}
}
var propTypesMisspellWarningShown;
{
propTypesMisspellWarningShown = false;
}
/**
* Verifies the object is a ReactElement.
* See https://reactjs.org/docs/react-api.html#isvalidelement
* @param {?object} object
* @return {boolean} True if `object` is a ReactElement.
* @final
*/
function isValidElement(object) {
{
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
}
}
function getDeclarationErrorAddendum() {
{
if (ReactCurrentOwner$1.current) {
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
if (name) {
return '\n\nCheck the render method of `' + name + '`.';
}
}
return '';
}
}
function getSourceInfoErrorAddendum(source) {
{
if (source !== undefined) {
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
var lineNumber = source.lineNumber;
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
}
return '';
}
}
/**
* Warn if there's no key explicitly set on dynamic arrays of children or
* object keys are not valid. This allows us to keep track of children between
* updates.
*/
var ownerHasKeyUseWarning = {};
function getCurrentComponentErrorInfo(parentType) {
{
var info = getDeclarationErrorAddendum();
if (!info) {
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
if (parentName) {
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
}
}
return info;
}
}
/**
* Warn if the element doesn't have an explicit key assigned to it.
* This element is in an array. The array could grow and shrink or be
* reordered. All children that haven't already been validated are required to
* have a "key" property assigned to it. Error statuses are cached so a warning
* will only be shown once.
*
* @internal
* @param {ReactElement} element Element that requires a key.
* @param {*} parentType element's parent's type.
*/
function validateExplicitKey(element, parentType) {
{
if (!element._store || element._store.validated || element.key != null) {
return;
}
element._store.validated = true;
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
return;
}
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
// property, it may be the creator of the child that's responsible for
// assigning it a key.
var childOwner = '';
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
// Give the component that originally created this child.
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
}
setCurrentlyValidatingElement$1(element);
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
setCurrentlyValidatingElement$1(null);
}
}
/**
* Ensure that every element either is passed in a static location, in an
* array with an explicit keys property defined, or in an object literal
* with valid key property.
*
* @internal
* @param {ReactNode} node Statically passed child of any type.
* @param {*} parentType node's parent's type.
*/
function validateChildKeys(node, parentType) {
{
if (typeof node !== 'object') {
return;
}
if (isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];
if (isValidElement(child)) {
validateExplicitKey(child, parentType);
}
}
} else if (isValidElement(node)) {
// This element was passed in a valid location.
if (node._store) {
node._store.validated = true;
}
} else if (node) {
var iteratorFn = getIteratorFn(node);
if (typeof iteratorFn === 'function') {
// Entry iterators used to provide implicit keys,
// but now we print a separate warning for them later.
if (iteratorFn !== node.entries) {
var iterator = iteratorFn.call(node);
var step;
while (!(step = iterator.next()).done) {
if (isValidElement(step.value)) {
validateExplicitKey(step.value, parentType);
}
}
}
}
}
}
}
/**
* Given an element, validate that its props follow the propTypes definition,
* provided by the type.
*
* @param {ReactElement} element
*/
function validatePropTypes(element) {
{
var type = element.type;
if (type === null || type === undefined || typeof type === 'string') {
return;
}
var propTypes;
if (typeof type === 'function') {
propTypes = type.propTypes;
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
type.$$typeof === REACT_MEMO_TYPE)) {
propTypes = type.propTypes;
} else {
return;
}
if (propTypes) {
// Intentionally inside to avoid triggering lazy initializers:
var name = getComponentNameFromType(type);
checkPropTypes(propTypes, element.props, 'prop', name, element);
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
var _name = getComponentNameFromType(type);
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
}
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
}
}
}
/**
* Given a fragment, validate that it can only be provided with fragment props
* @param {ReactElement} fragment
*/
function validateFragmentProps(fragment) {
{
var keys = Object.keys(fragment.props);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (key !== 'children' && key !== 'key') {
setCurrentlyValidatingElement$1(fragment);
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
setCurrentlyValidatingElement$1(null);
break;
}
}
if (fragment.ref !== null) {
setCurrentlyValidatingElement$1(fragment);
error('Invalid attribute `ref` supplied to `React.Fragment`.');
setCurrentlyValidatingElement$1(null);
}
}
}
var didWarnAboutKeySpread = {};
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
{
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
if (!validType) {
var info = '';
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
}
var sourceInfo = getSourceInfoErrorAddendum(source);
if (sourceInfo) {
info += sourceInfo;
} else {
info += getDeclarationErrorAddendum();
}
var typeString;
if (type === null) {
typeString = 'null';
} else if (isArray(type)) {
typeString = 'array';
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
info = ' Did you accidentally export a JSX literal instead of a component?';
} else {
typeString = typeof type;
}
error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
}
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
// TODO: Drop this when these are no longer allowed as the type argument.
if (element == null) {
return element;
} // Skip key warning if the type isn't valid since our key validation logic
// doesn't expect a non-string/function type and can throw confusing errors.
// We don't want exception behavior to differ between dev and prod.
// (Rendering will throw with a helpful message and as soon as the type is
// fixed, the key warnings will appear.)
if (validType) {
var children = props.children;
if (children !== undefined) {
if (isStaticChildren) {
if (isArray(children)) {
for (var i = 0; i < children.length; i++) {
validateChildKeys(children[i], type);
}
if (Object.freeze) {
Object.freeze(children);
}
} else {
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
}
} else {
validateChildKeys(children, type);
}
}
}
{
if (hasOwnProperty.call(props, 'key')) {
var componentName = getComponentNameFromType(type);
var keys = Object.keys(props).filter(function (k) {
return k !== 'key';
});
var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
didWarnAboutKeySpread[componentName + beforeExample] = true;
}
}
}
if (type === REACT_FRAGMENT_TYPE) {
validateFragmentProps(element);
} else {
validatePropTypes(element);
}
return element;
}
} // These two functions exist to still get child warnings in dev
// even with the prod transform. This means that jsxDEV is purely
// opt-in behavior for better messages but that we won't stop
// giving you warnings if you use production apis.
function jsxWithValidationStatic(type, props, key) {
{
return jsxWithValidation(type, props, key, true);
}
}
function jsxWithValidationDynamic(type, props, key) {
{
return jsxWithValidation(type, props, key, false);
}
}
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
// for now we can ship identical prod functions
var jsxs = jsxWithValidationStatic ;
exports.Fragment = REACT_FRAGMENT_TYPE;
exports.jsx = jsx;
exports.jsxs = jsxs;
})();
}
/***/ }),
/***/ "../../node_modules/react/jsx-runtime.js":
/*!***********************************************!*\
!*** ../../node_modules/react/jsx-runtime.js ***!
\***********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
if (false) // removed by dead control flow
{} else {
module.exports = __webpack_require__(/*! ./cjs/react-jsx-runtime.development.js */ "../../node_modules/react/cjs/react-jsx-runtime.development.js");
}
/***/ }),
/***/ "../utils/lib-esm/date/generator.js":
/*!******************************************!*\
!*** ../utils/lib-esm/date/generator.js ***!
\******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ buildWeeks: () => (/* binding */ buildWeeks)
/* harmony export */ });
/* harmony import */ var date_fns_addDays__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! date-fns/addDays */ "../../node_modules/date-fns/addDays.mjs");
/* harmony import */ var date_fns_startOfWeek__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! date-fns/startOfWeek */ "../../node_modules/date-fns/startOfWeek.mjs");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
/**
* Generate the set of weeks for a specific month
*/
function buildWeeks(year, monthIndex, firstDayOfWeek = 1) {
const firstDateOfMonth = new Date(year, monthIndex);
const firstDateOfCalendar = (0,date_fns_startOfWeek__WEBPACK_IMPORTED_MODULE_1__.startOfWeek)(firstDateOfMonth, {
weekStartsOn: firstDayOfWeek
});
const dates = new Array(7 * 6).fill(0).map((_, i) => (0,date_fns_addDays__WEBPACK_IMPORTED_MODULE_2__.addDays)(firstDateOfCalendar, i));
return (0,lodash__WEBPACK_IMPORTED_MODULE_0__.chunk)(dates, 7);
}
/***/ }),
/***/ "../utils/lib-esm/date/index.js":
/*!**************************************!*\
!*** ../utils/lib-esm/date/index.js ***!
\**************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ FORMAT: () => (/* binding */ FORMAT),
/* harmony export */ buildWeeks: () => (/* binding */ buildWeeks),
/* harmony export */ convertToLocalTime: () => (/* binding */ convertToLocalTime),
/* harmony export */ convertToTimeZone: () => (/* binding */ convertToTimeZone),
/* harmony export */ convertToUTC: () => (/* binding */ convertToUTC),
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ format: () => (/* binding */ format),
/* harmony export */ formatReadableUTCOffset: () => (/* binding */ formatReadableUTCOffset),
/* harmony export */ formatToTimeZone: () => (/* binding */ formatToTimeZone),
/* harmony export */ formatToUnicode: () => (/* binding */ formatToUnicode),
/* harmony export */ getUTCOffset: () => (/* binding */ getUTCOffset),
/* harmony export */ timeZoneExists: () => (/* binding */ timeZoneExists)
/* harmony export */ });
/* harmony import */ var date_fns_format__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! date-fns/format */ "../../node_modules/date-fns/format.mjs");
/* harmony import */ var date_fns_parseISO__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! date-fns/parseISO */ "../../node_modules/date-fns/parseISO.mjs");
/* harmony import */ var _generator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./generator */ "../utils/lib-esm/date/generator.js");
/**
* Get the offset between a timezone and the UTC time (in minutes)
* @param {string} timeZone Timezone IANA name
* @param {Date} date (optional) When specified, will be instead of default current time
* @returns {Number}
*
* @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
*/
function getUTCOffset(timeZone, date) {
// Build localized formats for UTC and the target timezone
const formatOptions = {
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric',
minute: 'numeric'
};
const locale = 'en-US';
const utcFormat = new Intl.DateTimeFormat(locale, {
...formatOptions,
timeZone: 'Etc/UTC'
});
const timezoneFormat = new Intl.DateTimeFormat(locale, {
...formatOptions,
timeZone
});
// Create the same date in UTC timezone and the target timezone
const dateObj = date || new Date();
const utcDate = new Date(utcFormat.format(dateObj));
const timezoneDate = new Date(timezoneFormat.format(dateObj));
// Compute delta between dates
return (timezoneDate.getTime() - utcDate.getTime()) / (1000 * 60);
}
/**
* Format an UTC offset from minutes to [+/-][HH][separator][mm]
* @param {Number} offset UTC offset
* @param {string} separator Separator between hours and minutes
* @returns {string} Formatted UTC offset
*/
function formatUTCOffset(offset, separator) {
const sign = offset >= 0 ? '+' : '-';
const absoluteOffset = Math.abs(offset);
const min = absoluteOffset % 60;
const hours = (absoluteOffset - min) / 60;
const paddedHours = hours.toString().padStart(2, '0');
const paddedMin = min.toString().padStart(2, '0');
return `${sign}${paddedHours}${separator}${paddedMin}`;
}
/**
* Format a human-readable UTC offset
* @param offset Timezone offset to UTC expressed in minutes
* @returns The human readable offset (+03:00, -06:00 ...)
*/
function formatReadableUTCOffset(offset) {
return formatUTCOffset(offset, ':');
}
/**
* Replace timezone token(s) in the date format pattern to a specific timezone's value(s).
* This should be maintained along with the date-fns formats (see linked API doc).
* @param {string} dateFormat
* @param {string} timeZone
* @returns {string}
*
* @see https://date-fns.org/v1.27.2/docs/format
* @see https://github.com/prantlf/date-fns-timezone/blob/master/src/formatToTimeZone.js#L131
*/
function formatTimeZoneTokens(dateFormat, timeZone) {
return dateFormat.replace(/(z|ZZ?)(?!\])/g, match => {
const offset = getUTCOffset(timeZone);
const separator = match === 'Z' ? ':' : '';
return formatUTCOffset(offset, separator);
});
}
/**
* Converts the given date from the given time zone to the local time and returns a new Date object.
* @param {DateFnsFormatInput} date Date to format
* @param {ConversionOptions} options
* @returns {Date}
*
* @see https://github.com/prantlf/date-fns-timezone/blob/HEAD/docs/API.md#converttolocaltime
*/
function convertToLocalTime(date, options) {
const parsedDate = (0,date_fns_parseISO__WEBPACK_IMPORTED_MODULE_1__.parseISO)(new Date(date).toISOString());
const offset = getUTCOffset(options.timeZone) + parsedDate.getTimezoneOffset();
return new Date(parsedDate.getTime() - offset * 60 * 1000);
}
/**
* Converts the given date from the local time (or from specified source timezone) to
* the given timezone and returns a new Date object.
* @param {DateFnsFormatInput} date Date to format
* @param {ConversionOptions} options
* @returns {Date}
*
* @see https://github.com/prantlf/date-fns-timezone/blob/master/src/convertToTimeZone.js
*/
function convertToTimeZone(date, options) {
const {
timeZone,
sourceTimeZone
} = options;
const parsedDate = (0,date_fns_parseISO__WEBPACK_IMPORTED_MODULE_1__.parseISO)(new Date(date).toISOString());
let offset = getUTCOffset(timeZone, parsedDate) + parsedDate.getTimezoneOffset();
if (sourceTimeZone) {
offset -= parsedDate.getTimezoneOffset();
offset -= getUTCOffset(sourceTimeZone, parsedDate);
}
return new Date(parsedDate.getTime() + offset * 60 * 1000);
}
function formatToUnicode(formatString) {
// See: https://date-fns.org/v2.16.1/docs/format
return formatString
// Characters are now escaped using single quote symbols (') instead of square brackets.
.replace(/\[T\]/g, () => "'T'")
// See: https://date-fns.org/docs/Unicode-Tokens
// Replace years YYYY to yyyy
.replace(/YYYY/g, () => 'yyyy')
// Replace days of the month DD to dd
.replace(/DD/g, () => 'dd')
// Replace days of the week ddd to EEE
.replace(/ddd/g, () => 'EEE');
}
/**
* Returns the formatted date string in the given format, after converting it to the given time zone.
* @param {DateFnsFormatInput} date Date to format
* @param {string} formatString Output format (see date-fns supported formats)
* @param {ConversionOptions} options
* @returns {string}
*
* @see https://github.com/prantlf/date-fns-timezone/blob/master/src/formatToTimeZone.js
*/
function formatToTimeZone(date, formatString, options) {
const dateConvertedToTimezone = convertToTimeZone(date, options);
const unicodeFormatedString = formatToUnicode(formatString);
// Replace timezone token(s) in the string format with timezone values, since format() will use local timezone
const dateFnsFormatWithTimeZoneValue = formatTimeZoneTokens(unicodeFormatedString, options.timeZone)
// Avoid error: "Format string contains an unescaped latin alphabet character `Z`"
.replace(/\[Z\]/g, () => "'Z'");
return (0,date_fns_format__WEBPACK_IMPORTED_MODULE_2__.format)(dateConvertedToTimezone, dateFnsFormatWithTimeZoneValue, options);
}
/**
* Convert a date in local TZ to UTC
* 20:00 in local TZ become 20:00 in UTC
* @param {Date} date
* @returns {Date}
*/
function convertToUTC(date) {
return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()));
}
/**
* Check wether a timezone exists or not.
* @param timeZone {string}
* @returns {boolean}
*/
function timeZoneExists(timeZone) {
try {
// eslint-disable-next-line no-new
new Intl.DateTimeFormat(undefined, {
timeZone
});
return true;
} catch (e) {
return false;
}
}
/**
* Date format options
* @enum string
*/
const FORMAT = {
/** en: June 29, 2021 / fr: 29 juin 2020 / ja: 2020年6月29日 / de 29. Juni 2020 */
MDY_LONG: 'MDY_LONG',
/** en: June 2020 / fr: juin 2020 / ja: 2020年6月 / Juni 2020 */
MY_LONG: 'MY_LONG',
/** en: 06/29/2020 / fr: 29/06/2020 / ja: 2020/06/29 / de: 29.06.2020 */
MDY: 'MDY',
/** en: 6/29 / fr: 29/06 / ja: 06/29 / de: 29.06 */
MD: 'MD',
/** en: 6/29/20, 10:00 PM / fr: 29/06/2020 22:00 / ja: 2020/06/29 22:00 / de: 29.06.20, 22:00 */
MDYHM: 'MDYHM'
};
const options = {
[FORMAT.MDY_LONG]: {
year: 'numeric',
month: 'long',
day: 'numeric'
},
[FORMAT.MY_LONG]: {
year: 'numeric',
month: 'long'
},
[FORMAT.MDY]: {
year: 'numeric',
month: '2-digit',
day: '2-digit'
},
[FORMAT.MD]: {
month: 'numeric',
day: 'numeric'
},
[FORMAT.MDYHM]: {
dateStyle: 'short',
timeStyle: 'short'
}
};
/**
* Format a date using Intl.
* @param date {DateFnsFormatInput} A date: Date, string or Number
* @param dateOption {string} Comes from `FORMAT` enum
* @param lang {string} language
* @returns The formated date
*/
function format(date, dateOption, lang) {
const parsedDate = (0,date_fns_parseISO__WEBPACK_IMPORTED_MODULE_1__.parseISO)(new Date(date).toISOString());
return new Intl.DateTimeFormat(lang, options[dateOption]).format(parsedDate);
}
const buildWeeks = _generator__WEBPACK_IMPORTED_MODULE_0__.buildWeeks;
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
convertToLocalTime,
convertToTimeZone,
convertToUTC,
format,
FORMAT,
formatReadableUTCOffset,
formatToTimeZone,
getUTCOffset,
timeZoneExists
});
/***/ }),
/***/ "../utils/lib-esm/filters/filters.js":
/*!*******************************************!*\
!*** ../utils/lib-esm/filters/filters.js ***!
\*******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ valued: () => (/* binding */ valued)
/* harmony export */ });
/**
* This allows Typescript to understand our array doesn't contain undefined or null values.
* So result is typed without "| null" nor "| undefined".
* This is not possible with a simple function like ".filter(v => !!v)" or ".filter(Boolean)"
*/
const valued = val => val !== undefined && val !== null;
/***/ }),
/***/ "../utils/lib-esm/filters/index.js":
/*!*****************************************!*\
!*** ../utils/lib-esm/filters/index.js ***!
\*****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ valued: () => (/* reexport safe */ _filters__WEBPACK_IMPORTED_MODULE_0__.valued)
/* harmony export */ });
/* harmony import */ var _filters__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./filters */ "../utils/lib-esm/filters/filters.js");
/***/ }),
/***/ "../utils/lib-esm/getDataAttrFromProps.js":
/*!************************************************!*\
!*** ../utils/lib-esm/getDataAttrFromProps.js ***!
\************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ getDataAttrFromProps)
/* harmony export */ });
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
/**
* get data attributes from props
* @param {object} props
* @returns {object}
*/
function getDataAttrFromProps(props) {
const dataAttributesKeys = Object.keys(props).filter(objectKey => objectKey.startsWith('data-'));
return (0,lodash__WEBPACK_IMPORTED_MODULE_0__.pick)(props, dataAttributesKeys);
}
/***/ }),
/***/ "../utils/lib-esm/index.js":
/*!*********************************!*\
!*** ../utils/lib-esm/index.js ***!
\*********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ date: () => (/* reexport module object */ _date__WEBPACK_IMPORTED_MODULE_0__),
/* harmony export */ filters: () => (/* reexport module object */ _filters__WEBPACK_IMPORTED_MODULE_1__),
/* harmony export */ getDataAttrFromProps: () => (/* reexport safe */ _getDataAttrFromProps__WEBPACK_IMPORTED_MODULE_2__["default"]),
/* harmony export */ randomUUID: () => (/* reexport safe */ _uuid__WEBPACK_IMPORTED_MODULE_3__.randomUUID),
/* harmony export */ validation: () => (/* reexport safe */ _validation__WEBPACK_IMPORTED_MODULE_4__["default"])
/* harmony export */ });
/* harmony import */ var _date__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./date */ "../utils/lib-esm/date/index.js");
/* harmony import */ var _filters__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./filters */ "../utils/lib-esm/filters/index.js");
/* harmony import */ var _getDataAttrFromProps__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getDataAttrFromProps */ "../utils/lib-esm/getDataAttrFromProps.js");
/* harmony import */ var _uuid__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./uuid */ "../utils/lib-esm/uuid.js");
/* harmony import */ var _validation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./validation */ "../utils/lib-esm/validation/index.js");
/***/ }),
/***/ "../utils/lib-esm/uuid.js":
/*!********************************!*\
!*** ../utils/lib-esm/uuid.js ***!
\********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ randomUUID: () => (/* binding */ randomUUID)
/* harmony export */ });
function randomUUID() {
// works only on https so need backport if the app is run on unsecure env
if (crypto && crypto.randomUUID) {
return crypto.randomUUID();
}
function h(n) {
return (n | 0).toString(16);
}
// backport using Math.random and Date
function s(n) {
return h(Math.random() * (1 << (n << 2)) ^ Date.now()).slice(-n);
}
return [s(4) + s(4), s(4), '4' + s(3),
// UUID version 4
h(8 | Math.random() * 4) + s(3),
// {8|9|A|B}xxx
// s(4) + s(4) + s(4),
Date.now().toString(16).slice(-10) + s(2) // Use timestamp to avoid collisions
].join('-');
}
/***/ }),
/***/ "../utils/lib-esm/validation/index.js":
/*!********************************************!*\
!*** ../utils/lib-esm/validation/index.js ***!
\********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _regexp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./regexp */ "../utils/lib-esm/validation/regexp.js");
/* harmony import */ var _methods__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./methods */ "../utils/lib-esm/validation/methods.js");
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
REGEXP: _regexp__WEBPACK_IMPORTED_MODULE_0__,
..._methods__WEBPACK_IMPORTED_MODULE_1__
});
/***/ }),
/***/ "../utils/lib-esm/validation/methods.js":
/*!**********************************************!*\
!*** ../utils/lib-esm/validation/methods.js ***!
\**********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ validDomain: () => (/* binding */ validDomain),
/* harmony export */ validEmail: () => (/* binding */ validEmail),
/* harmony export */ validFirstName: () => (/* binding */ validFirstName),
/* harmony export */ validLastName: () => (/* binding */ validLastName)
/* harmony export */ });
/* harmony import */ var _regexp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./regexp */ "../utils/lib-esm/validation/regexp.js");
/**
* Build a validation method along a given regular expression
* @param {RegExp} regexp Regular expression to test values against
* @returns {Function}
*/
function getValidationMethod(regexp) {
return value => regexp.test(value);
}
/**
* Check that a given value is a valid first name
* @param {string} value
* @returns {boolean}
*/
const validFirstName = getValidationMethod(_regexp__WEBPACK_IMPORTED_MODULE_0__.NAME);
/**
* Check that a given value is a valid last name
* @param {string} value
* @returns {boolean}
*/
const validLastName = getValidationMethod(_regexp__WEBPACK_IMPORTED_MODULE_0__.NAME);
/**
* Check that a given value is a value email address
* @param {string} value
* @returns {boolean}
*/
const validEmail = getValidationMethod(_regexp__WEBPACK_IMPORTED_MODULE_0__.EMAIL);
/**
* Check that a given value is a valid domain
* @param {string} value
* @returns {boolean}
*/
const validDomain = getValidationMethod(_regexp__WEBPACK_IMPORTED_MODULE_0__.DOMAIN);
/***/ }),
/***/ "../utils/lib-esm/validation/regexp.js":
/*!*********************************************!*\
!*** ../utils/lib-esm/validation/regexp.js ***!
\*********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ DOMAIN: () => (/* binding */ DOMAIN),
/* harmony export */ EMAIL: () => (/* binding */ EMAIL),
/* harmony export */ NAME: () => (/* binding */ NAME)
/* harmony export */ });
const EMAIL = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i;
const NAME = /^[^\~!@#$%^&*()|+=?;:",<>\{\}\[\]\\\/¤€¨£°§]*$/i;
const DOMAIN = /^[^\~!#$%^&*()|+=?;:",<>\{\}\[\]\\\/¤€¨£°§]*$/i;
/***/ }),
/***/ "./src/CRUDBadges.js":
/*!***************************!*\
!*** ./src/CRUDBadges.js ***!
\***************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ applyBadgeTransform: () => (/* binding */ applyBadgeTransform),
/* harmony export */ closeInitOpenedBadge: () => (/* binding */ closeInitOpenedBadge),
/* harmony export */ createBadge: () => (/* binding */ createBadge),
/* harmony export */ createBadgeWithValue: () => (/* binding */ createBadgeWithValue),
/* harmony export */ deleteBadge: () => (/* binding */ deleteBadge),
/* harmony export */ updateBadge: () => (/* binding */ updateBadge)
/* harmony export */ });
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
const findByMetadataBadgeId = badgeId => ({
metadata
}) => (0,lodash__WEBPACK_IMPORTED_MODULE_0__.get)(metadata, 'badgeId') === badgeId;
// eslint-disable-next-line testing-library/await-async-queries
const getBadgeIndexFromId = badgeId => badges => badges.findIndex(findByMetadataBadgeId(badgeId));
const getBadge = index => badges => badges[index];
const setBadgeValue = ({
properties,
metadata
}) => badge => ({
properties: {
...badge.properties,
...properties
},
metadata: {
...badge.metadata,
...metadata
}
});
const setBadge = (newProperties, newMetadata) => getIndexFn => badges => {
const index = getIndexFn(badges);
if (index >= 0) {
const newBadge = setBadgeValue({
properties: newProperties,
metadata: newMetadata
})(getBadge(index)(badges));
// eslint-disable-next-line no-param-reassign
badges[index] = newBadge;
}
return badges;
};
const spliceBadge = getIndexFn => badges => {
const index = getIndexFn(badges);
if (index >= 0) {
badges.splice(index, 1);
}
return badges;
};
const pushBadge = badge => badges => {
badges.push(badge);
return badges;
};
const applyBadgeTransform = transformFn => badges => {
const clonedBadges = (0,lodash__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(badges);
return transformFn(clonedBadges).map(Object.freeze);
};
const updateBadge = (badgeId, newProperties, newMetadata) => applyBadgeTransform((0,lodash__WEBPACK_IMPORTED_MODULE_0__.flow)([getBadgeIndexFromId, setBadge(newProperties, newMetadata)])(badgeId));
const deleteBadge = badgeId => applyBadgeTransform((0,lodash__WEBPACK_IMPORTED_MODULE_0__.flow)([getBadgeIndexFromId, spliceBadge])(badgeId));
const createBadge = badge => applyBadgeTransform(pushBadge({
...badge,
metadata: {
...badge.metadata,
isInCreation: true
}
}));
const closeInitOpenedBadge = badgeId => updateBadge(badgeId, {
initialOperatorOpened: false,
initialValueOpened: false
});
const createBadgeWithValue = (badge, operator, value) => applyBadgeTransform(pushBadge({
...badge,
properties: {
...badge.properties,
initialOperatorOpened: false,
initialValueOpened: false,
value,
operator
},
metadata: {
...badge.metadata,
isInCreation: false
}
}));
/***/ }),
/***/ "./src/components/AddFacetPopover/AddFacetPopover.component.js":
/*!*********************************************************************!*\
!*** ./src/components/AddFacetPopover/AddFacetPopover.component.js ***!
\*********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ AddFacetPopover: () => (/* binding */ AddFacetPopover)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @talend/design-system */ "@talend/design-system");
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../facetedSearch.propTypes */ "./src/components/facetedSearch.propTypes.js");
/* harmony import */ var _AddFacetPopoverHeader__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./AddFacetPopoverHeader */ "./src/components/AddFacetPopover/AddFacetPopoverHeader/index.js");
/* harmony import */ var _AddFacetPopoverRow__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./AddFacetPopoverRow */ "./src/components/AddFacetPopover/AddFacetPopoverRow/index.js");
/* harmony import */ var _AddFacetPopover_module_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./AddFacetPopover.module.scss */ "./src/components/AddFacetPopover/AddFacetPopover.module.scss");
/* harmony import */ var _AddFacetPopover_module_scss__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_AddFacetPopover_module_scss__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const filterByLabel = label => row => {
const rowLabel = (0,lodash__WEBPACK_IMPORTED_MODULE_7__.isString)(row) ? row : row.properties.label;
return rowLabel.toLocaleLowerCase().includes(label.toLocaleLowerCase().trim());
};
const filterByNotEmpty = row => {
const label = (0,lodash__WEBPACK_IMPORTED_MODULE_7__.isString)(row) ? row : row.properties.label;
return label.trim() !== '';
};
const sortByLabel = (rowA, rowB) => {
const labelA = (0,lodash__WEBPACK_IMPORTED_MODULE_7__.isString)(rowA) ? rowA : rowA.properties.label;
const labelB = (0,lodash__WEBPACK_IMPORTED_MODULE_7__.isString)(rowB) ? rowB : rowB.properties.label;
return labelA.localeCompare(labelB);
};
const getCategories = badgesDefinitions => {
const categories = badgesDefinitions.filter(badgeDefinition => !!badgeDefinition.metadata.category).map(badgeDefinition => badgeDefinition.metadata.category);
return (0,lodash__WEBPACK_IMPORTED_MODULE_7__.uniq)(categories);
};
const getScreens = (badgesDefinitions, filterValue, comparator = sortByLabel) => {
const visibleBadges = badgesDefinitions.filter(badgeDefinition => badgeDefinition.metadata.isAvailableForFacetList !== false);
const categories = getCategories(visibleBadges);
const screens = [{
category: null,
rows: visibleBadges.filter((definition, index, arr) => !definition.metadata.category ||
// remove category duplicates
arr.findIndex(prev => prev.metadata.category === definition.metadata.category) === index).map(badgeDefinition => badgeDefinition.metadata.category || badgeDefinition).filter(filterByNotEmpty).filter(filterByLabel(filterValue))
}, ...categories.map(categoryName => ({
category: categoryName,
rows: badgesDefinitions.filter(badgeDefinition => badgeDefinition.metadata.category === categoryName).filter(filterByNotEmpty).filter(filterByLabel(filterValue))
}))];
if (comparator) {
screens.forEach(screen => screen.rows.sort(comparator));
}
return screens;
};
const AddFacetPopover = ({
badgesDefinitions = [],
badgesDefinitionsSort,
badges,
id,
initialFilterValue,
onClick,
t
}) => {
const addFacetId = `${id}-add-facet-popover`;
const [category, setCategory] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null);
const [filterValue, setFilterValue] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialFilterValue || '');
const getScreensMemo = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => getScreens(badgesDefinitions, filterValue, badgesDefinitionsSort), [badgesDefinitions, filterValue, badgesDefinitionsSort]);
const screens = getScreensMemo();
const screensRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)((0,lodash__WEBPACK_IMPORTED_MODULE_7__.times)(screens.length, react__WEBPACK_IMPORTED_MODULE_0__.createRef));
const onFilter = event => {
var _event$target;
setFilterValue((event === null || event === void 0 ? void 0 : (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value) || '');
};
const resetFilter = () => setFilterValue('');
const onCategoryChange = newCategory => {
setCategory(newCategory);
resetFilter();
};
const onRowClick = (...args) => {
setCategory(null);
onClick(...args);
};
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("div", {
id: addFacetId,
className: (_AddFacetPopover_module_scss__WEBPACK_IMPORTED_MODULE_6___default()["tc-add-facet-popover"]),
children: screens.map((screen, index) => category === screen.category ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.Form, {
ref: screensRef.current[index],
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_AddFacetPopoverHeader__WEBPACK_IMPORTED_MODULE_4__.AddFacetPopoverHeader, {
id: `${addFacetId}-${category}`,
category: screen.category,
onCategoryChange: onCategoryChange,
onFilter: onFilter,
filterValue: filterValue,
t: t
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("div", {
className: (_AddFacetPopover_module_scss__WEBPACK_IMPORTED_MODULE_6___default()["tc-add-facet-popover-items"]),
"data-test": "add-facet-popover-items",
"data-testid": "add-facet-popover-items",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.StackVertical, {
gap: "0",
children: [filterValue !== '' && !screen.rows.length && t('ADD_FACET_FILTER_NO_RESULT', 'No result found'), screen.rows.map(rowItem => (0,lodash__WEBPACK_IMPORTED_MODULE_7__.isString)(rowItem) ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_AddFacetPopoverRow__WEBPACK_IMPORTED_MODULE_5__.AddFacetPopoverRowItemCategory, {
id: `${id}-open-category`,
label: rowItem,
onClick: onCategoryChange
}, rowItem) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_AddFacetPopoverRow__WEBPACK_IMPORTED_MODULE_5__.AddFacetPopoverRowItem, {
badgeDefinition: rowItem,
id: addFacetId,
label: rowItem.properties.label,
onClick: onRowClick,
badges: badges,
t: t
}, rowItem.properties.label))]
})
})]
}, `screen-${screen.category}`) : null)
});
};
AddFacetPopover.propTypes = {
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
initialFilterValue: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
badgesDefinitions: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_3__.badgesFacetedPropTypes,
badgesDefinitionsSort: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
badges: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().array).isRequired,
onClick: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
t: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired
};
/***/ }),
/***/ "./src/components/AddFacetPopover/AddFacetPopover.module.scss":
/*!********************************************************************!*\
!*** ./src/components/AddFacetPopover/AddFacetPopover.module.scss ***!
\********************************************************************/
/***/ ((module) => {
// extracted by mini-css-extract-plugin
module.exports = {"tc-add-facet-popover":"AddFacetPopover-module__tc-add-facet-popover___TuKb2","tc-add-facet-popover-items":"AddFacetPopover-module__tc-add-facet-popover-items___N9pWV"};
/***/ }),
/***/ "./src/components/AddFacetPopover/AddFacetPopoverHeader/AddFacetPopoverHeader.component.js":
/*!*************************************************************************************************!*\
!*** ./src/components/AddFacetPopover/AddFacetPopoverHeader/AddFacetPopoverHeader.component.js ***!
\*************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ AddFacetPopoverHeader: () => (/* binding */ AddFacetPopoverHeader)
/* harmony export */ });
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @talend/design-system */ "@talend/design-system");
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_talend_design_system__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const AddFacetPopoverHeader = ({
category,
onCategoryChange,
id,
onFilter,
filterValue,
t
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", {
id: `${id}-header`,
children: [!(0,lodash__WEBPACK_IMPORTED_MODULE_2__.isNull)(category) && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_1__.ButtonTertiary, {
"data-test": "add-facet-popover-header-goback",
"data-testid": "add-facet-popover-header-goback",
icon: "chevron-left",
size: "S",
onClick: () => onCategoryChange(null),
children: t('ADD_FACET_FILTER_BACK', 'Back')
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_1__.Form.Search, {
id: `${id}-filter`,
placeholder: t('ADD_FACET_FILTER_PLACEHOLDER', 'Find a filter'),
onChange: onFilter,
value: filterValue
})]
});
AddFacetPopoverHeader.propTypes = {
category: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
onCategoryChange: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func).isRequired,
id: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired,
onFilter: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func).isRequired,
filterValue: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired,
t: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func).isRequired
};
/***/ }),
/***/ "./src/components/AddFacetPopover/AddFacetPopoverHeader/index.js":
/*!***********************************************************************!*\
!*** ./src/components/AddFacetPopover/AddFacetPopoverHeader/index.js ***!
\***********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ AddFacetPopoverHeader: () => (/* reexport safe */ _AddFacetPopoverHeader_component__WEBPACK_IMPORTED_MODULE_0__.AddFacetPopoverHeader)
/* harmony export */ });
/* harmony import */ var _AddFacetPopoverHeader_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AddFacetPopoverHeader.component */ "./src/components/AddFacetPopover/AddFacetPopoverHeader/AddFacetPopoverHeader.component.js");
/***/ }),
/***/ "./src/components/AddFacetPopover/AddFacetPopoverRow/AddFacetPopoverRowButton/AddFacetPopoverRowButton.component.js":
/*!**************************************************************************************************************************!*\
!*** ./src/components/AddFacetPopover/AddFacetPopoverRow/AddFacetPopoverRowButton/AddFacetPopoverRowButton.component.js ***!
\**************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ AddFacetPopoverRowButton: () => (/* binding */ AddFacetPopoverRowButton)
/* harmony export */ });
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @talend/design-system */ "@talend/design-system");
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_talend_design_system__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const AddFacetPopoverRowButton = ({
id,
label,
onClick,
disabledLabel,
isCategory = false
}) => {
const body = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(_talend_design_system__WEBPACK_IMPORTED_MODULE_1__.StackHorizontal, {
gap: "0",
align: "center",
justify: "spaceBetween",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span", {
children: label
}), isCategory && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span", {
"data-test": "add-facet-popover-row-button-chevron",
"data-testid": "add-facet-popover-row-button-chevron",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_1__.SizedIcon, {
name: "chevron-right",
size: "S"
})
})]
});
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_1__.ButtonTertiary, {
"data-test": "add-facet-popover-row-button",
"data-testid": "add-facet-popover-row-button",
id: id,
onClick: onClick,
disabled: !!disabledLabel,
children: body
});
};
AddFacetPopoverRowButton.propTypes = {
id: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired,
label: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired,
onClick: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func).isRequired,
disabledLabel: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
isCategory: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool)
};
/***/ }),
/***/ "./src/components/AddFacetPopover/AddFacetPopoverRow/AddFacetPopoverRowButton/index.js":
/*!*********************************************************************************************!*\
!*** ./src/components/AddFacetPopover/AddFacetPopoverRow/AddFacetPopoverRowButton/index.js ***!
\*********************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ AddFacetPopoverRowButton: () => (/* reexport safe */ _AddFacetPopoverRowButton_component__WEBPACK_IMPORTED_MODULE_0__.AddFacetPopoverRowButton)
/* harmony export */ });
/* harmony import */ var _AddFacetPopoverRowButton_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AddFacetPopoverRowButton.component */ "./src/components/AddFacetPopover/AddFacetPopoverRow/AddFacetPopoverRowButton/AddFacetPopoverRowButton.component.js");
/***/ }),
/***/ "./src/components/AddFacetPopover/AddFacetPopoverRow/AddFacetPopoverRowItem/AddFacetPopoverRowItem.component.js":
/*!**********************************************************************************************************************!*\
!*** ./src/components/AddFacetPopover/AddFacetPopoverRow/AddFacetPopoverRowItem/AddFacetPopoverRowItem.component.js ***!
\**********************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ AddFacetPopoverRowItem: () => (/* binding */ AddFacetPopoverRowItem),
/* harmony export */ AddFacetPopoverRowItemCategory: () => (/* binding */ AddFacetPopoverRowItemCategory)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../facetedSearch.propTypes */ "./src/components/facetedSearch.propTypes.js");
/* harmony import */ var _AddFacetPopoverRowButton__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../AddFacetPopoverRowButton */ "./src/components/AddFacetPopover/AddFacetPopoverRow/AddFacetPopoverRowButton/index.js");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const filterByAttribute = badgeDefinition => badge => badge.properties.attribute === badgeDefinition.properties.attribute;
const isButtonDisabled = (badges, badgeDefinition, occurrences) => {
const badgePerFacet = parseInt(badgeDefinition.metadata.badgePerFacet, 10);
if ((0,lodash__WEBPACK_IMPORTED_MODULE_4__.isNaN)(badgePerFacet)) {
return false;
}
return occurrences >= badgePerFacet;
};
const AddFacetPopoverRowItem = ({
badgeDefinition,
id,
label,
onClick,
badges,
t
}) => {
const occurrences = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => badges.filter(filterByAttribute(badgeDefinition)).length, [badges, badgeDefinition]);
const isDisabled = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => isButtonDisabled(badges, badgeDefinition, occurrences), [badges, badgeDefinition, occurrences]);
const onClickRow = event => {
onClick(event, badgeDefinition);
};
const disabledLabel = t('ADD_FACET_ROW_DISABLED_LABEL', {
count: occurrences,
badgeLabel: label,
defaultValue: 'You can only apply the {{badgeLabel}} filter once',
defaultValue_other: 'You can only apply the {{badgeLabel}} filter {{count}} times'
});
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_AddFacetPopoverRowButton__WEBPACK_IMPORTED_MODULE_3__.AddFacetPopoverRowButton, {
id: `${id}-row-button-${label}`,
label: label,
onClick: onClickRow,
disabledLabel: isDisabled ? disabledLabel : ''
});
};
AddFacetPopoverRowItem.propTypes = {
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
badgeDefinition: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__.badgeFacetedPropTypes.isRequired,
label: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
onClick: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
badges: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().array).isRequired,
t: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired
};
const AddFacetPopoverRowItemCategory = ({
id,
label,
onClick
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_AddFacetPopoverRowButton__WEBPACK_IMPORTED_MODULE_3__.AddFacetPopoverRowButton, {
id: `${id}-row-button-${label}`,
label: label,
onClick: () => onClick(label),
isCategory: true
});
AddFacetPopoverRowItemCategory.propTypes = {
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
label: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
onClick: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired
};
/***/ }),
/***/ "./src/components/AddFacetPopover/AddFacetPopoverRow/AddFacetPopoverRowItem/index.js":
/*!*******************************************************************************************!*\
!*** ./src/components/AddFacetPopover/AddFacetPopoverRow/AddFacetPopoverRowItem/index.js ***!
\*******************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ AddFacetPopoverRowItem: () => (/* reexport safe */ _AddFacetPopoverRowItem_component__WEBPACK_IMPORTED_MODULE_0__.AddFacetPopoverRowItem),
/* harmony export */ AddFacetPopoverRowItemCategory: () => (/* reexport safe */ _AddFacetPopoverRowItem_component__WEBPACK_IMPORTED_MODULE_0__.AddFacetPopoverRowItemCategory)
/* harmony export */ });
/* harmony import */ var _AddFacetPopoverRowItem_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AddFacetPopoverRowItem.component */ "./src/components/AddFacetPopover/AddFacetPopoverRow/AddFacetPopoverRowItem/AddFacetPopoverRowItem.component.js");
/***/ }),
/***/ "./src/components/AddFacetPopover/AddFacetPopoverRow/index.js":
/*!********************************************************************!*\
!*** ./src/components/AddFacetPopover/AddFacetPopoverRow/index.js ***!
\********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ AddFacetPopoverRowButton: () => (/* reexport safe */ _AddFacetPopoverRowButton__WEBPACK_IMPORTED_MODULE_0__.AddFacetPopoverRowButton),
/* harmony export */ AddFacetPopoverRowItem: () => (/* reexport safe */ _AddFacetPopoverRowItem__WEBPACK_IMPORTED_MODULE_1__.AddFacetPopoverRowItem),
/* harmony export */ AddFacetPopoverRowItemCategory: () => (/* reexport safe */ _AddFacetPopoverRowItem__WEBPACK_IMPORTED_MODULE_1__.AddFacetPopoverRowItemCategory)
/* harmony export */ });
/* harmony import */ var _AddFacetPopoverRowButton__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AddFacetPopoverRowButton */ "./src/components/AddFacetPopover/AddFacetPopoverRow/AddFacetPopoverRowButton/index.js");
/* harmony import */ var _AddFacetPopoverRowItem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AddFacetPopoverRowItem */ "./src/components/AddFacetPopover/AddFacetPopoverRow/AddFacetPopoverRowItem/index.js");
/***/ }),
/***/ "./src/components/AddFacetPopover/index.js":
/*!*************************************************!*\
!*** ./src/components/AddFacetPopover/index.js ***!
\*************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ AddFacetPopover: () => (/* reexport safe */ _AddFacetPopover_component__WEBPACK_IMPORTED_MODULE_0__.AddFacetPopover)
/* harmony export */ });
/* harmony import */ var _AddFacetPopover_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AddFacetPopover.component */ "./src/components/AddFacetPopover/AddFacetPopover.component.js");
/***/ }),
/***/ "./src/components/AdvancedSearch/AdvancedSearch.component.js":
/*!*******************************************************************!*\
!*** ./src/components/AdvancedSearch/AdvancedSearch.component.js ***!
\*******************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ AdvancedSearch: () => (/* binding */ AdvancedSearch)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "classnames");
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @talend/design-system */ "@talend/design-system");
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _talend_design_tokens__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @talend/design-tokens */ "@talend/design-tokens");
/* harmony import */ var _talend_design_tokens__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_talend_design_tokens__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../constants */ "./src/constants.js");
/* harmony import */ var _context_facetedSearch_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../context/facetedSearch.context */ "./src/components/context/facetedSearch.context.js");
/* harmony import */ var _AdvancedSearch_module_scss__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./AdvancedSearch.module.scss */ "./src/components/AdvancedSearch/AdvancedSearch.module.scss");
/* harmony import */ var _AdvancedSearch_module_scss__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_AdvancedSearch_module_scss__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
/* eslint-disable jsx-a11y/no-autofocus */
const AdvancedSearchError = ({
id,
label
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("p", {
"aria-live": "assertive",
className: (_AdvancedSearch_module_scss__WEBPACK_IMPORTED_MODULE_7___default()["adv-search-error"]),
id: `${id}-error`,
role: "status",
children: label
});
AdvancedSearchError.propTypes = {
label: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string).isRequired,
id: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string).isRequired
};
function AdvancedSearch({
initialQuery = '',
placeholder,
onCancel,
onChange,
onKeyDown,
onSubmit
}) {
const [query, setQuery] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialQuery);
const {
id,
inProgress,
error,
t
} = (0,_context_facetedSearch_context__WEBPACK_IMPORTED_MODULE_6__.useFacetedSearchContext)();
const formSubmit = event => {
event.preventDefault();
onSubmit(event, query);
};
const onKeyDownHandler = event => {
if (onKeyDown) {
onKeyDown(event, query);
} else {
switch (event.key) {
case 'Enter':
formSubmit(event);
break;
default:
break;
}
}
};
const onChangeHandler = event => {
if (onChange) {
onChange(event, event.target.value);
} else {
setQuery(event.target.value);
}
};
const onCancelHandler = () => {
setQuery('');
if (onCancel) {
onCancel();
}
};
const advSearchId = `${id}-adv-search`;
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)("div", {
id: advSearchId,
className: (_AdvancedSearch_module_scss__WEBPACK_IMPORTED_MODULE_7___default()["adv-search"]),
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)("form", {
id: `${advSearchId}-form`,
role: "search",
onSubmit: formSubmit,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("div", {
className: (_AdvancedSearch_module_scss__WEBPACK_IMPORTED_MODULE_7___default()["adv-search-filter-icon"]),
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.SizedIcon, {
name: "filter",
size: "M",
color: (_talend_design_tokens__WEBPACK_IMPORTED_MODULE_4___default().coralColorNeutralIconWeak),
className: (_AdvancedSearch_module_scss__WEBPACK_IMPORTED_MODULE_7___default()["adv-search-filter-icon"])
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.Form.Text, {
id: `${id}-form`,
name: "advanced-search-faceted",
type: "search",
value: query,
placeholder: placeholder || t('ADV_SEARCH_FACETED_PLACEHOLDER', 'Enter your query'),
autoComplete: "off",
className: classnames__WEBPACK_IMPORTED_MODULE_1___default()((_AdvancedSearch_module_scss__WEBPACK_IMPORTED_MODULE_7___default()["adv-search-input"]), {
'has-error': error
}),
"aria-label": placeholder || t('ADV_SEARCH_FACETED_ARIA', 'Advanced Faceted Search'),
autoFocus: true,
role: "searchbox",
onKeyDown: onKeyDownHandler,
onChange: onChangeHandler
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)("div", {
className: (_AdvancedSearch_module_scss__WEBPACK_IMPORTED_MODULE_7___default()["adv-search-buttons"]),
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.ButtonIcon, {
name: "action-cancel-title",
icon: "cross-filled",
size: "S",
isLoading: inProgress,
onClick: onCancelHandler,
"data-feature": _constants__WEBPACK_IMPORTED_MODULE_5__.USAGE_TRACKING_TAGS.ADVANCED_CLEAR,
children: t('CANCEL_TOOLTIP', 'Cancel')
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.ButtonIcon, {
name: "action-submit-title",
icon: "check-filled",
size: "S",
isLoading: inProgress,
type: "submit",
"data-feature": _constants__WEBPACK_IMPORTED_MODULE_5__.USAGE_TRACKING_TAGS.ADVANCED_APPLY,
children: t('SUBMIT_TOOLTIP', 'Submit')
})]
})]
}), error && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(AdvancedSearchError, {
id: advSearchId,
label: error
})]
});
}
AdvancedSearch.propTypes = {
initialQuery: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string),
onCancel: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func),
onChange: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func),
onKeyDown: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func),
onSubmit: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func).isRequired,
placeholder: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string)
};
/***/ }),
/***/ "./src/components/AdvancedSearch/AdvancedSearch.module.scss":
/*!******************************************************************!*\
!*** ./src/components/AdvancedSearch/AdvancedSearch.module.scss ***!
\******************************************************************/
/***/ ((module) => {
// extracted by mini-css-extract-plugin
module.exports = {"adv-search":"AdvancedSearch-module__adv-search___qgwja","adv-search-filter-icon":"AdvancedSearch-module__adv-search-filter-icon____DuTD","adv-search-error":"AdvancedSearch-module__adv-search-error___TvcE0","adv-search-input":"AdvancedSearch-module__adv-search-input___P4KON","has-error":"AdvancedSearch-module__has-error___s5lKX","adv-search-buttons":"AdvancedSearch-module__adv-search-buttons___SlrG5"};
/***/ }),
/***/ "./src/components/AdvancedSearch/index.js":
/*!************************************************!*\
!*** ./src/components/AdvancedSearch/index.js ***!
\************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ AdvancedSearch: () => (/* reexport safe */ _AdvancedSearch_component__WEBPACK_IMPORTED_MODULE_0__.AdvancedSearch)
/* harmony export */ });
/* harmony import */ var _AdvancedSearch_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AdvancedSearch.component */ "./src/components/AdvancedSearch/AdvancedSearch.component.js");
/***/ }),
/***/ "./src/components/Badges/BadgeCheckboxes/BadgeCheckboxes.component.js":
/*!****************************************************************************!*\
!*** ./src/components/Badges/BadgeCheckboxes/BadgeCheckboxes.component.js ***!
\****************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeCheckboxes: () => (/* binding */ BadgeCheckboxes)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../facetedSearch.propTypes */ "./src/components/facetedSearch.propTypes.js");
/* harmony import */ var _BadgeFaceted__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../BadgeFaceted */ "./src/components/Badges/BadgeFaceted/index.js");
/* harmony import */ var _BadgeCheckboxesForm_component__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./BadgeCheckboxesForm.component */ "./src/components/Badges/BadgeCheckboxes/BadgeCheckboxesForm.component.js");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @talend/react-components */ "@talend/react-components");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const getSelectBadgeLabel = (value, t) => {
const labelAll = t('FACETED_SEARCH_VALUE_ALL', {
defaultValue: 'All'
});
if (value) {
const checkedCheckboxes = value.filter(v => v.checked);
if (checkedCheckboxes.length > 3) {
return t('FACETED_SEARCH_VALUES_COUNT', {
count: checkedCheckboxes.length,
defaultValue: '{{count}} values'
});
} else if (!checkedCheckboxes.length) {
return labelAll;
}
return checkedCheckboxes.map(val => val.label);
}
return labelAll;
};
// eslint-disable-next-line import/prefer-default-export
const BadgeCheckboxes = ({
id,
readOnly,
removable,
label,
initialOperatorOpened,
initialValueOpened,
operator,
operators,
size,
value,
category,
values,
displayType,
filterBarPlaceholder,
allSelector,
t,
callbacks,
...rest
}) => {
const [options, setOptions] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(values || []);
const [isLoading, setIsLoading] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(true);
const callback = callbacks && callbacks[rest.attribute];
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
if (values !== null && values !== void 0 && values.length || !callback || !callback.getOptions) {
setIsLoading(false);
return;
}
setIsLoading(true);
callback.getOptions().then(data => {
setOptions(data.map(item => {
if ((0,lodash__WEBPACK_IMPORTED_MODULE_6__.isObject)(item)) {
return {
id: item.id,
label: item.label
};
}
return {
id: item,
label: item
};
}));
}).finally(() => {
setIsLoading(false);
});
}, [callbacks]);
const currentOperators = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => operators, [operators]);
const currentOperator = operator || currentOperators && currentOperators[0];
const badgeCheckboxesId = `${id}-badge-checkboxes`;
const badgeLabel = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => getSelectBadgeLabel(value, t), [value, t]);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_BadgeFaceted__WEBPACK_IMPORTED_MODULE_3__.BadgeFaceted, {
badgeId: id,
displayType: displayType,
id: badgeCheckboxesId,
initialOperatorOpened: initialOperatorOpened,
initialValueOpened: initialValueOpened,
labelCategory: label,
labelValue: badgeLabel,
operator: currentOperator,
operators: currentOperators,
readOnly: readOnly,
removable: removable,
size: size,
t: t,
value: value || [],
children: ({
onSubmitBadge,
onChangeValue,
badgeValue
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_BadgeCheckboxesForm_component__WEBPACK_IMPORTED_MODULE_4__.BadgeCheckboxesForm, {
id: badgeCheckboxesId,
onChange: onChangeValue,
onSubmit: onSubmitBadge,
value: badgeValue,
checkboxValues: options,
feature: category || label,
filterBarPlaceholder: filterBarPlaceholder,
allSelector: allSelector,
isLoading: isLoading,
...rest
})
});
};
BadgeCheckboxes.propTypes = {
label: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
initialOperatorOpened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
initialValueOpened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
operator: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__.operatorPropTypes,
operators: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__.operatorsPropTypes,
size: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__.Badge.SIZES)),
category: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
value: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_1___default().string), prop_types__WEBPACK_IMPORTED_MODULE_1___default().arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_1___default().shape({
checked: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
label: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired
}))]),
readOnly: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
removable: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
values: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().array),
t: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
callbacks: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__.callbacksPropTypes,
displayType: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__.Badge.TYPES)),
filterBarPlaceholder: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
allSelector: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool)
};
/***/ }),
/***/ "./src/components/Badges/BadgeCheckboxes/BadgeCheckboxes.module.scss":
/*!***************************************************************************!*\
!*** ./src/components/Badges/BadgeCheckboxes/BadgeCheckboxes.module.scss ***!
\***************************************************************************/
/***/ ((module) => {
// extracted by mini-css-extract-plugin
module.exports = {"fs-badge-checkbox-form-checkboxes":"BadgeCheckboxes-module__fs-badge-checkbox-form-checkboxes___CVP45"};
/***/ }),
/***/ "./src/components/Badges/BadgeCheckboxes/BadgeCheckboxesForm.component.js":
/*!********************************************************************************!*\
!*** ./src/components/Badges/BadgeCheckboxes/BadgeCheckboxesForm.component.js ***!
\********************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeCheckboxesForm: () => (/* binding */ BadgeCheckboxesForm)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-i18next */ "react-i18next");
/* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_i18next__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @talend/design-system */ "@talend/design-system");
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _talend_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @talend/utils */ "../utils/lib-esm/index.js");
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../constants */ "./src/constants.js");
/* harmony import */ var _helpers_usage_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../helpers/usage.helpers */ "./src/helpers/usage.helpers.js");
/* harmony import */ var _BadgeCheckboxes_module_scss__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./BadgeCheckboxes.module.scss */ "./src/components/Badges/BadgeCheckboxes/BadgeCheckboxes.module.scss");
/* harmony import */ var _BadgeCheckboxes_module_scss__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_BadgeCheckboxes_module_scss__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
/* eslint-disable jsx-a11y/no-autofocus */
const createCheckboxEntity = value => checkbox => {
const entity = value.find(v => v.id === checkbox.id);
return {
id: checkbox.id,
label: checkbox.label,
checked: entity ? entity.checked : checkbox.checked || false
};
};
const getCheckboxes = (checkboxes, value, filterValue, showAll) => {
const formatFilterValue = filterValue.trim().toLocaleLowerCase();
return checkboxes.filter(checkbox => (0,lodash__WEBPACK_IMPORTED_MODULE_8__.get)(checkbox, 'label', '').toLocaleLowerCase().includes(formatFilterValue)).map(createCheckboxEntity(value)).filter(checkbox => showAll ? true : checkbox.checked);
};
const BadgeCheckboxesForm = ({
checkboxValues,
id,
onChange,
onSubmit,
value,
feature,
filterBarPlaceholder,
allSelector,
...rest
}) => {
const {
t
} = (0,react_i18next__WEBPACK_IMPORTED_MODULE_1__.useTranslation)(_constants__WEBPACK_IMPORTED_MODULE_5__.I18N_DOMAIN_FACETED_SEARCH);
const [filter, setFilter] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)('');
const [showAll, setShowAll] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(true);
const leftBtnLabel = showAll ? t('NB_SELECTED_TAGS', {
count: value.length,
defaultValue: '{{count}} selected'
}) : t('SHOW_ALL_TAGS', {
defaultValue: 'Show all'
});
const badgeCheckBoxesFormId = `${id}-checkboxes-form`;
const checkboxes = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(getCheckboxes(checkboxValues, value, filter, showAll), [checkboxValues, value, filter, showAll]);
const applyDataFeature = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => (0,_helpers_usage_helpers__WEBPACK_IMPORTED_MODULE_6__.getApplyDataFeature)(feature), [feature]);
const onChangeCheckBoxes = (event, checkboxId) => {
const entity = checkboxes.find(checkboxValue => checkboxValue.id === checkboxId);
if (entity) {
entity.checked = event.target.checked;
}
onChange(event, checkboxes.filter(c => c.checked));
};
const onToggleAll = event => {
const checked = event.target.checked;
if (checked) {
const checkedCheckboxes = checkboxes.map(entity => ({
...entity,
checked: true
}));
onChange(event, checkedCheckboxes);
} else {
onChange(event, []);
}
};
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.Form, {
id: `${badgeCheckBoxesFormId}-form`,
onSubmit: onSubmit,
children: [allSelector ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.Fragment, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.Form.Checkbox, {
id: 'selectAll-checkbox',
onChange: onToggleAll,
label: t('FACETED_SEARCH_VALUE_ALL', {
defaultValue: 'All'
}),
checked: checkboxes.filter(c => c.checked).length === checkboxValues.length,
"data-test": "badge-checkbox-form-checkbox-selectAll",
"data-testid": "badge-checkbox-form-checkbox-selectAll"
}, "selectAll"), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.Divider, {
orientation: "horizontal"
})]
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.Form.Search, {
id: `${badgeCheckBoxesFormId}-filter`,
placeholder: filterBarPlaceholder || t('FIND_COLUMN_FILTER_PLACEHOLDER', {
defaultValue: 'Find a column'
}),
onChange: event => {
var _event$target;
setFilter((event === null || event === void 0 ? void 0 : (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value) || '');
},
value: filter,
"data-test": "badge-checkbox-form-filter",
"data-testid": "badge-checkbox-form-filter"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", {
className: (_BadgeCheckboxes_module_scss__WEBPACK_IMPORTED_MODULE_7___default()["fs-badge-checkbox-form-checkboxes"]),
children: !rest.isLoading ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.StackVertical, {
gap: "S",
children: checkboxes.map(checkbox => {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.Form.Checkbox, {
id: `${checkbox.id}-checkbox`,
label: checkbox.label,
onChange: event => {
onChangeCheckBoxes(event, checkbox.id);
},
checked: checkbox.checked,
"data-testid": `badge-checkbox-form-checkbox-${checkbox.id}`,
"data-test": `badge-checkbox-form-checkbox-${checkbox.id}`
}, checkbox.id);
})
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.StackVertical, {
gap: "S",
"data-testid": "badge-checkbox-form-skeleton-item",
"data-test": "badge-checkbox-form-skeleton-item",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.SkeletonHeading, {
size: "L",
width: "100"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.SkeletonHeading, {
size: "L",
width: "100"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.SkeletonHeading, {
size: "L",
width: "100"
})]
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.Form.Buttons, {
padding: {
x: 0,
bottom: 0,
top: 'M'
},
children: [value.length > 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.ButtonTertiary, {
type: "button",
onClick: () => {
setFilter('');
setShowAll(!showAll);
},
children: leftBtnLabel
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.ButtonPrimary, {
"data-feature": applyDataFeature,
type: "submit",
disabled: rest.isLoading,
...(0,_talend_utils__WEBPACK_IMPORTED_MODULE_4__.getDataAttrFromProps)(rest),
children: t('APPLY', {
defaultValue: 'Apply'
})
})]
})]
})
});
};
BadgeCheckboxesForm.propTypes = {
checkboxValues: prop_types__WEBPACK_IMPORTED_MODULE_2___default().arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_2___default().shape({
checked: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().bool),
id: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string).isRequired,
label: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string).isRequired
})),
id: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string).isRequired,
onChange: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func),
onSubmit: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func).isRequired,
value: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().array),
feature: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string).isRequired,
filterBarPlaceholder: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string),
allSelector: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().bool)
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/Badges/BadgeCheckboxes/index.js":
/*!********************************************************!*\
!*** ./src/components/Badges/BadgeCheckboxes/index.js ***!
\********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeCheckboxes: () => (/* reexport safe */ _BadgeCheckboxes_component__WEBPACK_IMPORTED_MODULE_0__.BadgeCheckboxes),
/* harmony export */ BadgeCheckboxesForm: () => (/* reexport safe */ _BadgeCheckboxesForm_component__WEBPACK_IMPORTED_MODULE_1__.BadgeCheckboxesForm)
/* harmony export */ });
/* harmony import */ var _BadgeCheckboxes_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BadgeCheckboxes.component */ "./src/components/Badges/BadgeCheckboxes/BadgeCheckboxes.component.js");
/* harmony import */ var _BadgeCheckboxesForm_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BadgeCheckboxesForm.component */ "./src/components/Badges/BadgeCheckboxes/BadgeCheckboxesForm.component.js");
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/Badges/BadgeDate/BadgeDate.component.js":
/*!****************************************************************!*\
!*** ./src/components/Badges/BadgeDate/BadgeDate.component.js ***!
\****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeDate: () => (/* binding */ BadgeDate)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var date_fns_format__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! date-fns/format */ "../../node_modules/date-fns/format.mjs");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _dictionary_operator_dictionary__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../dictionary/operator.dictionary */ "./src/dictionary/operator.dictionary.js");
/* harmony import */ var _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../facetedSearch.propTypes */ "./src/components/facetedSearch.propTypes.js");
/* harmony import */ var _BadgeFaceted__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../BadgeFaceted */ "./src/components/Badges/BadgeFaceted/index.js");
/* harmony import */ var _BadgeDateForm_component__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./BadgeDateForm.component */ "./src/components/Badges/BadgeDate/BadgeDateForm.component.js");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @talend/react-components */ "@talend/react-components");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_talend_react_components__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const DATE_FORMAT = 'yyyy-MM-dd';
const defaultOperatorsName = [_dictionary_operator_dictionary__WEBPACK_IMPORTED_MODULE_2__.operatorNames.notEquals, _dictionary_operator_dictionary__WEBPACK_IMPORTED_MODULE_2__.operatorNames.equals, _dictionary_operator_dictionary__WEBPACK_IMPORTED_MODULE_2__.operatorNames.greaterThan, _dictionary_operator_dictionary__WEBPACK_IMPORTED_MODULE_2__.operatorNames.greaterThanOrEquals, _dictionary_operator_dictionary__WEBPACK_IMPORTED_MODULE_2__.operatorNames.lessThan, _dictionary_operator_dictionary__WEBPACK_IMPORTED_MODULE_2__.operatorNames.lessThanOrEquals];
const createDefaultOperators = t => Object.values((0,_dictionary_operator_dictionary__WEBPACK_IMPORTED_MODULE_2__.createOperatorsDict)(t)).filter(operator => defaultOperatorsName.includes(operator.name));
const BadgeDate = ({
id,
initialOperatorOpened,
initialValueOpened,
label,
operator,
operators,
size,
t,
value,
category,
readOnly,
removable,
displayType,
...rest
}) => {
const currentOperators = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => operators || createDefaultOperators(t), [operators, t]);
const currentOperator = operator || currentOperators[0];
const badgeDateId = `${id}-badge-date`;
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_BadgeFaceted__WEBPACK_IMPORTED_MODULE_4__.BadgeFaceted, {
badgeId: id,
displayType: displayType,
id: badgeDateId,
initialOperatorOpened: initialOperatorOpened,
initialValueOpened: initialValueOpened,
labelCategory: label,
labelValue: value ? (0,date_fns_format__WEBPACK_IMPORTED_MODULE_8__.format)(value, DATE_FORMAT) : t('FACETED_SEARCH_VALUE_ALL', {
defaultValue: 'All'
}),
operator: currentOperator,
operators: currentOperators,
readOnly: readOnly,
removable: removable,
size: size,
t: t,
value: value || '',
children: ({
onSubmitBadge,
onChangeValue,
badgeValue
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_BadgeDateForm_component__WEBPACK_IMPORTED_MODULE_5__.BadgeDateForm, {
id: badgeDateId,
onChange: onChangeValue,
onSubmit: onSubmitBadge,
value: badgeValue,
feature: category || label,
t: t,
...rest
})
});
};
BadgeDate.propTypes = {
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
initialOperatorOpened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
initialValueOpened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
label: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
operator: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_3__.operatorPropTypes,
operators: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_3__.operatorsPropTypes,
size: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_6__.Badge.SIZES)),
t: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
value: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().number),
category: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
readOnly: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
removable: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
displayType: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_6__.Badge.TYPES))
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/Badges/BadgeDate/BadgeDate.module.scss":
/*!***************************************************************!*\
!*** ./src/components/Badges/BadgeDate/BadgeDate.module.scss ***!
\***************************************************************/
/***/ ((module) => {
// extracted by mini-css-extract-plugin
module.exports = {"tc-badge-date-form-picker-container":"BadgeDate-module__tc-badge-date-form-picker-container___W3TRi"};
/***/ }),
/***/ "./src/components/Badges/BadgeDate/BadgeDateForm.component.js":
/*!********************************************************************!*\
!*** ./src/components/Badges/BadgeDate/BadgeDateForm.component.js ***!
\********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeDateForm: () => (/* binding */ BadgeDateForm)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var date_fns_startOfDay__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! date-fns/startOfDay */ "../../node_modules/date-fns/startOfDay.mjs");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @talend/design-system */ "@talend/design-system");
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _talend_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @talend/utils */ "../utils/lib-esm/index.js");
/* harmony import */ var _helpers_usage_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../helpers/usage.helpers */ "./src/helpers/usage.helpers.js");
/* harmony import */ var _BadgeDate_module_scss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./BadgeDate.module.scss */ "./src/components/Badges/BadgeDate/BadgeDate.module.scss");
/* harmony import */ var _BadgeDate_module_scss__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_BadgeDate_module_scss__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @talend/react-components */ "@talend/react-components");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_talend_react_components__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const BadgeDateForm = ({
id,
onChange,
onSubmit,
value,
feature,
t,
...rest
}) => {
const applyDataFeature = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => (0,_helpers_usage_helpers__WEBPACK_IMPORTED_MODULE_4__.getApplyDataFeature)(feature), [feature]);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.Form, {
id: `${id}-date-`,
onSubmit: onSubmit,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(_talend_react_components__WEBPACK_IMPORTED_MODULE_6__.DatePicker.Manager, {
id: `${id}-date-picker-manager`,
value: value,
onChange: (event, data) => {
if (!data.errors.length) {
onChange(event, (0,date_fns_startOfDay__WEBPACK_IMPORTED_MODULE_8__.startOfDay)(data.date).getTime());
}
},
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div", {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("label", {
htmlFor: `${id}-date-input`,
children: t('SELECT_A_DATE', 'Select a date')
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_talend_react_components__WEBPACK_IMPORTED_MODULE_6__.DatePicker.Input, {
id: `${id}-date-input`,
placeholder: t('TYPE_HERE', {
defaultValue: 'Type here'
})
})]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
className: (_BadgeDate_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["tc-badge-date-form-picker-container"]),
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_talend_react_components__WEBPACK_IMPORTED_MODULE_6__.DatePicker.Picker, {})
})]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.Form.Buttons, {
padding: {
x: 0,
bottom: 0,
top: 'M'
},
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.ButtonPrimary, {
"data-feature": applyDataFeature,
type: "submit",
...(0,_talend_utils__WEBPACK_IMPORTED_MODULE_3__.getDataAttrFromProps)(rest),
children: t('APPLY', {
defaultValue: 'Apply'
})
})
})]
});
};
BadgeDateForm.propTypes = {
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
onChange: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
onSubmit: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
value: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().number),
feature: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
t: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/Badges/BadgeFaceted/BadgeFaceted.component.js":
/*!**********************************************************************!*\
!*** ./src/components/Badges/BadgeFaceted/BadgeFaceted.component.js ***!
\**********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeFaceted: () => (/* binding */ BadgeFaceted)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "classnames");
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../constants */ "./src/constants.js");
/* harmony import */ var _hooks_badgeOverlayFlow_hook__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../hooks/badgeOverlayFlow.hook */ "./src/hooks/badgeOverlayFlow.hook.js");
/* harmony import */ var _hooks_facetedBadges_hook__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../hooks/facetedBadges.hook */ "./src/hooks/facetedBadges.hook.js");
/* harmony import */ var _context_badgeFaceted_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../context/badgeFaceted.context */ "./src/components/context/badgeFaceted.context.js");
/* harmony import */ var _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../facetedSearch.propTypes */ "./src/components/facetedSearch.propTypes.js");
/* harmony import */ var _BadgeOperator__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../BadgeOperator */ "./src/components/Badges/BadgeOperator/index.js");
/* harmony import */ var _BadgeOverlay__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../BadgeOverlay */ "./src/components/Badges/BadgeOverlay/index.js");
/* harmony import */ var _BadgeFaceted_module_scss__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./BadgeFaceted.module.scss */ "./src/components/Badges/BadgeFaceted/BadgeFaceted.module.scss");
/* harmony import */ var _BadgeFaceted_module_scss__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_BadgeFaceted_module_scss__WEBPACK_IMPORTED_MODULE_10__);
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @talend/react-components */ "@talend/react-components");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_talend_react_components__WEBPACK_IMPORTED_MODULE_11__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_12__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const findOperatorByName = name => operator => name === operator.name;
const BadgeFaceted = ({
badgeId,
displayType,
children,
id,
labelCategory,
labelValue,
initialOperatorOpened,
initialValueOpened,
operator,
operators,
readOnly,
removable = true,
value,
size = _talend_react_components__WEBPACK_IMPORTED_MODULE_11__.Badge.SIZES.large,
type,
t
}) => {
const openValueJustAfterSelectionOfType = operators.length < 2 && initialOperatorOpened;
const [overlayState, overlayDispatch, onChangeOperatorOverlay, onChangeValueOverlay] = (0,_hooks_badgeOverlayFlow_hook__WEBPACK_IMPORTED_MODULE_4__.useBadgeOverlayFlow)(openValueJustAfterSelectionOfType ? false : initialOperatorOpened, openValueJustAfterSelectionOfType ? true : initialValueOpened);
const {
dispatch
} = (0,_context_badgeFaceted_context__WEBPACK_IMPORTED_MODULE_6__.useBadgeFacetedContext)();
const [badgeOperator, setBadgeOperator] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(operator);
const [badgeValue, setBadgeValue] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(value);
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
if (!(0,lodash__WEBPACK_IMPORTED_MODULE_12__.isEqual)(value, badgeValue)) {
setBadgeValue(value);
}
if (!(0,lodash__WEBPACK_IMPORTED_MODULE_12__.isEqual)(operator, badgeOperator)) {
setBadgeOperator(operator);
}
}, [value, operator]);
const onChangeOperator = (_, operatorName) => {
const foundOperator = operators.find(findOperatorByName(operatorName));
if (foundOperator) {
setBadgeOperator(foundOperator);
}
dispatch(_hooks_facetedBadges_hook__WEBPACK_IMPORTED_MODULE_5__.BADGES_ACTIONS.update(badgeId, {
operator: foundOperator
}));
overlayDispatch(_hooks_badgeOverlayFlow_hook__WEBPACK_IMPORTED_MODULE_4__.OVERLAY_FLOW_ACTIONS.openValue);
dispatch(_hooks_facetedBadges_hook__WEBPACK_IMPORTED_MODULE_5__.BADGES_ACTIONS.closeInitialOpened(badgeId));
};
const onChangeValue = (_, entityValue) => {
setBadgeValue(entityValue);
};
const onSubmitBadge = () => {
var _event;
overlayDispatch(_hooks_badgeOverlayFlow_hook__WEBPACK_IMPORTED_MODULE_4__.OVERLAY_FLOW_ACTIONS.closeAll);
(_event = event) === null || _event === void 0 ? void 0 : _event.preventDefault();
dispatch(_hooks_facetedBadges_hook__WEBPACK_IMPORTED_MODULE_5__.BADGES_ACTIONS.update(badgeId, {
value: badgeValue,
operator: badgeOperator,
initialOperatorOpened: false,
initialValueOpened: false
}, {
isInCreation: false
}));
};
const onDeleteBadge = () => {
dispatch(_hooks_facetedBadges_hook__WEBPACK_IMPORTED_MODULE_5__.BADGES_ACTIONS.delete(badgeId));
};
const onHideOverlayOperator = () => {
overlayDispatch(_hooks_badgeOverlayFlow_hook__WEBPACK_IMPORTED_MODULE_4__.OVERLAY_FLOW_ACTIONS.closeAll);
dispatch(_hooks_facetedBadges_hook__WEBPACK_IMPORTED_MODULE_5__.BADGES_ACTIONS.closeInitialOpened(badgeId));
};
const onHideSubmitBadge = (...args) => {
dispatch(_hooks_facetedBadges_hook__WEBPACK_IMPORTED_MODULE_5__.BADGES_ACTIONS.closeInitialOpened(badgeId));
onSubmitBadge(...args);
};
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(_talend_react_components__WEBPACK_IMPORTED_MODULE_11__.Badge, {
id: id,
className: classnames__WEBPACK_IMPORTED_MODULE_1___default()((_BadgeFaceted_module_scss__WEBPACK_IMPORTED_MODULE_10___default()["tc-badge-faceted"]), type),
display: size,
type: displayType,
children: [labelCategory && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.Fragment, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_talend_react_components__WEBPACK_IMPORTED_MODULE_11__.Badge.Category, {
category: labelCategory,
label: labelCategory
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_BadgeOperator__WEBPACK_IMPORTED_MODULE_8__.BadgeOperatorOverlay, {
id: id,
onChangeOverlay: onChangeOperatorOverlay,
onHideOverlay: onHideOverlayOperator,
operatorLabel: badgeOperator.label,
operatorIconName: badgeOperator.iconName,
opened: overlayState.operatorOpened,
onClick: onChangeOperator,
operators: operators,
readOnly: readOnly,
size: size
})]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_BadgeOverlay__WEBPACK_IMPORTED_MODULE_9__.BadgeOverlay, {
id: id,
className: (_BadgeFaceted_module_scss__WEBPACK_IMPORTED_MODULE_10___default()["tc-badge-faceted-overlay"]),
showSpecialChars: !!displayType,
label: labelValue,
onHide: onHideSubmitBadge,
opened: overlayState.valueOpened,
onChange: onChangeValueOverlay,
readOnly: readOnly,
children: children({
onSubmitBadge,
onChangeValue,
badgeValue
})
}), removable && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_talend_react_components__WEBPACK_IMPORTED_MODULE_11__.Badge.DeleteAction, {
id: id,
label: t('DELETE_BADGE_ACTION', {
defaultValue: 'Remove filter'
}),
dataFeature: _constants__WEBPACK_IMPORTED_MODULE_3__.USAGE_TRACKING_TAGS.BADGE_REMOVE,
onClick: onDeleteBadge,
t: t
})]
});
};
BadgeFaceted.propTypes = {
badgeId: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string).isRequired,
displayType: prop_types__WEBPACK_IMPORTED_MODULE_2___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_11__.Badge.TYPES)),
labelCategory: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string).isRequired,
children: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func).isRequired,
id: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string).isRequired,
initialOperatorOpened: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().bool),
initialValueOpened: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().bool),
labelValue: prop_types__WEBPACK_IMPORTED_MODULE_2___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_2___default().string), prop_types__WEBPACK_IMPORTED_MODULE_2___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_2___default().string))]),
operator: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_7__.operatorPropTypes.isRequired,
operators: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_7__.operatorsPropTypes.isRequired,
size: prop_types__WEBPACK_IMPORTED_MODULE_2___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_11__.Badge.SIZES)),
value: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().any),
readOnly: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().bool),
removable: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().bool),
type: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string),
t: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func).isRequired
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/Badges/BadgeFaceted/BadgeFaceted.module.scss":
/*!*********************************************************************!*\
!*** ./src/components/Badges/BadgeFaceted/BadgeFaceted.module.scss ***!
\*********************************************************************/
/***/ ((module) => {
// extracted by mini-css-extract-plugin
module.exports = {"tc-badge-faceted":"BadgeFaceted-module__tc-badge-faceted___DHyq_","tc-badge-faceted-overlay":"BadgeFaceted-module__tc-badge-faceted-overlay___TKkVf"};
/***/ }),
/***/ "./src/components/Badges/BadgeFaceted/index.js":
/*!*****************************************************!*\
!*** ./src/components/Badges/BadgeFaceted/index.js ***!
\*****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeFaceted: () => (/* reexport safe */ _BadgeFaceted_component__WEBPACK_IMPORTED_MODULE_0__.BadgeFaceted)
/* harmony export */ });
/* harmony import */ var _BadgeFaceted_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BadgeFaceted.component */ "./src/components/Badges/BadgeFaceted/BadgeFaceted.component.js");
/***/ }),
/***/ "./src/components/Badges/BadgeMenu/BadgeMenu.component.js":
/*!****************************************************************!*\
!*** ./src/components/Badges/BadgeMenu/BadgeMenu.component.js ***!
\****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeMenu: () => (/* binding */ BadgeMenu)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../facetedSearch.propTypes */ "./src/components/facetedSearch.propTypes.js");
/* harmony import */ var _BadgeFaceted__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../BadgeFaceted */ "./src/components/Badges/BadgeFaceted/index.js");
/* harmony import */ var _BadgeMenuForm_component__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./BadgeMenuForm.component */ "./src/components/Badges/BadgeMenu/BadgeMenuForm.component.js");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @talend/react-components */ "@talend/react-components");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const getSelectBadgeLabel = (value, t) => {
const labelAll = t('FACETED_SEARCH_VALUE_ALL', {
defaultValue: 'All'
});
if (!(0,lodash__WEBPACK_IMPORTED_MODULE_6__.isEmpty)(value)) {
return value.label;
}
return labelAll;
};
// eslint-disable-next-line import/prefer-default-export
const BadgeMenu = ({
id,
readOnly,
removable,
label,
initialOperatorOpened,
initialValueOpened,
operator,
operators,
size,
value,
values,
displayType,
filterBarPlaceholder,
t,
callbacks,
...rest
}) => {
const [options, setOptions] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(values);
const currentOperators = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => operators, [operators]);
const currentOperator = operator || currentOperators && currentOperators[0];
const [isLoading, setIsLoading] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(true);
const callback = callbacks && callbacks[rest.attribute];
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
if (!callback || !callback.getOptions) {
setIsLoading(false);
return;
}
setIsLoading(true);
callback.getOptions().then(data => {
setOptions(data.map(item => {
if ((0,lodash__WEBPACK_IMPORTED_MODULE_6__.isObject)(item)) {
return {
id: item.id,
label: item.label
};
}
return {
id: item,
label: item
};
}));
}).finally(() => {
setIsLoading(false);
});
}, [callback]);
const badgeMenuId = `${id}-badge-menu`;
const badgeLabel = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => getSelectBadgeLabel(value, t), [value, t]);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_BadgeFaceted__WEBPACK_IMPORTED_MODULE_3__.BadgeFaceted, {
badgeId: id,
displayType: displayType,
id: badgeMenuId,
initialOperatorOpened: initialOperatorOpened,
initialValueOpened: initialValueOpened,
labelCategory: label,
labelValue: badgeLabel,
operator: currentOperator,
operators: currentOperators,
readOnly: readOnly,
removable: removable,
size: size,
t: t,
value: value || {},
children: ({
onSubmitBadge,
onChangeValue,
badgeValue
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_BadgeMenuForm_component__WEBPACK_IMPORTED_MODULE_4__.BadgeMenuForm, {
id: badgeMenuId,
onChange: onChangeValue,
onSubmit: onSubmitBadge,
value: badgeValue,
values: options,
filterBarPlaceholder: filterBarPlaceholder,
isLoading: isLoading,
t: t,
...rest
})
});
};
BadgeMenu.propTypes = {
label: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
initialOperatorOpened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
initialValueOpened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
operator: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__.operatorPropTypes,
operators: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__.operatorsPropTypes,
size: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__.Badge.SIZES)),
value: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_1___default().string), prop_types__WEBPACK_IMPORTED_MODULE_1___default().shape({
checked: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
label: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired
})]),
readOnly: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
removable: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
values: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().array),
callbacks: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__.callbacksPropTypes,
t: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
displayType: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__.Badge.TYPES)),
filterBarPlaceholder: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string)
};
/***/ }),
/***/ "./src/components/Badges/BadgeMenu/BadgeMenu.module.scss":
/*!***************************************************************!*\
!*** ./src/components/Badges/BadgeMenu/BadgeMenu.module.scss ***!
\***************************************************************/
/***/ ((module) => {
// extracted by mini-css-extract-plugin
module.exports = {"fs-badge-menu-form-items":"BadgeMenu-module__fs-badge-menu-form-items___GjXM1"};
/***/ }),
/***/ "./src/components/Badges/BadgeMenu/BadgeMenuForm.component.js":
/*!********************************************************************!*\
!*** ./src/components/Badges/BadgeMenu/BadgeMenuForm.component.js ***!
\********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeMenuForm: () => (/* binding */ BadgeMenuForm)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @talend/design-system */ "@talend/design-system");
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _talend_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @talend/utils */ "../utils/lib-esm/index.js");
/* harmony import */ var _BadgeMenu_module_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./BadgeMenu.module.scss */ "./src/components/Badges/BadgeMenu/BadgeMenu.module.scss");
/* harmony import */ var _BadgeMenu_module_scss__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_BadgeMenu_module_scss__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
/* eslint-disable jsx-a11y/no-autofocus */
const createRowItemEntity = value => option => {
return {
id: option.id,
label: option.label,
checked: option.id === value.id
};
};
const getRows = (values, value) => {
return values.map(createRowItemEntity(value));
};
const getVisibleRows = (rows, filterValue, showAll) => {
const formatFilterValue = filterValue.trim().toLocaleLowerCase();
return rows.filter(option => (0,lodash__WEBPACK_IMPORTED_MODULE_5__.get)(option, 'label', '').toLocaleLowerCase().includes(formatFilterValue)).filter(row => showAll ? true : row.checked);
};
const BadgeMenuForm = ({
values,
id,
onChange,
onSubmit,
value,
filterBarPlaceholder,
t,
...rest
}) => {
const [filter, setFilter] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)('');
const [showAll, setShowAll] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(true);
const badgeMenuFormId = `${id}-menu-form`;
const items = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => getRows(values, value), [values, value]);
const visibleItems = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => getVisibleRows(items, filter, showAll), [items, filter, showAll]);
const showSelectedToggleLabel = showAll ? t('SHOW_SELECTED_ITEMS', {
defaultValue: 'Show selected'
}) : t('SHOW_ALL_ITEMS', {
defaultValue: 'Show all'
});
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.Form, {
id: `${badgeMenuFormId}-form`,
onSubmit: onSubmit,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.Form.Search, {
id: `${badgeMenuFormId}-filter`,
placeholder: filterBarPlaceholder || t('FIND_COLUMN_FILTER_PLACEHOLDER', {
defaultValue: 'Find a column'
}),
onChange: event => {
var _event$target;
setFilter((event === null || event === void 0 ? void 0 : (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value) || '');
},
value: filter,
"data-test": "badge-menu-filter",
"data-testid": "badge-menu-filter"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
className: (_BadgeMenu_module_scss__WEBPACK_IMPORTED_MODULE_4___default()["fs-badge-menu-form-items"]),
children: !rest.isLoading ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.StackVertical, {
gap: "0",
children: visibleItems.map(rowItem => {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.DropdownButton, {
onClick: event => {
onChange(event, rowItem);
},
checked: rowItem.checked,
"data-testid": `badge-menu-form-item-${rowItem.id}`,
"data-test": `badge-menu-form-item-${rowItem.id}`,
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("span", {
children: rowItem.label
})
}, rowItem.id);
})
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.StackVertical, {
gap: "S",
"data-testid": "badge-menu-form-skeleton-item",
"data-test": "badge-menu-form-skeleton-item",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.SkeletonHeading, {
size: "L",
width: "100"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.SkeletonHeading, {
size: "L",
width: "100"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.SkeletonHeading, {
size: "L",
width: "100"
})]
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.Form.Buttons, {
padding: {
x: 0,
bottom: 0,
top: 'M'
},
children: [!(0,lodash__WEBPACK_IMPORTED_MODULE_5__.isEmpty)(value) && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.ButtonTertiary, {
type: "button",
onClick: () => {
setShowAll(!showAll);
setFilter('');
},
children: showSelectedToggleLabel
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.ButtonPrimary, {
type: "submit",
disabled: rest.isLoading,
...(0,_talend_utils__WEBPACK_IMPORTED_MODULE_3__.getDataAttrFromProps)(rest),
children: t('APPLY', {
defaultValue: 'Apply'
})
})]
})]
});
};
BadgeMenuForm.propTypes = {
values: prop_types__WEBPACK_IMPORTED_MODULE_1___default().arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_1___default().shape({
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
label: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
checked: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool)
})),
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
onChange: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
onSubmit: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
value: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().object),
filterBarPlaceholder: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
t: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired
};
/***/ }),
/***/ "./src/components/Badges/BadgeNumber/BadgeNumber.component.js":
/*!********************************************************************!*\
!*** ./src/components/Badges/BadgeNumber/BadgeNumber.component.js ***!
\********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeNumber: () => (/* binding */ BadgeNumber)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _BadgeFaceted__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../BadgeFaceted */ "./src/components/Badges/BadgeFaceted/index.js");
/* harmony import */ var _BadgeNumberForm_component__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./BadgeNumberForm.component */ "./src/components/Badges/BadgeNumber/BadgeNumberForm.component.js");
/* harmony import */ var _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../facetedSearch.propTypes */ "./src/components/facetedSearch.propTypes.js");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @talend/react-components */ "@talend/react-components");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const createDefaultOperators = t => [{
label: t('FACETED_SEARCH_DOES_NOT_CONTAIN', {
defaultValue: 'Does not contain'
}),
name: 'notEquals',
iconName: 'not-equal'
}, {
label: t('FACETED_SEARCH_EQUAL', {
defaultValue: 'Equal'
}),
name: 'equals',
iconName: 'equal'
}, {
label: t('FACETED_SEARCH_GREATHER_THAN', {
defaultValue: 'Greater than'
}),
name: 'GreaterThan',
iconName: 'greater-than'
}, {
label: t('FACETED_SEARCH_GREATHER_THAN_OR_EQUAL', {
defaultValue: 'Greater than or equal'
}),
name: 'GreaterThanOrEquals',
iconName: 'greater-than-equal'
}, {
label: t('FACETED_SEARCH_LESS_THAN', {
defaultValue: 'Less than'
}),
name: 'LessThan',
iconName: 'less-than'
}, {
label: t('FACETED_SEARCH_LESS_THAN_OR_EQUAL', {
defaultValue: 'Less than or equal'
}),
name: 'LessThanOrEquals',
iconName: 'less-than-equal'
}];
const BadgeNumber = ({
id,
initialOperatorOpened,
initialValueOpened,
label,
operator,
operators,
size,
t,
value,
category,
readOnly,
removable,
displayType,
...rest
}) => {
const currentOperators = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => operators || createDefaultOperators(t), [operators, t]);
const currentOperator = operator || currentOperators[0];
const badgeTextId = `${id}-badge-number`;
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_BadgeFaceted__WEBPACK_IMPORTED_MODULE_2__.BadgeFaceted, {
badgeId: id,
displayType: displayType,
id: badgeTextId,
initialOperatorOpened: initialOperatorOpened,
initialValueOpened: initialValueOpened,
labelCategory: label,
labelValue: value || t('FACETED_SEARCH_VALUE_ALL', {
defaultValue: 'All'
}),
operator: currentOperator,
operators: currentOperators,
readOnly: readOnly,
removable: removable,
size: size,
t: t,
value: value || '',
children: ({
onSubmitBadge,
onChangeValue,
badgeValue
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_BadgeNumberForm_component__WEBPACK_IMPORTED_MODULE_3__.BadgeNumberForm, {
id: badgeTextId,
onChange: onChangeValue,
onSubmit: onSubmitBadge,
value: badgeValue,
feature: category || label,
t: t,
...rest
})
});
};
BadgeNumber.propTypes = {
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
initialOperatorOpened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
initialValueOpened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
label: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
operator: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_4__.operatorPropTypes,
operators: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_4__.operatorsPropTypes,
size: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__.Badge.SIZES)),
t: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
value: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
category: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
readOnly: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
removable: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
displayType: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__.Badge.TYPES))
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/Badges/BadgeNumber/BadgeNumberForm.component.js":
/*!************************************************************************!*\
!*** ./src/components/Badges/BadgeNumber/BadgeNumberForm.component.js ***!
\************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeNumberForm: () => (/* binding */ BadgeNumberForm)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @talend/design-system */ "@talend/design-system");
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _talend_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @talend/utils */ "../utils/lib-esm/index.js");
/* harmony import */ var _helpers_usage_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../helpers/usage.helpers */ "./src/helpers/usage.helpers.js");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const BadgeNumberForm = ({
id,
onChange,
onSubmit,
value,
feature,
t,
...rest
}) => {
const applyDataFeature = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => (0,_helpers_usage_helpers__WEBPACK_IMPORTED_MODULE_4__.getApplyDataFeature)(feature), [feature]);
const onChangeText = event => onChange(event, event.target.value);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.Form, {
id: `${id}-number`,
onSubmit: onSubmit,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.Form.Number, {
id: `${id}-input`,
placeholder: t('TYPE_HERE', {
defaultValue: 'Type here'
}),
onChange: onChangeText,
value: value
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.Form.Buttons, {
padding: {
x: 0,
bottom: 0,
top: 'M'
},
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.ButtonPrimary, {
type: "submit",
"data-feature": applyDataFeature,
...(0,_talend_utils__WEBPACK_IMPORTED_MODULE_3__.getDataAttrFromProps)(rest),
children: t('APPLY', {
defaultValue: 'Apply'
})
})
})]
});
};
BadgeNumberForm.propTypes = {
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
onChange: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
onSubmit: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
value: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
feature: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
t: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/Badges/BadgeOperator/BadgeOperator.module.scss":
/*!***********************************************************************!*\
!*** ./src/components/Badges/BadgeOperator/BadgeOperator.module.scss ***!
\***********************************************************************/
/***/ ((module) => {
// extracted by mini-css-extract-plugin
module.exports = {"tc-badge-operator":"BadgeOperator-module__tc-badge-operator___MCaag","tc-badge-operator-small":"BadgeOperator-module__tc-badge-operator-small___scYDh","tc-badge-operator-large":"BadgeOperator-module__tc-badge-operator-large___V3LgO","tc-badge-operator-button":"BadgeOperator-module__tc-badge-operator-button___EROdD","tc-badge-operator-popover":"BadgeOperator-module__tc-badge-operator-popover___SPLqf"};
/***/ }),
/***/ "./src/components/Badges/BadgeOperator/BadgeOperatorOverlay.component.js":
/*!*******************************************************************************!*\
!*** ./src/components/Badges/BadgeOperator/BadgeOperatorOverlay.component.js ***!
\*******************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeOperatorOverlay: () => (/* binding */ BadgeOperatorOverlay)
/* harmony export */ });
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! classnames */ "classnames");
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../facetedSearch.propTypes */ "./src/components/facetedSearch.propTypes.js");
/* harmony import */ var _BadgeOverlay__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../BadgeOverlay */ "./src/components/Badges/BadgeOverlay/index.js");
/* harmony import */ var _BadgeOperatorPopover_component__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./BadgeOperatorPopover.component */ "./src/components/Badges/BadgeOperator/BadgeOperatorPopover.component.js");
/* harmony import */ var _BadgeOperator_module_scss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./BadgeOperator.module.scss */ "./src/components/Badges/BadgeOperator/BadgeOperator.module.scss");
/* harmony import */ var _BadgeOperator_module_scss__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_BadgeOperator_module_scss__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @talend/react-components */ "@talend/react-components");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_talend_react_components__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const BadgeOperatorOverlay = ({
id,
onClick,
onChangeOverlay,
onHideOverlay,
opened,
operatorIconName,
operatorLabel,
operators,
readOnly,
size
}) => {
/**
* Trigger the callback passed in props
* @param {function} setOverlayOpened callback used to open / close the overlay
*/
const onClickRow = setOverlayOpened => (event, name) => {
if (onClick) {
onClick(event, name, setOverlayOpened);
}
};
const onHide = event => {
if (onHideOverlay) {
onHideOverlay(event);
}
};
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
className: classnames__WEBPACK_IMPORTED_MODULE_0___default()((_BadgeOperator_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["tc-badge-operator"]), {
[(_BadgeOperator_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["tc-badge-operator-small"])]: _talend_react_components__WEBPACK_IMPORTED_MODULE_6__.Badge.SIZES.small === size,
[(_BadgeOperator_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["tc-badge-operator-large"])]: _talend_react_components__WEBPACK_IMPORTED_MODULE_6__.Badge.SIZES.large === size
}),
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_BadgeOverlay__WEBPACK_IMPORTED_MODULE_3__.BadgeOverlay, {
className: (_BadgeOperator_module_scss__WEBPACK_IMPORTED_MODULE_5___default()["tc-badge-operator-button"]),
iconName: operatorIconName,
id: `${id}-operator`,
label: operatorLabel,
onChange: onChangeOverlay,
onHide: onHide,
opened: opened,
readOnly: readOnly,
children: setOverlayOpened => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_BadgeOperatorPopover_component__WEBPACK_IMPORTED_MODULE_4__.BadgeOperatorPopover, {
id: `${id}-operator`,
operators: operators,
onClick: onClickRow(setOverlayOpened)
})
})
});
};
BadgeOperatorOverlay.propTypes = {
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
onClick: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
onChangeOverlay: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
onHideOverlay: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
opened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
operatorIconName: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
operatorLabel: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
operators: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__.operatorsPropTypes.isRequired,
readOnly: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
size: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_6__.Badge.SIZES))
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/Badges/BadgeOperator/BadgeOperatorPopover.component.js":
/*!*******************************************************************************!*\
!*** ./src/components/Badges/BadgeOperator/BadgeOperatorPopover.component.js ***!
\*******************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeOperatorPopover: () => (/* binding */ BadgeOperatorPopover)
/* harmony export */ });
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @talend/design-system */ "@talend/design-system");
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_talend_design_system__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../facetedSearch.propTypes */ "./src/components/facetedSearch.propTypes.js");
/* harmony import */ var _BadgeOperator_module_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./BadgeOperator.module.scss */ "./src/components/Badges/BadgeOperator/BadgeOperator.module.scss");
/* harmony import */ var _BadgeOperator_module_scss__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_BadgeOperator_module_scss__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const BadgeOperatorRow = ({
onClick,
id,
name,
label,
iconName
}) => {
const onClickOperatorRow = event => {
onClick(event, name);
};
if (iconName) {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_1__.ButtonTertiary, {
id: `${id}-operator-row-button-${name}`,
icon: `talend-${iconName}`,
onClick: onClickOperatorRow,
children: label
});
}
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_1__.ButtonTertiary, {
id: `${id}-operator-row-button-${name}`,
onClick: onClickOperatorRow,
children: label
});
};
BadgeOperatorRow.propTypes = {
onClick: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func).isRequired,
id: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
name: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
label: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
iconName: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string)
};
const BadgeOperatorPopover = ({
id,
operators,
onClick
}) => {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", {
className: (_BadgeOperator_module_scss__WEBPACK_IMPORTED_MODULE_3___default()["tc-badge-operator-popover"]),
children: operators.map(operator => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(BadgeOperatorRow, {
id: id,
onClick: onClick,
...operator
}, `${id}-${operator.name}`))
});
};
BadgeOperatorPopover.propTypes = {
id: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired,
operators: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__.operatorsPropTypes.isRequired,
onClick: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func).isRequired
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/Badges/BadgeOperator/index.js":
/*!******************************************************!*\
!*** ./src/components/Badges/BadgeOperator/index.js ***!
\******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeOperatorOverlay: () => (/* reexport safe */ _BadgeOperatorOverlay_component__WEBPACK_IMPORTED_MODULE_0__.BadgeOperatorOverlay)
/* harmony export */ });
/* harmony import */ var _BadgeOperatorOverlay_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BadgeOperatorOverlay.component */ "./src/components/Badges/BadgeOperator/BadgeOperatorOverlay.component.js");
/***/ }),
/***/ "./src/components/Badges/BadgeOverlay/BadgeOverlay.component.js":
/*!**********************************************************************!*\
!*** ./src/components/Badges/BadgeOverlay/BadgeOverlay.component.js ***!
\**********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeOverlay: () => (/* binding */ BadgeOverlay)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @talend/design-system */ "@talend/design-system");
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _BadgeOverlay_module_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./BadgeOverlay.module.scss */ "./src/components/Badges/BadgeOverlay/BadgeOverlay.module.scss");
/* harmony import */ var _BadgeOverlay_module_scss__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_BadgeOverlay_module_scss__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @talend/react-components */ "@talend/react-components");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_talend_react_components__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const getChildren = (children, setOverlayOpened) => {
if (typeof children === 'function') {
return children(setOverlayOpened);
}
return children;
};
const labelFormatter = (value, showSpecialChars) => showSpecialChars ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_react_components__WEBPACK_IMPORTED_MODULE_4__.FormatValue, {
className: (_BadgeOverlay_module_scss__WEBPACK_IMPORTED_MODULE_3___default()["tc-badge-format-value"]),
value: value
}, value) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("span", {
children: value
}, value);
const getLabel = (labels, showSpecialChars) => {
const formatedLabels = Array.isArray(labels) ? labels.map(label => labelFormatter(label, showSpecialChars)) : labelFormatter(labels, showSpecialChars);
return formatedLabels;
};
/**
* The badge overlay can be use in two different ways.
* An automatic one where you can only set an initial state.
* Or a manual one where you have to provide an opened and a onChange function.
* On hide can be used in both, returning the overlay setter,
* which can be helpful if you are using the automatic way.
*/
const BadgeOverlay = ({
children,
className,
dataFeature,
iconName,
id,
initialOpened = false,
label,
onChange,
onHide,
opened = false,
readOnly,
showSpecialChars = false
}) => {
const [overlayOpened, setOverlayOpened] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialOpened);
const changeOpened = event => {
if (onChange) {
onChange(event, !opened);
} else {
setOverlayOpened(!overlayOpened);
}
};
const onHideOverlay = event => {
if (onHide) {
onHide(event, setOverlayOpened);
} else {
setOverlayOpened(false);
}
};
const currentOpened = opened || overlayOpened;
const buttonLabel = iconName ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_react_components__WEBPACK_IMPORTED_MODULE_4__.Icon, {
name: `talend-${iconName}`
}, "icon") : getLabel(label, showSpecialChars);
const button = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.ButtonTertiary, {
id: `${id}-action-overlay`,
"aria-label": label,
onClick: changeOpened,
disabled: readOnly,
"data-feature": dataFeature,
size: "S",
title: label,
children: buttonLabel
});
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", {
className: className,
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.Popover, {
id: `${id}-popover`,
disclosure: button,
isFixed: true,
placement: "bottom",
open: currentOpened,
onOpenChange: open => {
if (!open) {
onHideOverlay(open);
}
},
children: currentOpened && getChildren(children, setOverlayOpened)
})
});
};
BadgeOverlay.propTypes = {
children: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_1___default().element), prop_types__WEBPACK_IMPORTED_MODULE_1___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_1___default().element)), (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func)]).isRequired,
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
label: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_1___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_1___default().string)), (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string)]),
readOnly: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
initialOpened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
opened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
className: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
iconName: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
showSpecialChars: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
dataFeature: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
onChange: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
onHide: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func)
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/Badges/BadgeOverlay/BadgeOverlay.module.scss":
/*!*********************************************************************!*\
!*** ./src/components/Badges/BadgeOverlay/BadgeOverlay.module.scss ***!
\*********************************************************************/
/***/ ((module) => {
// extracted by mini-css-extract-plugin
module.exports = {"tc-badge-format-value":"BadgeOverlay-module__tc-badge-format-value___gOTHO"};
/***/ }),
/***/ "./src/components/Badges/BadgeOverlay/index.js":
/*!*****************************************************!*\
!*** ./src/components/Badges/BadgeOverlay/index.js ***!
\*****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeOverlay: () => (/* reexport safe */ _BadgeOverlay_component__WEBPACK_IMPORTED_MODULE_0__.BadgeOverlay)
/* harmony export */ });
/* harmony import */ var _BadgeOverlay_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BadgeOverlay.component */ "./src/components/Badges/BadgeOverlay/BadgeOverlay.component.js");
/***/ }),
/***/ "./src/components/Badges/BadgePeriod/BadgePeriod.component.js":
/*!********************************************************************!*\
!*** ./src/components/Badges/BadgePeriod/BadgePeriod.component.js ***!
\********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgePeriod: () => (/* binding */ BadgePeriod)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! date-fns */ "../../node_modules/date-fns/format.mjs");
/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! date-fns */ "../../node_modules/date-fns/isValid.mjs");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../facetedSearch.propTypes */ "./src/components/facetedSearch.propTypes.js");
/* harmony import */ var _BadgeFaceted__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../BadgeFaceted */ "./src/components/Badges/BadgeFaceted/index.js");
/* harmony import */ var _BadgePeriodForm_component__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./BadgePeriodForm.component */ "./src/components/Badges/BadgePeriod/BadgePeriodForm.component.js");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @talend/react-components */ "@talend/react-components");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const DATE_FORMAT_YYYY_DD_MM = 'yyyy-MM-dd';
function isDateRange(value) {
return value.id === 'CUSTOM';
}
function formatDate(date) {
return (0,date_fns__WEBPACK_IMPORTED_MODULE_8__.format)(date, DATE_FORMAT_YYYY_DD_MM);
}
function getRangeLabel(startDateTime, endDateTime, t) {
return `${formatDate(startDateTime)} ${t('TO', {
defaultValue: 'to'
})} ${formatDate(endDateTime)}`;
}
const getSelectBadgeLabel = (value, t) => {
const labelAll = t('FACETED_SEARCH_VALUE_ALL', {
defaultValue: 'All'
});
if ((0,lodash__WEBPACK_IMPORTED_MODULE_6__.isEmpty)(value)) return labelAll;
if (isDateRange(value) && (0,date_fns__WEBPACK_IMPORTED_MODULE_9__.isValid)(value.startDateTime) && (0,date_fns__WEBPACK_IMPORTED_MODULE_9__.isValid)(value.endDateTime)) {
return getRangeLabel(value.startDateTime, value.endDateTime, t);
}
return value.label || labelAll;
};
// eslint-disable-next-line import/prefer-default-export
const BadgePeriod = ({
displayType,
filterBarPlaceholder,
id,
initialOperatorOpened,
initialValueOpened,
label,
readOnly,
removable,
operator,
operators,
size,
value,
values,
t,
...rest
}) => {
const currentOperator = operator || (operators === null || operators === void 0 ? void 0 : operators[0]);
const badgePeriodId = `${id}-badge-period`;
const badgeLabel = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => getSelectBadgeLabel(value, t), [value, t]);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_BadgeFaceted__WEBPACK_IMPORTED_MODULE_3__.BadgeFaceted, {
badgeId: id,
displayType: displayType,
id: badgePeriodId,
initialOperatorOpened: initialOperatorOpened,
initialValueOpened: initialValueOpened,
labelCategory: label,
labelValue: badgeLabel,
operator: currentOperator,
operators: operators,
readOnly: readOnly,
removable: removable,
size: size,
t: t,
value: value || {},
type: "period",
children: ({
onSubmitBadge,
onChangeValue,
badgeValue
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_BadgePeriodForm_component__WEBPACK_IMPORTED_MODULE_4__.BadgePeriodForm, {
id: badgePeriodId,
onChange: onChangeValue,
onSubmit: onSubmitBadge,
value: badgeValue,
values: values,
t: t,
...rest
})
});
};
BadgePeriod.propTypes = {
displayType: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__.Badge.TYPES)),
filterBarPlaceholder: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
readOnly: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
removable: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
label: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
initialOperatorOpened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
initialValueOpened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
operator: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__.operatorPropTypes,
operators: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__.operatorsPropTypes,
size: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__.Badge.SIZES)),
value: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_1___default().string), prop_types__WEBPACK_IMPORTED_MODULE_1___default().shape({
checked: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
label: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired
})]),
values: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().array),
t: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired
};
BadgePeriod.defaultProps = {
readOnly: false,
removable: true,
initialOperatorOpened: false,
initialValueOpened: false
};
/***/ }),
/***/ "./src/components/Badges/BadgePeriod/BadgePeriodForm.component.js":
/*!************************************************************************!*\
!*** ./src/components/Badges/BadgePeriod/BadgePeriodForm.component.js ***!
\************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgePeriodForm: () => (/* binding */ BadgePeriodForm)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! date-fns */ "../../node_modules/date-fns/subDays.mjs");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @talend/design-system */ "@talend/design-system");
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _talend_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @talend/utils */ "../utils/lib-esm/index.js");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @talend/react-components */ "@talend/react-components");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_talend_react_components__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
function getPeriodOptions(t) {
return [{
id: 'LAST_24_HOURS',
value: 'lastDay',
label: t('LAST_24_HOURS', {
defaultValue: 'Last 24 hours'
})
}, {
id: 'LAST_3_DAYS',
value: 'last3days',
label: t('LAST_3_DAYS', {
defaultValue: 'Last 3 days'
})
}, {
id: 'LAST_WEEK',
value: 'last7days',
label: t('LAST_WEEK', {
defaultValue: 'Last 7 days'
})
}, {
id: 'LAST_MONTH',
value: 'last30days',
label: t('LAST_MONTH', {
defaultValue: 'Last 30 days'
})
}, {
id: 'CUSTOM',
value: 'custom',
label: t('CUSTOM', {
defaultValue: 'Custom'
})
}];
}
const BadgePeriodForm = ({
id,
onChange,
onSubmit,
t,
value,
...rest
}) => {
const [isCustom, setCustom] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(value.id === 'CUSTOM');
const badgePeriodFormId = `${id}-period-form`;
const goBack = () => setCustom(false);
const [dirty, setDirty] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
const initialStartDateTime = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => (0,date_fns__WEBPACK_IMPORTED_MODULE_6__.subDays)(new Date(), 1), []);
const initialEndDateTime = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => new Date(), []);
const options = rest.values || getPeriodOptions(t);
const resetRange = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => {
onChange(null, {
id: 'CUSTOM',
startDateTime: initialStartDateTime,
endDateTime: initialEndDateTime,
errorMessage: null
});
}, [onChange, initialStartDateTime, initialEndDateTime]);
const onSelectOption = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((rowItem, event) => {
if (rowItem.id === 'CUSTOM') {
setCustom(true);
onChange(event, {
id: 'CUSTOM',
startDateTime: initialStartDateTime,
endDateTime: initialEndDateTime,
errorMessage: null
});
} else {
onChange(event, rowItem);
setDirty(true);
}
}, [onChange, setDirty, initialStartDateTime, initialEndDateTime]);
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
if (dirty) {
onSubmit();
setDirty(false);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [dirty]);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.Form, {
id: `${badgePeriodFormId}-form`,
onSubmit: onSubmit,
children: [!isCustom && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.StackVertical, {
gap: "0",
align: "normal",
children: options.map(rowItem => {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.ButtonTertiary, {
onClick: event => onSelectOption(rowItem, event),
"data-testid": `badge-period-form-item-${rowItem.id}`,
"data-test": `badge-period-form-item-${rowItem.id}`,
...(0,_talend_utils__WEBPACK_IMPORTED_MODULE_3__.getDataAttrFromProps)(rowItem),
children: rowItem.id === 'CUSTOM' ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.StackHorizontal, {
gap: "0",
align: "center",
justify: "spaceBetween",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("span", {
children: rowItem.label
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.SizedIcon, {
name: "chevron-right",
size: "M"
})]
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("span", {
children: rowItem.label
})
}, rowItem.id);
})
}), isCustom && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.ButtonTertiary, {
"data-testid": "badge-period-form-custom-button",
icon: "chevron-left",
onClick: goBack,
...(0,_talend_utils__WEBPACK_IMPORTED_MODULE_3__.getDataAttrFromProps)(rest),
children: t('CUSTOM', {
defaultValue: 'Custom'
})
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_react_components__WEBPACK_IMPORTED_MODULE_4__.InputDateTimeRangePicker, {
id: `${badgePeriodFormId}-date-time-range-picker`,
startDateTime: (value === null || value === void 0 ? void 0 : value.startDateTime) || initialStartDateTime,
endDateTime: (value === null || value === void 0 ? void 0 : value.endDateTime) || initialEndDateTime,
onChange: (event, range) => {
onChange(event, {
...range,
id: 'CUSTOM'
});
}
}), (value === null || value === void 0 ? void 0 : value.errorMessage) && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.InlineMessageDestructive, {
description: value.errorMessage
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.Form.Buttons, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.ButtonTertiary, {
id: "reset-button",
disabled: rest.isLoading,
onClick: resetRange,
...(0,_talend_utils__WEBPACK_IMPORTED_MODULE_3__.getDataAttrFromProps)(rest),
children: t('RESET', {
defaultValue: 'Reset'
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.ButtonPrimary, {
id: "apply-button",
type: "submit",
disabled: rest.isLoading || !!(value !== null && value !== void 0 && value.errorMessage),
...(0,_talend_utils__WEBPACK_IMPORTED_MODULE_3__.getDataAttrFromProps)(rest),
children: t('APPLY', {
defaultValue: 'Apply'
})
})]
})]
})]
});
};
BadgePeriodForm.propTypes = {
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
onChange: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
onSubmit: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
value: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().object),
t: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired
};
/***/ }),
/***/ "./src/components/Badges/BadgeSlider/BadgeSlider.component.js":
/*!********************************************************************!*\
!*** ./src/components/Badges/BadgeSlider/BadgeSlider.component.js ***!
\********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeSlider: () => (/* binding */ BadgeSlider)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _BadgeFaceted__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../BadgeFaceted */ "./src/components/Badges/BadgeFaceted/index.js");
/* harmony import */ var _BadgeSliderForm_component__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./BadgeSliderForm.component */ "./src/components/Badges/BadgeSlider/BadgeSliderForm.component.js");
/* harmony import */ var _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../facetedSearch.propTypes */ "./src/components/facetedSearch.propTypes.js");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @talend/react-components */ "@talend/react-components");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const createDefaultOperators = t => [{
label: t('FACETED_SEARCH_EQUAL', {
defaultValue: 'Equal'
}),
name: 'equals',
iconName: 'equal'
}, {
label: t('FACETED_SEARCH_GREATHER_THAN', {
defaultValue: 'Greater than'
}),
name: 'GreaterThan',
iconName: 'greater-than'
}, {
label: t('FACETED_SEARCH_LESS_THAN', {
defaultValue: 'Less than'
}),
name: 'LessThan',
iconName: 'less-than'
}];
const BadgeSlider = ({
id,
initialOperatorOpened,
initialValueOpened,
label,
operator,
operators,
size,
t,
value,
category,
defaultValue = 0,
unit = '',
displayType,
...rest
}) => {
const currentOperators = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => operators || createDefaultOperators(t), [operators, t]);
const currentOperator = operator || currentOperators[0];
const numericValue = value != null ? value : defaultValue;
const labelValue = numericValue != null && `${numericValue}${unit}`;
const badgeTextId = `${id}-badge-slider`;
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_BadgeFaceted__WEBPACK_IMPORTED_MODULE_2__.BadgeFaceted, {
badgeId: id,
displayType: displayType,
id: badgeTextId,
initialOperatorOpened: initialOperatorOpened,
initialValueOpened: initialValueOpened,
labelCategory: label,
labelValue: labelValue,
operator: currentOperator,
operators: currentOperators,
size: size,
t: t,
value: value || defaultValue,
children: ({
onSubmitBadge,
onChangeValue,
badgeValue
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_BadgeSliderForm_component__WEBPACK_IMPORTED_MODULE_3__.BadgeSliderForm, {
id: badgeTextId,
onChange: onChangeValue,
onSubmit: onSubmitBadge,
operator: currentOperator,
value: badgeValue,
defaultValue: defaultValue,
feature: category || label,
unit: unit,
t: t,
...rest
})
});
};
BadgeSlider.propTypes = {
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
initialOperatorOpened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
initialValueOpened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
label: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
operator: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_4__.operatorPropTypes,
operators: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_4__.operatorsPropTypes,
size: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__.Badge.SIZES)),
t: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
value: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().number),
category: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
defaultValue: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().number),
unit: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
displayType: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__.Badge.TYPES))
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/Badges/BadgeSlider/BadgeSlider.module.scss":
/*!*******************************************************************!*\
!*** ./src/components/Badges/BadgeSlider/BadgeSlider.module.scss ***!
\*******************************************************************/
/***/ ((module) => {
// extracted by mini-css-extract-plugin
module.exports = {"tc-badge-slider-form-body":"BadgeSlider-module__tc-badge-slider-form-body___CqDC3","tc-badge-slider-form-body-row":"BadgeSlider-module__tc-badge-slider-form-body-row___CFcsy","tc-badge-slider-form-body-row-icon":"BadgeSlider-module__tc-badge-slider-form-body-row-icon___O0dKL","tc-badge-slider-form-body-row-value":"BadgeSlider-module__tc-badge-slider-form-body-row-value___rt3ZB","tc-badge-value-unit":"BadgeSlider-module__tc-badge-value-unit___Xglzb"};
/***/ }),
/***/ "./src/components/Badges/BadgeSlider/BadgeSliderForm.component.js":
/*!************************************************************************!*\
!*** ./src/components/Badges/BadgeSlider/BadgeSliderForm.component.js ***!
\************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeSliderForm: () => (/* binding */ BadgeSliderForm)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "classnames");
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @talend/design-system */ "@talend/design-system");
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _talend_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @talend/utils */ "../utils/lib-esm/index.js");
/* harmony import */ var _helpers_usage_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../helpers/usage.helpers */ "./src/helpers/usage.helpers.js");
/* harmony import */ var _BadgeSlider_module_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./BadgeSlider.module.scss */ "./src/components/Badges/BadgeSlider/BadgeSlider.module.scss");
/* harmony import */ var _BadgeSlider_module_scss__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_BadgeSlider_module_scss__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @talend/react-components */ "@talend/react-components");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_talend_react_components__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const getSliderMode = ({
name
}) => {
switch (name) {
case 'greaterThan':
return _talend_react_components__WEBPACK_IMPORTED_MODULE_7__.Slider.MODES.GREATER_THAN;
case 'equals':
return _talend_react_components__WEBPACK_IMPORTED_MODULE_7__.Slider.MODES.EQUALS;
default:
return null;
}
};
const getValidator = (decimal, min, max) => v => v != null && (v < min || v > max) || !decimal && v % 1 !== 0;
const getErrorMessage = (t, decimal, min, max, value) => {
if (!decimal && value % 1 !== 0) {
return t('FACETED_SEARCH_VALUE_SHOULD_BE_AN_INTEGER', {
defaultValue: 'Please fill with an integer value'
});
}
if (value < min || value > max) {
return t('FACETED_SEARCH_VALUES_OUT_OF_RANGE', {
defaultValue: 'The value must be between {{min}} and {{max}}',
min,
max
});
}
return null;
};
const BadgeSliderForm = ({
id,
onChange,
onSubmit,
feature,
t,
unit,
icon,
operator = {},
decimal = false,
min = 0,
max = 100,
step = 1,
value: initialValue = min,
defaultValue,
...rest
}) => {
const applyDataFeature = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => (0,_helpers_usage_helpers__WEBPACK_IMPORTED_MODULE_5__.getApplyDataFeature)(feature), [feature]);
const [value, setValue] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialValue);
const [slider, setSlider] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialValue);
const [input, setInput] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialValue);
const [editing, setEditing] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
const error = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => getErrorMessage(t, decimal, min, max, input), [t, decimal, min, max, input]);
const isErroneous = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => getValidator(decimal, min, max), [decimal, min, max]);
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => onChange(null, value), [onChange, value]);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.Form, {
id: `${id}-slider`,
onSubmit: onSubmit,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)("div", {
className: (_BadgeSlider_module_scss__WEBPACK_IMPORTED_MODULE_6___default()["tc-badge-slider-form-body"]),
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)("div", {
className: (_BadgeSlider_module_scss__WEBPACK_IMPORTED_MODULE_6___default()["tc-badge-slider-form-body-row"]),
children: [icon && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("div", {
className: (_BadgeSlider_module_scss__WEBPACK_IMPORTED_MODULE_6___default()["tc-badge-slider-form-body-row-icon"]),
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_talend_react_components__WEBPACK_IMPORTED_MODULE_7__.Icon, {
name: icon.name,
className: classnames__WEBPACK_IMPORTED_MODULE_1___default()((_BadgeSlider_module_scss__WEBPACK_IMPORTED_MODULE_6___default()["tc-badge-icon"]), icon.class || icon.className)
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)("div", {
className: (_BadgeSlider_module_scss__WEBPACK_IMPORTED_MODULE_6___default()["tc-badge-slider-form-body-row-value"]),
children: editing ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.Form.Number, {
id: `${id}-input`,
min: min,
max: max,
step: step,
onChange: event => {
const v = event.target.value;
setInput(v);
setValue(!isErroneous(v) ? v : defaultValue);
},
onBlur: () => {
setInput(value);
setValue(value);
setSlider(value);
setEditing(false);
},
value: input
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)("button", {
className: (_BadgeSlider_module_scss__WEBPACK_IMPORTED_MODULE_6___default()["tc-badge-value-unit"]),
onClick: () => setEditing(true),
title: t('FACETED_SEARCH_EDIT_DIRECTLY', {
defaultValue: 'Edit directly'
}),
"aria-label": t('FACETED_SEARCH_EDIT_DIRECTLY', {
defaultValue: 'Edit directly'
}),
children: [value, unit]
})
})]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_talend_react_components__WEBPACK_IMPORTED_MODULE_7__.Slider, {
value: slider,
captionTextStepNumber: 2,
mode: getSliderMode(operator),
onChange: v => {
setValue(v);
setInput(v);
setSlider(v);
},
min: min,
max: max,
step: step,
hideTooltip: true
}), error && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.InlineMessageDestructive, {
description: error
})]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.Form.Buttons, {
padding: {
x: 0,
bottom: 0,
top: 'M'
},
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_3__.ButtonPrimary, {
type: "submit",
"data-feature": applyDataFeature,
disabled: !!error,
...(0,_talend_utils__WEBPACK_IMPORTED_MODULE_4__.getDataAttrFromProps)(rest),
children: t('APPLY', {
defaultValue: 'Apply'
})
})
})]
});
};
BadgeSliderForm.propTypes = {
id: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string).isRequired,
onChange: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func),
onSubmit: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func).isRequired,
value: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().number),
feature: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string).isRequired,
t: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func).isRequired,
unit: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string),
decimal: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().bool),
min: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().number),
max: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().number),
step: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().number),
defaultValue: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().number),
icon: prop_types__WEBPACK_IMPORTED_MODULE_2___default().shape({
name: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string),
class: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string),
className: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string)
}),
operator: prop_types__WEBPACK_IMPORTED_MODULE_2___default().shape({
name: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string)
})
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/Badges/BadgeSlider/index.js":
/*!****************************************************!*\
!*** ./src/components/Badges/BadgeSlider/index.js ***!
\****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeSlider: () => (/* reexport safe */ _BadgeSlider_component__WEBPACK_IMPORTED_MODULE_0__.BadgeSlider)
/* harmony export */ });
/* harmony import */ var _BadgeSlider_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BadgeSlider.component */ "./src/components/Badges/BadgeSlider/BadgeSlider.component.js");
/***/ }),
/***/ "./src/components/Badges/BadgeText/BadgeText.component.js":
/*!****************************************************************!*\
!*** ./src/components/Badges/BadgeText/BadgeText.component.js ***!
\****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeText: () => (/* binding */ BadgeText)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _BadgeFaceted__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../BadgeFaceted */ "./src/components/Badges/BadgeFaceted/index.js");
/* harmony import */ var _BadgeTextForm_component__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./BadgeTextForm.component */ "./src/components/Badges/BadgeText/BadgeTextForm.component.js");
/* harmony import */ var _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../facetedSearch.propTypes */ "./src/components/facetedSearch.propTypes.js");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @talend/react-components */ "@talend/react-components");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const createDefaultOperators = t => [{
label: t('FACETED_SEARCH_DOES_NOT_CONTAIN', {
defaultValue: 'Does not contain'
}),
name: 'notEquals',
iconName: 'not-equal'
}, {
label: t('FACETED_SEARCH_EQUAL', {
defaultValue: 'Equal'
}),
name: 'equals',
iconName: 'equal'
}, {
label: t('FACETED_SEARCH_CONTAINS', {
defaultValue: 'Contains'
}),
name: 'contains',
iconName: 'contains'
}];
const BadgeText = ({
id,
initialOperatorOpened,
initialValueOpened,
label,
operator,
operators,
size,
t,
value,
category,
readOnly,
removable,
displayType,
placeholder,
...rest
}) => {
const currentOperators = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => operators || createDefaultOperators(t), [operators, t]);
const currentOperator = operator || currentOperators[0];
const badgeTextId = `${id}-badge-text`;
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_BadgeFaceted__WEBPACK_IMPORTED_MODULE_2__.BadgeFaceted, {
badgeId: id,
displayType: displayType,
id: badgeTextId,
initialOperatorOpened: initialOperatorOpened,
initialValueOpened: initialValueOpened,
labelCategory: label,
labelValue: value || t('FACETED_SEARCH_VALUE_ALL', {
defaultValue: 'All'
}),
operator: currentOperator,
operators: currentOperators,
readOnly: readOnly,
removable: removable,
size: size,
t: t,
value: value || '',
children: ({
onSubmitBadge,
onChangeValue,
badgeValue
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_BadgeTextForm_component__WEBPACK_IMPORTED_MODULE_3__.BadgeTextForm, {
id: badgeTextId,
onChange: onChangeValue,
onSubmit: onSubmitBadge,
value: badgeValue,
feature: category || label,
t: t,
placeholder: placeholder,
...rest
})
});
};
BadgeText.propTypes = {
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
initialOperatorOpened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
initialValueOpened: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
label: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
operator: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_4__.operatorPropTypes,
operators: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_4__.operatorsPropTypes,
size: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__.Badge.SIZES)),
t: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
value: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
category: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
readOnly: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
removable: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
displayType: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOf(Object.values(_talend_react_components__WEBPACK_IMPORTED_MODULE_5__.Badge.TYPES)),
placeholder: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string)
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/Badges/BadgeText/BadgeTextForm.component.js":
/*!********************************************************************!*\
!*** ./src/components/Badges/BadgeText/BadgeTextForm.component.js ***!
\********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeTextForm: () => (/* binding */ BadgeTextForm)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @talend/design-system */ "@talend/design-system");
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _talend_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @talend/utils */ "../utils/lib-esm/index.js");
/* harmony import */ var _helpers_usage_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../helpers/usage.helpers */ "./src/helpers/usage.helpers.js");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const BadgeTextForm = ({
id,
onChange,
onSubmit,
value,
feature,
t,
placeholder,
minLength,
maxLength,
...rest
}) => {
const applyDataFeature = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => (0,_helpers_usage_helpers__WEBPACK_IMPORTED_MODULE_4__.getApplyDataFeature)(feature), [feature]);
const onChangeText = event => {
onChange(event, event.target.value);
};
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.Form, {
id: `${id}-text-area`,
onSubmit: onSubmit,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.Form.Text, {
id: `${id}-text`,
onChange: onChangeText,
placeholder: placeholder || t('TYPE_HERE', {
defaultValue: 'Type here'
}),
type: "text",
value: value,
minLength: minLength,
maxLength: maxLength
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.Form.Buttons, {
padding: {
x: 0,
bottom: 0,
top: 'M'
},
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.ButtonPrimary, {
type: "submit",
"data-feature": applyDataFeature,
...(0,_talend_utils__WEBPACK_IMPORTED_MODULE_3__.getDataAttrFromProps)(rest),
children: t('APPLY', {
defaultValue: 'Apply'
})
})
})]
});
};
BadgeTextForm.propTypes = {
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
onChange: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
onSubmit: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
value: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
feature: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
t: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
placeholder: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
minLength: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().number),
maxLength: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().number)
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/Badges/BadgeText/index.js":
/*!**************************************************!*\
!*** ./src/components/Badges/BadgeText/index.js ***!
\**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeText: () => (/* reexport safe */ _BadgeText_component__WEBPACK_IMPORTED_MODULE_0__.BadgeText)
/* harmony export */ });
/* harmony import */ var _BadgeText_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BadgeText.component */ "./src/components/Badges/BadgeText/BadgeText.component.js");
/***/ }),
/***/ "./src/components/Badges/index.js":
/*!****************************************!*\
!*** ./src/components/Badges/index.js ***!
\****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeCheckboxes: () => (/* reexport safe */ _BadgeCheckboxes__WEBPACK_IMPORTED_MODULE_4__.BadgeCheckboxes),
/* harmony export */ BadgeCheckboxesForm: () => (/* reexport safe */ _BadgeCheckboxes__WEBPACK_IMPORTED_MODULE_4__.BadgeCheckboxesForm),
/* harmony export */ BadgeFaceted: () => (/* reexport safe */ _BadgeFaceted__WEBPACK_IMPORTED_MODULE_3__.BadgeFaceted),
/* harmony export */ BadgeOverlay: () => (/* reexport safe */ _BadgeOverlay__WEBPACK_IMPORTED_MODULE_2__.BadgeOverlay),
/* harmony export */ BadgeSlider: () => (/* reexport safe */ _BadgeSlider__WEBPACK_IMPORTED_MODULE_1__.BadgeSlider),
/* harmony export */ BadgeText: () => (/* reexport safe */ _BadgeText__WEBPACK_IMPORTED_MODULE_0__.BadgeText)
/* harmony export */ });
/* harmony import */ var _BadgeText__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BadgeText */ "./src/components/Badges/BadgeText/index.js");
/* harmony import */ var _BadgeSlider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BadgeSlider */ "./src/components/Badges/BadgeSlider/index.js");
/* harmony import */ var _BadgeOverlay__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BadgeOverlay */ "./src/components/Badges/BadgeOverlay/index.js");
/* harmony import */ var _BadgeFaceted__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./BadgeFaceted */ "./src/components/Badges/BadgeFaceted/index.js");
/* harmony import */ var _BadgeCheckboxes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./BadgeCheckboxes */ "./src/components/Badges/BadgeCheckboxes/index.js");
/***/ }),
/***/ "./src/components/BadgesGenerator/BadgesGenerator.component.js":
/*!*********************************************************************!*\
!*** ./src/components/BadgesGenerator/BadgesGenerator.component.js ***!
\*********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgesGenerator: () => (/* binding */ BadgesGenerator)
/* harmony export */ });
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../facetedSearch.propTypes */ "./src/components/facetedSearch.propTypes.js");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
const BadgesGenerator = ({
badges,
badgesDictionary,
getBadgeFromDict,
callbacks,
t
}) => badges.reduce((acc, {
properties,
metadata
}) => {
const BadgeComponent = getBadgeFromDict(badgesDictionary, (0,lodash__WEBPACK_IMPORTED_MODULE_2__.get)(properties, 'type'));
if (BadgeComponent) {
acc.push(/*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_3__.createElement)(BadgeComponent, {
...metadata,
...properties,
callbacks: callbacks,
id: metadata.badgeId,
key: metadata.badgeId,
t: t
}));
}
return acc;
}, []);
BadgesGenerator.propTypes = {
badges: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_1__.badgesFacetedPropTypes,
badgesDictionary: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().object).isRequired,
getBadgeFromDict: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func).isRequired,
t: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func).isRequired
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/BadgesGenerator/index.js":
/*!*************************************************!*\
!*** ./src/components/BadgesGenerator/index.js ***!
\*************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgesGenerator: () => (/* reexport safe */ _BadgesGenerator_component__WEBPACK_IMPORTED_MODULE_0__.BadgesGenerator)
/* harmony export */ });
/* harmony import */ var _BadgesGenerator_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BadgesGenerator.component */ "./src/components/BadgesGenerator/BadgesGenerator.component.js");
/***/ }),
/***/ "./src/components/BasicSearch/BasicSearch.component.js":
/*!*************************************************************!*\
!*** ./src/components/BasicSearch/BasicSearch.component.js ***!
\*************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BasicSearch: () => (/* binding */ BasicSearch)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @talend/design-system */ "@talend/design-system");
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../constants */ "./src/constants.js");
/* harmony import */ var _dictionary_badge_dictionary__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../dictionary/badge.dictionary */ "./src/dictionary/badge.dictionary.js");
/* harmony import */ var _dictionary_operator_dictionary__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../dictionary/operator.dictionary */ "./src/dictionary/operator.dictionary.js");
/* harmony import */ var _hooks_facetedBadges_hook__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../hooks/facetedBadges.hook */ "./src/hooks/facetedBadges.hook.js");
/* harmony import */ var _AddFacetPopover__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../AddFacetPopover */ "./src/components/AddFacetPopover/index.js");
/* harmony import */ var _BadgesGenerator__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../BadgesGenerator */ "./src/components/BadgesGenerator/index.js");
/* harmony import */ var _context_badgeFaceted_context__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../context/badgeFaceted.context */ "./src/components/context/badgeFaceted.context.js");
/* harmony import */ var _context_facetedSearch_context__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../context/facetedSearch.context */ "./src/components/context/facetedSearch.context.js");
/* harmony import */ var _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../facetedSearch.propTypes */ "./src/components/facetedSearch.propTypes.js");
/* harmony import */ var _QuickSearchInput__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../QuickSearchInput */ "./src/components/QuickSearchInput/index.js");
/* harmony import */ var _QuickSearchInput_QuickSearchInput_component__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../QuickSearchInput/QuickSearchInput.component */ "./src/components/QuickSearchInput/QuickSearchInput.component.js");
/* harmony import */ var _types_badgeDefinition_type__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../types/badgeDefinition.type */ "./src/components/types/badgeDefinition.type.js");
/* harmony import */ var _BasicSearch_module_scss__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./BasicSearch.module.scss */ "./src/components/BasicSearch/BasicSearch.module.scss");
/* harmony import */ var _BasicSearch_module_scss__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_BasicSearch_module_scss__WEBPACK_IMPORTED_MODULE_15__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_16__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const isInCreation = badge => (0,lodash__WEBPACK_IMPORTED_MODULE_16__.get)(badge, 'metadata.isInCreation', true);
const BasicSearch = ({
badgesDefinitions = [],
badgesFaceted,
initialBadges = [],
customBadgesDictionary,
customOperatorsDictionary,
initialFilterValue,
onSubmit,
setBadgesFaceted,
callbacks,
badgesDefinitionsSort,
quickSearchPlaceholder,
quickSearchFacetsFilter,
quickSearchInputProps,
quickSearchTypeaheadProps,
disclosureProps
}) => {
const {
id,
t
} = (0,_context_facetedSearch_context__WEBPACK_IMPORTED_MODULE_10__.useFacetedSearchContext)();
const operatorsDictionary = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => (0,_dictionary_operator_dictionary__WEBPACK_IMPORTED_MODULE_5__.createOperatorsDict)(t, customOperatorsDictionary), [t, customOperatorsDictionary]);
const badgesDictionary = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => (0,_dictionary_badge_dictionary__WEBPACK_IMPORTED_MODULE_4__.createBadgesDict)(customBadgesDictionary), [customBadgesDictionary]);
const badges = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => (0,_dictionary_badge_dictionary__WEBPACK_IMPORTED_MODULE_4__.filterBadgeDefinitionsWithDictionary)(badgesDictionary, badgesDefinitions), [badgesDictionary, badgesDefinitions]);
const [state, dispatch] = (0,_hooks_facetedBadges_hook__WEBPACK_IMPORTED_MODULE_6__.useFacetedBadges)(badgesFaceted, setBadgesFaceted);
const quicksearchable = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => badgesDefinitions.filter(({
metadata = {}
}) => metadata.isAvailableForQuickSearch), [badgesDefinitions]);
const [badgeState, setBadgeState] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(state.badges);
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
if (!state.badges.some(isInCreation) && !(0,lodash__WEBPACK_IMPORTED_MODULE_16__.isEqual)(badgeState, state.badges)) {
setBadgeState(state.badges);
onSubmit({}, state.badges);
}
}, [state.badges, onSubmit]);
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
initialBadges.forEach(initial => {
const facet = badges.find(({
properties
}) => properties.attribute === initial.attribute);
const operators = (0,_dictionary_operator_dictionary__WEBPACK_IMPORTED_MODULE_5__.getOperatorsFromDict)(operatorsDictionary, (0,lodash__WEBPACK_IMPORTED_MODULE_16__.get)(facet, 'metadata.operators'));
dispatch(_hooks_facetedBadges_hook__WEBPACK_IMPORTED_MODULE_6__.BADGES_ACTIONS.addWithValue((0,_types_badgeDefinition_type__WEBPACK_IMPORTED_MODULE_14__.generateBadge)(operators)(facet), operatorsDictionary[initial.operator], initial.value));
});
// This is intended
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const onClickOverlayRow = (_, badgeDefinition) => {
const operators = (0,_dictionary_operator_dictionary__WEBPACK_IMPORTED_MODULE_5__.getOperatorsFromDict)(operatorsDictionary, (0,lodash__WEBPACK_IMPORTED_MODULE_16__.get)(badgeDefinition, 'metadata.operators'));
dispatch(_hooks_facetedBadges_hook__WEBPACK_IMPORTED_MODULE_6__.BADGES_ACTIONS.add((0,_types_badgeDefinition_type__WEBPACK_IMPORTED_MODULE_14__.generateBadge)(operators)(badgeDefinition)));
};
const basicSearchId = `${id}-basic-search`;
const badgeFacetedContextValue = {
state,
dispatch,
onSubmit
};
// removable = undefined means badge can be removed (backward compatible change)
const hasRemovableBadge = state.badges.some(badge => badge.properties.removable !== false);
const quickSearchMinLength = Math.max(quicksearchable.map(quicksearchableItem => {
var _quicksearchableItem$;
return (_quicksearchableItem$ = quicksearchableItem.metadata) === null || _quicksearchableItem$ === void 0 ? void 0 : _quicksearchableItem$.minLength;
})) || 1;
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsxs)("div", {
id: basicSearchId,
className: (_BasicSearch_module_scss__WEBPACK_IMPORTED_MODULE_15___default()["tc-basic-search"]),
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)(_QuickSearchInput__WEBPACK_IMPORTED_MODULE_12__.QuickSearchInput, {
t: t,
className: (_BasicSearch_module_scss__WEBPACK_IMPORTED_MODULE_15___default()["tc-basic-search-quicksearch"]),
facets: quicksearchable,
placeholder: quickSearchPlaceholder,
facetsFilter: quickSearchFacetsFilter,
onSelect: (facet, value) => {
const operators = (0,_dictionary_operator_dictionary__WEBPACK_IMPORTED_MODULE_5__.getOperatorsFromDict)(operatorsDictionary, (0,lodash__WEBPACK_IMPORTED_MODULE_16__.get)(facet, 'metadata.operators'));
dispatch(_hooks_facetedBadges_hook__WEBPACK_IMPORTED_MODULE_6__.BADGES_ACTIONS.addWithValue((0,_types_badgeDefinition_type__WEBPACK_IMPORTED_MODULE_14__.generateBadge)(operators)(facet), operators.find(({
name
}) => name === _QuickSearchInput_QuickSearchInput_component__WEBPACK_IMPORTED_MODULE_13__.DEFAULT_QUICKSEARCH_OPERATOR) || operators[0], value));
},
inputProps: quickSearchInputProps,
minLength: quickSearchMinLength,
typeaheadProps: quickSearchTypeaheadProps
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsxs)("div", {
className: (_BasicSearch_module_scss__WEBPACK_IMPORTED_MODULE_15___default()["tc-basic-search-content"]),
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)(_context_badgeFaceted_context__WEBPACK_IMPORTED_MODULE_9__.BadgeFacetedProvider, {
value: badgeFacetedContextValue,
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)(_BadgesGenerator__WEBPACK_IMPORTED_MODULE_8__.BadgesGenerator, {
badges: state.badges,
badgesDictionary: badgesDictionary,
getBadgeFromDict: _dictionary_badge_dictionary__WEBPACK_IMPORTED_MODULE_4__.getBadgesFromDict,
id: basicSearchId,
callbacks: callbacks,
t: t
})
}), badgesDefinitions.length > 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)("div", {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.Popover, {
position: "bottom",
isFixed: true,
disclosure: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.ButtonSecondary, {
size: "S",
isDropdown: true,
"data-feature": _constants__WEBPACK_IMPORTED_MODULE_3__.USAGE_TRACKING_TAGS.BASIC_ADD,
...disclosureProps,
children: t('BASIC_SEARCH_ADD_FILTER', 'Add filter')
}),
children: popover => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)(_AddFacetPopover__WEBPACK_IMPORTED_MODULE_7__.AddFacetPopover, {
badges: state.badges,
badgesDefinitions: badges,
badgesDefinitionsSort: badgesDefinitionsSort,
id: basicSearchId,
initialFilterValue: initialFilterValue,
onClick: (...args) => {
onClickOverlayRow(...args);
popover === null || popover === void 0 ? void 0 : popover.hide();
},
t: t
})
})
})]
}), hasRemovableBadge && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)("div", {
className: (_BasicSearch_module_scss__WEBPACK_IMPORTED_MODULE_15___default()["tc-basic-search-clear-content"]),
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_2__.ButtonIcon, {
icon: "trash",
size: "S",
"data-feature": _constants__WEBPACK_IMPORTED_MODULE_3__.USAGE_TRACKING_TAGS.BASIC_CLEAR,
onClick: () => dispatch(_hooks_facetedBadges_hook__WEBPACK_IMPORTED_MODULE_6__.BADGES_ACTIONS.deleteAll()),
children: t('FACETED_SEARCH_BASIC_CLEAR', 'Remove all filters')
})
})]
});
};
BasicSearch.propTypes = {
badgesDefinitions: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_11__.badgesFacetedPropTypes,
badgesDefinitionsSort: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
badgesFaceted: prop_types__WEBPACK_IMPORTED_MODULE_1___default().shape({
badges: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_11__.badgesFacetedPropTypes
}),
initialBadges: prop_types__WEBPACK_IMPORTED_MODULE_1___default().arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_1___default().shape({
attribute: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
value: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().any),
operator: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string)
})),
customBadgesDictionary: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().object),
customOperatorsDictionary: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_11__.operatorsPropTypes,
initialFilterValue: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
quickSearchPlaceholder: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
/* Can be used to filter facets displayed when input changes; (term, facets) => [facets] */
quickSearchFacetsFilter: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
onSubmit: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
setBadgesFaceted: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
callbacks: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_11__.callbacksPropTypes,
quickSearchInputProps: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().object),
disclosureProps: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().object)
};
/***/ }),
/***/ "./src/components/BasicSearch/BasicSearch.module.scss":
/*!************************************************************!*\
!*** ./src/components/BasicSearch/BasicSearch.module.scss ***!
\************************************************************/
/***/ ((module) => {
// extracted by mini-css-extract-plugin
module.exports = {"tc-basic-search":"BasicSearch-module__tc-basic-search___kC3Q2","tc-basic-search-quicksearch":"BasicSearch-module__tc-basic-search-quicksearch___px3e8","tc-basic-search-content":"BasicSearch-module__tc-basic-search-content___W8S7N"};
/***/ }),
/***/ "./src/components/BasicSearch/index.js":
/*!*********************************************!*\
!*** ./src/components/BasicSearch/index.js ***!
\*********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BasicSearch: () => (/* reexport safe */ _BasicSearch_component__WEBPACK_IMPORTED_MODULE_0__.BasicSearch)
/* harmony export */ });
/* harmony import */ var _BasicSearch_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BasicSearch.component */ "./src/components/BasicSearch/BasicSearch.component.js");
/***/ }),
/***/ "./src/components/FacetedManager/FacetedManager.component.js":
/*!*******************************************************************!*\
!*** ./src/components/FacetedManager/FacetedManager.component.js ***!
\*******************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ FacetedManager: () => (/* binding */ FacetedManager)
/* harmony export */ });
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-i18next */ "react-i18next");
/* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_i18next__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../constants */ "./src/constants.js");
/* harmony import */ var _context_facetedSearch_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../context/facetedSearch.context */ "./src/components/context/facetedSearch.context.js");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const FacetedManager = ({
children,
id,
inProgress,
error
}) => {
const {
t
} = (0,react_i18next__WEBPACK_IMPORTED_MODULE_1__.useTranslation)(_constants__WEBPACK_IMPORTED_MODULE_2__.I18N_DOMAIN_FACETED_SEARCH);
const contextValue = {
error,
id,
inProgress,
t
};
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_context_facetedSearch_context__WEBPACK_IMPORTED_MODULE_3__.FacetedSearchProvider, {
value: contextValue,
children: children
});
};
FacetedManager.propTypes = {
children: prop_types__WEBPACK_IMPORTED_MODULE_0___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_0___default().element), prop_types__WEBPACK_IMPORTED_MODULE_0___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_0___default().element))]),
id: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired,
inProgress: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool),
error: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string)
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/FacetedManager/index.js":
/*!************************************************!*\
!*** ./src/components/FacetedManager/index.js ***!
\************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ FacetedManager: () => (/* reexport safe */ _FacetedManager_component__WEBPACK_IMPORTED_MODULE_0__.FacetedManager)
/* harmony export */ });
/* harmony import */ var _FacetedManager_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FacetedManager.component */ "./src/components/FacetedManager/FacetedManager.component.js");
/***/ }),
/***/ "./src/components/FacetedSearch/FacetedSearch.component.js":
/*!*****************************************************************!*\
!*** ./src/components/FacetedSearch/FacetedSearch.component.js ***!
\*****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ FacetedSearch: () => (/* binding */ FacetedSearch)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-i18next */ "react-i18next");
/* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_i18next__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../constants */ "./src/constants.js");
/* harmony import */ var _FacetedToolbar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../FacetedToolbar */ "./src/components/FacetedToolbar/index.js");
/* harmony import */ var _FacetedManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../FacetedManager */ "./src/components/FacetedManager/index.js");
/* harmony import */ var _controlled__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../controlled */ "./src/controlled.js");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const FacetedSearch = ({
children,
error,
facetedMode,
id,
inProgress,
setFacetedMode
}) => {
const isControlled = (0,_controlled__WEBPACK_IMPORTED_MODULE_6__.controlled)('FacetedSearch', facetedMode, setFacetedMode);
const [facetedModeState, setFacetedModeState] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(_constants__WEBPACK_IMPORTED_MODULE_3__.FACETED_MODE.BASIC);
const {
t
} = (0,react_i18next__WEBPACK_IMPORTED_MODULE_2__.useTranslation)(_constants__WEBPACK_IMPORTED_MODULE_3__.I18N_DOMAIN_FACETED_SEARCH);
const facetedId = `${id}-faceted`;
const mode = isControlled ? facetedMode : facetedModeState;
const setMode = isControlled ? setFacetedMode : setFacetedModeState;
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_FacetedManager__WEBPACK_IMPORTED_MODULE_5__.FacetedManager, {
error: error,
id: facetedId,
inProgress: inProgress,
t: t,
children: typeof children === 'function' ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_FacetedToolbar__WEBPACK_IMPORTED_MODULE_4__.FacetedToolbar, {
id: id,
facetedMode: mode,
onChangeFacetedMode: setMode,
t: t,
children: children(mode)
}) : children
});
};
FacetedSearch.propTypes = {
children: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func).isRequired,
error: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
facetedMode: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
id: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string).isRequired,
inProgress: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().bool),
setFacetedMode: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func)
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/FacetedSearch/index.js":
/*!***********************************************!*\
!*** ./src/components/FacetedSearch/index.js ***!
\***********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ FacetedSearch: () => (/* reexport safe */ _FacetedSearch_component__WEBPACK_IMPORTED_MODULE_0__.FacetedSearch)
/* harmony export */ });
/* harmony import */ var _FacetedSearch_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FacetedSearch.component */ "./src/components/FacetedSearch/FacetedSearch.component.js");
/***/ }),
/***/ "./src/components/FacetedToolbar/FacetedToolbar.component.js":
/*!*******************************************************************!*\
!*** ./src/components/FacetedToolbar/FacetedToolbar.component.js ***!
\*******************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ FacetedToolbar: () => (/* binding */ FacetedToolbar)
/* harmony export */ });
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @talend/design-system */ "@talend/design-system");
/* harmony import */ var _talend_design_system__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_talend_design_system__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../constants */ "./src/constants.js");
/* harmony import */ var _FacetedToolbar_module_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./FacetedToolbar.module.scss */ "./src/components/FacetedToolbar/FacetedToolbar.module.scss");
/* harmony import */ var _FacetedToolbar_module_scss__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_FacetedToolbar_module_scss__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const SwitchFacetedMode = ({
facetedMode,
onChange,
t
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_1__.Form, {
className: (_FacetedToolbar_module_scss__WEBPACK_IMPORTED_MODULE_3___default()["tc-faceted-switch-mode"]),
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_talend_design_system__WEBPACK_IMPORTED_MODULE_1__.Form.ToggleSwitch, {
label: t('FACETED_SEARCH_QUERY', 'Query'),
checked: facetedMode === _constants__WEBPACK_IMPORTED_MODULE_2__.FACETED_MODE.ADVANCED,
onChange: () => onChange(facetedMode === _constants__WEBPACK_IMPORTED_MODULE_2__.FACETED_MODE.BASIC ? _constants__WEBPACK_IMPORTED_MODULE_2__.FACETED_MODE.ADVANCED : _constants__WEBPACK_IMPORTED_MODULE_2__.FACETED_MODE.BASIC),
"data-feature": facetedMode === _constants__WEBPACK_IMPORTED_MODULE_2__.FACETED_MODE.BASIC ? _constants__WEBPACK_IMPORTED_MODULE_2__.USAGE_TRACKING_TAGS.BASIC : _constants__WEBPACK_IMPORTED_MODULE_2__.USAGE_TRACKING_TAGS.ADVANCED
})
});
SwitchFacetedMode.propTypes = {
facetedMode: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired,
onChange: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func).isRequired,
t: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func).isRequired
};
const FacetedToolbar = ({
children,
facetedMode,
id,
onChangeFacetedMode,
t
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
id: `${id}-toolbar`,
className: (_FacetedToolbar_module_scss__WEBPACK_IMPORTED_MODULE_3___default()["tc-faceted-toolbar"]),
children: [children, /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(SwitchFacetedMode, {
id: id,
facetedMode: facetedMode,
onChange: onChangeFacetedMode,
t: t
})]
});
FacetedToolbar.propTypes = {
children: prop_types__WEBPACK_IMPORTED_MODULE_0___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_0___default().element), prop_types__WEBPACK_IMPORTED_MODULE_0___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_0___default().element))]),
facetedMode: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired,
id: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired,
onChangeFacetedMode: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func).isRequired,
t: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func).isRequired
};
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/components/FacetedToolbar/FacetedToolbar.module.scss":
/*!******************************************************************!*\
!*** ./src/components/FacetedToolbar/FacetedToolbar.module.scss ***!
\******************************************************************/
/***/ ((module) => {
// extracted by mini-css-extract-plugin
module.exports = {"tc-faceted-toolbar":"FacetedToolbar-module__tc-faceted-toolbar___NpCxO","tc-faceted-switch-mode":"FacetedToolbar-module__tc-faceted-switch-mode___poz3i"};
/***/ }),
/***/ "./src/components/FacetedToolbar/index.js":
/*!************************************************!*\
!*** ./src/components/FacetedToolbar/index.js ***!
\************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ FacetedToolbar: () => (/* reexport safe */ _FacetedToolbar_component__WEBPACK_IMPORTED_MODULE_0__.FacetedToolbar)
/* harmony export */ });
/* harmony import */ var _FacetedToolbar_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FacetedToolbar.component */ "./src/components/FacetedToolbar/FacetedToolbar.component.js");
/***/ }),
/***/ "./src/components/QuickSearchInput/QuickSearchInput.component.js":
/*!***********************************************************************!*\
!*** ./src/components/QuickSearchInput/QuickSearchInput.component.js ***!
\***********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ DEFAULT_QUICKSEARCH_OPERATOR: () => (/* binding */ DEFAULT_QUICKSEARCH_OPERATOR),
/* harmony export */ QuickSearchInput: () => (/* binding */ QuickSearchInput)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../facetedSearch.propTypes */ "./src/components/facetedSearch.propTypes.js");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @talend/react-components */ "@talend/react-components");
/* harmony import */ var _talend_react_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_talend_react_components__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "../../node_modules/react/jsx-runtime.js");
const DEFAULT_QUICKSEARCH_OPERATOR = 'containsIgnoreCase';
const getDefaultFacet = (facets = []) => facets.find(({
metadata
}) => metadata.isDefaultForQuickSearch) || facets[0];
const QuickSearchInput = ({
t,
facets,
placeholder,
className,
onSelect = () => {},
facetsFilter,
inputProps,
minLength,
typeaheadProps = {}
}) => {
const defaultFacet = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => getDefaultFacet(facets), [facets]);
const [opened, setOpened] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
const [value, setValue] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)('');
if (!facets.length) {
return null;
}
const filteredFacets = facetsFilter ? facetsFilter(value, facets) : facets;
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_talend_react_components__WEBPACK_IMPORTED_MODULE_3__.Typeahead, {
placeholder: placeholder || t('QUICKSEARCH_PLACEHOLDER', 'Find in a column...'),
onFocus: () => setOpened(value.length >= minLength),
onBlur: () => {
setValue('');
setOpened(false);
},
focusedItemIndex: 2,
onChange: (_, {
value: val
}) => {
setValue(val);
setOpened(val.length >= minLength);
},
onSelect: (_, {
itemIndex
}) => {
if (value.length >= minLength) {
onSelect(filteredFacets[itemIndex] || defaultFacet, value);
setValue('');
setOpened(false);
}
},
icon: {
name: 'talend-search'
},
items: opened ? [{
hint: true,
title: t('QUICKSEARCH_ITEM_TOOLTIP', {
defaultValue: 'Search in'
}),
suggestions: filteredFacets.map(a => (0,lodash__WEBPACK_IMPORTED_MODULE_4__.get)(a, ['properties', 'label'], null))
}] : undefined,
value: value,
role: "searchbox",
className: className,
inputProps: inputProps,
...typeaheadProps
});
};
QuickSearchInput.propTypes = {
facets: _facetedSearch_propTypes__WEBPACK_IMPORTED_MODULE_2__.badgesFacetedPropTypes,
className: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
placeholder: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
onSelect: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
facetsFilter: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
t: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func),
inputProps: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().object),
minLength: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().number)
};
/***/ }),
/***/ "./src/components/QuickSearchInput/index.js":
/*!**************************************************!*\
!*** ./src/components/QuickSearchInput/index.js ***!
\**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ QuickSearchInput: () => (/* reexport safe */ _QuickSearchInput_component__WEBPACK_IMPORTED_MODULE_0__.QuickSearchInput)
/* harmony export */ });
/* harmony import */ var _QuickSearchInput_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./QuickSearchInput.component */ "./src/components/QuickSearchInput/QuickSearchInput.component.js");
/***/ }),
/***/ "./src/components/context/badgeFaceted.context.js":
/*!********************************************************!*\
!*** ./src/components/context/badgeFaceted.context.js ***!
\********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BadgeFacetedProvider: () => (/* binding */ BadgeFacetedProvider),
/* harmony export */ useBadgeFacetedContext: () => (/* binding */ useBadgeFacetedContext)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! invariant */ "../../node_modules/invariant/browser.js");
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(invariant__WEBPACK_IMPORTED_MODULE_1__);
const badgeFacetedContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)();
const useBadgeFacetedContext = () => {
const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(badgeFacetedContext);
invariant__WEBPACK_IMPORTED_MODULE_1___default()(context, '[badgeFacetedContext]: You are using a badge faceted component outside its context');
return context;
};
const BadgeFacetedProvider = badgeFacetedContext.Provider;
/***/ }),
/***/ "./src/components/context/facetedSearch.context.js":
/*!*********************************************************!*\
!*** ./src/components/context/facetedSearch.context.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ FacetedSearchProvider: () => (/* binding */ FacetedSearchProvider),
/* harmony export */ useFacetedSearchContext: () => (/* binding */ useFacetedSearchContext)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! invariant */ "../../node_modules/invariant/browser.js");
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(invariant__WEBPACK_IMPORTED_MODULE_1__);
const facetedSearchContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)();
const useFacetedSearchContext = () => {
const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(facetedSearchContext);
invariant__WEBPACK_IMPORTED_MODULE_1___default()(context, '[facetedSearchContext]: You are using one of faceted mode outside the faceted search');
return context;
};
const FacetedSearchProvider = facetedSearchContext.Provider;
/***/ }),
/***/ "./src/components/facetedSearch.propTypes.js":
/*!***************************************************!*\
!*** ./src/components/facetedSearch.propTypes.js ***!
\***************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ badgeDefinitionRawDataPropTypes: () => (/* binding */ badgeDefinitionRawDataPropTypes),
/* harmony export */ badgeFacetedPropTypes: () => (/* binding */ badgeFacetedPropTypes),
/* harmony export */ badgesDefinitionsRawDataPropTypes: () => (/* binding */ badgesDefinitionsRawDataPropTypes),
/* harmony export */ badgesFacetedPropTypes: () => (/* binding */ badgesFacetedPropTypes),
/* harmony export */ callbacksPropTypes: () => (/* binding */ callbacksPropTypes),
/* harmony export */ operatorPropTypes: () => (/* binding */ operatorPropTypes),
/* harmony export */ operatorsPropTypes: () => (/* binding */ operatorsPropTypes)
/* harmony export */ });
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ "prop-types");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__);
const badgeDefinitionRawDataPropTypes = prop_types__WEBPACK_IMPORTED_MODULE_0___default().shape({
attribute: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired,
label: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired,
operators: prop_types__WEBPACK_IMPORTED_MODULE_0___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_0___default().string)),
type: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired,
metadata: prop_types__WEBPACK_IMPORTED_MODULE_0___default().shape({
badgePerFacet: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
entitiesPerBadge: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string)
})
});
const badgesDefinitionsRawDataPropTypes = prop_types__WEBPACK_IMPORTED_MODULE_0___default().arrayOf(badgeDefinitionRawDataPropTypes);
const operatorPropTypes = prop_types__WEBPACK_IMPORTED_MODULE_0___default().shape({
name: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
label: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
iconName: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string)
});
const operatorsPropTypes = prop_types__WEBPACK_IMPORTED_MODULE_0___default().arrayOf(operatorPropTypes);
const badgeFacetedPropTypes = prop_types__WEBPACK_IMPORTED_MODULE_0___default().shape({
properties: prop_types__WEBPACK_IMPORTED_MODULE_0___default().shape({
attribute: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired,
label: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired,
initialOperatorOpened: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool),
initialValueOpened: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool),
operator: operatorPropTypes,
operators: operatorsPropTypes,
type: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired,
readOnly: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool),
removable: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool)
}),
metadata: prop_types__WEBPACK_IMPORTED_MODULE_0___default().shape({
badgeId: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
badgePerFacet: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
isInCreation: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool),
entitiesPerBadge: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
operators: prop_types__WEBPACK_IMPORTED_MODULE_0___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_0___default().string))
})
});
const badgesFacetedPropTypes = prop_types__WEBPACK_IMPORTED_MODULE_0___default().arrayOf(badgeFacetedPropTypes);
const callbacksPropTypes = prop_types__WEBPACK_IMPORTED_MODULE_0___default().shape({
getTags: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func)
});
/***/ }),
/***/ "./src/components/index.js":
/*!*********************************!*\
!*** ./src/components/index.js ***!
\*********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ AdvancedSearch: () => (/* reexport safe */ _AdvancedSearch__WEBPACK_IMPORTED_MODULE_1__.AdvancedSearch),
/* harmony export */ BadgeCheckboxes: () => (/* reexport safe */ _Badges__WEBPACK_IMPORTED_MODULE_3__.BadgeCheckboxes),
/* harmony export */ BadgeCheckboxesForm: () => (/* reexport safe */ _Badges__WEBPACK_IMPORTED_MODULE_3__.BadgeCheckboxesForm),
/* harmony export */ BadgeFaceted: () => (/* reexport safe */ _Badges__WEBPACK_IMPORTED_MODULE_3__.BadgeFaceted),
/* harmony export */ BadgeOverlay: () => (/* reexport safe */ _Badges__WEBPACK_IMPORTED_MODULE_3__.BadgeOverlay),
/* harmony export */ BadgeSlider: () => (/* reexport safe */ _Badges__WEBPACK_IMPORTED_MODULE_3__.BadgeSlider),
/* harmony export */ BadgeText: () => (/* reexport safe */ _Badges__WEBPACK_IMPORTED_MODULE_3__.BadgeText),
/* harmony export */ BasicSearch: () => (/* reexport safe */ _BasicSearch__WEBPACK_IMPORTED_MODULE_2__.BasicSearch),
/* harmony export */ FacetedSearch: () => (/* reexport safe */ _FacetedSearch__WEBPACK_IMPORTED_MODULE_0__.FacetedSearch),
/* harmony export */ badgeDefinitionTypes: () => (/* reexport module object */ _types_badgeDefinition_type__WEBPACK_IMPORTED_MODULE_4__)
/* harmony export */ });
/* harmony import */ var _FacetedSearch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FacetedSearch */ "./src/components/FacetedSearch/index.js");
/* harmony import */ var _AdvancedSearch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AdvancedSearch */ "./src/components/AdvancedSearch/index.js");
/* harmony import */ var _BasicSearch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BasicSearch */ "./src/components/BasicSearch/index.js");
/* harmony import */ var _Badges__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Badges */ "./src/components/Badges/index.js");
/* harmony import */ var _types_badgeDefinition_type__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./types/badgeDefinition.type */ "./src/components/types/badgeDefinition.type.js");
/***/ }),
/***/ "./src/components/types/badgeDefinition.type.js":
/*!******************************************************!*\
!*** ./src/components/types/badgeDefinition.type.js ***!
\******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ addOperatorsProps: () => (/* binding */ addOperatorsProps),
/* harmony export */ createFacetedBadgeDefinition: () => (/* binding */ createFacetedBadgeDefinition),
/* harmony export */ generateBadge: () => (/* binding */ generateBadge),
/* harmony export */ generateUniqueBadgeId: () => (/* binding */ generateUniqueBadgeId)
/* harmony export */ });
/* harmony import */ var _talend_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @talend/utils */ "../utils/lib-esm/index.js");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);
const getAttribute = badgeDefinitionRaw => (0,lodash__WEBPACK_IMPORTED_MODULE_1__.get)(badgeDefinitionRaw, 'attribute');
const createBadgeId = attribute => `${attribute}-${(0,_talend_utils__WEBPACK_IMPORTED_MODULE_0__.randomUUID)()}`;
const getOperators = badgeDefinitionRaw => (0,lodash__WEBPACK_IMPORTED_MODULE_1__.get)(badgeDefinitionRaw, 'operators');
const getType = badgeDefinitionRaw => (0,lodash__WEBPACK_IMPORTED_MODULE_1__.get)(badgeDefinitionRaw, 'type');
const getTypeProperties = badgeDefinitionRaw => (0,lodash__WEBPACK_IMPORTED_MODULE_1__.get)(badgeDefinitionRaw, 'typeProperties');
const getLabel = badgeDefinitionRaw => (0,lodash__WEBPACK_IMPORTED_MODULE_1__.get)(badgeDefinitionRaw, 'label');
const facetedBadgeDefinitionStruct = {
properties: {
attribute: name,
initialOpenedOperator: false,
initialOpenedValue: false,
label: '',
operator: {},
operators: [],
type: ''
},
metadata: {
badgeId: '',
badgesPerFacet: 1,
entitiesPerBadge: 'N'
}
};
const fromRaw = badgeDefinitionRaw => {
const newStruct = Object.create(facetedBadgeDefinitionStruct);
const name = getAttribute(badgeDefinitionRaw);
const typeProperties = getTypeProperties(badgeDefinitionRaw);
newStruct.properties = {
attribute: name,
initialOperatorOpened: true,
initialValueOpened: false,
label: getLabel(badgeDefinitionRaw),
operator: {},
operators: [],
type: getType(badgeDefinitionRaw),
...typeProperties
};
newStruct.metadata = {
...badgeDefinitionRaw.metadata,
operators: getOperators(badgeDefinitionRaw)
};
return newStruct;
};
const addOperatorsProps = operators => badge => ({
...badge,
properties: {
...badge.properties,
operator: Array.isArray(operators) && operators[0],
operators: Array.isArray(operators) && operators
}
});
const generateUniqueBadgeId = badge => ({
...badge,
metadata: {
...badge.metadata,
badgeId: createBadgeId(badge.properties.attribute)
}
});
const createFacetedBadgeDefinition = badgeDefinitionRaw => {
if (badgeDefinitionRaw) {
return fromRaw(badgeDefinitionRaw);
}
return Object.create(facetedBadgeDefinitionStruct);
};
const generateBadge = operators => (0,lodash__WEBPACK_IMPORTED_MODULE_1__.flow)([generateUniqueBadgeId, addOperatorsProps(operators)]);
/***/ }),
/***/ "./src/constants.js":
/*!**************************!*\
!*** ./src/constants.js ***!
\**************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ FACETED_MODE: () => (/* binding */ FACETED_MODE),
/* harmony export */ I18N_DOMAIN_FACETED_SEARCH: () => (/* binding */ I18N_DOMAIN_FACETED_SEARCH),
/* harmony export */ USAGE_TRACKING_TAGS: () => (/* binding */ USAGE_TRACKING_TAGS)
/* harmony export */ });
const I18N_DOMAIN_FACETED_SEARCH = 'tui-faceted-search';
const FACETED_MODE = {
ADVANCED: 'advanced',
BASIC: 'basic'
};
const USAGE_TRACKING_TAGS = {
ADVANCED: 'filter.advanced',
ADVANCED_APPLY: 'filter.advanced.apply',
ADVANCED_CLEAR: 'filter.advanced.clear',
BASIC: 'filter.basic',
BASIC_ADD: 'filter.basic.add',
BASIC_CLEAR: 'filter.basic.clear',
COLLAPSE: 'filter.collapse',
EXPAND: 'filter.expand',
BADGE_REMOVE: 'filter.remove',
BADGE_ADD: 'filter.#{badgeName}.add'
};
/***/ }),
/***/ "./src/controlled.js":
/*!***************************!*\
!*** ./src/controlled.js ***!
\***************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ controlled: () => (/* binding */ controlled)
/* harmony export */ });
const isDefined = arg => typeof arg !== 'undefined';
// eslint-disable-next-line import/prefer-default-export
const controlled = (componentName, ...args) => {
const isControlled = args.every(isDefined);
if (!isControlled && args.some(isDefined)) {
throw new Error(`You are trying to control the ${componentName} but not all value are defined, refer to the api doc`);
}
return isControlled;
};
/***/ }),
/***/ "./src/dictionary/badge.dictionary.js":
/*!********************************************!*\
!*** ./src/dictionary/badge.dictionary.js ***!
\********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ createBadgesDict: () => (/* binding */ createBadgesDict),
/* harmony export */ filterBadgeDefinitionsWithDictionary: () => (/* binding */ filterBadgeDefinitionsWithDictionary),
/* harmony export */ getBadgesFromDict: () => (/* binding */ getBadgesFromDict),
/* harmony export */ standardBadgeTypeNames: () => (/* binding */ standardBadgeTypeNames)
/* harmony export */ });
/* harmony import */ var _components_Badges_BadgeCheckboxes_BadgeCheckboxes_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Badges/BadgeCheckboxes/BadgeCheckboxes.component */ "./src/components/Badges/BadgeCheckboxes/BadgeCheckboxes.component.js");
/* harmony import */ var _components_Badges_BadgeDate_BadgeDate_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/Badges/BadgeDate/BadgeDate.component */ "./src/components/Badges/BadgeDate/BadgeDate.component.js");
/* harmony import */ var _components_Badges_BadgeMenu_BadgeMenu_component__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/Badges/BadgeMenu/BadgeMenu.component */ "./src/components/Badges/BadgeMenu/BadgeMenu.component.js");
/* harmony import */ var _components_Badges_BadgeNumber_BadgeNumber_component__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/Badges/BadgeNumber/BadgeNumber.component */ "./src/components/Badges/BadgeNumber/BadgeNumber.component.js");
/* harmony import */ var _components_Badges_BadgePeriod_BadgePeriod_component__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/Badges/BadgePeriod/BadgePeriod.component */ "./src/components/Badges/BadgePeriod/BadgePeriod.component.js");
/* harmony import */ var _components_Badges_BadgeSlider_BadgeSlider_component__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/Badges/BadgeSlider/BadgeSlider.component */ "./src/components/Badges/BadgeSlider/BadgeSlider.component.js");
/* harmony import */ var _components_Badges_BadgeText_BadgeText_component__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../components/Badges/BadgeText/BadgeText.component */ "./src/components/Badges/BadgeText/BadgeText.component.js");
const standardBadgeTypeNames = {
text: 'text',
checkbox: 'checkbox',
number: 'number',
slider: 'slider',
tags: 'tags',
date: 'date',
menu: 'menu',
period: 'period'
};
const standardBadges = {
[standardBadgeTypeNames.text]: _components_Badges_BadgeText_BadgeText_component__WEBPACK_IMPORTED_MODULE_6__.BadgeText,
[standardBadgeTypeNames.checkbox]: _components_Badges_BadgeCheckboxes_BadgeCheckboxes_component__WEBPACK_IMPORTED_MODULE_0__.BadgeCheckboxes,
[standardBadgeTypeNames.number]: _components_Badges_BadgeNumber_BadgeNumber_component__WEBPACK_IMPORTED_MODULE_3__.BadgeNumber,
[standardBadgeTypeNames.slider]: _components_Badges_BadgeSlider_BadgeSlider_component__WEBPACK_IMPORTED_MODULE_5__.BadgeSlider,
[standardBadgeTypeNames.tags]: _components_Badges_BadgeCheckboxes_BadgeCheckboxes_component__WEBPACK_IMPORTED_MODULE_0__.BadgeCheckboxes,
[standardBadgeTypeNames.date]: _components_Badges_BadgeDate_BadgeDate_component__WEBPACK_IMPORTED_MODULE_1__.BadgeDate,
[standardBadgeTypeNames.menu]: _components_Badges_BadgeMenu_BadgeMenu_component__WEBPACK_IMPORTED_MODULE_2__.BadgeMenu,
[standardBadgeTypeNames.period]: _components_Badges_BadgePeriod_BadgePeriod_component__WEBPACK_IMPORTED_MODULE_4__.BadgePeriod
};
const filterBadgeDefinitionsWithDictionary = (badgesDictionary, badgeDefinition) => {
const supportedTypes = Object.keys(badgesDictionary);
return badgeDefinition.filter(badge => supportedTypes.includes(badge.properties.type));
};
const createBadgesDict = badges => {
if (badges) {
return {
...standardBadges,
...badges
};
}
return standardBadges;
};
const getBadgesFromDict = (badges, badgeKey) => badges[badgeKey];
/***/ }),
/***/ "./src/dictionary/helpers.dictionary.js":
/*!**********************************************!*\
!*** ./src/dictionary/helpers.dictionary.js ***!
\**********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ filterBadgesDefinitionsWithOneContains: () => (/* binding */ filterBadgesDefinitionsWithOneContains),
/* harmony export */ removeOneOperator: () => (/* binding */ removeOneOperator)
/* harmony export */ });
/* harmony import */ var _operator_dictionary__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./operator.dictionary */ "./src/dictionary/operator.dictionary.js");
const removeOneOperator = (badgeDefinition, operatorToRemove) => {
const {
metadata: {
operators
}
} = badgeDefinition;
return {
...badgeDefinition,
metadata: {
...badgeDefinition.metadata,
operators: operators.filter(operator => operator !== operatorToRemove)
}
};
};
const filterBadgesDefinitionsWithOneContains = badgesDefinitions => badgesDefinitions.map(badgeDefinition => {
const {
properties: {
type
},
metadata: {
operators
}
} = badgeDefinition;
const hasTwoContainsOperator = type === 'text' && operators.includes(_operator_dictionary__WEBPACK_IMPORTED_MODULE_0__.operatorNames.contains) && operators.includes(_operator_dictionary__WEBPACK_IMPORTED_MODULE_0__.operatorNames.containsIgnoreCase);
if (hasTwoContainsOperator) {
return removeOneOperator(badgeDefinition, _operator_dictionary__WEBPACK_IMPORTED_MODULE_0__.operatorNames.contains);
}
return badgeDefinition;
});
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
filterBadgesDefinitionsWithOneContains,
removeOneOperator
});
/***/ }),
/***/ "./src/dictionary/operator.dictionary.js":
/*!***********************************************!*\
!*** ./src/dictionary/operator.dictionary.js ***!
\***********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ createOperatorsDict: () => (/* binding */ createOperatorsDict),
/* harmony export */ getOperatorsFromDict: () => (/* binding */ getOperatorsFromDict),
/* harmony export */ operatorNames: () => (/* binding */ operatorNames)
/* harmony export */ });
const operatorNames = {
contains: 'contains',
containsIgnoreCase: 'containsIgnoreCase',
notContains: 'notContains',
notContainsIgnoreCase: 'notContainsIgnoreCase',
equals: 'equals',
notEquals: 'notEquals',
in: 'in',
notIn: 'notIn',
greaterThan: 'greaterThan',
greaterThanOrEquals: 'greaterThanOrEquals',
lessThan: 'lessThan',
lessThanOrEquals: 'lessThanOrEquals',
complies: 'complies',
wordComplies: 'wordComplies'
};
const standardOperators = t => ({
[operatorNames.notEquals]: {
label: t('OPERATOR_NOT_EQUALS_LABEL', {
defaultValue: 'Not equal to'
}),
name: 'notEquals',
iconName: 'not-equal'
},
[operatorNames.equals]: {
label: t('OPERATOR_EQUALS_LABEL', {
defaultValue: 'Equal to'
}),
name: 'equals',
iconName: 'equal'
},
[operatorNames.contains]: {
label: t('OPERATOR_CONTAINS_LABEL', {
defaultValue: 'Contains'
}),
name: 'contains',
iconName: 'contains'
},
[operatorNames.containsIgnoreCase]: {
label: t('OPERATOR_CONTAINS_LABEL', {
defaultValue: 'Contains'
}),
name: 'containsIgnoreCase',
iconName: 'contains'
},
[operatorNames.notContains]: {
label: t('OPERATOR_NOT_CONTAINS_LABEL', {
defaultValue: 'Not contains'
}),
name: 'notContains',
iconName: 'not-contains'
},
[operatorNames.notContainsIgnoreCase]: {
label: t('OPERATOR_NOT_CONTAINS_LABEL', {
defaultValue: 'Not contains'
}),
name: 'notContainsIgnoreCase',
iconName: 'not-contains'
},
[operatorNames.in]: {
label: t('OPERATOR_IN_LABEL', {
defaultValue: 'In'
}),
name: 'in'
},
[operatorNames.notIn]: {
label: t('OPERATOR_NOT_IN_LABEL', {
defaultValue: 'Not in'
}),
name: 'notIn'
},
[operatorNames.greaterThan]: {
label: t('OPERATOR_GREATER_THAN_LABEL', {
defaultValue: 'Greater than'
}),
name: 'greaterThan',
iconName: 'greater-than'
},
[operatorNames.greaterThanOrEquals]: {
label: t('OPERATOR_GREATER_THAN_OR_EQUAL_LABEL', {
defaultValue: 'Greater than or equal to'
}),
name: 'greaterThanOrEquals',
iconName: 'greater-than-equal'
},
[operatorNames.lessThan]: {
label: t('OPERATOR_LESS_THAN_LABEL', {
defaultValue: 'Less than'
}),
name: 'lessThan',
iconName: 'less-than'
},
[operatorNames.lessThanOrEquals]: {
label: t('OPERATOR_LESS_THAN_OR_EQUAL_LABEL', {
defaultValue: 'Less than or equal to'
}),
name: 'lessThanOrEquals',
iconName: 'less-than-equal'
},
[operatorNames.complies]: {
label: t('OPERATOR_COMPLIES_LABEL', {
defaultValue: 'Matches character based pattern'
}),
name: 'complies',
iconName: 'between'
},
[operatorNames.wordComplies]: {
label: t('OPERATOR_WORD_COMPLIES_LABEL', {
defaultValue: 'Matches word based pattern'
}),
name: 'wordComplies',
iconName: 'between'
}
});
const createOperatorsDict = (t, operators) => {
if (operators) {
return {
...standardOperators(t),
...operators
};
}
return standardOperators(t);
};
const getOperatorsFromDict = (operatorsDictionary, operatorsKeys) => operatorsKeys.map(operatorKey => operatorsDictionary[operatorKey]).filter(element => element !== undefined);
// eslint-disable-next-line import/prefer-default-export
/***/ }),
/***/ "./src/helpers/usage.helpers.js":
/*!**************************************!*\
!*** ./src/helpers/usage.helpers.js ***!
\**************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ getApplyDataFeature: () => (/* binding */ getApplyDataFeature)
/* harmony export */ });
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants */ "./src/constants.js");
const getApplyDataFeature = feature => {
const formatedFeature = feature.toLowerCase().replace(' ', '_');
return _constants__WEBPACK_IMPORTED_MODULE_0__.USAGE_TRACKING_TAGS.BADGE_ADD.replace('#{badgeName}', formatedFeature);
};
/***/ }),
/***/ "./src/hooks/badgeOverlayFlow.hook.js":
/*!********************************************!*\
!*** ./src/hooks/badgeOverlayFlow.hook.js ***!
\********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ OVERLAY_FLOW_ACTIONS: () => (/* binding */ OVERLAY_FLOW_ACTIONS),
/* harmony export */ useBadgeOverlayFlow: () => (/* binding */ useBadgeOverlayFlow)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
const OVERLAY_FLOW_ACTIONS_KEYS = {
CLOSE_ALL: 'CLOSE_ALL',
OPEN_OPERATOR: 'OPEN_OPERATOR',
OPEN_VALUE: 'OPEN_VALUE'
};
const OVERLAY_FLOW_ACTIONS = {
openOperator: {
type: OVERLAY_FLOW_ACTIONS_KEYS.OPEN_OPERATOR
},
openValue: {
type: OVERLAY_FLOW_ACTIONS_KEYS.OPEN_VALUE
},
closeAll: {
type: OVERLAY_FLOW_ACTIONS_KEYS.CLOSE_ALL
}
};
const reducer = (state, {
type
}) => {
switch (type) {
case 'OPEN_OPERATOR':
return {
...state,
operatorOpened: true,
valueOpened: false
};
case 'OPEN_VALUE':
return {
...state,
operatorOpened: false,
valueOpened: true
};
case 'CLOSE_ALL':
return {
...state,
operatorOpened: false,
valueOpened: false
};
default:
return state;
}
};
const useBadgeOverlayFlow = (initialOperatorOpened = false, initialValueOpened = false) => {
const [state, dispatch] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useReducer)(reducer, {
operatorOpened: initialOperatorOpened,
valueOpened: initialValueOpened
});
const onChangeOperatorOverlay = () => {
if (state.operatorOpened) {
dispatch(OVERLAY_FLOW_ACTIONS.openValue);
} else {
dispatch(OVERLAY_FLOW_ACTIONS.openOperator);
}
};
const onChangeValueOverlay = () => {
if (state.valueOpened) {
dispatch(OVERLAY_FLOW_ACTIONS.closeAll);
} else {
dispatch(OVERLAY_FLOW_ACTIONS.openValue);
}
};
return [state, dispatch, onChangeOperatorOverlay, onChangeValueOverlay];
};
/***/ }),
/***/ "./src/hooks/facetedBadges.hook.js":
/*!*****************************************!*\
!*** ./src/hooks/facetedBadges.hook.js ***!
\*****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ BADGES_ACTIONS: () => (/* binding */ BADGES_ACTIONS),
/* harmony export */ BADGES_ACTIONS_KEYS: () => (/* binding */ BADGES_ACTIONS_KEYS),
/* harmony export */ useFacetedBadges: () => (/* binding */ useFacetedBadges)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _CRUDBadges__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../CRUDBadges */ "./src/CRUDBadges.js");
const BADGES_ACTIONS_KEYS = {
ADD_BADGE: 'ADD_BADGE',
ADD_BADGE_WITH_VALUE: 'ADD_BADGE_WITH_VALUE',
UPDATE_BADGE: 'UPDATE_BADGE',
DELETE_BADGE: 'DELETE_BADGE',
DELETE_ALL_BADGES: 'DELETE_ALL_BADGES',
CLOSE_INIT_OPENED: 'CLOSE_INIT_OPENED',
RESET_STATE: 'RESET_STATE'
};
const BADGES_ACTIONS = {
add: badge => ({
type: BADGES_ACTIONS_KEYS.ADD_BADGE,
payload: {
badge
}
}),
update: (badgeId, properties, metadata) => ({
type: BADGES_ACTIONS_KEYS.UPDATE_BADGE,
payload: {
badgeId,
properties,
metadata
}
}),
addWithValue: (badge, operator, value) => ({
type: BADGES_ACTIONS_KEYS.ADD_BADGE_WITH_VALUE,
payload: {
badge,
operator,
value
}
}),
delete: badgeId => ({
type: BADGES_ACTIONS_KEYS.DELETE_BADGE,
payload: {
badgeId
}
}),
deleteAll: () => ({
type: BADGES_ACTIONS_KEYS.DELETE_ALL_BADGES
}),
closeInitialOpened: badgeId => ({
type: BADGES_ACTIONS_KEYS.CLOSE_INIT_OPENED,
payload: {
badgeId
}
}),
resetState: state => ({
type: BADGES_ACTIONS_KEYS.RESET_STATE,
payload: state
})
};
const reducer = (state, {
type,
payload
}) => {
switch (type) {
case BADGES_ACTIONS_KEYS.ADD_BADGE:
return {
...state,
badges: (0,_CRUDBadges__WEBPACK_IMPORTED_MODULE_1__.createBadge)(payload.badge)(state.badges)
};
case BADGES_ACTIONS_KEYS.UPDATE_BADGE:
return {
...state,
badges: (0,_CRUDBadges__WEBPACK_IMPORTED_MODULE_1__.updateBadge)(payload.badgeId, payload.properties, payload.metadata)(state.badges)
};
case BADGES_ACTIONS_KEYS.ADD_BADGE_WITH_VALUE:
return {
...state,
badges: (0,_CRUDBadges__WEBPACK_IMPORTED_MODULE_1__.createBadgeWithValue)(payload.badge, payload.operator, payload.value)(state.badges)
};
case BADGES_ACTIONS_KEYS.DELETE_BADGE:
return {
...state,
badges: (0,_CRUDBadges__WEBPACK_IMPORTED_MODULE_1__.deleteBadge)(payload.badgeId)(state.badges)
};
case BADGES_ACTIONS_KEYS.DELETE_ALL_BADGES:
return {
...state,
badges: []
};
case BADGES_ACTIONS_KEYS.CLOSE_INIT_OPENED:
return {
...state,
badges: (0,_CRUDBadges__WEBPACK_IMPORTED_MODULE_1__.closeInitOpenedBadge)(payload.badgeId)(state.badges)
};
case BADGES_ACTIONS_KEYS.RESET_STATE:
return payload;
default:
return state;
}
};
const useFacetedBadges = (externalState, setExternalState) => {
const [state, dispatch] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useReducer)(reducer, !externalState ? {
badges: []
} : externalState);
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
if (setExternalState) {
setExternalState(state);
}
}, [setExternalState, state]);
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
if (externalState) {
dispatch(BADGES_ACTIONS.resetState(externalState));
}
}, [externalState]);
return [state, dispatch];
};
/***/ }),
/***/ "@talend/design-system":
/*!*************************************!*\
!*** external "TalendDesignSystem" ***!
\*************************************/
/***/ ((module) => {
"use strict";
module.exports = TalendDesignSystem;
/***/ }),
/***/ "@talend/design-tokens":
/*!*************************************!*\
!*** external "TalendDesignTokens" ***!
\*************************************/
/***/ ((module) => {
"use strict";
module.exports = TalendDesignTokens;
/***/ }),
/***/ "@talend/react-components":
/*!****************************************!*\
!*** external "TalendReactComponents" ***!
\****************************************/
/***/ ((module) => {
"use strict";
module.exports = TalendReactComponents;
/***/ }),
/***/ "classnames":
/*!*****************************!*\
!*** external "classNames" ***!
\*****************************/
/***/ ((module) => {
"use strict";
module.exports = classNames;
/***/ }),
/***/ "lodash":
/*!********************!*\
!*** external "_" ***!
\********************/
/***/ ((module) => {
"use strict";
module.exports = _;
/***/ }),
/***/ "prop-types":
/*!****************************!*\
!*** external "PropTypes" ***!
\****************************/
/***/ ((module) => {
"use strict";
module.exports = PropTypes;
/***/ }),
/***/ "react":
/*!************************!*\
!*** external "React" ***!
\************************/
/***/ ((module) => {
"use strict";
module.exports = React;
/***/ }),
/***/ "react-i18next":
/*!*******************************!*\
!*** external "ReactI18next" ***!
\*******************************/
/***/ ((module) => {
"use strict";
module.exports = ReactI18next;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
(() => {
"use strict";
/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ "./src/constants.js");
/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components */ "./src/components/index.js");
/* harmony import */ var _dictionary_helpers_dictionary__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dictionary/helpers.dictionary */ "./src/dictionary/helpers.dictionary.js");
/* harmony import */ var _dictionary_operator_dictionary__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./dictionary/operator.dictionary */ "./src/dictionary/operator.dictionary.js");
const components = {
Faceted: _components__WEBPACK_IMPORTED_MODULE_1__.FacetedSearch,
AdvancedSearch: _components__WEBPACK_IMPORTED_MODULE_1__.AdvancedSearch,
BasicSearch: _components__WEBPACK_IMPORTED_MODULE_1__.BasicSearch,
BadgeText: _components__WEBPACK_IMPORTED_MODULE_1__.BadgeText,
BadgeSlider: _components__WEBPACK_IMPORTED_MODULE_1__.BadgeSlider,
BadgeOverlay: _components__WEBPACK_IMPORTED_MODULE_1__.BadgeOverlay,
BadgeCheckboxes: _components__WEBPACK_IMPORTED_MODULE_1__.BadgeCheckboxes,
BadgeCheckboxesForm: _components__WEBPACK_IMPORTED_MODULE_1__.BadgeCheckboxesForm,
BadgeFaceted: _components__WEBPACK_IMPORTED_MODULE_1__.BadgeFaceted
};
const helpers = {
dictionary: _dictionary_helpers_dictionary__WEBPACK_IMPORTED_MODULE_2__["default"],
operatorNames: _dictionary_operator_dictionary__WEBPACK_IMPORTED_MODULE_3__.operatorNames
};
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
...components,
badgeDefinitionTypes: _components__WEBPACK_IMPORTED_MODULE_1__.badgeDefinitionTypes,
constants: _constants__WEBPACK_IMPORTED_MODULE_0__,
helpers
});
})();
/******/ return __webpack_exports__;
/******/ })()
;
});
//# sourceMappingURL=TalendReactFacetedSearch.js.map