primereact 10.0.0 → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/componentbase/componentbase.cjs.js +12 -7
- package/componentbase/componentbase.cjs.min.js +1 -1
- package/componentbase/componentbase.esm.min.mjs +1 -1
- package/componentbase/componentbase.esm.mjs +12 -7
- package/componentbase/componentbase.js +12 -7
- package/componentbase/componentbase.min.js +1 -1
- package/core/core.js +12 -7
- package/core/core.min.js +1 -1
- package/package.json +1 -1
- package/primereact.all.cjs.js +12 -7
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.min.mjs +1 -1
- package/primereact.all.esm.mjs +12 -7
- package/primereact.all.js +12 -7
- package/primereact.all.min.js +1 -1
- package/web-types.json +1 -1
- package/accordion/accordion.esm.js +0 -421
- package/accordion/accordion.esm.min.js +0 -1
- package/api/api.esm.js +0 -944
- package/api/api.esm.min.js +0 -1
- package/autocomplete/autocomplete.esm.js +0 -1127
- package/autocomplete/autocomplete.esm.min.js +0 -1
- package/avatar/avatar.esm.js +0 -245
- package/avatar/avatar.esm.min.js +0 -1
- package/avatargroup/avatargroup.esm.js +0 -55
- package/avatargroup/avatargroup.esm.min.js +0 -1
- package/badge/badge.esm.js +0 -110
- package/badge/badge.esm.min.js +0 -1
- package/blockui/blockui.esm.js +0 -265
- package/blockui/blockui.esm.min.js +0 -1
- package/breadcrumb/breadcrumb.esm.js +0 -351
- package/breadcrumb/breadcrumb.esm.min.js +0 -1
- package/button/button.esm.js +0 -295
- package/button/button.esm.min.js +0 -1
- package/calendar/calendar.esm.js +0 -3473
- package/calendar/calendar.esm.min.js +0 -1
- package/card/card.esm.js +0 -98
- package/card/card.esm.min.js +0 -1
- package/carousel/carousel.esm.js +0 -801
- package/carousel/carousel.esm.min.js +0 -1
- package/cascadeselect/cascadeselect.esm.js +0 -819
- package/cascadeselect/cascadeselect.esm.min.js +0 -1
- package/chart/chart.esm.js +0 -155
- package/chart/chart.esm.min.js +0 -1
- package/checkbox/checkbox.esm.js +0 -357
- package/checkbox/checkbox.esm.min.js +0 -1
- package/chip/chip.esm.js +0 -248
- package/chip/chip.esm.min.js +0 -1
- package/chips/chips.esm.js +0 -501
- package/chips/chips.esm.min.js +0 -1
- package/colorpicker/colorpicker.esm.js +0 -788
- package/colorpicker/colorpicker.esm.min.js +0 -1
- package/column/column.esm.js +0 -8
- package/column/column.esm.min.js +0 -1
- package/columngroup/columngroup.esm.js +0 -6
- package/columngroup/columngroup.esm.min.js +0 -1
- package/componentbase/componentbase.esm.js +0 -323
- package/componentbase/componentbase.esm.min.js +0 -1
- package/confirmdialog/confirmdialog.esm.js +0 -376
- package/confirmdialog/confirmdialog.esm.min.js +0 -1
- package/confirmpopup/confirmpopup.esm.js +0 -610
- package/confirmpopup/confirmpopup.esm.min.js +0 -1
- package/contextmenu/contextmenu.esm.js +0 -664
- package/contextmenu/contextmenu.esm.min.js +0 -1
- package/csstransition/csstransition.esm.js +0 -138
- package/csstransition/csstransition.esm.min.js +0 -1
- package/datascroller/datascroller.esm.js +0 -320
- package/datascroller/datascroller.esm.min.js +0 -1
- package/datatable/datatable.esm.js +0 -6636
- package/datatable/datatable.esm.min.js +0 -1
- package/dataview/dataview.esm.js +0 -506
- package/dataview/dataview.esm.min.js +0 -1
- package/deferredcontent/deferredcontent.esm.js +0 -133
- package/deferredcontent/deferredcontent.esm.min.js +0 -1
- package/dialog/dialog.esm.js +0 -983
- package/dialog/dialog.esm.min.js +0 -1
- package/divider/divider.esm.js +0 -79
- package/divider/divider.esm.min.js +0 -1
- package/dock/dock.esm.js +0 -348
- package/dock/dock.esm.min.js +0 -1
- package/dropdown/dropdown.esm.js +0 -1380
- package/dropdown/dropdown.esm.min.js +0 -1
- package/editor/editor.esm.js +0 -338
- package/editor/editor.esm.min.js +0 -1
- package/fieldset/fieldset.esm.js +0 -270
- package/fieldset/fieldset.esm.min.js +0 -1
- package/fileupload/fileupload.esm.js +0 -1005
- package/fileupload/fileupload.esm.min.js +0 -1
- package/galleria/galleria.esm.js +0 -1090
- package/galleria/galleria.esm.min.js +0 -1
- package/hooks/hooks.esm.js +0 -1042
- package/hooks/hooks.esm.min.js +0 -1
- package/iconbase/iconbase.esm.js +0 -33
- package/iconbase/iconbase.esm.min.js +0 -1
- package/icons/angledoubledown/index.esm.js +0 -39
- package/icons/angledoubledown/index.esm.min.js +0 -1
- package/icons/angledoubleleft/index.esm.js +0 -39
- package/icons/angledoubleleft/index.esm.min.js +0 -1
- package/icons/angledoubleright/index.esm.js +0 -39
- package/icons/angledoubleright/index.esm.min.js +0 -1
- package/icons/angledoubleup/index.esm.js +0 -39
- package/icons/angledoubleup/index.esm.min.js +0 -1
- package/icons/angledown/index.esm.js +0 -37
- package/icons/angledown/index.esm.min.js +0 -1
- package/icons/angleleft/index.esm.js +0 -37
- package/icons/angleleft/index.esm.min.js +0 -1
- package/icons/angleright/index.esm.js +0 -37
- package/icons/angleright/index.esm.min.js +0 -1
- package/icons/angleup/index.esm.js +0 -37
- package/icons/angleup/index.esm.min.js +0 -1
- package/icons/arrowdown/index.esm.js +0 -661
- package/icons/arrowdown/index.esm.min.js +0 -1
- package/icons/arrowup/index.esm.js +0 -661
- package/icons/arrowup/index.esm.min.js +0 -1
- package/icons/ban/index.esm.js +0 -659
- package/icons/ban/index.esm.min.js +0 -1
- package/icons/bars/index.esm.js +0 -39
- package/icons/bars/index.esm.min.js +0 -1
- package/icons/calendar/index.esm.js +0 -37
- package/icons/calendar/index.esm.min.js +0 -1
- package/icons/check/index.esm.js +0 -37
- package/icons/check/index.esm.min.js +0 -1
- package/icons/chevrondown/index.esm.js +0 -37
- package/icons/chevrondown/index.esm.min.js +0 -1
- package/icons/chevronleft/index.esm.js +0 -37
- package/icons/chevronleft/index.esm.min.js +0 -1
- package/icons/chevronright/index.esm.js +0 -37
- package/icons/chevronright/index.esm.min.js +0 -1
- package/icons/chevronup/index.esm.js +0 -37
- package/icons/chevronup/index.esm.min.js +0 -1
- package/icons/download/index.esm.js +0 -661
- package/icons/download/index.esm.min.js +0 -1
- package/icons/exclamationtriangle/index.esm.js +0 -665
- package/icons/exclamationtriangle/index.esm.min.js +0 -1
- package/icons/eye/index.esm.js +0 -39
- package/icons/eye/index.esm.min.js +0 -1
- package/icons/eyeslash/index.esm.js +0 -661
- package/icons/eyeslash/index.esm.min.js +0 -1
- package/icons/filter/index.esm.js +0 -659
- package/icons/filter/index.esm.min.js +0 -1
- package/icons/filterslash/index.esm.js +0 -661
- package/icons/filterslash/index.esm.min.js +0 -1
- package/icons/infocircle/index.esm.js +0 -661
- package/icons/infocircle/index.esm.min.js +0 -1
- package/icons/minus/index.esm.js +0 -37
- package/icons/minus/index.esm.min.js +0 -1
- package/icons/pencil/index.esm.js +0 -659
- package/icons/pencil/index.esm.min.js +0 -1
- package/icons/plus/index.esm.js +0 -659
- package/icons/plus/index.esm.min.js +0 -1
- package/icons/refresh/index.esm.js +0 -661
- package/icons/refresh/index.esm.min.js +0 -1
- package/icons/search/index.esm.js +0 -661
- package/icons/search/index.esm.min.js +0 -1
- package/icons/searchminus/index.esm.js +0 -661
- package/icons/searchminus/index.esm.min.js +0 -1
- package/icons/searchplus/index.esm.js +0 -661
- package/icons/searchplus/index.esm.min.js +0 -1
- package/icons/sortalt/index.esm.js +0 -668
- package/icons/sortalt/index.esm.min.js +0 -1
- package/icons/sortamountdown/index.esm.js +0 -674
- package/icons/sortamountdown/index.esm.min.js +0 -1
- package/icons/sortamountupalt/index.esm.js +0 -674
- package/icons/sortamountupalt/index.esm.min.js +0 -1
- package/icons/spinner/index.esm.js +0 -659
- package/icons/spinner/index.esm.min.js +0 -1
- package/icons/star/index.esm.js +0 -659
- package/icons/star/index.esm.min.js +0 -1
- package/icons/starfill/index.esm.js +0 -659
- package/icons/starfill/index.esm.min.js +0 -1
- package/icons/thlarge/index.esm.js +0 -661
- package/icons/thlarge/index.esm.min.js +0 -1
- package/icons/times/index.esm.js +0 -37
- package/icons/times/index.esm.min.js +0 -1
- package/icons/timescircle/index.esm.js +0 -661
- package/icons/timescircle/index.esm.min.js +0 -1
- package/icons/trash/index.esm.js +0 -661
- package/icons/trash/index.esm.min.js +0 -1
- package/icons/undo/index.esm.js +0 -661
- package/icons/undo/index.esm.min.js +0 -1
- package/icons/upload/index.esm.js +0 -661
- package/icons/upload/index.esm.min.js +0 -1
- package/icons/windowmaximize/index.esm.js +0 -661
- package/icons/windowmaximize/index.esm.min.js +0 -1
- package/icons/windowminimize/index.esm.js +0 -661
- package/icons/windowminimize/index.esm.min.js +0 -1
- package/image/image.esm.js +0 -1162
- package/image/image.esm.min.js +0 -1
- package/inplace/inplace.esm.js +0 -243
- package/inplace/inplace.esm.min.js +0 -1
- package/inputmask/inputmask.esm.js +0 -560
- package/inputmask/inputmask.esm.min.js +0 -1
- package/inputnumber/inputnumber.esm.js +0 -1209
- package/inputnumber/inputnumber.esm.min.js +0 -1
- package/inputswitch/inputswitch.esm.js +0 -291
- package/inputswitch/inputswitch.esm.min.js +0 -1
- package/inputtext/inputtext.esm.js +0 -171
- package/inputtext/inputtext.esm.min.js +0 -1
- package/inputtextarea/inputtextarea.esm.js +0 -220
- package/inputtextarea/inputtextarea.esm.min.js +0 -1
- package/keyfilter/keyfilter.esm.js +0 -108
- package/keyfilter/keyfilter.esm.min.js +0 -1
- package/knob/knob.esm.js +0 -318
- package/knob/knob.esm.min.js +0 -1
- package/listbox/listbox.esm.js +0 -810
- package/listbox/listbox.esm.min.js +0 -1
- package/megamenu/megamenu.esm.js +0 -716
- package/megamenu/megamenu.esm.min.js +0 -1
- package/mention/mention.esm.js +0 -771
- package/mention/mention.esm.min.js +0 -1
- package/menu/menu.esm.js +0 -485
- package/menu/menu.esm.min.js +0 -1
- package/menubar/menubar.esm.js +0 -584
- package/menubar/menubar.esm.min.js +0 -1
- package/message/message.esm.js +0 -169
- package/message/message.esm.min.js +0 -1
- package/messages/messages.esm.js +0 -439
- package/messages/messages.esm.min.js +0 -1
- package/multiselect/multiselect.esm.js +0 -1724
- package/multiselect/multiselect.esm.min.js +0 -1
- package/multistatecheckbox/multistatecheckbox.esm.js +0 -352
- package/multistatecheckbox/multistatecheckbox.esm.min.js +0 -1
- package/orderlist/orderlist.esm.js +0 -816
- package/orderlist/orderlist.esm.min.js +0 -1
- package/organizationchart/organizationchart.esm.js +0 -480
- package/organizationchart/organizationchart.esm.min.js +0 -1
- package/overlaypanel/overlaypanel.esm.js +0 -516
- package/overlaypanel/overlaypanel.esm.min.js +0 -1
- package/overlayservice/overlayservice.esm.js +0 -7
- package/overlayservice/overlayservice.esm.min.js +0 -1
- package/paginator/paginator.esm.js +0 -933
- package/paginator/paginator.esm.min.js +0 -1
- package/panel/panel.esm.js +0 -316
- package/panel/panel.esm.min.js +0 -1
- package/panelmenu/panelmenu.esm.js +0 -645
- package/panelmenu/panelmenu.esm.min.js +0 -1
- package/passthrough/index.esm.js +0 -71
- package/passthrough/index.esm.min.js +0 -1
- package/passthrough/tailwind/index.esm.js +0 -3509
- package/passthrough/tailwind/index.esm.min.js +0 -1
- package/password/password.esm.js +0 -567
- package/password/password.esm.min.js +0 -1
- package/picklist/picklist.esm.js +0 -1119
- package/picklist/picklist.esm.min.js +0 -1
- package/portal/portal.esm.js +0 -110
- package/portal/portal.esm.min.js +0 -1
- package/primereact.all.esm.js +0 -51646
- package/primereact.all.esm.min.js +0 -1
- package/progressbar/progressbar.esm.js +0 -190
- package/progressbar/progressbar.esm.min.js +0 -1
- package/progressspinner/progressspinner.esm.js +0 -88
- package/progressspinner/progressspinner.esm.min.js +0 -1
- package/radiobutton/radiobutton.esm.js +0 -329
- package/radiobutton/radiobutton.esm.min.js +0 -1
- package/rating/rating.esm.js +0 -273
- package/rating/rating.esm.min.js +0 -1
- package/ripple/ripple.esm.js +0 -100
- package/ripple/ripple.esm.min.js +0 -1
- package/row/row.esm.js +0 -36
- package/row/row.esm.min.js +0 -1
- package/scrollpanel/scrollpanel.esm.js +0 -210
- package/scrollpanel/scrollpanel.esm.min.js +0 -1
- package/scrolltop/scrolltop.esm.js +0 -269
- package/scrolltop/scrolltop.esm.min.js +0 -1
- package/selectbutton/selectbutton.esm.js +0 -327
- package/selectbutton/selectbutton.esm.min.js +0 -1
- package/sidebar/sidebar.esm.js +0 -543
- package/sidebar/sidebar.esm.min.js +0 -1
- package/skeleton/skeleton.esm.js +0 -125
- package/skeleton/skeleton.esm.min.js +0 -1
- package/slidemenu/slidemenu.esm.js +0 -689
- package/slidemenu/slidemenu.esm.min.js +0 -1
- package/slider/slider.esm.js +0 -478
- package/slider/slider.esm.min.js +0 -1
- package/speeddial/speeddial.esm.js +0 -521
- package/speeddial/speeddial.esm.min.js +0 -1
- package/splitbutton/splitbutton.esm.js +0 -545
- package/splitbutton/splitbutton.esm.min.js +0 -1
- package/splitter/splitter.esm.js +0 -466
- package/splitter/splitter.esm.min.js +0 -1
- package/steps/steps.esm.js +0 -294
- package/steps/steps.esm.min.js +0 -1
- package/styleclass/styleclass.esm.js +0 -269
- package/styleclass/styleclass.esm.min.js +0 -1
- package/tabmenu/tabmenu.esm.js +0 -332
- package/tabmenu/tabmenu.esm.min.js +0 -1
- package/tabview/tabview.esm.js +0 -678
- package/tabview/tabview.esm.min.js +0 -1
- package/tag/tag.esm.js +0 -117
- package/tag/tag.esm.min.js +0 -1
- package/terminal/terminal.esm.js +0 -280
- package/terminal/terminal.esm.min.js +0 -1
- package/terminalservice/terminalservice.esm.js +0 -7
- package/terminalservice/terminalservice.esm.min.js +0 -1
- package/tieredmenu/tieredmenu.esm.js +0 -699
- package/tieredmenu/tieredmenu.esm.min.js +0 -1
- package/timeline/timeline.esm.js +0 -164
- package/timeline/timeline.esm.min.js +0 -1
- package/toast/toast.esm.js +0 -739
- package/toast/toast.esm.min.js +0 -1
- package/togglebutton/togglebutton.esm.js +0 -217
- package/togglebutton/togglebutton.esm.min.js +0 -1
- package/toolbar/toolbar.esm.js +0 -79
- package/toolbar/toolbar.esm.min.js +0 -1
- package/tooltip/tooltip.esm.js +0 -696
- package/tooltip/tooltip.esm.min.js +0 -1
- package/tree/tree.esm.js +0 -1403
- package/tree/tree.esm.min.js +0 -1
- package/treeselect/treeselect.esm.js +0 -930
- package/treeselect/treeselect.esm.min.js +0 -1
- package/treetable/treetable.esm.js +0 -3094
- package/treetable/treetable.esm.min.js +0 -1
- package/tristatecheckbox/tristatecheckbox.esm.js +0 -292
- package/tristatecheckbox/tristatecheckbox.esm.min.js +0 -1
- package/utils/utils.esm.js +0 -2383
- package/utils/utils.esm.min.js +0 -1
- package/virtualscroller/virtualscroller.esm.js +0 -972
- package/virtualscroller/virtualscroller.esm.min.js +0 -1
package/web-types.json
CHANGED
|
@@ -1,421 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { PrimeReactContext, ariaLabel } from 'primereact/api';
|
|
5
|
-
import { CSSTransition } from 'primereact/csstransition';
|
|
6
|
-
import { useMountEffect } from 'primereact/hooks';
|
|
7
|
-
import { ObjectUtils, classNames, UniqueComponentId, mergeProps, IconUtils } from 'primereact/utils';
|
|
8
|
-
import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
|
|
9
|
-
import { ChevronRightIcon } from 'primereact/icons/chevronright';
|
|
10
|
-
import { ChevronDownIcon } from 'primereact/icons/chevrondown';
|
|
11
|
-
|
|
12
|
-
function _extends() {
|
|
13
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
14
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
15
|
-
var source = arguments[i];
|
|
16
|
-
for (var key in source) {
|
|
17
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
18
|
-
target[key] = source[key];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return target;
|
|
23
|
-
};
|
|
24
|
-
return _extends.apply(this, arguments);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function _arrayLikeToArray(arr, len) {
|
|
28
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
29
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
30
|
-
return arr2;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function _arrayWithoutHoles(arr) {
|
|
34
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function _iterableToArray(iter) {
|
|
38
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
42
|
-
if (!o) return;
|
|
43
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
44
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
45
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
46
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
47
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function _nonIterableSpread() {
|
|
51
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function _toConsumableArray(arr) {
|
|
55
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function _typeof(o) {
|
|
59
|
-
"@babel/helpers - typeof";
|
|
60
|
-
|
|
61
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
62
|
-
return typeof o;
|
|
63
|
-
} : function (o) {
|
|
64
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
65
|
-
}, _typeof(o);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function _toPrimitive(input, hint) {
|
|
69
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
70
|
-
var prim = input[Symbol.toPrimitive];
|
|
71
|
-
if (prim !== undefined) {
|
|
72
|
-
var res = prim.call(input, hint || "default");
|
|
73
|
-
if (_typeof(res) !== "object") return res;
|
|
74
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
75
|
-
}
|
|
76
|
-
return (hint === "string" ? String : Number)(input);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function _toPropertyKey(arg) {
|
|
80
|
-
var key = _toPrimitive(arg, "string");
|
|
81
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function _defineProperty(obj, key, value) {
|
|
85
|
-
key = _toPropertyKey(key);
|
|
86
|
-
if (key in obj) {
|
|
87
|
-
Object.defineProperty(obj, key, {
|
|
88
|
-
value: value,
|
|
89
|
-
enumerable: true,
|
|
90
|
-
configurable: true,
|
|
91
|
-
writable: true
|
|
92
|
-
});
|
|
93
|
-
} else {
|
|
94
|
-
obj[key] = value;
|
|
95
|
-
}
|
|
96
|
-
return obj;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function _arrayWithHoles(arr) {
|
|
100
|
-
if (Array.isArray(arr)) return arr;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function _iterableToArrayLimit(r, l) {
|
|
104
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
105
|
-
if (null != t) {
|
|
106
|
-
var e,
|
|
107
|
-
n,
|
|
108
|
-
i,
|
|
109
|
-
u,
|
|
110
|
-
a = [],
|
|
111
|
-
f = !0,
|
|
112
|
-
o = !1;
|
|
113
|
-
try {
|
|
114
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
115
|
-
if (Object(t) !== t) return;
|
|
116
|
-
f = !1;
|
|
117
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
118
|
-
} catch (r) {
|
|
119
|
-
o = !0, n = r;
|
|
120
|
-
} finally {
|
|
121
|
-
try {
|
|
122
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
123
|
-
} finally {
|
|
124
|
-
if (o) throw n;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return a;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function _nonIterableRest() {
|
|
132
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function _slicedToArray(arr, i) {
|
|
136
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
var classes = {
|
|
140
|
-
root: 'p-accordion p-component',
|
|
141
|
-
tab: {
|
|
142
|
-
root: function root(_ref) {
|
|
143
|
-
var selected = _ref.selected;
|
|
144
|
-
return classNames('p-accordion-tab', {
|
|
145
|
-
'p-accordion-tab-active': selected
|
|
146
|
-
});
|
|
147
|
-
},
|
|
148
|
-
content: 'p-accordion-content',
|
|
149
|
-
header: function header(_ref2) {
|
|
150
|
-
var selected = _ref2.selected,
|
|
151
|
-
getTabProp = _ref2.getTabProp,
|
|
152
|
-
tab = _ref2.tab;
|
|
153
|
-
return classNames('p-accordion-header', {
|
|
154
|
-
'p-highlight': selected,
|
|
155
|
-
'p-disabled': getTabProp(tab, 'disabled')
|
|
156
|
-
});
|
|
157
|
-
},
|
|
158
|
-
headeraction: 'p-accordion-header-link',
|
|
159
|
-
headericon: 'p-accordion-toggle-icon',
|
|
160
|
-
headertitle: 'p-accordion-header-text',
|
|
161
|
-
toggleablecontent: 'p-toggleable-content',
|
|
162
|
-
transition: 'p-toggleable-content'
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
var styles = "\n@layer primereact {\n .p-accordion-header-link {\n cursor: pointer;\n display: flex;\n align-items: center;\n user-select: none;\n position: relative;\n text-decoration: none;\n }\n \n .p-accordion-header-link:focus {\n z-index: 1;\n }\n \n .p-accordion-header-text {\n line-height: 1;\n }\n}\n";
|
|
166
|
-
var AccordionBase = ComponentBase.extend({
|
|
167
|
-
defaultProps: {
|
|
168
|
-
__TYPE: 'Accordion',
|
|
169
|
-
id: null,
|
|
170
|
-
activeIndex: null,
|
|
171
|
-
className: null,
|
|
172
|
-
style: null,
|
|
173
|
-
multiple: false,
|
|
174
|
-
expandIcon: null,
|
|
175
|
-
collapseIcon: null,
|
|
176
|
-
transitionOptions: null,
|
|
177
|
-
onTabOpen: null,
|
|
178
|
-
onTabClose: null,
|
|
179
|
-
onTabChange: null,
|
|
180
|
-
children: undefined
|
|
181
|
-
},
|
|
182
|
-
css: {
|
|
183
|
-
classes: classes,
|
|
184
|
-
styles: styles
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
var AccordionTabBase = ComponentBase.extend({
|
|
188
|
-
defaultProps: {
|
|
189
|
-
__TYPE: 'AccordionTab',
|
|
190
|
-
className: null,
|
|
191
|
-
contentClassName: null,
|
|
192
|
-
contentStyle: null,
|
|
193
|
-
disabled: false,
|
|
194
|
-
header: null,
|
|
195
|
-
headerClassName: null,
|
|
196
|
-
headerStyle: null,
|
|
197
|
-
headerTemplate: null,
|
|
198
|
-
style: null,
|
|
199
|
-
tabIndex: 0,
|
|
200
|
-
children: undefined
|
|
201
|
-
},
|
|
202
|
-
getCProp: function getCProp(tab, name) {
|
|
203
|
-
return ObjectUtils.getComponentProp(tab, name, AccordionTabBase.defaultProps);
|
|
204
|
-
},
|
|
205
|
-
getCProps: function getCProps(tab) {
|
|
206
|
-
return ObjectUtils.getComponentProps(tab, AccordionTabBase.defaultProps);
|
|
207
|
-
},
|
|
208
|
-
getCOtherProps: function getCOtherProps(tab) {
|
|
209
|
-
return ObjectUtils.getComponentDiffProps(tab, AccordionTabBase.defaultProps);
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
214
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
215
|
-
var AccordionTab = function AccordionTab() {};
|
|
216
|
-
var Accordion = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
217
|
-
var context = React.useContext(PrimeReactContext);
|
|
218
|
-
var props = AccordionBase.getProps(inProps, context);
|
|
219
|
-
var _React$useState = React.useState(props.id),
|
|
220
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
221
|
-
idState = _React$useState2[0],
|
|
222
|
-
setIdState = _React$useState2[1];
|
|
223
|
-
var _React$useState3 = React.useState(props.activeIndex),
|
|
224
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
225
|
-
activeIndexState = _React$useState4[0],
|
|
226
|
-
setActiveIndexState = _React$useState4[1];
|
|
227
|
-
var elementRef = React.useRef(null);
|
|
228
|
-
var activeIndex = props.onTabChange ? props.activeIndex : activeIndexState;
|
|
229
|
-
var count = React.Children.count(props.children);
|
|
230
|
-
var metaData = {
|
|
231
|
-
props: props,
|
|
232
|
-
state: {
|
|
233
|
-
id: idState,
|
|
234
|
-
activeIndex: activeIndexState
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
var _AccordionBase$setMet = AccordionBase.setMetaData(_objectSpread({}, metaData)),
|
|
238
|
-
ptm = _AccordionBase$setMet.ptm,
|
|
239
|
-
ptmo = _AccordionBase$setMet.ptmo,
|
|
240
|
-
cx = _AccordionBase$setMet.cx;
|
|
241
|
-
_AccordionBase$setMet.sx;
|
|
242
|
-
var isUnstyled = _AccordionBase$setMet.isUnstyled;
|
|
243
|
-
useHandleStyle(AccordionBase.css.styles, isUnstyled, {
|
|
244
|
-
name: 'accordion'
|
|
245
|
-
});
|
|
246
|
-
var getTabPT = function getTabPT(tab, key, index) {
|
|
247
|
-
AccordionTabBase.getCProps(tab);
|
|
248
|
-
var tabMetaData = {
|
|
249
|
-
// props: atProps, /* @todo */
|
|
250
|
-
parent: metaData,
|
|
251
|
-
context: {
|
|
252
|
-
index: index,
|
|
253
|
-
count: count,
|
|
254
|
-
first: index === 0,
|
|
255
|
-
last: index === count - 1,
|
|
256
|
-
selected: isSelected(index),
|
|
257
|
-
disabled: getTabProp(tab, 'disabled')
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
return mergeProps(ptm("accordiontab.".concat(key), {
|
|
261
|
-
accordiontab: tabMetaData
|
|
262
|
-
}), ptm("accordiontab.".concat(key), tabMetaData), ptmo(tab.props, key, tabMetaData));
|
|
263
|
-
};
|
|
264
|
-
var getTabProp = function getTabProp(tab, name) {
|
|
265
|
-
return AccordionTabBase.getCProp(tab, name);
|
|
266
|
-
};
|
|
267
|
-
var onTabHeaderClick = function onTabHeaderClick(event, tab, index) {
|
|
268
|
-
if (!getTabProp(tab, 'disabled')) {
|
|
269
|
-
var selected = isSelected(index);
|
|
270
|
-
var newActiveIndex = null;
|
|
271
|
-
if (props.multiple) {
|
|
272
|
-
var indexes = activeIndex || [];
|
|
273
|
-
newActiveIndex = selected ? indexes.filter(function (i) {
|
|
274
|
-
return i !== index;
|
|
275
|
-
}) : [].concat(_toConsumableArray(indexes), [index]);
|
|
276
|
-
} else {
|
|
277
|
-
newActiveIndex = selected ? null : index;
|
|
278
|
-
}
|
|
279
|
-
var callback = selected ? props.onTabClose : props.onTabOpen;
|
|
280
|
-
callback && callback({
|
|
281
|
-
originalEvent: event,
|
|
282
|
-
index: index
|
|
283
|
-
});
|
|
284
|
-
if (props.onTabChange) {
|
|
285
|
-
props.onTabChange({
|
|
286
|
-
originalEvent: event,
|
|
287
|
-
index: newActiveIndex
|
|
288
|
-
});
|
|
289
|
-
} else {
|
|
290
|
-
setActiveIndexState(newActiveIndex);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
event.preventDefault();
|
|
294
|
-
};
|
|
295
|
-
var isSelected = function isSelected(index) {
|
|
296
|
-
return props.multiple ? activeIndex && activeIndex.some(function (i) {
|
|
297
|
-
return i === index;
|
|
298
|
-
}) : activeIndex === index;
|
|
299
|
-
};
|
|
300
|
-
React.useImperativeHandle(ref, function () {
|
|
301
|
-
return {
|
|
302
|
-
props: props,
|
|
303
|
-
getElement: function getElement() {
|
|
304
|
-
return elementRef.current;
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
});
|
|
308
|
-
useMountEffect(function () {
|
|
309
|
-
if (!idState) {
|
|
310
|
-
setIdState(UniqueComponentId());
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
|
-
if (!idState) {
|
|
314
|
-
return null;
|
|
315
|
-
}
|
|
316
|
-
var createTabHeader = function createTabHeader(tab, selected, index) {
|
|
317
|
-
var style = _objectSpread(_objectSpread({}, getTabProp(tab, 'style') || {}), getTabProp(tab, 'headerStyle') || {});
|
|
318
|
-
var headerId = idState + '_header_' + index;
|
|
319
|
-
var ariaControls = idState + '_content_' + index;
|
|
320
|
-
var tabIndex = getTabProp(tab, 'disabled') ? -1 : getTabProp(tab, 'tabIndex');
|
|
321
|
-
var headerTitleProps = mergeProps({
|
|
322
|
-
className: cx('tab.headertitle')
|
|
323
|
-
}, getTabPT(tab, 'headertitle', index));
|
|
324
|
-
var header = getTabProp(tab, 'headerTemplate') ? ObjectUtils.getJSXElement(getTabProp(tab, 'headerTemplate'), AccordionTabBase.getCProps(tab)) : /*#__PURE__*/React.createElement("span", headerTitleProps, getTabProp(tab, 'header'));
|
|
325
|
-
var headerIconProps = mergeProps({
|
|
326
|
-
className: cx('tab.headericon')
|
|
327
|
-
}, getTabPT(tab, 'headericon', index));
|
|
328
|
-
var icon = selected ? props.collapseIcon || /*#__PURE__*/React.createElement(ChevronDownIcon, headerIconProps) : props.expandIcon || /*#__PURE__*/React.createElement(ChevronRightIcon, headerIconProps);
|
|
329
|
-
var toggleIcon = IconUtils.getJSXIcon(icon, _objectSpread({}, headerIconProps), {
|
|
330
|
-
props: props,
|
|
331
|
-
selected: selected
|
|
332
|
-
});
|
|
333
|
-
var label = selected ? ariaLabel('collapseLabel') : ariaLabel('expandLabel');
|
|
334
|
-
var headerProps = mergeProps({
|
|
335
|
-
className: classNames(getTabProp(tab, 'headerClassName'), getTabProp(tab, 'className'), cx('tab.header', {
|
|
336
|
-
selected: selected,
|
|
337
|
-
getTabProp: getTabProp,
|
|
338
|
-
tab: tab
|
|
339
|
-
})),
|
|
340
|
-
style: style,
|
|
341
|
-
'data-p-highlight': selected,
|
|
342
|
-
'data-p-disabled': getTabProp(tab, 'disabled')
|
|
343
|
-
}, getTabPT(tab, 'header', index));
|
|
344
|
-
var headerActionProps = mergeProps({
|
|
345
|
-
id: headerId,
|
|
346
|
-
href: '#' + ariaControls,
|
|
347
|
-
className: cx('tab.headeraction'),
|
|
348
|
-
role: 'tab',
|
|
349
|
-
tabIndex: tabIndex,
|
|
350
|
-
onClick: function onClick(e) {
|
|
351
|
-
return onTabHeaderClick(e, tab, index);
|
|
352
|
-
},
|
|
353
|
-
'aria-label': label,
|
|
354
|
-
'aria-controls': ariaControls,
|
|
355
|
-
'aria-expanded': selected
|
|
356
|
-
}, getTabPT(tab, 'headeraction', index));
|
|
357
|
-
return /*#__PURE__*/React.createElement("div", headerProps, /*#__PURE__*/React.createElement("a", headerActionProps, toggleIcon, header));
|
|
358
|
-
};
|
|
359
|
-
var createTabContent = function createTabContent(tab, selected, index) {
|
|
360
|
-
var style = _objectSpread(_objectSpread({}, getTabProp(tab, 'style') || {}), getTabProp(tab, 'contentStyle') || {});
|
|
361
|
-
var contentId = idState + '_content_' + index;
|
|
362
|
-
var ariaLabelledby = idState + '_header_' + index;
|
|
363
|
-
var contentRef = /*#__PURE__*/React.createRef();
|
|
364
|
-
var toggleableContentProps = mergeProps({
|
|
365
|
-
id: contentId,
|
|
366
|
-
ref: contentRef,
|
|
367
|
-
className: classNames(getTabProp(tab, 'contentClassName'), getTabProp(tab, 'className'), cx('tab.toggleablecontent')),
|
|
368
|
-
style: style,
|
|
369
|
-
role: 'region',
|
|
370
|
-
'aria-labelledby': ariaLabelledby
|
|
371
|
-
}, getTabPT(tab, 'toggleablecontent', index));
|
|
372
|
-
var contentProps = mergeProps({
|
|
373
|
-
className: cx('tab.content')
|
|
374
|
-
}, getTabPT(tab, 'content', index));
|
|
375
|
-
var transitionProps = mergeProps({
|
|
376
|
-
classNames: cx('tab.transition'),
|
|
377
|
-
timeout: {
|
|
378
|
-
enter: 1000,
|
|
379
|
-
exit: 450
|
|
380
|
-
},
|
|
381
|
-
"in": selected,
|
|
382
|
-
unmountOnExit: true,
|
|
383
|
-
options: props.transitionOptions
|
|
384
|
-
}, getTabPT(tab, 'transition', index));
|
|
385
|
-
return /*#__PURE__*/React.createElement(CSSTransition, _extends({
|
|
386
|
-
nodeRef: contentRef
|
|
387
|
-
}, transitionProps), /*#__PURE__*/React.createElement("div", toggleableContentProps, /*#__PURE__*/React.createElement("div", contentProps, getTabProp(tab, 'children'))));
|
|
388
|
-
};
|
|
389
|
-
var createTab = function createTab(tab, index) {
|
|
390
|
-
if (ObjectUtils.isValidChild(tab, 'AccordionTab')) {
|
|
391
|
-
var key = idState + '_' + index;
|
|
392
|
-
var selected = isSelected(index);
|
|
393
|
-
var tabHeader = createTabHeader(tab, selected, index);
|
|
394
|
-
var tabContent = createTabContent(tab, selected, index);
|
|
395
|
-
var _rootProps = mergeProps({
|
|
396
|
-
key: key,
|
|
397
|
-
className: cx('tab.root', {
|
|
398
|
-
selected: selected
|
|
399
|
-
})
|
|
400
|
-
}, AccordionTabBase.getCOtherProps(tab), getTabPT(tab, 'root', index));
|
|
401
|
-
return /*#__PURE__*/React.createElement("div", _rootProps, tabHeader, tabContent);
|
|
402
|
-
}
|
|
403
|
-
return null;
|
|
404
|
-
};
|
|
405
|
-
var createTabs = function createTabs() {
|
|
406
|
-
return React.Children.map(props.children, createTab);
|
|
407
|
-
};
|
|
408
|
-
var tabs = createTabs();
|
|
409
|
-
var rootProps = mergeProps({
|
|
410
|
-
className: classNames(props.className, cx('root')),
|
|
411
|
-
style: props.style
|
|
412
|
-
}, AccordionBase.getOtherProps(props), ptm('root'));
|
|
413
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
414
|
-
id: idState,
|
|
415
|
-
ref: elementRef
|
|
416
|
-
}, rootProps), tabs);
|
|
417
|
-
});
|
|
418
|
-
AccordionTab.displayName = 'AccordionTab';
|
|
419
|
-
Accordion.displayName = 'Accordion';
|
|
420
|
-
|
|
421
|
-
export { Accordion, AccordionTab };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"react";import{PrimeReactContext as t,ariaLabel as n}from"primereact/api";import{CSSTransition as r}from"primereact/csstransition";import{useMountEffect as o}from"primereact/hooks";import{ObjectUtils as a,classNames as i,UniqueComponentId as l,mergeProps as c,IconUtils as s}from"primereact/utils";import{ComponentBase as u,useHandleStyle as d}from"primereact/componentbase";import{ChevronRightIcon as p}from"primereact/icons/chevronright";import{ChevronDownIcon as f}from"primereact/icons/chevrondown";function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m.apply(this,arguments)}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e){if(Array.isArray(e))return b(e)}function h(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function g(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}function v(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function O(e){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},O(e)}function P(e,t){if("object"!==O(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==O(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function x(e){var t=P(e,"string");return"symbol"===O(t)?t:String(t)}function C(e){if(Array.isArray(e))return e}function S(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,l=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}function j(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(e,t){return C(e)||S(e,t)||g(e,t)||j()}var N=u.extend({defaultProps:{__TYPE:"Accordion",id:null,activeIndex:null,className:null,style:null,multiple:!1,expandIcon:null,collapseIcon:null,transitionOptions:null,onTabOpen:null,onTabClose:null,onTabChange:null,children:void 0},css:{classes:{root:"p-accordion p-component",tab:{root:function(e){return i("p-accordion-tab",{"p-accordion-tab-active":e.selected})},content:"p-accordion-content",header:function(e){return i("p-accordion-header",{"p-highlight":e.selected,"p-disabled":(0,e.getTabProp)(e.tab,"disabled")})},headeraction:"p-accordion-header-link",headericon:"p-accordion-toggle-icon",headertitle:"p-accordion-header-text",toggleablecontent:"p-toggleable-content",transition:"p-toggleable-content"}},styles:"\n@layer primereact {\n .p-accordion-header-link {\n cursor: pointer;\n display: flex;\n align-items: center;\n user-select: none;\n position: relative;\n text-decoration: none;\n }\n \n .p-accordion-header-link:focus {\n z-index: 1;\n }\n \n .p-accordion-header-text {\n line-height: 1;\n }\n}\n"}}),T=u.extend({defaultProps:{__TYPE:"AccordionTab",className:null,contentClassName:null,contentStyle:null,disabled:!1,header:null,headerClassName:null,headerStyle:null,headerTemplate:null,style:null,tabIndex:0,children:void 0},getCProp:function(e,t){return a.getComponentProp(e,t,T.defaultProps)},getCProps:function(e){return a.getComponentProps(e,T.defaultProps)},getCOtherProps:function(e){return a.getComponentDiffProps(e,T.defaultProps)}});function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function I(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){var r,o,a;r=e,a=n[t],(o=x(o=t))in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var A=function(){},_=e.forwardRef((function(u,b){var O=e.useContext(t),P=N.getProps(u,O),x=E(e.useState(P.id),2),C=x[0],S=x[1],j=E(e.useState(P.activeIndex),2),w=j[0],A=j[1],_=e.useRef(null),k=P.onTabChange?P.activeIndex:w,D=e.Children.count(P.children),R={props:P,state:{id:C,activeIndex:w}},J=N.setMetaData(I({},R)),L=J.ptm,M=J.ptmo,U=J.cx;d(N.css.styles,J.isUnstyled,{name:"accordion"});var X=function(e,t,n){T.getCProps(e);var r={parent:R,context:{index:n,count:D,first:0===n,last:n===D-1,selected:H(n),disabled:Y(e,"disabled")}};return c(L("accordiontab.".concat(t),{accordiontab:r}),L("accordiontab.".concat(t),r),M(e.props,t,r))},Y=function(e,t){return T.getCProp(e,t)},z=function(e,t,n){if(!Y(t,"disabled")){var r=H(n),o=null;if(P.multiple){var a=k||[];o=r?a.filter((function(e){return e!==n})):[].concat(y(l=a)||h(l)||g(l)||v(),[n])}else o=r?null:n;var i=r?P.onTabClose:P.onTabOpen;i&&i({originalEvent:e,index:n}),P.onTabChange?P.onTabChange({originalEvent:e,index:o}):A(o)}var l;e.preventDefault()},H=function(e){return P.multiple?k&&k.some((function(t){return t===e})):k===e};if(e.useImperativeHandle(b,(function(){return{props:P,getElement:function(){return _.current}}})),o((function(){C||S(l())})),!C)return null;var V=function(t,r,o){var l=I(I({},Y(t,"style")||{}),Y(t,"headerStyle")||{}),u=C+"_header_"+o,d=C+"_content_"+o,m=Y(t,"disabled")?-1:Y(t,"tabIndex"),b=c({className:U("tab.headertitle")},X(t,"headertitle",o)),y=Y(t,"headerTemplate")?a.getJSXElement(Y(t,"headerTemplate"),T.getCProps(t)):e.createElement("span",b,Y(t,"header")),h=c({className:U("tab.headericon")},X(t,"headericon",o)),g=s.getJSXIcon(r?P.collapseIcon||e.createElement(f,h):P.expandIcon||e.createElement(p,h),I({},h),{props:P,selected:r}),v=n(r?"collapseLabel":"expandLabel"),O=c({className:i(Y(t,"headerClassName"),Y(t,"className"),U("tab.header",{selected:r,getTabProp:Y,tab:t})),style:l,"data-p-highlight":r,"data-p-disabled":Y(t,"disabled")},X(t,"header",o)),x=c({id:u,href:"#"+d,className:U("tab.headeraction"),role:"tab",tabIndex:m,onClick:function(e){return z(e,t,o)},"aria-label":v,"aria-controls":d,"aria-expanded":r},X(t,"headeraction",o));return e.createElement("div",O,e.createElement("a",x,g,y))},$=function(t,n,o){var a=I(I({},Y(t,"style")||{}),Y(t,"contentStyle")||{}),l=C+"_content_"+o,s=C+"_header_"+o,u=e.createRef(),d=c({id:l,ref:u,className:i(Y(t,"contentClassName"),Y(t,"className"),U("tab.toggleablecontent")),style:a,role:"region","aria-labelledby":s},X(t,"toggleablecontent",o)),p=c({className:U("tab.content")},X(t,"content",o)),f=c({classNames:U("tab.transition"),timeout:{enter:1e3,exit:450},in:n,unmountOnExit:!0,options:P.transitionOptions},X(t,"transition",o));return e.createElement(r,m({nodeRef:u},f),e.createElement("div",d,e.createElement("div",p,Y(t,"children"))))},q=e.Children.map(P.children,(function(t,n){if(a.isValidChild(t,"AccordionTab")){var r=C+"_"+n,o=H(n),i=V(t,o,n),l=$(t,o,n),s=c({key:r,className:U("tab.root",{selected:o})},T.getCOtherProps(t),X(t,"root",n));return e.createElement("div",s,i,l)}return null})),B=c({className:i(P.className,U("root")),style:P.style},N.getOtherProps(P),L("root"));return e.createElement("div",m({id:C,ref:_},B),q)}));A.displayName="AccordionTab",_.displayName="Accordion";export{_ as Accordion,A as AccordionTab};
|