@logosphere-ui/core 0.0.0-alpha.23 → 0.0.0-alpha.25
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/AGENTS.md +1118 -0
- package/dist/AGENTS.md +1118 -0
- package/dist/atoms/Badge/badge.d.ts +1 -1
- package/dist/atoms/FormField/formfield.d.ts +3 -0
- package/dist/badge-CGgnn_UN.js +72 -0
- package/dist/badge-DXBwR32c.cjs +13 -0
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/button-BBf5JAD-.js +58 -0
- package/dist/button-BryTzF74.cjs +10 -0
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/{calendar-WZ_GQvnn.js → calendar-BiJlAmA6.js} +1 -1
- package/dist/{calendar-LMn1ZF3N.cjs → calendar-D5W-t26J.cjs} +1 -1
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.js +1 -1
- package/dist/{card-KiNHfEi2.cjs → card-C8G9YXhU.cjs} +1 -1
- package/dist/{card-CNoTUaJC.js → card-RWV7CumH.js} +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/chatbot-BfzuCerB.cjs +183 -0
- package/dist/{chatbot-B1Yb35Rp.js → chatbot-CDtwNwGX.js} +146 -84
- package/dist/chatbot.cjs +1 -1
- package/dist/chatbot.js +1 -1
- package/dist/{combobox-C6zoQopK.cjs → combobox-BrANDiaM.cjs} +4 -4
- package/dist/{combobox-LBU6VHLi.js → combobox-D5QdM3ue.js} +22 -10
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +1 -1
- package/dist/{datepicker-CwDDA6np.cjs → datepicker-CxKs90IQ.cjs} +1 -1
- package/dist/{datepicker-SwKsdw3S.js → datepicker-DZsZdSCv.js} +3 -3
- package/dist/datepicker.cjs +1 -1
- package/dist/datepicker.js +1 -1
- package/dist/{drawer-DVINJB4a.js → drawer-D_qOdapq.js} +2 -2
- package/dist/drawer-s1BLy2Xe.cjs +25 -0
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.js +1 -1
- package/dist/{formfield-CNh4mBSs.js → formfield-BZOK4Pkz.js} +23 -16
- package/dist/formfield-HIqosWPz.cjs +33 -0
- package/dist/formfield.cjs +1 -1
- package/dist/formfield.js +1 -1
- package/dist/index.cjs +119 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +358 -41
- package/dist/index.umd.js +404 -196
- package/dist/input-CG6RsUJs.js +257 -0
- package/dist/input-DgGaco-Y.cjs +59 -0
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/left-menu.cjs +1 -1
- package/dist/left-menu.js +1 -1
- package/dist/{leftmenu-DBcncBN8.cjs → leftmenu-BSVpwbyD.cjs} +1 -1
- package/dist/{leftmenu-C-q1h_2U.js → leftmenu-DJE2N5kl.js} +7 -7
- package/dist/{modal-DU1sszVn.cjs → modal-3-TNUICH.cjs} +1 -1
- package/dist/{modal-B8aQyCBg.js → modal-BhhhXCEK.js} +1 -1
- package/dist/modal.cjs +1 -1
- package/dist/modal.js +1 -1
- package/dist/molecules/Input/input.d.ts +4 -0
- package/dist/molecules/Textarea/text-area.d.ts +5 -1
- package/dist/molecules/TimePicker/index.d.ts +2 -0
- package/dist/molecules/TimePicker/timepicker.d.ts +62 -0
- package/dist/organisms/Chatbot/chatbot.d.ts +7 -0
- package/dist/organisms/Combobox/combobox.d.ts +2 -0
- package/dist/organisms/Toast/index.d.ts +2 -0
- package/dist/organisms/Toast/toast-container.d.ts +42 -0
- package/dist/organisms/Toast/toast.d.ts +48 -0
- package/dist/styles/main.css +89 -83
- package/dist/text-area-Bz62kq2S.cjs +51 -0
- package/dist/text-area-CG0gBXni.js +235 -0
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/toast-container-Br8TDkFh.js +274 -0
- package/dist/toast-container-DsEbVrT7.cjs +64 -0
- package/dist/toast.cjs +1 -0
- package/dist/toast.js +6 -0
- package/dist/{tree-menu-BbX8GK_z.js → tree-menu-B39KDvKV.js} +2 -2
- package/dist/tree-menu-BZEOD4_f.cjs +47 -0
- package/dist/tree-menu.cjs +1 -1
- package/dist/tree-menu.js +1 -1
- package/dist/ui-icon-BRl1UmIf.cjs +22 -0
- package/dist/ui-icon-CFvsDv0z.js +66 -0
- package/package.json +21 -11
- package/dist/badge-7IIatiRv.cjs +0 -13
- package/dist/badge-B2chRYGd.js +0 -72
- package/dist/button-BqOMevro.js +0 -58
- package/dist/button-CDRccsk9.cjs +0 -10
- package/dist/chatbot-CweQSDtr.cjs +0 -161
- package/dist/drawer-BvcPd5nz.cjs +0 -25
- package/dist/formfield-BFOIEicR.cjs +0 -33
- package/dist/input-JpAWN-M1.cjs +0 -59
- package/dist/input-jmbvgWEq.js +0 -212
- package/dist/text-area-CZDdxbrN.cjs +0 -46
- package/dist/text-area-Dec_k4rs.js +0 -205
- package/dist/tree-menu-B1iwfHyd.cjs +0 -47
- package/dist/ui-icon-Bys4HYSQ.js +0 -57
- package/dist/ui-icon-DWh1MhBa.cjs +0 -22
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import "./toast";
|
|
3
|
+
import type { ToastActionConfig, ToastType } from "./toast";
|
|
4
|
+
export type ToastOptions = {
|
|
5
|
+
id?: string;
|
|
6
|
+
type?: ToastType;
|
|
7
|
+
title?: string;
|
|
8
|
+
text: string;
|
|
9
|
+
icon?: string;
|
|
10
|
+
closeable?: boolean;
|
|
11
|
+
autoDismiss?: boolean;
|
|
12
|
+
duration?: number;
|
|
13
|
+
action?: ToastActionConfig;
|
|
14
|
+
};
|
|
15
|
+
export declare class LogosphereToastContainer extends LitElement {
|
|
16
|
+
static styles: import("lit").CSSResult[];
|
|
17
|
+
private visibleToasts;
|
|
18
|
+
private queuedToasts;
|
|
19
|
+
show(options: ToastOptions): string;
|
|
20
|
+
close(id: string): void;
|
|
21
|
+
clear(): void;
|
|
22
|
+
private dequeue;
|
|
23
|
+
private toToast;
|
|
24
|
+
private createId;
|
|
25
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
26
|
+
}
|
|
27
|
+
export declare class ToastService {
|
|
28
|
+
private static container?;
|
|
29
|
+
static show(options: ToastOptions): string;
|
|
30
|
+
static success(options: Omit<ToastOptions, "type">): string;
|
|
31
|
+
static danger(options: Omit<ToastOptions, "type">): string;
|
|
32
|
+
static warning(options: Omit<ToastOptions, "type">): string;
|
|
33
|
+
static info(options: Omit<ToastOptions, "type">): string;
|
|
34
|
+
static close(id: string): void;
|
|
35
|
+
static clear(): void;
|
|
36
|
+
private static getContainer;
|
|
37
|
+
}
|
|
38
|
+
declare global {
|
|
39
|
+
interface HTMLElementTagNameMap {
|
|
40
|
+
"logosphere-toast-container": LogosphereToastContainer;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import "../../shared/icons/ui-icon";
|
|
3
|
+
import "../../atoms/Button/button";
|
|
4
|
+
export type ToastType = "success" | "danger" | "warning" | "info";
|
|
5
|
+
export type ToastActionConfig = {
|
|
6
|
+
okayLabel?: string;
|
|
7
|
+
cancelLabel?: string;
|
|
8
|
+
onOkay?: () => void;
|
|
9
|
+
onCancel?: () => void;
|
|
10
|
+
closeOnAction?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare class LogosphereToast extends LitElement {
|
|
13
|
+
static styles: import("lit").CSSResult[];
|
|
14
|
+
type: ToastType;
|
|
15
|
+
title: string;
|
|
16
|
+
text: string;
|
|
17
|
+
icon: string;
|
|
18
|
+
closeable: boolean;
|
|
19
|
+
duration: number;
|
|
20
|
+
autoDismiss: boolean;
|
|
21
|
+
action?: ToastActionConfig;
|
|
22
|
+
private isClosing;
|
|
23
|
+
private remainingMs;
|
|
24
|
+
private startedAt;
|
|
25
|
+
private timerId?;
|
|
26
|
+
private closeTimerId?;
|
|
27
|
+
connectedCallback(): void;
|
|
28
|
+
disconnectedCallback(): void;
|
|
29
|
+
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
30
|
+
close(reason?: "manual" | "auto"): void;
|
|
31
|
+
private get canAutoDismiss();
|
|
32
|
+
private get resolvedTitle();
|
|
33
|
+
private get resolvedText();
|
|
34
|
+
private get resolvedIcon();
|
|
35
|
+
private get hasActions();
|
|
36
|
+
private onActionClick;
|
|
37
|
+
private clearTimer;
|
|
38
|
+
private startTimer;
|
|
39
|
+
private pauseTimer;
|
|
40
|
+
private resumeTimer;
|
|
41
|
+
private restartTimer;
|
|
42
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
43
|
+
}
|
|
44
|
+
declare global {
|
|
45
|
+
interface HTMLElementTagNameMap {
|
|
46
|
+
"logosphere-toast": LogosphereToast;
|
|
47
|
+
}
|
|
48
|
+
}
|
package/dist/styles/main.css
CHANGED
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
/* ==================== SPACING ==================== */
|
|
49
49
|
|
|
50
50
|
--spacing-0: 0;
|
|
51
|
+
--spacing-0-5: 0.125rem; /* 2px */
|
|
51
52
|
--spacing-1: 0.25rem; /* 4px */
|
|
52
|
-
--spacing-1-5: 0.375rem; /* 6px */
|
|
53
53
|
--spacing-2: 0.5rem; /* 8px */
|
|
54
54
|
--spacing-3: 0.75rem; /* 12px */
|
|
55
55
|
--spacing-4: 1rem; /* 16px */
|
|
@@ -76,11 +76,12 @@
|
|
|
76
76
|
/* ==================== SHADOWS ==================== */
|
|
77
77
|
|
|
78
78
|
--shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
79
|
-
--shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1),
|
|
80
|
-
--shadow-
|
|
81
|
-
--shadow-
|
|
82
|
-
--shadow-
|
|
83
|
-
--shadow-
|
|
79
|
+
--shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);
|
|
80
|
+
--shadow-md: 0px 4px 8px -2px rgba(0, 0, 0, 0.1), 0px 2px 4px -2px rgba(0, 0, 0, 0.06);
|
|
81
|
+
--shadow-lg: 0px 12px 16px -4px rgba(0, 0, 0, 0.1), 0px 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
82
|
+
--shadow-xl: 0px 20px 24px -4px rgba(0, 0, 0, 0.1), 0px 8px 8px -4px rgba(0, 0, 0, 0.04);
|
|
83
|
+
--shadow-2xl: 0px 24px 48px -12px rgba(0, 0, 0, 0.25);
|
|
84
|
+
--shadow-3xl: 0px 32px 64px -12px rgba(0, 0, 0, 0.2);
|
|
84
85
|
--shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
|
|
85
86
|
|
|
86
87
|
/* ==================== Z-INDEX SCALE ==================== */
|
|
@@ -104,96 +105,101 @@
|
|
|
104
105
|
|
|
105
106
|
/* Body & Layout */
|
|
106
107
|
--color-body-bg: #ffffff;
|
|
107
|
-
--color-body-
|
|
108
|
-
--color-body-
|
|
109
|
-
--color-body-
|
|
108
|
+
--color-body-color: #2b2b2b;
|
|
109
|
+
--color-body-bg-hover: #f8f8f8;
|
|
110
|
+
--color-body-bg-active: #e0e0e0;
|
|
111
|
+
|
|
110
112
|
|
|
111
|
-
/* Hovers */
|
|
112
|
-
--color-outline-hover: #7878780d;
|
|
113
113
|
|
|
114
|
-
/* Tertiary Colors */
|
|
115
|
-
--color-tertiary: #8e8e8e;
|
|
116
|
-
--color-tertiary-rgb: 142, 142, 142;
|
|
117
|
-
--color-tertiary-bg: #f8f8f8;
|
|
118
|
-
--color-tertiary-bg-rgb: 248, 248, 248;
|
|
119
114
|
|
|
120
115
|
/* Emphasis */
|
|
121
116
|
--color-emphasis: #000000;
|
|
122
|
-
--color-emphasis-
|
|
117
|
+
--color-emphasis-color: #ffffff;
|
|
123
118
|
|
|
124
119
|
/* Borders */
|
|
125
120
|
--color-border: #e0e0e0;
|
|
126
|
-
--color-border-
|
|
127
|
-
--color-border-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
--color-
|
|
131
|
-
--color-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
--color-primary
|
|
136
|
-
--color-primary-hover: #
|
|
137
|
-
--color-primary-active: #
|
|
138
|
-
--color-primary-
|
|
139
|
-
--color-primary-
|
|
121
|
+
--color-border-subtle: #f8f9fa;
|
|
122
|
+
--color-border-emphasis: #2b2b2b;
|
|
123
|
+
|
|
124
|
+
/* Tertiary Colors */
|
|
125
|
+
--color-tertiary: #8e8e8e;
|
|
126
|
+
--color-tertiary-border: #8e8e8e;
|
|
127
|
+
--color-tertiary-border-subtle: #e0e0e0;
|
|
128
|
+
|
|
129
|
+
/* Primary Brand Color — Logo Kırmızısı */
|
|
130
|
+
--color-primary: #c8102e;
|
|
131
|
+
--color-primary-hover: #aa0e27;
|
|
132
|
+
--color-primary-active: #8c0b20;
|
|
133
|
+
--color-primary-disabled: #efb7c0;
|
|
134
|
+
--color-primary-emphasis: #8c0b20;
|
|
135
|
+
--color-primary-border: #c8102e;
|
|
136
|
+
--color-primary-border-subtle: #efb7c0;
|
|
137
|
+
--color-primary-bg: #c8102e;
|
|
138
|
+
--color-primary-bg-subtle: #f7dbe0;
|
|
140
139
|
|
|
141
140
|
/* Secondary Colors */
|
|
142
141
|
--color-secondary: #565656;
|
|
143
|
-
--color-secondary-
|
|
144
|
-
--color-secondary-
|
|
145
|
-
--color-secondary-
|
|
146
|
-
--color-secondary-
|
|
142
|
+
--color-secondary-color: #ffffff;
|
|
143
|
+
--color-secondary-hover: #333333;
|
|
144
|
+
--color-secondary-active: #2b2b2b;
|
|
145
|
+
--color-secondary-disabled: #c6c6c6;
|
|
146
|
+
--color-secondary-emphasis: #2b2b2b;
|
|
147
|
+
--color-secondary-border: #565656;
|
|
148
|
+
--color-secondary-border-subtle: #b0b0b0;
|
|
147
149
|
|
|
148
150
|
/* Success Colors */
|
|
149
151
|
--color-success: #198754;
|
|
150
|
-
--color-success-
|
|
151
|
-
--color-success-hover: #
|
|
152
|
-
--color-success-active: #
|
|
153
|
-
--color-success-
|
|
154
|
-
--color-success-
|
|
155
|
-
--color-success-
|
|
156
|
-
|
|
157
|
-
/* Purple Colors */
|
|
158
|
-
--color-purple: #3D246A;
|
|
159
|
-
--color-purple-rgb: #EDE8F4;
|
|
160
|
-
/* Danger Colors */
|
|
161
|
-
--color-danger: #b94d4d;
|
|
162
|
-
--color-danger-rgb: #b94d4d15;
|
|
163
|
-
--color-danger-hover: #99404024;
|
|
164
|
-
--color-danger-active: #8f343b;
|
|
165
|
-
--color-danger-bg-subtle: #f0b8bd;
|
|
166
|
-
--color-danger-text-emphasis: #662a2a;
|
|
167
|
-
--color-danger-outline-text-emphasis: #783232;
|
|
152
|
+
--color-success-subtle: #d1e7dd;
|
|
153
|
+
--color-success-hover: #1d754c;
|
|
154
|
+
--color-success-active: #206244;
|
|
155
|
+
--color-success-emphasis: #24503b;
|
|
156
|
+
--color-success-disabled: #a3cfbb;
|
|
157
|
+
--color-success-border: #198754;
|
|
158
|
+
--color-success-border-subtle: #a3cfbb;
|
|
168
159
|
|
|
169
|
-
/*
|
|
170
|
-
--color-
|
|
171
|
-
--color-
|
|
172
|
-
--color-
|
|
173
|
-
--color-
|
|
174
|
-
--color-
|
|
175
|
-
--color-
|
|
176
|
-
--color-
|
|
160
|
+
/* Danger Colors */
|
|
161
|
+
--color-danger: #dd4236;
|
|
162
|
+
--color-danger-subtle: #fae3e1;
|
|
163
|
+
--color-danger-hover: #c23f34;
|
|
164
|
+
--color-danger-active: #a83b33;
|
|
165
|
+
--color-danger-emphasis: #a83b33;
|
|
166
|
+
--color-danger-disabled: #f1b3af;
|
|
167
|
+
--color-danger-border: #dd4236;
|
|
177
168
|
|
|
178
169
|
/* Warning Colors */
|
|
179
|
-
--color-warning: #
|
|
180
|
-
--color-warning-
|
|
181
|
-
--color-warning-hover: #
|
|
182
|
-
--color-warning-active: #
|
|
183
|
-
--color-warning-
|
|
184
|
-
--color-warning-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
--color-
|
|
190
|
-
--color-
|
|
191
|
-
--color-
|
|
192
|
-
--color-
|
|
193
|
-
--color-
|
|
194
|
-
--color-
|
|
195
|
-
--color-
|
|
196
|
-
--color-
|
|
170
|
+
--color-warning: #f7c159;
|
|
171
|
+
--color-warning-subtle: #fdefd5;
|
|
172
|
+
--color-warning-hover: #e3b254;
|
|
173
|
+
--color-warning-active: #e3b254;
|
|
174
|
+
--color-warning-emphasis: #9b7e44;
|
|
175
|
+
--color-warning-disabled: #fbe0ac;
|
|
176
|
+
--color-warning-border: #f7c159;
|
|
177
|
+
--color-warning-border-subtle: #fdefd5;
|
|
178
|
+
|
|
179
|
+
/* Info Colors */
|
|
180
|
+
--color-info: #377dff;
|
|
181
|
+
--color-info-subtle: #d7e5ff;
|
|
182
|
+
--color-info-hover: #3571df;
|
|
183
|
+
--color-info-active: #3364bf;
|
|
184
|
+
--color-info-emphasis: #3364bf;
|
|
185
|
+
--color-info-disabled: #afcbff;
|
|
186
|
+
--color-info-border: #377dff;
|
|
187
|
+
--color-info-border-subtle: #afcbff;
|
|
188
|
+
|
|
189
|
+
/* Commercial / Purple */
|
|
190
|
+
--color-commercial-subtle: #e2d9f3;
|
|
191
|
+
--color-commercial-emphasis: #543985;
|
|
192
|
+
|
|
193
|
+
/* Light */
|
|
194
|
+
--color-light: #f8f8f8;
|
|
195
|
+
--color-light-bg: #f8f8f8;
|
|
196
|
+
--color-light-bg-2: #f8f9fa;
|
|
197
|
+
--color-light-border-subtle: #f8f8f8;
|
|
198
|
+
--color-light-text-emphasis: #333333;
|
|
199
|
+
|
|
200
|
+
/* Dark */
|
|
201
|
+
--color-dark: #000000;
|
|
202
|
+
--color-dark-bg-subtle: #e0e0e0;
|
|
197
203
|
}
|
|
198
204
|
|
|
199
205
|
/* ==================== DARK THEME ==================== */
|
|
@@ -202,8 +208,8 @@
|
|
|
202
208
|
/* !* Body & Layout *!*/
|
|
203
209
|
/* --color-body-bg: #2b2b2b;*/
|
|
204
210
|
/* --color-body-bg-rgb: 43, 43, 43;*/
|
|
205
|
-
/* --color-body-
|
|
206
|
-
/* --color-body-
|
|
211
|
+
/* --color-body-color: #f8f8f8;*/
|
|
212
|
+
/* --color-body-color-rgb: 248, 248, 248;*/
|
|
207
213
|
|
|
208
214
|
/* !* Secondary Colors *!*/
|
|
209
215
|
/* --color-secondary: #bbbbbb;*/
|
|
@@ -214,8 +220,8 @@
|
|
|
214
220
|
/* --color-secondary-outline-hover: #7878780D;*/
|
|
215
221
|
|
|
216
222
|
/* !* Tertiary Colors *!*/
|
|
217
|
-
/* --color-tertiary
|
|
218
|
-
/* --color-tertiary-
|
|
223
|
+
/* --color-tertiary: #3a3a3a;*/
|
|
224
|
+
/* --color-tertiary-rgb: 58, 58, 58;*/
|
|
219
225
|
|
|
220
226
|
/* !* Emphasis *!*/
|
|
221
227
|
/* --color-emphasis: #ffffff;*/
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";const i=require("lit"),t=require("lit/decorators.js"),p=require("lit/directives/live.js");require("./formfield-HIqosWPz.cjs");require("./ui-icon-BRl1UmIf.cjs");const u=".textarea__wrap{position:relative;flex:1;min-width:0}.textarea__field{display:block;width:100%;background:transparent;border:none;outline:none;font-size:14px;font-family:var(--font-family-base);font-weight:var(--font-weight-regular);line-height:1.25rem;letter-spacing:-.14px;color:var(--color-body-text);box-sizing:border-box}.textarea__field::placeholder{color:var(--color-tertiary)}.textarea__field:disabled{cursor:not-allowed}.textarea__field--resize-none{resize:none}.textarea__field--resize-vertical{resize:vertical}.textarea__field--resize-horizontal{resize:horizontal}.textarea__field--resize-both{resize:both}.textarea__field--auto-resize{resize:none;overflow:hidden}.textarea__counter{position:absolute;bottom:5px;right:18px;font-size:11px;font-weight:var(--font-weight-medium);line-height:1rem;letter-spacing:-.11px;color:var(--color-secondary);background-color:var(--color-light-bg-2);border-radius:var(--radius-sm, 4px);padding:0 var(--spacing-1);white-space:nowrap;-webkit-user-select:none;user-select:none;pointer-events:none}.textarea__wrap--no-grip .textarea__counter{right:4px}.textarea__clear-btn{border:none;background:transparent;color:var(--color-tertiary);cursor:pointer;padding:0;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;outline:none;line-height:0;transition:color var(--transition-speed-fast) var(--transition-timing)}.textarea__clear-btn:hover{color:var(--color-body-text)}";var d=Object.defineProperty,c=Object.getOwnPropertyDescriptor,r=(n,e,a,s)=>{for(var o=s>1?void 0:s?c(e,a):e,l=n.length-1,h;l>=0;l--)(h=n[l])&&(o=(s?h(e,a,o):h(o))||o);return s&&o&&d(e,a,o),o};exports.TextArea=class extends i.LitElement{constructor(){super(...arguments),this.value="",this.placeholder="",this.name="",this.autocomplete="",this.rows=3,this.maxRows=8,this.wrap="soft",this.resize="vertical",this.autoResize=!0,this.size="default",this.variant="default",this.label="",this.helper="",this.error="",this.required=!1,this.disabled=!1,this.readonly=!1,this._internalError="",this._charCount=0,this.handleInput=e=>{const a=e.target;this.value=a.value,this._charCount=this.value.length,this.autoResize&&this.adjustHeight(),this._internalError&&(this._internalError="",this._textareaElement.setCustomValidity("")),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:this.value,originalEvent:e}}))},this.handleChange=e=>{const a=e.target;this.value=a.value,a.checkValidity()||(this._internalError=a.validationMessage),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.value,originalEvent:e}}))},this.handleKeyDown=e=>{this.dispatchEvent(new CustomEvent("keydown",{bubbles:!0,composed:!0,detail:{key:e.key,originalEvent:e}}))},this.handleKeyUp=e=>{this.dispatchEvent(new CustomEvent("keyup",{bubbles:!0,composed:!0,detail:{key:e.key,originalEvent:e}}))},this.handleClear=()=>{this.value="",this._charCount=0,this._textareaElement&&(this._textareaElement.value="",this.autoResize&&this.adjustHeight()),this.dispatchEvent(new CustomEvent("clear",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:"",originalEvent:null}}))}}get textareaElement(){return this._textareaElement}focus(){this._textareaElement?.focus()}blur(){this._textareaElement?.blur()}select(){this._textareaElement?.select()}setSelectionRange(e,a,s){this._textareaElement?.setSelectionRange(e,a,s)}checkValidity(){return this._textareaElement?.checkValidity()??!0}reportValidity(){return this._textareaElement?.reportValidity()??!0}setCustomValidity(e){this._textareaElement?.setCustomValidity(e),this._internalError=e,this.requestUpdate()}adjustHeight(){if(!this.autoResize||!this._textareaElement)return;const e=this._textareaElement;e.style.height="",e.style.overflow="hidden";const a=e.scrollHeight;if(a!==0){if(this.maxRows>0){const s=parseFloat(getComputedStyle(e).lineHeight)||20,o=Math.round(s*this.maxRows);if(a>=o){e.style.height=`${o}px`,e.style.overflow="auto";return}}e.style.height=`${a}px`}}getResizeClass(){return this.autoResize?"textarea__field--auto-resize":{none:"textarea__field--resize-none",vertical:"textarea__field--resize-vertical",horizontal:"textarea__field--resize-horizontal",both:"textarea__field--resize-both"}[this.resize]}firstUpdated(){this._charCount=this.value.length,this.autoResize&&requestAnimationFrame(()=>this.adjustHeight())}updated(e){super.updated(e),e.has("value")&&(this._charCount=this.value.length,this.autoResize&&this.adjustHeight())}getWrapClass(){return this.autoResize||this.resize==="none"?"textarea__wrap textarea__wrap--no-grip":"textarea__wrap"}render(){const e=this.error||this._internalError,a=!!this.value&&!this.disabled&&!this.readonly,s=this.maxlength!=null,o=`textarea__field ${this.getResizeClass()}`;return i.html`
|
|
2
|
+
<logosphere-formfield
|
|
3
|
+
.label=${this.label}
|
|
4
|
+
.helper=${this.helper}
|
|
5
|
+
.error=${e}
|
|
6
|
+
.required=${this.required}
|
|
7
|
+
.disabled=${this.disabled}
|
|
8
|
+
.readonly=${this.readonly}
|
|
9
|
+
.size=${this.size}
|
|
10
|
+
.variant=${this.variant}
|
|
11
|
+
.multiline=${!0}
|
|
12
|
+
>
|
|
13
|
+
<slot name="prefix" slot="prefix"></slot>
|
|
14
|
+
<div class="${this.getWrapClass()}">
|
|
15
|
+
<textarea
|
|
16
|
+
class="${o}"
|
|
17
|
+
.value=${p.live(this.value)}
|
|
18
|
+
placeholder=${this.placeholder||i.nothing}
|
|
19
|
+
name=${this.name||i.nothing}
|
|
20
|
+
autocomplete=${this.autocomplete||i.nothing}
|
|
21
|
+
?required=${this.required}
|
|
22
|
+
?disabled=${this.disabled}
|
|
23
|
+
?readonly=${this.readonly}
|
|
24
|
+
minlength=${this.minlength??i.nothing}
|
|
25
|
+
maxlength=${this.maxlength??i.nothing}
|
|
26
|
+
rows=${this.rows}
|
|
27
|
+
cols=${this.cols??i.nothing}
|
|
28
|
+
wrap=${this.wrap}
|
|
29
|
+
@input=${this.handleInput}
|
|
30
|
+
@change=${this.handleChange}
|
|
31
|
+
@keydown=${this.handleKeyDown}
|
|
32
|
+
@keyup=${this.handleKeyUp}
|
|
33
|
+
></textarea>
|
|
34
|
+
${s?i.html`
|
|
35
|
+
<span class="textarea__counter">${this._charCount}/${this.maxlength}</span>
|
|
36
|
+
`:i.nothing}
|
|
37
|
+
</div>
|
|
38
|
+
${a?i.html`
|
|
39
|
+
<button
|
|
40
|
+
type="button"
|
|
41
|
+
slot="clear"
|
|
42
|
+
class="textarea__clear-btn"
|
|
43
|
+
@click=${this.handleClear}
|
|
44
|
+
tabindex="-1"
|
|
45
|
+
>
|
|
46
|
+
<ui-icon name="uil-times" size="14"></ui-icon>
|
|
47
|
+
</button>
|
|
48
|
+
`:i.nothing}
|
|
49
|
+
<slot name="suffix" slot="suffix"></slot>
|
|
50
|
+
</logosphere-formfield>
|
|
51
|
+
`}};exports.TextArea.styles=[i.css`${i.unsafeCSS(u)}`];r([t.query("textarea")],exports.TextArea.prototype,"_textareaElement",2);r([t.property({type:String})],exports.TextArea.prototype,"value",2);r([t.property({type:String})],exports.TextArea.prototype,"placeholder",2);r([t.property({type:String})],exports.TextArea.prototype,"name",2);r([t.property({type:String})],exports.TextArea.prototype,"autocomplete",2);r([t.property({type:Number})],exports.TextArea.prototype,"minlength",2);r([t.property({type:Number})],exports.TextArea.prototype,"maxlength",2);r([t.property({type:Number})],exports.TextArea.prototype,"rows",2);r([t.property({type:Number})],exports.TextArea.prototype,"maxRows",2);r([t.property({type:Number})],exports.TextArea.prototype,"cols",2);r([t.property({type:String})],exports.TextArea.prototype,"wrap",2);r([t.property({type:String})],exports.TextArea.prototype,"resize",2);r([t.property({type:Boolean})],exports.TextArea.prototype,"autoResize",2);r([t.property({type:String})],exports.TextArea.prototype,"size",2);r([t.property({type:String})],exports.TextArea.prototype,"variant",2);r([t.property({type:String})],exports.TextArea.prototype,"label",2);r([t.property({type:String})],exports.TextArea.prototype,"helper",2);r([t.property({type:String})],exports.TextArea.prototype,"error",2);r([t.property({type:Boolean})],exports.TextArea.prototype,"required",2);r([t.property({type:Boolean})],exports.TextArea.prototype,"disabled",2);r([t.property({type:Boolean})],exports.TextArea.prototype,"readonly",2);r([t.state()],exports.TextArea.prototype,"_internalError",2);r([t.state()],exports.TextArea.prototype,"_charCount",2);exports.TextArea=r([t.customElement("logosphere-textarea")],exports.TextArea);
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { unsafeCSS as c, css as y, LitElement as m, nothing as n, html as u } from "lit";
|
|
2
|
+
import { query as _, property as i, state as d, customElement as x } from "lit/decorators.js";
|
|
3
|
+
import { live as g } from "lit/directives/live.js";
|
|
4
|
+
import "./formfield-BZOK4Pkz.js";
|
|
5
|
+
import "./ui-icon-CFvsDv0z.js";
|
|
6
|
+
const f = ".textarea__wrap{position:relative;flex:1;min-width:0}.textarea__field{display:block;width:100%;background:transparent;border:none;outline:none;font-size:14px;font-family:var(--font-family-base);font-weight:var(--font-weight-regular);line-height:1.25rem;letter-spacing:-.14px;color:var(--color-body-text);box-sizing:border-box}.textarea__field::placeholder{color:var(--color-tertiary)}.textarea__field:disabled{cursor:not-allowed}.textarea__field--resize-none{resize:none}.textarea__field--resize-vertical{resize:vertical}.textarea__field--resize-horizontal{resize:horizontal}.textarea__field--resize-both{resize:both}.textarea__field--auto-resize{resize:none;overflow:hidden}.textarea__counter{position:absolute;bottom:5px;right:18px;font-size:11px;font-weight:var(--font-weight-medium);line-height:1rem;letter-spacing:-.11px;color:var(--color-secondary);background-color:var(--color-light-bg-2);border-radius:var(--radius-sm, 4px);padding:0 var(--spacing-1);white-space:nowrap;-webkit-user-select:none;user-select:none;pointer-events:none}.textarea__wrap--no-grip .textarea__counter{right:4px}.textarea__clear-btn{border:none;background:transparent;color:var(--color-tertiary);cursor:pointer;padding:0;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;outline:none;line-height:0;transition:color var(--transition-speed-fast) var(--transition-timing)}.textarea__clear-btn:hover{color:var(--color-body-text)}";
|
|
7
|
+
var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, r = (e, a, s, o) => {
|
|
8
|
+
for (var l = o > 1 ? void 0 : o ? b(a, s) : a, h = e.length - 1, p; h >= 0; h--)
|
|
9
|
+
(p = e[h]) && (l = (o ? p(a, s, l) : p(l)) || l);
|
|
10
|
+
return o && l && v(a, s, l), l;
|
|
11
|
+
};
|
|
12
|
+
let t = class extends m {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.value = "", this.placeholder = "", this.name = "", this.autocomplete = "", this.rows = 3, this.maxRows = 8, this.wrap = "soft", this.resize = "vertical", this.autoResize = !0, this.size = "default", this.variant = "default", this.label = "", this.helper = "", this.error = "", this.required = !1, this.disabled = !1, this.readonly = !1, this._internalError = "", this._charCount = 0, this.handleInput = (e) => {
|
|
15
|
+
const a = e.target;
|
|
16
|
+
this.value = a.value, this._charCount = this.value.length, this.autoResize && this.adjustHeight(), this._internalError && (this._internalError = "", this._textareaElement.setCustomValidity("")), this.dispatchEvent(new CustomEvent("input", {
|
|
17
|
+
bubbles: !0,
|
|
18
|
+
composed: !0,
|
|
19
|
+
detail: { value: this.value, originalEvent: e }
|
|
20
|
+
}));
|
|
21
|
+
}, this.handleChange = (e) => {
|
|
22
|
+
const a = e.target;
|
|
23
|
+
this.value = a.value, a.checkValidity() || (this._internalError = a.validationMessage), this.dispatchEvent(new CustomEvent("change", {
|
|
24
|
+
bubbles: !0,
|
|
25
|
+
composed: !0,
|
|
26
|
+
detail: { value: this.value, originalEvent: e }
|
|
27
|
+
}));
|
|
28
|
+
}, this.handleKeyDown = (e) => {
|
|
29
|
+
this.dispatchEvent(new CustomEvent("keydown", {
|
|
30
|
+
bubbles: !0,
|
|
31
|
+
composed: !0,
|
|
32
|
+
detail: { key: e.key, originalEvent: e }
|
|
33
|
+
}));
|
|
34
|
+
}, this.handleKeyUp = (e) => {
|
|
35
|
+
this.dispatchEvent(new CustomEvent("keyup", {
|
|
36
|
+
bubbles: !0,
|
|
37
|
+
composed: !0,
|
|
38
|
+
detail: { key: e.key, originalEvent: e }
|
|
39
|
+
}));
|
|
40
|
+
}, this.handleClear = () => {
|
|
41
|
+
this.value = "", this._charCount = 0, this._textareaElement && (this._textareaElement.value = "", this.autoResize && this.adjustHeight()), this.dispatchEvent(new CustomEvent("clear", { bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("input", {
|
|
42
|
+
bubbles: !0,
|
|
43
|
+
composed: !0,
|
|
44
|
+
detail: { value: "", originalEvent: null }
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
get textareaElement() {
|
|
49
|
+
return this._textareaElement;
|
|
50
|
+
}
|
|
51
|
+
focus() {
|
|
52
|
+
this._textareaElement?.focus();
|
|
53
|
+
}
|
|
54
|
+
blur() {
|
|
55
|
+
this._textareaElement?.blur();
|
|
56
|
+
}
|
|
57
|
+
select() {
|
|
58
|
+
this._textareaElement?.select();
|
|
59
|
+
}
|
|
60
|
+
setSelectionRange(e, a, s) {
|
|
61
|
+
this._textareaElement?.setSelectionRange(e, a, s);
|
|
62
|
+
}
|
|
63
|
+
checkValidity() {
|
|
64
|
+
return this._textareaElement?.checkValidity() ?? !0;
|
|
65
|
+
}
|
|
66
|
+
reportValidity() {
|
|
67
|
+
return this._textareaElement?.reportValidity() ?? !0;
|
|
68
|
+
}
|
|
69
|
+
setCustomValidity(e) {
|
|
70
|
+
this._textareaElement?.setCustomValidity(e), this._internalError = e, this.requestUpdate();
|
|
71
|
+
}
|
|
72
|
+
adjustHeight() {
|
|
73
|
+
if (!this.autoResize || !this._textareaElement) return;
|
|
74
|
+
const e = this._textareaElement;
|
|
75
|
+
e.style.height = "", e.style.overflow = "hidden";
|
|
76
|
+
const a = e.scrollHeight;
|
|
77
|
+
if (a !== 0) {
|
|
78
|
+
if (this.maxRows > 0) {
|
|
79
|
+
const s = parseFloat(getComputedStyle(e).lineHeight) || 20, o = Math.round(s * this.maxRows);
|
|
80
|
+
if (a >= o) {
|
|
81
|
+
e.style.height = `${o}px`, e.style.overflow = "auto";
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
e.style.height = `${a}px`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
getResizeClass() {
|
|
89
|
+
return this.autoResize ? "textarea__field--auto-resize" : {
|
|
90
|
+
none: "textarea__field--resize-none",
|
|
91
|
+
vertical: "textarea__field--resize-vertical",
|
|
92
|
+
horizontal: "textarea__field--resize-horizontal",
|
|
93
|
+
both: "textarea__field--resize-both"
|
|
94
|
+
}[this.resize];
|
|
95
|
+
}
|
|
96
|
+
firstUpdated() {
|
|
97
|
+
this._charCount = this.value.length, this.autoResize && requestAnimationFrame(() => this.adjustHeight());
|
|
98
|
+
}
|
|
99
|
+
updated(e) {
|
|
100
|
+
super.updated(e), e.has("value") && (this._charCount = this.value.length, this.autoResize && this.adjustHeight());
|
|
101
|
+
}
|
|
102
|
+
getWrapClass() {
|
|
103
|
+
return this.autoResize || this.resize === "none" ? "textarea__wrap textarea__wrap--no-grip" : "textarea__wrap";
|
|
104
|
+
}
|
|
105
|
+
render() {
|
|
106
|
+
const e = this.error || this._internalError, a = !!this.value && !this.disabled && !this.readonly, s = this.maxlength != null, o = `textarea__field ${this.getResizeClass()}`;
|
|
107
|
+
return u`
|
|
108
|
+
<logosphere-formfield
|
|
109
|
+
.label=${this.label}
|
|
110
|
+
.helper=${this.helper}
|
|
111
|
+
.error=${e}
|
|
112
|
+
.required=${this.required}
|
|
113
|
+
.disabled=${this.disabled}
|
|
114
|
+
.readonly=${this.readonly}
|
|
115
|
+
.size=${this.size}
|
|
116
|
+
.variant=${this.variant}
|
|
117
|
+
.multiline=${!0}
|
|
118
|
+
>
|
|
119
|
+
<slot name="prefix" slot="prefix"></slot>
|
|
120
|
+
<div class="${this.getWrapClass()}">
|
|
121
|
+
<textarea
|
|
122
|
+
class="${o}"
|
|
123
|
+
.value=${g(this.value)}
|
|
124
|
+
placeholder=${this.placeholder || n}
|
|
125
|
+
name=${this.name || n}
|
|
126
|
+
autocomplete=${this.autocomplete || n}
|
|
127
|
+
?required=${this.required}
|
|
128
|
+
?disabled=${this.disabled}
|
|
129
|
+
?readonly=${this.readonly}
|
|
130
|
+
minlength=${this.minlength ?? n}
|
|
131
|
+
maxlength=${this.maxlength ?? n}
|
|
132
|
+
rows=${this.rows}
|
|
133
|
+
cols=${this.cols ?? n}
|
|
134
|
+
wrap=${this.wrap}
|
|
135
|
+
@input=${this.handleInput}
|
|
136
|
+
@change=${this.handleChange}
|
|
137
|
+
@keydown=${this.handleKeyDown}
|
|
138
|
+
@keyup=${this.handleKeyUp}
|
|
139
|
+
></textarea>
|
|
140
|
+
${s ? u`
|
|
141
|
+
<span class="textarea__counter">${this._charCount}/${this.maxlength}</span>
|
|
142
|
+
` : n}
|
|
143
|
+
</div>
|
|
144
|
+
${a ? u`
|
|
145
|
+
<button
|
|
146
|
+
type="button"
|
|
147
|
+
slot="clear"
|
|
148
|
+
class="textarea__clear-btn"
|
|
149
|
+
@click=${this.handleClear}
|
|
150
|
+
tabindex="-1"
|
|
151
|
+
>
|
|
152
|
+
<ui-icon name="uil-times" size="14"></ui-icon>
|
|
153
|
+
</button>
|
|
154
|
+
` : n}
|
|
155
|
+
<slot name="suffix" slot="suffix"></slot>
|
|
156
|
+
</logosphere-formfield>
|
|
157
|
+
`;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
t.styles = [y`${c(f)}`];
|
|
161
|
+
r([
|
|
162
|
+
_("textarea")
|
|
163
|
+
], t.prototype, "_textareaElement", 2);
|
|
164
|
+
r([
|
|
165
|
+
i({ type: String })
|
|
166
|
+
], t.prototype, "value", 2);
|
|
167
|
+
r([
|
|
168
|
+
i({ type: String })
|
|
169
|
+
], t.prototype, "placeholder", 2);
|
|
170
|
+
r([
|
|
171
|
+
i({ type: String })
|
|
172
|
+
], t.prototype, "name", 2);
|
|
173
|
+
r([
|
|
174
|
+
i({ type: String })
|
|
175
|
+
], t.prototype, "autocomplete", 2);
|
|
176
|
+
r([
|
|
177
|
+
i({ type: Number })
|
|
178
|
+
], t.prototype, "minlength", 2);
|
|
179
|
+
r([
|
|
180
|
+
i({ type: Number })
|
|
181
|
+
], t.prototype, "maxlength", 2);
|
|
182
|
+
r([
|
|
183
|
+
i({ type: Number })
|
|
184
|
+
], t.prototype, "rows", 2);
|
|
185
|
+
r([
|
|
186
|
+
i({ type: Number })
|
|
187
|
+
], t.prototype, "maxRows", 2);
|
|
188
|
+
r([
|
|
189
|
+
i({ type: Number })
|
|
190
|
+
], t.prototype, "cols", 2);
|
|
191
|
+
r([
|
|
192
|
+
i({ type: String })
|
|
193
|
+
], t.prototype, "wrap", 2);
|
|
194
|
+
r([
|
|
195
|
+
i({ type: String })
|
|
196
|
+
], t.prototype, "resize", 2);
|
|
197
|
+
r([
|
|
198
|
+
i({ type: Boolean })
|
|
199
|
+
], t.prototype, "autoResize", 2);
|
|
200
|
+
r([
|
|
201
|
+
i({ type: String })
|
|
202
|
+
], t.prototype, "size", 2);
|
|
203
|
+
r([
|
|
204
|
+
i({ type: String })
|
|
205
|
+
], t.prototype, "variant", 2);
|
|
206
|
+
r([
|
|
207
|
+
i({ type: String })
|
|
208
|
+
], t.prototype, "label", 2);
|
|
209
|
+
r([
|
|
210
|
+
i({ type: String })
|
|
211
|
+
], t.prototype, "helper", 2);
|
|
212
|
+
r([
|
|
213
|
+
i({ type: String })
|
|
214
|
+
], t.prototype, "error", 2);
|
|
215
|
+
r([
|
|
216
|
+
i({ type: Boolean })
|
|
217
|
+
], t.prototype, "required", 2);
|
|
218
|
+
r([
|
|
219
|
+
i({ type: Boolean })
|
|
220
|
+
], t.prototype, "disabled", 2);
|
|
221
|
+
r([
|
|
222
|
+
i({ type: Boolean })
|
|
223
|
+
], t.prototype, "readonly", 2);
|
|
224
|
+
r([
|
|
225
|
+
d()
|
|
226
|
+
], t.prototype, "_internalError", 2);
|
|
227
|
+
r([
|
|
228
|
+
d()
|
|
229
|
+
], t.prototype, "_charCount", 2);
|
|
230
|
+
t = r([
|
|
231
|
+
x("logosphere-textarea")
|
|
232
|
+
], t);
|
|
233
|
+
export {
|
|
234
|
+
t as T
|
|
235
|
+
};
|
package/dist/textarea.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./text-area-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./text-area-Bz62kq2S.cjs");Object.defineProperty(exports,"TextArea",{enumerable:!0,get:()=>e.TextArea});
|
package/dist/textarea.js
CHANGED