@nova-design-system/nova-react 3.2.0 → 3.4.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/{index-B2jv2KXv.js → index-CrgVjOZF.js} +1121 -1100
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/{nv-alert.entry-pxBJfmIm.js → nv-alert.entry-CW72ajnD.js} +7 -7
- package/dist/cjs/{nv-avatar.entry-CHtVctSK.js → nv-avatar.entry-D9wUCu5K.js} +7 -7
- package/dist/cjs/{nv-badge_2.entry-BO88KO1O.js → nv-badge_2.entry-CQs2Sf6G.js} +1 -1
- package/dist/cjs/{nv-breadcrumb.entry-7azRtyl5.js → nv-breadcrumb.entry-CGrSsjAL.js} +1 -1
- package/dist/cjs/{nv-breadcrumbs.entry-DfZVMKpY.js → nv-breadcrumbs.entry-HStUGnwu.js} +1 -1
- package/dist/cjs/{nv-button.entry-DW9SblsY.js → nv-button.entry-BJfYc4Ow.js} +7 -7
- package/dist/cjs/{nv-calendar.entry-BeayRRor.js → nv-calendar.entry-Co8f_3E5.js} +396 -147
- package/dist/cjs/{nv-col.entry-C6oEkSbI.js → nv-col.entry-PJML3P46.js} +1 -1
- package/dist/cjs/{nv-datagrid.entry-xhQP6JJP.js → nv-datagrid.entry-Bpwt9yDb.js} +50 -17
- package/dist/cjs/{nv-datagridcolumn.entry-CjYmo4fM.js → nv-datagridcolumn.entry-Dfifeiia.js} +1 -1
- package/dist/cjs/{nv-dialog.entry-mxETaZbc.js → nv-dialog.entry-eUEzDdrS.js} +3 -3
- package/dist/cjs/{nv-dialogfooter_2.entry-DnLg2DHy.js → nv-dialogfooter_2.entry-HQyyE6VN.js} +3 -3
- package/dist/cjs/{nv-fieldcheckbox.entry-Be9__i15.js → nv-fieldcheckbox.entry-C5AMgttR.js} +1 -1
- package/dist/cjs/nv-fielddate.entry-Dkqz-UqJ.js +303 -0
- package/dist/cjs/nv-fielddaterange.entry-D6QmyWHp.js +462 -0
- package/dist/cjs/{nv-fielddropdown.entry-BPwviyCp.js → nv-fielddropdown.entry-BpZz90ob.js} +2 -2
- package/dist/cjs/{nv-fielddropdownitem.entry-BGuUR9KP.js → nv-fielddropdownitem.entry-BbJ9SKGo.js} +1 -1
- package/dist/cjs/{nv-fieldmultiselect.entry-Lrxr1gsi.js → nv-fieldmultiselect.entry-mnYvhkj0.js} +2 -2
- package/dist/cjs/nv-fieldnumber.entry-B5ED8fCU.js +130 -0
- package/dist/cjs/nv-fieldpassword.entry-ohASip15.js +121 -0
- package/dist/cjs/{nv-fieldradio.entry-CDu8xs0p.js → nv-fieldradio.entry-BPipemAC.js} +4 -4
- package/dist/cjs/{nv-fieldselect.entry-NEdv8bQK.js → nv-fieldselect.entry-BWZX6L-B.js} +7 -7
- package/dist/cjs/{nv-fieldslider.entry-51gF9XPz.js → nv-fieldslider.entry-nmE8TjBA.js} +28 -23
- package/dist/cjs/nv-fieldtext.entry-DxoznMYV.js +123 -0
- package/dist/cjs/nv-fieldtextarea.entry-BccBiMKe.js +198 -0
- package/dist/cjs/{nv-fieldtime.entry-MbaWbVtc.js → nv-fieldtime.entry-BmQ5DFbN.js} +67 -67
- package/dist/cjs/{nv-icon.entry-BSSHr-ud.js → nv-icon.entry-DE-sMmDp.js} +8 -8
- package/dist/cjs/{nv-iconbutton_2.entry-DMaO-JWz.js → nv-iconbutton_2.entry-DguqeTa3.js} +3 -3
- package/dist/cjs/{nv-menu.entry-D5_lj9XB.js → nv-menu.entry-UTPRtlti.js} +2 -2
- package/dist/cjs/{nv-menuitem.entry-fhnYI91K.js → nv-menuitem.entry-CaRqhVtk.js} +2 -2
- package/dist/cjs/{nv-popover.entry-CYqBaVbr.js → nv-popover.entry-ByFhVB2j.js} +3 -3
- package/dist/cjs/{nv-row.entry-BUheLufV.js → nv-row.entry-BIwxIl3Q.js} +2 -2
- package/dist/cjs/{nv-stack.entry-DNPce51E.js → nv-stack.entry-xDwyG0Xr.js} +2 -2
- package/dist/cjs/{nv-table.entry-DXQM8l3t.js → nv-table.entry-DCMcpbpc.js} +3 -3
- package/dist/cjs/{nv-tablecolumn.entry-DROQK_0c.js → nv-tablecolumn.entry-D_kTZ7Mp.js} +1 -1
- package/dist/cjs/{nv-toggle.entry-fMzTrdte.js → nv-toggle.entry-tds7tIzF.js} +3 -3
- package/dist/cjs/{nv-tooltip.entry-yB2Ek1Cz.js → nv-tooltip.entry-PfQ2HgFG.js} +2 -2
- package/dist/generated/components.js +9 -4
- package/dist/types/generated/components.d.ts +15 -4
- package/package.json +2 -2
- package/dist/cjs/nv-fielddate.entry-BlNily-X.js +0 -269
- package/dist/cjs/nv-fielddaterange.entry-CycpKoJd.js +0 -408
- package/dist/cjs/nv-fieldnumber.entry-B1VySoWj.js +0 -130
- package/dist/cjs/nv-fieldpassword.entry-D7Qlx7Bh.js +0 -121
- package/dist/cjs/nv-fieldtext.entry-Bug9zMgo.js +0 -123
- package/dist/cjs/nv-fieldtextarea.entry-D44HbsVQ.js +0 -198
- /package/dist/cjs/{constants-b97e736d-BzFAKCkR.js → constants-4faa1fae-BzFAKCkR.js} +0 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-CrgVjOZF.js');
|
|
4
|
+
var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
|
|
5
|
+
require('react');
|
|
6
|
+
|
|
7
|
+
const nvFieldtextCss = "nv-fieldslider .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .track-range{background:var(--components-slider-track-filled-focus)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .thumb{border-color:var(--components-slider-track-filled-focus)}nv-fieldslider[error] .slider-container .track-container .track .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:hover{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-handler-background-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:focus{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldtext{--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-fieldtext[fluid]:not([fluid=false]){max-width:unset}nv-fieldtext[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-fieldtext[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-fieldtext[success]:not([success=false]){--nv-field-border-default:var(--components-form-field-border-success);--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-success)}nv-fieldtext[required]:not([required=false]) label::after{content:\"*\";color:var(--components-form-text-required);font-weight:700}nv-fieldtext>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-fieldtext>.input-wrapper{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch}nv-fieldtext>.input-wrapper .input-container{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}nv-fieldtext>.input-wrapper .input-container:hover{border-color:var(--nv-field-border-hover)}nv-fieldtext>.input-wrapper .input-container:focus-within,nv-fieldtext>.input-wrapper .input-container:focus-within:hover,nv-fieldtext>.input-wrapper .input-container:focus,nv-fieldtext>.input-wrapper .input-container: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-fieldtext>.input-wrapper .input-container:has(input:read-only){opacity:0.5;background-color:var(--components-form-field-background-readonly);border-color:var(--nv-field-border-readonly)}nv-fieldtext>.input-wrapper .input-container:has(input:disabled){opacity:0.5;background-color:var(--components-form-field-background-disabled);border-color:var(--nv-field-border-disabled)}nv-fieldtext>.input-wrapper .input-container>[slot=leading-input]{display:block;margin-left:var(--form-field-padding-x)}nv-fieldtext>.input-wrapper .input-container input{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%;}nv-fieldtext>.input-wrapper .input-container input:focus{outline:none}nv-fieldtext>.input-wrapper .input-container input::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-fieldtext>.input-wrapper .input-container input[type=password]::-ms-clear,nv-fieldtext>.input-wrapper .input-container input[type=password]::-ms-reveal{display:none;width:0;height:0}nv-fieldtext>.input-wrapper .input-container nv-icon.validation{color:var(--nv-field-border-default);margin-right:var(--form-gap-x)}nv-fieldtext>.input-wrapper .input-container>[slot=trailing-input]{display:block;margin-right:var(--form-field-padding-x)}nv-fieldtext>.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-fieldtext>.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)}";
|
|
8
|
+
const NvFieldtextStyle0 = nvFieldtextCss;
|
|
9
|
+
|
|
10
|
+
const NvFieldtext = 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 type prop lets you specify what kind of information the input field
|
|
26
|
+
* should accept. Choose 'text' for general words or sentences, 'tel' for
|
|
27
|
+
* phone numbers, or 'email' for email addresses. This makes sure users get
|
|
28
|
+
* the right keyboard and validation for what they need to enter.
|
|
29
|
+
*/
|
|
30
|
+
this.type = 'text';
|
|
31
|
+
/**
|
|
32
|
+
* The disabled prop lets you turn off the input field so that users can’t
|
|
33
|
+
* type in it. When disabled, the field is grayed out and won’t respond to
|
|
34
|
+
* clicks or touches.
|
|
35
|
+
*/
|
|
36
|
+
this.disabled = false;
|
|
37
|
+
/**
|
|
38
|
+
* Display the input field’s content without allowing users to change it.
|
|
39
|
+
* Users can still click on it, select, and copy the text, but they won’t be
|
|
40
|
+
* able to type or delete anything.
|
|
41
|
+
*/
|
|
42
|
+
this.readonly = false;
|
|
43
|
+
/**
|
|
44
|
+
* Marks the input field as required, ensuring that the user must fill it out
|
|
45
|
+
* before submitting the form.
|
|
46
|
+
*/
|
|
47
|
+
this.required = false;
|
|
48
|
+
/**
|
|
49
|
+
* Alters the input field’s appearance to indicate an error, helping users
|
|
50
|
+
* identify fields that need correction.
|
|
51
|
+
* @validator error
|
|
52
|
+
*/
|
|
53
|
+
this.error = false;
|
|
54
|
+
/**
|
|
55
|
+
* Changes the input field’s appearance to indicate successful input or
|
|
56
|
+
* validation.
|
|
57
|
+
*/
|
|
58
|
+
this.success = false;
|
|
59
|
+
/**
|
|
60
|
+
* When used with the email input type, this prop enables the field to accept
|
|
61
|
+
* multiple email addresses. Users can enter several addresses, separating
|
|
62
|
+
* each one with a comma, allowing the form to handle multiple recipients.
|
|
63
|
+
*/
|
|
64
|
+
this.multiple = false;
|
|
65
|
+
/**
|
|
66
|
+
* Applies focus to the input field as soon as the component is mounted. This
|
|
67
|
+
* is equivalent to setting the native autofocus attribute on an <input>
|
|
68
|
+
* element.
|
|
69
|
+
*/
|
|
70
|
+
this.autofocus = false;
|
|
71
|
+
/**
|
|
72
|
+
* Allows the field to stretch and fill the entire width of its container.
|
|
73
|
+
*/
|
|
74
|
+
this.fluid = false;
|
|
75
|
+
//#endregion EVENTS
|
|
76
|
+
/****************************************************************************/
|
|
77
|
+
//#region METHODS
|
|
78
|
+
/**
|
|
79
|
+
* Handles the input event on the input element.
|
|
80
|
+
* Emits the inputChanged event with the new value.
|
|
81
|
+
* @param {Event} event - Event object of the input event.
|
|
82
|
+
*/
|
|
83
|
+
this.handleInput = (event) => {
|
|
84
|
+
const input = event.target;
|
|
85
|
+
this.value = input.value;
|
|
86
|
+
this.valueChanged.emit(input.value);
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Handles focus when the input container is clicked.
|
|
90
|
+
*/
|
|
91
|
+
this.handleInputContainerClick = () => {
|
|
92
|
+
this.inputElement.focus();
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//#endregion METHODS
|
|
96
|
+
/****************************************************************************/
|
|
97
|
+
//#region LIFECYCLE
|
|
98
|
+
componentWillRender() {
|
|
99
|
+
if (this.textInputType) {
|
|
100
|
+
this.type = this.textInputType;
|
|
101
|
+
}
|
|
102
|
+
if (this.message) {
|
|
103
|
+
this.description = this.message;
|
|
104
|
+
}
|
|
105
|
+
if (this.validation) {
|
|
106
|
+
this.errorDescription = this.validation;
|
|
107
|
+
this.error = true;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//#endregion LIFECYCLE
|
|
111
|
+
/****************************************************************************/
|
|
112
|
+
//#region RENDER
|
|
113
|
+
render() {
|
|
114
|
+
return (index.h(index.Host, { key: '376745526ad4350a50ef017acceb43d77414ddaf' }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'f03087361cb8f347d6fffb1dc234f3d041109229', htmlFor: this.inputId }, index.h("slot", { key: 'cea3904cf5522359426b47e7d4e8f4a71da6fb00', name: "label" }, this.label))), index.h("div", { key: '9f766da6a0962d3e865388d732109c81b03a5802', class: "input-wrapper" }, index.h("slot", { key: 'f9cd30cda301c60f89263eef30c178ccbbf2fa18', name: "before-input" }), index.h("div", { key: '086b7a59b7883aea0f5a93945d40a642f3b0fef2', class: "input-container", onClick: this.handleInputContainerClick }, index.h("slot", { key: 'caa4cf0d9d1e2990c438aea19e6afa29a11163b9', name: "leading-input" }), index.h("input", { key: '36fda559fb8609c8275fa3f3d14142d0cf4fc2db', id: this.inputId, ref: e => (this.inputElement = e), placeholder: this.placeholder, name: this.name, type: this.type, disabled: this.disabled, readOnly: this.readonly, required: this.required, maxlength: this.maxlength, minlength: this.minlength, pattern: this.pattern, autofocus: this.autofocus, autocomplete: this.autocomplete, multiple: this.multiple, value: this.value, onInput: this.handleInput }), index.h("slot", { key: 'dd6564d4960fff20e8204dab2cad3ae07ec433ad', name: "trailing-input" }), this.error && (index.h("nv-icon", { key: '203a3a51cf3db17b6544b327d692d8805c9577ee', name: "alert-circle", class: "validation", size: "md" })), this.success && (index.h("nv-icon", { key: '13f4d73e72745cbb06cdb3969f94ad5627822743', name: "circle-check", class: "validation", size: "md" }))), index.h("slot", { key: '1c9b1388173a7ad98b3ec2ac7663d77588d71c8d', name: "after-input" })), (this.description ||
|
|
115
|
+
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '71797445f8593485ec2c0030c90eef6649d25f7f', class: "description" }, index.h("slot", { key: '296dbddd49b791284734254bcd07400532e9e8ce', name: "description" }, this.description))), (this.errorDescription ||
|
|
116
|
+
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: 'a2cf61e30ff98da3b3c4134f0669ef6f63cdc62f', hidden: !this.error, class: "error-description" }, index.h("slot", { key: 'fd4ba3d94a266ce096ca3f1b016b05040813cc37', name: "error-description" }, this.errorDescription)))));
|
|
117
|
+
}
|
|
118
|
+
static get formAssociated() { return true; }
|
|
119
|
+
get el() { return index.getElement(this); }
|
|
120
|
+
};
|
|
121
|
+
NvFieldtext.style = NvFieldtextStyle0;
|
|
122
|
+
|
|
123
|
+
exports.nv_fieldtext = NvFieldtext;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-CrgVjOZF.js');
|
|
4
|
+
var clsx297c1ffe = require('./clsx-297c1ffe-BtxeOLZW.js');
|
|
5
|
+
var v4A79185f4 = require('./v4-a79185f4-2n0dOd_Y.js');
|
|
6
|
+
require('react');
|
|
7
|
+
|
|
8
|
+
const nvFieldtextareaCss = "nv-fieldslider .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-hover)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .track-range{background:var(--components-slider-track-filled-focus)}nv-fieldslider .slider-container .track-container:has(.thumb:focus) .thumb{border-color:var(--components-slider-track-filled-focus)}nv-fieldslider[error] .slider-container .track-container .track .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:hover{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-handler-background-error)}nv-fieldslider[error] .slider-container .track-container .track .thumb:focus{border-color:var(--components-slider-track-filled-error);outline:calc(var(--focus-outline-stroke) * 1) solid var(--components-slider-track-filled-error);outline-offset:calc(var(--focus-outline-offset) * 1);background-color:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .track-range{background:var(--components-slider-track-filled-error)}nv-fieldslider[error] .slider-container .track-container:has(.thumb:hover) .thumb{border-color:var(--components-slider-track-filled-error)}nv-fieldtextarea{--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-fieldtextarea[fluid]:not([fluid=false]){max-width:unset}nv-fieldtextarea[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-fieldtextarea[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-fieldtextarea[success]:not([success=false]){--nv-field-border-default:var(--components-form-field-border-success);--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-success)}nv-fieldtextarea[required]:not([required=false]) label::after{content:\"*\";color:var(--components-form-text-required);font-weight:700}nv-fieldtextarea 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-fieldtextarea .textarea-wrapper{display:flex;flex-wrap:wrap;gap:var(--form-gap-x);align-items:stretch;align-self:stretch}nv-fieldtextarea .textarea-wrapper .textarea-container{display:flex;flex-grow:1;padding:calc(var(--form-field-padding-y) - 1px) var(--form-field-padding-x);justify-content:center;align-items:center;gap:var(--form-field-gap);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);background:var(--nv-field-background);transition:all 150ms ease-out}nv-fieldtextarea .textarea-wrapper .textarea-container:hover{border-color:var(--nv-field-border-hover)}nv-fieldtextarea .textarea-wrapper .textarea-container:focus-within{border-color:var(--nv-field-border-focus);box-shadow:0 0 0 var(--focus-field-stroke) var(--nv-field-focus-box-shadow)}nv-fieldtextarea .textarea-wrapper .textarea-container:has(textarea:read-only){opacity:0.5;background-color:var(--components-form-field-background-readonly);border-color:var(--nv-field-border-readonly)}nv-fieldtextarea .textarea-wrapper .textarea-container:has(textarea:disabled){opacity:0.5;background-color:var(--components-form-field-background-disabled);border-color:var(--nv-field-border-disabled)}nv-fieldtextarea .textarea-wrapper .textarea-container textarea{display:flex;align-items:center;flex:1 0 0;overflow:hidden;background-color:transparent;color:var(--components-form-field-content-text);text-overflow:ellipsis;font-size:var(--form-field-font-size);font-style:normal;font-weight:500;line-height:var(--form-field-line-height)}nv-fieldtextarea .textarea-wrapper .textarea-container textarea::-webkit-scrollbar{width:6px;height:6px}nv-fieldtextarea .textarea-wrapper .textarea-container textarea::-webkit-scrollbar-track{background-color:var(--color-level-10-background);border-radius:9999px}nv-fieldtextarea .textarea-wrapper .textarea-container textarea::-webkit-scrollbar-thumb{background-color:var(--color-gray-200);border-radius:9999px}nv-fieldtextarea .textarea-wrapper .textarea-container textarea:focus{outline:none}nv-fieldtextarea .textarea-wrapper .textarea-container textarea::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-fieldtextarea .textarea-wrapper .textarea-container nv-icon.validation{color:var(--nv-field-border-default)}nv-fieldtextarea .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-fieldtextarea .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)}";
|
|
9
|
+
const NvFieldtextareaStyle0 = nvFieldtextareaCss;
|
|
10
|
+
|
|
11
|
+
const NvFieldtextarea = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
index.registerInstance(this, hostRef);
|
|
14
|
+
this.valueChanged = index.createEvent(this, "valueChanged");
|
|
15
|
+
//#endregion DEPRECATED
|
|
16
|
+
/****************************************************************************/
|
|
17
|
+
//#region PROPERTIES
|
|
18
|
+
/**
|
|
19
|
+
* Sets the ID for the input element and the for attribute of the associated
|
|
20
|
+
* label. If no ID is provided, a random one will be automatically generated
|
|
21
|
+
* to ensure unique identification, facilitating proper label association and
|
|
22
|
+
* accessibility.
|
|
23
|
+
*/
|
|
24
|
+
this.inputId = v4A79185f4.v4();
|
|
25
|
+
/**
|
|
26
|
+
* The disabled prop lets you turn off the textarea field so that users can’t
|
|
27
|
+
* type in it. When disabled, the field is grayed out and won’t respond to#
|
|
28
|
+
* clicks or touches.
|
|
29
|
+
*/
|
|
30
|
+
this.disabled = false;
|
|
31
|
+
/**
|
|
32
|
+
* Display the textarea field’s content without allowing users to change it.
|
|
33
|
+
* Users can still click on it, select, and copy the text, but they won’t be
|
|
34
|
+
* able to type or delete anything.
|
|
35
|
+
*/
|
|
36
|
+
this.readonly = false;
|
|
37
|
+
/**
|
|
38
|
+
* Marks the textarea field as required, ensuring that the user must fill it out
|
|
39
|
+
* before submitting the form.
|
|
40
|
+
*/
|
|
41
|
+
this.required = false;
|
|
42
|
+
/**
|
|
43
|
+
* Alters the textarea field’s appearance to indicate an error, helping users
|
|
44
|
+
* identify fields that need correction.
|
|
45
|
+
* @validator error
|
|
46
|
+
*/
|
|
47
|
+
this.error = false;
|
|
48
|
+
/**
|
|
49
|
+
* Changes the textarea field’s appearance to indicate successful textarea or
|
|
50
|
+
* validation.
|
|
51
|
+
*/
|
|
52
|
+
this.success = false;
|
|
53
|
+
/**
|
|
54
|
+
* The number of visible text lines for the control. The default is 3. This
|
|
55
|
+
* can be useful when you want to limit the size of the textarea field or when
|
|
56
|
+
* you want to make the textarea field smaller to fit a specific layout. The
|
|
57
|
+
* textarea field will expand vertically to fit the text as the user types.
|
|
58
|
+
*/
|
|
59
|
+
this.rows = 3;
|
|
60
|
+
/**
|
|
61
|
+
* Controls the resize property of a textarea. It can be set to none, both,
|
|
62
|
+
* horizontal, or vertical. The default is vertical.
|
|
63
|
+
*/
|
|
64
|
+
this.resize = 'vertical';
|
|
65
|
+
/**
|
|
66
|
+
* Enable this to make the textarea automatically resize as the user types,
|
|
67
|
+
* adjusting the height to fit the content. For the best experience, avoid
|
|
68
|
+
* vertical resizing, as it’s controlled by this feature. Horizontal resizing
|
|
69
|
+
* can still be allowed if desired.
|
|
70
|
+
*/
|
|
71
|
+
this.autosize = false;
|
|
72
|
+
/**
|
|
73
|
+
* Applies focus to the input field as soon as the component is mounted. This
|
|
74
|
+
* is equivalent to setting the native autofocus attribute on a <textarea>
|
|
75
|
+
* element.
|
|
76
|
+
*/
|
|
77
|
+
this.autofocus = false;
|
|
78
|
+
/**
|
|
79
|
+
* Allows the field to stretch and fill the entire width of its container.
|
|
80
|
+
*/
|
|
81
|
+
this.fluid = false;
|
|
82
|
+
//#endregion WATCHERS
|
|
83
|
+
/****************************************************************************/
|
|
84
|
+
//#region METHODS
|
|
85
|
+
this.handleTextarea = (event) => {
|
|
86
|
+
const textarea = event.target;
|
|
87
|
+
this.value = textarea.value;
|
|
88
|
+
this.valueChanged.emit(textarea.value);
|
|
89
|
+
};
|
|
90
|
+
this.handleTextareaContainerClick = () => {
|
|
91
|
+
this.textareaElement.focus();
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//#endregion EVENTS
|
|
95
|
+
/****************************************************************************/
|
|
96
|
+
//#region WATCHERS
|
|
97
|
+
/**
|
|
98
|
+
* If autosize is true, we need to make sure to update the min-height when
|
|
99
|
+
* the rows change.
|
|
100
|
+
*/
|
|
101
|
+
rowsChanged() {
|
|
102
|
+
if (this.autosize) {
|
|
103
|
+
this.adjustTextareaHeight();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* If autosize is true, we need to make sure to update the height and
|
|
108
|
+
* min-height, if false, we need to remove the height property.
|
|
109
|
+
*/
|
|
110
|
+
autosizeChanged() {
|
|
111
|
+
var _a;
|
|
112
|
+
if (this.autosize) {
|
|
113
|
+
this.adjustTextareaHeight();
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
(_a = this.textareaElement) === null || _a === void 0 ? void 0 : _a.style.removeProperty('height');
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Make sure to adjust the height of the textarea when the value changes
|
|
121
|
+
* programmatically or by typing when autosize is on.
|
|
122
|
+
*/
|
|
123
|
+
handleValueChange() {
|
|
124
|
+
if (this.autosize) {
|
|
125
|
+
this.adjustTextareaHeight();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
adjustTextareaHeight() {
|
|
129
|
+
if (this.textareaElement && this.autosize) {
|
|
130
|
+
/**
|
|
131
|
+
* The first requestAnimationFrame ensures that the DOM has applied any
|
|
132
|
+
* pending changes (e.g., value updates or attribute changes) before
|
|
133
|
+
* proceeding to the next frame.
|
|
134
|
+
*/
|
|
135
|
+
requestAnimationFrame(() => {
|
|
136
|
+
/**
|
|
137
|
+
* The second requestAnimationFrame ensures that the browser has fully
|
|
138
|
+
* recalculated layout and styles based on the updated DOM, such as
|
|
139
|
+
* recalculating scrollHeight for the textarea after the new value is
|
|
140
|
+
* rendered.
|
|
141
|
+
*/
|
|
142
|
+
requestAnimationFrame(() => {
|
|
143
|
+
this.textareaElement.style.height = 'auto';
|
|
144
|
+
const computedStyle = window.getComputedStyle(this.textareaElement);
|
|
145
|
+
const lineHeight = parseFloat(computedStyle.lineHeight);
|
|
146
|
+
const paddingTop = parseFloat(computedStyle.paddingTop);
|
|
147
|
+
const paddingBottom = parseFloat(computedStyle.paddingBottom);
|
|
148
|
+
const borderTopWidth = parseFloat(computedStyle.borderTopWidth);
|
|
149
|
+
const borderBottomWidth = parseFloat(computedStyle.borderBottomWidth);
|
|
150
|
+
// Calculate min-height based on rows
|
|
151
|
+
const minHeight = lineHeight * this.rows +
|
|
152
|
+
paddingTop +
|
|
153
|
+
paddingBottom +
|
|
154
|
+
borderTopWidth +
|
|
155
|
+
borderBottomWidth;
|
|
156
|
+
this.textareaElement.style.minHeight = `${minHeight}px`;
|
|
157
|
+
this.textareaElement.style.height =
|
|
158
|
+
this.textareaElement.scrollHeight + 'px';
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
//#endregion METHODS
|
|
164
|
+
/****************************************************************************/
|
|
165
|
+
//#region LIFECYCLE
|
|
166
|
+
componentWillRender() {
|
|
167
|
+
if (this.message) {
|
|
168
|
+
this.description = this.message;
|
|
169
|
+
}
|
|
170
|
+
if (this.validation) {
|
|
171
|
+
this.errorDescription = this.validation;
|
|
172
|
+
this.error = true;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
componentDidLoad() {
|
|
176
|
+
if (this.autosize) {
|
|
177
|
+
this.adjustTextareaHeight();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
//#endregion LIFECYCLE
|
|
181
|
+
/****************************************************************************/
|
|
182
|
+
//#region RENDER
|
|
183
|
+
render() {
|
|
184
|
+
return (index.h(index.Host, { key: '1ee58085eaa986a995b26dce3ec149130831bb42' }, (this.label || this.el.querySelector('[slot="label"]')) && (index.h("label", { key: 'dc8ede45802fa28d9bf616e534f4ca50b8f74f63', htmlFor: this.inputId }, index.h("slot", { key: '498b99a1e7b82694be943dffc1181c9f0a4c9f5e', name: "label" }, this.label))), index.h("div", { key: '9a9b90d5398f2ba010384b7b9cb64865329b019c', class: "textarea-wrapper" }, index.h("div", { key: '4d48453ac04146e6ad25e650995df5e4f550e35e', class: "textarea-container", onClick: this.handleTextareaContainerClick }, index.h("textarea", { key: '2190886c348e78073f5d8f6afc04cf3e91423b16', id: this.inputId, ref: e => (this.textareaElement = e), placeholder: this.placeholder, autofocus: this.autofocus, name: this.name, disabled: this.disabled, readOnly: this.readonly, required: this.required, maxlength: this.maxlength, minlength: this.minlength, autocomplete: "off", value: this.value, onInput: this.handleTextarea, rows: this.rows, class: clsx297c1ffe.clsx(this.resize === 'none' && 'resize-none', this.resize === 'vertical' && 'resize-y', this.resize === 'horizontal' && 'resize-x', this.resize === 'both' && 'resize') }))), (this.description ||
|
|
185
|
+
this.el.querySelector('[slot="description"]')) && (index.h("div", { key: '55475e861f4b63ae2806141eb148d62864615b97', class: "description" }, index.h("slot", { key: 'da2d6533d1b86f7ad3cb436650e3691cc155a1dd', name: "description" }, this.description))), (this.errorDescription ||
|
|
186
|
+
this.el.querySelector('[slot="error-description"]')) && (index.h("div", { key: '239cc36f8db7855aeedf3c8f428099921142f249', hidden: !this.error, class: "error-description" }, index.h("slot", { key: '97cd804f0c573da6042a6194c263d8580931ca55', name: "error-description" }, this.errorDescription)))));
|
|
187
|
+
}
|
|
188
|
+
static get formAssociated() { return true; }
|
|
189
|
+
get el() { return index.getElement(this); }
|
|
190
|
+
static get watchers() { return {
|
|
191
|
+
"rows": ["rowsChanged"],
|
|
192
|
+
"autosize": ["autosizeChanged"],
|
|
193
|
+
"value": ["handleValueChange"]
|
|
194
|
+
}; }
|
|
195
|
+
};
|
|
196
|
+
NvFieldtextarea.style = NvFieldtextareaStyle0;
|
|
197
|
+
|
|
198
|
+
exports.nv_fieldtextarea = NvFieldtextarea;
|