@luzmo/lucero 1.0.1-alpha.46 → 1.0.1-alpha.48
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/components/accordion/index.cjs +1 -1
- package/components/accordion/index.js +1 -1
- package/components/action-bar/index.cjs +1 -1
- package/components/action-bar/index.js +2 -2
- package/components/chat-message/index.cjs +1 -1
- package/components/chat-message/index.js +1 -1
- package/components/chat-message-group/index.cjs +2 -2
- package/components/chat-message-group/index.js +10 -10
- package/components/checkbox/index.cjs +1 -1
- package/components/checkbox/index.js +1 -1
- package/components/color-field/index.cjs +1 -1
- package/components/color-field/index.js +1 -1
- package/components/date-time-picker/index.cjs +1 -1
- package/components/date-time-picker/index.js +1 -1
- package/components/index.cjs +1 -1
- package/components/index.js +2 -2
- package/components/menu/index.cjs +1 -1
- package/components/menu/index.js +1 -1
- package/components/number-field/index.cjs +1 -1
- package/components/number-field/index.js +1 -1
- package/components/popover/index.cjs +1 -1
- package/components/popover/index.js +1 -1
- package/components/{popover-UFgI7b75.js → popover-9RrCrbbh.js} +1 -1
- package/components/{popover-CPZ51K_z.cjs → popover-DoH42mv2.cjs} +1 -1
- package/components/prompt-box/index.cjs +28 -26
- package/components/prompt-box/index.js +90 -61
- package/components/prompt-box/prompt-box.d.ts +72 -12
- package/components/search/index.cjs +1 -1
- package/components/search/index.js +2 -2
- package/components/select/index.cjs +1 -1
- package/components/select/index.js +44 -44
- package/components/tags/index.cjs +1 -1
- package/components/tags/index.js +1 -1
- package/components/text-field/index.cjs +1 -1
- package/components/text-field/index.js +1 -1
- package/components/text-field/text-field.d.ts +25 -0
- package/components/text-field-Czie2Tyh.js +332 -0
- package/components/text-field-DL5Qe8rI.cjs +81 -0
- package/components/{text-field.module-eAEqjvZu.cjs → text-field.module-BuB2wcWe.cjs} +1 -1
- package/components/{text-field.module-Bp4Mwuvj.js → text-field.module-CTNU1d1S.js} +1 -1
- package/components/toast/index.cjs +1 -1
- package/components/toast/index.js +4 -4
- package/custom-elements.json +1 -1
- package/package.json +1 -1
- package/components/text-field-CclDsK1X.cjs +0 -81
- package/components/text-field-Ckbe58fH.js +0 -288
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
* */
|
|
18
18
|
import { luzmoClear as $, luzmoCheck as C, luzmoMicrophone as k, luzmoArrowUp as S } from "@luzmo/icons";
|
|
19
19
|
import { unsafeCSS as B, html as s, nothing as f } from "lit";
|
|
20
|
-
import { property as m, state as h, query as
|
|
20
|
+
import { property as m, state as h, query as _ } from "lit/decorators.js";
|
|
21
21
|
import { repeat as E } from "lit/directives/repeat.js";
|
|
22
22
|
import { a as F } from "../base-BUViEg_7.js";
|
|
23
23
|
import { S as L } from "../sized-mixin-cJbo3PKR.js";
|
|
24
|
-
import { V as
|
|
24
|
+
import { V as w } from "../voice-recorder-BRq_gEkz.js";
|
|
25
25
|
import "../action-button/index.js";
|
|
26
26
|
import "../button/index.js";
|
|
27
27
|
import "../icon/index.js";
|
|
@@ -35,28 +35,28 @@ const A = () => {
|
|
|
35
35
|
};
|
|
36
36
|
A();
|
|
37
37
|
const I = ":host{display:flex;flex-direction:column;font-family:var(--luzmo-prompt-box-font-family, var(--prompt-box-font-family));font-size:var(--luzmo-prompt-box-font-size, var(--prompt-box-font-size));line-height:var(--luzmo-prompt-box-line-height, var(--prompt-box-line-height));color:var(--highcontrast-prompt-box-text-color, var(--luzmo-prompt-box-text-color, var(--prompt-box-text-color)));width:100%}:host([disabled]){opacity:var(--luzmo-prompt-box-disabled-opacity, var(--prompt-box-disabled-opacity));pointer-events:none}.container{display:flex;flex-direction:column;gap:var(--luzmo-prompt-box-gap, var(--prompt-box-gap));padding:var(--luzmo-prompt-box-vertical-padding, var(--prompt-box-vertical-padding)) var(--luzmo-prompt-box-horizontal-padding, var(--prompt-box-horizontal-padding));background-color:var(--highcontrast-prompt-box-background-color, var(--luzmo-prompt-box-background-color, var(--prompt-box-background-color)));border-radius:var(--luzmo-prompt-box-border-radius, var(--prompt-box-border-radius));border-width:var(--luzmo-prompt-box-border-width, var(--prompt-box-border-width));border-style:solid;border-color:var(--highcontrast-prompt-box-border-color, var(--luzmo-prompt-box-border-color, var(--prompt-box-border-color)));box-shadow:var(--luzmo-prompt-box-shadow, var(--prompt-box-shadow));transition:border-color var(--luzmo-prompt-box-animation-duration, var(--prompt-box-animation-duration)) ease-in-out,box-shadow var(--luzmo-prompt-box-animation-duration, var(--prompt-box-animation-duration)) ease-in-out}:host(:focus-visible) .container{border-color:var(--luzmo-prompt-box-border-color-focus, var(--prompt-box-border-color-focus));box-shadow:var(--luzmo-prompt-box-shadow-focus, var(--prompt-box-shadow-focus))}:host(.focus-visible) .container{border-color:var(--luzmo-prompt-box-border-color-focus, var(--prompt-box-border-color-focus));box-shadow:var(--luzmo-prompt-box-shadow-focus, var(--prompt-box-shadow-focus))}:host(:focus){outline:none}.top-actions{display:flex;align-items:center;gap:var(--luzmo-prompt-box-top-actions-gap, var(--prompt-box-top-actions-gap));flex-wrap:wrap;opacity:var(--luzmo-prompt-box-actions-opacity, var(--prompt-box-actions-opacity, 1));transition:opacity var(--luzmo-prompt-box-animation-duration, var(--prompt-box-animation-duration)) ease-in-out}.top-actions.empty{display:none}.hidden-file-input{position:absolute;width:0;height:0;opacity:0;overflow:hidden;pointer-events:none}.attachments{display:flex;flex-direction:column;gap:var(--luzmo-prompt-box-attachments-gap, var(--prompt-box-attachments-gap, 8px))}.image-attachments{display:flex;flex-wrap:wrap;gap:var(--luzmo-prompt-box-image-attachments-gap, var(--prompt-box-image-attachments-gap, 8px))}.image-attachment{position:relative;display:inline-flex;width:var(--luzmo-prompt-box-image-preview-size, var(--prompt-box-image-preview-size, 80px));height:var(--luzmo-prompt-box-image-preview-size, var(--prompt-box-image-preview-size, 80px));border-radius:var(--luzmo-prompt-box-image-border-radius, var(--prompt-box-image-border-radius, 8px));overflow:hidden;background-color:var(--luzmo-prompt-box-image-background, var(--prompt-box-image-background, rgba(0, 0, 0, .05)))}.image-preview{width:100%;height:100%;object-fit:cover}.attachment-remove{position:absolute;top:4px;right:4px;width:var(--luzmo-prompt-box-remove-button-size, var(--prompt-box-remove-button-size, 24px));height:var(--luzmo-prompt-box-remove-button-size, var(--prompt-box-remove-button-size, 24px));background-color:var(--luzmo-prompt-box-remove-button-background, var(--prompt-box-remove-button-background, rgba(0, 0, 0, .5)));border-radius:50%;--luzmo-clear-button-icon-color: var( --luzmo-prompt-box-remove-button-icon-color, var(--prompt-box-remove-button-icon-color, #fff) )}.attachment-remove:hover{background-color:var(--luzmo-prompt-box-remove-button-background-hover, var(--prompt-box-remove-button-background-hover, rgba(0, 0, 0, .7)))}.file-attachments{--luzmo-tag-border-radius: 16px;display:flex;flex-wrap:wrap;gap:var(--luzmo-prompt-box-file-attachments-gap, var(--prompt-box-file-attachments-gap, 4px))}.file-attachment{max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.input-wrapper{position:relative;display:flex;flex:1}.input-field{flex:1;width:100%;min-width:0;--luzmo-text-field-focus-indicator-width: 0;--luzmo-text-field-border-width: 0;--luzmo-text-field-width: 100%;--luzmo-text-field-min-width: 0;--luzmo-text-field-placeholder-text-color-default: var( --luzmo-prompt-box-placeholder-color, var(--prompt-box-placeholder-color) )}.actions-row{display:flex;align-items:center;justify-content:space-between;gap:var(--luzmo-prompt-box-actions-gap, var(--prompt-box-actions-gap))}.bottom-actions{display:flex;align-items:center;gap:var(--luzmo-prompt-box-bottom-actions-gap, var(--prompt-box-bottom-actions-gap));flex-wrap:wrap;flex:1;opacity:var(--luzmo-prompt-box-actions-opacity, var(--prompt-box-actions-opacity, 1));transition:opacity var(--luzmo-prompt-box-animation-duration, var(--prompt-box-animation-duration)) ease-in-out}.button-group{display:flex;align-items:center;gap:var(--luzmo-prompt-box-button-group-gap, var(--prompt-box-button-group-gap));margin-left:auto}.record-button,.cancel-recording-button{--luzmo-action-button-border-radius: var( --luzmo-prompt-box-record-button-border-radius, 50% );--luzmo-action-button-focus-indicator-border-radius: var( --luzmo-prompt-box-record-button-focus-indicator-border-radius, 50% )}.submit-button{margin-inline-start:var(--luzmo-prompt-box-submit-button-margin-inline-start, var(--prompt-box-submit-button-margin-inline-start))}.recording-ui{display:flex;align-items:center;gap:var(--luzmo-prompt-box-recording-gap, var(--prompt-box-recording-gap))}.waveform{display:flex;align-items:center;gap:var(--luzmo-prompt-box-waveform-gap, var(--prompt-box-waveform-gap, 3px));height:var(--luzmo-prompt-box-waveform-height, var(--prompt-box-waveform-height, 24px));padding:0 4px}.waveform-bar{width:var(--luzmo-prompt-box-waveform-bar-width, var(--prompt-box-waveform-bar-width, 3px));height:calc(var(--bar-height, .3) * var(--luzmo-prompt-box-waveform-height, var(--prompt-box-waveform-height, 24px)));min-height:4px;background-color:var(--luzmo-prompt-box-waveform-bar-color, var(--prompt-box-waveform-bar-color, currentColor));border-radius:var(--luzmo-prompt-box-waveform-bar-radius, var(--prompt-box-waveform-bar-radius, 2px));transition:height .05s ease-out;animation:waveform-pulse 1s ease-in-out infinite}.waveform-bar:nth-child(1){animation-delay:0s}.waveform-bar:nth-child(2){animation-delay:.1s}.waveform-bar:nth-child(3){animation-delay:.2s}.waveform-bar:nth-child(4){animation-delay:.1s}.waveform-bar:nth-child(5){animation-delay:0s}@keyframes waveform-pulse{0%,to{opacity:.6}50%{opacity:1}}.recording-duration{font-family:var(--luzmo-prompt-box-recording-duration-font-family, var(--prompt-box-recording-duration-font-family, monospace));font-size:var(--luzmo-prompt-box-recording-duration-font-size, var(--prompt-box-recording-duration-font-size, 14px));font-weight:var(--luzmo-prompt-box-recording-duration-font-weight, var(--prompt-box-recording-duration-font-weight, 500));color:var(--luzmo-prompt-box-recording-duration-color, var(--prompt-box-recording-duration-color, currentColor));text-align:center}::slotted([slot=top-actions]){display:inline-flex;align-items:center}::slotted([slot=bottom-actions]){display:inline-flex;align-items:center}::slotted([slot=record-button]){display:inline-flex}::slotted([slot=submit-button]){display:inline-flex;margin-inline-start:var(--luzmo-prompt-box-submit-button-margin-inline-start, var(--prompt-box-submit-button-margin-inline-start))}@media (forced-colors: active){:host{--highcontrast-prompt-box-background-color: Canvas;--highcontrast-prompt-box-border-color: CanvasText;--highcontrast-prompt-box-text-color: CanvasText}}:host{--prompt-box-font-family: var(--luzmo-font-family);--prompt-box-font-size: var(--luzmo-font-size);--prompt-box-line-height: 1.5;--prompt-box-text-color: var(--luzmo-font-color);--prompt-box-background-color: var(--luzmo-background-color);--prompt-box-border-radius: var(--luzmo-border-radius-xl);--prompt-box-border-width: var(--luzmo-border-width);--prompt-box-border-color: var(--luzmo-border-color);--prompt-box-border-color-focus: var(--luzmo-primary);--prompt-box-shadow: 0 2px 8px rgba(var(--luzmo-border-color-rgb), .08);--prompt-box-shadow-focus: 0 2px 12px rgba(var(--luzmo-primary-rgb), .15);--prompt-box-gap: var(--luzmo-spacing-5);--prompt-box-recording-gap: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--prompt-box-vertical-padding: var(--luzmo-spacing-4);--prompt-box-horizontal-padding: var(--luzmo-spacing-5);--prompt-box-actions-gap: var(--luzmo-spacing-3);--prompt-box-top-actions-gap: var(--luzmo-spacing-2);--prompt-box-bottom-actions-gap: var(--luzmo-spacing-2);--prompt-box-button-group-gap: var(--luzmo-spacing-2);--prompt-box-submit-button-margin-inline-start: var(--luzmo-spacing-3);--prompt-box-max-height: 200px;--prompt-box-placeholder-color: var(--luzmo-font-color-extra-dimmed);--prompt-box-placeholder-opacity: 1;--prompt-box-animation-duration: var(--luzmo-animation-duration, .15s);--prompt-box-disabled-opacity: .5;--prompt-box-attachments-gap: var(--luzmo-spacing-1);--prompt-box-image-attachments-gap: var(--luzmo-spacing-2);--prompt-box-file-attachments-gap: var(--luzmo-spacing-2);--prompt-box-image-preview-size: 64px;--prompt-box-image-border-radius: var(--luzmo-border-radius);--prompt-box-image-background: rgba(0, 0, 0, .05);--prompt-box-remove-button-size: 20px;--prompt-box-remove-button-background: rgba(0, 0, 0, .5);--prompt-box-remove-button-background-hover: rgba(0, 0, 0, .7);--prompt-box-remove-button-icon-color: #fff}:host([size=s]){--prompt-box-font-size: var(--luzmo-font-size-s);--prompt-box-border-radius: var(--luzmo-border-radius-l);--prompt-box-vertical-padding: var(--luzmo-spacing-3);--prompt-box-horizontal-padding: var(--luzmo-spacing-4);--prompt-box-gap: var(--luzmo-spacing-4);--prompt-box-attachments-gap: 0;--prompt-box-image-attachments-gap: var(--luzmo-spacing-1);--prompt-box-recording-gap: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--prompt-box-max-height: 150px;--prompt-box-image-preview-size: 48px;--prompt-box-remove-button-size: 18px}:host([size=l]){--prompt-box-font-size: var(--luzmo-font-size-l);--prompt-box-border-radius: var(--luzmo-border-radius-xl);--prompt-box-vertical-padding: var(--luzmo-spacing-5);--prompt-box-horizontal-padding: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-1) );--prompt-box-gap: var(--luzmo-spacing-4);--prompt-box-attachments-gap: var(--luzmo-spacing-1);--prompt-box-image-attachments-gap: calc( var(--luzmo-spacing-2) + var(--luzmo-spacing-1) );--prompt-box-recording-gap: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--prompt-box-max-height: 250px;--prompt-box-image-preview-size: 72px;--prompt-box-remove-button-size: 24px}:host([size=xl]){--prompt-box-font-size: var(--luzmo-font-size-xl);--prompt-box-border-radius: var(--luzmo-border-radius-xl);--prompt-box-vertical-padding: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-1) );--prompt-box-horizontal-padding: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-2) );--prompt-box-gap: var(--luzmo-spacing-5);--prompt-box-attachments-gap: var(--luzmo-spacing-2);--prompt-box-image-attachments-gap: var(--luzmo-spacing-3);--prompt-box-max-height: 300px;--prompt-box-image-preview-size: 96px;--prompt-box-remove-button-size: 28px}:host([pending]){--prompt-box-actions-opacity: .75}";
|
|
38
|
-
var T = Object.defineProperty,
|
|
39
|
-
for (var
|
|
40
|
-
(l = b[r]) && (
|
|
41
|
-
return
|
|
38
|
+
var T = Object.defineProperty, a = (b, t, o, e) => {
|
|
39
|
+
for (var n = void 0, r = b.length - 1, l; r >= 0; r--)
|
|
40
|
+
(l = b[r]) && (n = l(t, o, n) || n);
|
|
41
|
+
return n && T(t, o, n), n;
|
|
42
42
|
};
|
|
43
|
-
let
|
|
43
|
+
let x = !1;
|
|
44
44
|
typeof window < "u" && (document.addEventListener(
|
|
45
45
|
"keydown",
|
|
46
46
|
() => {
|
|
47
|
-
|
|
47
|
+
x = !0;
|
|
48
48
|
},
|
|
49
49
|
!0
|
|
50
50
|
), document.addEventListener(
|
|
51
51
|
"mousedown",
|
|
52
52
|
() => {
|
|
53
|
-
|
|
53
|
+
x = !1;
|
|
54
54
|
},
|
|
55
55
|
!0
|
|
56
56
|
), document.addEventListener(
|
|
57
57
|
"pointerdown",
|
|
58
58
|
() => {
|
|
59
|
-
|
|
59
|
+
x = !1;
|
|
60
60
|
},
|
|
61
61
|
!0
|
|
62
62
|
));
|
|
@@ -66,15 +66,15 @@ const i = (d = class extends L(F, {
|
|
|
66
66
|
defaultSize: "m"
|
|
67
67
|
}) {
|
|
68
68
|
constructor() {
|
|
69
|
-
super(...arguments), this.rows = 1, this.grows = !1, this.recording = !1, this.hideSubmit = !1, this.placeholder = "", this.value = "", this.disabled = !1, this.readonly = !1, this.maxlength = -1, this.pending = !1, this.allowImages = !1, this.allowFiles = !1, this.acceptedFileTypes = [], this._hasTopActions = !1, this._hasBottomActions = !1, this._hasRecordButton = !1, this._hasSubmitButton = !1, this._attachments = [], this._isRecording = !1, this._recordingDuration = 0, this._audioLevel = 0, this._voiceRecorder = null, this._shouldFocusFinishButton = !1, this._attachmentIdCounter = 0, this._handleHostFocus = () => {
|
|
70
|
-
|
|
69
|
+
super(...arguments), this.rows = 1, this.grows = !1, this.maxRows = -1, this.recording = !1, this.hideSubmit = !1, this.placeholder = "", this.value = "", this.disabled = !1, this.readonly = !1, this.maxlength = -1, this.pending = !1, this.allowImages = !1, this.allowFiles = !1, this.acceptedFileTypes = [], this._hasTopActions = !1, this._hasBottomActions = !1, this._hasRecordButton = !1, this._hasSubmitButton = !1, this._attachments = [], this._isRecording = !1, this._recordingDuration = 0, this._audioLevel = 0, this._voiceRecorder = null, this._shouldFocusFinishButton = !1, this._attachmentIdCounter = 0, this._handleHostFocus = () => {
|
|
70
|
+
x && this.classList.add("focus-visible");
|
|
71
71
|
}, this._handleHostBlur = () => {
|
|
72
72
|
this.classList.remove("focus-visible");
|
|
73
73
|
}, this._handlePaste = (t) => {
|
|
74
|
-
var
|
|
74
|
+
var n;
|
|
75
75
|
if (!this.allowImages || this.disabled || this.readonly || this.pending)
|
|
76
76
|
return;
|
|
77
|
-
const o = (
|
|
77
|
+
const o = (n = t.clipboardData) == null ? void 0 : n.items;
|
|
78
78
|
if (!o) return;
|
|
79
79
|
const e = [];
|
|
80
80
|
for (const r of o)
|
|
@@ -91,7 +91,7 @@ const i = (d = class extends L(F, {
|
|
|
91
91
|
/**
|
|
92
92
|
* Get the appropriate tag size based on the prompt box size.
|
|
93
93
|
* Tags are one level smaller than the prompt box, with 's' being the minimum.
|
|
94
|
-
* @
|
|
94
|
+
* @internal
|
|
95
95
|
*/
|
|
96
96
|
get _tagSize() {
|
|
97
97
|
switch (this.size) {
|
|
@@ -115,22 +115,42 @@ const i = (d = class extends L(F, {
|
|
|
115
115
|
for (const t of this._attachments)
|
|
116
116
|
t.previewUrl && URL.revokeObjectURL(t.previewUrl);
|
|
117
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Handles the change event for the top actions slot.
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
118
122
|
_handleTopActionsSlotChange(t) {
|
|
119
123
|
const o = t.target;
|
|
120
124
|
this._hasTopActions = o.assignedNodes().length > 0;
|
|
121
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Handles the change event for the bottom actions slot.
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
122
130
|
_handleBottomActionsSlotChange(t) {
|
|
123
131
|
const o = t.target;
|
|
124
132
|
this._hasBottomActions = o.assignedNodes().length > 0;
|
|
125
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Handles the change event for the record button slot.
|
|
136
|
+
* @internal
|
|
137
|
+
*/
|
|
126
138
|
_handleRecordButtonSlotChange(t) {
|
|
127
139
|
const o = t.target;
|
|
128
140
|
this._hasRecordButton = o.assignedNodes().length > 0;
|
|
129
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Handles the change event for the submit button slot.
|
|
144
|
+
* @internal
|
|
145
|
+
*/
|
|
130
146
|
_handleSubmitButtonSlotChange(t) {
|
|
131
147
|
const o = t.target;
|
|
132
148
|
this._hasSubmitButton = o.assignedNodes().length > 0;
|
|
133
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Handles the input event for the input element.
|
|
152
|
+
* @internal
|
|
153
|
+
*/
|
|
134
154
|
_handleInput(t) {
|
|
135
155
|
const o = t.target;
|
|
136
156
|
this.value = o.value, this.dispatchEvent(
|
|
@@ -140,6 +160,10 @@ const i = (d = class extends L(F, {
|
|
|
140
160
|
})
|
|
141
161
|
);
|
|
142
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Handles the keydown event for the input element.
|
|
165
|
+
* @internal
|
|
166
|
+
*/
|
|
143
167
|
_handleKeydown(t) {
|
|
144
168
|
t.key === "Enter" && !t.shiftKey && (t.preventDefault(), this._submit());
|
|
145
169
|
}
|
|
@@ -151,8 +175,8 @@ const i = (d = class extends L(F, {
|
|
|
151
175
|
if (this.acceptedFileTypes.length === 0)
|
|
152
176
|
return !0;
|
|
153
177
|
const o = t.name.toLowerCase(), e = t.type.toLowerCase();
|
|
154
|
-
for (const
|
|
155
|
-
const r =
|
|
178
|
+
for (const n of this.acceptedFileTypes) {
|
|
179
|
+
const r = n.toLowerCase();
|
|
156
180
|
if (r.endsWith("/*")) {
|
|
157
181
|
const l = r.slice(0, -2);
|
|
158
182
|
if (e.startsWith(l + "/"))
|
|
@@ -184,11 +208,11 @@ const i = (d = class extends L(F, {
|
|
|
184
208
|
for (const e of t) {
|
|
185
209
|
if (this._isImageFile(e) && !this.allowImages || !this._isImageFile(e) && !this.allowFiles || !this._isFileTypeAccepted(e))
|
|
186
210
|
continue;
|
|
187
|
-
const
|
|
211
|
+
const n = this._generateAttachmentId(), r = {
|
|
188
212
|
file: e,
|
|
189
|
-
id:
|
|
213
|
+
id: n
|
|
190
214
|
};
|
|
191
|
-
this._isImageFile(e) && (r.previewUrl = URL.createObjectURL(e)), this._attachments = [...this._attachments, r], o.push(
|
|
215
|
+
this._isImageFile(e) && (r.previewUrl = URL.createObjectURL(e)), this._attachments = [...this._attachments, r], o.push(n);
|
|
192
216
|
}
|
|
193
217
|
return o.length > 0 && this.dispatchEvent(
|
|
194
218
|
new CustomEvent("luzmo-attachments-change", {
|
|
@@ -252,8 +276,8 @@ const i = (d = class extends L(F, {
|
|
|
252
276
|
_extractActionValues(t) {
|
|
253
277
|
const o = [];
|
|
254
278
|
for (const e of t) {
|
|
255
|
-
const
|
|
256
|
-
for (const r of
|
|
279
|
+
const n = this._getInteractiveElements(e);
|
|
280
|
+
for (const r of n) {
|
|
257
281
|
const l = {
|
|
258
282
|
element: r,
|
|
259
283
|
name: r.getAttribute("name") || r.getAttribute("label") || void 0
|
|
@@ -275,13 +299,13 @@ const i = (d = class extends L(F, {
|
|
|
275
299
|
'slot[name="top-actions"]'
|
|
276
300
|
), o = (u = this.shadowRoot) == null ? void 0 : u.querySelector(
|
|
277
301
|
'slot[name="bottom-actions"]'
|
|
278
|
-
), e = (t == null ? void 0 : t.assignedElements()) ?? [],
|
|
302
|
+
), e = (t == null ? void 0 : t.assignedElements()) ?? [], n = (o == null ? void 0 : o.assignedElements()) ?? [], r = this._extractActionValues([
|
|
279
303
|
...e,
|
|
280
|
-
...
|
|
304
|
+
...n
|
|
281
305
|
]), l = {
|
|
282
306
|
value: this.value,
|
|
283
307
|
topActions: [...e],
|
|
284
|
-
bottomActions: [...
|
|
308
|
+
bottomActions: [...n],
|
|
285
309
|
actionValues: r,
|
|
286
310
|
attachments: [...this._attachments]
|
|
287
311
|
};
|
|
@@ -294,7 +318,7 @@ const i = (d = class extends L(F, {
|
|
|
294
318
|
);
|
|
295
319
|
}
|
|
296
320
|
async _handleRecordClick(t) {
|
|
297
|
-
if (!
|
|
321
|
+
if (!w.isSupported()) {
|
|
298
322
|
this.dispatchEvent(
|
|
299
323
|
new CustomEvent("luzmo-record-error", {
|
|
300
324
|
bubbles: !0,
|
|
@@ -358,7 +382,7 @@ const i = (d = class extends L(F, {
|
|
|
358
382
|
* @private
|
|
359
383
|
*/
|
|
360
384
|
_initVoiceRecorder() {
|
|
361
|
-
this._voiceRecorder || (this._voiceRecorder = new
|
|
385
|
+
this._voiceRecorder || (this._voiceRecorder = new w({
|
|
362
386
|
maxDuration: 3e5
|
|
363
387
|
// 5 minutes
|
|
364
388
|
}), this._voiceRecorder.onStart(() => {
|
|
@@ -401,7 +425,7 @@ const i = (d = class extends L(F, {
|
|
|
401
425
|
* @private
|
|
402
426
|
*/
|
|
403
427
|
_formatRecordingDuration() {
|
|
404
|
-
return
|
|
428
|
+
return w.formatDuration(this._recordingDuration);
|
|
405
429
|
}
|
|
406
430
|
/**
|
|
407
431
|
* Focus the input element.
|
|
@@ -465,21 +489,21 @@ const i = (d = class extends L(F, {
|
|
|
465
489
|
const t = (p = this.shadowRoot) == null ? void 0 : p.querySelector(
|
|
466
490
|
'slot[name="submit-button"]'
|
|
467
491
|
), o = (t == null ? void 0 : t.assignedElements()) ?? [];
|
|
468
|
-
for (const
|
|
469
|
-
const y = this._getInteractiveElements(
|
|
492
|
+
for (const z of o) {
|
|
493
|
+
const y = this._getInteractiveElements(z);
|
|
470
494
|
for (const c of y)
|
|
471
495
|
this.pending ? (c.setAttribute("pending", ""), c.removeAttribute("disabled"), c.removeAttribute("readonly")) : this.disabled ? (c.removeAttribute("pending"), c.setAttribute("disabled", ""), c.removeAttribute("readonly")) : (c.removeAttribute("pending"), c.removeAttribute("disabled"), c.removeAttribute("readonly"));
|
|
472
496
|
}
|
|
473
|
-
const e = (
|
|
474
|
-
for (const y of
|
|
497
|
+
const e = (z) => {
|
|
498
|
+
for (const y of z) {
|
|
475
499
|
const c = this._getInteractiveElements(y);
|
|
476
500
|
for (const g of c)
|
|
477
501
|
this.disabled ? (g.setAttribute("disabled", ""), g.removeAttribute("readonly")) : this.pending ? (g.removeAttribute("disabled"), g.setAttribute("readonly", "")) : (g.removeAttribute("disabled"), g.removeAttribute("readonly"));
|
|
478
502
|
}
|
|
479
|
-
},
|
|
503
|
+
}, n = (u = this.shadowRoot) == null ? void 0 : u.querySelector(
|
|
480
504
|
'slot[name="top-actions"]'
|
|
481
505
|
);
|
|
482
|
-
e((
|
|
506
|
+
e((n == null ? void 0 : n.assignedElements()) ?? []);
|
|
483
507
|
const r = (v = this.shadowRoot) == null ? void 0 : v.querySelector(
|
|
484
508
|
'slot[name="bottom-actions"]'
|
|
485
509
|
);
|
|
@@ -637,6 +661,7 @@ const i = (d = class extends L(F, {
|
|
|
637
661
|
.size=${this.size}
|
|
638
662
|
rows=${this.rows}
|
|
639
663
|
?grows=${this.grows}
|
|
664
|
+
max-rows=${this.maxRows}
|
|
640
665
|
?readonly=${this.readonly || this.pending || this.disabled}
|
|
641
666
|
maxlength=${this.maxlength > 0 ? this.maxlength : -1}
|
|
642
667
|
multiline
|
|
@@ -644,6 +669,7 @@ const i = (d = class extends L(F, {
|
|
|
644
669
|
label=${this.placeholder || "Enter your message"}
|
|
645
670
|
@input=${this._handleInput}
|
|
646
671
|
@keydown=${this._handleKeydown}
|
|
672
|
+
hide-validation-icons
|
|
647
673
|
></luzmo-text-field>
|
|
648
674
|
`;
|
|
649
675
|
}
|
|
@@ -753,77 +779,80 @@ const i = (d = class extends L(F, {
|
|
|
753
779
|
`;
|
|
754
780
|
}
|
|
755
781
|
}, d.INTERACTIVE_ELEMENTS_SELECTOR = "luzmo-button, luzmo-action-button, luzmo-switch, luzmo-picker, luzmo-picker-button, luzmo-select, luzmo-text-field, luzmo-number-field", d);
|
|
756
|
-
|
|
782
|
+
a([
|
|
757
783
|
m({ type: Number })
|
|
758
784
|
], i.prototype, "rows");
|
|
759
|
-
|
|
785
|
+
a([
|
|
760
786
|
m({ type: Boolean, reflect: !0 })
|
|
761
787
|
], i.prototype, "grows");
|
|
762
|
-
|
|
788
|
+
a([
|
|
789
|
+
m({ type: Number, attribute: "max-rows" })
|
|
790
|
+
], i.prototype, "maxRows");
|
|
791
|
+
a([
|
|
763
792
|
m({ type: Boolean, reflect: !0 })
|
|
764
793
|
], i.prototype, "recording");
|
|
765
|
-
|
|
794
|
+
a([
|
|
766
795
|
m({ type: Boolean, reflect: !0, attribute: "hide-submit" })
|
|
767
796
|
], i.prototype, "hideSubmit");
|
|
768
|
-
|
|
797
|
+
a([
|
|
769
798
|
m({ type: String })
|
|
770
799
|
], i.prototype, "placeholder");
|
|
771
|
-
|
|
800
|
+
a([
|
|
772
801
|
m({ type: String })
|
|
773
802
|
], i.prototype, "value");
|
|
774
|
-
|
|
803
|
+
a([
|
|
775
804
|
m({ type: Boolean, reflect: !0 })
|
|
776
805
|
], i.prototype, "disabled");
|
|
777
|
-
|
|
806
|
+
a([
|
|
778
807
|
m({ type: Boolean, reflect: !0 })
|
|
779
808
|
], i.prototype, "readonly");
|
|
780
|
-
|
|
809
|
+
a([
|
|
781
810
|
m({ type: Number })
|
|
782
811
|
], i.prototype, "maxlength");
|
|
783
|
-
|
|
812
|
+
a([
|
|
784
813
|
m({ type: Boolean, reflect: !0 })
|
|
785
814
|
], i.prototype, "pending");
|
|
786
|
-
|
|
815
|
+
a([
|
|
787
816
|
m({ type: Boolean, reflect: !0, attribute: "allow-images" })
|
|
788
817
|
], i.prototype, "allowImages");
|
|
789
|
-
|
|
818
|
+
a([
|
|
790
819
|
m({ type: Boolean, reflect: !0, attribute: "allow-files" })
|
|
791
820
|
], i.prototype, "allowFiles");
|
|
792
|
-
|
|
821
|
+
a([
|
|
793
822
|
m({ type: Array, attribute: "accepted-file-types" })
|
|
794
823
|
], i.prototype, "acceptedFileTypes");
|
|
795
|
-
|
|
824
|
+
a([
|
|
796
825
|
h()
|
|
797
826
|
], i.prototype, "_hasTopActions");
|
|
798
|
-
|
|
827
|
+
a([
|
|
799
828
|
h()
|
|
800
829
|
], i.prototype, "_hasBottomActions");
|
|
801
|
-
|
|
830
|
+
a([
|
|
802
831
|
h()
|
|
803
832
|
], i.prototype, "_hasRecordButton");
|
|
804
|
-
|
|
833
|
+
a([
|
|
805
834
|
h()
|
|
806
835
|
], i.prototype, "_hasSubmitButton");
|
|
807
|
-
|
|
836
|
+
a([
|
|
808
837
|
h()
|
|
809
838
|
], i.prototype, "_attachments");
|
|
810
|
-
|
|
839
|
+
a([
|
|
811
840
|
h()
|
|
812
841
|
], i.prototype, "_isRecording");
|
|
813
|
-
|
|
842
|
+
a([
|
|
814
843
|
h()
|
|
815
844
|
], i.prototype, "_recordingDuration");
|
|
816
|
-
|
|
845
|
+
a([
|
|
817
846
|
h()
|
|
818
847
|
], i.prototype, "_audioLevel");
|
|
819
|
-
|
|
820
|
-
|
|
848
|
+
a([
|
|
849
|
+
_("luzmo-text-field")
|
|
821
850
|
], i.prototype, "_inputElement");
|
|
822
|
-
|
|
823
|
-
|
|
851
|
+
a([
|
|
852
|
+
_('input[type="file"]')
|
|
824
853
|
], i.prototype, "_fileInput");
|
|
825
|
-
|
|
826
|
-
|
|
854
|
+
a([
|
|
855
|
+
_(".finish-recording-button")
|
|
827
856
|
], i.prototype, "_finishRecordingButton");
|
|
828
857
|
let D = i;
|
|
829
858
|
customElements.get("luzmo-prompt-box") || customElements.define("luzmo-prompt-box", D);
|
|
@@ -53,6 +53,14 @@ export declare class LuzmoPromptBox extends LuzmoPromptBox_base {
|
|
|
53
53
|
* @attr grows
|
|
54
54
|
*/
|
|
55
55
|
grows: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* The maximum number of rows the textarea should grow to when `grows` is enabled.
|
|
58
|
+
* When content exceeds this limit, the textarea will show a scrollbar.
|
|
59
|
+
* A value of -1 means no maximum (unlimited growth).
|
|
60
|
+
* When set, the value must be >= 1; values < 1 will be disregarded.
|
|
61
|
+
* @attr max-rows
|
|
62
|
+
*/
|
|
63
|
+
maxRows: number;
|
|
56
64
|
/**
|
|
57
65
|
* Whether to show the record/voice button.
|
|
58
66
|
* @attr recording
|
|
@@ -113,75 +121,127 @@ export declare class LuzmoPromptBox extends LuzmoPromptBox_base {
|
|
|
113
121
|
acceptedFileTypes: string[];
|
|
114
122
|
/**
|
|
115
123
|
* Whether the prompt box has a top-actions slot.
|
|
116
|
-
* @
|
|
124
|
+
* @internal
|
|
117
125
|
*/
|
|
118
126
|
private _hasTopActions;
|
|
119
127
|
/**
|
|
120
128
|
* Whether the prompt box has a bottom-actions slot.
|
|
121
|
-
* @
|
|
129
|
+
* @internal
|
|
122
130
|
*/
|
|
123
131
|
private _hasBottomActions;
|
|
124
132
|
/**
|
|
125
133
|
* Whether the prompt box has a custom record-button slot.
|
|
126
|
-
* @
|
|
134
|
+
* @internal
|
|
127
135
|
*/
|
|
128
136
|
private _hasRecordButton;
|
|
129
137
|
/**
|
|
130
138
|
* Whether the prompt box has a custom submit-button slot.
|
|
131
|
-
* @
|
|
139
|
+
* @internal
|
|
132
140
|
*/
|
|
133
141
|
private _hasSubmitButton;
|
|
134
142
|
/**
|
|
135
143
|
* List of attachments (files and images).
|
|
136
|
-
* @
|
|
144
|
+
* @internal
|
|
137
145
|
*/
|
|
138
146
|
private _attachments;
|
|
139
147
|
/**
|
|
140
148
|
* Whether the component is currently recording audio.
|
|
141
|
-
* @
|
|
149
|
+
* @internal
|
|
142
150
|
*/
|
|
143
151
|
private _isRecording;
|
|
144
152
|
/**
|
|
145
153
|
* Current recording duration in milliseconds.
|
|
146
|
-
* @
|
|
154
|
+
* @internal
|
|
147
155
|
*/
|
|
148
156
|
private _recordingDuration;
|
|
149
157
|
/**
|
|
150
158
|
* Current audio level for waveform visualization (0-1).
|
|
151
|
-
* @
|
|
159
|
+
* @internal
|
|
152
160
|
*/
|
|
153
161
|
private _audioLevel;
|
|
154
162
|
/**
|
|
155
163
|
* Voice recorder instance.
|
|
156
|
-
* @
|
|
164
|
+
* @internal
|
|
157
165
|
*/
|
|
158
166
|
private _voiceRecorder;
|
|
159
167
|
/**
|
|
160
168
|
* Whether to focus the finish button after render.
|
|
161
|
-
* @
|
|
169
|
+
* @internal
|
|
162
170
|
*/
|
|
163
171
|
private _shouldFocusFinishButton;
|
|
172
|
+
/**
|
|
173
|
+
* The input element.
|
|
174
|
+
* @internal
|
|
175
|
+
*/
|
|
164
176
|
private _inputElement;
|
|
177
|
+
/**
|
|
178
|
+
* The file input element.
|
|
179
|
+
* @internal
|
|
180
|
+
*/
|
|
165
181
|
private _fileInput;
|
|
182
|
+
/**
|
|
183
|
+
* The finish recording button element.
|
|
184
|
+
* @internal
|
|
185
|
+
*/
|
|
166
186
|
private _finishRecordingButton;
|
|
187
|
+
/**
|
|
188
|
+
* The attachment ID counter.
|
|
189
|
+
* @internal
|
|
190
|
+
*/
|
|
167
191
|
private _attachmentIdCounter;
|
|
168
192
|
/**
|
|
169
193
|
* Get the appropriate tag size based on the prompt box size.
|
|
170
194
|
* Tags are one level smaller than the prompt box, with 's' being the minimum.
|
|
171
|
-
* @
|
|
195
|
+
* @internal
|
|
172
196
|
*/
|
|
173
197
|
private get _tagSize();
|
|
174
198
|
connectedCallback(): void;
|
|
175
199
|
disconnectedCallback(): void;
|
|
176
200
|
private _revokeAllPreviewUrls;
|
|
201
|
+
/**
|
|
202
|
+
* Handles the focus event for the host element.
|
|
203
|
+
* @internal
|
|
204
|
+
*/
|
|
177
205
|
private _handleHostFocus;
|
|
206
|
+
/**
|
|
207
|
+
* Handles the blur event for the host element.
|
|
208
|
+
* @internal
|
|
209
|
+
*/
|
|
178
210
|
private _handleHostBlur;
|
|
211
|
+
/**
|
|
212
|
+
* Handles the change event for the top actions slot.
|
|
213
|
+
* @internal
|
|
214
|
+
*/
|
|
179
215
|
private _handleTopActionsSlotChange;
|
|
216
|
+
/**
|
|
217
|
+
* Handles the change event for the bottom actions slot.
|
|
218
|
+
* @internal
|
|
219
|
+
*/
|
|
180
220
|
private _handleBottomActionsSlotChange;
|
|
221
|
+
/**
|
|
222
|
+
* Handles the change event for the record button slot.
|
|
223
|
+
* @internal
|
|
224
|
+
*/
|
|
181
225
|
private _handleRecordButtonSlotChange;
|
|
226
|
+
/**
|
|
227
|
+
* Handles the change event for the submit button slot.
|
|
228
|
+
* @internal
|
|
229
|
+
*/
|
|
182
230
|
private _handleSubmitButtonSlotChange;
|
|
231
|
+
/**
|
|
232
|
+
* Handles the input event for the input element.
|
|
233
|
+
* @internal
|
|
234
|
+
*/
|
|
183
235
|
private _handleInput;
|
|
236
|
+
/**
|
|
237
|
+
* Handles the keydown event for the input element.
|
|
238
|
+
* @internal
|
|
239
|
+
*/
|
|
184
240
|
private _handleKeydown;
|
|
241
|
+
/**
|
|
242
|
+
* Handles the paste event for the input element.
|
|
243
|
+
* @internal
|
|
244
|
+
*/
|
|
185
245
|
private _handlePaste;
|
|
186
246
|
private _handleFileInputChange;
|
|
187
247
|
private _isFileTypeAccepted;
|
|
@@ -273,7 +333,7 @@ export declare class LuzmoPromptBox extends LuzmoPromptBox_base {
|
|
|
273
333
|
protected updated(changedProperties: PropertyValues): void;
|
|
274
334
|
/**
|
|
275
335
|
* Selector for interactive elements that should be disabled.
|
|
276
|
-
* @
|
|
336
|
+
* @internal
|
|
277
337
|
*/
|
|
278
338
|
private static readonly INTERACTIVE_ELEMENTS_SELECTOR;
|
|
279
339
|
/**
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("lit"),a=require("lit/decorators.js"),u=require("lit/directives/if-defined.js"),n=require("@luzmo/icons");require("../button/index.cjs");require("../icon/index.cjs");const d=require("../text-field-CclDsK1X.cjs"),v="@media (forced-colors: active){#text-field #text-field,#text-field #text-field .input{--highcontrast-search-color-default: CanvasText;--highcontrast-search-color-hover: CanvasText;--highcontrast-search-color-focus: CanvasText;--highcontrast-search-color-disabled: GrayText}#text-field #button .luzmo-ClearButton-fill{forced-color-adjust:none;background-color:initial}}#text-field{--search-button-inline-size: var(--search-block-size);--search-min-inline-size: calc( var(--search-min-inline-multiplier) * var(--search-block-size) );--luzmo-text-field-font-family: var( --luzmo-search-font-family, var(--search-font-family) );--luzmo-text-field-font-weight: var( --luzmo-search-font-weight, var(--search-font-weight) );--luzmo-text-field-corner-radius: var( --luzmo-search-border-radius, var(--search-border-radius) );--luzmo-text-field-border-width: var( --luzmo-search-border-width, var(--search-border-width) );--luzmo-text-field-focus-indicator-gap: var( --luzmo-search-focus-indicator-gap, var(--search-focus-indicator-gap) );--luzmo-text-field-focus-indicator-width: var( --luzmo-search-focus-indicator-width, var(--search-focus-indicator-width) );--luzmo-text-field-focus-indicator-color: var( --luzmo-search-focus-indicator-color, var(--search-focus-indicator-color) );--luzmo-text-field-text-color-default: var( --luzmo-search-color-default, var(--search-color-default) );--luzmo-text-field-text-color-hover: var( --luzmo-search-color-hover, var(--search-color-hover) );--luzmo-text-field-text-color-focus: var( --luzmo-search-color-focus, var(--search-color-focus) );--luzmo-text-field-text-color-focus-hover: var( --luzmo-search-color-focus-hover, var(--search-color-focus-hover) );--luzmo-text-field-text-color-keyboard-focus: var( --luzmo-search-color-key-focus, var(--search-color-key-focus) );--luzmo-text-field-text-color-disabled: var( --luzmo-search-color-disabled, var(--search-color-disabled) );--luzmo-text-field-border-color: var( --luzmo-search-border-color-default, var(--search-border-color-default) );--luzmo-text-field-border-color-hover: var( --luzmo-search-border-color-hover, var(--search-border-color-hover) );--luzmo-text-field-border-color-focus: var( --luzmo-search-border-color-focus, var(--search-border-color-focus) );--luzmo-text-field-border-color-focus-hover: var( --luzmo-search-border-color-focus-hover, var(--search-border-color-focus-hover) );--luzmo-text-field-border-color-keyboard-focus: var( --luzmo-search-border-color-key-focus, var(--search-border-color-key-focus) );--luzmo-text-field-border-color-disabled: var( --luzmo-search-border-color-disabled, var(--search-border-color-disabled) );--luzmo-text-field-background-color: var( --luzmo-search-background-color, var(--search-background-color) );--luzmo-text-field-background-color-disabled: var( --luzmo-search-background-color-disabled, var(--search-background-color-disabled) );inline-size:var(--luzmo-search-inline-size, var(--search-inline-size));min-inline-size:var(--luzmo-search-min-inline-size, var(--search-min-inline-size));display:inline-block;position:relative}#text-field .luzmo-HelpText{margin-block-start:var(--luzmo-search-to-help-text, var(--search-to-help-text))}#button{position:absolute;inset-block-start:0;inset-inline-end:0;height:var(--search-block-size);width:var(--search-block-size)}#button,#button .luzmo-ClearButton-fill{border-radius:var(--luzmo-search-border-radius, var(--search-border-radius))}#text-field.is-disabled #button{display:none}#text-field{inline-size:100%}.icon-search{--search-color: var( --highcontrast-search-color-default, var(--luzmo-search-color-default, var(--search-color-default)) );color:var(--search-color);margin-block:auto;display:block;position:absolute;inset-block:0}#text-field.is-focused .icon-search{--search-color: var( --highcontrast-search-color-focus, var(--luzmo-search-color-focus, var(--search-color-focus)) )}#text-field.is-disabled .icon-search{--search-color: var( --highcontrast-search-color-disabled, var(--luzmo-search-color-disabled, var(--search-color-disabled)) )}@media (hover: hover){#text-field:hover .icon-search{--search-color: var( --highcontrast-search-color-hover, var(--luzmo-search-color-hover, var(--search-color-hover)) )}#text-field.is-focused:hover .icon-search{--search-color: var( --highcontrast-search-color-focus, var(--luzmo-search-color-focus-hover, var(--search-color-focus-hover)) )}#text-field.is-disabled:hover .icon-search{--search-color: var( --highcontrast-search-color-disabled, var(--luzmo-search-color-disabled, var(--search-color-disabled)) )}}.input{-webkit-appearance:none;-moz-appearance:none;appearance:none;block-size:var(--luzmo-search-block-size, var(--search-block-size));font-style:var(--luzmo-search-font-style, var(--search-font-style));line-height:var(--luzmo-search-line-height, var(--search-line-height));padding-block-start:calc(var(--luzmo-search-top-to-text, var(--search-top-to-text)) - var(--luzmo-search-border-width, var(--search-border-width)));padding-block-end:calc(var(--luzmo-search-bottom-to-text, var(--search-bottom-to-text)) - var(--luzmo-search-border-width, var(--search-border-width)))}.input::-webkit-search-cancel-button,.input::-webkit-search-decoration{-webkit-appearance:none;-moz-appearance:none;appearance:none}:host(:not([quiet])) #text-field .icon-search{inset-inline-start:var(--luzmo-search-edge-to-visual, var(--search-edge-to-visual))}:host(:not([quiet])) #text-field .input{padding-inline-start:calc(var(--luzmo-search-edge-to-visual, var(--search-edge-to-visual)) - var(--luzmo-search-border-width, var(--search-border-width)) + var(--luzmo-search-icon-size, var(--search-icon-size)) + var(--luzmo-search-text-to-icon, var(--search-text-to-icon)));padding-inline-end:calc(var(--luzmo-search-button-inline-size, var(--search-button-inline-size)) - var(--luzmo-search-border-width, var(--search-border-width)))}:host([quiet]){--search-quiet-button-offset: var( --luzmo-search-quiet-button-offset, calc( var(--luzmo-search-block-size, var(--search-block-size)) / 2 - var(--luzmo-search-icon-size, var(--search-icon-size)) / 2 ) )}:host([quiet]) #button .luzmo-ClearButton-icon{transform:translate(var(--search-quiet-button-offset))}:host([quiet]) #text-field .input{border-radius:var(--luzmo-search-border-radius, var(--search-border-radius));padding-block-start:var(--luzmo-search-top-to-text, var(--search-top-to-text));padding-inline-start:calc(var(--luzmo-search-edge-to-visual, var(--search-edge-to-visual)) + var(--luzmo-search-icon-size, var(--search-icon-size)) + var(--luzmo-search-text-to-icon, var(--search-text-to-icon)));padding-inline-end:calc(var(--luzmo-search-button-inline-size, var(--search-button-inline-size)) - var(--search-quiet-button-offset))}:host{--search-border-color-default: var(--luzmo-border-color);--search-border-color-hover: rgba(var(--luzmo-primary-rgb), .3);--search-border-color-focus: var(--luzmo-primary);--search-border-color-focus-hover: var(--luzmo-primary);--search-border-color-key-focus: var(--luzmo-primary);--search-inline-size: 192px;--search-min-inline-multiplier: 3;--search-to-help-text: 0px;--search-top-to-text: var(--luzmo-spacing-2);--search-bottom-to-text: var(--luzmo-spacing-2);--search-focus-indicator-width: var(--luzmo-indicator-width);--search-focus-indicator-gap: -1px;--search-focus-indicator-color: var(--luzmo-primary);--search-font-family: var(--luzmo-font-family);--search-font-weight: var(--luzmo-font-weight);--search-font-style: var(--luzmo-font-style);--search-line-height: var(--luzmo-line-height);--search-color-default: var(--luzmo-font-color);--search-color-hover: var(--luzmo-font-color-hover);--search-color-focus: var(--luzmo-font-color-focus);--search-color-focus-hover: var(--luzmo-font-focus);--search-color-key-focus: var(--luzmo-font-color-focus);--search-border-width: var(--luzmo-border-width);--search-background-color: var(--luzmo-background-color);--search-color-disabled: var(--luzmo-disabled-color);--search-background-color-disabled: var(--luzmo-background-color-disabled);--search-border-color-disabled: var(--luzmo-border-color-disabled)}:host #text-field{--search-border-radius: var(--luzmo-border-radius);--search-edge-to-visual: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--search-block-size: var(--luzmo-component-height);--search-icon-size: var(--luzmo-font-size-l);--search-text-to-icon: calc(var(--luzmo-spacing-3) + var(--luzmo-spacing-1))}:host([size=s]) #text-field{--search-border-radius: var(--luzmo-border-radius);--search-edge-to-visual: var(--luzmo-spacing-3);--search-block-size: var(--luzmo-component-height-s);--search-icon-size: var(--luzmo-font-size);--search-text-to-icon: var(--luzmo-spacing-3)}:host([size=l]) #text-field{--search-border-radius: var(--luzmo-border-radius);--search-edge-to-visual: var(--luzmo-spacing-4);--search-block-size: var(--luzmo-component-height-l);--search-icon-size: var(--luzmo-font-size-xl);--search-text-to-icon: calc(var(--luzmo-spacing-3) + var(--luzmo-spacing-1))}:host([size=xl]) #text-field{--search-border-radius: var(--luzmo-border-radius);--search-edge-to-visual: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--search-block-size: var(--luzmo-component-height-xl);--search-icon-size: var(--luzmo-font-size-xxl);--search-text-to-icon: var(--luzmo-spacing-4)}:host([quiet]) #text-field{--search-background-color: transparent;--search-background-color-disabled: transparent;--search-border-color-disabled: var(--luzmo-border-color-disabled);--search-border-radius: 0;--search-edge-to-visual: 0px}:host{--luzmo-text-field-spacing-inline: var(--alias-infield-button-full-height-m)}input::-webkit-search-cancel-button{display:none}@media (forced-colors: active){luzmo-clear-button{--clear-button-fill-background-color: transparent;--clear-button-fill-background-color-disabled: transparent;--clear-button-fill-background-color-down: transparent;--clear-button-fill-background-color-hover: transparent;--clear-button-fill-background-color-key-focus: transparent}}";var m=Object.defineProperty,t=(o,r,c,f)=>{for(var s=void 0,i=o.length-1,h;i>=0;i--)(h=o[i])&&(s=h(r,c,s)||s);return s&&m(r,c,s),s};const b=o=>o.stopPropagation(),z=o=>o==="s"?n.luzmoSearch12:o==="l"?n.luzmoSearch:n.luzmoSearch14;class e extends d.LuzmoTextField{constructor(){super(...arguments),this.action="",this.label="Search",this.placeholder="Search"}static get styles(){return[...super.styles,l.unsafeCSS(v)]}handleSubmit(r){this.dispatchEvent(new Event("submit",{cancelable:!0,bubbles:!0}))||r.preventDefault()}handleKeydown(r){const{code:c}=r;c==="Escape"&&this.holdValueOnEscape||!this.value||c!=="Escape"||this.reset()}async reset(){this.value="",await this.updateComplete,this.focusElement.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0})),this.focusElement.dispatchEvent(new InputEvent("change",{bubbles:!0}))}renderField(){return l.html`
|
|
18
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("lit"),a=require("lit/decorators.js"),u=require("lit/directives/if-defined.js"),n=require("@luzmo/icons");require("../button/index.cjs");require("../icon/index.cjs");const d=require("../text-field-DL5Qe8rI.cjs"),v="@media (forced-colors: active){#text-field #text-field,#text-field #text-field .input{--highcontrast-search-color-default: CanvasText;--highcontrast-search-color-hover: CanvasText;--highcontrast-search-color-focus: CanvasText;--highcontrast-search-color-disabled: GrayText}#text-field #button .luzmo-ClearButton-fill{forced-color-adjust:none;background-color:initial}}#text-field{--search-button-inline-size: var(--search-block-size);--search-min-inline-size: calc( var(--search-min-inline-multiplier) * var(--search-block-size) );--luzmo-text-field-font-family: var( --luzmo-search-font-family, var(--search-font-family) );--luzmo-text-field-font-weight: var( --luzmo-search-font-weight, var(--search-font-weight) );--luzmo-text-field-border-radius: var( --luzmo-search-border-radius, var(--search-border-radius) );--luzmo-text-field-border-width: var( --luzmo-search-border-width, var(--search-border-width) );--luzmo-text-field-focus-indicator-gap: var( --luzmo-search-focus-indicator-gap, var(--search-focus-indicator-gap) );--luzmo-text-field-focus-indicator-width: var( --luzmo-search-focus-indicator-width, var(--search-focus-indicator-width) );--luzmo-text-field-focus-indicator-color: var( --luzmo-search-focus-indicator-color, var(--search-focus-indicator-color) );--luzmo-text-field-text-color-default: var( --luzmo-search-color-default, var(--search-color-default) );--luzmo-text-field-text-color-hover: var( --luzmo-search-color-hover, var(--search-color-hover) );--luzmo-text-field-text-color-focus: var( --luzmo-search-color-focus, var(--search-color-focus) );--luzmo-text-field-text-color-focus-hover: var( --luzmo-search-color-focus-hover, var(--search-color-focus-hover) );--luzmo-text-field-text-color-keyboard-focus: var( --luzmo-search-color-key-focus, var(--search-color-key-focus) );--luzmo-text-field-text-color-disabled: var( --luzmo-search-color-disabled, var(--search-color-disabled) );--luzmo-text-field-border-color: var( --luzmo-search-border-color-default, var(--search-border-color-default) );--luzmo-text-field-border-color-hover: var( --luzmo-search-border-color-hover, var(--search-border-color-hover) );--luzmo-text-field-border-color-focus: var( --luzmo-search-border-color-focus, var(--search-border-color-focus) );--luzmo-text-field-border-color-focus-hover: var( --luzmo-search-border-color-focus-hover, var(--search-border-color-focus-hover) );--luzmo-text-field-border-color-keyboard-focus: var( --luzmo-search-border-color-key-focus, var(--search-border-color-key-focus) );--luzmo-text-field-border-color-disabled: var( --luzmo-search-border-color-disabled, var(--search-border-color-disabled) );--luzmo-text-field-background-color: var( --luzmo-search-background-color, var(--search-background-color) );--luzmo-text-field-background-color-disabled: var( --luzmo-search-background-color-disabled, var(--search-background-color-disabled) );inline-size:var(--luzmo-search-inline-size, var(--search-inline-size));min-inline-size:var(--luzmo-search-min-inline-size, var(--search-min-inline-size));display:inline-block;position:relative}#text-field .luzmo-HelpText{margin-block-start:var(--luzmo-search-to-help-text, var(--search-to-help-text))}#button{position:absolute;inset-block-start:0;inset-inline-end:0;height:var(--search-block-size);width:var(--search-block-size)}#button,#button .luzmo-ClearButton-fill{border-radius:var(--luzmo-search-border-radius, var(--search-border-radius))}#text-field.is-disabled #button{display:none}#text-field{inline-size:100%}.icon-search{--search-color: var( --highcontrast-search-color-default, var(--luzmo-search-color-default, var(--search-color-default)) );color:var(--search-color);margin-block:auto;display:block;position:absolute;inset-block:0}#text-field.is-focused .icon-search{--search-color: var( --highcontrast-search-color-focus, var(--luzmo-search-color-focus, var(--search-color-focus)) )}#text-field.is-disabled .icon-search{--search-color: var( --highcontrast-search-color-disabled, var(--luzmo-search-color-disabled, var(--search-color-disabled)) )}@media (hover: hover){#text-field:hover .icon-search{--search-color: var( --highcontrast-search-color-hover, var(--luzmo-search-color-hover, var(--search-color-hover)) )}#text-field.is-focused:hover .icon-search{--search-color: var( --highcontrast-search-color-focus, var(--luzmo-search-color-focus-hover, var(--search-color-focus-hover)) )}#text-field.is-disabled:hover .icon-search{--search-color: var( --highcontrast-search-color-disabled, var(--luzmo-search-color-disabled, var(--search-color-disabled)) )}}.input{-webkit-appearance:none;-moz-appearance:none;appearance:none;block-size:var(--luzmo-search-block-size, var(--search-block-size));font-style:var(--luzmo-search-font-style, var(--search-font-style));line-height:var(--luzmo-search-line-height, var(--search-line-height));padding-block-start:calc(var(--luzmo-search-top-to-text, var(--search-top-to-text)) - var(--luzmo-search-border-width, var(--search-border-width)));padding-block-end:calc(var(--luzmo-search-bottom-to-text, var(--search-bottom-to-text)) - var(--luzmo-search-border-width, var(--search-border-width)))}.input::-webkit-search-cancel-button,.input::-webkit-search-decoration{-webkit-appearance:none;-moz-appearance:none;appearance:none}:host(:not([quiet])) #text-field .icon-search{inset-inline-start:var(--luzmo-search-edge-to-visual, var(--search-edge-to-visual))}:host(:not([quiet])) #text-field .input{padding-inline-start:calc(var(--luzmo-search-edge-to-visual, var(--search-edge-to-visual)) - var(--luzmo-search-border-width, var(--search-border-width)) + var(--luzmo-search-icon-size, var(--search-icon-size)) + var(--luzmo-search-text-to-icon, var(--search-text-to-icon)));padding-inline-end:calc(var(--luzmo-search-button-inline-size, var(--search-button-inline-size)) - var(--luzmo-search-border-width, var(--search-border-width)))}:host([quiet]){--search-quiet-button-offset: var( --luzmo-search-quiet-button-offset, calc( var(--luzmo-search-block-size, var(--search-block-size)) / 2 - var(--luzmo-search-icon-size, var(--search-icon-size)) / 2 ) )}:host([quiet]) #button .luzmo-ClearButton-icon{transform:translate(var(--search-quiet-button-offset))}:host([quiet]) #text-field .input{border-radius:var(--luzmo-search-border-radius, var(--search-border-radius));padding-block-start:var(--luzmo-search-top-to-text, var(--search-top-to-text));padding-inline-start:calc(var(--luzmo-search-edge-to-visual, var(--search-edge-to-visual)) + var(--luzmo-search-icon-size, var(--search-icon-size)) + var(--luzmo-search-text-to-icon, var(--search-text-to-icon)));padding-inline-end:calc(var(--luzmo-search-button-inline-size, var(--search-button-inline-size)) - var(--search-quiet-button-offset))}:host{--search-border-color-default: var(--luzmo-border-color);--search-border-color-hover: rgba(var(--luzmo-primary-rgb), .3);--search-border-color-focus: var(--luzmo-primary);--search-border-color-focus-hover: var(--luzmo-primary);--search-border-color-key-focus: var(--luzmo-primary);--search-inline-size: 192px;--search-min-inline-multiplier: 3;--search-to-help-text: 0px;--search-top-to-text: var(--luzmo-spacing-2);--search-bottom-to-text: var(--luzmo-spacing-2);--search-focus-indicator-width: var(--luzmo-indicator-width);--search-focus-indicator-gap: -1px;--search-focus-indicator-color: var(--luzmo-primary);--search-font-family: var(--luzmo-font-family);--search-font-weight: var(--luzmo-font-weight);--search-font-style: var(--luzmo-font-style);--search-line-height: var(--luzmo-line-height);--search-color-default: var(--luzmo-font-color);--search-color-hover: var(--luzmo-font-color-hover);--search-color-focus: var(--luzmo-font-color-focus);--search-color-focus-hover: var(--luzmo-font-focus);--search-color-key-focus: var(--luzmo-font-color-focus);--search-border-width: var(--luzmo-border-width);--search-background-color: var(--luzmo-background-color);--search-color-disabled: var(--luzmo-disabled-color);--search-background-color-disabled: var(--luzmo-background-color-disabled);--search-border-color-disabled: var(--luzmo-border-color-disabled)}:host #text-field{--search-border-radius: var(--luzmo-border-radius);--search-edge-to-visual: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--search-block-size: var(--luzmo-component-height);--search-icon-size: var(--luzmo-font-size-l);--search-text-to-icon: calc(var(--luzmo-spacing-3) + var(--luzmo-spacing-1))}:host([size=s]) #text-field{--search-border-radius: var(--luzmo-border-radius);--search-edge-to-visual: var(--luzmo-spacing-3);--search-block-size: var(--luzmo-component-height-s);--search-icon-size: var(--luzmo-font-size);--search-text-to-icon: var(--luzmo-spacing-3)}:host([size=l]) #text-field{--search-border-radius: var(--luzmo-border-radius);--search-edge-to-visual: var(--luzmo-spacing-4);--search-block-size: var(--luzmo-component-height-l);--search-icon-size: var(--luzmo-font-size-xl);--search-text-to-icon: calc(var(--luzmo-spacing-3) + var(--luzmo-spacing-1))}:host([size=xl]) #text-field{--search-border-radius: var(--luzmo-border-radius);--search-edge-to-visual: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--search-block-size: var(--luzmo-component-height-xl);--search-icon-size: var(--luzmo-font-size-xxl);--search-text-to-icon: var(--luzmo-spacing-4)}:host([quiet]) #text-field{--search-background-color: transparent;--search-background-color-disabled: transparent;--search-border-color-disabled: var(--luzmo-border-color-disabled);--search-border-radius: 0;--search-edge-to-visual: 0px}:host{--luzmo-text-field-spacing-inline: var(--alias-infield-button-full-height-m)}input::-webkit-search-cancel-button{display:none}@media (forced-colors: active){luzmo-clear-button{--clear-button-fill-background-color: transparent;--clear-button-fill-background-color-disabled: transparent;--clear-button-fill-background-color-down: transparent;--clear-button-fill-background-color-hover: transparent;--clear-button-fill-background-color-key-focus: transparent}}";var m=Object.defineProperty,t=(o,r,c,f)=>{for(var s=void 0,i=o.length-1,h;i>=0;i--)(h=o[i])&&(s=h(r,c,s)||s);return s&&m(r,c,s),s};const b=o=>o.stopPropagation(),z=o=>o==="s"?n.luzmoSearch12:o==="l"?n.luzmoSearch:n.luzmoSearch14;class e extends d.LuzmoTextField{constructor(){super(...arguments),this.action="",this.label="Search",this.placeholder="Search"}static get styles(){return[...super.styles,l.unsafeCSS(v)]}handleSubmit(r){this.dispatchEvent(new Event("submit",{cancelable:!0,bubbles:!0}))||r.preventDefault()}handleKeydown(r){const{code:c}=r;c==="Escape"&&this.holdValueOnEscape||!this.value||c!=="Escape"||this.reset()}async reset(){this.value="",await this.updateComplete,this.focusElement.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0})),this.focusElement.dispatchEvent(new InputEvent("change",{bubbles:!0}))}renderField(){return l.html`
|
|
19
19
|
<form
|
|
20
20
|
action=${this.action}
|
|
21
21
|
id="form"
|