@rio-cloud/rio-uikit 2.4.2 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CountedInput.d.ts +2 -0
- package/CountedInput.js +5 -0
- package/CountedInput.js.map +1 -0
- package/TabbedPanel.d.ts +2 -0
- package/TabbedPanel.js +5 -0
- package/TabbedPanel.js.map +1 -0
- package/components/applicationHeader/NavItems.js +58 -46
- package/components/applicationHeader/NavItems.js.map +1 -1
- package/components/applicationLayout/ApplicationLayoutBody.d.ts +1 -1
- package/components/applicationLayout/ApplicationLayoutBody.js +29 -29
- package/components/applicationLayout/ApplicationLayoutBody.js.map +1 -1
- package/components/applicationLayout/ApplicationLayoutHeader.js +22 -7
- package/components/applicationLayout/ApplicationLayoutHeader.js.map +1 -1
- package/components/assetTree/useTreeHeight.js.map +1 -1
- package/components/button/Button.d.ts +11 -3
- package/components/button/Button.js.map +1 -1
- package/components/clearableInput/ClearableInput.d.ts +4 -0
- package/components/clearableInput/ClearableInput.js.map +1 -1
- package/components/countedInput/CountedInput.d.ts +91 -0
- package/components/countedInput/CountedInput.js +65 -0
- package/components/countedInput/CountedInput.js.map +1 -0
- package/components/datepicker/DayPicker.js +3 -2
- package/components/datepicker/DayPicker.js.map +1 -1
- package/components/datepicker/DayPickerInput.d.ts +1 -1
- package/components/datepicker/DayPickerInput.js.map +1 -1
- package/components/datepicker/dayPickerTypes.d.ts +3 -2
- package/components/datepicker/dayPickerTypes.js.map +1 -1
- package/components/datepicker/dayPickerUtils.d.ts +1 -1
- package/components/datepicker/dayPickerUtils.js +45 -22
- package/components/datepicker/dayPickerUtils.js.map +1 -1
- package/components/datepicker/useDayPickerInputState.d.ts +1 -1
- package/components/dialog/ConfirmationDialog.d.ts +17 -0
- package/components/dialog/ConfirmationDialog.js +43 -19
- package/components/dialog/ConfirmationDialog.js.map +1 -1
- package/components/dialog/DialogHeader.js +20 -19
- package/components/dialog/DialogHeader.js.map +1 -1
- package/components/dropdown/ButtonDropdown.d.ts +5 -0
- package/components/dropdown/ButtonDropdown.js +63 -61
- package/components/dropdown/ButtonDropdown.js.map +1 -1
- package/components/dropdown/DropdownToggleButton.d.ts +2 -0
- package/components/dropdown/DropdownToggleButton.js +39 -35
- package/components/dropdown/DropdownToggleButton.js.map +1 -1
- package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js +103 -105
- package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js.map +1 -1
- package/components/map/utils/eventHandling.js.map +1 -1
- package/components/map/utils/mapTypes.d.ts +7 -0
- package/components/map/utils/mapTypes.js.map +1 -1
- package/components/map/utils/rendering.js +5 -5
- package/components/numberControl/NumberControl.js.map +1 -1
- package/components/page/Page.d.ts +2 -0
- package/components/page/Page.js.map +1 -1
- package/components/rioglyph/Rioglyph.d.ts +8 -2
- package/components/rioglyph/Rioglyph.js.map +1 -1
- package/components/rioglyph/RioglyphIconType.d.ts +1 -1
- package/components/selects/BaseSelectDropdown.d.ts +8 -0
- package/components/selects/BaseSelectDropdown.js +76 -60
- package/components/selects/BaseSelectDropdown.js.map +1 -1
- package/components/selects/Multiselect.d.ts +5 -0
- package/components/selects/Multiselect.js +60 -58
- package/components/selects/Multiselect.js.map +1 -1
- package/components/selects/Select.d.ts +5 -0
- package/components/selects/Select.js +60 -58
- package/components/selects/Select.js.map +1 -1
- package/components/sidebars/Sidebar.js +40 -40
- package/components/sidebars/Sidebar.js.map +1 -1
- package/components/sidebars/SidebarCloseButton.d.ts +3 -1
- package/components/sidebars/SidebarCloseButton.js +19 -5
- package/components/sidebars/SidebarCloseButton.js.map +1 -1
- package/components/states/CustomState.d.ts +7 -1
- package/components/states/CustomState.js.map +1 -1
- package/components/states/StateButton.d.ts +11 -1
- package/components/states/StateButton.js +46 -10
- package/components/states/StateButton.js.map +1 -1
- package/components/statsWidget/StatsWidgetNumber.d.ts +16 -1
- package/components/statsWidget/StatsWidgetNumber.js +29 -12
- package/components/statsWidget/StatsWidgetNumber.js.map +1 -1
- package/components/tabbedPanel/TabbedPanel.d.ts +99 -0
- package/components/tabbedPanel/TabbedPanel.js +119 -0
- package/components/tabbedPanel/TabbedPanel.js.map +1 -0
- package/components/table/Table.types.d.ts +9 -1
- package/components/table/TableColumn.js +20 -19
- package/components/table/TableColumn.js.map +1 -1
- package/components/table/TableHeaderColumn.d.ts +4 -0
- package/components/table/TableHeaderColumn.js +50 -53
- package/components/table/TableHeaderColumn.js.map +1 -1
- package/components/table/TableToolbar.d.ts +4 -0
- package/components/table/TableToolbar.js.map +1 -1
- package/components/table/TableToolbarColumn.d.ts +3 -0
- package/components/table/TableToolbarColumn.js.map +1 -1
- package/components/table/render/header/resolveHeaderCellStyle.d.ts +87 -55
- package/components/timepicker/TimePicker.d.ts +6 -0
- package/components/timepicker/TimePicker.js +57 -56
- package/components/timepicker/TimePicker.js.map +1 -1
- package/hooks/useClickOutside.js +3 -3
- package/hooks/useClipboard.js.map +1 -1
- package/hooks/useScrollPosition.js.map +1 -1
- package/package.json +4 -4
- package/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +23 -22
- package/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js.map +1 -1
- package/utils/analytics/getTrackingLabelFromNode.d.ts +2 -0
- package/utils/analytics/getTrackingLabelFromNode.js +24 -0
- package/utils/analytics/getTrackingLabelFromNode.js.map +1 -0
- package/utils/analytics/googleAnalyticsUtils.js +21 -28
- package/utils/analytics/googleAnalyticsUtils.js.map +1 -1
- package/utils/getNodeTextContent.d.ts +2 -0
- package/utils/getNodeTextContent.js +22 -0
- package/utils/getNodeTextContent.js.map +1 -0
- package/utils/init/initCSS.js +5 -5
- package/utils/init/initCSS.js.map +1 -1
- package/utils/init/initConfig.js +4 -7
- package/utils/init/initConfig.js.map +1 -1
- package/utils/init/initDocumentBootstrapping.js +14 -14
- package/utils/init/initDocumentBootstrapping.js.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/DayPickerPrototype.d.ts +0 -2
- package/DayPickerPrototype.js +0 -5
- package/DayPickerPrototype.js.map +0 -1
- package/TableNext.d.ts +0 -2
- package/TableNext.js +0 -25
- package/TableNext.js.map +0 -1
- package/components/datepicker/DayPickerPrototype.d.ts +0 -53
- package/components/datepicker/DayPickerPrototype.js +0 -285
- package/components/datepicker/DayPickerPrototype.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { parse as
|
|
2
|
-
import * as
|
|
3
|
-
|
|
1
|
+
import { parse as i, format as a, isValid as m } from "date-fns";
|
|
2
|
+
import * as e from "date-fns/locale";
|
|
3
|
+
import { IMask as d } from "react-imask";
|
|
4
|
+
const f = {
|
|
4
5
|
"bg-BG": "dd.MM.yyyy",
|
|
5
6
|
"cs-CZ": "dd.MM.yyyy",
|
|
6
7
|
"da-DK": "dd-MM-yyyy",
|
|
@@ -25,10 +26,10 @@ const i = {
|
|
|
25
26
|
"sk-SK": "dd.MM.yyyy",
|
|
26
27
|
"sl-SI": "dd.MM.yyyy",
|
|
27
28
|
"sv-SE": "yyyy-MM-dd"
|
|
28
|
-
},
|
|
29
|
+
}, k = Object.keys(f), h = (y) => {
|
|
29
30
|
const r = y.trim(), t = r.replace(/-([a-z])/gi, (n, M) => M.toUpperCase()), o = r.split("-")[0];
|
|
30
|
-
return
|
|
31
|
-
}, p = (y, r, t) => y ?
|
|
31
|
+
return e[t] || e[r] || e[o] || e.enGB;
|
|
32
|
+
}, p = (y, r, t) => y ? a(y, s(r, t)) : "", L = (y, r, t, o) => {
|
|
32
33
|
if (!y)
|
|
33
34
|
return "";
|
|
34
35
|
const n = (M) => p(M, r, o);
|
|
@@ -37,11 +38,11 @@ const i = {
|
|
|
37
38
|
if (t === "multiple" && Array.isArray(y))
|
|
38
39
|
return y.map(n).join(", ");
|
|
39
40
|
if (t === "range" && typeof y == "object" && "from" in y) {
|
|
40
|
-
const M = y.from ? n(y.from) : "...",
|
|
41
|
-
return `${M} - ${
|
|
41
|
+
const M = y.from ? n(y.from) : "...", c = y.to ? n(y.to) : "...";
|
|
42
|
+
return `${M} - ${c}`;
|
|
42
43
|
}
|
|
43
44
|
return "";
|
|
44
|
-
},
|
|
45
|
+
}, s = (y, r) => r || f[y] || "yyyy-MM-dd", u = (y) => {
|
|
45
46
|
let r = "";
|
|
46
47
|
for (let t = 0; t < y.length; ) {
|
|
47
48
|
if (y.startsWith("dd", t)) {
|
|
@@ -56,6 +57,14 @@ const i = {
|
|
|
56
57
|
r += "Y", t += 4;
|
|
57
58
|
continue;
|
|
58
59
|
}
|
|
60
|
+
if (y.startsWith("HH", t)) {
|
|
61
|
+
r += "H", t += 2;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (y.startsWith("mm", t)) {
|
|
65
|
+
r += "M", t += 2;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
59
68
|
const o = y[t];
|
|
60
69
|
if (!o)
|
|
61
70
|
break;
|
|
@@ -64,29 +73,43 @@ const i = {
|
|
|
64
73
|
r += o, t += 1;
|
|
65
74
|
}
|
|
66
75
|
return r;
|
|
67
|
-
},
|
|
68
|
-
const t =
|
|
76
|
+
}, D = (y, r) => {
|
|
77
|
+
const t = s(y, r), o = u(t);
|
|
69
78
|
if (o)
|
|
70
79
|
return {
|
|
71
80
|
mask: Date,
|
|
72
81
|
pattern: o,
|
|
73
|
-
|
|
74
|
-
|
|
82
|
+
blocks: {
|
|
83
|
+
H: {
|
|
84
|
+
mask: d.MaskedRange,
|
|
85
|
+
from: 0,
|
|
86
|
+
to: 23,
|
|
87
|
+
maxLength: 2
|
|
88
|
+
},
|
|
89
|
+
M: {
|
|
90
|
+
mask: d.MaskedRange,
|
|
91
|
+
from: 0,
|
|
92
|
+
to: 59,
|
|
93
|
+
maxLength: 2
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
format: (n) => n ? a(n, t) : "",
|
|
97
|
+
parse: (n) => i(n, t, /* @__PURE__ */ new Date())
|
|
75
98
|
};
|
|
76
|
-
},
|
|
99
|
+
}, I = (y, r, t) => {
|
|
77
100
|
if (!y)
|
|
78
101
|
return;
|
|
79
|
-
const o = t ||
|
|
80
|
-
if (
|
|
102
|
+
const o = t || s(r), n = i(y, o, /* @__PURE__ */ new Date());
|
|
103
|
+
if (m(n) && a(n, o) === y)
|
|
81
104
|
return n;
|
|
82
105
|
};
|
|
83
106
|
export {
|
|
84
107
|
p as formatDate,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
108
|
+
L as formatSelectionForInput,
|
|
109
|
+
s as getInputFormat,
|
|
110
|
+
D as getInputMaskProps,
|
|
111
|
+
I as parseDateString,
|
|
112
|
+
h as resolveLocale,
|
|
113
|
+
k as supportedDayPickerLocales
|
|
91
114
|
};
|
|
92
115
|
//# sourceMappingURL=dayPickerUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dayPickerUtils.js","sources":["../../../src/components/datepicker/dayPickerUtils.ts"],"sourcesContent":["import { format, isValid, parse, type Locale } from 'date-fns';\nimport * as locales from 'date-fns/locale';\n\nimport type { ClearableInputProps } from '../clearableInput/ClearableInput';\nimport type { DateRange, DayPickerMode } from './dayPickerTypes';\n\nconst localeFormatMap: Record<string, string> = {\n 'bg-BG': 'dd.MM.yyyy',\n 'cs-CZ': 'dd.MM.yyyy',\n 'da-DK': 'dd-MM-yyyy',\n 'de-DE': 'dd.MM.yyyy',\n 'el-GR': 'dd/MM/yyyy',\n 'en-GB': 'dd/MM/yyyy',\n 'es-ES': 'dd/MM/yyyy',\n 'et-EE': 'dd.MM.yyyy',\n 'fi-FI': 'dd.MM.yyyy',\n 'fr-FR': 'dd/MM/yyyy',\n 'hr-HR': 'dd.MM.yyyy',\n 'hu-HU': 'yyyy. MM. dd.',\n 'it-IT': 'dd/MM/yyyy',\n 'lt-LT': 'dd-MM-yyyy',\n 'lv-LV': 'dd.MM.yyyy',\n 'nb-NO': 'dd.MM.yyyy',\n 'nl-NL': 'dd-MM-yyyy',\n 'pl-PL': 'dd.MM.yyyy',\n 'pt-BR': 'dd/MM/yyyy',\n 'pt-PT': 'dd/MM/yyyy',\n 'ro-RO': 'dd.MM.yyyy',\n 'sk-SK': 'dd.MM.yyyy',\n 'sl-SI': 'dd.MM.yyyy',\n 'sv-SE': 'yyyy-MM-dd',\n};\n\nexport const supportedDayPickerLocales = Object.keys(localeFormatMap);\n\nexport const resolveLocale = (localeCode: string): Locale => {\n const normalizedLocaleCode = localeCode.trim();\n const dateFnsLocaleKey = normalizedLocaleCode.replace(/-([a-z])/gi, (_, segment: string) => segment.toUpperCase());\n const baseCode = normalizedLocaleCode.split('-')[0];\n\n return (\n (locales as Record<string, Locale>)[dateFnsLocaleKey] ||\n (locales as Record<string, Locale>)[normalizedLocaleCode] ||\n (locales as Record<string, Locale>)[baseCode] ||\n locales.enGB\n );\n};\n\nexport const formatDate = (date: Date | undefined, localeCode: string, dateFormat?: string): string => {\n if (!date) {\n return '';\n }\n\n return format(date, getInputFormat(localeCode, dateFormat));\n};\n\nexport const formatSelectionForInput = (\n selected: Date | Date[] | DateRange | undefined,\n localeCode: string,\n mode: DayPickerMode,\n dateFormat?: string\n): string => {\n if (!selected) {\n return '';\n }\n\n const formatFn = (date: Date) => formatDate(date, localeCode, dateFormat);\n\n if (mode === 'single' && selected instanceof Date) {\n return formatFn(selected);\n }\n\n if (mode === 'multiple' && Array.isArray(selected)) {\n return selected.map(formatFn).join(', ');\n }\n\n if (mode === 'range' && typeof selected === 'object' && 'from' in selected) {\n const from = selected.from ? formatFn(selected.from) : '...';\n const to = selected.to ? formatFn(selected.to) : '...';\n return `${from} - ${to}`;\n }\n\n return '';\n};\n\nexport const getInputFormat = (localeCode: string, dateFormat?: string) =>\n dateFormat || localeFormatMap[localeCode] || 'yyyy-MM-dd';\n\nconst getInputMaskPattern = (inputFormat: string) => {\n let pattern = '';\n\n for (let index = 0; index < inputFormat.length; ) {\n if (inputFormat.startsWith('dd', index)) {\n pattern += 'd';\n index += 2;\n continue;\n }\n\n if (inputFormat.startsWith('MM', index)) {\n pattern += 'm';\n index += 2;\n continue;\n }\n\n if (inputFormat.startsWith('yyyy', index)) {\n pattern += 'Y';\n index += 4;\n continue;\n }\n\n const currentChar = inputFormat[index];\n if (!currentChar) {\n break;\n }\n\n if (/[a-zA-Z]/.test(currentChar)) {\n return;\n }\n\n pattern += currentChar;\n index += 1;\n }\n\n return pattern;\n};\n\nexport const getInputMaskProps = (\n localeCode: string,\n dateFormat?: string\n): Pick<ClearableInputProps, 'mask' | 'pattern' | 'format' | 'parse'> | undefined => {\n const inputFormat = getInputFormat(localeCode, dateFormat);\n const pattern = getInputMaskPattern(inputFormat);\n if (!pattern) {\n return;\n }\n\n return {\n mask: Date,\n pattern,\n format: (value: Date | null) => {\n if (!value) {\n return '';\n }\n\n return format(value, inputFormat);\n },\n parse: (value: string) => parse(value, inputFormat, new Date()),\n };\n};\n\nexport const parseDateString = (\n value: string | undefined,\n localeCode: string,\n dateFormat?: string\n): Date | undefined => {\n if (!value) {\n return;\n }\n\n const expectedFormat = dateFormat || getInputFormat(localeCode);\n const parsed = parse(value, expectedFormat, new Date());\n if (!isValid(parsed)) {\n return;\n }\n\n if (format(parsed, expectedFormat) !== value) {\n return;\n }\n\n return parsed;\n};\n"],"names":["localeFormatMap","supportedDayPickerLocales","resolveLocale","localeCode","normalizedLocaleCode","dateFnsLocaleKey","_","segment","baseCode","locales","formatDate","date","dateFormat","format","getInputFormat","formatSelectionForInput","selected","mode","formatFn","from","to","getInputMaskPattern","inputFormat","pattern","index","currentChar","getInputMaskProps","value","parse","parseDateString","expectedFormat","parsed","isValid"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dayPickerUtils.js","sources":["../../../src/components/datepicker/dayPickerUtils.ts"],"sourcesContent":["import { format, isValid, parse, type Locale } from 'date-fns';\nimport * as locales from 'date-fns/locale';\nimport { IMask } from 'react-imask';\n\nimport type { ClearableInputProps } from '../clearableInput/ClearableInput';\nimport type { DateRange, DayPickerMode } from './dayPickerTypes';\n\nconst localeFormatMap: Record<string, string> = {\n 'bg-BG': 'dd.MM.yyyy',\n 'cs-CZ': 'dd.MM.yyyy',\n 'da-DK': 'dd-MM-yyyy',\n 'de-DE': 'dd.MM.yyyy',\n 'el-GR': 'dd/MM/yyyy',\n 'en-GB': 'dd/MM/yyyy',\n 'es-ES': 'dd/MM/yyyy',\n 'et-EE': 'dd.MM.yyyy',\n 'fi-FI': 'dd.MM.yyyy',\n 'fr-FR': 'dd/MM/yyyy',\n 'hr-HR': 'dd.MM.yyyy',\n 'hu-HU': 'yyyy. MM. dd.',\n 'it-IT': 'dd/MM/yyyy',\n 'lt-LT': 'dd-MM-yyyy',\n 'lv-LV': 'dd.MM.yyyy',\n 'nb-NO': 'dd.MM.yyyy',\n 'nl-NL': 'dd-MM-yyyy',\n 'pl-PL': 'dd.MM.yyyy',\n 'pt-BR': 'dd/MM/yyyy',\n 'pt-PT': 'dd/MM/yyyy',\n 'ro-RO': 'dd.MM.yyyy',\n 'sk-SK': 'dd.MM.yyyy',\n 'sl-SI': 'dd.MM.yyyy',\n 'sv-SE': 'yyyy-MM-dd',\n};\n\nexport const supportedDayPickerLocales = Object.keys(localeFormatMap);\n\nexport const resolveLocale = (localeCode: string): Locale => {\n const normalizedLocaleCode = localeCode.trim();\n const dateFnsLocaleKey = normalizedLocaleCode.replace(/-([a-z])/gi, (_, segment: string) => segment.toUpperCase());\n const baseCode = normalizedLocaleCode.split('-')[0];\n\n return (\n (locales as Record<string, Locale>)[dateFnsLocaleKey] ||\n (locales as Record<string, Locale>)[normalizedLocaleCode] ||\n (locales as Record<string, Locale>)[baseCode] ||\n locales.enGB\n );\n};\n\nexport const formatDate = (date: Date | undefined, localeCode: string, dateFormat?: string): string => {\n if (!date) {\n return '';\n }\n\n return format(date, getInputFormat(localeCode, dateFormat));\n};\n\nexport const formatSelectionForInput = (\n selected: Date | Date[] | DateRange | undefined,\n localeCode: string,\n mode: DayPickerMode,\n dateFormat?: string\n): string => {\n if (!selected) {\n return '';\n }\n\n const formatFn = (date: Date) => formatDate(date, localeCode, dateFormat);\n\n if (mode === 'single' && selected instanceof Date) {\n return formatFn(selected);\n }\n\n if (mode === 'multiple' && Array.isArray(selected)) {\n return selected.map(formatFn).join(', ');\n }\n\n if (mode === 'range' && typeof selected === 'object' && 'from' in selected) {\n const from = selected.from ? formatFn(selected.from) : '...';\n const to = selected.to ? formatFn(selected.to) : '...';\n return `${from} - ${to}`;\n }\n\n return '';\n};\n\nexport const getInputFormat = (localeCode: string, dateFormat?: string) =>\n dateFormat || localeFormatMap[localeCode] || 'yyyy-MM-dd';\n\nconst getInputMaskPattern = (inputFormat: string) => {\n let pattern = '';\n\n for (let index = 0; index < inputFormat.length; ) {\n if (inputFormat.startsWith('dd', index)) {\n pattern += 'd';\n index += 2;\n continue;\n }\n\n if (inputFormat.startsWith('MM', index)) {\n pattern += 'm';\n index += 2;\n continue;\n }\n\n if (inputFormat.startsWith('yyyy', index)) {\n pattern += 'Y';\n index += 4;\n continue;\n }\n\n if (inputFormat.startsWith('HH', index)) {\n pattern += 'H';\n index += 2;\n continue;\n }\n\n if (inputFormat.startsWith('mm', index)) {\n pattern += 'M';\n index += 2;\n continue;\n }\n\n const currentChar = inputFormat[index];\n if (!currentChar) {\n break;\n }\n\n if (/[a-zA-Z]/.test(currentChar)) {\n return;\n }\n\n pattern += currentChar;\n index += 1;\n }\n\n return pattern;\n};\n\nexport const getInputMaskProps = (\n localeCode: string,\n dateFormat?: string\n): Pick<ClearableInputProps, 'mask' | 'pattern' | 'format' | 'parse' | 'blocks'> | undefined => {\n const inputFormat = getInputFormat(localeCode, dateFormat);\n const pattern = getInputMaskPattern(inputFormat);\n if (!pattern) {\n return;\n }\n\n return {\n mask: Date,\n pattern,\n blocks: {\n H: {\n mask: IMask.MaskedRange,\n from: 0,\n to: 23,\n maxLength: 2,\n },\n M: {\n mask: IMask.MaskedRange,\n from: 0,\n to: 59,\n maxLength: 2,\n },\n },\n format: (value: Date | null) => {\n if (!value) {\n return '';\n }\n\n return format(value, inputFormat);\n },\n parse: (value: string) => parse(value, inputFormat, new Date()),\n };\n};\n\nexport const parseDateString = (\n value: string | undefined,\n localeCode: string,\n dateFormat?: string\n): Date | undefined => {\n if (!value) {\n return;\n }\n\n const expectedFormat = dateFormat || getInputFormat(localeCode);\n const parsed = parse(value, expectedFormat, new Date());\n if (!isValid(parsed)) {\n return;\n }\n\n if (format(parsed, expectedFormat) !== value) {\n return;\n }\n\n return parsed;\n};\n"],"names":["localeFormatMap","supportedDayPickerLocales","resolveLocale","localeCode","normalizedLocaleCode","dateFnsLocaleKey","_","segment","baseCode","locales","formatDate","date","dateFormat","format","getInputFormat","formatSelectionForInput","selected","mode","formatFn","from","to","getInputMaskPattern","inputFormat","pattern","index","currentChar","getInputMaskProps","IMask","value","parse","parseDateString","expectedFormat","parsed","isValid"],"mappings":"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"}
|
|
@@ -27,6 +27,6 @@ declare const useDayPickerInputState: ({ props, locale, dateFormat, inputProps,
|
|
|
27
27
|
handleClearInput: () => void;
|
|
28
28
|
handleInputFocus: (event: FocusEvent<HTMLInputElement>) => void;
|
|
29
29
|
handleInputKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
30
|
-
inputMaskProps: Pick<import('../clearableInput/ClearableInput').ClearableInputProps, "
|
|
30
|
+
inputMaskProps: Pick<import('../clearableInput/ClearableInput').ClearableInputProps, "mask" | "pattern" | "format" | "parse" | "blocks"> | undefined;
|
|
31
31
|
};
|
|
32
32
|
export default useDayPickerInputState;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { AutoTrackingAttributes } from '../../utils/analytics/autoTracking';
|
|
2
3
|
import { BaseDialogProps } from './Dialog';
|
|
3
4
|
export type ConfirmationDialogProps = BaseDialogProps & {
|
|
4
5
|
/**
|
|
@@ -21,10 +22,26 @@ export type ConfirmationDialogProps = BaseDialogProps & {
|
|
|
21
22
|
* The content of the cancel button. (Usually a text, can also be a FormattedMessage component).
|
|
22
23
|
*/
|
|
23
24
|
cancelButtonText?: string | React.ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Optional key used to generate automatic GA tracking attributes for the cancel button.
|
|
27
|
+
*/
|
|
28
|
+
cancelButtonAutoTrackingKey?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Optional tracking attributes (e.g. from `getTrackingAttributes`) added to the cancel button.
|
|
31
|
+
*/
|
|
32
|
+
cancelButtonTrackingAttributes?: AutoTrackingAttributes;
|
|
24
33
|
/**
|
|
25
34
|
* The content of the confirmation button. Since it is a node, it can be a simple text or any JSX node like a div element with an icon and a text.
|
|
26
35
|
*/
|
|
27
36
|
confirmButtonText?: string | React.ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Optional key used to generate automatic GA tracking attributes for the confirmation button.
|
|
39
|
+
*/
|
|
40
|
+
confirmButtonAutoTrackingKey?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Optional tracking attributes (e.g. from `getTrackingAttributes`) added to the confirmation button.
|
|
43
|
+
*/
|
|
44
|
+
confirmButtonTrackingAttributes?: AutoTrackingAttributes;
|
|
28
45
|
/**
|
|
29
46
|
* When set to `true` the confirmation button will be disabled.
|
|
30
47
|
*/
|
|
@@ -1,27 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { noop as
|
|
1
|
+
import { jsxs as k, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { noop as n } from "es-toolkit/function";
|
|
3
3
|
import i from "../button/Button.js";
|
|
4
|
-
import
|
|
4
|
+
import B from "./Dialog.js";
|
|
5
5
|
const x = (r) => {
|
|
6
6
|
const {
|
|
7
|
-
content:
|
|
8
|
-
onClickCancel:
|
|
9
|
-
cancelButtonText:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
content: a,
|
|
8
|
+
onClickCancel: t = n,
|
|
9
|
+
cancelButtonText: c,
|
|
10
|
+
cancelButtonAutoTrackingKey: e,
|
|
11
|
+
cancelButtonTrackingAttributes: l,
|
|
12
|
+
onClickConfirm: s = n,
|
|
13
|
+
confirmButtonText: m,
|
|
14
|
+
confirmButtonAutoTrackingKey: u,
|
|
15
|
+
confirmButtonTrackingAttributes: f,
|
|
16
|
+
disableConfirm: C,
|
|
17
|
+
...d
|
|
18
|
+
} = r, g = /* @__PURE__ */ k("div", { className: "btn-toolbar", children: [
|
|
19
|
+
/* @__PURE__ */ o(
|
|
20
|
+
i,
|
|
21
|
+
{
|
|
22
|
+
className: "CancelButton",
|
|
23
|
+
onClick: t,
|
|
24
|
+
autoTrackingKey: e,
|
|
25
|
+
...l,
|
|
26
|
+
children: c
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ o(
|
|
30
|
+
i,
|
|
31
|
+
{
|
|
32
|
+
bsStyle: "primary",
|
|
33
|
+
className: "ConfirmationButton",
|
|
34
|
+
onClick: s,
|
|
35
|
+
disabled: C,
|
|
36
|
+
autoTrackingKey: u,
|
|
37
|
+
...f,
|
|
38
|
+
children: m
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
] });
|
|
15
42
|
return /* @__PURE__ */ o(
|
|
16
|
-
|
|
43
|
+
B,
|
|
17
44
|
{
|
|
18
|
-
...
|
|
19
|
-
body:
|
|
20
|
-
footer:
|
|
21
|
-
|
|
22
|
-
/* @__PURE__ */ o(i, { bsStyle: "primary", className: "ConfirmationButton", onClick: l, disabled: c, children: s })
|
|
23
|
-
] }),
|
|
24
|
-
onClose: n,
|
|
45
|
+
...d,
|
|
46
|
+
body: a,
|
|
47
|
+
footer: g,
|
|
48
|
+
onClose: t,
|
|
25
49
|
showCloseButton: !1,
|
|
26
50
|
className: "confirmation-dialog",
|
|
27
51
|
disableEsc: !0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmationDialog.js","sources":["../../../src/components/dialog/ConfirmationDialog.tsx"],"sourcesContent":["import type React from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport Button from '../button/Button';\nimport Dialog, { type BaseDialogProps } from './Dialog';\n\nexport type ConfirmationDialogProps = BaseDialogProps & {\n /**\n * The content of the dialog body itself\n */\n content?: string | React.ReactNode;\n\n /**\n * A callback fired when the confirmation button is clicked.\n *\n * @default () => {}\n */\n onClickConfirm?: VoidFunction;\n\n /**\n * A callback fired when the cancel button is clicked or the dialog is closed.\n *\n * @default () => {}\n */\n onClickCancel?: VoidFunction;\n\n /**\n * The content of the cancel button. (Usually a text, can also be a FormattedMessage component).\n */\n cancelButtonText?: string | React.ReactNode;\n\n /**\n * The content of the confirmation button. Since it is a node, it can be a simple text or any JSX node like a div element with an icon and a text.\n */\n confirmButtonText?: string | React.ReactNode;\n\n /**\n * When set to `true` the confirmation button will be disabled.\n */\n disableConfirm?: boolean;\n};\n\nconst ConfirmationDialog = (props: ConfirmationDialogProps) => {\n const {\n content,\n onClickCancel = noop,\n cancelButtonText,\n onClickConfirm = noop,\n confirmButtonText,\n disableConfirm,\n ...remainingProps\n } = props;\n\n const footer = (\n <div className='btn-toolbar'>\n <Button
|
|
1
|
+
{"version":3,"file":"ConfirmationDialog.js","sources":["../../../src/components/dialog/ConfirmationDialog.tsx"],"sourcesContent":["import type React from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport Button from '../button/Button';\nimport type { AutoTrackingAttributes } from '../../utils/analytics/autoTracking';\nimport Dialog, { type BaseDialogProps } from './Dialog';\n\nexport type ConfirmationDialogProps = BaseDialogProps & {\n /**\n * The content of the dialog body itself\n */\n content?: string | React.ReactNode;\n\n /**\n * A callback fired when the confirmation button is clicked.\n *\n * @default () => {}\n */\n onClickConfirm?: VoidFunction;\n\n /**\n * A callback fired when the cancel button is clicked or the dialog is closed.\n *\n * @default () => {}\n */\n onClickCancel?: VoidFunction;\n\n /**\n * The content of the cancel button. (Usually a text, can also be a FormattedMessage component).\n */\n cancelButtonText?: string | React.ReactNode;\n\n /**\n * Optional key used to generate automatic GA tracking attributes for the cancel button.\n */\n cancelButtonAutoTrackingKey?: string;\n\n /**\n * Optional tracking attributes (e.g. from `getTrackingAttributes`) added to the cancel button.\n */\n cancelButtonTrackingAttributes?: AutoTrackingAttributes;\n\n /**\n * The content of the confirmation button. Since it is a node, it can be a simple text or any JSX node like a div element with an icon and a text.\n */\n confirmButtonText?: string | React.ReactNode;\n\n /**\n * Optional key used to generate automatic GA tracking attributes for the confirmation button.\n */\n confirmButtonAutoTrackingKey?: string;\n\n /**\n * Optional tracking attributes (e.g. from `getTrackingAttributes`) added to the confirmation button.\n */\n confirmButtonTrackingAttributes?: AutoTrackingAttributes;\n\n /**\n * When set to `true` the confirmation button will be disabled.\n */\n disableConfirm?: boolean;\n};\n\nconst ConfirmationDialog = (props: ConfirmationDialogProps) => {\n const {\n content,\n onClickCancel = noop,\n cancelButtonText,\n cancelButtonAutoTrackingKey,\n cancelButtonTrackingAttributes,\n onClickConfirm = noop,\n confirmButtonText,\n confirmButtonAutoTrackingKey,\n confirmButtonTrackingAttributes,\n disableConfirm,\n ...remainingProps\n } = props;\n\n const footer = (\n <div className='btn-toolbar'>\n <Button\n className='CancelButton'\n onClick={onClickCancel}\n autoTrackingKey={cancelButtonAutoTrackingKey}\n {...cancelButtonTrackingAttributes}\n >\n {cancelButtonText}\n </Button>\n <Button\n bsStyle='primary'\n className='ConfirmationButton'\n onClick={onClickConfirm}\n disabled={disableConfirm}\n autoTrackingKey={confirmButtonAutoTrackingKey}\n {...confirmButtonTrackingAttributes}\n >\n {confirmButtonText}\n </Button>\n </div>\n );\n\n return (\n <Dialog\n {...remainingProps}\n body={content}\n footer={footer}\n onClose={onClickCancel}\n showCloseButton={false}\n className='confirmation-dialog'\n disableEsc\n />\n );\n};\n\nexport default ConfirmationDialog;\n"],"names":["ConfirmationDialog","props","content","onClickCancel","noop","cancelButtonText","cancelButtonAutoTrackingKey","cancelButtonTrackingAttributes","onClickConfirm","confirmButtonText","confirmButtonAutoTrackingKey","confirmButtonTrackingAttributes","disableConfirm","remainingProps","footer","jsxs","jsx","Button","Dialog"],"mappings":";;;;AA+DA,MAAMA,IAAqB,CAACC,MAAmC;AAC3D,QAAM;AAAA,IACF,SAAAC;AAAA,IACA,eAAAC,IAAgBC;AAAA,IAChB,kBAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,gCAAAC;AAAA,IACA,gBAAAC,IAAiBJ;AAAA,IACjB,mBAAAK;AAAA,IACA,8BAAAC;AAAA,IACA,iCAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHZ,GAEEa,IACF,gBAAAC,EAAC,OAAA,EAAI,WAAU,eACX,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACG,WAAU;AAAA,QACV,SAASd;AAAA,QACT,iBAAiBG;AAAA,QAChB,GAAGC;AAAA,QAEH,UAAAF;AAAA,MAAA;AAAA,IAAA;AAAA,IAEL,gBAAAW;AAAA,MAACC;AAAA,MAAA;AAAA,QACG,SAAQ;AAAA,QACR,WAAU;AAAA,QACV,SAAST;AAAA,QACT,UAAUI;AAAA,QACV,iBAAiBF;AAAA,QAChB,GAAGC;AAAA,QAEH,UAAAF;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GACJ;AAGJ,SACI,gBAAAO;AAAA,IAACE;AAAA,IAAA;AAAA,MACI,GAAGL;AAAA,MACJ,MAAMX;AAAA,MACN,QAAAY;AAAA,MACA,SAASX;AAAA,MACT,iBAAiB;AAAA,MACjB,WAAU;AAAA,MACV,YAAU;AAAA,IAAA;AAAA,EAAA;AAGtB;"}
|
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
import { jsxs as e, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { noop as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import v from "react";
|
|
3
|
+
import { noop as B } from "es-toolkit/function";
|
|
4
|
+
import x from "../button/Button.js";
|
|
5
|
+
import { getTrackingLabelFromNode as k } from "../../utils/analytics/getTrackingLabelFromNode.js";
|
|
6
|
+
import i from "../../utils/classNames.js";
|
|
7
|
+
import { useDialogContext as w } from "./dialogContext.js";
|
|
8
|
+
const H = (n) => {
|
|
9
|
+
const { title: t, subtitle: s, headerButtons: l, onCloseButtonClick: c = B, ...m } = n, { onClose: h, isSmallestDialog: a, showXsDialogBorders: u, showCloseButton: g } = w(), r = a ? u : !0, p = a ? !1 : g, b = i("modal-header", !r && "border-bottom-none"), C = i(
|
|
9
10
|
"modal-header-text",
|
|
10
11
|
!r && "padding-bottom-0 width-100pct"
|
|
11
|
-
),
|
|
12
|
-
|
|
12
|
+
), d = k(t), N = (f) => {
|
|
13
|
+
c(), h(f);
|
|
13
14
|
};
|
|
14
|
-
return /* @__PURE__ */ e("div", { ...
|
|
15
|
-
/* @__PURE__ */ e("div", { className:
|
|
16
|
-
|
|
17
|
-
/* @__PURE__ */ o("div", { className: "modal-header-title", children:
|
|
15
|
+
return /* @__PURE__ */ e("div", { ...m, className: b, "aria-label": "dialog header", children: [
|
|
16
|
+
/* @__PURE__ */ e("div", { className: C, children: [
|
|
17
|
+
s && /* @__PURE__ */ o("div", { className: "modal-header-subtitle", children: s }),
|
|
18
|
+
/* @__PURE__ */ o("div", { className: "modal-header-title", children: t })
|
|
18
19
|
] }),
|
|
19
20
|
/* @__PURE__ */ e("div", { className: "modal-header-buttons", children: [
|
|
20
|
-
l && !a && /* @__PURE__ */ e(
|
|
21
|
+
l && !a && /* @__PURE__ */ e(v.Fragment, { children: [
|
|
21
22
|
l,
|
|
22
23
|
/* @__PURE__ */ o("div", { className: "modal-header-buttons-spacer" })
|
|
23
24
|
] }),
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
p && /* @__PURE__ */ o(
|
|
26
|
+
x,
|
|
26
27
|
{
|
|
27
28
|
bsStyle: "muted",
|
|
28
29
|
iconOnly: !0,
|
|
29
30
|
iconName: "rioglyph-remove",
|
|
30
|
-
autoTrackingKey: `dialog::closed::${
|
|
31
|
+
autoTrackingKey: d && `dialog::closed::${d}`,
|
|
31
32
|
className: "modal-header-close close",
|
|
32
|
-
onClick:
|
|
33
|
+
onClick: N,
|
|
33
34
|
"data-testid": "close",
|
|
34
35
|
"aria-label": "dialog close button"
|
|
35
36
|
}
|
|
@@ -38,6 +39,6 @@ const T = (i) => {
|
|
|
38
39
|
] });
|
|
39
40
|
};
|
|
40
41
|
export {
|
|
41
|
-
|
|
42
|
+
H as default
|
|
42
43
|
};
|
|
43
44
|
//# sourceMappingURL=DialogHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogHeader.js","sources":["../../../src/components/dialog/DialogHeader.tsx"],"sourcesContent":["import React, { type ComponentProps } from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport Button from '../button/Button';\nimport classNames from '../../utils/classNames';\nimport { useDialogContext } from './dialogContext';\n\nexport type DialogHeaderProps = Omit<ComponentProps<'div'>, 'title'> & {\n /**\n * The dialog title (can also be a FormattedMessage component).\n */\n title: string | React.ReactNode;\n\n /**\n * The dialog header subtitle content.\n */\n subtitle?: string | React.ReactNode;\n\n /**\n * Allows to add additional buttons to the dialog header.\n */\n headerButtons?: React.ReactNode;\n\n onCloseButtonClick?: () => void;\n};\n\nconst DialogHeader = (props: DialogHeaderProps) => {\n const { title, subtitle, headerButtons, onCloseButtonClick = noop, ...remainingProps } = props;\n\n const { onClose, isSmallestDialog, showXsDialogBorders, showCloseButton } = useDialogContext();\n\n const doShowXsDialogBorders = isSmallestDialog ? showXsDialogBorders : true;\n\n const doShowCloseButton = isSmallestDialog ? false : showCloseButton;\n\n const headerClasses = classNames('modal-header', !doShowXsDialogBorders && 'border-bottom-none');\n const headerTextClasses = classNames(\n 'modal-header-text',\n !doShowXsDialogBorders && 'padding-bottom-0 width-100pct'\n );\n\n const handleClose = (event: React.MouseEvent<HTMLButtonElement>) => {\n onCloseButtonClick();\n onClose(event);\n };\n\n return (\n <div {...remainingProps} className={headerClasses} aria-label='dialog header'>\n <div className={headerTextClasses}>\n {subtitle && <div className='modal-header-subtitle'>{subtitle}</div>}\n <div className='modal-header-title'>{title}</div>\n </div>\n <div className='modal-header-buttons'>\n {headerButtons && !isSmallestDialog && (\n <React.Fragment>\n {headerButtons}\n <div className='modal-header-buttons-spacer' />\n </React.Fragment>\n )}\n {doShowCloseButton && (\n <Button\n bsStyle='muted'\n iconOnly\n iconName='rioglyph-remove'\n autoTrackingKey={`dialog::closed::${
|
|
1
|
+
{"version":3,"file":"DialogHeader.js","sources":["../../../src/components/dialog/DialogHeader.tsx"],"sourcesContent":["import React, { type ComponentProps } from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport Button from '../button/Button';\nimport { getTrackingLabelFromNode } from '../../utils/analytics/getTrackingLabelFromNode';\nimport classNames from '../../utils/classNames';\nimport { useDialogContext } from './dialogContext';\n\nexport type DialogHeaderProps = Omit<ComponentProps<'div'>, 'title'> & {\n /**\n * The dialog title (can also be a FormattedMessage component).\n */\n title: string | React.ReactNode;\n\n /**\n * The dialog header subtitle content.\n */\n subtitle?: string | React.ReactNode;\n\n /**\n * Allows to add additional buttons to the dialog header.\n */\n headerButtons?: React.ReactNode;\n\n onCloseButtonClick?: () => void;\n};\n\nconst DialogHeader = (props: DialogHeaderProps) => {\n const { title, subtitle, headerButtons, onCloseButtonClick = noop, ...remainingProps } = props;\n\n const { onClose, isSmallestDialog, showXsDialogBorders, showCloseButton } = useDialogContext();\n\n const doShowXsDialogBorders = isSmallestDialog ? showXsDialogBorders : true;\n\n const doShowCloseButton = isSmallestDialog ? false : showCloseButton;\n\n const headerClasses = classNames('modal-header', !doShowXsDialogBorders && 'border-bottom-none');\n const headerTextClasses = classNames(\n 'modal-header-text',\n !doShowXsDialogBorders && 'padding-bottom-0 width-100pct'\n );\n const titleTrackingValue = getTrackingLabelFromNode(title);\n\n const handleClose = (event: React.MouseEvent<HTMLButtonElement>) => {\n onCloseButtonClick();\n onClose(event);\n };\n\n return (\n <div {...remainingProps} className={headerClasses} aria-label='dialog header'>\n <div className={headerTextClasses}>\n {subtitle && <div className='modal-header-subtitle'>{subtitle}</div>}\n <div className='modal-header-title'>{title}</div>\n </div>\n <div className='modal-header-buttons'>\n {headerButtons && !isSmallestDialog && (\n <React.Fragment>\n {headerButtons}\n <div className='modal-header-buttons-spacer' />\n </React.Fragment>\n )}\n {doShowCloseButton && (\n <Button\n bsStyle='muted'\n iconOnly\n iconName='rioglyph-remove'\n autoTrackingKey={titleTrackingValue && `dialog::closed::${titleTrackingValue}`}\n className='modal-header-close close'\n onClick={handleClose}\n data-testid='close'\n aria-label='dialog close button'\n />\n )}\n </div>\n </div>\n );\n};\n\nexport default DialogHeader;\n"],"names":["DialogHeader","props","title","subtitle","headerButtons","onCloseButtonClick","noop","remainingProps","onClose","isSmallestDialog","showXsDialogBorders","showCloseButton","useDialogContext","doShowXsDialogBorders","doShowCloseButton","headerClasses","classNames","headerTextClasses","titleTrackingValue","getTrackingLabelFromNode","handleClose","event","jsxs","jsx","React","Button"],"mappings":";;;;;;;AA2BA,MAAMA,IAAe,CAACC,MAA6B;AAC/C,QAAM,EAAE,OAAAC,GAAO,UAAAC,GAAU,eAAAC,GAAe,oBAAAC,IAAqBC,GAAM,GAAGC,MAAmBN,GAEnF,EAAE,SAAAO,GAAS,kBAAAC,GAAkB,qBAAAC,GAAqB,iBAAAC,EAAA,IAAoBC,EAAA,GAEtEC,IAAwBJ,IAAmBC,IAAsB,IAEjEI,IAAoBL,IAAmB,KAAQE,GAE/CI,IAAgBC,EAAW,gBAAgB,CAACH,KAAyB,oBAAoB,GACzFI,IAAoBD;AAAA,IACtB;AAAA,IACA,CAACH,KAAyB;AAAA,EAAA,GAExBK,IAAqBC,EAAyBjB,CAAK,GAEnDkB,IAAc,CAACC,MAA+C;AAChE,IAAAhB,EAAA,GACAG,EAAQa,CAAK;AAAA,EACjB;AAEA,2BACK,OAAA,EAAK,GAAGd,GAAgB,WAAWQ,GAAe,cAAW,iBAC1D,UAAA;AAAA,IAAA,gBAAAO,EAAC,OAAA,EAAI,WAAWL,GACX,UAAA;AAAA,MAAAd,KAAY,gBAAAoB,EAAC,OAAA,EAAI,WAAU,yBAAyB,UAAApB,GAAS;AAAA,MAC9D,gBAAAoB,EAAC,OAAA,EAAI,WAAU,sBAAsB,UAAArB,EAAA,CAAM;AAAA,IAAA,GAC/C;AAAA,IACA,gBAAAoB,EAAC,OAAA,EAAI,WAAU,wBACV,UAAA;AAAA,MAAAlB,KAAiB,CAACK,KACf,gBAAAa,EAACE,EAAM,UAAN,EACI,UAAA;AAAA,QAAApB;AAAA,QACD,gBAAAmB,EAAC,OAAA,EAAI,WAAU,8BAAA,CAA8B;AAAA,MAAA,GACjD;AAAA,MAEHT,KACG,gBAAAS;AAAA,QAACE;AAAA,QAAA;AAAA,UACG,SAAQ;AAAA,UACR,UAAQ;AAAA,UACR,UAAS;AAAA,UACT,iBAAiBP,KAAsB,mBAAmBA,CAAkB;AAAA,UAC5E,WAAU;AAAA,UACV,SAASE;AAAA,UACT,eAAY;AAAA,UACZ,cAAW;AAAA,QAAA;AAAA,MAAA;AAAA,IACf,EAAA,CAER;AAAA,EAAA,GACJ;AAER;"}
|
|
@@ -2,6 +2,7 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { DropdownToggleEvent, DropdownToggleButtonType } from './DropdownToggleButton';
|
|
3
3
|
import { MenuItemProps as MenuItem } from '../menuItems/MenuItem';
|
|
4
4
|
import { BUTTON_SIZE, BUTTON_STYLE, BUTTON_VARIANT } from '../button/Button';
|
|
5
|
+
import { TrackingAttributes } from '../../utils/analytics/googleAnalyticsUtils';
|
|
5
6
|
export type ButtonDropdownProps<T extends DropdownToggleButtonType = 'button'> = {
|
|
6
7
|
/**
|
|
7
8
|
* Unique button id. If not present a random id is generated.
|
|
@@ -128,6 +129,10 @@ export type ButtonDropdownProps<T extends DropdownToggleButtonType = 'button'> =
|
|
|
128
129
|
* Additional classes to be set on the dropdown-toggle button.
|
|
129
130
|
*/
|
|
130
131
|
toggleClassName?: string;
|
|
132
|
+
/**
|
|
133
|
+
* Optional tracking attributes added to the dropdown toggle button.
|
|
134
|
+
*/
|
|
135
|
+
trackingAttributes?: TrackingAttributes;
|
|
131
136
|
/**
|
|
132
137
|
* Additional classes to be set on the dropdown.
|
|
133
138
|
*/
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as p, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ao, useState as c, useEffect as io } from "react";
|
|
3
3
|
import po from "react-dom";
|
|
4
|
-
import { usePopper as
|
|
5
|
-
import { noop as
|
|
6
|
-
import { isNil as
|
|
4
|
+
import { usePopper as co } from "react-popper";
|
|
5
|
+
import { noop as d } from "es-toolkit/function";
|
|
6
|
+
import { isNil as fo } from "es-toolkit/predicate";
|
|
7
7
|
import P from "../../utils/classNames.js";
|
|
8
|
-
import { getOrCreatePortalRoot as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
const
|
|
8
|
+
import { getOrCreatePortalRoot as mo } from "../../utils/portalRoot.js";
|
|
9
|
+
import uo, { DEFAULT_EVENT_TYPES as go } from "../../hooks/useClickOutside.js";
|
|
10
|
+
import wo from "../menuItems/MenuItems.js";
|
|
11
|
+
import Co from "../menuItems/MenuItemList.js";
|
|
12
|
+
import bo from "./DropdownToggleButton.js";
|
|
13
|
+
import Bo from "./SplitCaretButton.js";
|
|
14
|
+
import Do from "./Caret.js";
|
|
15
|
+
const No = (r, s) => r && s ? "top-end" : !r && s ? "top-start" : r && !s ? "bottom-end" : "bottom-start", Oo = () => ao((r, s) => {
|
|
16
16
|
const {
|
|
17
17
|
id: g = Math.random().toString(36).slice(2, 16),
|
|
18
18
|
"aria-label": R,
|
|
@@ -24,102 +24,104 @@ const Do = (r, s) => r && s ? "top-end" : !r && s ? "top-start" : r && !s ? "bot
|
|
|
24
24
|
iconName: y,
|
|
25
25
|
iconOnly: B = !1,
|
|
26
26
|
title: E,
|
|
27
|
-
splitButton:
|
|
27
|
+
splitButton: t = !1,
|
|
28
28
|
customDropdown: D,
|
|
29
|
-
open:
|
|
29
|
+
open: e,
|
|
30
30
|
dropup: L = !1,
|
|
31
31
|
pullRight: f = !1,
|
|
32
32
|
noCaret: x = !1,
|
|
33
|
-
onOpen: I =
|
|
34
|
-
onClose: j =
|
|
35
|
-
onLabelButtonClick:
|
|
33
|
+
onOpen: I = d,
|
|
34
|
+
onClose: j = d,
|
|
35
|
+
onLabelButtonClick: A = d,
|
|
36
36
|
usePortal: l = !1,
|
|
37
|
-
popperConfig:
|
|
38
|
-
toggleButtonType:
|
|
37
|
+
popperConfig: U,
|
|
38
|
+
toggleButtonType: _ = "button",
|
|
39
39
|
toggleClassName: N = "",
|
|
40
|
+
trackingAttributes: v,
|
|
40
41
|
dropdownClassName: z,
|
|
41
|
-
className:
|
|
42
|
-
...
|
|
43
|
-
} = r, [O, m] = c(
|
|
44
|
-
placement:
|
|
42
|
+
className: F = "",
|
|
43
|
+
...V
|
|
44
|
+
} = r, [O, m] = c(e), [Y, q] = c(null), [S, G] = c(null), [H, J] = c(null), K = {
|
|
45
|
+
placement: No(f, L),
|
|
45
46
|
modifiers: []
|
|
46
|
-
},
|
|
47
|
+
}, Q = t && f ? H : Y, { styles: W, attributes: X } = co(Q, S, U || K), n = fo(e), a = n ? O : e, Z = uo(
|
|
47
48
|
(o) => {
|
|
48
|
-
l && S?.contains(o.target) ||
|
|
49
|
+
l && S?.contains(o.target) || i();
|
|
49
50
|
},
|
|
50
|
-
|
|
51
|
+
go,
|
|
51
52
|
!!a
|
|
52
53
|
// only listen to clicks outside when the dropdown is open
|
|
53
|
-
),
|
|
54
|
-
|
|
55
|
-
n || m(
|
|
56
|
-
}, [n,
|
|
57
|
-
const
|
|
58
|
-
(n ? O :
|
|
59
|
-
},
|
|
54
|
+
), $ = mo(), oo = !x && !t && !B;
|
|
55
|
+
io(() => {
|
|
56
|
+
n || m(e);
|
|
57
|
+
}, [n, e]);
|
|
58
|
+
const u = (o) => {
|
|
59
|
+
(n ? O : e) ? i() : to(o);
|
|
60
|
+
}, to = (o) => {
|
|
60
61
|
n && m(!0), o && I(o);
|
|
61
|
-
},
|
|
62
|
+
}, i = () => {
|
|
62
63
|
n && m(!1), j();
|
|
63
64
|
}, eo = () => {
|
|
64
|
-
|
|
65
|
-
}, to = (o) => {
|
|
66
|
-
d(o);
|
|
65
|
+
i(), A();
|
|
67
66
|
}, no = (o) => {
|
|
68
|
-
|
|
69
|
-
}, ro =
|
|
67
|
+
u(o);
|
|
68
|
+
}, ro = (o) => {
|
|
69
|
+
t ? eo() : u(o);
|
|
70
|
+
}, so = P("dropdown", "btn-group", a && "open", F), lo = P(
|
|
70
71
|
l && "dropdown-portal",
|
|
71
|
-
|
|
72
|
+
t && f && "pull-right",
|
|
72
73
|
z
|
|
73
|
-
), M = /* @__PURE__ */
|
|
74
|
-
|
|
74
|
+
), M = /* @__PURE__ */ p(
|
|
75
|
+
Co,
|
|
75
76
|
{
|
|
76
|
-
className:
|
|
77
|
-
ref:
|
|
78
|
-
style:
|
|
79
|
-
...
|
|
80
|
-
children: D || /* @__PURE__ */
|
|
77
|
+
className: lo,
|
|
78
|
+
ref: G,
|
|
79
|
+
style: W.popper,
|
|
80
|
+
...X.popper,
|
|
81
|
+
children: D || /* @__PURE__ */ p(wo, { items: T, closeMenu: u })
|
|
81
82
|
}
|
|
82
83
|
);
|
|
83
|
-
return /* @__PURE__ */ h("div", { ...
|
|
84
|
+
return /* @__PURE__ */ h("div", { ...V, className: so, ref: Z, children: [
|
|
84
85
|
/* @__PURE__ */ h(
|
|
85
|
-
|
|
86
|
+
bo,
|
|
86
87
|
{
|
|
87
88
|
id: g,
|
|
88
89
|
"aria-label": R,
|
|
89
|
-
splitButton:
|
|
90
|
+
splitButton: t,
|
|
90
91
|
bsStyle: C,
|
|
91
92
|
bsSize: w,
|
|
92
93
|
variant: k,
|
|
93
94
|
iconOnly: B,
|
|
94
95
|
iconName: y,
|
|
95
96
|
disabled: b,
|
|
96
|
-
ref:
|
|
97
|
-
onClick:
|
|
97
|
+
ref: q,
|
|
98
|
+
onClick: ro,
|
|
98
99
|
outerRef: s,
|
|
99
|
-
toggleButtonType:
|
|
100
|
+
toggleButtonType: _,
|
|
100
101
|
className: N,
|
|
102
|
+
trackingAttributes: v,
|
|
101
103
|
children: [
|
|
102
104
|
E,
|
|
103
|
-
|
|
105
|
+
oo && /* @__PURE__ */ p(Do, {})
|
|
104
106
|
]
|
|
105
107
|
}
|
|
106
108
|
),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
t && /* @__PURE__ */ p(
|
|
110
|
+
Bo,
|
|
109
111
|
{
|
|
110
112
|
id: g,
|
|
111
113
|
bsStyle: C,
|
|
112
114
|
bsSize: w,
|
|
113
115
|
disabled: b,
|
|
114
116
|
className: N,
|
|
115
|
-
onClick:
|
|
116
|
-
ref:
|
|
117
|
+
onClick: no,
|
|
118
|
+
ref: J
|
|
117
119
|
}
|
|
118
120
|
),
|
|
119
|
-
a && l && po.createPortal(M,
|
|
121
|
+
a && l && po.createPortal(M, $),
|
|
120
122
|
a && !l && M
|
|
121
123
|
] });
|
|
122
|
-
}), _o =
|
|
124
|
+
}), _o = Oo();
|
|
123
125
|
export {
|
|
124
126
|
_o as default
|
|
125
127
|
};
|