@luzmo/lucero 1.0.1-alpha.45 → 1.0.1-alpha.47

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luzmo/lucero",
3
- "version": "1.0.1-alpha.45",
3
+ "version": "1.0.1-alpha.47",
4
4
  "homepage": "https://luzmo.com",
5
5
  "description": "Lucero - The design system for Luzmo",
6
6
  "type": "module",
@@ -1,81 +0,0 @@
1
- /*! * Lucero - The design system for Luzmo.
2
- *
3
- * Copyright © 2025 Luzmo
4
- * All rights reserved.
5
- * Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
6
- * This license allows users with a current active Luzmo account to use Lucero.
7
- * This license terminates automatically if a user no longer has an active Luzmo account.
8
- * Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
9
- *
10
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16
- * SOFTWARE.
17
- * */
18
- "use strict";const n=require("lit"),i=require("lit/decorators.js"),s=require("lit/directives/if-defined.js"),y=require("lit/directives/live.js"),h=require("@luzmo/icons"),v=require("./focusable-agUxU61W.cjs"),f=require("./sized-mixin-DcvJLFeo.cjs"),m=require("./manage-help-text-Bat9yGvF.cjs"),g=require("./text-field.module-eAEqjvZu.cjs");var $=Object.defineProperty,x=Object.getOwnPropertyDescriptor,r=(p,e,l,a)=>{for(var o=a>1?void 0:a?x(e,l):e,u=p.length-1,d;u>=0;u--)(d=p[u])&&(o=(a?d(e,l,o):d(o))||o);return a&&o&&$(e,l,o),o};const b=["text","url","tel","email","password"];class t extends m.ManageHelpText(f.SizedMixin(v.Focusable,{noDefaultSize:!0})){constructor(){super(...arguments),this.allowedKeys="",this.focused=!1,this.invalid=!1,this.label="",this.placeholder="",this._type="text",this.grows=!1,this.maxlength=-1,this.minlength=-1,this.multiline=!1,this.readonly=!1,this.rows=-1,this.valid=!1,this._value="",this.quiet=!1,this.required=!1}static get styles(){return[n.unsafeCSS(g.textFieldStyles)]}set type(e){const l=this._type;this._type=e,this.requestUpdate("type",l)}get type(){return b.find(e=>e===this._type)??"text"}set value(e){if(e===this.value)return;const l=this._value;this._value=e,this.requestUpdate("value",l)}get value(){return this._value}get focusElement(){return this.inputElement}setSelectionRange(e,l,a="none"){this.inputElement.setSelectionRange(e,l,a)}select(){this.inputElement.select()}handleInput(e){if(this.allowedKeys&&this.inputElement.value&&!new RegExp(`^[${this.allowedKeys}]*$`,"u").test(this.inputElement.value)){const o=this.inputElement.selectionStart-1;this.inputElement.value=this.value.toString(),this.inputElement.setSelectionRange(o,o);return}this.value=this.inputElement.value}handleChange(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}onFocus(){this.focused=!this.readonly&&!0}onBlur(e){this.focused=!this.readonly&&!1}handleInputElementPointerdown(){}renderStateIcons(){return this.invalid?n.html`
19
- <div id="invalid" class="icon">${h.luzmoIcon(h.luzmoAlert)}</div>
20
- `:this.valid?n.html`
21
- <div id="valid" class="icon">${h.luzmoIcon(h.luzmoCheck)}</div>
22
- `:n.nothing}get displayValue(){return this.value.toString()}get renderMultiline(){return n.html`
23
- ${this.multiline&&this.grows&&this.rows===-1?n.html`
24
- <div id="sizer" class="input" aria-hidden="true">${this.value}&#8203;
25
- </div>
26
- `:n.nothing}
27
- <!-- @ts-ignore -->
28
- <textarea
29
- name=${s.ifDefined(this.name||void 0)}
30
- aria-describedby=${this.helpTextId}
31
- aria-label=${this.label||this.appliedLabel||this.placeholder}
32
- aria-invalid=${s.ifDefined(this.invalid||void 0)}
33
- class="input"
34
- maxlength=${s.ifDefined(this.maxlength>-1?this.maxlength:void 0)}
35
- minlength=${s.ifDefined(this.minlength>-1?this.minlength:void 0)}
36
- title=${this.invalid?"":n.nothing}
37
- pattern=${s.ifDefined(this.pattern)}
38
- placeholder=${this.placeholder}
39
- .value=${this.displayValue}
40
- @change=${this.handleChange}
41
- @input=${this.handleInput}
42
- @focus=${this.onFocus}
43
- @blur=${this.onBlur}
44
- ?disabled=${this.disabled}
45
- ?required=${this.required}
46
- ?readonly=${this.readonly}
47
- rows=${s.ifDefined(this.rows>-1?this.rows:void 0)}
48
- autocomplete=${s.ifDefined(this.autocomplete)}
49
- ></textarea>
50
- `}get renderInput(){return n.html`
51
- <!-- @ts-ignore -->
52
- <input
53
- name=${s.ifDefined(this.name||void 0)}
54
- type=${this.type}
55
- aria-describedby=${this.helpTextId}
56
- aria-label=${this.label||this.appliedLabel||this.placeholder}
57
- aria-invalid=${s.ifDefined(this.invalid||void 0)}
58
- class="input"
59
- title=${this.invalid?"":n.nothing}
60
- maxlength=${s.ifDefined(this.maxlength>-1?this.maxlength:void 0)}
61
- minlength=${s.ifDefined(this.minlength>-1?this.minlength:void 0)}
62
- pattern=${s.ifDefined(this.pattern)}
63
- placeholder=${this.placeholder}
64
- .value=${y.live(this.displayValue)}
65
- @change=${this.handleChange}
66
- @input=${this.handleInput}
67
- @pointerdown=${this.handleInputElementPointerdown}
68
- @focus=${this.onFocus}
69
- @blur=${this.onBlur}
70
- ?disabled=${this.disabled}
71
- ?required=${this.required}
72
- ?readonly=${this.readonly}
73
- autocomplete=${s.ifDefined(this.autocomplete)}
74
- />
75
- `}renderField(){return n.html`
76
- ${this.renderStateIcons()}
77
- ${this.multiline?this.renderMultiline:this.renderInput}
78
- `}render(){return n.html`
79
- <div id="text-field">${this.renderField()}</div>
80
- ${this.renderHelpText(this.invalid)}
81
- `}update(e){(e.has("value")||e.has("required")&&this.required)&&this.updateComplete.then(()=>{this.checkValidity()}),super.update(e)}checkValidity(){let e=this.inputElement.checkValidity();return(this.required||this.value&&this.pattern)&&((this.disabled||this.multiline)&&this.pattern&&(e=new RegExp(`^${this.pattern}$`,"u").test(this.value.toString())),this.minlength!==void 0&&(e=e&&this.value.toString().length>=this.minlength),this.valid=e,this.invalid=!e),e}}r([i.state()],t.prototype,"appliedLabel",2);r([i.property({attribute:"allowed-keys"})],t.prototype,"allowedKeys",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"focused",2);r([i.query(".input:not(#sizer)")],t.prototype,"inputElement",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"invalid",2);r([i.property()],t.prototype,"label",2);r([i.property({type:String,reflect:!0})],t.prototype,"name",2);r([i.property()],t.prototype,"placeholder",2);r([i.state()],t.prototype,"type",1);r([i.property({attribute:"type",reflect:!0})],t.prototype,"_type",2);r([i.property()],t.prototype,"pattern",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"grows",2);r([i.property({type:Number})],t.prototype,"maxlength",2);r([i.property({type:Number})],t.prototype,"minlength",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"multiline",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"readonly",2);r([i.property({type:Number})],t.prototype,"rows",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"valid",2);r([i.property({type:String})],t.prototype,"value",1);r([i.property({type:Boolean,reflect:!0})],t.prototype,"quiet",2);r([i.property({type:Boolean,reflect:!0})],t.prototype,"required",2);r([i.property({type:String,reflect:!0})],t.prototype,"autocomplete",2);class c extends t{constructor(){super(...arguments),this._value=""}set value(e){if(e===this.value)return;const l=this._value;this._value=e,this.requestUpdate("value",l)}get value(){return this._value}}r([i.property({type:String})],c.prototype,"value",1);exports.LuzmoTextField=c;exports.LuzmoTextFieldBase=t;
@@ -1,288 +0,0 @@
1
- /*! * Lucero - The design system for Luzmo.
2
- *
3
- * Copyright © 2025 Luzmo
4
- * All rights reserved.
5
- * Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
6
- * This license allows users with a current active Luzmo account to use Lucero.
7
- * This license terminates automatically if a user no longer has an active Luzmo account.
8
- * Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
9
- *
10
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16
- * SOFTWARE.
17
- * */
18
- import { unsafeCSS as v, html as o, nothing as p } from "lit";
19
- import { state as m, property as l, query as y } from "lit/decorators.js";
20
- import { ifDefined as r } from "lit/directives/if-defined.js";
21
- import { live as f } from "lit/directives/live.js";
22
- import { luzmoIcon as c, luzmoAlert as g, luzmoCheck as $ } from "@luzmo/icons";
23
- import { F as x } from "./focusable-BM1nd-dI.js";
24
- import { S as b } from "./sized-mixin-cJbo3PKR.js";
25
- import { M as S } from "./manage-help-text-C9sCHK3R.js";
26
- import { t as w } from "./text-field.module-Bp4Mwuvj.js";
27
- var _ = Object.defineProperty, E = Object.getOwnPropertyDescriptor, t = (h, e, s, a) => {
28
- for (var n = a > 1 ? void 0 : a ? E(e, s) : e, u = h.length - 1, d; u >= 0; u--)
29
- (d = h[u]) && (n = (a ? d(e, s, n) : d(n)) || n);
30
- return a && n && _(e, s, n), n;
31
- };
32
- const q = ["text", "url", "tel", "email", "password"];
33
- class i extends S(
34
- b(x, {
35
- noDefaultSize: !0
36
- })
37
- ) {
38
- constructor() {
39
- super(...arguments), this.allowedKeys = "", this.focused = !1, this.invalid = !1, this.label = "", this.placeholder = "", this._type = "text", this.grows = !1, this.maxlength = -1, this.minlength = -1, this.multiline = !1, this.readonly = !1, this.rows = -1, this.valid = !1, this._value = "", this.quiet = !1, this.required = !1;
40
- }
41
- static get styles() {
42
- return [v(w)];
43
- }
44
- set type(e) {
45
- const s = this._type;
46
- this._type = e, this.requestUpdate("type", s);
47
- }
48
- get type() {
49
- return q.find((e) => e === this._type) ?? "text";
50
- }
51
- set value(e) {
52
- if (e === this.value)
53
- return;
54
- const s = this._value;
55
- this._value = e, this.requestUpdate("value", s);
56
- }
57
- get value() {
58
- return this._value;
59
- }
60
- get focusElement() {
61
- return this.inputElement;
62
- }
63
- /**
64
- * Sets the start and end positions of the current selection.
65
- *
66
- * @param selectionStart The 0-based index of the first selected character. An index greater than the length of the
67
- * element's value is treated as pointing to the end of the value.
68
- * @param selectionEnd The 0-based index of the character after the last selected character. An index greater than
69
- * the length of the element's value is treated as pointing to the end of the value.
70
- * @param [selectionDirection="none"] A string indicating the direction in which the selection is considered to
71
- * have been performed.
72
- */
73
- setSelectionRange(e, s, a = "none") {
74
- this.inputElement.setSelectionRange(
75
- e,
76
- s,
77
- a
78
- );
79
- }
80
- /**
81
- * Selects all the text.
82
- */
83
- select() {
84
- this.inputElement.select();
85
- }
86
- handleInput(e) {
87
- if (this.allowedKeys && this.inputElement.value && !new RegExp(`^[${this.allowedKeys}]*$`, "u").test(this.inputElement.value)) {
88
- const n = this.inputElement.selectionStart - 1;
89
- this.inputElement.value = this.value.toString(), this.inputElement.setSelectionRange(n, n);
90
- return;
91
- }
92
- this.value = this.inputElement.value;
93
- }
94
- handleChange() {
95
- this.dispatchEvent(
96
- new Event("change", {
97
- bubbles: !0,
98
- composed: !0
99
- })
100
- );
101
- }
102
- onFocus() {
103
- this.focused = !this.readonly && !0;
104
- }
105
- onBlur(e) {
106
- this.focused = !this.readonly && !1;
107
- }
108
- handleInputElementPointerdown() {
109
- }
110
- renderStateIcons() {
111
- return this.invalid ? o`
112
- <div id="invalid" class="icon">${c(g)}</div>
113
- ` : this.valid ? o`
114
- <div id="valid" class="icon">${c($)}</div>
115
- ` : p;
116
- }
117
- get displayValue() {
118
- return this.value.toString();
119
- }
120
- // prettier-ignore
121
- get renderMultiline() {
122
- return o`
123
- ${this.multiline && this.grows && this.rows === -1 ? o`
124
- <div id="sizer" class="input" aria-hidden="true">${this.value}&#8203;
125
- </div>
126
- ` : p}
127
- <!-- @ts-ignore -->
128
- <textarea
129
- name=${r(this.name || void 0)}
130
- aria-describedby=${this.helpTextId}
131
- aria-label=${this.label || this.appliedLabel || this.placeholder}
132
- aria-invalid=${r(this.invalid || void 0)}
133
- class="input"
134
- maxlength=${r(this.maxlength > -1 ? this.maxlength : void 0)}
135
- minlength=${r(this.minlength > -1 ? this.minlength : void 0)}
136
- title=${this.invalid ? "" : p}
137
- pattern=${r(this.pattern)}
138
- placeholder=${this.placeholder}
139
- .value=${this.displayValue}
140
- @change=${this.handleChange}
141
- @input=${this.handleInput}
142
- @focus=${this.onFocus}
143
- @blur=${this.onBlur}
144
- ?disabled=${this.disabled}
145
- ?required=${this.required}
146
- ?readonly=${this.readonly}
147
- rows=${r(this.rows > -1 ? this.rows : void 0)}
148
- autocomplete=${r(this.autocomplete)}
149
- ></textarea>
150
- `;
151
- }
152
- get renderInput() {
153
- return o`
154
- <!-- @ts-ignore -->
155
- <input
156
- name=${r(this.name || void 0)}
157
- type=${this.type}
158
- aria-describedby=${this.helpTextId}
159
- aria-label=${this.label || this.appliedLabel || this.placeholder}
160
- aria-invalid=${r(this.invalid || void 0)}
161
- class="input"
162
- title=${this.invalid ? "" : p}
163
- maxlength=${r(this.maxlength > -1 ? this.maxlength : void 0)}
164
- minlength=${r(this.minlength > -1 ? this.minlength : void 0)}
165
- pattern=${r(this.pattern)}
166
- placeholder=${this.placeholder}
167
- .value=${f(this.displayValue)}
168
- @change=${this.handleChange}
169
- @input=${this.handleInput}
170
- @pointerdown=${this.handleInputElementPointerdown}
171
- @focus=${this.onFocus}
172
- @blur=${this.onBlur}
173
- ?disabled=${this.disabled}
174
- ?required=${this.required}
175
- ?readonly=${this.readonly}
176
- autocomplete=${r(this.autocomplete)}
177
- />
178
- `;
179
- }
180
- renderField() {
181
- return o`
182
- ${this.renderStateIcons()}
183
- ${this.multiline ? this.renderMultiline : this.renderInput}
184
- `;
185
- }
186
- render() {
187
- return o`
188
- <div id="text-field">${this.renderField()}</div>
189
- ${this.renderHelpText(this.invalid)}
190
- `;
191
- }
192
- update(e) {
193
- (e.has("value") || e.has("required") && this.required) && this.updateComplete.then(() => {
194
- this.checkValidity();
195
- }), super.update(e);
196
- }
197
- checkValidity() {
198
- let e = this.inputElement.checkValidity();
199
- return (this.required || this.value && this.pattern) && ((this.disabled || this.multiline) && this.pattern && (e = new RegExp(`^${this.pattern}$`, "u").test(this.value.toString())), this.minlength !== void 0 && (e = e && this.value.toString().length >= this.minlength), this.valid = e, this.invalid = !e), e;
200
- }
201
- }
202
- t([
203
- m()
204
- ], i.prototype, "appliedLabel", 2);
205
- t([
206
- l({ attribute: "allowed-keys" })
207
- ], i.prototype, "allowedKeys", 2);
208
- t([
209
- l({ type: Boolean, reflect: !0 })
210
- ], i.prototype, "focused", 2);
211
- t([
212
- y(".input:not(#sizer)")
213
- ], i.prototype, "inputElement", 2);
214
- t([
215
- l({ type: Boolean, reflect: !0 })
216
- ], i.prototype, "invalid", 2);
217
- t([
218
- l()
219
- ], i.prototype, "label", 2);
220
- t([
221
- l({ type: String, reflect: !0 })
222
- ], i.prototype, "name", 2);
223
- t([
224
- l()
225
- ], i.prototype, "placeholder", 2);
226
- t([
227
- m()
228
- ], i.prototype, "type", 1);
229
- t([
230
- l({ attribute: "type", reflect: !0 })
231
- ], i.prototype, "_type", 2);
232
- t([
233
- l()
234
- ], i.prototype, "pattern", 2);
235
- t([
236
- l({ type: Boolean, reflect: !0 })
237
- ], i.prototype, "grows", 2);
238
- t([
239
- l({ type: Number })
240
- ], i.prototype, "maxlength", 2);
241
- t([
242
- l({ type: Number })
243
- ], i.prototype, "minlength", 2);
244
- t([
245
- l({ type: Boolean, reflect: !0 })
246
- ], i.prototype, "multiline", 2);
247
- t([
248
- l({ type: Boolean, reflect: !0 })
249
- ], i.prototype, "readonly", 2);
250
- t([
251
- l({ type: Number })
252
- ], i.prototype, "rows", 2);
253
- t([
254
- l({ type: Boolean, reflect: !0 })
255
- ], i.prototype, "valid", 2);
256
- t([
257
- l({ type: String })
258
- ], i.prototype, "value", 1);
259
- t([
260
- l({ type: Boolean, reflect: !0 })
261
- ], i.prototype, "quiet", 2);
262
- t([
263
- l({ type: Boolean, reflect: !0 })
264
- ], i.prototype, "required", 2);
265
- t([
266
- l({ type: String, reflect: !0 })
267
- ], i.prototype, "autocomplete", 2);
268
- class B extends i {
269
- constructor() {
270
- super(...arguments), this._value = "";
271
- }
272
- set value(e) {
273
- if (e === this.value)
274
- return;
275
- const s = this._value;
276
- this._value = e, this.requestUpdate("value", s);
277
- }
278
- get value() {
279
- return this._value;
280
- }
281
- }
282
- t([
283
- l({ type: String })
284
- ], B.prototype, "value", 1);
285
- export {
286
- B as L,
287
- i as a
288
- };