@luzmo/lucero 1.0.1-alpha.40 → 1.0.1-alpha.43

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.
Files changed (89) hide show
  1. package/components/accordion/index.js +1 -1
  2. package/components/action-bar/index.cjs +1 -1
  3. package/components/action-bar/index.js +2 -2
  4. package/components/action-button/index.cjs +1 -1
  5. package/components/action-button/index.js +2 -2
  6. package/components/action-group/index.js +1 -1
  7. package/components/action-menu/index.js +1 -1
  8. package/components/avatar/index.js +1 -1
  9. package/components/button/index.cjs +2 -2
  10. package/components/button/index.js +78 -49
  11. package/components/{button-base-B5uul3tZ.js → button-base-B_SkfcFn.js} +1 -1
  12. package/components/{button-base-C7or8-FB.cjs → button-base-BdzHcHRs.cjs} +1 -1
  13. package/components/button-group/index.js +1 -1
  14. package/components/calendar/index.js +1 -1
  15. package/components/chat-message/chat-message.d.ts +127 -0
  16. package/components/chat-message/index.cjs +80 -0
  17. package/components/chat-message/index.d.ts +8 -0
  18. package/components/chat-message/index.js +254 -0
  19. package/components/chat-message-group/chat-message-group.d.ts +50 -0
  20. package/components/chat-message-group/index.cjs +24 -0
  21. package/components/chat-message-group/index.d.ts +7 -0
  22. package/components/chat-message-group/index.js +144 -0
  23. package/components/checkbox/index.cjs +1 -1
  24. package/components/checkbox/index.js +8 -8
  25. package/components/{close-button-R-Cyxi_j.js → close-button-CGZxCNlI.js} +1 -1
  26. package/components/{close-button-C4zqQJRL.cjs → close-button-Decm0Qbb.cjs} +1 -1
  27. package/components/color-area/index.js +1 -1
  28. package/components/color-field/index.js +1 -1
  29. package/components/color-handle/index.js +1 -1
  30. package/components/color-loupe/index.js +1 -1
  31. package/components/color-menu/index.js +1 -1
  32. package/components/color-palette/index.js +1 -1
  33. package/components/color-palette-group/index.js +1 -1
  34. package/components/color-picker/index.js +1 -1
  35. package/components/color-slider/index.js +1 -1
  36. package/components/date-time-picker/index.js +1 -1
  37. package/components/divider/index.js +1 -1
  38. package/components/field-group/index.js +1 -1
  39. package/components/field-label/index.js +1 -1
  40. package/components/icon/index.js +1 -1
  41. package/components/index.cjs +1 -1
  42. package/components/index.js +161 -156
  43. package/components/infield-button/index.cjs +1 -1
  44. package/components/infield-button/index.js +2 -2
  45. package/components/label/index.js +1 -1
  46. package/components/menu/index.js +1 -1
  47. package/components/multi-language-field/index.js +1 -1
  48. package/components/number-field/index.js +1 -1
  49. package/components/options/index.js +1 -1
  50. package/components/overlay/index.js +1 -1
  51. package/components/picker/index.js +1 -1
  52. package/components/picker-button/index.cjs +2 -2
  53. package/components/picker-button/index.js +3 -3
  54. package/components/popover/index.js +1 -1
  55. package/components/progress-circle/index.js +1 -1
  56. package/components/prompt-box/index.cjs +222 -0
  57. package/components/prompt-box/index.d.ts +8 -0
  58. package/components/prompt-box/index.js +832 -0
  59. package/components/prompt-box/prompt-box.d.ts +326 -0
  60. package/components/radio/index.js +1 -1
  61. package/components/search/index.js +1 -1
  62. package/components/select/index.js +1 -1
  63. package/components/slider/index.js +1 -1
  64. package/components/swatch/index.js +1 -1
  65. package/components/switch/index.js +1 -1
  66. package/components/tabs/index.js +1 -1
  67. package/components/tags/index.cjs +5 -5
  68. package/components/tags/index.js +34 -21
  69. package/components/tags/tag.d.ts +2 -0
  70. package/components/tags/tags.d.ts +3 -1
  71. package/components/text-field/index.js +1 -1
  72. package/components/toast/index.cjs +1 -1
  73. package/components/toast/index.js +3 -3
  74. package/components/tooltip/index.js +1 -1
  75. package/components/utils.cjs +1 -1
  76. package/components/utils.js +10 -8
  77. package/components/voice-recorder-BRq_gEkz.js +210 -0
  78. package/components/voice-recorder-CAm5iDre.cjs +18 -0
  79. package/custom-elements.json +1 -1
  80. package/index.d.ts +3 -1
  81. package/package.json +19 -7
  82. package/utils/index.d.ts +1 -0
  83. package/utils/voice-recorder.d.ts +121 -0
  84. package/components/clear-button-Bjp7N52G.js +0 -54
  85. package/components/clear-button-C39c3PH0.cjs +0 -18
  86. package/components/unit-input/index.cjs +0 -43
  87. package/components/unit-input/index.d.ts +0 -7
  88. package/components/unit-input/index.js +0 -184
  89. package/components/unit-input/unit-input.d.ts +0 -33
package/index.d.ts CHANGED
@@ -7,6 +7,8 @@ export * from './components/avatar';
7
7
  export * from './components/button';
8
8
  export * from './components/button-group';
9
9
  export * from './components/calendar';
10
+ export * from './components/chat-message';
11
+ export * from './components/chat-message-group';
10
12
  export * from './components/checkbox';
11
13
  export * from './components/color-area';
12
14
  export * from './components/color-field';
@@ -33,6 +35,7 @@ export * from './components/picker';
33
35
  export * from './components/picker-button';
34
36
  export * from './components/popover';
35
37
  export * from './components/progress-circle';
38
+ export * from './components/prompt-box';
36
39
  export * from './components/radio';
37
40
  export * from './components/search';
38
41
  export * from './components/select';
@@ -44,5 +47,4 @@ export * from './components/tags';
44
47
  export * from './components/text-field';
45
48
  export * from './components/toast';
46
49
  export * from './components/tooltip';
47
- export * from './components/unit-input';
48
50
  export * from './utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luzmo/lucero",
3
- "version": "1.0.1-alpha.40",
3
+ "version": "1.0.1-alpha.43",
4
4
  "homepage": "https://luzmo.com",
5
5
  "description": "Lucero - The design system for Luzmo",
6
6
  "type": "module",
@@ -68,6 +68,18 @@
68
68
  "import": "./components/calendar/index.js",
69
69
  "require": "./components/calendar/index.cjs"
70
70
  },
71
+ "./chat-message": {
72
+ "types": "./components/chat-message/index.d.ts",
73
+ "node": "./components/chat-message/index.js",
74
+ "import": "./components/chat-message/index.js",
75
+ "require": "./components/chat-message/index.cjs"
76
+ },
77
+ "./chat-message-group": {
78
+ "types": "./components/chat-message-group/index.d.ts",
79
+ "node": "./components/chat-message-group/index.js",
80
+ "import": "./components/chat-message-group/index.js",
81
+ "require": "./components/chat-message-group/index.cjs"
82
+ },
71
83
  "./checkbox": {
72
84
  "types": "./components/checkbox/index.d.ts",
73
85
  "node": "./components/checkbox/index.js",
@@ -224,6 +236,12 @@
224
236
  "import": "./components/progress-circle/index.js",
225
237
  "require": "./components/progress-circle/index.cjs"
226
238
  },
239
+ "./prompt-box": {
240
+ "types": "./components/prompt-box/index.d.ts",
241
+ "node": "./components/prompt-box/index.js",
242
+ "import": "./components/prompt-box/index.js",
243
+ "require": "./components/prompt-box/index.cjs"
244
+ },
227
245
  "./radio": {
228
246
  "types": "./components/radio/index.d.ts",
229
247
  "node": "./components/radio/index.js",
@@ -290,12 +308,6 @@
290
308
  "import": "./components/tooltip/index.js",
291
309
  "require": "./components/tooltip/index.cjs"
292
310
  },
293
- "./unit-input": {
294
- "types": "./components/unit-input/index.d.ts",
295
- "node": "./components/unit-input/index.js",
296
- "import": "./components/unit-input/index.js",
297
- "require": "./components/unit-input/index.cjs"
298
- },
299
311
  "./utils": {
300
312
  "types": "./utils/index.d.ts",
301
313
  "node": "./components/utils.js",
package/utils/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export * from './focusable';
4
4
  export * from './platform';
5
5
  export * from './sized-mixin';
6
6
  export * from './streaming-listener';
7
+ export * from './voice-recorder';
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Voice Recorder Utility
3
+ * Provides audio recording functionality with waveform visualization support.
4
+ */
5
+ export interface VoiceRecorderOptions {
6
+ /** Maximum recording duration in milliseconds (default: 300000 = 5 minutes) */
7
+ maxDuration?: number;
8
+ /** Audio bits per second (default: 128000) */
9
+ audioBitsPerSecond?: number;
10
+ }
11
+ export interface VoiceRecordingResult {
12
+ /** The recorded audio blob */
13
+ audioBlob: Blob;
14
+ /** Recording duration in milliseconds */
15
+ duration: number;
16
+ /** MIME type of the audio */
17
+ mimeType: string;
18
+ }
19
+ export type VoiceRecorderEventCallback<T = void> = (data: T) => void;
20
+ /**
21
+ * VoiceRecorder class for handling audio recording with visualization support.
22
+ */
23
+ export declare class VoiceRecorder {
24
+ private mediaRecorder;
25
+ private audioChunks;
26
+ private isRecording;
27
+ private stream;
28
+ private recordingStartTime;
29
+ private maxDuration;
30
+ private audioBitsPerSecond;
31
+ private mimeType;
32
+ private audioContext;
33
+ private analyser;
34
+ private animationFrame;
35
+ private onStartCallback?;
36
+ private onStopCallback?;
37
+ private onErrorCallback?;
38
+ private onAudioLevelCallback?;
39
+ private onDurationUpdateCallback?;
40
+ private durationInterval;
41
+ constructor(options?: VoiceRecorderOptions);
42
+ /**
43
+ * Check if the browser supports audio recording.
44
+ */
45
+ static isSupported(): boolean;
46
+ /**
47
+ * Get the best supported MIME type for recording.
48
+ */
49
+ private getSupportedMimeType;
50
+ /**
51
+ * Start audio recording.
52
+ * @returns Promise that resolves to true if recording started successfully.
53
+ */
54
+ startRecording(): Promise<boolean>;
55
+ /**
56
+ * Stop audio recording.
57
+ */
58
+ stopRecording(): void;
59
+ /**
60
+ * Cancel audio recording without emitting the result.
61
+ */
62
+ cancelRecording(): void;
63
+ /**
64
+ * Check if currently recording.
65
+ */
66
+ isCurrentlyRecording(): boolean;
67
+ /**
68
+ * Get recording duration in milliseconds.
69
+ */
70
+ getRecordingDuration(): number;
71
+ /**
72
+ * Set up audio analysis for waveform visualization.
73
+ */
74
+ private setupAudioAnalysis;
75
+ /**
76
+ * Start monitoring audio levels for visualization.
77
+ */
78
+ private startAudioLevelMonitoring;
79
+ /**
80
+ * Start duration update interval.
81
+ */
82
+ private startDurationUpdates;
83
+ /**
84
+ * Stop duration update interval.
85
+ */
86
+ private stopDurationUpdates;
87
+ /**
88
+ * Clean up resources.
89
+ */
90
+ private cleanup;
91
+ /**
92
+ * Destroy the recorder and clean up all resources.
93
+ */
94
+ destroy(): void;
95
+ /**
96
+ * Set callback for when recording starts.
97
+ */
98
+ onStart(callback: VoiceRecorderEventCallback): this;
99
+ /**
100
+ * Set callback for when recording stops with the result.
101
+ */
102
+ onStop(callback: VoiceRecorderEventCallback<VoiceRecordingResult>): this;
103
+ /**
104
+ * Set callback for recording errors.
105
+ */
106
+ onError(callback: VoiceRecorderEventCallback<string>): this;
107
+ /**
108
+ * Set callback for audio level updates (for waveform visualization).
109
+ * Level is normalized between 0 and 1.
110
+ */
111
+ onAudioLevel(callback: VoiceRecorderEventCallback<number>): this;
112
+ /**
113
+ * Set callback for duration updates (in milliseconds).
114
+ */
115
+ onDurationUpdate(callback: VoiceRecorderEventCallback<number>): this;
116
+ /**
117
+ * Format duration in milliseconds to MM:SS format.
118
+ */
119
+ static formatDuration(ms: number): string;
120
+ }
121
+ export default VoiceRecorder;
@@ -1,54 +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 { luzmoIcon as e, luzmoClear12 as u, luzmoClear as i, luzmoClear14 as s } from "@luzmo/icons";
19
- import { unsafeCSS as b, html as a } from "lit";
20
- import { property as d } from "lit/decorators.js";
21
- import { S as v } from "./sized-mixin-cJbo3PKR.js";
22
- import { L as g } from "./button-base-B5uul3tZ.js";
23
- const h = ":host{font-size:var(--luzmo-clear-button-icon-size, var(--clear-button-icon-size));cursor:pointer;background-color:initial;background-color:var(--luzmo-clear-button-background-color, transparent);padding:var(--luzmo-clear-button-padding, var(--clear-button-padding));color:var(--luzmo-clear-button-icon-color, var(--clear-button-icon-color));border:none;border-radius:100%;margin:0}.icon{margin-block:0;margin-inline:auto}@media (hover: hover){:host(:hover){color:var(--highcontrast-clear-button-icon-color-hover, var(--luzmo-clear-button-icon-color-hover, var(--clear-button-icon-color-hover)))}:host(:hover) .fill{background-color:var(--luzmo-clear-button-background-color-hover, var(--clear-button-background-color-hover))}}:host(:is(:active,[active])){color:var(--luzmo-clear-button-icon-color-down, var(--clear-button-icon-color-down))}:host(:is(:active,[active])) .fill{background-color:var(--luzmo-clear-button-background-color-down, var(--clear-button-background-color-down))}:host([focus-within]) .js-focus-within,:host(:focus-visible),:host:focus-within{color:var(--luzmo-clear-button-icon-color-key-focus, var(--clear-button-icon-color-key-focus))}:host([focus-within]) .js-focus-within .fill,:host(:focus-visible) .fill,:host:focus-within .fill{background-color:var(--luzmo-clear-button-background-color-key-focus, var(--clear-button-background-color-key-focus))}:host([disabled]){--clear-button-icon-color: var( --luzmo-clear-button-icon-color-disabled, var(--disabled-content-color) );--clear-button-background-color: var( --luzmo-clear-button-background-color-disabled, transparent )}.fill{background-color:var(--luzmo-clear-button-background-color, var(--clear-button-background-color));inline-size:100%;block-size:100%;border-radius:100%;justify-content:center;align-items:center;display:flex}:host([variant=overBackground]:focus-visible){outline:none}@media (forced-colors: active){:host:not(:disabled){--highcontrast-clear-button-icon-color-hover: Highlight}}:host{--clear-button-background-color: transparent;--clear-button-background-color-hover: transparent;--clear-button-background-color-down: transparent;--clear-button-background-color-key-focus: transparent;--clear-button-icon-size: var(--luzmo-font-size);--clear-button-padding: 0px;--clear-button-icon-color: var(--luzmo-font-color);--clear-button-icon-color-hover: var(--luzmo-font-color-hover);--clear-button-icon-color-down: var(--luzmo-font-color-down);--clear-button-icon-color-key-focus: var(--luzmo-font-color-focus)}:host([size=s]){--clear-button-icon-size: var(--luzmo-font-size-s)}:host([size=l]){--clear-button-icon-size: var(--luzmo-font-size-l)}:host([size=xl]){--clear-button-icon-size: var(--luzmo-font-size-xl)}:host .luzmo-ClearButton--quiet{--clear-button-background-color: transparent;--clear-button-background-color-hover: transparent;--clear-button-background-color-down: transparent;--clear-button-background-color-key-focus: transparent}:host([variant=overBackground]){--clear-button-icon-color: rgb(255, 255, 255);--clear-button-icon-color-hover: rgb(255, 255, 255);--clear-button-icon-color-down: rgb(255, 255, 255);--clear-button-icon-color-key-focus: rgb(255, 255, 255);--clear-button-background-color: transparent;--clear-button-background-color-hover: rgba(255, 255, 255, .25);--clear-button-background-color-down: rgba(255, 255, 255, .4);--clear-button-background-color-key-focus: rgba(255, 255, 255, .25)}:host([disabled]){--clear-button-icon-color: var(--luzmo-disabled-color);--clear-button-icon-color-hover: var(--luzmo-disabled-color);--clear-button-icon-color-down: var(--luzmo-disabled-color);--clear-button-background-color: transparent}:host{box-sizing:border-box}";
24
- var f = Object.defineProperty, z = (o, t, n, p) => {
25
- for (var r = void 0, c = o.length - 1, l; c >= 0; c--)
26
- (l = o[c]) && (r = l(t, n, r) || r);
27
- return r && f(t, n, r), r;
28
- };
29
- const m = (o) => {
30
- const t = o === "s" ? u : ["xl", "l"].includes(o) ? i : s;
31
- return a` <div class="icon" slot="icon">${e(t)}</div> `;
32
- };
33
- class k extends v(g, {
34
- noDefaultSize: !0
35
- }) {
36
- constructor() {
37
- super(...arguments), this.variant = "";
38
- }
39
- static get styles() {
40
- return [...super.styles, b(h)];
41
- }
42
- get buttonContent() {
43
- return [m(this.size)];
44
- }
45
- render() {
46
- return a` <div class="fill">${super.render()}</div> `;
47
- }
48
- }
49
- z([
50
- d({ reflect: !0 })
51
- ], k.prototype, "variant");
52
- export {
53
- k as L
54
- };
@@ -1,18 +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 c=require("@luzmo/icons"),l=require("lit"),i=require("lit/decorators.js"),s=require("./sized-mixin-DcvJLFeo.cjs"),b=require("./button-base-C7or8-FB.cjs"),d=":host{font-size:var(--luzmo-clear-button-icon-size, var(--clear-button-icon-size));cursor:pointer;background-color:initial;background-color:var(--luzmo-clear-button-background-color, transparent);padding:var(--luzmo-clear-button-padding, var(--clear-button-padding));color:var(--luzmo-clear-button-icon-color, var(--clear-button-icon-color));border:none;border-radius:100%;margin:0}.icon{margin-block:0;margin-inline:auto}@media (hover: hover){:host(:hover){color:var(--highcontrast-clear-button-icon-color-hover, var(--luzmo-clear-button-icon-color-hover, var(--clear-button-icon-color-hover)))}:host(:hover) .fill{background-color:var(--luzmo-clear-button-background-color-hover, var(--clear-button-background-color-hover))}}:host(:is(:active,[active])){color:var(--luzmo-clear-button-icon-color-down, var(--clear-button-icon-color-down))}:host(:is(:active,[active])) .fill{background-color:var(--luzmo-clear-button-background-color-down, var(--clear-button-background-color-down))}:host([focus-within]) .js-focus-within,:host(:focus-visible),:host:focus-within{color:var(--luzmo-clear-button-icon-color-key-focus, var(--clear-button-icon-color-key-focus))}:host([focus-within]) .js-focus-within .fill,:host(:focus-visible) .fill,:host:focus-within .fill{background-color:var(--luzmo-clear-button-background-color-key-focus, var(--clear-button-background-color-key-focus))}:host([disabled]){--clear-button-icon-color: var( --luzmo-clear-button-icon-color-disabled, var(--disabled-content-color) );--clear-button-background-color: var( --luzmo-clear-button-background-color-disabled, transparent )}.fill{background-color:var(--luzmo-clear-button-background-color, var(--clear-button-background-color));inline-size:100%;block-size:100%;border-radius:100%;justify-content:center;align-items:center;display:flex}:host([variant=overBackground]:focus-visible){outline:none}@media (forced-colors: active){:host:not(:disabled){--highcontrast-clear-button-icon-color-hover: Highlight}}:host{--clear-button-background-color: transparent;--clear-button-background-color-hover: transparent;--clear-button-background-color-down: transparent;--clear-button-background-color-key-focus: transparent;--clear-button-icon-size: var(--luzmo-font-size);--clear-button-padding: 0px;--clear-button-icon-color: var(--luzmo-font-color);--clear-button-icon-color-hover: var(--luzmo-font-color-hover);--clear-button-icon-color-down: var(--luzmo-font-color-down);--clear-button-icon-color-key-focus: var(--luzmo-font-color-focus)}:host([size=s]){--clear-button-icon-size: var(--luzmo-font-size-s)}:host([size=l]){--clear-button-icon-size: var(--luzmo-font-size-l)}:host([size=xl]){--clear-button-icon-size: var(--luzmo-font-size-xl)}:host .luzmo-ClearButton--quiet{--clear-button-background-color: transparent;--clear-button-background-color-hover: transparent;--clear-button-background-color-down: transparent;--clear-button-background-color-key-focus: transparent}:host([variant=overBackground]){--clear-button-icon-color: rgb(255, 255, 255);--clear-button-icon-color-hover: rgb(255, 255, 255);--clear-button-icon-color-down: rgb(255, 255, 255);--clear-button-icon-color-key-focus: rgb(255, 255, 255);--clear-button-background-color: transparent;--clear-button-background-color-hover: rgba(255, 255, 255, .25);--clear-button-background-color-down: rgba(255, 255, 255, .4);--clear-button-background-color-key-focus: rgba(255, 255, 255, .25)}:host([disabled]){--clear-button-icon-color: var(--luzmo-disabled-color);--clear-button-icon-color-hover: var(--luzmo-disabled-color);--clear-button-icon-color-down: var(--luzmo-disabled-color);--clear-button-background-color: transparent}:host{box-sizing:border-box}";var v=Object.defineProperty,h=(o,t,a,z)=>{for(var r=void 0,n=o.length-1,e;n>=0;n--)(e=o[n])&&(r=e(t,a,r)||r);return r&&v(t,a,r),r};const g=o=>{const t=o==="s"?c.luzmoClear12:["xl","l"].includes(o)?c.luzmoClear:c.luzmoClear14;return l.html` <div class="icon" slot="icon">${c.luzmoIcon(t)}</div> `};class u extends s.SizedMixin(b.LuzmoButtonBase,{noDefaultSize:!0}){constructor(){super(...arguments),this.variant=""}static get styles(){return[...super.styles,l.unsafeCSS(d)]}get buttonContent(){return[g(this.size)]}render(){return l.html` <div class="fill">${super.render()}</div> `}}h([i.property({reflect:!0})],u.prototype,"variant");exports.LuzmoClearButton=u;
@@ -1,43 +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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("lit"),o=require("lit/decorators.js"),d=require("@luzmo/icons"),z=require("lit/directives/style-map.js"),x=require("../base-5nDSSNeT.cjs"),w="*,*:before,*:after{box-sizing:border-box}:host{display:flex;flex:1 1 auto}svg{height:.75em}.unit-input-container{width:100%;position:relative;display:flex;height:1.875rem;box-sizing:border-box;border-radius:var(--luzmo-border-radius)}.unit-input-container input{box-sizing:border-box;min-width:0;width:100%;line-height:1.6rem;color:var(--luzmo-font-color);padding-left:var(--luzmo-spacing-3);padding-right:var(--luzmo-spacing-5);outline:none;border:var(--luzmo-border-width) solid var(--luzmo-border-color);border-radius:var(--luzmo-border-radius);background:transparent;font-weight:400;text-align:right;transition:border .2s ease-in-out}.unit-input-container input:focus{border:var(--luzmo-border-width) solid var(--luzmo-primary);background:var(--luzmo-background-color-hover)}.unit-input-container input:focus~.ticks{border:var(--luzmo-border-width) solid var(--luzmo-primary)}.unit-input-container input:focus~.ticks .tick-up{border-bottom:var(--luzmo-border-width) solid var(--luzmo-primary)}.unit-input-container .unit{position:absolute;box-sizing:border-box;display:flex;align-items:center;justify-content:center;right:1.125rem;color:var(--luzmo-font-color-disabled);padding:0 var(--luzmo-spacing-2);height:100%;cursor:default;-webkit-user-select:none;user-select:none;z-index:2;font-size:80%}.unit-input-container .ticks{position:absolute;display:flex;flex-direction:column;top:0;bottom:0;right:0;width:var(--luzmo-unit-input-tick-width, 1rem);-webkit-user-select:none;user-select:none;z-index:3;border:var(--luzmo-border-width) solid var(--luzmo-border-color);border-top-right-radius:var(--luzmo-border-radius);border-bottom-right-radius:var(--luzmo-border-radius);overflow:hidden;background-color:var(--luzmo-background-color-hover)}.unit-input-container .ticks>div{flex:1 1 auto;display:flex;justify-content:center;align-items:center;overflow:hidden;color:var(--luzmo-font-color);transition:all .2s ease-in-out;cursor:pointer;position:relative}.unit-input-container .ticks>div:hover{color:var(--luzmo-font-color-hover);background:var(--background-color-alt-2)}.unit-input-container .ticks>div.disabled,.unit-input-container .ticks>div.disabled:hover{cursor:not-allowed;color:var(--luzmo-font-color-disabled)!important;background-color:var(--luzmo-background-color)}.unit-input-container .ticks>div.tick-up{border-bottom:var(--luzmo-border-width) solid var(--luzmo-border-color)}.unit-input-container.with-unit input{padding-right:2.25rem}.unit-input-container.has-error input{border-color:var(--luzmo-negative-color, red)!important}.unit-input-container.has-error .ticks{border-color:var(--luzmo-negative-color, red)!important;background-color:var(--luzmo-negative-color, red)!important}.unit-input-container.has-error .tick-up,.unit-input-container.has-error .tick-down{border-color:var(--luzmo-negative-color, red)!important;background-color:var(--luzmo-negative-color, red)!important;color:#fff!important}";var k=Object.defineProperty,s=(m,t,e,i)=>{for(var a=void 0,n=m.length-1,u;n>=0;n--)(u=m[n])&&(a=u(t,e,a)||a);return a&&k(t,e,a),a};const l={min:-99999999999,max:99999999999,step:1,default:0,debounce:250},h=class h extends x.LuzmoElement{constructor(){super(),this.isDecimal=!1,this.disabled=!1,this.readOnly=!1,this.inputWidth="",this.debounce=l.debounce,this.errors=[],this.setValue=t=>{this.waitForUpdate=!0,this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(()=>{this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0}))},this.debounce||0)},this.setCorrectInitialValues()}transformToNumber(t,e){let i=t;return i=this.isDecimal?Number.parseFloat(t+""):Number.parseInt(t+"",10),i=Number.isNaN(i)?Number(e):Number(i),i}onInput(t){let e=new RegExp(/[^0-9+-]/g);this.isDecimal&&(e=new RegExp(/[^0-9.,+-]/g));const i=t.target.value.replace(e,"").replaceAll(",",".");t.target.value=i,this.errors=[];const a=this.isDecimal?Number.parseFloat(i+""):Number.parseInt(i+"",10);Number.isNaN(a)&&this.errors.push("Not a number"),a<this.min&&this.errors.length===0&&this.errors.push("Value is lower than minimum"),a>this.max&&this.errors.length===0&&this.errors.push("Value is higher than maximum"),this.errors.length===0?(this.validValue=a,this.value=this.validValue,this.setValue(this.value),this.setErrorStatus(!1)):this.setErrorStatus(!0)}setErrorStatus(t){var e,i;t?(e=this.renderRoot.querySelector(".unit-input-container"))==null||e.classList.add("has-error"):(this.errors=[],(i=this.renderRoot.querySelector(".unit-input-container"))==null||i.classList.remove("has-error"))}setDisabledUpDownStatus(){this.value===this.min?this.renderRoot.querySelector(".tick-down").classList.add("disabled"):this.renderRoot.querySelector(".tick-down").classList.remove("disabled"),this.value===this.max?this.renderRoot.querySelector(".tick-up").classList.add("disabled"):this.renderRoot.querySelector(".tick-up").classList.remove("disabled")}createAndSetValidValue(t){let e=this.validValue?this.transformToNumber(t,this.validValue):this.transformToNumber(t,this.default);this.max<e&&(e=this.max),this.min>e&&(e=this.min),this.validValue=e,this.value=e}setCorrectInitialValues(){this.min=this.transformToNumber(this.min,l.min),this.max=this.transformToNumber(this.max,l.max),this.step=Math.abs(this.transformToNumber(this.step,l.step)),this.min>this.max&&(this.min=this.max),this.max<this.min+this.step&&(this.max=this.min+this.step),this.default=this.transformToNumber(this.default,l.default),this.createAndSetValidValue(this.value)}onKeydown(t){!this.disabled&&(t.key==="ArrowUp"||t.key==="ArrowDown")&&this.applyStep(t,t.key==="ArrowUp")}applyStep(t,e){var i,a,n,u,b,f;if(!this.disabled){t.preventDefault();const v=((n=(a=(i=this.validValue.toString())==null?void 0:i.split("."))==null?void 0:a[1])==null?void 0:n.length)??0,y=((f=(b=(u=this.step.toString())==null?void 0:u.split("."))==null?void 0:b[1])==null?void 0:f.length)??0,g=Math.max(v,y);let p=this.validValue+(e?this.step:-this.step);p=Number.parseFloat(p.toFixed(g)),this.createAndSetValidValue(p),this.setErrorStatus(!1),this.renderRoot.querySelector("input").value=this.validValue+"",this.setValue(this.validValue),this.setDisabledUpDownStatus()}}setPaddingRightOfInput(){const t=this.renderRoot.querySelector(".unit"),e=this.renderRoot.querySelector(".ticks"),i=this.unit?`calc(${t==null?void 0:t.offsetWidth}px + ${e==null?void 0:e.offsetWidth}px)`:`calc(${e==null?void 0:e.offsetWidth}px + var(--luzmo-spacing-3))`;this.renderRoot.querySelector("input").style.paddingRight=i}updated(t){t.has("value")&&(this.setCorrectInitialValues(),this.waitForUpdate?this.waitForUpdate=!1:this.renderRoot.querySelector("input").value=this.value+"",this.setPaddingRightOfInput())}render(){return c.html`
19
- <div style=${z.styleMap(this.inputWidth?{width:this.inputWidth}:{})}>
20
- <input
21
- .min=${String(this.min)}
22
- .max=${String(this.max)}
23
- @input=${this.onInput}
24
- @keydown=${this.onKeydown}
25
- />
26
- ${this.unit?c.html`<div class="unit">${this.unit}</div>`:""}
27
- <div class="ticks">
28
- <div
29
- class="tick-up"
30
- @click=${{handleEvent:t=>this.applyStep(t,!0)}}
31
- >
32
- ${d.luzmoIcon(d.luzmoAngleUp)}
33
- </div>
34
-
35
- <div
36
- class="tick-down"
37
- @click=${{handleEvent:t=>this.applyStep(t,!1)}}
38
- >
39
- ${d.luzmoIcon(d.luzmoAngleDown)}
40
- </div>
41
- </div>
42
- </div>
43
- `}};h.styles=c.unsafeCSS(w);let r=h;s([o.property({type:Number,reflect:!0,attribute:"value"})],r.prototype,"value");s([o.property({type:Number,reflect:!0,attribute:"default"})],r.prototype,"default");s([o.property({type:String,reflect:!0,attribute:"placeholder"})],r.prototype,"placeholder");s([o.property({type:String,reflect:!0,attribute:"unit"})],r.prototype,"unit");s([o.property({type:Number,reflect:!0,attribute:"min"})],r.prototype,"min");s([o.property({type:Number,reflect:!0,attribute:"max"})],r.prototype,"max");s([o.property({type:Number,reflect:!0,attribute:"step"})],r.prototype,"step");s([o.property({type:Boolean,reflect:!0,attribute:"isDecimal"})],r.prototype,"isDecimal");s([o.property({type:Boolean,reflect:!0,attribute:"disabled"})],r.prototype,"disabled");s([o.property({type:Boolean,reflect:!0,attribute:"readOnly"})],r.prototype,"readOnly");s([o.property({type:String,reflect:!0,attribute:"inputWidth"})],r.prototype,"inputWidth");s([o.property({type:Number,reflect:!0,attribute:"debounce"})],r.prototype,"debounce");s([o.state()],r.prototype,"errors");s([o.state()],r.prototype,"validValue");s([o.state()],r.prototype,"waitForUpdate");customElements.get("luzmo-unit-input")||customElements.define("luzmo-unit-input",r);exports.LuzmoUnitInput=r;
@@ -1,7 +0,0 @@
1
- import { LuzmoUnitInput } from './unit-input';
2
- declare global {
3
- interface HTMLElementTagNameMap {
4
- 'luzmo-unit-input': LuzmoUnitInput;
5
- }
6
- }
7
- export { LuzmoUnitInput } from './unit-input';
@@ -1,184 +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 w, html as f } from "lit";
19
- import { property as u, state as m } from "lit/decorators.js";
20
- import { luzmoIcon as z, luzmoAngleUp as k, luzmoAngleDown as S } from "@luzmo/icons";
21
- import { styleMap as V } from "lit/directives/style-map.js";
22
- import { a as N } from "../base-CdYjmV_8.js";
23
- const y = () => {
24
- if (typeof document < "u" && !document.querySelector("style[data-luzmo-vars]")) {
25
- const s = document.createElement("style");
26
- s.setAttribute("data-luzmo-vars", ""), s.textContent = 'html{--luzmo-animation-duration: 0.15s;--luzmo-border-color: rgba(var(--luzmo-border-color-rgb), 0.1);--luzmo-border-color-hover: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-down: rgba(var(--luzmo-border-color-rgb), 0.3);--luzmo-border-color-focus: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-rgb: 0, 0, 0;--luzmo-border-color-full: rgb(180, 180, 180);--luzmo-border-color-full-hover: rgb(140, 140, 140);--luzmo-border-color-full-down: rgb(110, 110, 110);--luzmo-border-color-full-focus: rgb(140, 140, 140);--luzmo-border-color-disabled: #dddddd;--luzmo-border-radius: 6px;--luzmo-border-radius-s: 4px;--luzmo-border-radius-l: 8px;--luzmo-border-radius-xl: 12px;--luzmo-border-radius-full: 999rem;--luzmo-background-color: #ffffff;--luzmo-background-color-rgb: 255, 255, 255;--luzmo-background-color-disabled: #eeeeee;--luzmo-background-color-hover: #f0f0fc;--luzmo-background-color-down: #f1f1ff;--luzmo-background-color-focus: #f0f0fc;--luzmo-background-color-highlight: rgb(240, 240, 240);--luzmo-background-color-highlight-disabled: rgb(245, 245, 245);--luzmo-background-color-highlight-hover: rgb(225, 225, 225);--luzmo-background-color-highlight-down: rgb(215, 215, 215);--luzmo-background-color-highlight-focus: rgb(225, 225, 225);--luzmo-border-width: 1px;--luzmo-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;--luzmo-font-size-xs: 10px;--luzmo-font-size-s: 12px;--luzmo-font-size-m: 14px;--luzmo-font-size: 14px;--luzmo-font-size-l: 16px;--luzmo-font-size-xl: 18px;--luzmo-font-size-xxl: 20px;--luzmo-font-style: normal;--luzmo-line-height: normal;--luzmo-font-weight: 400;--luzmo-font-weight-semibold: 500;--luzmo-font-weight-bold: 600;--luzmo-font-color: #333;--luzmo-font-color-disabled: var(--luzmo-disabled-color);--luzmo-font-color-extra-dimmed: #888;--luzmo-font-color-hover: #333;--luzmo-font-color-down: #111;--luzmo-font-color-focus: #333;--luzmo-primary: #4434ff;--luzmo-primary-hover: #4234e4;--luzmo-primary-down: #392cc7;--luzmo-primary-focus: #4234e4;--luzmo-primary-inverse-color: #ffffff;--luzmo-primary-rgb: 68, 52, 255;--luzmo-secondary: #ff00ff;--luzmo-secondary-hover: #e309e3;--luzmo-secondary-down: #c711c7;--luzmo-secondary-focus: #e309e3;--luzmo-secondary-inverse-color: #ffffff;--luzmo-secondary-rgb: 255, 0, 255;--luzmo-negative-color: #ca221c;--luzmo-negative-color-hover: #b3241f;--luzmo-negative-color-down: #9f231f;--luzmo-negative-color-focus: #b3241f;--luzmo-negative-color-rgb: 202, 34, 28;--luzmo-positive-color: rgb(20, 150, 101);--luzmo-positive-color-hover: rgb(17, 128, 86);--luzmo-positive-color-down: rgb(16, 105, 71);--luzmo-positive-color-focus: rgb(17, 128, 86);--luzmo-positive-color-rgb: 20, 150, 101;--luzmo-selected-color: rgb(110, 110, 110);--luzmo-selected-color-hover: rgb(70, 70, 70);--luzmo-selected-color-down: rgb(40, 40, 40);--luzmo-selected-color-focus: rgb(70, 70, 70);--luzmo-selected-color-hard: #1e1e1e;--luzmo-selected-color-hard-hover: rgb(0, 0, 0);--luzmo-selected-color-hard-down: rgb(0, 0, 0);--luzmo-selected-color-hard-focus: rgb(0, 0, 0);--luzmo-informative-color: #1a77e9;--luzmo-informative-color-rgb: 26, 119, 233;--luzmo-disabled-color: #aaaaaa;--luzmo-spacing-1: 2px;--luzmo-spacing-2: 4px;--luzmo-spacing-3: 8px;--luzmo-spacing-4: 12px;--luzmo-spacing-5: 16px;--luzmo-indicator-gap: 2px;--luzmo-indicator-width: 1px;--luzmo-indicator-color: var(--luzmo-primary);--luzmo-component-height-xxs: 20px;--luzmo-component-height-xs: 24px;--luzmo-component-height-s: 28px;--luzmo-component-height: 32px;--luzmo-component-height-l: 40px;--luzmo-component-height-xl: 48px;--luzmo-component-height-xxl: 64px;--luzmo-icon-size-xxs: 12px;--luzmo-icon-size-xs: 14px;--luzmo-icon-size-s: 16px;--luzmo-icon-size-m: 18px;--luzmo-icon-size-l: 20px;--luzmo-icon-size-xl: 22px;--luzmo-icon-size-xxl: 32px}', document.head.appendChild(s);
27
- }
28
- };
29
- y();
30
- const R = "*,*:before,*:after{box-sizing:border-box}:host{display:flex;flex:1 1 auto}svg{height:.75em}.unit-input-container{width:100%;position:relative;display:flex;height:1.875rem;box-sizing:border-box;border-radius:var(--luzmo-border-radius)}.unit-input-container input{box-sizing:border-box;min-width:0;width:100%;line-height:1.6rem;color:var(--luzmo-font-color);padding-left:var(--luzmo-spacing-3);padding-right:var(--luzmo-spacing-5);outline:none;border:var(--luzmo-border-width) solid var(--luzmo-border-color);border-radius:var(--luzmo-border-radius);background:transparent;font-weight:400;text-align:right;transition:border .2s ease-in-out}.unit-input-container input:focus{border:var(--luzmo-border-width) solid var(--luzmo-primary);background:var(--luzmo-background-color-hover)}.unit-input-container input:focus~.ticks{border:var(--luzmo-border-width) solid var(--luzmo-primary)}.unit-input-container input:focus~.ticks .tick-up{border-bottom:var(--luzmo-border-width) solid var(--luzmo-primary)}.unit-input-container .unit{position:absolute;box-sizing:border-box;display:flex;align-items:center;justify-content:center;right:1.125rem;color:var(--luzmo-font-color-disabled);padding:0 var(--luzmo-spacing-2);height:100%;cursor:default;-webkit-user-select:none;user-select:none;z-index:2;font-size:80%}.unit-input-container .ticks{position:absolute;display:flex;flex-direction:column;top:0;bottom:0;right:0;width:var(--luzmo-unit-input-tick-width, 1rem);-webkit-user-select:none;user-select:none;z-index:3;border:var(--luzmo-border-width) solid var(--luzmo-border-color);border-top-right-radius:var(--luzmo-border-radius);border-bottom-right-radius:var(--luzmo-border-radius);overflow:hidden;background-color:var(--luzmo-background-color-hover)}.unit-input-container .ticks>div{flex:1 1 auto;display:flex;justify-content:center;align-items:center;overflow:hidden;color:var(--luzmo-font-color);transition:all .2s ease-in-out;cursor:pointer;position:relative}.unit-input-container .ticks>div:hover{color:var(--luzmo-font-color-hover);background:var(--background-color-alt-2)}.unit-input-container .ticks>div.disabled,.unit-input-container .ticks>div.disabled:hover{cursor:not-allowed;color:var(--luzmo-font-color-disabled)!important;background-color:var(--luzmo-background-color)}.unit-input-container .ticks>div.tick-up{border-bottom:var(--luzmo-border-width) solid var(--luzmo-border-color)}.unit-input-container.with-unit input{padding-right:2.25rem}.unit-input-container.has-error input{border-color:var(--luzmo-negative-color, red)!important}.unit-input-container.has-error .ticks{border-color:var(--luzmo-negative-color, red)!important;background-color:var(--luzmo-negative-color, red)!important}.unit-input-container.has-error .tick-up,.unit-input-container.has-error .tick-down{border-color:var(--luzmo-negative-color, red)!important;background-color:var(--luzmo-negative-color, red)!important;color:#fff!important}";
31
- var E = Object.defineProperty, i = (s, o, e, t) => {
32
- for (var l = void 0, a = s.length - 1, n; a >= 0; a--)
33
- (n = s[a]) && (l = n(o, e, l) || l);
34
- return l && E(o, e, l), l;
35
- };
36
- const d = {
37
- min: -99999999999,
38
- max: 99999999999,
39
- step: 1,
40
- default: 0,
41
- debounce: 250
42
- }, p = class p extends N {
43
- constructor() {
44
- super(), this.isDecimal = !1, this.disabled = !1, this.readOnly = !1, this.inputWidth = "", this.debounce = d.debounce, this.errors = [], this.setValue = (o) => {
45
- this.waitForUpdate = !0, this.debounceTimeout && clearTimeout(this.debounceTimeout), this.debounceTimeout = setTimeout(() => {
46
- this.dispatchEvent(
47
- new CustomEvent("change", {
48
- detail: o,
49
- bubbles: !0,
50
- composed: !0
51
- })
52
- );
53
- }, this.debounce || 0);
54
- }, this.setCorrectInitialValues();
55
- }
56
- transformToNumber(o, e) {
57
- let t = o;
58
- return t = this.isDecimal ? Number.parseFloat(o + "") : Number.parseInt(o + "", 10), t = Number.isNaN(t) ? Number(e) : Number(t), t;
59
- }
60
- onInput(o) {
61
- let e = new RegExp(/[^0-9+-]/g);
62
- this.isDecimal && (e = new RegExp(/[^0-9.,+-]/g));
63
- const t = o.target.value.replace(e, "").replaceAll(",", ".");
64
- o.target.value = t, this.errors = [];
65
- const l = this.isDecimal ? Number.parseFloat(t + "") : Number.parseInt(t + "", 10);
66
- Number.isNaN(l) && this.errors.push("Not a number"), l < this.min && this.errors.length === 0 && this.errors.push("Value is lower than minimum"), l > this.max && this.errors.length === 0 && this.errors.push("Value is higher than maximum"), this.errors.length === 0 ? (this.validValue = l, this.value = this.validValue, this.setValue(this.value), this.setErrorStatus(!1)) : this.setErrorStatus(!0);
67
- }
68
- setErrorStatus(o) {
69
- var e, t;
70
- o ? (e = this.renderRoot.querySelector(".unit-input-container")) == null || e.classList.add("has-error") : (this.errors = [], (t = this.renderRoot.querySelector(".unit-input-container")) == null || t.classList.remove("has-error"));
71
- }
72
- setDisabledUpDownStatus() {
73
- this.value === this.min ? this.renderRoot.querySelector(".tick-down").classList.add("disabled") : this.renderRoot.querySelector(".tick-down").classList.remove("disabled"), this.value === this.max ? this.renderRoot.querySelector(".tick-up").classList.add("disabled") : this.renderRoot.querySelector(".tick-up").classList.remove("disabled");
74
- }
75
- createAndSetValidValue(o) {
76
- let e = this.validValue ? this.transformToNumber(o, this.validValue) : this.transformToNumber(o, this.default);
77
- this.max < e && (e = this.max), this.min > e && (e = this.min), this.validValue = e, this.value = e;
78
- }
79
- setCorrectInitialValues() {
80
- this.min = this.transformToNumber(this.min, d.min), this.max = this.transformToNumber(this.max, d.max), this.step = Math.abs(this.transformToNumber(this.step, d.step)), this.min > this.max && (this.min = this.max), this.max < this.min + this.step && (this.max = this.min + this.step), this.default = this.transformToNumber(this.default, d.default), this.createAndSetValidValue(this.value);
81
- }
82
- onKeydown(o) {
83
- !this.disabled && (o.key === "ArrowUp" || o.key === "ArrowDown") && this.applyStep(o, o.key === "ArrowUp");
84
- }
85
- applyStep(o, e) {
86
- var t, l, a, n, h, b;
87
- if (!this.disabled) {
88
- o.preventDefault();
89
- const g = ((a = (l = (t = this.validValue.toString()) == null ? void 0 : t.split(".")) == null ? void 0 : l[1]) == null ? void 0 : a.length) ?? 0, v = ((b = (h = (n = this.step.toString()) == null ? void 0 : n.split(".")) == null ? void 0 : h[1]) == null ? void 0 : b.length) ?? 0, x = Math.max(g, v);
90
- let c = this.validValue + (e ? this.step : -this.step);
91
- c = Number.parseFloat(c.toFixed(x)), this.createAndSetValidValue(c), this.setErrorStatus(!1), this.renderRoot.querySelector("input").value = this.validValue + "", this.setValue(this.validValue), this.setDisabledUpDownStatus();
92
- }
93
- }
94
- setPaddingRightOfInput() {
95
- const o = this.renderRoot.querySelector(".unit"), e = this.renderRoot.querySelector(".ticks"), t = this.unit ? `calc(${o == null ? void 0 : o.offsetWidth}px + ${e == null ? void 0 : e.offsetWidth}px)` : `calc(${e == null ? void 0 : e.offsetWidth}px + var(--luzmo-spacing-3))`;
96
- this.renderRoot.querySelector("input").style.paddingRight = t;
97
- }
98
- updated(o) {
99
- o.has("value") && (this.setCorrectInitialValues(), this.waitForUpdate ? this.waitForUpdate = !1 : this.renderRoot.querySelector("input").value = this.value + "", this.setPaddingRightOfInput());
100
- }
101
- render() {
102
- return f`
103
- <div style=${V(this.inputWidth ? { width: this.inputWidth } : {})}>
104
- <input
105
- .min=${String(this.min)}
106
- .max=${String(this.max)}
107
- @input=${this.onInput}
108
- @keydown=${this.onKeydown}
109
- />
110
- ${this.unit ? f`<div class="unit">${this.unit}</div>` : ""}
111
- <div class="ticks">
112
- <div
113
- class="tick-up"
114
- @click=${{
115
- handleEvent: (o) => this.applyStep(o, !0)
116
- }}
117
- >
118
- ${z(k)}
119
- </div>
120
-
121
- <div
122
- class="tick-down"
123
- @click=${{
124
- handleEvent: (o) => this.applyStep(o, !1)
125
- }}
126
- >
127
- ${z(S)}
128
- </div>
129
- </div>
130
- </div>
131
- `;
132
- }
133
- };
134
- p.styles = w(R);
135
- let r = p;
136
- i([
137
- u({ type: Number, reflect: !0, attribute: "value" })
138
- ], r.prototype, "value");
139
- i([
140
- u({ type: Number, reflect: !0, attribute: "default" })
141
- ], r.prototype, "default");
142
- i([
143
- u({ type: String, reflect: !0, attribute: "placeholder" })
144
- ], r.prototype, "placeholder");
145
- i([
146
- u({ type: String, reflect: !0, attribute: "unit" })
147
- ], r.prototype, "unit");
148
- i([
149
- u({ type: Number, reflect: !0, attribute: "min" })
150
- ], r.prototype, "min");
151
- i([
152
- u({ type: Number, reflect: !0, attribute: "max" })
153
- ], r.prototype, "max");
154
- i([
155
- u({ type: Number, reflect: !0, attribute: "step" })
156
- ], r.prototype, "step");
157
- i([
158
- u({ type: Boolean, reflect: !0, attribute: "isDecimal" })
159
- ], r.prototype, "isDecimal");
160
- i([
161
- u({ type: Boolean, reflect: !0, attribute: "disabled" })
162
- ], r.prototype, "disabled");
163
- i([
164
- u({ type: Boolean, reflect: !0, attribute: "readOnly" })
165
- ], r.prototype, "readOnly");
166
- i([
167
- u({ type: String, reflect: !0, attribute: "inputWidth" })
168
- ], r.prototype, "inputWidth");
169
- i([
170
- u({ type: Number, reflect: !0, attribute: "debounce" })
171
- ], r.prototype, "debounce");
172
- i([
173
- m()
174
- ], r.prototype, "errors");
175
- i([
176
- m()
177
- ], r.prototype, "validValue");
178
- i([
179
- m()
180
- ], r.prototype, "waitForUpdate");
181
- customElements.get("luzmo-unit-input") || customElements.define("luzmo-unit-input", r);
182
- export {
183
- r as LuzmoUnitInput
184
- };
@@ -1,33 +0,0 @@
1
- import { LuzmoElement } from '../../utils/base';
2
- export declare class LuzmoUnitInput extends LuzmoElement {
3
- static styles: import("lit").CSSResult;
4
- value: number;
5
- default: number;
6
- placeholder: string;
7
- unit: string;
8
- min: number;
9
- max: number;
10
- step: number;
11
- isDecimal: boolean;
12
- disabled: boolean;
13
- readOnly: boolean;
14
- inputWidth: string;
15
- debounce: number;
16
- debounceTimeout: any;
17
- errors: string[];
18
- validValue: number;
19
- waitForUpdate: boolean;
20
- private transformToNumber;
21
- private onInput;
22
- private setErrorStatus;
23
- setDisabledUpDownStatus(): void;
24
- private createAndSetValidValue;
25
- private setCorrectInitialValues;
26
- private onKeydown;
27
- private applyStep;
28
- private setValue;
29
- private setPaddingRightOfInput;
30
- constructor();
31
- protected updated(changedProperties: Map<string, any>): void;
32
- render(): import("lit-html").TemplateResult<1>;
33
- }