primereact 10.6.2 → 10.6.3
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/autocomplete/autocomplete.cjs.js +16 -8
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.d.ts +5 -0
- package/autocomplete/autocomplete.esm.js +16 -8
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +16 -8
- package/autocomplete/autocomplete.min.js +1 -1
- package/blockui/blockui.cjs.js +3 -6
- package/blockui/blockui.cjs.min.js +1 -1
- package/blockui/blockui.esm.js +3 -6
- package/blockui/blockui.esm.min.js +1 -1
- package/blockui/blockui.js +3 -6
- package/blockui/blockui.min.js +1 -1
- package/breadcrumb/breadcrumb.cjs.js +2 -5
- package/breadcrumb/breadcrumb.cjs.min.js +1 -1
- package/breadcrumb/breadcrumb.esm.js +2 -5
- package/breadcrumb/breadcrumb.esm.min.js +1 -1
- package/breadcrumb/breadcrumb.js +2 -5
- package/breadcrumb/breadcrumb.min.js +1 -1
- package/buttongroup/buttongroup.cjs.js +6 -1
- package/buttongroup/buttongroup.cjs.min.js +1 -1
- package/buttongroup/buttongroup.d.ts +5 -0
- package/buttongroup/buttongroup.esm.js +7 -2
- package/buttongroup/buttongroup.esm.min.js +1 -1
- package/buttongroup/buttongroup.js +6 -1
- package/buttongroup/buttongroup.min.js +1 -1
- package/calendar/calendar.cjs.js +30 -20
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.d.ts +5 -0
- package/calendar/calendar.esm.js +30 -20
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +30 -20
- package/calendar/calendar.min.js +1 -1
- package/card/card.cjs.js +2 -5
- package/card/card.cjs.min.js +1 -1
- package/card/card.esm.js +3 -6
- package/card/card.esm.min.js +1 -1
- package/card/card.js +2 -5
- package/card/card.min.js +1 -1
- package/cascadeselect/cascadeselect.cjs.js +14 -16
- package/cascadeselect/cascadeselect.cjs.min.js +1 -1
- package/cascadeselect/cascadeselect.d.ts +5 -0
- package/cascadeselect/cascadeselect.esm.js +14 -16
- package/cascadeselect/cascadeselect.esm.min.js +1 -1
- package/cascadeselect/cascadeselect.js +14 -16
- package/cascadeselect/cascadeselect.min.js +1 -1
- package/chart/chart.cjs.js +4 -7
- package/chart/chart.cjs.min.js +1 -1
- package/chart/chart.esm.js +4 -7
- package/chart/chart.esm.min.js +1 -1
- package/chart/chart.js +4 -7
- package/chart/chart.min.js +1 -1
- package/checkbox/checkbox.cjs.js +6 -3
- package/checkbox/checkbox.cjs.min.js +1 -1
- package/checkbox/checkbox.d.ts +5 -0
- package/checkbox/checkbox.esm.js +6 -3
- package/checkbox/checkbox.esm.min.js +1 -1
- package/checkbox/checkbox.js +6 -3
- package/checkbox/checkbox.min.js +1 -1
- package/chips/chips.cjs.js +5 -3
- package/chips/chips.cjs.min.js +1 -1
- package/chips/chips.d.ts +5 -0
- package/chips/chips.esm.js +5 -3
- package/chips/chips.esm.min.js +1 -1
- package/chips/chips.js +5 -3
- package/chips/chips.min.js +1 -1
- package/colorpicker/colorpicker.cjs.js +2 -2
- package/colorpicker/colorpicker.cjs.min.js +1 -1
- package/colorpicker/colorpicker.esm.js +2 -2
- package/colorpicker/colorpicker.esm.min.js +1 -1
- package/colorpicker/colorpicker.js +2 -2
- package/colorpicker/colorpicker.min.js +1 -1
- package/column/column.d.ts +1 -1
- package/componentbase/componentbase.cjs.js +1 -1
- package/componentbase/componentbase.cjs.min.js +1 -1
- package/componentbase/componentbase.esm.js +1 -1
- package/componentbase/componentbase.esm.min.js +1 -1
- package/componentbase/componentbase.js +1 -1
- package/componentbase/componentbase.min.js +1 -1
- package/confirmpopup/confirmpopup.cjs.js +2 -2
- package/confirmpopup/confirmpopup.cjs.min.js +1 -1
- package/confirmpopup/confirmpopup.esm.js +2 -2
- package/confirmpopup/confirmpopup.esm.min.js +1 -1
- package/confirmpopup/confirmpopup.js +2 -2
- package/confirmpopup/confirmpopup.min.js +1 -1
- package/core/core.js +140 -60
- package/core/core.min.js +7 -7
- package/datatable/datatable.cjs.js +15 -6
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.esm.js +15 -6
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +15 -6
- package/datatable/datatable.min.js +1 -1
- package/dialog/dialog.cjs.js +3 -3
- package/dialog/dialog.cjs.min.js +1 -1
- package/dialog/dialog.esm.js +3 -3
- package/dialog/dialog.esm.min.js +1 -1
- package/dialog/dialog.js +3 -3
- package/dialog/dialog.min.js +1 -1
- package/dropdown/dropdown.cjs.js +41 -20
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.d.ts +6 -1
- package/dropdown/dropdown.esm.js +41 -20
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +41 -20
- package/dropdown/dropdown.min.js +1 -1
- package/fileupload/fileupload.cjs.js +7 -4
- package/fileupload/fileupload.cjs.min.js +1 -1
- package/fileupload/fileupload.esm.js +7 -4
- package/fileupload/fileupload.esm.min.js +1 -1
- package/fileupload/fileupload.js +7 -4
- package/fileupload/fileupload.min.js +1 -1
- package/floatlabel/floatlabel.cjs.js +6 -1
- package/floatlabel/floatlabel.cjs.min.js +1 -1
- package/floatlabel/floatlabel.esm.js +7 -2
- package/floatlabel/floatlabel.esm.min.js +1 -1
- package/floatlabel/floatlabel.js +6 -1
- package/floatlabel/floatlabel.min.js +1 -1
- package/iconfield/iconfield.cjs.js +4 -4
- package/iconfield/iconfield.cjs.min.js +1 -1
- package/iconfield/iconfield.esm.js +4 -4
- package/iconfield/iconfield.esm.min.js +1 -1
- package/iconfield/iconfield.js +4 -4
- package/iconfield/iconfield.min.js +1 -1
- package/iconfield/package.json +7 -0
- package/image/image.cjs.js +2 -2
- package/image/image.cjs.min.js +1 -1
- package/image/image.esm.js +2 -2
- package/image/image.esm.min.js +1 -1
- package/image/image.js +2 -2
- package/image/image.min.js +1 -1
- package/inputicon/package.json +7 -0
- package/inputmask/inputmask.cjs.js +21 -1
- package/inputmask/inputmask.cjs.min.js +1 -1
- package/inputmask/inputmask.d.ts +11 -1
- package/inputmask/inputmask.esm.js +22 -2
- package/inputmask/inputmask.esm.min.js +1 -1
- package/inputmask/inputmask.js +21 -1
- package/inputmask/inputmask.min.js +1 -1
- package/inputnumber/inputnumber.cjs.js +68 -23
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.d.ts +5 -0
- package/inputnumber/inputnumber.esm.js +68 -23
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +68 -23
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputotp/inputotp.cjs.js +348 -0
- package/inputotp/inputotp.cjs.min.js +1 -0
- package/inputotp/inputotp.d.ts +177 -0
- package/inputotp/inputotp.esm.js +340 -0
- package/inputotp/inputotp.esm.min.js +1 -0
- package/inputotp/inputotp.js +346 -0
- package/inputotp/inputotp.min.js +1 -0
- package/inputotp/package.json +7 -0
- package/inputtext/inputtext.cjs.js +9 -5
- package/inputtext/inputtext.cjs.min.js +1 -1
- package/inputtext/inputtext.d.ts +5 -0
- package/inputtext/inputtext.esm.js +9 -5
- package/inputtext/inputtext.esm.min.js +1 -1
- package/inputtext/inputtext.js +9 -5
- package/inputtext/inputtext.min.js +1 -1
- package/inputtextarea/inputtextarea.cjs.js +8 -4
- package/inputtextarea/inputtextarea.cjs.min.js +1 -1
- package/inputtextarea/inputtextarea.d.ts +5 -0
- package/inputtextarea/inputtextarea.esm.js +8 -4
- package/inputtextarea/inputtextarea.esm.min.js +1 -1
- package/inputtextarea/inputtextarea.js +8 -4
- package/inputtextarea/inputtextarea.min.js +1 -1
- package/knob/knob.cjs.js +2 -2
- package/knob/knob.cjs.min.js +1 -1
- package/knob/knob.esm.js +2 -2
- package/knob/knob.esm.min.js +1 -1
- package/knob/knob.js +2 -2
- package/knob/knob.min.js +1 -1
- package/mention/mention.cjs.js +13 -9
- package/mention/mention.cjs.min.js +1 -1
- package/mention/mention.esm.js +13 -9
- package/mention/mention.esm.min.js +1 -1
- package/mention/mention.js +13 -9
- package/mention/mention.min.js +1 -1
- package/metergroup/package.json +7 -0
- package/multiselect/multiselect.cjs.js +27 -8
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.d.ts +5 -0
- package/multiselect/multiselect.esm.js +27 -8
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +27 -8
- package/multiselect/multiselect.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.cjs.js +6 -3
- package/multistatecheckbox/multistatecheckbox.cjs.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.esm.js +6 -3
- package/multistatecheckbox/multistatecheckbox.esm.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.js +6 -3
- package/multistatecheckbox/multistatecheckbox.min.js +1 -1
- package/overlaypanel/overlaypanel.cjs.js +5 -5
- package/overlaypanel/overlaypanel.cjs.min.js +1 -1
- package/overlaypanel/overlaypanel.esm.js +5 -5
- package/overlaypanel/overlaypanel.esm.min.js +1 -1
- package/overlaypanel/overlaypanel.js +5 -5
- package/overlaypanel/overlaypanel.min.js +1 -1
- package/package.json +1 -1
- package/panelmenu/panelmenu.cjs.js +12 -15
- package/panelmenu/panelmenu.cjs.min.js +1 -1
- package/panelmenu/panelmenu.esm.js +12 -15
- package/panelmenu/panelmenu.esm.min.js +1 -1
- package/panelmenu/panelmenu.js +12 -15
- package/panelmenu/panelmenu.min.js +1 -1
- package/passthrough/tailwind/index.cjs.js +134 -170
- package/passthrough/tailwind/index.cjs.min.js +1 -1
- package/passthrough/tailwind/index.esm.js +134 -170
- package/passthrough/tailwind/index.esm.min.js +1 -1
- package/passthrough/tailwind/index.js +134 -170
- package/passthrough/tailwind/index.min.js +1 -1
- package/password/password.cjs.js +5 -3
- package/password/password.cjs.min.js +1 -1
- package/password/password.d.ts +5 -0
- package/password/password.esm.js +5 -3
- package/password/password.esm.min.js +1 -1
- package/password/password.js +5 -3
- package/password/password.min.js +1 -1
- package/primereact.all.cjs.js +432 -302
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +432 -302
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +432 -302
- package/primereact.all.min.js +1 -1
- package/radiobutton/radiobutton.cjs.js +8 -3
- package/radiobutton/radiobutton.cjs.min.js +1 -1
- package/radiobutton/radiobutton.d.ts +5 -0
- package/radiobutton/radiobutton.esm.js +8 -3
- package/radiobutton/radiobutton.esm.min.js +1 -1
- package/radiobutton/radiobutton.js +8 -3
- package/radiobutton/radiobutton.min.js +1 -1
- package/rating/rating.cjs.js +2 -2
- package/rating/rating.cjs.min.js +1 -1
- package/rating/rating.esm.js +2 -2
- package/rating/rating.esm.min.js +1 -1
- package/rating/rating.js +2 -2
- package/rating/rating.min.js +1 -1
- package/resources/themes/arya-blue/theme.css +51 -43
- package/resources/themes/arya-green/theme.css +51 -43
- package/resources/themes/arya-orange/theme.css +51 -43
- package/resources/themes/bootstrap4-dark-blue/theme.css +51 -43
- package/resources/themes/bootstrap4-dark-purple/theme.css +9 -0
- package/resources/themes/bootstrap4-light-blue/theme.css +51 -43
- package/resources/themes/bootstrap4-light-purple/theme.css +9 -0
- package/resources/themes/fluent-light/theme.css +51 -43
- package/resources/themes/lara-dark-amber/theme.css +51 -43
- package/resources/themes/lara-dark-blue/theme.css +51 -43
- package/resources/themes/lara-dark-cyan/theme.css +51 -43
- package/resources/themes/lara-dark-green/theme.css +51 -43
- package/resources/themes/lara-dark-indigo/theme.css +51 -43
- package/resources/themes/lara-dark-pink/theme.css +51 -43
- package/resources/themes/lara-dark-purple/theme.css +1124 -227
- package/resources/themes/lara-dark-teal/theme.css +51 -43
- package/resources/themes/lara-light-amber/theme.css +51 -43
- package/resources/themes/lara-light-blue/theme.css +51 -43
- package/resources/themes/lara-light-cyan/theme.css +51 -43
- package/resources/themes/lara-light-green/theme.css +51 -43
- package/resources/themes/lara-light-indigo/theme.css +51 -43
- package/resources/themes/lara-light-pink/theme.css +51 -43
- package/resources/themes/lara-light-purple/theme.css +1122 -229
- package/resources/themes/lara-light-teal/theme.css +51 -43
- package/resources/themes/luna-amber/theme.css +51 -43
- package/resources/themes/luna-blue/theme.css +51 -43
- package/resources/themes/luna-green/theme.css +51 -43
- package/resources/themes/luna-pink/theme.css +51 -43
- package/resources/themes/md-dark-deeppurple/theme.css +9 -0
- package/resources/themes/md-dark-indigo/theme.css +193 -185
- package/resources/themes/md-light-deeppurple/theme.css +9 -0
- package/resources/themes/md-light-indigo/theme.css +51 -43
- package/resources/themes/mdc-dark-deeppurple/theme.css +9 -0
- package/resources/themes/mdc-dark-indigo/theme.css +193 -185
- package/resources/themes/mdc-light-deeppurple/theme.css +9 -0
- package/resources/themes/mdc-light-indigo/theme.css +51 -43
- package/resources/themes/mira/theme.css +51 -43
- package/resources/themes/nano/theme.css +51 -43
- package/resources/themes/nova/theme.css +51 -43
- package/resources/themes/nova-accent/theme.css +51 -43
- package/resources/themes/nova-alt/theme.css +51 -43
- package/resources/themes/rhea/theme.css +51 -43
- package/resources/themes/saga-blue/theme.css +51 -43
- package/resources/themes/saga-green/theme.css +51 -43
- package/resources/themes/saga-orange/theme.css +51 -43
- package/resources/themes/soho-dark/theme.css +76 -68
- package/resources/themes/soho-light/theme.css +51 -43
- package/resources/themes/tailwind-light/theme.css +52 -44
- package/resources/themes/vela-blue/theme.css +51 -43
- package/resources/themes/vela-green/theme.css +51 -43
- package/resources/themes/vela-orange/theme.css +51 -43
- package/resources/themes/viva-dark/theme.css +51 -43
- package/resources/themes/viva-light/theme.css +51 -43
- package/scrollpanel/scrollpanel.cjs.js +2 -5
- package/scrollpanel/scrollpanel.cjs.min.js +1 -1
- package/scrollpanel/scrollpanel.esm.js +3 -6
- package/scrollpanel/scrollpanel.esm.min.js +1 -1
- package/scrollpanel/scrollpanel.js +2 -5
- package/scrollpanel/scrollpanel.min.js +1 -1
- package/selectbutton/selectbutton.cjs.js +2 -2
- package/selectbutton/selectbutton.cjs.min.js +1 -1
- package/selectbutton/selectbutton.esm.js +2 -2
- package/selectbutton/selectbutton.esm.min.js +1 -1
- package/selectbutton/selectbutton.js +2 -2
- package/selectbutton/selectbutton.min.js +1 -1
- package/sidebar/sidebar.cjs.js +5 -5
- package/sidebar/sidebar.cjs.min.js +1 -1
- package/sidebar/sidebar.esm.js +5 -5
- package/sidebar/sidebar.esm.min.js +1 -1
- package/sidebar/sidebar.js +5 -5
- package/sidebar/sidebar.min.js +1 -1
- package/slidemenu/slidemenu.cjs.js +2 -2
- package/slidemenu/slidemenu.cjs.min.js +1 -1
- package/slidemenu/slidemenu.esm.js +2 -2
- package/slidemenu/slidemenu.esm.min.js +1 -1
- package/slidemenu/slidemenu.js +2 -2
- package/slidemenu/slidemenu.min.js +1 -1
- package/slider/slider.cjs.js +3 -3
- package/slider/slider.cjs.min.js +1 -1
- package/slider/slider.esm.js +3 -3
- package/slider/slider.esm.min.js +1 -1
- package/slider/slider.js +3 -3
- package/slider/slider.min.js +1 -1
- package/splitbutton/splitbutton.cjs.js +2 -2
- package/splitbutton/splitbutton.cjs.min.js +1 -1
- package/splitbutton/splitbutton.esm.js +2 -2
- package/splitbutton/splitbutton.esm.min.js +1 -1
- package/splitbutton/splitbutton.js +2 -2
- package/splitbutton/splitbutton.min.js +1 -1
- package/stepperpanel/stepperpanel.cjs.js +9 -2
- package/stepperpanel/stepperpanel.cjs.min.js +1 -1
- package/stepperpanel/stepperpanel.d.ts +1 -1
- package/stepperpanel/stepperpanel.esm.js +9 -2
- package/stepperpanel/stepperpanel.esm.min.js +1 -1
- package/stepperpanel/stepperpanel.js +10 -4
- package/stepperpanel/stepperpanel.min.js +1 -1
- package/steps/steps.cjs.js +2 -2
- package/steps/steps.cjs.min.js +1 -1
- package/steps/steps.esm.js +2 -2
- package/steps/steps.esm.min.js +1 -1
- package/steps/steps.js +2 -2
- package/steps/steps.min.js +1 -1
- package/tabmenu/tabmenu.cjs.js +2 -5
- package/tabmenu/tabmenu.cjs.min.js +1 -1
- package/tabmenu/tabmenu.esm.js +2 -5
- package/tabmenu/tabmenu.esm.min.js +1 -1
- package/tabmenu/tabmenu.js +2 -5
- package/tabmenu/tabmenu.min.js +1 -1
- package/tabview/tabview.cjs.js +2 -2
- package/tabview/tabview.cjs.min.js +1 -1
- package/tabview/tabview.esm.js +2 -2
- package/tabview/tabview.esm.min.js +1 -1
- package/tabview/tabview.js +2 -2
- package/tabview/tabview.min.js +1 -1
- package/tieredmenu/tieredmenu.cjs.js +2 -2
- package/tieredmenu/tieredmenu.cjs.min.js +1 -1
- package/tieredmenu/tieredmenu.esm.js +2 -2
- package/tieredmenu/tieredmenu.esm.min.js +1 -1
- package/tieredmenu/tieredmenu.js +2 -2
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/togglebutton/togglebutton.cjs.js +3 -3
- package/togglebutton/togglebutton.cjs.min.js +1 -1
- package/togglebutton/togglebutton.esm.js +3 -3
- package/togglebutton/togglebutton.esm.min.js +1 -1
- package/togglebutton/togglebutton.js +3 -3
- package/togglebutton/togglebutton.min.js +1 -1
- package/toolbar/toolbar.cjs.js +2 -5
- package/toolbar/toolbar.cjs.min.js +1 -1
- package/toolbar/toolbar.esm.js +3 -6
- package/toolbar/toolbar.esm.min.js +1 -1
- package/toolbar/toolbar.js +2 -5
- package/toolbar/toolbar.min.js +1 -1
- package/tree/tree.cjs.js +12 -5
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.esm.js +12 -5
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +12 -5
- package/tree/tree.min.js +1 -1
- package/treeselect/treeselect.cjs.js +7 -3
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.d.ts +5 -0
- package/treeselect/treeselect.esm.js +7 -3
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +7 -3
- package/treeselect/treeselect.min.js +1 -1
- package/treetable/treetable.cjs.js +6 -3
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.esm.js +6 -3
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +6 -3
- package/treetable/treetable.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.cjs.js +7 -3
- package/tristatecheckbox/tristatecheckbox.cjs.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.d.ts +5 -0
- package/tristatecheckbox/tristatecheckbox.esm.js +7 -3
- package/tristatecheckbox/tristatecheckbox.esm.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.js +7 -3
- package/tristatecheckbox/tristatecheckbox.min.js +1 -1
- package/web-types.json +302 -11
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var hooks = require('primereact/hooks');
|
|
8
|
+
var api = require('primereact/api');
|
|
9
|
+
var componentbase = require('primereact/componentbase');
|
|
10
|
+
var InputText = require('@/components/lib/inputtext/InputText');
|
|
11
|
+
var utils = require('primereact/utils');
|
|
12
|
+
|
|
13
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
+
|
|
15
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
16
|
+
|
|
17
|
+
function _extends() {
|
|
18
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
19
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
20
|
+
var source = arguments[i];
|
|
21
|
+
for (var key in source) {
|
|
22
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
23
|
+
target[key] = source[key];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
};
|
|
29
|
+
return _extends.apply(this, arguments);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function _arrayLikeToArray(arr, len) {
|
|
33
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
34
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
35
|
+
return arr2;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function _arrayWithoutHoles(arr) {
|
|
39
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function _iterableToArray(iter) {
|
|
43
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
47
|
+
if (!o) return;
|
|
48
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
49
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
50
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
51
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
52
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function _nonIterableSpread() {
|
|
56
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function _toConsumableArray(arr) {
|
|
60
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function _readOnlyError(name) {
|
|
64
|
+
throw new TypeError("\"" + name + "\" is read-only");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function _arrayWithHoles(arr) {
|
|
68
|
+
if (Array.isArray(arr)) return arr;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function _iterableToArrayLimit(r, l) {
|
|
72
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
73
|
+
if (null != t) {
|
|
74
|
+
var e,
|
|
75
|
+
n,
|
|
76
|
+
i,
|
|
77
|
+
u,
|
|
78
|
+
a = [],
|
|
79
|
+
f = !0,
|
|
80
|
+
o = !1;
|
|
81
|
+
try {
|
|
82
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
83
|
+
if (Object(t) !== t) return;
|
|
84
|
+
f = !1;
|
|
85
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
86
|
+
} catch (r) {
|
|
87
|
+
o = !0, n = r;
|
|
88
|
+
} finally {
|
|
89
|
+
try {
|
|
90
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
91
|
+
} finally {
|
|
92
|
+
if (o) throw n;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return a;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function _nonIterableRest() {
|
|
100
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function _slicedToArray(arr, i) {
|
|
104
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function _typeof(o) {
|
|
108
|
+
"@babel/helpers - typeof";
|
|
109
|
+
|
|
110
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
111
|
+
return typeof o;
|
|
112
|
+
} : function (o) {
|
|
113
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
114
|
+
}, _typeof(o);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function _toPrimitive(input, hint) {
|
|
118
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
119
|
+
var prim = input[Symbol.toPrimitive];
|
|
120
|
+
if (prim !== undefined) {
|
|
121
|
+
var res = prim.call(input, hint || "default");
|
|
122
|
+
if (_typeof(res) !== "object") return res;
|
|
123
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
124
|
+
}
|
|
125
|
+
return (hint === "string" ? String : Number)(input);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function _toPropertyKey(arg) {
|
|
129
|
+
var key = _toPrimitive(arg, "string");
|
|
130
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function _defineProperty(obj, key, value) {
|
|
134
|
+
key = _toPropertyKey(key);
|
|
135
|
+
if (key in obj) {
|
|
136
|
+
Object.defineProperty(obj, key, {
|
|
137
|
+
value: value,
|
|
138
|
+
enumerable: true,
|
|
139
|
+
configurable: true,
|
|
140
|
+
writable: true
|
|
141
|
+
});
|
|
142
|
+
} else {
|
|
143
|
+
obj[key] = value;
|
|
144
|
+
}
|
|
145
|
+
return obj;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
var classes = {
|
|
149
|
+
root: 'p-inputotp p-component',
|
|
150
|
+
input: 'p-inputotp-input'
|
|
151
|
+
};
|
|
152
|
+
var InputOtpBase = componentbase.ComponentBase.extend({
|
|
153
|
+
defaultProps: {
|
|
154
|
+
__TYPE: 'InputOtp',
|
|
155
|
+
__parentMetadata: null,
|
|
156
|
+
className: null,
|
|
157
|
+
modelValue: false,
|
|
158
|
+
invalid: false,
|
|
159
|
+
disabled: false,
|
|
160
|
+
readOnly: false,
|
|
161
|
+
variant: null,
|
|
162
|
+
tabIndex: null,
|
|
163
|
+
length: 4,
|
|
164
|
+
mask: false,
|
|
165
|
+
integerOnly: false
|
|
166
|
+
},
|
|
167
|
+
css: {
|
|
168
|
+
classes: classes
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
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; }
|
|
173
|
+
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; }
|
|
174
|
+
var InputOtp = /*#__PURE__*/React__default["default"].memo( /*#__PURE__*/React__default["default"].forwardRef(function (inProps, ref) {
|
|
175
|
+
var _props$value, _props$value$split;
|
|
176
|
+
var elementRef = React.useRef(ref);
|
|
177
|
+
var mergeProps = hooks.useMergeProps();
|
|
178
|
+
var context = React.useContext(api.PrimeReactContext);
|
|
179
|
+
var props = InputOtpBase.getProps(inProps, context);
|
|
180
|
+
var _InputOtpBase$setMeta = InputOtpBase.setMetaData(_objectSpread(_objectSpread({
|
|
181
|
+
props: props
|
|
182
|
+
}, props.__parentMetadata), {}, {
|
|
183
|
+
context: {
|
|
184
|
+
disabled: props.disabled
|
|
185
|
+
}
|
|
186
|
+
})),
|
|
187
|
+
ptm = _InputOtpBase$setMeta.ptm,
|
|
188
|
+
cx = _InputOtpBase$setMeta.cx,
|
|
189
|
+
isUnstyled = _InputOtpBase$setMeta.isUnstyled;
|
|
190
|
+
componentbase.useHandleStyle(InputOtpBase.css.styles, isUnstyled, {
|
|
191
|
+
name: 'inputotp'
|
|
192
|
+
});
|
|
193
|
+
var defaultValue = props.value ? (_props$value = props.value) === null || _props$value === void 0 || (_props$value = _props$value.toString()) === null || _props$value === void 0 || (_props$value$split = _props$value.split) === null || _props$value$split === void 0 ? void 0 : _props$value$split.call(_props$value, '') : new Array(props.length);
|
|
194
|
+
var _useState = React.useState(defaultValue),
|
|
195
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
196
|
+
tokens = _useState2[0],
|
|
197
|
+
setTokens = _useState2[1];
|
|
198
|
+
var findNextInput = function findNextInput(element) {
|
|
199
|
+
var nextInput = element.nextElementSibling;
|
|
200
|
+
if (!nextInput) return;
|
|
201
|
+
return nextInput.nodeName === 'INPUT' ? nextInput : findNextInput(nextInput);
|
|
202
|
+
};
|
|
203
|
+
var findPrevInput = function findPrevInput(element) {
|
|
204
|
+
var prevInput = element.previousElementSibling;
|
|
205
|
+
if (!prevInput) return;
|
|
206
|
+
return prevInput.nodeName === 'INPUT' ? prevInput : findPrevInput(prevInput);
|
|
207
|
+
};
|
|
208
|
+
var moveToNextInput = function moveToNextInput(event) {
|
|
209
|
+
var nextInput = findNextInput(event.target);
|
|
210
|
+
if (nextInput) {
|
|
211
|
+
nextInput.focus();
|
|
212
|
+
nextInput.select();
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
var moveToPrevInput = function moveToPrevInput(event) {
|
|
216
|
+
var prevInput = findPrevInput(event.target);
|
|
217
|
+
if (prevInput) {
|
|
218
|
+
prevInput.focus();
|
|
219
|
+
prevInput.select();
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
var onChange = function onChange(event, value) {
|
|
223
|
+
var _props$onChange;
|
|
224
|
+
props === null || props === void 0 || (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, {
|
|
225
|
+
originalEvent: event,
|
|
226
|
+
value: value.join('')
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
var updateTokens = function updateTokens(event, index) {
|
|
230
|
+
var inputValue = event.target.value;
|
|
231
|
+
var newTokens = _toConsumableArray(tokens);
|
|
232
|
+
newTokens[index] = inputValue;
|
|
233
|
+
newTokens.join(''), _readOnlyError("newTokens");
|
|
234
|
+
newTokens ? newTokens.split('') : new Array(props.length), _readOnlyError("newTokens");
|
|
235
|
+
setTokens(newTokens);
|
|
236
|
+
onChange(event, newTokens);
|
|
237
|
+
};
|
|
238
|
+
var _onInput = function onInput(event, index) {
|
|
239
|
+
updateTokens(event, index);
|
|
240
|
+
if (event.nativeEvent.inputType === 'deleteContentBackward') {
|
|
241
|
+
moveToPrevInput(event);
|
|
242
|
+
} else if (event.nativeEvent.inputType === 'insertText' || event.nativeEvent.inputType === 'deleteContentForward') {
|
|
243
|
+
moveToNextInput(event);
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
var onPaste = function onPaste(event) {
|
|
247
|
+
var paste = event.clipboardData.getData('text');
|
|
248
|
+
if (paste.length) {
|
|
249
|
+
var pastedCode = paste.substring(0, props.length + 1);
|
|
250
|
+
if (!props.integerOnly || !isNaN(pastedCode)) {
|
|
251
|
+
var newTokens = pastedCode.split('');
|
|
252
|
+
setTokens(newTokens);
|
|
253
|
+
onChange(event, newTokens);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
var onFocus = function onFocus(event) {
|
|
258
|
+
var _props$focus;
|
|
259
|
+
event.target.select();
|
|
260
|
+
props === null || props === void 0 || (_props$focus = props.focus) === null || _props$focus === void 0 || _props$focus.call(props, event);
|
|
261
|
+
};
|
|
262
|
+
var onBlur = function onBlur(event) {
|
|
263
|
+
var _props$blur;
|
|
264
|
+
props === null || props === void 0 || (_props$blur = props.blur) === null || _props$blur === void 0 || _props$blur.call(props, event);
|
|
265
|
+
};
|
|
266
|
+
var onKeydown = function onKeydown(event) {
|
|
267
|
+
switch (event.code) {
|
|
268
|
+
case 'ArrowLeft':
|
|
269
|
+
{
|
|
270
|
+
moveToPrevInput(event);
|
|
271
|
+
event.preventDefault();
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
case 'ArrowRight':
|
|
275
|
+
{
|
|
276
|
+
moveToNextInput(event);
|
|
277
|
+
event.preventDefault();
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
case 'Backspace':
|
|
281
|
+
{
|
|
282
|
+
var _event$target;
|
|
283
|
+
if (((_event$target = event.target) === null || _event$target === void 0 || (_event$target = _event$target.value) === null || _event$target === void 0 ? void 0 : _event$target.length) === 0) {
|
|
284
|
+
moveToPrevInput(event);
|
|
285
|
+
event.preventDefault();
|
|
286
|
+
}
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
case 'ArrowUp':
|
|
290
|
+
case 'ArrowDown':
|
|
291
|
+
{
|
|
292
|
+
event.preventDefault();
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
default:
|
|
296
|
+
{
|
|
297
|
+
// Prevent non-numeric characters from being entered if integerOnly is true or if the length of the input is greater than the specified length
|
|
298
|
+
if (props !== null && props !== void 0 && props.integerOnly && !((event.code.startsWith('Digit') || event.code.startsWith('Numpad')) && Number(event.key) >= 0 && Number(event.key) <= 9) || tokens.join('').length >= props.length && event.code !== 'Delete') {
|
|
299
|
+
event.preventDefault();
|
|
300
|
+
}
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
var createInputElements = function createInputElements(remainingInputs) {
|
|
306
|
+
if (remainingInputs <= 0) {
|
|
307
|
+
return [];
|
|
308
|
+
}
|
|
309
|
+
var inputElementIndex = props.length - remainingInputs;
|
|
310
|
+
var inputElementEvents = {
|
|
311
|
+
onInput: function onInput(event) {
|
|
312
|
+
return _onInput(event, inputElementIndex);
|
|
313
|
+
},
|
|
314
|
+
onKeyDown: onKeydown,
|
|
315
|
+
onFocus: onFocus,
|
|
316
|
+
onBlur: onBlur,
|
|
317
|
+
onPaste: onPaste
|
|
318
|
+
};
|
|
319
|
+
var inputElementProps = mergeProps({
|
|
320
|
+
id: inputElementIndex,
|
|
321
|
+
key: inputElementIndex,
|
|
322
|
+
value: tokens[inputElementIndex] || '',
|
|
323
|
+
inputMode: props !== null && props !== void 0 && props.integerOnly ? 'numeric' : 'text',
|
|
324
|
+
type: props !== null && props !== void 0 && props.mask ? 'password' : 'text',
|
|
325
|
+
variant: props === null || props === void 0 ? void 0 : props.variant,
|
|
326
|
+
readOnly: props === null || props === void 0 ? void 0 : props.readOnly,
|
|
327
|
+
disabled: props === null || props === void 0 ? void 0 : props.disabled,
|
|
328
|
+
invalid: props === null || props === void 0 ? void 0 : props.invalid,
|
|
329
|
+
tabIndex: props === null || props === void 0 ? void 0 : props.tabIndex,
|
|
330
|
+
unstyled: props === null || props === void 0 ? void 0 : props.unstyled,
|
|
331
|
+
className: cx('input')
|
|
332
|
+
}, ptm('input'));
|
|
333
|
+
var inputElement = props !== null && props !== void 0 && props.inputTemplate ? utils.ObjectUtils.getJSXElement(props === null || props === void 0 ? void 0 : props.inputTemplate, {
|
|
334
|
+
events: inputElementEvents,
|
|
335
|
+
props: inputElementProps
|
|
336
|
+
}) : /*#__PURE__*/React__default["default"].createElement(InputText.InputText, _extends({}, inputElementProps, inputElementEvents));
|
|
337
|
+
var inputElements = [inputElement].concat(_toConsumableArray(createInputElements(remainingInputs - 1)));
|
|
338
|
+
return inputElements;
|
|
339
|
+
};
|
|
340
|
+
var rootElementProps = mergeProps({
|
|
341
|
+
className: cx('root'),
|
|
342
|
+
ref: elementRef,
|
|
343
|
+
style: props === null || props === void 0 ? void 0 : props.style
|
|
344
|
+
}, ptm('root'));
|
|
345
|
+
return /*#__PURE__*/React__default["default"].createElement("div", rootElementProps, createInputElements(props.length));
|
|
346
|
+
}));
|
|
347
|
+
|
|
348
|
+
exports.InputOtp = InputOtp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/hooks"),n=require("primereact/api"),r=require("primereact/componentbase"),o=require("@/components/lib/inputtext/InputText"),l=require("primereact/utils");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=a(e);function u(){return u=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},u.apply(this,arguments)}function c(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 s(e){if(Array.isArray(e))return c(e)}function p(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function f(e,t){if(e){if("string"==typeof e)return c(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)?c(e,t):void 0}}function d(){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 v(e){return s(e)||p(e)||f(e)||d()}function y(e){throw new TypeError('"'+e+'" is read-only')}function b(e){if(Array.isArray(e))return e}function m(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,l,a,i=[],u=!0,c=!1;try{if(l=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=l.call(n)).done)&&(i.push(r.value),i.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return i}}function g(){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 h(e){return h="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},h(e)}function O(e,t){if("object"!==h(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function w(e){var t=O(e,"string");return"symbol"===h(t)?t:String(t)}var j=r.ComponentBase.extend({defaultProps:{__TYPE:"InputOtp",__parentMetadata:null,className:null,modelValue:!1,invalid:!1,disabled:!1,readOnly:!1,variant:null,tabIndex:null,length:4,mask:!1,integerOnly:!1},css:{classes:{root:"p-inputotp p-component",input:"p-inputotp-input"}}});function S(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 P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S(Object(n),!0).forEach((function(t){var r,o,l;r=e,l=n[t],(o=w(o=t))in r?Object.defineProperty(r,o,{value:l,enumerable:!0,configurable:!0,writable:!0}):r[o]=l})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}exports.InputOtp=i.default.memo(i.default.forwardRef((function(a,c){var s,p,d=e.useRef(c),h=t.useMergeProps(),O=e.useContext(n.PrimeReactContext),w=j.getProps(a,O),S=j.setMetaData(P(P({props:w},w.__parentMetadata),{},{context:{disabled:w.disabled}})),x=S.ptm,T=S.cx;r.useHandleStyle(j.css.styles,S.isUnstyled,{name:"inputotp"});var D,E,k=w.value?null===(s=w.value)||void 0===s||null===(s=s.toString())||void 0===s||null===(p=s.split)||void 0===p?void 0:p.call(s,""):new Array(w.length),A=e.useState(k),I=(E=2,b(D=A)||m(D,E)||f(D,E)||g()),N=I[0],_=I[1],C=function e(t){var n=t.nextElementSibling;if(n)return"INPUT"===n.nodeName?n:e(n)},M=function e(t){var n=t.previousElementSibling;if(n)return"INPUT"===n.nodeName?n:e(n)},q=function(e){var t=C(e.target);t&&(t.focus(),t.select())},U=function(e){var t=M(e.target);t&&(t.focus(),t.select())},B=function(e,t){var n;null==w||null===(n=w.onChange)||void 0===n||n.call(w,{originalEvent:e,value:t.join("")})},R=function(e,t){var n=e.target.value,r=v(N);r[t]=n,r.join(""),y("newTokens"),r?r.split(""):new Array(w.length),y("newTokens"),_(r),B(e,r)},F=function(e,t){R(e,t),"deleteContentBackward"===e.nativeEvent.inputType?U(e):"insertText"!==e.nativeEvent.inputType&&"deleteContentForward"!==e.nativeEvent.inputType||q(e)},W=function(e){var t=e.clipboardData.getData("text");if(t.length){var n=t.substring(0,w.length+1);if(!w.integerOnly||!isNaN(n)){var r=n.split("");_(r),B(e,r)}}},H=function(e){var t;e.target.select(),null==w||null===(t=w.focus)||void 0===t||t.call(w,e)},J=function(e){var t;null==w||null===(t=w.blur)||void 0===t||t.call(w,e)},K=function(e){switch(e.code){case"ArrowLeft":U(e),e.preventDefault();break;case"ArrowRight":q(e),e.preventDefault();break;case"Backspace":var t;0===(null===(t=e.target)||void 0===t||null===(t=t.value)||void 0===t?void 0:t.length)&&(U(e),e.preventDefault());break;case"ArrowUp":case"ArrowDown":e.preventDefault();break;default:(null!=w&&w.integerOnly&&!((e.code.startsWith("Digit")||e.code.startsWith("Numpad"))&&Number(e.key)>=0&&Number(e.key)<=9)||N.join("").length>=w.length&&"Delete"!==e.code)&&e.preventDefault()}},L=h({className:T("root"),ref:d,style:null==w?void 0:w.style},x("root"));return i.default.createElement("div",L,function e(t){if(t<=0)return[];var n=w.length-t,r={onInput:function(e){return F(e,n)},onKeyDown:K,onFocus:H,onBlur:J,onPaste:W},a=h({id:n,key:n,value:N[n]||"",inputMode:null!=w&&w.integerOnly?"numeric":"text",type:null!=w&&w.mask?"password":"text",variant:null==w?void 0:w.variant,readOnly:null==w?void 0:w.readOnly,disabled:null==w?void 0:w.disabled,invalid:null==w?void 0:w.invalid,tabIndex:null==w?void 0:w.tabIndex,unstyled:null==w?void 0:w.unstyled,className:T("input")},x("input"));return[null!=w&&w.inputTemplate?l.ObjectUtils.getJSXElement(null==w?void 0:w.inputTemplate,{events:r,props:a}):i.default.createElement(o.InputText,u({},a,r))].concat(v(e(t-1)))}(w.length))})));
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* InputOtp is an extension to standard input element with theming and keyfiltering.
|
|
4
|
+
*
|
|
5
|
+
* [Live Demo](https://www.primereact.org/inputotp/)
|
|
6
|
+
*
|
|
7
|
+
* @module inputotp
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
import { ComponentHooks } from '../componentbase/componentbase';
|
|
12
|
+
import { KeyFilterType } from '../keyfilter';
|
|
13
|
+
import { PassThroughOptions } from '../passthrough';
|
|
14
|
+
import { TooltipPassThroughOptions } from '../tooltip/tooltip';
|
|
15
|
+
import { TooltipOptions } from '../tooltip/tooltipoptions';
|
|
16
|
+
import { PassThroughType, TemplateType } from '../utils/utils';
|
|
17
|
+
|
|
18
|
+
export declare type InputOtpPassThroughType<T> = PassThroughType<T, InputOtpPassThroughMethodOptions>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Custom passthrough(pt) option method.
|
|
22
|
+
*/
|
|
23
|
+
export interface InputOtpPassThroughMethodOptions {
|
|
24
|
+
props: InputOtpProps;
|
|
25
|
+
context: InputOtpContext;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Custom passthrough(pt) options.
|
|
30
|
+
* @see {@link InputOtpProps.pt}
|
|
31
|
+
*/
|
|
32
|
+
export interface InputOtpPassThroughOptions {
|
|
33
|
+
/**
|
|
34
|
+
* Uses to pass attributes to the root's DOM element.
|
|
35
|
+
*/
|
|
36
|
+
root?: InputOtpPassThroughType<React.HTMLAttributes<HTMLDivElement>>;
|
|
37
|
+
/**
|
|
38
|
+
* Uses to pass attributes to the Tooltip component.
|
|
39
|
+
* @see {@link TooltipPassThroughOptions}
|
|
40
|
+
*/
|
|
41
|
+
input?: InputOtpPassThroughType<React.HTMLAttributes<HTMLInputElement>>;
|
|
42
|
+
/**
|
|
43
|
+
* Used to manage all lifecycle hooks
|
|
44
|
+
* @see {@link ComponentHooks}
|
|
45
|
+
*/
|
|
46
|
+
hooks?: ComponentHooks;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Defines current options in InputOtp component.
|
|
51
|
+
*/
|
|
52
|
+
export interface InputOtpContext {
|
|
53
|
+
/**
|
|
54
|
+
* Current disabled state of the component as a boolean.
|
|
55
|
+
* @defaultValue false
|
|
56
|
+
*/
|
|
57
|
+
disabled: boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Custom change event
|
|
62
|
+
* @see {@link InputOtpProps.onChange}
|
|
63
|
+
* @event
|
|
64
|
+
*/
|
|
65
|
+
interface InputOtpChangeEvent {
|
|
66
|
+
/**
|
|
67
|
+
* Browser event
|
|
68
|
+
*/
|
|
69
|
+
originalEvent: React.SyntheticEvent;
|
|
70
|
+
/**
|
|
71
|
+
* New value
|
|
72
|
+
*/
|
|
73
|
+
value?: string | number | null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Defines valid properties in InputOtp component. In addition to these, all properties of HTMLInputElement can be used in this component.
|
|
78
|
+
* @group Properties
|
|
79
|
+
*/
|
|
80
|
+
export interface InputOtpProps extends Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, 'onInput' | 'ref' | 'value' | 'size' | 'onChange'> {
|
|
81
|
+
/**
|
|
82
|
+
* Specifies the value of the component.
|
|
83
|
+
* @defaultValue null
|
|
84
|
+
*/
|
|
85
|
+
value?: string | number | null;
|
|
86
|
+
/**
|
|
87
|
+
* When present, it specifies that the component should have invalid state style.
|
|
88
|
+
* @defaultValue false
|
|
89
|
+
*/
|
|
90
|
+
invalid?: boolean | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* When present, it specifies that the component should be disabled.
|
|
93
|
+
* @defaultValue false
|
|
94
|
+
*/
|
|
95
|
+
disabled?: boolean | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* When present, it specifies that an input field is read-only.
|
|
98
|
+
* @defaultValue false
|
|
99
|
+
*/
|
|
100
|
+
readonly?: boolean | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Specifies the input variant of the component.
|
|
103
|
+
* @defaultValue outlined
|
|
104
|
+
*/
|
|
105
|
+
variant?: 'outlined' | 'filled' | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Index of the element in tabbing order.
|
|
108
|
+
*/
|
|
109
|
+
tabindex?: number | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Number of characters to initiate.
|
|
112
|
+
* @defaultValue 4
|
|
113
|
+
*/
|
|
114
|
+
length?: number | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* Mask pattern.
|
|
117
|
+
* @defaultValue false
|
|
118
|
+
*/
|
|
119
|
+
mask?: boolean | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* When present, it specifies that an input field is integer-only.
|
|
122
|
+
* @defaultValue false
|
|
123
|
+
*/
|
|
124
|
+
integerOnly?: boolean | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Template of an item.
|
|
127
|
+
*/
|
|
128
|
+
inputTemplate?: TemplateType<InputOtpProps> | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Callback to invoke while typing value on input
|
|
131
|
+
* @param {React.FormEvent<HTMLInputElement>} event - Browser event
|
|
132
|
+
*/
|
|
133
|
+
onInput?(event: React.FormEvent<HTMLInputElement>): void;
|
|
134
|
+
/**
|
|
135
|
+
* Callback to invoke when autocomplete gets focus.
|
|
136
|
+
* @param {React.FocusEvent<HTMLInputElement>} event - Browser event.
|
|
137
|
+
*/
|
|
138
|
+
onFocus?(event: React.FocusEvent<HTMLInputElement>): void;
|
|
139
|
+
/**
|
|
140
|
+
* Callback to invoke when autocomplete loses focus.
|
|
141
|
+
* @param {React.FocusEvent<HTMLInputElement>} event - Browser event.
|
|
142
|
+
*/
|
|
143
|
+
onBlur?(event: React.FocusEvent<HTMLInputElement>): void;
|
|
144
|
+
/**
|
|
145
|
+
* Callback to invoke on value change.
|
|
146
|
+
* @param {InputOtpChangeEvent} event - Custom change event
|
|
147
|
+
*/
|
|
148
|
+
onChange?(event: InputOtpChangeEvent): void;
|
|
149
|
+
/**
|
|
150
|
+
* Uses to pass attributes to DOM elements inside the component.
|
|
151
|
+
* @type {InputOtpPassThroughOptions}
|
|
152
|
+
*/
|
|
153
|
+
pt?: InputOtpPassThroughOptions;
|
|
154
|
+
/**
|
|
155
|
+
* Used to configure passthrough(pt) options of the component.
|
|
156
|
+
* @type {PassThroughOptions}
|
|
157
|
+
*/
|
|
158
|
+
ptOptions?: PassThroughOptions;
|
|
159
|
+
/**
|
|
160
|
+
* When enabled, it removes component related styles in the core.
|
|
161
|
+
* @defaultValue false
|
|
162
|
+
*/
|
|
163
|
+
unstyled?: boolean;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* **PrimeReact - InputOtp**
|
|
168
|
+
*
|
|
169
|
+
* _InputOtp is an extension to standard input element with theming and keyfiltering._
|
|
170
|
+
*
|
|
171
|
+
* [Live Demo](https://www.primereact.org/inputotp/)
|
|
172
|
+
* --- ---
|
|
173
|
+
* 
|
|
174
|
+
*
|
|
175
|
+
* @group Component
|
|
176
|
+
*/
|
|
177
|
+
export declare const InputOtp: React.ForwardRefExoticComponent<InputOtpProps & React.RefAttributes<HTMLInputElement>>;
|