@latty-ds/web 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +106 -0
  3. package/custom-elements.json +8785 -0
  4. package/dist/base/index.d.ts +1 -0
  5. package/dist/base/index.js +35 -0
  6. package/dist/base/themeable-element.d.ts +20 -0
  7. package/dist/components/accordion/accordion.d.ts +82 -0
  8. package/dist/components/accordion/accordion.styles.d.ts +1 -0
  9. package/dist/components/accordion/accordion.types.d.ts +10 -0
  10. package/dist/components/accordion/index.d.ts +8 -0
  11. package/dist/components/accordion/index.js +468 -0
  12. package/dist/components/alert/alert.d.ts +51 -0
  13. package/dist/components/alert/alert.styles.d.ts +1 -0
  14. package/dist/components/alert/alert.types.d.ts +2 -0
  15. package/dist/components/alert/index.d.ts +2 -0
  16. package/dist/components/alert/index.js +746 -0
  17. package/dist/components/avatar/avatar.d.ts +27 -0
  18. package/dist/components/avatar/avatar.styles.d.ts +1 -0
  19. package/dist/components/avatar/avatar.types.d.ts +3 -0
  20. package/dist/components/avatar/index.d.ts +2 -0
  21. package/dist/components/avatar/index.js +222 -0
  22. package/dist/components/badge/badge.d.ts +29 -0
  23. package/dist/components/badge/badge.styles.d.ts +1 -0
  24. package/dist/components/badge/badge.types.d.ts +3 -0
  25. package/dist/components/badge/index.d.ts +2 -0
  26. package/dist/components/badge/index.js +277 -0
  27. package/dist/components/breadcrumb/breadcrumb.d.ts +53 -0
  28. package/dist/components/breadcrumb/breadcrumb.styles.d.ts +2 -0
  29. package/dist/components/breadcrumb/breadcrumb.types.d.ts +1 -0
  30. package/dist/components/breadcrumb/index.d.ts +2 -0
  31. package/dist/components/breadcrumb/index.js +166 -0
  32. package/dist/components/button/button.d.ts +111 -0
  33. package/dist/components/button/button.styles.d.ts +1 -0
  34. package/dist/components/button/button.types.d.ts +38 -0
  35. package/dist/components/button/index.d.ts +8 -0
  36. package/dist/components/button/index.js +466 -0
  37. package/dist/components/calendar/calendar.d.ts +84 -0
  38. package/dist/components/calendar/calendar.styles.d.ts +1 -0
  39. package/dist/components/calendar/calendar.types.d.ts +15 -0
  40. package/dist/components/calendar/index.d.ts +1 -0
  41. package/dist/components/calendar/index.js +958 -0
  42. package/dist/components/checkbox/checkbox.d.ts +113 -0
  43. package/dist/components/checkbox/checkbox.styles.d.ts +1 -0
  44. package/dist/components/checkbox/checkbox.types.d.ts +21 -0
  45. package/dist/components/checkbox/index.d.ts +8 -0
  46. package/dist/components/checkbox/index.js +320 -0
  47. package/dist/components/chip/chip.d.ts +35 -0
  48. package/dist/components/chip/chip.styles.d.ts +1 -0
  49. package/dist/components/chip/chip.types.d.ts +3 -0
  50. package/dist/components/chip/index.d.ts +2 -0
  51. package/dist/components/chip/index.js +282 -0
  52. package/dist/components/color-input/color-input.d.ts +55 -0
  53. package/dist/components/color-input/color-input.styles.d.ts +1 -0
  54. package/dist/components/color-input/color-input.types.d.ts +2 -0
  55. package/dist/components/color-input/index.d.ts +1 -0
  56. package/dist/components/color-input/index.js +489 -0
  57. package/dist/components/combobox/combobox.d.ts +59 -0
  58. package/dist/components/combobox/combobox.styles.d.ts +1 -0
  59. package/dist/components/combobox/combobox.types.d.ts +7 -0
  60. package/dist/components/combobox/index.d.ts +2 -0
  61. package/dist/components/combobox/index.js +1988 -0
  62. package/dist/components/date-input/date-input.d.ts +66 -0
  63. package/dist/components/date-input/date-input.styles.d.ts +1 -0
  64. package/dist/components/date-input/date-input.types.d.ts +3 -0
  65. package/dist/components/date-input/index.d.ts +2 -0
  66. package/dist/components/date-input/index.js +2863 -0
  67. package/dist/components/datepicker/datepicker.d.ts +52 -0
  68. package/dist/components/datepicker/datepicker.styles.d.ts +1 -0
  69. package/dist/components/datepicker/datepicker.types.d.ts +3 -0
  70. package/dist/components/datepicker/index.d.ts +2 -0
  71. package/dist/components/datepicker/index.js +416 -0
  72. package/dist/components/dialog/dialog.d.ts +114 -0
  73. package/dist/components/dialog/dialog.styles.d.ts +1 -0
  74. package/dist/components/dialog/dialog.types.d.ts +11 -0
  75. package/dist/components/dialog/index.d.ts +2 -0
  76. package/dist/components/dialog/index.js +920 -0
  77. package/dist/components/divider/divider.d.ts +35 -0
  78. package/dist/components/divider/divider.styles.d.ts +1 -0
  79. package/dist/components/divider/divider.types.d.ts +2 -0
  80. package/dist/components/divider/index.d.ts +2 -0
  81. package/dist/components/divider/index.js +149 -0
  82. package/dist/components/dropdown/dropdown-item.d.ts +24 -0
  83. package/dist/components/dropdown/dropdown-item.styles.d.ts +1 -0
  84. package/dist/components/dropdown/dropdown.d.ts +30 -0
  85. package/dist/components/dropdown/dropdown.styles.d.ts +1 -0
  86. package/dist/components/dropdown/dropdown.types.d.ts +1 -0
  87. package/dist/components/dropdown/index.d.ts +3 -0
  88. package/dist/components/dropdown/index.js +1791 -0
  89. package/dist/components/header/header.d.ts +19 -0
  90. package/dist/components/header/header.styles.d.ts +1 -0
  91. package/dist/components/header/header.types.d.ts +1 -0
  92. package/dist/components/header/index.d.ts +2 -0
  93. package/dist/components/header/index.js +104 -0
  94. package/dist/components/icon-button/icon-button.d.ts +52 -0
  95. package/dist/components/icon-button/icon-button.styles.d.ts +1 -0
  96. package/dist/components/icon-button/icon-button.types.d.ts +8 -0
  97. package/dist/components/icon-button/index.d.ts +1 -0
  98. package/dist/components/icon-button/index.js +342 -0
  99. package/dist/components/image/image.d.ts +26 -0
  100. package/dist/components/image/image.styles.d.ts +1 -0
  101. package/dist/components/image/image.types.d.ts +0 -0
  102. package/dist/components/image/index.d.ts +1 -0
  103. package/dist/components/image/index.js +105 -0
  104. package/dist/components/link/index.d.ts +1 -0
  105. package/dist/components/link/index.js +108 -0
  106. package/dist/components/link/link.d.ts +22 -0
  107. package/dist/components/link/link.styles.d.ts +1 -0
  108. package/dist/components/link/link.types.d.ts +1 -0
  109. package/dist/components/list/index.d.ts +9 -0
  110. package/dist/components/list/index.js +254 -0
  111. package/dist/components/list/list-item.d.ts +41 -0
  112. package/dist/components/list/list-item.styles.d.ts +1 -0
  113. package/dist/components/list/list.d.ts +85 -0
  114. package/dist/components/list/list.styles.d.ts +1 -0
  115. package/dist/components/list/list.types.d.ts +16 -0
  116. package/dist/components/nav/index.d.ts +3 -0
  117. package/dist/components/nav/index.js +345 -0
  118. package/dist/components/nav/nav-item.d.ts +73 -0
  119. package/dist/components/nav/nav.d.ts +49 -0
  120. package/dist/components/nav/nav.styles.d.ts +2 -0
  121. package/dist/components/nav/nav.types.d.ts +1 -0
  122. package/dist/components/pagination/index.d.ts +2 -0
  123. package/dist/components/pagination/index.js +210 -0
  124. package/dist/components/pagination/pagination.d.ts +34 -0
  125. package/dist/components/pagination/pagination.styles.d.ts +1 -0
  126. package/dist/components/pagination/pagination.types.d.ts +1 -0
  127. package/dist/components/progress/index.d.ts +2 -0
  128. package/dist/components/progress/index.js +167 -0
  129. package/dist/components/progress/progress.d.ts +44 -0
  130. package/dist/components/progress/progress.styles.d.ts +1 -0
  131. package/dist/components/progress/progress.types.d.ts +2 -0
  132. package/dist/components/radio/index.d.ts +8 -0
  133. package/dist/components/radio/index.js +294 -0
  134. package/dist/components/radio/radio.d.ts +96 -0
  135. package/dist/components/radio/radio.styles.d.ts +1 -0
  136. package/dist/components/radio/radio.types.d.ts +21 -0
  137. package/dist/components/radio-group/index.d.ts +8 -0
  138. package/dist/components/radio-group/index.js +384 -0
  139. package/dist/components/radio-group/radio-group.d.ts +100 -0
  140. package/dist/components/radio-group/radio-group.styles.d.ts +1 -0
  141. package/dist/components/radio-group/radio-group.types.d.ts +8 -0
  142. package/dist/components/select/index.d.ts +8 -0
  143. package/dist/components/select/index.js +2123 -0
  144. package/dist/components/select/select.d.ts +129 -0
  145. package/dist/components/select/select.styles.d.ts +1 -0
  146. package/dist/components/select/select.types.d.ts +37 -0
  147. package/dist/components/shared/backdrop.styles.d.ts +1 -0
  148. package/dist/components/shared/floating.d.ts +10 -0
  149. package/dist/components/sidepanel/index.d.ts +1 -0
  150. package/dist/components/sidepanel/index.js +768 -0
  151. package/dist/components/sidepanel/sidepanel.d.ts +48 -0
  152. package/dist/components/sidepanel/sidepanel.styles.d.ts +1 -0
  153. package/dist/components/sidepanel/sidepanel.types.d.ts +1 -0
  154. package/dist/components/skeleton/index.d.ts +2 -0
  155. package/dist/components/skeleton/index.js +129 -0
  156. package/dist/components/skeleton/skeleton.d.ts +39 -0
  157. package/dist/components/skeleton/skeleton.styles.d.ts +1 -0
  158. package/dist/components/skeleton/skeleton.types.d.ts +1 -0
  159. package/dist/components/slider/index.d.ts +2 -0
  160. package/dist/components/slider/index.js +635 -0
  161. package/dist/components/slider/slider.d.ts +33 -0
  162. package/dist/components/slider/slider.styles.d.ts +1 -0
  163. package/dist/components/slider/slider.types.d.ts +1 -0
  164. package/dist/components/snackbar/index.d.ts +2 -0
  165. package/dist/components/snackbar/index.js +358 -0
  166. package/dist/components/snackbar/snackbar.d.ts +63 -0
  167. package/dist/components/snackbar/snackbar.styles.d.ts +1 -0
  168. package/dist/components/snackbar/snackbar.types.d.ts +1 -0
  169. package/dist/components/spinner/index.d.ts +8 -0
  170. package/dist/components/spinner/index.js +131 -0
  171. package/dist/components/spinner/spineer.styles.d.ts +1 -0
  172. package/dist/components/spinner/spinner.d.ts +52 -0
  173. package/dist/components/spinner/spinner.types.d.ts +18 -0
  174. package/dist/components/surface/index.d.ts +8 -0
  175. package/dist/components/surface/index.js +128 -0
  176. package/dist/components/surface/surface.d.ts +48 -0
  177. package/dist/components/surface/surface.styles.d.ts +1 -0
  178. package/dist/components/surface/surface.types.d.ts +20 -0
  179. package/dist/components/switch/index.d.ts +8 -0
  180. package/dist/components/switch/index.js +293 -0
  181. package/dist/components/switch/switch.d.ts +90 -0
  182. package/dist/components/switch/switch.styles.d.ts +1 -0
  183. package/dist/components/switch/switch.types.d.ts +21 -0
  184. package/dist/components/tab/index.d.ts +9 -0
  185. package/dist/components/tab/index.js +252 -0
  186. package/dist/components/tab/tab-panel.d.ts +28 -0
  187. package/dist/components/tab/tab-panel.styles.d.ts +1 -0
  188. package/dist/components/tab/tab.d.ts +59 -0
  189. package/dist/components/tab/tab.styles.d.ts +1 -0
  190. package/dist/components/tab/tab.types.d.ts +7 -0
  191. package/dist/components/tab-group/index.d.ts +8 -0
  192. package/dist/components/tab-group/index.js +441 -0
  193. package/dist/components/tab-group/tab-group.d.ts +99 -0
  194. package/dist/components/tab-group/tab-group.styles.d.ts +1 -0
  195. package/dist/components/tab-group/tab-group.types.d.ts +11 -0
  196. package/dist/components/table/index.d.ts +2 -0
  197. package/dist/components/table/index.js +582 -0
  198. package/dist/components/table/table.d.ts +160 -0
  199. package/dist/components/table/table.styles.d.ts +1 -0
  200. package/dist/components/table/table.types.d.ts +106 -0
  201. package/dist/components/text/index.d.ts +1 -0
  202. package/dist/components/text/index.js +207 -0
  203. package/dist/components/text/text.d.ts +32 -0
  204. package/dist/components/text/text.styles.d.ts +1 -0
  205. package/dist/components/text/text.types.d.ts +2 -0
  206. package/dist/components/textfield/index.d.ts +8 -0
  207. package/dist/components/textfield/index.js +718 -0
  208. package/dist/components/textfield/textfield.d.ts +168 -0
  209. package/dist/components/textfield/textfield.styles.d.ts +1 -0
  210. package/dist/components/textfield/textfield.types.d.ts +40 -0
  211. package/dist/components/tooltip/index.d.ts +2 -0
  212. package/dist/components/tooltip/index.js +379 -0
  213. package/dist/components/tooltip/tooltip.d.ts +42 -0
  214. package/dist/components/tooltip/tooltip.styles.d.ts +1 -0
  215. package/dist/components/tooltip/tooltip.types.d.ts +1 -0
  216. package/dist/css/font-face.css +22 -0
  217. package/dist/css/latty.css +57 -0
  218. package/dist/fonts/HankenGrotesk-Variable.woff2 +0 -0
  219. package/dist/fonts/HankenGrotesk-VariableItalic.woff2 +0 -0
  220. package/dist/index.cjs +12739 -0
  221. package/dist/index.d.ts +101 -0
  222. package/dist/index.js +11406 -0
  223. package/dist/manifest.json +2396 -0
  224. package/dist/utils/click-outside.d.ts +22 -0
  225. package/dist/utils/color.d.ts +14 -0
  226. package/dist/utils/dispatch.d.ts +18 -0
  227. package/dist/utils/index.d.ts +3 -0
  228. package/package.json +231 -0
@@ -0,0 +1,718 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+
12
+ // src/components/textfield/textfield.ts
13
+ import { html as html2 } from "lit";
14
+ import { ifDefined } from "lit/directives/if-defined.js";
15
+
16
+ // src/base/themeable-element.ts
17
+ import { LitElement } from "lit";
18
+ import { property } from "lit/decorators.js";
19
+ var ThemeableElement = class extends LitElement {
20
+ willUpdate(changed) {
21
+ super.willUpdate(changed);
22
+ if (changed.has("theme")) {
23
+ this._syncThemeAttribute();
24
+ }
25
+ }
26
+ _syncThemeAttribute() {
27
+ if (this.theme === "dark" || this.theme === "light") {
28
+ this.setAttribute("data-theme", this.theme);
29
+ } else {
30
+ this.removeAttribute("data-theme");
31
+ }
32
+ }
33
+ };
34
+ __decorateClass([
35
+ property({ reflect: true })
36
+ ], ThemeableElement.prototype, "theme", 2);
37
+
38
+ // src/components/textfield/textfield.ts
39
+ import { customElement as customElement2, property as property3, state } from "lit/decorators.js";
40
+
41
+ // src/components/textfield/textfield.styles.ts
42
+ import { css } from "lit";
43
+ var textfieldStyles = css`
44
+ :host {
45
+ display: inline-block;
46
+ font-family: 'Hanken Grotesk', sans-serif;
47
+ width: 100%;
48
+ }
49
+
50
+ .wrapper {
51
+ display: flex;
52
+ flex-direction: column;
53
+ gap: var(--lt-spacing-1);
54
+ width: 100%;
55
+ }
56
+
57
+ label {
58
+ color: var(--lt-text-subtle);
59
+ }
60
+
61
+ .input-container {
62
+ position: relative;
63
+ width: 100%;
64
+ display: flex;
65
+ align-items: center;
66
+ gap: var(--lt-spacing-2);
67
+ }
68
+
69
+ .icon-start,
70
+ .icon-end {
71
+ color: var(--lt-text-muted);
72
+ flex-shrink: 0;
73
+ position: absolute;
74
+ pointer-events: none;
75
+ }
76
+
77
+ .icon-start {
78
+ left: var(--lt-spacing-3);
79
+ }
80
+
81
+ .icon-end {
82
+ right: var(--lt-spacing-3);
83
+ }
84
+
85
+ .password-toggle {
86
+ pointer-events: auto;
87
+ cursor: pointer;
88
+ transition: color 120ms ease;
89
+ }
90
+
91
+ .password-toggle:hover {
92
+ color: var(--lt-text-default);
93
+ }
94
+
95
+ .variant-icon {
96
+ pointer-events: none;
97
+ }
98
+
99
+ :host([variant='success']) .variant-icon {
100
+ color: var(--lt-interactive-success-bg);
101
+ }
102
+
103
+ :host([variant='warning']) .variant-icon {
104
+ color: var(--lt-interactive-warning-bg);
105
+ }
106
+
107
+ :host([variant='error']) .variant-icon,
108
+ :host([data-invalid]) .variant-icon {
109
+ color: var(--lt-interactive-error-bg);
110
+ }
111
+
112
+ input,
113
+ textarea {
114
+ background: var(--lt-bg-subtle);
115
+ border-radius: var(--lt-border-radius);
116
+ border: 1px solid var(--lt-border-default);
117
+ box-sizing: border-box;
118
+ color: var(--lt-text-default);
119
+ font-family: inherit;
120
+ font-weight: 400;
121
+ transition:
122
+ border-color 120ms ease,
123
+ box-shadow 120ms ease;
124
+ width: 100%;
125
+ }
126
+
127
+ textarea {
128
+ min-height: 80px;
129
+ padding-block: var(--lt-spacing-3);
130
+ resize: vertical;
131
+ }
132
+
133
+ input::placeholder,
134
+ textarea::placeholder {
135
+ color: var(--lt-text-muted);
136
+ }
137
+
138
+ input:hover:not(:disabled),
139
+ textarea:hover:not(:disabled) {
140
+ border-color: var(--lt-border-strong);
141
+ }
142
+
143
+ input:focus,
144
+ textarea:focus {
145
+ border-color: var(--lt-interactive-primary-bg);
146
+ box-shadow: 0 0 0 3px var(--lt-bg-primary-subtle);
147
+ outline: none;
148
+ }
149
+
150
+ input:disabled,
151
+ textarea:disabled {
152
+ background: var(--lt-bg-surface);
153
+ color: var(--lt-text-muted);
154
+ cursor: not-allowed;
155
+ }
156
+
157
+ /* sizes */
158
+ :host([size='sm']) input,
159
+ :host([size='sm']) textarea {
160
+ font-size: 0.875rem;
161
+ height: 32px;
162
+ padding-inline: var(--lt-spacing-3);
163
+ }
164
+
165
+ :host([size='sm']) input.has-start-icon,
166
+ :host([size='sm']) textarea.has-start-icon {
167
+ padding-left: calc(var(--lt-spacing-3) + 20px + var(--lt-spacing-2));
168
+ }
169
+
170
+ :host([size='sm']) input.has-end-icon,
171
+ :host([size='sm']) textarea.has-end-icon {
172
+ padding-right: calc(var(--lt-spacing-3) + 20px + var(--lt-spacing-2));
173
+ }
174
+
175
+ :host([size='md']) input,
176
+ :host([size='md']) textarea {
177
+ font-size: 1rem;
178
+ height: 40px;
179
+ padding-inline: var(--lt-spacing-4);
180
+ }
181
+
182
+ :host([size='md']) input.has-start-icon,
183
+ :host([size='md']) textarea.has-start-icon {
184
+ padding-left: calc(var(--lt-spacing-4) + 20px + var(--lt-spacing-2));
185
+ }
186
+
187
+ :host([size='md']) input.has-end-icon,
188
+ :host([size='md']) textarea.has-end-icon {
189
+ padding-right: calc(var(--lt-spacing-4) + 20px + var(--lt-spacing-2));
190
+ }
191
+
192
+ :host([size='lg']) input,
193
+ :host([size='lg']) textarea {
194
+ font-size: 1.0625rem;
195
+ height: 48px;
196
+ padding-inline: var(--lt-spacing-5);
197
+ }
198
+
199
+ :host([size='lg']) input.has-start-icon,
200
+ :host([size='lg']) textarea.has-start-icon {
201
+ padding-left: calc(var(--lt-spacing-5) + 24px + var(--lt-spacing-2));
202
+ }
203
+
204
+ :host([size='lg']) input.has-end-icon,
205
+ :host([size='lg']) textarea.has-end-icon {
206
+ padding-right: calc(var(--lt-spacing-5) + 24px + var(--lt-spacing-2));
207
+ }
208
+
209
+ :host([size='lg']) .icon-start,
210
+ :host([size='lg']) .icon-end {
211
+ width: 24px;
212
+ height: 24px;
213
+ }
214
+
215
+ /* variants */
216
+ :host([variant='success']) input,
217
+ :host([variant='success']) textarea {
218
+ border-color: var(--lt-border-success-strong);
219
+ }
220
+
221
+ :host([variant='success']) input:focus,
222
+ :host([variant='success']) textarea:focus {
223
+ border-color: var(--lt-interactive-success-bg-hover);
224
+ box-shadow: 0 0 0 3px var(--lt-bg-success-subtle);
225
+ }
226
+
227
+ :host([variant='warning']) input,
228
+ :host([variant='warning']) textarea {
229
+ border-color: var(--lt-border-warning-strong);
230
+ }
231
+
232
+ :host([variant='warning']) input:focus,
233
+ :host([variant='warning']) textarea:focus {
234
+ border-color: var(--lt-interactive-warning-bg-hover);
235
+ box-shadow: 0 0 0 3px var(--lt-bg-warning-subtle);
236
+ }
237
+
238
+ :host([variant='error']) input,
239
+ :host([variant='error']) textarea,
240
+ :host([data-invalid]) input,
241
+ :host([data-invalid]) textarea {
242
+ border-color: var(--lt-border-error-strong);
243
+ }
244
+
245
+ :host([variant='error']) input:focus,
246
+ :host([variant='error']) textarea:focus,
247
+ :host([data-invalid]) input:focus,
248
+ :host([data-invalid]) textarea:focus {
249
+ border-color: var(--lt-interactive-error-bg-hover);
250
+ box-shadow: 0 0 0 3px var(--lt-bg-error-subtle);
251
+ }
252
+
253
+ .helper-text {
254
+ color: var(--lt-text-subtle);
255
+ }
256
+
257
+ .helper-text::part(base) {
258
+ font-weight: 200;
259
+ }
260
+
261
+ :host([variant='success']) .helper-text {
262
+ color: var(--lt-text-success);
263
+ }
264
+
265
+ :host([variant='warning']) .helper-text {
266
+ color: var(--lt-text-warning);
267
+ }
268
+
269
+ :host([variant='error']) .helper-text,
270
+ :host([data-invalid]) .helper-text {
271
+ color: var(--lt-text-error);
272
+ }
273
+
274
+ .required-indicator {
275
+ color: var(--lt-color-error-500);
276
+ }
277
+
278
+ :host([uppercase]) label lt-text::part(base) {
279
+ font-variant-caps: small-caps;
280
+ letter-spacing: 0.05rem;
281
+ text-transform: lowercase;
282
+ }
283
+ `;
284
+
285
+ // src/components/textfield/textfield.ts
286
+ import "@latty-ds/icons";
287
+
288
+ // src/components/text/text.ts
289
+ import { customElement, property as property2 } from "lit/decorators.js";
290
+ import { html, unsafeStatic } from "lit/static-html.js";
291
+
292
+ // src/components/text/text.styles.ts
293
+ import { css as css2 } from "lit";
294
+ var textStyles = css2`
295
+ :host {
296
+ display: block;
297
+ color: inherit;
298
+ }
299
+
300
+ /* Inline variants sit in text flow */
301
+ :host([variant='caption']),
302
+ :host([variant='overline']),
303
+ :host([variant='label']) {
304
+ display: inline;
305
+ }
306
+
307
+ [part='base'] {
308
+ margin: 0;
309
+ color: inherit;
310
+ font-family: var(--lt-typography-fontfamily);
311
+ }
312
+
313
+ /* ── Display ─────────────────────────────────────────────────────────── */
314
+
315
+ :host([variant='display-2xl']) [part='base'] {
316
+ font-size: clamp(2.5rem, 6vw, 4.5rem);
317
+ font-weight: var(--lt-text-weight, 200);
318
+ line-height: 1.1;
319
+ letter-spacing: -0.02em;
320
+ }
321
+
322
+ :host([variant='display-xl']) [part='base'] {
323
+ font-size: clamp(2rem, 5vw, 3.75rem);
324
+ font-weight: var(--lt-text-weight, 200);
325
+ line-height: 1.1;
326
+ letter-spacing: -0.02em;
327
+ }
328
+
329
+ :host([variant='display-lg']) [part='base'] {
330
+ font-size: clamp(2rem, 4vw, 3rem);
331
+ font-weight: var(--lt-text-weight, 200);
332
+ line-height: 1.15;
333
+ letter-spacing: -0.01em;
334
+ }
335
+
336
+ /* ── Headings ─────────────────────────────────────────────────────────── */
337
+
338
+ :host([variant='h1']) [part='base'] {
339
+ font-size: clamp(1.75rem, 2.5vw + 0.75rem, 2.5rem);
340
+ font-weight: var(--lt-text-weight, 600);
341
+ line-height: 1.2;
342
+ letter-spacing: -0.02em;
343
+ }
344
+
345
+ :host([variant='h2']) [part='base'] {
346
+ font-size: clamp(1.5rem, 2vw + 0.5rem, 2rem);
347
+ font-weight: var(--lt-text-weight, 600);
348
+ line-height: 1.25;
349
+ letter-spacing: -0.01em;
350
+ }
351
+
352
+ :host([variant='h3']) [part='base'] {
353
+ font-size: clamp(1.25rem, 1.5vw + 0.5rem, 1.5rem);
354
+ font-weight: var(--lt-text-weight, 600);
355
+ line-height: 1.3;
356
+ }
357
+
358
+ :host([variant='h4']) [part='base'] {
359
+ font-size: 1.25rem;
360
+ font-weight: var(--lt-text-weight, 600);
361
+ line-height: 1.35;
362
+ }
363
+
364
+ :host([variant='h5']) [part='base'] {
365
+ font-size: 1.125rem;
366
+ font-weight: var(--lt-text-weight, 600);
367
+ line-height: 1.4;
368
+ }
369
+
370
+ :host([variant='h6']) [part='base'] {
371
+ font-size: 1rem;
372
+ font-weight: var(--lt-text-weight, 600);
373
+ line-height: 1.4;
374
+ }
375
+
376
+ /* ── Body ─────────────────────────────────────────────────────────────── */
377
+
378
+ :host([variant='lead']) [part='base'] {
379
+ font-size: 1.25rem;
380
+ font-weight: var(--lt-text-weight, 400);
381
+ line-height: 1.6;
382
+ }
383
+
384
+ :host([variant='body']) [part='base'],
385
+ :host(:not([variant])) [part='base'] {
386
+ font-size: 1rem;
387
+ font-weight: var(--lt-text-weight, 400);
388
+ line-height: 1.6;
389
+ }
390
+
391
+ :host([variant='body-sm']) [part='base'] {
392
+ font-size: 0.875rem;
393
+ font-weight: var(--lt-text-weight, 400);
394
+ line-height: 1.6;
395
+ }
396
+
397
+ /* ── Inline ───────────────────────────────────────────────────────────── */
398
+
399
+ :host([variant='caption']) [part='base'] {
400
+ font-size: 0.75rem;
401
+ font-weight: var(--lt-text-weight, 400);
402
+ line-height: 1.5;
403
+ }
404
+
405
+ :host([variant='overline']) [part='base'] {
406
+ font-size: 0.6875rem;
407
+ font-weight: var(--lt-text-weight, 600);
408
+ line-height: 1.2;
409
+ letter-spacing: 0.08em;
410
+ text-transform: uppercase;
411
+ }
412
+
413
+ :host([variant='label']) [part='base'] {
414
+ font-size: 0.875rem;
415
+ font-weight: var(--lt-text-weight, 600);
416
+ line-height: 1.4;
417
+ }
418
+ `;
419
+
420
+ // src/components/text/text.ts
421
+ var VARIANT_TAG = {
422
+ "display-2xl": "p",
423
+ "display-xl": "p",
424
+ "display-lg": "p",
425
+ h1: "h1",
426
+ h2: "h2",
427
+ h3: "h3",
428
+ h4: "h4",
429
+ h5: "h5",
430
+ h6: "h6",
431
+ lead: "p",
432
+ body: "p",
433
+ "body-sm": "p",
434
+ caption: "span",
435
+ overline: "span",
436
+ label: "span"
437
+ };
438
+ var Text = class extends ThemeableElement {
439
+ constructor() {
440
+ super(...arguments);
441
+ this.variant = "body";
442
+ this.as = "";
443
+ }
444
+ render() {
445
+ const tag = unsafeStatic(this.as || VARIANT_TAG[this.variant] || "p");
446
+ return html`<${tag} part="base"><slot></slot></${tag}>`;
447
+ }
448
+ };
449
+ Text.styles = textStyles;
450
+ __decorateClass([
451
+ property2({ reflect: true })
452
+ ], Text.prototype, "variant", 2);
453
+ __decorateClass([
454
+ property2({ reflect: true })
455
+ ], Text.prototype, "as", 2);
456
+ Text = __decorateClass([
457
+ customElement("lt-text")
458
+ ], Text);
459
+
460
+ // src/components/textfield/textfield.ts
461
+ var Textfield = class extends ThemeableElement {
462
+ constructor() {
463
+ super(...arguments);
464
+ this.variant = "default";
465
+ this.size = "md";
466
+ this.type = "text";
467
+ this.value = "";
468
+ this.placeholder = "";
469
+ this.label = "";
470
+ this.helperText = "";
471
+ this.disabled = false;
472
+ this.required = false;
473
+ this.readonly = false;
474
+ this.iconStart = "";
475
+ this.rows = 3;
476
+ this.min = null;
477
+ this.max = null;
478
+ this.uppercase = false;
479
+ this.isPasswordVisible = false;
480
+ this._touched = false;
481
+ this._autoError = false;
482
+ this._onBlur = (e) => {
483
+ const native = e.target;
484
+ this.value = native.value;
485
+ this._touched = true;
486
+ this._autoError = !this._validate();
487
+ };
488
+ }
489
+ /**
490
+ * Handles input events from the native input or textarea element.
491
+ * Updates the component's value property and dispatches a custom input event.
492
+ *
493
+ * @param e - The native input event
494
+ * @private
495
+ */
496
+ _validate() {
497
+ const v = this.value;
498
+ if (!v) return true;
499
+ if (this.type === "email" && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v)) return false;
500
+ if (this.type === "url") {
501
+ try {
502
+ new URL(v);
503
+ } catch {
504
+ return false;
505
+ }
506
+ }
507
+ if (this.type === "tel" && !/^[+\d][\d\s()\-.]{2,}$/.test(v)) return false;
508
+ if (this.type === "number") {
509
+ const n = Number(v);
510
+ if (isNaN(n)) return false;
511
+ if (this.min !== null && n < this.min) return false;
512
+ if (this.max !== null && n > this.max) return false;
513
+ } else {
514
+ if (this.min !== null && v.length < this.min) return false;
515
+ if (this.max !== null && v.length > this.max) return false;
516
+ }
517
+ return true;
518
+ }
519
+ handleInput(e) {
520
+ const input = e.target;
521
+ this.value = input.value;
522
+ if (this._touched) this._autoError = !this._validate();
523
+ this.dispatchEvent(
524
+ new CustomEvent("input", {
525
+ detail: { value: this.value },
526
+ bubbles: true,
527
+ composed: true
528
+ })
529
+ );
530
+ }
531
+ /**
532
+ * Handles change events from the native input or textarea element.
533
+ * Updates the component's value property and dispatches a custom change event.
534
+ *
535
+ * @param e - The native change event
536
+ * @private
537
+ */
538
+ handleChange(e) {
539
+ const input = e.target;
540
+ this.value = input.value;
541
+ this.dispatchEvent(
542
+ new CustomEvent("change", {
543
+ detail: { value: this.value },
544
+ bubbles: true,
545
+ composed: true
546
+ })
547
+ );
548
+ }
549
+ /**
550
+ * Toggles password visibility for password-type inputs.
551
+ * Switches between showing plain text and masked password.
552
+ *
553
+ * @private
554
+ */
555
+ togglePasswordVisibility() {
556
+ this.isPasswordVisible = !this.isPasswordVisible;
557
+ }
558
+ /**
559
+ * Determines the appropriate end icon based on input type and variant.
560
+ *
561
+ * Password inputs show eye/eye-off toggle icon.
562
+ * Non-default variants show their respective state icons.
563
+ * Default variant shows no end icon.
564
+ *
565
+ * @returns The icon name to display, or empty string if no icon should be shown
566
+ * @private
567
+ */
568
+ getEndIconName() {
569
+ if (this.type === "password") return this.isPasswordVisible ? "eye-off" : "eye";
570
+ const effectiveVariant = this._autoError ? "error" : this.variant;
571
+ switch (effectiveVariant) {
572
+ case "success":
573
+ return "check-circle";
574
+ case "warning":
575
+ return "warning-triangle";
576
+ case "error":
577
+ return "xmark-circle";
578
+ default:
579
+ return "";
580
+ }
581
+ }
582
+ updated(changed) {
583
+ super.updated(changed);
584
+ this.toggleAttribute("data-invalid", this._autoError);
585
+ }
586
+ render() {
587
+ const hasStartIcon = Boolean(this.iconStart);
588
+ const isPasswordField = this.type === "password";
589
+ const isMultiline = this.type === "multiline";
590
+ const isNumber = this.type === "number";
591
+ const endIconName = this.getEndIconName();
592
+ const hasEndIcon = Boolean(endIconName);
593
+ const actualInputType = isPasswordField && this.isPasswordVisible ? "text" : this.type;
594
+ const isInvalid = this._autoError || this.variant === "error";
595
+ const resolvedHelperText = typeof this.helperText === "function" ? this.helperText(isInvalid) : this.helperText;
596
+ return html2`
597
+ <div class="wrapper">
598
+ ${this.label ? html2`
599
+ <label>
600
+ <lt-text variant="label" as="span">${this.label}</lt-text>
601
+ ${this.required ? html2`<span class="required-indicator">*</span>` : ""}
602
+ </label>
603
+ ` : ""}
604
+ <div class="input-container">
605
+ ${hasStartIcon ? html2`<lt-icon class="icon-start" name=${this.iconStart}></lt-icon>` : ""}
606
+ ${isMultiline ? html2`
607
+ <textarea
608
+ .value=${this.value}
609
+ placeholder=${this.placeholder}
610
+ rows=${this.rows}
611
+ minlength=${ifDefined(this.min !== null ? this.min : void 0)}
612
+ maxlength=${ifDefined(this.max !== null ? this.max : void 0)}
613
+ ?disabled=${this.disabled}
614
+ ?required=${this.required}
615
+ ?readonly=${this.readonly}
616
+ @input=${this.handleInput}
617
+ @change=${this.handleChange}
618
+ @blur=${this._onBlur}
619
+ aria-label=${this.label || this.placeholder}
620
+ aria-invalid=${isInvalid ? "true" : "false"}
621
+ class=${hasStartIcon ? "has-start-icon" : ""}
622
+ ${hasEndIcon ? "has-end-icon" : ""}
623
+ ></textarea>
624
+ ` : html2`
625
+ <input
626
+ type=${actualInputType}
627
+ .value=${this.value}
628
+ placeholder=${this.placeholder}
629
+ min=${ifDefined(isNumber && this.min !== null ? this.min : void 0)}
630
+ max=${ifDefined(isNumber && this.max !== null ? this.max : void 0)}
631
+ minlength=${ifDefined(!isNumber && this.min !== null ? this.min : void 0)}
632
+ maxlength=${ifDefined(!isNumber && this.max !== null ? this.max : void 0)}
633
+ ?disabled=${this.disabled}
634
+ ?required=${this.required}
635
+ ?readonly=${this.readonly}
636
+ @input=${this.handleInput}
637
+ @change=${this.handleChange}
638
+ @blur=${this._onBlur}
639
+ aria-label=${this.label || this.placeholder}
640
+ aria-invalid=${isInvalid ? "true" : "false"}
641
+ class=${hasStartIcon ? "has-start-icon" : ""}
642
+ ${hasEndIcon ? "has-end-icon" : ""}
643
+ />
644
+ `}
645
+ ${hasEndIcon ? html2`
646
+ <lt-icon
647
+ class="icon-end ${isPasswordField ? "password-toggle" : "variant-icon"}"
648
+ name=${endIconName}
649
+ @click=${isPasswordField ? this.togglePasswordVisibility : null}
650
+ ></lt-icon>
651
+ ` : ""}
652
+ </div>
653
+ ${resolvedHelperText ? html2`<lt-text variant="caption" as="span" class="helper-text">${resolvedHelperText}</lt-text>` : ""}
654
+ </div>
655
+ `;
656
+ }
657
+ };
658
+ Textfield.styles = textfieldStyles;
659
+ __decorateClass([
660
+ property3({ reflect: true })
661
+ ], Textfield.prototype, "variant", 2);
662
+ __decorateClass([
663
+ property3({ reflect: true })
664
+ ], Textfield.prototype, "size", 2);
665
+ __decorateClass([
666
+ property3({ reflect: true })
667
+ ], Textfield.prototype, "type", 2);
668
+ __decorateClass([
669
+ property3()
670
+ ], Textfield.prototype, "value", 2);
671
+ __decorateClass([
672
+ property3()
673
+ ], Textfield.prototype, "placeholder", 2);
674
+ __decorateClass([
675
+ property3()
676
+ ], Textfield.prototype, "label", 2);
677
+ __decorateClass([
678
+ property3({ attribute: "helper-text" })
679
+ ], Textfield.prototype, "helperText", 2);
680
+ __decorateClass([
681
+ property3({ type: Boolean, reflect: true })
682
+ ], Textfield.prototype, "disabled", 2);
683
+ __decorateClass([
684
+ property3({ type: Boolean, reflect: true })
685
+ ], Textfield.prototype, "required", 2);
686
+ __decorateClass([
687
+ property3({ type: Boolean, reflect: true })
688
+ ], Textfield.prototype, "readonly", 2);
689
+ __decorateClass([
690
+ property3({ attribute: "icon-start" })
691
+ ], Textfield.prototype, "iconStart", 2);
692
+ __decorateClass([
693
+ property3({ type: Number })
694
+ ], Textfield.prototype, "rows", 2);
695
+ __decorateClass([
696
+ property3({ type: Number })
697
+ ], Textfield.prototype, "min", 2);
698
+ __decorateClass([
699
+ property3({ type: Number })
700
+ ], Textfield.prototype, "max", 2);
701
+ __decorateClass([
702
+ property3({ type: Boolean, reflect: true })
703
+ ], Textfield.prototype, "uppercase", 2);
704
+ __decorateClass([
705
+ state()
706
+ ], Textfield.prototype, "isPasswordVisible", 2);
707
+ __decorateClass([
708
+ state()
709
+ ], Textfield.prototype, "_touched", 2);
710
+ __decorateClass([
711
+ state()
712
+ ], Textfield.prototype, "_autoError", 2);
713
+ Textfield = __decorateClass([
714
+ customElement2("lt-textfield")
715
+ ], Textfield);
716
+ export {
717
+ Textfield
718
+ };