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/chips/chips.esm.js
DELETED
|
@@ -1,501 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { PrimeReactContext } from 'primereact/api';
|
|
5
|
-
import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
|
|
6
|
-
import { useMountEffect } from 'primereact/hooks';
|
|
7
|
-
import { TimesCircleIcon } from 'primereact/icons/timescircle';
|
|
8
|
-
import { KeyFilter } from 'primereact/keyfilter';
|
|
9
|
-
import { Tooltip } from 'primereact/tooltip';
|
|
10
|
-
import { classNames, ObjectUtils, DomHandler, mergeProps, IconUtils } from 'primereact/utils';
|
|
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 _typeof(o) {
|
|
28
|
-
"@babel/helpers - typeof";
|
|
29
|
-
|
|
30
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
31
|
-
return typeof o;
|
|
32
|
-
} : function (o) {
|
|
33
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
34
|
-
}, _typeof(o);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function _toPrimitive(input, hint) {
|
|
38
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
39
|
-
var prim = input[Symbol.toPrimitive];
|
|
40
|
-
if (prim !== undefined) {
|
|
41
|
-
var res = prim.call(input, hint || "default");
|
|
42
|
-
if (_typeof(res) !== "object") return res;
|
|
43
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
44
|
-
}
|
|
45
|
-
return (hint === "string" ? String : Number)(input);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function _toPropertyKey(arg) {
|
|
49
|
-
var key = _toPrimitive(arg, "string");
|
|
50
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function _defineProperty(obj, key, value) {
|
|
54
|
-
key = _toPropertyKey(key);
|
|
55
|
-
if (key in obj) {
|
|
56
|
-
Object.defineProperty(obj, key, {
|
|
57
|
-
value: value,
|
|
58
|
-
enumerable: true,
|
|
59
|
-
configurable: true,
|
|
60
|
-
writable: true
|
|
61
|
-
});
|
|
62
|
-
} else {
|
|
63
|
-
obj[key] = value;
|
|
64
|
-
}
|
|
65
|
-
return obj;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function _arrayLikeToArray(arr, len) {
|
|
69
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
70
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
71
|
-
return arr2;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function _arrayWithoutHoles(arr) {
|
|
75
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function _iterableToArray(iter) {
|
|
79
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
83
|
-
if (!o) return;
|
|
84
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
85
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
86
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
87
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
88
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function _nonIterableSpread() {
|
|
92
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function _toConsumableArray(arr) {
|
|
96
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
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 styles = "\n@layer primereact {\n .p-chips {\n display: inline-flex;\n }\n \n .p-chips-multiple-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n cursor: text;\n overflow: hidden;\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n }\n \n .p-chips-token {\n cursor: default;\n display: inline-flex;\n align-items: center;\n flex: 0 0 auto;\n }\n \n .p-chips-input-token {\n flex: 1 1 auto;\n display: inline-flex;\n }\n \n .p-chips-token-icon {\n cursor: pointer;\n }\n \n .p-chips-input-token input {\n border: 0 none;\n outline: 0 none;\n background-color: transparent;\n margin: 0;\n padding: 0;\n box-shadow: none;\n border-radius: 0;\n width: 100%;\n }\n \n .p-fluid .p-chips {\n display: flex;\n }\n \n .p-chips-icon-left,\n .p-chips-icon-right {\n position: relative;\n display: inline-block;\n }\n \n .p-chips-icon-left > i,\n .p-chips-icon-right > i,\n .p-chips-icon-left > svg,\n .p-chips-icon-right > svg,\n .p-chips-icon-left > .p-chips-prefix,\n .p-chips-icon-right > .p-chips-suffix {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n }\n \n .p-fluid .p-chips-icon-left,\n .p-fluid .p-chips-icon-right {\n display: block;\n width: 100%;\n }\n}\n";
|
|
140
|
-
var classes = {
|
|
141
|
-
removeTokenIcon: 'p-chips-token-icon',
|
|
142
|
-
label: 'p-chips-token-label',
|
|
143
|
-
token: 'p-chips-token p-highlight',
|
|
144
|
-
inputToken: 'p-chips-input-token',
|
|
145
|
-
container: function container(_ref) {
|
|
146
|
-
var props = _ref.props,
|
|
147
|
-
focusedState = _ref.focusedState;
|
|
148
|
-
return classNames('p-inputtext p-chips-multiple-container', {
|
|
149
|
-
'p-disabled': props.disabled,
|
|
150
|
-
'p-focus': focusedState
|
|
151
|
-
});
|
|
152
|
-
},
|
|
153
|
-
root: function root(_ref2) {
|
|
154
|
-
var isFilled = _ref2.isFilled,
|
|
155
|
-
focusedState = _ref2.focusedState;
|
|
156
|
-
return classNames('p-chips p-component p-inputwrapper', {
|
|
157
|
-
'p-inputwrapper-filled': isFilled,
|
|
158
|
-
'p-inputwrapper-focus': focusedState
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
var ChipsBase = ComponentBase.extend({
|
|
163
|
-
defaultProps: {
|
|
164
|
-
__TYPE: 'Chips',
|
|
165
|
-
addOnBlur: null,
|
|
166
|
-
allowDuplicate: true,
|
|
167
|
-
ariaLabelledBy: null,
|
|
168
|
-
autoFocus: false,
|
|
169
|
-
className: null,
|
|
170
|
-
disabled: null,
|
|
171
|
-
id: null,
|
|
172
|
-
inputId: null,
|
|
173
|
-
inputRef: null,
|
|
174
|
-
itemTemplate: null,
|
|
175
|
-
keyfilter: null,
|
|
176
|
-
max: null,
|
|
177
|
-
name: null,
|
|
178
|
-
onAdd: null,
|
|
179
|
-
onBlur: null,
|
|
180
|
-
onChange: null,
|
|
181
|
-
onFocus: null,
|
|
182
|
-
onKeyDown: null,
|
|
183
|
-
onRemove: null,
|
|
184
|
-
placeholder: null,
|
|
185
|
-
readOnly: false,
|
|
186
|
-
removable: true,
|
|
187
|
-
removeIcon: null,
|
|
188
|
-
separator: null,
|
|
189
|
-
style: null,
|
|
190
|
-
tooltip: null,
|
|
191
|
-
tooltipOptions: null,
|
|
192
|
-
value: null,
|
|
193
|
-
children: undefined
|
|
194
|
-
},
|
|
195
|
-
css: {
|
|
196
|
-
classes: classes,
|
|
197
|
-
styles: styles
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
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; }
|
|
202
|
-
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; }
|
|
203
|
-
var Chips = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
204
|
-
var context = React.useContext(PrimeReactContext);
|
|
205
|
-
var props = ChipsBase.getProps(inProps, context);
|
|
206
|
-
var _React$useState = React.useState(false),
|
|
207
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
208
|
-
focusedState = _React$useState2[0],
|
|
209
|
-
setFocusedState = _React$useState2[1];
|
|
210
|
-
var _ChipsBase$setMetaDat = ChipsBase.setMetaData({
|
|
211
|
-
props: props,
|
|
212
|
-
state: {
|
|
213
|
-
focused: focusedState
|
|
214
|
-
}
|
|
215
|
-
}),
|
|
216
|
-
ptm = _ChipsBase$setMetaDat.ptm,
|
|
217
|
-
cx = _ChipsBase$setMetaDat.cx,
|
|
218
|
-
isUnstyled = _ChipsBase$setMetaDat.isUnstyled;
|
|
219
|
-
useHandleStyle(ChipsBase.css.styles, isUnstyled, {
|
|
220
|
-
name: 'chips'
|
|
221
|
-
});
|
|
222
|
-
var elementRef = React.useRef(null);
|
|
223
|
-
var listRef = React.useRef(null);
|
|
224
|
-
var inputRef = React.useRef(props.inputRef);
|
|
225
|
-
var removeItem = function removeItem(event, index) {
|
|
226
|
-
if (props.disabled && props.readOnly) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
var values = _toConsumableArray(props.value);
|
|
230
|
-
var removedItem = values.splice(index, 1);
|
|
231
|
-
if (!isRemovable(removedItem, index)) {
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
if (props.onRemove) {
|
|
235
|
-
props.onRemove({
|
|
236
|
-
originalEvent: event,
|
|
237
|
-
value: removedItem
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
if (props.onChange) {
|
|
241
|
-
props.onChange({
|
|
242
|
-
originalEvent: event,
|
|
243
|
-
value: values,
|
|
244
|
-
stopPropagation: function stopPropagation() {
|
|
245
|
-
event.stopPropagation();
|
|
246
|
-
},
|
|
247
|
-
preventDefault: function preventDefault() {
|
|
248
|
-
event.preventDefault();
|
|
249
|
-
},
|
|
250
|
-
target: {
|
|
251
|
-
name: props.name,
|
|
252
|
-
id: props.id,
|
|
253
|
-
value: values
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
var addItem = function addItem(event, item, preventDefault) {
|
|
259
|
-
if (item && item.trim().length) {
|
|
260
|
-
var values = props.value ? _toConsumableArray(props.value) : [];
|
|
261
|
-
if (props.allowDuplicate || values.indexOf(item) === -1) {
|
|
262
|
-
var allowAddition = true;
|
|
263
|
-
if (props.onAdd) {
|
|
264
|
-
allowAddition = props.onAdd({
|
|
265
|
-
originalEvent: event,
|
|
266
|
-
value: item
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
if (allowAddition !== false) {
|
|
270
|
-
values.push(item);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
updateInput(event, values, preventDefault);
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
var onWrapperClick = function onWrapperClick() {
|
|
277
|
-
DomHandler.focus(inputRef.current);
|
|
278
|
-
};
|
|
279
|
-
var _onKeyDown = function onKeyDown(event) {
|
|
280
|
-
var inputValue = event.target.value;
|
|
281
|
-
var values = props.value || [];
|
|
282
|
-
props.onKeyDown && props.onKeyDown(event);
|
|
283
|
-
|
|
284
|
-
// do not continue if the user defined keydown wants to prevent
|
|
285
|
-
if (event.defaultPrevented) {
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
switch (event.key) {
|
|
289
|
-
case 'Backspace':
|
|
290
|
-
if (inputRef.current.value.length === 0 && values.length > 0) {
|
|
291
|
-
removeItem(event, values.length - 1);
|
|
292
|
-
}
|
|
293
|
-
break;
|
|
294
|
-
case 'Enter':
|
|
295
|
-
if (inputValue && inputValue.trim().length && (!props.max || props.max > values.length)) {
|
|
296
|
-
addItem(event, inputValue, true);
|
|
297
|
-
}
|
|
298
|
-
break;
|
|
299
|
-
default:
|
|
300
|
-
if (props.keyfilter) {
|
|
301
|
-
KeyFilter.onKeyPress(event, props.keyfilter);
|
|
302
|
-
}
|
|
303
|
-
if (isMaxedOut()) {
|
|
304
|
-
event.preventDefault();
|
|
305
|
-
} else if (props.separator === ',') {
|
|
306
|
-
// GitHub #3885 Android Opera gives strange code 229 for comma
|
|
307
|
-
if (event.key === props.separator || DomHandler.isAndroid() && event.which === 229) {
|
|
308
|
-
addItem(event, inputValue, true);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
break;
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
|
-
var updateInput = function updateInput(event, items, preventDefault) {
|
|
315
|
-
if (props.onChange) {
|
|
316
|
-
props.onChange({
|
|
317
|
-
originalEvent: event,
|
|
318
|
-
value: items,
|
|
319
|
-
stopPropagation: function stopPropagation() {
|
|
320
|
-
event.stopPropagation();
|
|
321
|
-
},
|
|
322
|
-
preventDefault: function preventDefault() {
|
|
323
|
-
event.preventDefault();
|
|
324
|
-
},
|
|
325
|
-
target: {
|
|
326
|
-
name: props.name,
|
|
327
|
-
id: props.id,
|
|
328
|
-
value: items
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
inputRef.current.value = '';
|
|
333
|
-
preventDefault && event.preventDefault();
|
|
334
|
-
};
|
|
335
|
-
var _onPaste = function onPaste(event) {
|
|
336
|
-
if (props.separator) {
|
|
337
|
-
var pastedData = (event.clipboardData || window['clipboardData']).getData('Text');
|
|
338
|
-
if (props.keyfilter) {
|
|
339
|
-
KeyFilter.onPaste(event, props.keyfilter);
|
|
340
|
-
}
|
|
341
|
-
if (pastedData) {
|
|
342
|
-
var values = props.value || [];
|
|
343
|
-
var pastedValues = pastedData.split(props.separator);
|
|
344
|
-
pastedValues = pastedValues.filter(function (val) {
|
|
345
|
-
return (props.allowDuplicate || values.indexOf(val) === -1) && val.trim().length;
|
|
346
|
-
});
|
|
347
|
-
values = [].concat(_toConsumableArray(values), _toConsumableArray(pastedValues));
|
|
348
|
-
updateInput(event, values, true);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
};
|
|
352
|
-
var _onFocus = function onFocus(event) {
|
|
353
|
-
setFocusedState(true);
|
|
354
|
-
props.onFocus && props.onFocus(event);
|
|
355
|
-
};
|
|
356
|
-
var _onBlur = function onBlur(event) {
|
|
357
|
-
if (props.addOnBlur) {
|
|
358
|
-
var inputValue = event.target.value;
|
|
359
|
-
var values = props.value || [];
|
|
360
|
-
if (inputValue && inputValue.trim().length && (!props.max || props.max > values.length)) {
|
|
361
|
-
addItem(event, inputValue, true);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
setFocusedState(false);
|
|
365
|
-
props.onBlur && props.onBlur(event);
|
|
366
|
-
};
|
|
367
|
-
var isMaxedOut = function isMaxedOut() {
|
|
368
|
-
return props.max && props.value && props.max === props.value.length;
|
|
369
|
-
};
|
|
370
|
-
var currentValue = inputRef.current && inputRef.current.value;
|
|
371
|
-
var isFilled = React.useMemo(function () {
|
|
372
|
-
return ObjectUtils.isNotEmpty(props.value) || ObjectUtils.isNotEmpty(currentValue);
|
|
373
|
-
}, [props.value, currentValue]);
|
|
374
|
-
var isRemovable = function isRemovable(value, index) {
|
|
375
|
-
return ObjectUtils.getPropValue(props.removable, {
|
|
376
|
-
value: value,
|
|
377
|
-
index: index,
|
|
378
|
-
props: props
|
|
379
|
-
});
|
|
380
|
-
};
|
|
381
|
-
React.useImperativeHandle(ref, function () {
|
|
382
|
-
return {
|
|
383
|
-
props: props,
|
|
384
|
-
focus: function focus() {
|
|
385
|
-
return DomHandler.focus(inputRef.current);
|
|
386
|
-
},
|
|
387
|
-
getElement: function getElement() {
|
|
388
|
-
return elementRef.current;
|
|
389
|
-
},
|
|
390
|
-
getInput: function getInput() {
|
|
391
|
-
return inputRef.current;
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
});
|
|
395
|
-
React.useEffect(function () {
|
|
396
|
-
ObjectUtils.combinedRefs(inputRef, props.inputRef);
|
|
397
|
-
}, [inputRef, props.inputRef]);
|
|
398
|
-
useMountEffect(function () {
|
|
399
|
-
if (props.autoFocus) {
|
|
400
|
-
DomHandler.focus(inputRef.current, props.autoFocus);
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
var createRemoveIcon = function createRemoveIcon(value, index) {
|
|
404
|
-
var iconProps = mergeProps({
|
|
405
|
-
className: cx('removeTokenIcon'),
|
|
406
|
-
onClick: function onClick(event) {
|
|
407
|
-
return removeItem(event, index);
|
|
408
|
-
}
|
|
409
|
-
}, ptm('removeTokenIcon'));
|
|
410
|
-
var icon = props.removeIcon || /*#__PURE__*/React.createElement(TimesCircleIcon, iconProps);
|
|
411
|
-
var removeIcon = IconUtils.getJSXIcon(icon, _objectSpread({}, iconProps), {
|
|
412
|
-
props: props
|
|
413
|
-
});
|
|
414
|
-
if (!props.disabled && !props.readOnly && isRemovable(value, index)) {
|
|
415
|
-
return removeIcon;
|
|
416
|
-
}
|
|
417
|
-
return null;
|
|
418
|
-
};
|
|
419
|
-
var createItem = function createItem(value, index) {
|
|
420
|
-
var content = props.itemTemplate ? props.itemTemplate(value) : value;
|
|
421
|
-
var labelProps = mergeProps({
|
|
422
|
-
className: cx('label')
|
|
423
|
-
}, ptm('label'));
|
|
424
|
-
var label = /*#__PURE__*/React.createElement("span", labelProps, content);
|
|
425
|
-
var icon = createRemoveIcon(value, index);
|
|
426
|
-
var tokenProps = mergeProps({
|
|
427
|
-
key: index,
|
|
428
|
-
className: cx('token'),
|
|
429
|
-
'data-p-highlight': true
|
|
430
|
-
}, ptm('token'));
|
|
431
|
-
return /*#__PURE__*/React.createElement("li", tokenProps, label, icon);
|
|
432
|
-
};
|
|
433
|
-
var createInput = function createInput() {
|
|
434
|
-
var inputTokenProps = mergeProps({
|
|
435
|
-
className: cx('inputToken')
|
|
436
|
-
}, ptm('inputToken'));
|
|
437
|
-
var inputProps = mergeProps(_objectSpread({
|
|
438
|
-
id: props.inputId,
|
|
439
|
-
ref: inputRef,
|
|
440
|
-
placeholder: props.placeholder,
|
|
441
|
-
type: 'text',
|
|
442
|
-
name: props.name,
|
|
443
|
-
disabled: props.disabled || isMaxedOut(),
|
|
444
|
-
onKeyDown: function onKeyDown(e) {
|
|
445
|
-
return _onKeyDown(e);
|
|
446
|
-
},
|
|
447
|
-
onPaste: function onPaste(e) {
|
|
448
|
-
return _onPaste(e);
|
|
449
|
-
},
|
|
450
|
-
onFocus: function onFocus(e) {
|
|
451
|
-
return _onFocus(e);
|
|
452
|
-
},
|
|
453
|
-
onBlur: function onBlur(e) {
|
|
454
|
-
return _onBlur(e);
|
|
455
|
-
},
|
|
456
|
-
readOnly: props.readOnly
|
|
457
|
-
}, ariaProps), ptm('input'));
|
|
458
|
-
return /*#__PURE__*/React.createElement("li", inputTokenProps, /*#__PURE__*/React.createElement("input", inputProps));
|
|
459
|
-
};
|
|
460
|
-
var createItems = function createItems() {
|
|
461
|
-
return props.value ? props.value.map(createItem) : null;
|
|
462
|
-
};
|
|
463
|
-
var createList = function createList() {
|
|
464
|
-
var items = createItems();
|
|
465
|
-
var input = createInput();
|
|
466
|
-
var containerProps = mergeProps({
|
|
467
|
-
ref: listRef,
|
|
468
|
-
className: cx('container', {
|
|
469
|
-
focusedState: focusedState
|
|
470
|
-
}),
|
|
471
|
-
onClick: function onClick(e) {
|
|
472
|
-
return onWrapperClick();
|
|
473
|
-
},
|
|
474
|
-
'data-p-disabled': props.disabled,
|
|
475
|
-
'data-p-focus': focusedState
|
|
476
|
-
}, ptm('container'));
|
|
477
|
-
return /*#__PURE__*/React.createElement("ul", containerProps, items, input);
|
|
478
|
-
};
|
|
479
|
-
var hasTooltip = ObjectUtils.isNotEmpty(props.tooltip);
|
|
480
|
-
var otherProps = ChipsBase.getOtherProps(props);
|
|
481
|
-
var ariaProps = ObjectUtils.reduceKeys(otherProps, DomHandler.ARIA_PROPS);
|
|
482
|
-
var list = createList();
|
|
483
|
-
var rootProps = mergeProps({
|
|
484
|
-
id: props.id,
|
|
485
|
-
ref: elementRef,
|
|
486
|
-
className: classNames(props.className, cx('root', {
|
|
487
|
-
isFilled: isFilled,
|
|
488
|
-
focusedState: focusedState
|
|
489
|
-
})),
|
|
490
|
-
style: props.style
|
|
491
|
-
}, ptm('root'));
|
|
492
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", rootProps, list), hasTooltip && /*#__PURE__*/React.createElement(Tooltip, _extends({
|
|
493
|
-
target: inputRef,
|
|
494
|
-
content: props.tooltip
|
|
495
|
-
}, props.tooltipOptions, {
|
|
496
|
-
pt: ptm('tooltip')
|
|
497
|
-
})));
|
|
498
|
-
}));
|
|
499
|
-
Chips.displayName = 'Chips';
|
|
500
|
-
|
|
501
|
-
export { Chips };
|
package/chips/chips.esm.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"react";import{PrimeReactContext as n}from"primereact/api";import{ComponentBase as t,useHandleStyle as r}from"primereact/componentbase";import{useMountEffect as o}from"primereact/hooks";import{TimesCircleIcon as i}from"primereact/icons/timescircle";import{KeyFilter as l}from"primereact/keyfilter";import{Tooltip as a}from"primereact/tooltip";import{classNames as u,ObjectUtils as c,DomHandler as p,mergeProps as s,IconUtils as f}from"primereact/utils";function m(){return m=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},m.apply(this,arguments)}function d(e){return d="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},d(e)}function y(e,n){if("object"!==d(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!==d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}function v(e){var n=y(e,"string");return"symbol"===d(n)?n:String(n)}function h(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function b(e){if(Array.isArray(e))return h(e)}function g(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function O(e,n){if(e){if("string"==typeof e)return h(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?h(e,n):void 0}}function w(){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 k(e){return b(e)||g(e)||O(e)||w()}function x(e){if(Array.isArray(e))return e}function P(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i,l,a=[],u=!0,c=!1;try{if(i=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;u=!1}else for(;!(u=(r=i.call(t)).done)&&(a.push(r.value),a.length!==n);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=t.return&&(l=t.return(),Object(l)!==l))return}finally{if(c)throw o}}return a}}function E(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var S=t.extend({defaultProps:{__TYPE:"Chips",addOnBlur:null,allowDuplicate:!0,ariaLabelledBy:null,autoFocus:!1,className:null,disabled:null,id:null,inputId:null,inputRef:null,itemTemplate:null,keyfilter:null,max:null,name:null,onAdd:null,onBlur:null,onChange:null,onFocus:null,onKeyDown:null,onRemove:null,placeholder:null,readOnly:!1,removable:!0,removeIcon:null,separator:null,style:null,tooltip:null,tooltipOptions:null,value:null,children:void 0},css:{classes:{removeTokenIcon:"p-chips-token-icon",label:"p-chips-token-label",token:"p-chips-token p-highlight",inputToken:"p-chips-input-token",container:function(e){return u("p-inputtext p-chips-multiple-container",{"p-disabled":e.props.disabled,"p-focus":e.focusedState})},root:function(e){return u("p-chips p-component p-inputwrapper",{"p-inputwrapper-filled":e.isFilled,"p-inputwrapper-focus":e.focusedState})}},styles:"\n@layer primereact {\n .p-chips {\n display: inline-flex;\n }\n \n .p-chips-multiple-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n cursor: text;\n overflow: hidden;\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n }\n \n .p-chips-token {\n cursor: default;\n display: inline-flex;\n align-items: center;\n flex: 0 0 auto;\n }\n \n .p-chips-input-token {\n flex: 1 1 auto;\n display: inline-flex;\n }\n \n .p-chips-token-icon {\n cursor: pointer;\n }\n \n .p-chips-input-token input {\n border: 0 none;\n outline: 0 none;\n background-color: transparent;\n margin: 0;\n padding: 0;\n box-shadow: none;\n border-radius: 0;\n width: 100%;\n }\n \n .p-fluid .p-chips {\n display: flex;\n }\n \n .p-chips-icon-left,\n .p-chips-icon-right {\n position: relative;\n display: inline-block;\n }\n \n .p-chips-icon-left > i,\n .p-chips-icon-right > i,\n .p-chips-icon-left > svg,\n .p-chips-icon-right > svg,\n .p-chips-icon-left > .p-chips-prefix,\n .p-chips-icon-right > .p-chips-suffix {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n }\n \n .p-fluid .p-chips-icon-left,\n .p-fluid .p-chips-icon-right {\n display: block;\n width: 100%;\n }\n}\n"}});function j(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function D(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?j(Object(t),!0).forEach((function(n){var r,o,i;r=e,i=t[n],(o=v(o=n))in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):j(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var I=e.memo(e.forwardRef((function(t,d){var y,v,h=e.useContext(n),b=S.getProps(t,h),g=e.useState(!1),w=(v=2,x(y=g)||P(y,v)||O(y,v)||E()),j=w[0],I=w[1],A=S.setMetaData({props:b,state:{focused:j}}),R=A.ptm,T=A.cx;r(S.css.styles,A.isUnstyled,{name:"chips"});var N=e.useRef(null),C=e.useRef(null),F=e.useRef(b.inputRef),B=function(e,n){if(!b.disabled||!b.readOnly){var t=k(b.value),r=t.splice(n,1);X(r,n)&&(b.onRemove&&b.onRemove({originalEvent:e,value:r}),b.onChange&&b.onChange({originalEvent:e,value:t,stopPropagation:function(){e.stopPropagation()},preventDefault:function(){e.preventDefault()},target:{name:b.name,id:b.id,value:t}}))}},K=function(e,n,t){if(n&&n.trim().length){var r=b.value?k(b.value):[];if(b.allowDuplicate||-1===r.indexOf(n)){var o=!0;b.onAdd&&(o=b.onAdd({originalEvent:e,value:n})),!1!==o&&r.push(n)}_(e,r,t)}},M=function(e){var n=e.target.value,t=b.value||[];if(b.onKeyDown&&b.onKeyDown(e),!e.defaultPrevented)switch(e.key){case"Backspace":0===F.current.value.length&&t.length>0&&B(e,t.length-1);break;case"Enter":n&&n.trim().length&&(!b.max||b.max>t.length)&&K(e,n,!0);break;default:b.keyfilter&&l.onKeyPress(e,b.keyfilter),J()?e.preventDefault():","===b.separator&&(e.key===b.separator||p.isAndroid()&&229===e.which)&&K(e,n,!0)}},_=function(e,n,t){b.onChange&&b.onChange({originalEvent:e,value:n,stopPropagation:function(){e.stopPropagation()},preventDefault:function(){e.preventDefault()},target:{name:b.name,id:b.id,value:n}}),F.current.value="",t&&e.preventDefault()},U=function(e){if(b.separator){var n=(e.clipboardData||window.clipboardData).getData("Text");if(b.keyfilter&&l.onPaste(e,b.keyfilter),n){var t=b.value||[],r=n.split(b.separator);r=r.filter((function(e){return(b.allowDuplicate||-1===t.indexOf(e))&&e.trim().length})),t=[].concat(k(t),k(r)),_(e,t,!0)}}},H=function(e){if(b.addOnBlur){var n=e.target.value,t=b.value||[];n&&n.trim().length&&(!b.max||b.max>t.length)&&K(e,n,!0)}I(!1),b.onBlur&&b.onBlur(e)},J=function(){return b.max&&b.value&&b.max===b.value.length},L=F.current&&F.current.value,V=e.useMemo((function(){return c.isNotEmpty(b.value)||c.isNotEmpty(L)}),[b.value,L]),X=function(e,n){return c.getPropValue(b.removable,{value:e,index:n,props:b})};e.useImperativeHandle(d,(function(){return{props:b,focus:function(){return p.focus(F.current)},getElement:function(){return N.current},getInput:function(){return F.current}}})),e.useEffect((function(){c.combinedRefs(F,b.inputRef)}),[F,b.inputRef]),o((function(){b.autoFocus&&p.focus(F.current,b.autoFocus)}));var Y,$,q,z,G,Q=function(n,t){var r=s({className:T("removeTokenIcon"),onClick:function(e){return B(e,t)}},R("removeTokenIcon")),o=f.getJSXIcon(b.removeIcon||e.createElement(i,r),D({},r),{props:b});return b.disabled||b.readOnly||!X(n,t)?null:o},W=function(n,t){var r=b.itemTemplate?b.itemTemplate(n):n,o=s({className:T("label")},R("label")),i=e.createElement("span",o,r),l=Q(n,t),a=s({key:t,className:T("token"),"data-p-highlight":!0},R("token"));return e.createElement("li",a,i,l)},Z=c.isNotEmpty(b.tooltip),ee=S.getOtherProps(b),ne=c.reduceKeys(ee,p.ARIA_PROPS),te=(q=b.value?b.value.map(W):null,Y=s({className:T("inputToken")},R("inputToken")),$=s(D({id:b.inputId,ref:F,placeholder:b.placeholder,type:"text",name:b.name,disabled:b.disabled||J(),onKeyDown:function(e){return M(e)},onPaste:function(e){return U(e)},onFocus:function(e){return n=e,I(!0),void(b.onFocus&&b.onFocus(n));var n},onBlur:function(e){return H(e)},readOnly:b.readOnly},ne),R("input")),z=e.createElement("li",Y,e.createElement("input",$)),G=s({ref:C,className:T("container",{focusedState:j}),onClick:function(e){p.focus(F.current)},"data-p-disabled":b.disabled,"data-p-focus":j},R("container")),e.createElement("ul",G,q,z)),re=s({id:b.id,ref:N,className:u(b.className,T("root",{isFilled:V,focusedState:j})),style:b.style},R("root"));return e.createElement(e.Fragment,null,e.createElement("div",re,te),Z&&e.createElement(a,m({target:F,content:b.tooltip},b.tooltipOptions,{pt:R("tooltip")})))})));I.displayName="Chips";export{I as Chips};
|