@nova-design-system/nova-react 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{constants-98e2dcc2-C0SBCapP.js → constants-b97e736d-BzFAKCkR.js} +11 -0
- package/dist/cjs/{index-Byv3Vmev.js → index-B2jv2KXv.js} +2856 -1620
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/{nv-alert.entry-BXY4KXbF.js → nv-alert.entry-pxBJfmIm.js} +11 -11
- package/dist/cjs/{nv-avatar.entry-BnPSKkJJ.js → nv-avatar.entry-CHtVctSK.js} +7 -7
- package/dist/cjs/nv-badge_2.entry-BO88KO1O.js +204 -0
- package/dist/cjs/{nv-breadcrumb.entry-D5vGHLOG.js → nv-breadcrumb.entry-7azRtyl5.js} +1 -1
- package/dist/cjs/{nv-breadcrumbs.entry-CsaqAsnb.js → nv-breadcrumbs.entry-DfZVMKpY.js} +1 -1
- package/dist/cjs/{nv-button.entry-DzZfGZGy.js → nv-button.entry-DW9SblsY.js} +7 -7
- package/dist/cjs/nv-calendar.entry-BeayRRor.js +1043 -0
- package/dist/cjs/{nv-col.entry-Cng8NaTW.js → nv-col.entry-C6oEkSbI.js} +1 -1
- package/dist/cjs/{nv-datagrid.entry-BbAOzpiO.js → nv-datagrid.entry-xhQP6JJP.js} +423 -94
- package/dist/cjs/{nv-datagridcolumn.entry-CRogHbVM.js → nv-datagridcolumn.entry-CjYmo4fM.js} +2 -2
- package/dist/cjs/{nv-dialog.entry-BSIZGYGF.js → nv-dialog.entry-mxETaZbc.js} +19 -13
- package/dist/cjs/{nv-dialogfooter_2.entry-Q4_li_QU.js → nv-dialogfooter_2.entry-DnLg2DHy.js} +3 -3
- package/dist/cjs/{nv-fieldcheckbox.entry-DmgzfmRd.js → nv-fieldcheckbox.entry-Be9__i15.js} +1 -1
- package/dist/cjs/{nv-fielddate.entry-qAvLX_Ru.js → nv-fielddate.entry-BlNily-X.js} +9 -18
- package/dist/cjs/nv-fielddaterange.entry-CycpKoJd.js +408 -0
- package/dist/cjs/{nv-fielddropdown.entry-DKXmoXeW.js → nv-fielddropdown.entry-BPwviyCp.js} +88 -57
- package/dist/cjs/{nv-fielddropdownitem.entry-BVLVXi0e.js → nv-fielddropdownitem.entry-BGuUR9KP.js} +2 -2
- package/dist/cjs/{nv-fieldmultiselect.entry-DrTbd3Dj.js → nv-fieldmultiselect.entry-Lrxr1gsi.js} +122 -104
- package/dist/cjs/nv-fieldnumber.entry-B1VySoWj.js +130 -0
- package/dist/cjs/nv-fieldpassword.entry-D7Qlx7Bh.js +121 -0
- package/dist/cjs/{nv-fieldradio.entry-CVEY4v6F.js → nv-fieldradio.entry-CDu8xs0p.js} +4 -4
- package/dist/cjs/{nv-fieldselect.entry-BrCUuRWa.js → nv-fieldselect.entry-NEdv8bQK.js} +11 -7
- package/dist/cjs/nv-fieldslider.entry-51gF9XPz.js +660 -0
- package/dist/cjs/nv-fieldtext.entry-Bug9zMgo.js +123 -0
- package/dist/cjs/{nv-fieldtextarea.entry-B4qiLmX1.js → nv-fieldtextarea.entry-D44HbsVQ.js} +9 -5
- package/dist/cjs/{nv-fieldtime.entry-Bp2IWjhN.js → nv-fieldtime.entry-MbaWbVtc.js} +71 -68
- package/dist/cjs/nv-icon.entry-BSSHr-ud.js +79 -0
- package/dist/cjs/{nv-iconbutton_2.entry-BRPAGl2S.js → nv-iconbutton_2.entry-DMaO-JWz.js} +3 -3
- package/dist/cjs/{nv-menu.entry-BiWiIZAm.js → nv-menu.entry-D5_lj9XB.js} +4 -2
- package/dist/cjs/{nv-menuitem.entry-CFkXoZ_r.js → nv-menuitem.entry-fhnYI91K.js} +2 -2
- package/dist/cjs/{nv-popover.entry-KT1iQUJk.js → nv-popover.entry-CYqBaVbr.js} +2 -2
- package/dist/cjs/{nv-row.entry-Cs2GDrcu.js → nv-row.entry-BUheLufV.js} +2 -2
- package/dist/cjs/{nv-stack.entry-Ci7pxGSo.js → nv-stack.entry-DNPce51E.js} +2 -2
- package/dist/cjs/{nv-table.entry-N4MV8Y6E.js → nv-table.entry-DXQM8l3t.js} +3 -3
- package/dist/cjs/{nv-tablecolumn.entry-CTz4jsZl.js → nv-tablecolumn.entry-DROQK_0c.js} +1 -1
- package/dist/cjs/{nv-toggle.entry-m10-ncYR.js → nv-toggle.entry-fMzTrdte.js} +3 -3
- package/dist/cjs/{nv-tooltip.entry-B6aRDto3.js → nv-tooltip.entry-yB2Ek1Cz.js} +3 -3
- package/dist/generated/components.js +12 -1
- package/dist/types/generated/components.d.ts +19 -7
- package/package.json +1 -1
- package/dist/cjs/nv-badge_2.entry-BsI3B8Rr.js +0 -195
- package/dist/cjs/nv-calendar.entry-CGKv_-gO.js +0 -1065
- package/dist/cjs/nv-fielddaterange.entry-DVB8Rwxk.js +0 -355
- package/dist/cjs/nv-fieldnumber.entry-DegbEHRL.js +0 -126
- package/dist/cjs/nv-fieldpassword.entry-gqjlEl7a.js +0 -117
- package/dist/cjs/nv-fieldtext.entry-q9NnqL5c.js +0 -119
- package/dist/cjs/nv-icon.entry-B1ax9cJS.js +0 -79
package/dist/cjs/{nv-fieldmultiselect.entry-DrTbd3Dj.js → nv-fieldmultiselect.entry-Lrxr1gsi.js}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-B2jv2KXv.js');
|
|
4
4
|
var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
|
|
5
5
|
require('react');
|
|
6
6
|
|
|
7
|
-
const nvFieldmultiselectCss = "nv-fieldmultiselect{--nv-field-border-default:var(--components-form-field-border-default);--nv-field-border-hover:var(--components-form-field-border-hover);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--components-form-field-border-default);--nv-field-border-readonly:var(--components-form-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-brand);--nv-field-background:var(--components-form-field-background-default);display:flex;flex-direction:column;align-items:flex-start;gap:var(--form-gap-y);box-sizing:border-box}nv-fieldmultiselect[readonly]:not([readonly=false]){--nv-field-border-default:var(--components-form-field-border-readonly);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-background:var(--components-form-field-background-readonly)}nv-fieldmultiselect[error]:not([error=false]){--nv-field-border-default:var(--components-form-field-border-error);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-destructive)}nv-fieldmultiselect[required]:not([required=false])>label::after{content:\"*\";color:var(--components-form-text-required);font-weight:700}nv-fieldmultiselect label{display:flex;align-items:center;gap:var(--form-label-gap);align-self:stretch;color:var(--components-form-text-label-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-label-font-size);font-style:normal;font-weight:500;line-height:var(--form-label-line-height)}nv-fieldmultiselect nv-popover{width:100%;display:block}nv-fieldmultiselect nv-popover [data-scope=popover]{width:100%;padding:var(--list-dropdown-padding);border-radius:var(--list-dropdown-radius);background-color:var(--components-list-dropdown-background);border:1px solid var(--components-list-dropdown-border)}nv-fieldmultiselect nv-popover [slot=content]{gap:var(--list-dropdown-gap-y);display:flex;flex-direction:column}nv-fieldmultiselect nv-popover hr{color:var(--components-list-dropdown-separator)}nv-fieldmultiselect .input-wrapper-multiselect{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch;width:100%}nv-fieldmultiselect .input-container-multiselect{display:flex;flex-grow:1;justify-content:center;align-items:center;align-self:stretch;border-radius:var(--form-field-radius);border-width:1px;border-style:solid;border-color:var(--nv-field-border-default);opacity:var(--components-form-opacity-default, 1);background:var(--nv-field-background);transition:all 150ms ease-out;position:relative;width:100%;min-height:40px;}nv-fieldmultiselect .input-container-multiselect:hover{border-color:var(--nv-field-border-hover)}nv-fieldmultiselect .input-container-multiselect:focus-within,nv-fieldmultiselect .input-container-multiselect:focus-within:hover,nv-fieldmultiselect .input-container-multiselect:focus,nv-fieldmultiselect .input-container-multiselect:focus:hover{border-color:var(--nv-field-border-focus);box-shadow:0px 0px 0px var(--focus-field-stroke) var(--nv-field-focus-box-shadow)}nv-fieldmultiselect .input-container-multiselect:has(input:read-only){opacity:0.5;background-color:var(--components-form-field-background-readonly);border-color:var(--nv-field-border-readonly)}nv-fieldmultiselect .input-container-multiselect:has(input:disabled){opacity:0.5;background-color:var(--components-form-field-background-disabled);border-color:var(--nv-field-border-disabled)}nv-fieldmultiselect .input-container-multiselect>nv-badge{margin-left:var(--form-field-padding-x)}nv-fieldmultiselect .input-container-multiselect input,nv-fieldmultiselect .input-container-multiselect p.non-filterable-text{display:flex;align-items:center;flex:1 0 0;overflow:hidden;background-color:transparent;color:var(--components-form-field-content-text);padding:var(--form-field-padding-y) var(--form-field-padding-x);font-size:var(--form-field-font-size);font-style:normal;font-weight:500;line-height:var(--form-field-line-height);width:100%;flex-grow:1;margin:0;min-height:100%;box-sizing:border-box}nv-fieldmultiselect .input-container-multiselect input:focus,nv-fieldmultiselect .input-container-multiselect p.non-filterable-text:focus{outline:none}nv-fieldmultiselect .input-container-multiselect input::placeholder,nv-fieldmultiselect .input-container-multiselect p.non-filterable-text::placeholder{overflow:hidden;color:var(--components-form-field-content-placeholder);text-overflow:ellipsis;font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-field-font-size);font-style:normal;font-weight:400;line-height:var(--form-field-line-height)}nv-fieldmultiselect .input-container-multiselect>nv-iconbutton{border:0px;border-radius:0px}nv-fieldmultiselect .input-container-multiselect>nv-iconbutton:focus-visible{border-radius:var(--button-md-border-radius);outline-offset:-3px}nv-fieldmultiselect .input-container-multiselect nv-icon.validation{color:var(--nv-field-border-default)}nv-fieldmultiselect .non-filterable-text{display:block;border-radius:var(--form-field-radius);background-color:var(--nv-field-background);color:var(--components-form-field-content-text);font-size:var(--form-field-font-size);font-weight:500;line-height:var(--form-field-line-height);box-sizing:border-box;cursor:pointer;height:100%;min-height:40px}nv-fieldmultiselect .non-filterable-text span{display:inline-block;width:100%;overflow:hidden;text-overflow:ellipsis}nv-fieldmultiselect .description{align-self:stretch;color:var(--components-form-text-description-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height)}nv-fieldmultiselect .error-description{align-self:stretch;color:var(--components-form-text-description-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height);color:var(--components-form-text-description-error)}.no-results-message{text-align:center;padding:10px;color:var(--components-form-text-description-error)}.multiselect-divider{display:block;width:100%;height:1px;background-color:var(--components-list-dropdown-separator);margin:var(--list-dropdown-item-padding-y) 0;border:0}";
|
|
7
|
+
const nvFieldmultiselectCss = "nv-fieldmultiselect{--nv-field-border-default:var(--components-form-field-border-default);--nv-field-border-hover:var(--components-form-field-border-hover);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--components-form-field-border-default);--nv-field-border-readonly:var(--components-form-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-brand);--nv-field-background:var(--components-form-field-background-default);display:flex;flex-direction:column;align-items:flex-start;gap:var(--form-gap-y);box-sizing:border-box;max-width:480px}nv-fieldmultiselect[fluid]:not([fluid=false]){max-width:unset}nv-fieldmultiselect[readonly]:not([readonly=false]){--nv-field-border-default:var(--components-form-field-border-readonly);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--components-form-field-border-focus);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-background:var(--components-form-field-background-readonly)}nv-fieldmultiselect[error]:not([error=false]){--nv-field-border-default:var(--components-form-field-border-error);--nv-field-border-hover:var(--nv-field-border-default);--nv-field-border-focus:var(--nv-field-border-default);--nv-field-border-disabled:var(--nv-field-border-default);--nv-field-border-readonly:var(--nv-field-border-default);--nv-field-focus-box-shadow:var(--color-focus-destructive-in-field)}nv-fieldmultiselect[required]:not([required=false])>label::after{content:\"*\";color:var(--components-form-text-required);font-weight:700}nv-fieldmultiselect label{display:flex;align-items:center;gap:var(--form-label-gap);align-self:stretch;color:var(--components-form-text-label-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-label-font-size);font-style:normal;font-weight:500;line-height:var(--form-label-line-height)}nv-fieldmultiselect nv-popover{width:100%;display:block}nv-fieldmultiselect nv-popover [data-scope=popover]{width:100%;padding:var(--list-dropdown-padding);border-radius:var(--list-dropdown-radius);background-color:var(--components-list-dropdown-background);border:1px solid var(--components-list-dropdown-border)}nv-fieldmultiselect nv-popover [slot=content]{gap:var(--list-dropdown-gap-y);display:flex;flex-direction:column}nv-fieldmultiselect nv-popover hr{color:var(--components-list-dropdown-separator)}nv-fieldmultiselect nv-popover div[slot=content]{max-height:calc(90vh - var(--list-dropdown-padding) * 2);overflow-y:auto;position:relative}nv-fieldmultiselect nv-popover div[slot=content]::-webkit-scrollbar{width:6px;height:6px}nv-fieldmultiselect nv-popover div[slot=content]::-webkit-scrollbar-track{background-color:var(--color-level-10-background);border-radius:9999px}nv-fieldmultiselect nv-popover div[slot=content]::-webkit-scrollbar-thumb{background-color:var(--color-gray-200);border-radius:9999px}nv-fieldmultiselect .input-wrapper-multiselect{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch;width:100%}nv-fieldmultiselect .input-container-multiselect{display:flex;flex-grow:1;justify-content:center;align-items:center;align-self:stretch;border-radius:var(--form-field-radius);border-width:1px;border-style:solid;border-color:var(--nv-field-border-default);opacity:var(--components-form-opacity-default, 1);background:var(--nv-field-background);transition:all 150ms ease-out;position:relative;width:100%;min-height:40px;}nv-fieldmultiselect .input-container-multiselect:hover{border-color:var(--nv-field-border-hover)}nv-fieldmultiselect .input-container-multiselect:focus-within,nv-fieldmultiselect .input-container-multiselect:focus-within:hover,nv-fieldmultiselect .input-container-multiselect:focus,nv-fieldmultiselect .input-container-multiselect:focus:hover{border-color:var(--nv-field-border-focus);box-shadow:0px 0px 0px var(--focus-field-stroke) var(--nv-field-focus-box-shadow)}nv-fieldmultiselect .input-container-multiselect:has(input:read-only){opacity:0.5;background-color:var(--components-form-field-background-readonly);border-color:var(--nv-field-border-readonly)}nv-fieldmultiselect .input-container-multiselect:has(input:disabled){opacity:0.5;background-color:var(--components-form-field-background-disabled);border-color:var(--nv-field-border-disabled)}nv-fieldmultiselect .input-container-multiselect>nv-badge{margin-left:var(--form-field-padding-x)}nv-fieldmultiselect .input-container-multiselect input,nv-fieldmultiselect .input-container-multiselect p.non-filterable-text{display:flex;align-items:center;flex:1 0 0;overflow:hidden;background-color:transparent;color:var(--components-form-field-content-text);padding:var(--form-field-padding-y) var(--form-field-padding-x);font-size:var(--form-field-font-size);font-style:normal;font-weight:500;line-height:var(--form-field-line-height);width:100%;width:100%;flex-grow:1;margin:0;min-height:100%;box-sizing:border-box}nv-fieldmultiselect .input-container-multiselect input:focus,nv-fieldmultiselect .input-container-multiselect p.non-filterable-text:focus{outline:none}nv-fieldmultiselect .input-container-multiselect input::placeholder,nv-fieldmultiselect .input-container-multiselect p.non-filterable-text::placeholder{overflow:hidden;color:var(--components-form-field-content-placeholder);text-overflow:ellipsis;font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-field-font-size);font-style:normal;font-weight:400;line-height:var(--form-field-line-height)}nv-fieldmultiselect .input-container-multiselect>nv-iconbutton{border:0px;border-radius:0px}nv-fieldmultiselect .input-container-multiselect>nv-iconbutton:focus-visible{border-radius:var(--button-md-border-radius);outline-offset:-3px}nv-fieldmultiselect .input-container-multiselect nv-icon.validation{color:var(--nv-field-border-default)}nv-fieldmultiselect .non-filterable-text{display:block;border-radius:var(--form-field-radius);background-color:var(--nv-field-background);color:var(--components-form-field-content-text);font-size:var(--form-field-font-size);font-weight:500;line-height:var(--form-field-line-height);box-sizing:border-box;cursor:pointer;height:100%;min-height:40px}nv-fieldmultiselect .non-filterable-text span{display:inline-block;width:100%;overflow:hidden;text-overflow:ellipsis}nv-fieldmultiselect .description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);color:var(--components-form-text-description-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height)}nv-fieldmultiselect .error-description{display:flex;align-items:center;align-self:stretch;gap:var(--spacing-1);color:var(--components-form-text-description-default);font-family:\"TT Norms Pro\", sans-serif;font-size:var(--form-description-font-size);font-style:normal;line-height:var(--form-description-line-height);color:var(--components-form-text-description-error)}.no-results-message{text-align:center;padding:10px;color:var(--components-form-text-description-error)}.multiselect-divider{display:block;width:100%;height:1px;background-color:var(--components-list-dropdown-separator);margin:var(--list-dropdown-item-padding-y) 0;border:0}";
|
|
8
8
|
const NvFieldmultiselectStyle0 = nvFieldmultiselectCss;
|
|
9
9
|
|
|
10
10
|
const NvFieldmultiselect = class {
|
|
@@ -22,21 +22,24 @@ const NvFieldmultiselect = class {
|
|
|
22
22
|
*/
|
|
23
23
|
this.inputId = v4A79185f4.v4();
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* The autocomplete prop helps users fill out the input field faster by
|
|
26
|
+
* suggesting entries they've used before, like their email or address.
|
|
27
|
+
* You can turn it on to make forms more convenient or off to ensure users
|
|
28
|
+
* always type in fresh data.
|
|
26
29
|
*/
|
|
27
|
-
this.
|
|
30
|
+
this.autocomplete = 'off';
|
|
28
31
|
/**
|
|
29
|
-
*
|
|
32
|
+
* Marks the input field as required.
|
|
30
33
|
*/
|
|
31
|
-
this.
|
|
34
|
+
this.required = false;
|
|
32
35
|
/**
|
|
33
|
-
*
|
|
36
|
+
* Display the input field's content without allowing users to change it.
|
|
34
37
|
*/
|
|
35
|
-
this.
|
|
38
|
+
this.readonly = false;
|
|
36
39
|
/**
|
|
37
|
-
*
|
|
40
|
+
* Disables the input field.
|
|
38
41
|
*/
|
|
39
|
-
this.
|
|
42
|
+
this.disabled = false;
|
|
40
43
|
/**
|
|
41
44
|
* Alters the input field's appearance to indicate an error, helping users
|
|
42
45
|
* identify fields that need correction.
|
|
@@ -44,49 +47,56 @@ const NvFieldmultiselect = class {
|
|
|
44
47
|
*/
|
|
45
48
|
this.error = false;
|
|
46
49
|
/**
|
|
47
|
-
*
|
|
50
|
+
* Defines the maximum height of the multiselect list when open.
|
|
48
51
|
*/
|
|
49
|
-
this.
|
|
52
|
+
this.maxHeight = '';
|
|
50
53
|
/**
|
|
51
|
-
*
|
|
54
|
+
* State of the multiselect popover.
|
|
52
55
|
*/
|
|
53
|
-
this.
|
|
56
|
+
this.open = false;
|
|
54
57
|
/**
|
|
55
|
-
* The
|
|
58
|
+
* The text to display when no items match the filter.
|
|
56
59
|
*/
|
|
57
|
-
this.
|
|
60
|
+
this.emptyResult = 'No results found';
|
|
58
61
|
/**
|
|
59
62
|
* Enables or disables the filtering feature for the multiselect items.
|
|
60
63
|
*/
|
|
61
64
|
this.filterable = false;
|
|
62
65
|
/**
|
|
63
|
-
*
|
|
66
|
+
* Delay in milliseconds before the search is triggered when typing in the filter input.
|
|
67
|
+
* @default 300
|
|
64
68
|
*/
|
|
65
|
-
this.
|
|
69
|
+
this.debounceDelay = 300;
|
|
66
70
|
/**
|
|
67
|
-
*
|
|
71
|
+
* Applies focus to the input field as soon as the component is mounted. This
|
|
72
|
+
* is equivalent to setting the native autofocus attribute on an <input>
|
|
73
|
+
* element.
|
|
68
74
|
*/
|
|
69
|
-
this.
|
|
75
|
+
this.autofocus = false;
|
|
70
76
|
/**
|
|
71
|
-
*
|
|
77
|
+
* Allows the field to stretch and fill the entire width of its container.
|
|
72
78
|
*/
|
|
73
|
-
this.
|
|
79
|
+
this.fluid = false;
|
|
80
|
+
/**
|
|
81
|
+
* Text for the badge showing the number of selected items.
|
|
82
|
+
*/
|
|
83
|
+
this.badgeLabel = '';
|
|
84
|
+
//#endregion PROPERTIES
|
|
85
|
+
/****************************************************************************/
|
|
86
|
+
//#region STATE
|
|
74
87
|
/**
|
|
75
88
|
* The text entered by the user for filtering multiselect items.
|
|
76
89
|
*/
|
|
77
90
|
this.filterText = '';
|
|
78
91
|
/**
|
|
79
|
-
*
|
|
80
|
-
* @default 300
|
|
92
|
+
* List of selected values in the multiselect.
|
|
81
93
|
*/
|
|
82
|
-
this.
|
|
83
|
-
this.isHandlingEscape = false;
|
|
94
|
+
this.selectedValues = [];
|
|
84
95
|
/**
|
|
85
|
-
*
|
|
86
|
-
* is equivalent to setting the native autofocus attribute on an <input>
|
|
87
|
-
* element.
|
|
96
|
+
* Sorted options for display.
|
|
88
97
|
*/
|
|
89
|
-
this.
|
|
98
|
+
this.sortedOptions = [];
|
|
99
|
+
this.isHandlingEscape = false;
|
|
90
100
|
/**
|
|
91
101
|
* Handle badge close for options mode.
|
|
92
102
|
*/
|
|
@@ -296,82 +306,45 @@ const NvFieldmultiselect = class {
|
|
|
296
306
|
* @returns {any} The JSX for options mode
|
|
297
307
|
*/
|
|
298
308
|
this.renderOptionsMode = () => {
|
|
299
|
-
return (index.h(index.Host,
|
|
309
|
+
return (index.h(index.Host, { "aria-label": this.label, "aria-expanded": this.open.toString() }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { htmlFor: this.inputId }, index.h("slot", { name: "label" }, this.label))), index.h("nv-popover", { ref: el => (this.popoverElement = el), triggerMode: "controlled", placement: "bottom-start", open: this.open }, index.h("div", { class: "input-wrapper-multiselect", slot: "trigger" }, index.h("slot", { name: "before-input" }), index.h("div", { class: "input-container-multiselect" }, index.h("slot", { name: "leading-input" }), this.selectedValues.length > 0 && (index.h("nv-badge", { slot: "leading-input", "prevent-auto-close": true, color: "10", dismissible: this.selectedValues.length > 0, label: `${this.selectedValues.length} ${this.badgeLabel}`, "aria-label": `Clear all ${this.selectedValues.length} ${this.badgeLabel} items`, onCloseClicked: this.handleBadgeCloseOptions })), this.filterable || this.disabled || this.readonly ? (index.h("input", { type: "text", id: this.inputId, ref: e => (this.inputElement = e), autofocus: this.autofocus, autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, value: this.value, required: this.required, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInputOptions, onFocus: this.handleInputFocusOptions, onBlur: this.handleInputBlurOptions, onKeyDown: this.handleKeyDown, "data-scope": "focusable" })) : (index.h("p", { id: this.inputId, class: "non-filterable-text", onClick: this.handleInputContainerClickOptions, tabIndex: 0, onKeyDown: this.handleKeyDown, onFocus: this.handleInputFocusOptions, role: "combobox", "aria-expanded": this.open, "data-scope": "focusable" }, index.h("span", null, this.value || this.placeholder))), this.error && (index.h("nv-icon", { name: "alert-circle", class: "validation", size: "md" })), index.h("nv-iconbutton", { "data-scope": "toggle-dropdown", name: this.open ? 'chevron-top' : 'chevron-down', size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide dropdown' : 'Show dropdown', "aria-pressed": this.open.toString(), onClick: this.togglePopoverOptions })), index.h("slot", { name: "after-input" })), index.h("div", { slot: "content", role: "listbox", "aria-multiselectable": "true", style: this.maxHeight ? { maxHeight: this.maxHeight } : {} }, index.h("ul", { role: "content" }, this.options.map(option => (index.h("nv-fielddropdownitemcheck", { label: option.label, description: option.description, value: option.value, checked: this.selectedValues.includes(option.value), disabled: option.disabled }))), index.h("hr", { class: "multiselect-divider", style: { display: 'none' } })))), this.renderDescriptions()));
|
|
300
310
|
};
|
|
301
311
|
/**
|
|
302
312
|
* Renders the component in slots mode
|
|
303
313
|
* @returns {any} The JSX for slots mode
|
|
304
314
|
*/
|
|
305
315
|
this.renderSlotsMode = () => {
|
|
306
|
-
return (index.h(index.Host,
|
|
316
|
+
return (index.h(index.Host, { "aria-label": this.label, "aria-expanded": this.open.toString() }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { htmlFor: this.inputId }, index.h("slot", { name: "label" }, this.label))), index.h("nv-popover", { ref: el => (this.popoverElement = el), triggerMode: "controlled", placement: "bottom-start", open: this.open }, index.h("div", { class: "input-wrapper-multiselect", slot: "trigger" }, index.h("slot", { name: "before-input" }), index.h("div", { class: "input-container-multiselect", onClick: this.handleInputContainerClickSlots }, index.h("slot", { name: "leading-input" }), this.selectedValues.length > 0 && (index.h("nv-badge", { slot: "leading-input", "prevent-auto-close": true, color: "10", dismissible: this.selectedValues.length > 0, label: `${this.selectedValues.length} ${this.badgeLabel}`, "aria-label": `Clear all ${this.selectedValues.length} ${this.badgeLabel} items`, onCloseClicked: this.handleBadgeCloseSlots })), this.filterable || this.disabled || this.readonly ? (index.h("input", { id: this.inputId, ref: e => (this.inputElement = e), autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, value: this.value, required: this.required, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInputSlots, onFocus: this.handleInputFocusSlots, onBlur: this.handleInputBlurSlots, onKeyDown: this.handleKeyDown, "data-scope": "focusable" })) : (index.h("p", { id: this.inputId, class: "non-filterable-text", onClick: this.handleInputContainerClickSlots, tabIndex: 0, onKeyDown: this.handleKeyDown, onFocus: this.handleInputFocusSlots, role: "combobox", "aria-expanded": this.open, "data-scope": "focusable" }, index.h("span", null, this.value || this.placeholder))), this.error && (index.h("nv-icon", { name: "alert-circle", class: "validation", size: "md" })), index.h("nv-iconbutton", { "data-scope": "toggle-dropdown", name: this.open ? 'chevron-top' : 'chevron-down', size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide dropdown' : 'Show dropdown', "aria-pressed": this.open.toString(), onClick: this.togglePopoverSlots })), index.h("slot", { name: "after-input" })), index.h("div", { slot: "content", role: "listbox", "aria-multiselectable": "true", style: this.maxHeight ? { maxHeight: this.maxHeight } : {} }, index.h("slot", { name: "content" }))), this.renderDescriptions()));
|
|
307
317
|
};
|
|
308
318
|
}
|
|
309
|
-
//#endregion
|
|
319
|
+
//#endregion EVENTS
|
|
310
320
|
/****************************************************************************/
|
|
311
|
-
//#region
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
* Set the mode state and handle options change.
|
|
320
|
-
*/
|
|
321
|
-
componentWillLoad() {
|
|
322
|
-
var _a;
|
|
323
|
-
// Don't call handleOptionsChange if we are in slots mode
|
|
324
|
-
if (this.options) {
|
|
325
|
-
this.handleOptionsChange(this.options);
|
|
326
|
-
}
|
|
327
|
-
// Specific initialization for slots mode
|
|
328
|
-
if (!this.options) {
|
|
329
|
-
Promise.resolve().then(() => {
|
|
330
|
-
const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
|
|
331
|
-
// Initialize selectedValues with checked items
|
|
332
|
-
this.selectedValues = items
|
|
333
|
-
.filter(item => item.hasAttribute('checked'))
|
|
334
|
-
.map(item => item.getAttribute('value') || '');
|
|
335
|
-
// Force a reorder after initialization
|
|
336
|
-
requestAnimationFrame(() => {
|
|
337
|
-
this.reorderSlotContent();
|
|
338
|
-
});
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
// Initialize the sorted options array with the parsed options for initial rendering
|
|
342
|
-
if (this.options) {
|
|
343
|
-
this.sortedOptions = [...((_a = this.options) !== null && _a !== void 0 ? _a : [])];
|
|
344
|
-
}
|
|
345
|
-
// Apply filtering if the multiselect is filterable and there is a value
|
|
346
|
-
if (this.filterable && this.value) {
|
|
347
|
-
this.filterText = String(this.value).toLocaleLowerCase();
|
|
348
|
-
this.filterItems();
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
// Reset visibility state of all dropdown items
|
|
352
|
-
this.resetFilter();
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Force reorder if options mode in componentDidLoad because of the initial render not trigger @watch
|
|
357
|
-
*/
|
|
358
|
-
componentDidLoad() {
|
|
359
|
-
if (this.options) {
|
|
360
|
-
this.handleOptionsChange(this.options);
|
|
361
|
-
}
|
|
321
|
+
//#region WATCHERS
|
|
322
|
+
handleOptionsChange(newValue) {
|
|
323
|
+
if (!newValue)
|
|
324
|
+
return;
|
|
325
|
+
this.selectedValues = newValue
|
|
326
|
+
.filter(option => option.checked)
|
|
327
|
+
.map(option => option.value);
|
|
328
|
+
this.reorderOptionsContent();
|
|
362
329
|
}
|
|
363
330
|
/**
|
|
364
|
-
*
|
|
331
|
+
* Emitted when the value changes.
|
|
365
332
|
*/
|
|
366
|
-
|
|
367
|
-
|
|
333
|
+
watchValueHandler() {
|
|
334
|
+
// Handle value change and update the corresponding multiselect item if it exists
|
|
335
|
+
this.setInitialSelection();
|
|
368
336
|
}
|
|
337
|
+
//#endregion WATCHERS
|
|
338
|
+
/****************************************************************************/
|
|
339
|
+
//#region LISTENERS
|
|
369
340
|
/**
|
|
370
341
|
* Emitted when the input loses focus.
|
|
371
342
|
* @param {CustomEvent<boolean>} event - The event object containing the focus state.
|
|
372
343
|
*/
|
|
373
344
|
handleOpenChanged(event) {
|
|
374
|
-
//
|
|
345
|
+
// Stop propagation to prevent the event from affecting parent components like dialogs
|
|
346
|
+
event.stopPropagation();
|
|
347
|
+
// Update `open` based on the popover state
|
|
375
348
|
this.open = event.detail;
|
|
376
349
|
if (this.open) {
|
|
377
350
|
// Filter items only if there is filter text
|
|
@@ -421,21 +394,6 @@ const NvFieldmultiselect = class {
|
|
|
421
394
|
console.warn('Received itemChecked event with undefined or null value'); // Warning log
|
|
422
395
|
}
|
|
423
396
|
}
|
|
424
|
-
handleOptionsChange(newValue) {
|
|
425
|
-
if (!newValue)
|
|
426
|
-
return;
|
|
427
|
-
this.selectedValues = newValue
|
|
428
|
-
.filter(option => option.checked)
|
|
429
|
-
.map(option => option.value);
|
|
430
|
-
this.reorderOptionsContent();
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* Emitted when the value changes.
|
|
434
|
-
*/
|
|
435
|
-
watchValueHandler() {
|
|
436
|
-
// Handle value change and update the corresponding multiselect item if it exists
|
|
437
|
-
this.setInitialSelection();
|
|
438
|
-
}
|
|
439
397
|
// Add a listener for the slot content
|
|
440
398
|
handleSlotChange(event) {
|
|
441
399
|
// Check: we only want to reorder if it's the "content" slot
|
|
@@ -448,7 +406,67 @@ const NvFieldmultiselect = class {
|
|
|
448
406
|
});
|
|
449
407
|
}
|
|
450
408
|
}
|
|
451
|
-
//#endregion
|
|
409
|
+
//#endregion LISTENERS
|
|
410
|
+
/****************************************************************************/
|
|
411
|
+
//#region LIFECYCLE
|
|
412
|
+
/**
|
|
413
|
+
* Subscribe to click outside event.
|
|
414
|
+
*/
|
|
415
|
+
connectedCallback() {
|
|
416
|
+
document.addEventListener('click', this.handleClickOutside.bind(this));
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Set the mode state and handle options change.
|
|
420
|
+
*/
|
|
421
|
+
componentWillLoad() {
|
|
422
|
+
var _a;
|
|
423
|
+
// Don't call handleOptionsChange if we are in slots mode
|
|
424
|
+
if (this.options) {
|
|
425
|
+
this.handleOptionsChange(this.options);
|
|
426
|
+
}
|
|
427
|
+
// Specific initialization for slots mode
|
|
428
|
+
if (!this.options) {
|
|
429
|
+
Promise.resolve().then(() => {
|
|
430
|
+
const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
|
|
431
|
+
// Initialize selectedValues with checked items
|
|
432
|
+
this.selectedValues = items
|
|
433
|
+
.filter(item => item.hasAttribute('checked'))
|
|
434
|
+
.map(item => item.getAttribute('value') || '');
|
|
435
|
+
// Force a reorder after initialization
|
|
436
|
+
requestAnimationFrame(() => {
|
|
437
|
+
this.reorderSlotContent();
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
// Initialize the sorted options array with the parsed options for initial rendering
|
|
442
|
+
if (this.options) {
|
|
443
|
+
this.sortedOptions = [...((_a = this.options) !== null && _a !== void 0 ? _a : [])];
|
|
444
|
+
}
|
|
445
|
+
// Apply filtering if the multiselect is filterable and there is a value
|
|
446
|
+
if (this.filterable && this.value) {
|
|
447
|
+
this.filterText = String(this.value).toLocaleLowerCase();
|
|
448
|
+
this.filterItems();
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
|
+
// Reset visibility state of all dropdown items
|
|
452
|
+
this.resetFilter();
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Force reorder if options mode in componentDidLoad because of the initial render not trigger @watch
|
|
457
|
+
*/
|
|
458
|
+
componentDidLoad() {
|
|
459
|
+
if (this.options) {
|
|
460
|
+
this.handleOptionsChange(this.options);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Unsubscribe from click outside event.
|
|
465
|
+
*/
|
|
466
|
+
disconnectedCallback() {
|
|
467
|
+
document.removeEventListener('click', this.handleClickOutside.bind(this));
|
|
468
|
+
}
|
|
469
|
+
//#endregion LIFECYCLE
|
|
452
470
|
/****************************************************************************/
|
|
453
471
|
//#region METHODS
|
|
454
472
|
/**
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-B2jv2KXv.js');
|
|
4
|
+
var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
|
|
5
|
+
require('react');
|
|
6
|
+
|
|
7
|
+
const nvFieldnumberCss = "nv-fieldnumber {\n --nv-field-border-default: var(--components-form-field-border-default);\n --nv-field-border-hover: var(--components-form-field-border-hover);\n --nv-field-border-focus: var(--components-form-field-border-focus);\n --nv-field-border-disabled: var(--components-form-field-border-default);\n --nv-field-border-readonly: var(--components-form-field-border-default);\n --nv-field-focus-box-shadow: var(--color-focus-brand);\n --nv-field-background: var(--components-form-field-background-default);\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: var(--form-gap-y);\n box-sizing: border-box;\n max-width: 480px;\n}\nnv-fieldnumber[fluid]:not([fluid=false]) {\n max-width: unset;\n}\nnv-fieldnumber[readonly]:not([readonly=false]) {\n --nv-field-border-default: var(--components-form-field-border-readonly);\n --nv-field-border-hover: var(--nv-field-border-default);\n --nv-field-border-focus: var(--components-form-field-border-focus);\n --nv-field-border-disabled: var(--nv-field-border-default);\n --nv-field-border-readonly: var(--nv-field-border-default);\n --nv-field-background: var(--components-form-field-background-readonly);\n}\nnv-fieldnumber[error]:not([error=false]) {\n --nv-field-border-default: var(--components-form-field-border-error);\n --nv-field-border-hover: var(--nv-field-border-default);\n --nv-field-border-focus: var(--nv-field-border-default);\n --nv-field-border-disabled: var(--nv-field-border-default);\n --nv-field-border-readonly: var(--nv-field-border-default);\n --nv-field-focus-box-shadow: var(--color-focus-destructive-in-field);\n}\nnv-fieldnumber[success]:not([success=false]) {\n --nv-field-border-default: var(--components-form-field-border-success);\n --nv-field-border-hover: var(--nv-field-border-default);\n --nv-field-border-focus: var(--nv-field-border-default);\n --nv-field-border-disabled: var(--nv-field-border-default);\n --nv-field-border-readonly: var(--nv-field-border-default);\n --nv-field-focus-box-shadow: var(--color-focus-success);\n}\nnv-fieldnumber[required]:not([required=false]) label::after {\n content: \"*\";\n color: var(--components-form-text-required);\n font-weight: 700;\n}\nnv-fieldnumber label {\n display: flex;\n align-items: center;\n gap: var(--form-label-gap);\n align-self: stretch;\n color: var(--components-form-text-label-default);\n font-family: \"TT Norms Pro\", sans-serif;\n font-size: var(--form-label-font-size);\n font-style: normal;\n font-weight: 500;\n line-height: var(--form-label-line-height);\n}\nnv-fieldnumber .input-wrapper {\n display: flex;\n flex-wrap: wrap;\n gap: var(--form-gap-x);\n align-items: stretch;\n align-self: stretch;\n}\nnv-fieldnumber .input-wrapper .input-container {\n display: flex;\n flex-grow: 1;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--form-field-radius);\n border-width: 1px;\n border-style: solid;\n border-color: var(--nv-field-border-default);\n opacity: var(--components-form-opacity-default, 1);\n background: var(--nv-field-background);\n transition: all 150ms ease-out;\n container-type: inline-size;\n container-name: field-number-input-container;\n overflow: hidden;\n position: relative;\n}\nnv-fieldnumber .input-wrapper .input-container:hover {\n border-color: var(--nv-field-border-hover);\n}\nnv-fieldnumber .input-wrapper .input-container:focus-within, nv-fieldnumber .input-wrapper .input-container:focus-within:hover, nv-fieldnumber .input-wrapper .input-container:focus, nv-fieldnumber .input-wrapper .input-container:focus:hover {\n border-color: var(--nv-field-border-focus);\n box-shadow: 0px 0px 0px var(--focus-field-stroke) var(--nv-field-focus-box-shadow);\n}\nnv-fieldnumber .input-wrapper .input-container:has(input:read-only) {\n opacity: 0.5;\n background-color: var(--components-form-field-background-readonly);\n border-color: var(--nv-field-border-readonly);\n}\nnv-fieldnumber .input-wrapper .input-container:has(input:disabled) {\n opacity: 0.5;\n background-color: var(--components-form-field-background-disabled);\n border-color: var(--nv-field-border-disabled);\n}\nnv-fieldnumber .input-wrapper .input-container input {\n display: flex;\n align-items: center;\n flex: 1 0 0;\n overflow: hidden;\n background-color: transparent;\n color: var(--components-form-field-content-text);\n padding: var(--form-field-padding-y) var(--form-field-padding-x);\n font-size: var(--form-field-font-size);\n font-style: normal;\n font-weight: 500;\n line-height: var(--form-field-line-height);\n width: 100%;\n width: 100%;\n appearance: textfield;\n}\nnv-fieldnumber .input-wrapper .input-container input:focus {\n outline: none;\n}\nnv-fieldnumber .input-wrapper .input-container input::placeholder {\n overflow: hidden;\n color: var(--components-form-field-content-placeholder);\n text-overflow: ellipsis;\n font-family: \"TT Norms Pro\", sans-serif;\n font-size: var(--form-field-font-size);\n font-style: normal;\n font-weight: 400;\n line-height: var(--form-field-line-height);\n}\nnv-fieldnumber .input-wrapper .input-container input::-webkit-inner-spin-button, nv-fieldnumber .input-wrapper .input-container input::-webkit-outer-spin-button {\n appearance: none;\n margin: 0;\n}\nnv-fieldnumber .input-wrapper .input-container nv-icon.validation {\n color: var(--nv-field-border-default);\n margin-right: var(--form-field-gap);\n}\nnv-fieldnumber .input-wrapper .input-container > nv-iconbutton {\n border: 0px;\n border-radius: 0px;\n}\nnv-fieldnumber .input-wrapper .input-container > nv-iconbutton:focus-visible {\n border-radius: var(--button-md-border-radius);\n outline-offset: -3px;\n}\nnv-fieldnumber .input-wrapper .input-container .stepper {\n display: flex;\n border-left: var(--notification-border-width-low-emphasis) solid var(--components-form-field-border-readonly);\n}\nnv-fieldnumber .input-wrapper .input-container .stepper > nv-iconbutton {\n border: 0px;\n border-radius: 0px;\n border-radius: 0px;\n}\nnv-fieldnumber .input-wrapper .input-container .stepper > nv-iconbutton:focus-visible {\n border-radius: var(--button-md-border-radius);\n outline-offset: -3px;\n}\n@container field-number-input-container (width < 150px) {\n nv-fieldnumber .input-wrapper .input-container .stepper-spacer {\n display: none;\n }\n nv-fieldnumber .input-wrapper .input-container .stepper {\n display: none;\n }\n}\nnv-fieldnumber .description {\n display: flex;\n align-items: center;\n align-self: stretch;\n gap: var(--spacing-1);\n color: var(--components-form-text-description-default);\n font-family: \"TT Norms Pro\", sans-serif;\n font-size: var(--form-description-font-size);\n font-style: normal;\n line-height: var(--form-description-line-height);\n}\nnv-fieldnumber .error-description {\n display: flex;\n align-items: center;\n align-self: stretch;\n gap: var(--spacing-1);\n color: var(--components-form-text-description-default);\n font-family: \"TT Norms Pro\", sans-serif;\n font-size: var(--form-description-font-size);\n font-style: normal;\n line-height: var(--form-description-line-height);\n color: var(--components-form-text-description-error);\n}";
|
|
8
|
+
const NvFieldnumberStyle0 = nvFieldnumberCss;
|
|
9
|
+
|
|
10
|
+
const NvFieldnumber = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.valueChanged = index.createEvent(this, "valueChanged");
|
|
14
|
+
//#endregion DEPRECATED
|
|
15
|
+
/****************************************************************************/
|
|
16
|
+
//#region PROPERTIES
|
|
17
|
+
/**
|
|
18
|
+
* Sets the ID for the input element and the for attribute of the associated
|
|
19
|
+
* label. If no ID is provided, a random one will be automatically generated
|
|
20
|
+
* to ensure unique identification, facilitating proper label association and
|
|
21
|
+
* accessibility.
|
|
22
|
+
*/
|
|
23
|
+
this.inputId = v4A79185f4.v4();
|
|
24
|
+
/**
|
|
25
|
+
* The disabled prop lets you turn off the input field so that users can’t
|
|
26
|
+
* type in it. When disabled, the field is grayed out and won’t respond to#
|
|
27
|
+
* clicks or touches.
|
|
28
|
+
*/
|
|
29
|
+
this.disabled = false;
|
|
30
|
+
/**
|
|
31
|
+
* Display the input field’s content without allowing users to change it.
|
|
32
|
+
* Users can still click on it, select, and copy the text, but they won’t be
|
|
33
|
+
* able to type or delete anything.
|
|
34
|
+
*/
|
|
35
|
+
this.readonly = false;
|
|
36
|
+
/**
|
|
37
|
+
* Marks the input field as required, ensuring that the user must fill it out
|
|
38
|
+
* before submitting the form.
|
|
39
|
+
*/
|
|
40
|
+
this.required = false;
|
|
41
|
+
/**
|
|
42
|
+
* Alters the input field’s appearance to indicate an error, helping users
|
|
43
|
+
* identify fields that need correction.
|
|
44
|
+
* @validator error
|
|
45
|
+
*/
|
|
46
|
+
this.error = false;
|
|
47
|
+
/**
|
|
48
|
+
* Changes the input field’s appearance to indicate successful input or
|
|
49
|
+
* validation.
|
|
50
|
+
*/
|
|
51
|
+
this.success = false;
|
|
52
|
+
/**
|
|
53
|
+
* Define the increment value for the input field. It determines how much the
|
|
54
|
+
* value will increase or decrease when the user clicks the stepper buttons.
|
|
55
|
+
*/
|
|
56
|
+
this.step = 1;
|
|
57
|
+
/**
|
|
58
|
+
* Applies focus to the input field as soon as the component is mounted. This
|
|
59
|
+
* is equivalent to setting the native autofocus attribute on an <input>
|
|
60
|
+
* element.
|
|
61
|
+
*/
|
|
62
|
+
this.autofocus = false;
|
|
63
|
+
/**
|
|
64
|
+
* Allows the field to stretch and fill the entire width of its container.
|
|
65
|
+
*/
|
|
66
|
+
this.fluid = false;
|
|
67
|
+
//#endregion WATCHERS
|
|
68
|
+
/****************************************************************************/
|
|
69
|
+
//#region METHODS
|
|
70
|
+
this.handleInput = (event) => {
|
|
71
|
+
const input = event.target;
|
|
72
|
+
this.value = Number(input.value);
|
|
73
|
+
};
|
|
74
|
+
this.handleInputContainerClick = () => {
|
|
75
|
+
this.inputElement.focus();
|
|
76
|
+
};
|
|
77
|
+
this.handlePlus = () => {
|
|
78
|
+
this.inputElement.stepUp();
|
|
79
|
+
this.value = Number(this.inputElement.value);
|
|
80
|
+
};
|
|
81
|
+
this.handleMinus = () => {
|
|
82
|
+
this.inputElement.stepDown();
|
|
83
|
+
this.value = Number(this.inputElement.value);
|
|
84
|
+
};
|
|
85
|
+
// prevents text selection when clicking the buttons multiple times
|
|
86
|
+
this.preventSelection = (event) => {
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
};
|
|
89
|
+
this.isMinValueReached = () => {
|
|
90
|
+
return this.min !== undefined && this.value <= this.min;
|
|
91
|
+
};
|
|
92
|
+
this.isMaxValueReached = () => {
|
|
93
|
+
return this.max !== undefined && this.value >= this.max;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//#endregion EVENTS
|
|
97
|
+
/****************************************************************************/
|
|
98
|
+
//#region WATCHERS
|
|
99
|
+
watchValueHandler(newValue) {
|
|
100
|
+
this.valueChanged.emit(newValue);
|
|
101
|
+
}
|
|
102
|
+
//#endregion METHODS
|
|
103
|
+
/****************************************************************************/
|
|
104
|
+
//#region LIFECYCLE
|
|
105
|
+
componentWillRender() {
|
|
106
|
+
if (this.message) {
|
|
107
|
+
this.description = this.message;
|
|
108
|
+
}
|
|
109
|
+
if (this.validation) {
|
|
110
|
+
this.errorDescription = this.validation;
|
|
111
|
+
this.error = true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
//#endregion LIFECYCLE
|
|
115
|
+
/****************************************************************************/
|
|
116
|
+
//#region RENDER
|
|
117
|
+
render() {
|
|
118
|
+
return (index.h(index.Host, { key: 'ff097af3b023ea85fe549331219fd147aaf5d587' }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'fbb5a460baf515c9f41068126db0dfc80f3aba64', htmlFor: this.inputId }, index.h("slot", { key: '27963c9e2f61213b1897e117a68a2cb0d56e7d0f', name: "label" }, this.label))), index.h("div", { key: 'f1f53b27aabd76cfe478ca0de182fd0d181e1c4b', class: "input-wrapper" }, index.h("slot", { key: 'f5f0fe6e8fbaa63bb961a5216eba0d0a10ca4cf7', name: "before-input" }), index.h("div", { key: '6d615f206e6b0ed3b228c75601fd7608b1aa4869', class: "input-container", onClick: this.handleInputContainerClick }, index.h("slot", { key: 'd4cbd09db77e7998020289b44d43be1c37c1197a', name: "leading-input" }), index.h("input", { key: 'fa8620fa422b1b96a05630da3f5bed20281b8d19', id: this.inputId, ref: e => (this.inputElement = e), placeholder: this.placeholder, name: this.name, type: "number", autofocus: this.autofocus, required: this.required, max: this.max, min: this.min, step: this.step, value: this.value, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInput }), this.error && (index.h("nv-icon", { key: '0787893a02fbebf2bec97f4285d4b396fc1a474d', name: "alert-circle", class: "validation", size: "md" })), this.success && (index.h("nv-icon", { key: 'd2d244b7a2280c3b7719927d6550a28c75743a48', name: "circle-check", class: "validation", size: "md" })), index.h("div", { key: 'ebe05dafe4b7ec67dbe59d5da612f2f5e6951e3f', class: "stepper" }, index.h("nv-iconbutton", { key: '3112ee0b6f5b3982290cd1ec006653d48d3db626', size: "md", name: "minus", emphasis: "lower", onClick: this.handleMinus, disabled: this.isMinValueReached(), onMouseDown: this.preventSelection, tabindex: "-1" }), index.h("nv-iconbutton", { key: 'e3cdf3ca761ebd647e13f23df44c4e18879b8913', size: "md", name: "plus", emphasis: "lower", onClick: this.handlePlus, disabled: this.isMaxValueReached(), onMouseDown: this.preventSelection, tabindex: "-1" }))), index.h("slot", { key: 'c6de7aaff35002e78e5a27d5f37fe06297b3693f', name: "after-input" })), (this.description ||
|
|
119
|
+
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: 'e2c1ea1eb866593cee0eb4218dba9665cd8a321c', class: "description" }, index.h("slot", { key: '1fd324333be676116f5d614bb2dc7448ecd7d3a1', name: "description" }, this.description))), (this.errorDescription ||
|
|
120
|
+
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: 'adb8565f5204849caff31758f739d732f2eb5a01', hidden: !this.error, class: "error-description" }, index.h("slot", { key: '0f2ec09a50e98855cc3f2451c75bd6dca4a6baec', name: "error-description" }, this.errorDescription)))));
|
|
121
|
+
}
|
|
122
|
+
static get formAssociated() { return true; }
|
|
123
|
+
get el() { return index.getElement(this); }
|
|
124
|
+
static get watchers() { return {
|
|
125
|
+
"value": ["watchValueHandler"]
|
|
126
|
+
}; }
|
|
127
|
+
};
|
|
128
|
+
NvFieldnumber.style = NvFieldnumberStyle0;
|
|
129
|
+
|
|
130
|
+
exports.nv_fieldnumber = NvFieldnumber;
|