tyrell-components 1.0.0-RC10
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/LICENSE +21 -0
- package/README.md +221 -0
- package/css/tyrell-brand.css +767 -0
- package/css/tyrell.css +1679 -0
- package/dist/tyrell-brand.css +767 -0
- package/dist/tyrell.css +1679 -0
- package/dist/tyrell.js +2 -0
- package/lib/base/ty-component.d.ts +133 -0
- package/lib/base/ty-component.d.ts.map +1 -0
- package/lib/base/ty-component.js +297 -0
- package/lib/base/ty-component.js.map +1 -0
- package/lib/components/button.d.ts +135 -0
- package/lib/components/button.d.ts.map +1 -0
- package/lib/components/button.js +277 -0
- package/lib/components/button.js.map +1 -0
- package/lib/components/calendar-month.d.ts +132 -0
- package/lib/components/calendar-month.d.ts.map +1 -0
- package/lib/components/calendar-month.js +440 -0
- package/lib/components/calendar-month.js.map +1 -0
- package/lib/components/calendar-navigation.d.ts +137 -0
- package/lib/components/calendar-navigation.d.ts.map +1 -0
- package/lib/components/calendar-navigation.js +366 -0
- package/lib/components/calendar-navigation.js.map +1 -0
- package/lib/components/calendar.d.ts +166 -0
- package/lib/components/calendar.d.ts.map +1 -0
- package/lib/components/calendar.js +774 -0
- package/lib/components/calendar.js.map +1 -0
- package/lib/components/checkbox.d.ts +189 -0
- package/lib/components/checkbox.d.ts.map +1 -0
- package/lib/components/checkbox.js +400 -0
- package/lib/components/checkbox.js.map +1 -0
- package/lib/components/copy.d.ts +180 -0
- package/lib/components/copy.d.ts.map +1 -0
- package/lib/components/copy.js +393 -0
- package/lib/components/copy.js.map +1 -0
- package/lib/components/date-picker.d.ts +379 -0
- package/lib/components/date-picker.d.ts.map +1 -0
- package/lib/components/date-picker.js +1586 -0
- package/lib/components/date-picker.js.map +1 -0
- package/lib/components/dropdown.d.ts +424 -0
- package/lib/components/dropdown.d.ts.map +1 -0
- package/lib/components/dropdown.js +1640 -0
- package/lib/components/dropdown.js.map +1 -0
- package/lib/components/file-upload.d.ts +121 -0
- package/lib/components/file-upload.d.ts.map +1 -0
- package/lib/components/file-upload.js +441 -0
- package/lib/components/file-upload.js.map +1 -0
- package/lib/components/icon.d.ts +118 -0
- package/lib/components/icon.d.ts.map +1 -0
- package/lib/components/icon.js +245 -0
- package/lib/components/icon.js.map +1 -0
- package/lib/components/input.d.ts +270 -0
- package/lib/components/input.d.ts.map +1 -0
- package/lib/components/input.js +721 -0
- package/lib/components/input.js.map +1 -0
- package/lib/components/modal.d.ts +78 -0
- package/lib/components/modal.d.ts.map +1 -0
- package/lib/components/modal.js +497 -0
- package/lib/components/modal.js.map +1 -0
- package/lib/components/multiselect.d.ts +397 -0
- package/lib/components/multiselect.d.ts.map +1 -0
- package/lib/components/multiselect.js +1595 -0
- package/lib/components/multiselect.js.map +1 -0
- package/lib/components/option.d.ts +66 -0
- package/lib/components/option.d.ts.map +1 -0
- package/lib/components/option.js +314 -0
- package/lib/components/option.js.map +1 -0
- package/lib/components/popup.d.ts +43 -0
- package/lib/components/popup.d.ts.map +1 -0
- package/lib/components/popup.js +380 -0
- package/lib/components/popup.js.map +1 -0
- package/lib/components/radio.d.ts +198 -0
- package/lib/components/radio.d.ts.map +1 -0
- package/lib/components/radio.js +437 -0
- package/lib/components/radio.js.map +1 -0
- package/lib/components/resize-observer.d.ts +48 -0
- package/lib/components/resize-observer.d.ts.map +1 -0
- package/lib/components/resize-observer.js +108 -0
- package/lib/components/resize-observer.js.map +1 -0
- package/lib/components/scroll-container.d.ts +51 -0
- package/lib/components/scroll-container.d.ts.map +1 -0
- package/lib/components/scroll-container.js +239 -0
- package/lib/components/scroll-container.js.map +1 -0
- package/lib/components/step.d.ts +26 -0
- package/lib/components/step.d.ts.map +1 -0
- package/lib/components/step.js +75 -0
- package/lib/components/step.js.map +1 -0
- package/lib/components/switch.d.ts +111 -0
- package/lib/components/switch.d.ts.map +1 -0
- package/lib/components/switch.js +240 -0
- package/lib/components/switch.js.map +1 -0
- package/lib/components/tab.d.ts +23 -0
- package/lib/components/tab.d.ts.map +1 -0
- package/lib/components/tab.js +76 -0
- package/lib/components/tab.js.map +1 -0
- package/lib/components/tabs.d.ts +93 -0
- package/lib/components/tabs.d.ts.map +1 -0
- package/lib/components/tabs.js +653 -0
- package/lib/components/tabs.js.map +1 -0
- package/lib/components/tag.d.ts +144 -0
- package/lib/components/tag.d.ts.map +1 -0
- package/lib/components/tag.js +316 -0
- package/lib/components/tag.js.map +1 -0
- package/lib/components/textarea.d.ts +241 -0
- package/lib/components/textarea.d.ts.map +1 -0
- package/lib/components/textarea.js +585 -0
- package/lib/components/textarea.js.map +1 -0
- package/lib/components/tooltip.d.ts +40 -0
- package/lib/components/tooltip.d.ts.map +1 -0
- package/lib/components/tooltip.js +439 -0
- package/lib/components/tooltip.js.map +1 -0
- package/lib/components/wizard.d.ts +86 -0
- package/lib/components/wizard.d.ts.map +1 -0
- package/lib/components/wizard.js +636 -0
- package/lib/components/wizard.js.map +1 -0
- package/lib/icons/fontawesome/brands.d.ts +557 -0
- package/lib/icons/fontawesome/brands.d.ts.map +1 -0
- package/lib/icons/fontawesome/brands.js +557 -0
- package/lib/icons/fontawesome/brands.js.map +1 -0
- package/lib/icons/fontawesome/regular.d.ts +281 -0
- package/lib/icons/fontawesome/regular.d.ts.map +1 -0
- package/lib/icons/fontawesome/regular.js +281 -0
- package/lib/icons/fontawesome/regular.js.map +1 -0
- package/lib/icons/fontawesome/solid.d.ts +1992 -0
- package/lib/icons/fontawesome/solid.d.ts.map +1 -0
- package/lib/icons/fontawesome/solid.js +1992 -0
- package/lib/icons/fontawesome/solid.js.map +1 -0
- package/lib/icons/heroicons/micro.d.ts +324 -0
- package/lib/icons/heroicons/micro.d.ts.map +1 -0
- package/lib/icons/heroicons/micro.js +1032 -0
- package/lib/icons/heroicons/micro.js.map +1 -0
- package/lib/icons/heroicons/mini.d.ts +332 -0
- package/lib/icons/heroicons/mini.d.ts.map +1 -0
- package/lib/icons/heroicons/mini.js +1038 -0
- package/lib/icons/heroicons/mini.js.map +1 -0
- package/lib/icons/heroicons/outline.d.ts +332 -0
- package/lib/icons/heroicons/outline.d.ts.map +1 -0
- package/lib/icons/heroicons/outline.js +993 -0
- package/lib/icons/heroicons/outline.js.map +1 -0
- package/lib/icons/heroicons/solid.d.ts +332 -0
- package/lib/icons/heroicons/solid.d.ts.map +1 -0
- package/lib/icons/heroicons/solid.js +1063 -0
- package/lib/icons/heroicons/solid.js.map +1 -0
- package/lib/icons/lucide.d.ts +1872 -0
- package/lib/icons/lucide.d.ts.map +1 -0
- package/lib/icons/lucide.js +28212 -0
- package/lib/icons/lucide.js.map +1 -0
- package/lib/icons/material/filled.d.ts +2180 -0
- package/lib/icons/material/filled.d.ts.map +1 -0
- package/lib/icons/material/filled.js +14003 -0
- package/lib/icons/material/filled.js.map +1 -0
- package/lib/icons/material/outlined.d.ts +2142 -0
- package/lib/icons/material/outlined.d.ts.map +1 -0
- package/lib/icons/material/outlined.js +14545 -0
- package/lib/icons/material/outlined.js.map +1 -0
- package/lib/icons/material/round.d.ts +2147 -0
- package/lib/icons/material/round.d.ts.map +1 -0
- package/lib/icons/material/round.js +14779 -0
- package/lib/icons/material/round.js.map +1 -0
- package/lib/icons/material/sharp.d.ts +2147 -0
- package/lib/icons/material/sharp.d.ts.map +1 -0
- package/lib/icons/material/sharp.js +14189 -0
- package/lib/icons/material/sharp.js.map +1 -0
- package/lib/icons/material/two-tone.d.ts +2185 -0
- package/lib/icons/material/two-tone.d.ts.map +1 -0
- package/lib/icons/material/two-tone.js +17152 -0
- package/lib/icons/material/two-tone.js.map +1 -0
- package/lib/index.d.ts +86 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +78 -0
- package/lib/index.js.map +1 -0
- package/lib/styles/button.d.ts +14 -0
- package/lib/styles/button.d.ts.map +1 -0
- package/lib/styles/button.js +498 -0
- package/lib/styles/button.js.map +1 -0
- package/lib/styles/calendar-month.d.ts +6 -0
- package/lib/styles/calendar-month.d.ts.map +1 -0
- package/lib/styles/calendar-month.js +275 -0
- package/lib/styles/calendar-month.js.map +1 -0
- package/lib/styles/calendar-navigation.d.ts +6 -0
- package/lib/styles/calendar-navigation.d.ts.map +1 -0
- package/lib/styles/calendar-navigation.js +143 -0
- package/lib/styles/calendar-navigation.js.map +1 -0
- package/lib/styles/calendar.d.ts +6 -0
- package/lib/styles/calendar.d.ts.map +1 -0
- package/lib/styles/calendar.js +28 -0
- package/lib/styles/calendar.js.map +1 -0
- package/lib/styles/checkbox.d.ts +9 -0
- package/lib/styles/checkbox.d.ts.map +1 -0
- package/lib/styles/checkbox.js +19 -0
- package/lib/styles/checkbox.js.map +1 -0
- package/lib/styles/copy.d.ts +7 -0
- package/lib/styles/copy.d.ts.map +1 -0
- package/lib/styles/copy.js +94 -0
- package/lib/styles/copy.js.map +1 -0
- package/lib/styles/custom-scrollbar.d.ts +6 -0
- package/lib/styles/custom-scrollbar.d.ts.map +1 -0
- package/lib/styles/custom-scrollbar.js +157 -0
- package/lib/styles/custom-scrollbar.js.map +1 -0
- package/lib/styles/date-picker.d.ts +6 -0
- package/lib/styles/date-picker.d.ts.map +1 -0
- package/lib/styles/date-picker.js +438 -0
- package/lib/styles/date-picker.js.map +1 -0
- package/lib/styles/dropdown.d.ts +12 -0
- package/lib/styles/dropdown.d.ts.map +1 -0
- package/lib/styles/dropdown.js +1081 -0
- package/lib/styles/dropdown.js.map +1 -0
- package/lib/styles/file-upload.d.ts +2 -0
- package/lib/styles/file-upload.d.ts.map +1 -0
- package/lib/styles/file-upload.js +241 -0
- package/lib/styles/file-upload.js.map +1 -0
- package/lib/styles/icon.d.ts +6 -0
- package/lib/styles/icon.d.ts.map +1 -0
- package/lib/styles/icon.js +241 -0
- package/lib/styles/icon.js.map +1 -0
- package/lib/styles/input.d.ts +7 -0
- package/lib/styles/input.d.ts.map +1 -0
- package/lib/styles/input.js +685 -0
- package/lib/styles/input.js.map +1 -0
- package/lib/styles/modal.d.ts +8 -0
- package/lib/styles/modal.d.ts.map +1 -0
- package/lib/styles/modal.js +134 -0
- package/lib/styles/modal.js.map +1 -0
- package/lib/styles/multiselect.d.ts +6 -0
- package/lib/styles/multiselect.d.ts.map +1 -0
- package/lib/styles/multiselect.js +825 -0
- package/lib/styles/multiselect.js.map +1 -0
- package/lib/styles/option.d.ts +6 -0
- package/lib/styles/option.d.ts.map +1 -0
- package/lib/styles/option.js +116 -0
- package/lib/styles/option.js.map +1 -0
- package/lib/styles/popup.d.ts +8 -0
- package/lib/styles/popup.d.ts.map +1 -0
- package/lib/styles/popup.js +95 -0
- package/lib/styles/popup.js.map +1 -0
- package/lib/styles/radio.d.ts +8 -0
- package/lib/styles/radio.d.ts.map +1 -0
- package/lib/styles/radio.js +160 -0
- package/lib/styles/radio.js.map +1 -0
- package/lib/styles/resize-observer.d.ts +6 -0
- package/lib/styles/resize-observer.d.ts.map +1 -0
- package/lib/styles/resize-observer.js +18 -0
- package/lib/styles/resize-observer.js.map +1 -0
- package/lib/styles/scroll-container.d.ts +6 -0
- package/lib/styles/scroll-container.d.ts.map +1 -0
- package/lib/styles/scroll-container.js +198 -0
- package/lib/styles/scroll-container.js.map +1 -0
- package/lib/styles/step.d.ts +5 -0
- package/lib/styles/step.d.ts.map +1 -0
- package/lib/styles/step.js +50 -0
- package/lib/styles/step.js.map +1 -0
- package/lib/styles/switch.d.ts +9 -0
- package/lib/styles/switch.d.ts.map +1 -0
- package/lib/styles/switch.js +100 -0
- package/lib/styles/switch.js.map +1 -0
- package/lib/styles/tab.d.ts +5 -0
- package/lib/styles/tab.d.ts.map +1 -0
- package/lib/styles/tab.js +51 -0
- package/lib/styles/tab.js.map +1 -0
- package/lib/styles/tabs.d.ts +13 -0
- package/lib/styles/tabs.d.ts.map +1 -0
- package/lib/styles/tabs.js +184 -0
- package/lib/styles/tabs.js.map +1 -0
- package/lib/styles/tag.d.ts +6 -0
- package/lib/styles/tag.d.ts.map +1 -0
- package/lib/styles/tag.js +409 -0
- package/lib/styles/tag.js.map +1 -0
- package/lib/styles/textarea.d.ts +6 -0
- package/lib/styles/textarea.d.ts.map +1 -0
- package/lib/styles/textarea.js +350 -0
- package/lib/styles/textarea.js.map +1 -0
- package/lib/styles/tooltip.d.ts +9 -0
- package/lib/styles/tooltip.d.ts.map +1 -0
- package/lib/styles/tooltip.js +133 -0
- package/lib/styles/tooltip.js.map +1 -0
- package/lib/styles/wizard.d.ts +25 -0
- package/lib/styles/wizard.d.ts.map +1 -0
- package/lib/styles/wizard.js +348 -0
- package/lib/styles/wizard.js.map +1 -0
- package/lib/types/common.d.ts +143 -0
- package/lib/types/common.d.ts.map +1 -0
- package/lib/types/common.js +5 -0
- package/lib/types/common.js.map +1 -0
- package/lib/utils/calendar-utils.d.ts +176 -0
- package/lib/utils/calendar-utils.d.ts.map +1 -0
- package/lib/utils/calendar-utils.js +370 -0
- package/lib/utils/calendar-utils.js.map +1 -0
- package/lib/utils/custom-scrollbar.d.ts +82 -0
- package/lib/utils/custom-scrollbar.d.ts.map +1 -0
- package/lib/utils/custom-scrollbar.js +320 -0
- package/lib/utils/custom-scrollbar.js.map +1 -0
- package/lib/utils/icon-registry.d.ts +78 -0
- package/lib/utils/icon-registry.d.ts.map +1 -0
- package/lib/utils/icon-registry.js +304 -0
- package/lib/utils/icon-registry.js.map +1 -0
- package/lib/utils/loader-registry.d.ts +35 -0
- package/lib/utils/loader-registry.d.ts.map +1 -0
- package/lib/utils/loader-registry.js +43 -0
- package/lib/utils/loader-registry.js.map +1 -0
- package/lib/utils/locale.d.ts +136 -0
- package/lib/utils/locale.d.ts.map +1 -0
- package/lib/utils/locale.js +213 -0
- package/lib/utils/locale.js.map +1 -0
- package/lib/utils/mobile.d.ts +14 -0
- package/lib/utils/mobile.d.ts.map +1 -0
- package/lib/utils/mobile.js +21 -0
- package/lib/utils/mobile.js.map +1 -0
- package/lib/utils/number-format.d.ts +83 -0
- package/lib/utils/number-format.d.ts.map +1 -0
- package/lib/utils/number-format.js +143 -0
- package/lib/utils/number-format.js.map +1 -0
- package/lib/utils/parse-boolean.d.ts +39 -0
- package/lib/utils/parse-boolean.d.ts.map +1 -0
- package/lib/utils/parse-boolean.js +58 -0
- package/lib/utils/parse-boolean.js.map +1 -0
- package/lib/utils/positioning.d.ts +143 -0
- package/lib/utils/positioning.d.ts.map +1 -0
- package/lib/utils/positioning.js +308 -0
- package/lib/utils/positioning.js.map +1 -0
- package/lib/utils/property-capture.d.ts +132 -0
- package/lib/utils/property-capture.d.ts.map +1 -0
- package/lib/utils/property-capture.js +152 -0
- package/lib/utils/property-capture.js.map +1 -0
- package/lib/utils/property-manager.d.ts +90 -0
- package/lib/utils/property-manager.d.ts.map +1 -0
- package/lib/utils/property-manager.js +197 -0
- package/lib/utils/property-manager.js.map +1 -0
- package/lib/utils/resize-observer.d.ts +42 -0
- package/lib/utils/resize-observer.d.ts.map +1 -0
- package/lib/utils/resize-observer.js +71 -0
- package/lib/utils/resize-observer.js.map +1 -0
- package/lib/utils/scroll-lock.d.ts +79 -0
- package/lib/utils/scroll-lock.d.ts.map +1 -0
- package/lib/utils/scroll-lock.js +197 -0
- package/lib/utils/scroll-lock.js.map +1 -0
- package/lib/utils/styles.d.ts +27 -0
- package/lib/utils/styles.d.ts.map +1 -0
- package/lib/utils/styles.js +53 -0
- package/lib/utils/styles.js.map +1 -0
- package/lib/version.d.ts +8 -0
- package/lib/version.d.ts.map +1 -0
- package/lib/version.js +11 -0
- package/lib/version.js.map +1 -0
- package/package.json +163 -0
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ty-textarea - Enhanced textarea component with auto-resize functionality
|
|
3
|
+
*
|
|
4
|
+
* Features:
|
|
5
|
+
* - Auto-resize based on content
|
|
6
|
+
* - Form-associated custom element
|
|
7
|
+
* - Min/max height constraints
|
|
8
|
+
* - Size variants (xs, sm, md, lg, xl)
|
|
9
|
+
* - Validation states (error, required)
|
|
10
|
+
* - Manual resize control options
|
|
11
|
+
* - Accessibility support
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```html
|
|
15
|
+
* <!-- Basic usage -->
|
|
16
|
+
* <ty-textarea label="Description" placeholder="Enter details..."></ty-textarea>
|
|
17
|
+
*
|
|
18
|
+
* <!-- With validation -->
|
|
19
|
+
* <ty-textarea
|
|
20
|
+
* label="Bio"
|
|
21
|
+
* required
|
|
22
|
+
* error="Bio is required"
|
|
23
|
+
* size="lg">
|
|
24
|
+
* </ty-textarea>
|
|
25
|
+
*
|
|
26
|
+
* <!-- With height constraints -->
|
|
27
|
+
* <ty-textarea
|
|
28
|
+
* min-height="100px"
|
|
29
|
+
* max-height="300px"
|
|
30
|
+
* placeholder="Auto-resizing textarea">
|
|
31
|
+
* </ty-textarea>
|
|
32
|
+
*
|
|
33
|
+
* <!-- Manual resize control -->
|
|
34
|
+
* <ty-textarea resize="vertical"></ty-textarea>
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @fires {CustomEvent<{value: string, originalEvent: Event}>} input - Emitted on input
|
|
38
|
+
* @fires {CustomEvent<{value: string, originalEvent: Event}>} change - Emitted on change
|
|
39
|
+
*/
|
|
40
|
+
import { TyComponent } from '../base/ty-component.js';
|
|
41
|
+
import { ensureStyles } from '../utils/styles.js';
|
|
42
|
+
import { textareaStyles } from '../styles/textarea.js';
|
|
43
|
+
import { CustomScrollbar, isCustomScrollbarEnabled } from '../utils/custom-scrollbar.js';
|
|
44
|
+
import { customScrollbarStyles } from '../styles/custom-scrollbar.js';
|
|
45
|
+
/**
|
|
46
|
+
* Required icon SVG (matches input.ts)
|
|
47
|
+
*/
|
|
48
|
+
const REQUIRED_ICON = `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>`;
|
|
49
|
+
export class TyTextarea extends TyComponent {
|
|
50
|
+
constructor() {
|
|
51
|
+
super(); // TyComponent handles attachInternals() and attachShadow()
|
|
52
|
+
// ============================================================================
|
|
53
|
+
// INTERNAL STATE - Not managed by PropertyManager
|
|
54
|
+
// NOTE: _internals provided by TyComponent base class
|
|
55
|
+
// ============================================================================
|
|
56
|
+
// DOM element references
|
|
57
|
+
this._textareaEl = null;
|
|
58
|
+
this._dummyEl = null;
|
|
59
|
+
this._scrollbar = null;
|
|
60
|
+
// Focus state
|
|
61
|
+
this._isFocused = false;
|
|
62
|
+
/**
|
|
63
|
+
* Handle textarea input event
|
|
64
|
+
*/
|
|
65
|
+
this.handleInputEvent = (e) => {
|
|
66
|
+
const target = e.target;
|
|
67
|
+
const newValue = target.value;
|
|
68
|
+
// Update value via property (triggers proper lifecycle)
|
|
69
|
+
this.value = newValue;
|
|
70
|
+
// Trigger resize after state update
|
|
71
|
+
if (this._textareaEl && this._dummyEl) {
|
|
72
|
+
this.resizeTextarea(this._textareaEl, this._dummyEl);
|
|
73
|
+
}
|
|
74
|
+
// Emit custom events
|
|
75
|
+
this.emitValueEvents(e);
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Handle textarea focus event
|
|
79
|
+
*/
|
|
80
|
+
this.handleFocusEvent = () => {
|
|
81
|
+
this._isFocused = true;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Handle textarea blur event
|
|
85
|
+
*/
|
|
86
|
+
this.handleBlurEvent = () => {
|
|
87
|
+
this._isFocused = false;
|
|
88
|
+
};
|
|
89
|
+
// Apply styles to shadow root
|
|
90
|
+
const shadow = this.shadowRoot;
|
|
91
|
+
ensureStyles(shadow, { css: textareaStyles, id: 'ty-textarea' });
|
|
92
|
+
// Add custom scrollbar styles
|
|
93
|
+
if (isCustomScrollbarEnabled()) {
|
|
94
|
+
ensureStyles(shadow, { css: customScrollbarStyles, id: 'ty-custom-scrollbar' });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// observedAttributes auto-generated by TyComponent from properties config
|
|
98
|
+
// ============================================================================
|
|
99
|
+
// TYCOMPONENT LIFECYCLE HOOKS
|
|
100
|
+
// ============================================================================
|
|
101
|
+
/**
|
|
102
|
+
* Called when component connects to DOM
|
|
103
|
+
* TyComponent already handled pre-connection property capture
|
|
104
|
+
*/
|
|
105
|
+
onConnect() {
|
|
106
|
+
// No special initialization needed - TyComponent handles everything
|
|
107
|
+
// Just render the component
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Called when component disconnects from DOM
|
|
111
|
+
*/
|
|
112
|
+
onDisconnect() {
|
|
113
|
+
// Cleanup scrollbar
|
|
114
|
+
this._destroyScrollbar();
|
|
115
|
+
// Cleanup event listeners if needed
|
|
116
|
+
if (this._textareaEl) {
|
|
117
|
+
const newTextarea = this._textareaEl.cloneNode(true);
|
|
118
|
+
this._textareaEl.parentNode?.replaceChild(newTextarea, this._textareaEl);
|
|
119
|
+
this._textareaEl = null;
|
|
120
|
+
}
|
|
121
|
+
this._dummyEl = null;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Handle property changes - called BEFORE render
|
|
125
|
+
* This replaces the old attributeChangedCallback logic
|
|
126
|
+
*/
|
|
127
|
+
onPropertiesChanged(changes) {
|
|
128
|
+
// No special handling needed for textarea
|
|
129
|
+
// All property changes will trigger render() automatically if marked as visual
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Override form value to return current value
|
|
133
|
+
*/
|
|
134
|
+
getFormValue() {
|
|
135
|
+
return this.getProperty('value') || null;
|
|
136
|
+
}
|
|
137
|
+
// ============================================================================
|
|
138
|
+
// PROPERTY ACCESSORS - Simplified with TyComponent
|
|
139
|
+
// ============================================================================
|
|
140
|
+
get value() { return this.getProperty('value'); }
|
|
141
|
+
set value(v) { this.setProperty('value', v); }
|
|
142
|
+
get name() { return this.getProperty('name'); }
|
|
143
|
+
set name(v) { this.setProperty('name', v); }
|
|
144
|
+
get placeholder() { return this.getProperty('placeholder'); }
|
|
145
|
+
set placeholder(v) { this.setProperty('placeholder', v); }
|
|
146
|
+
get label() { return this.getProperty('label'); }
|
|
147
|
+
set label(v) { this.setProperty('label', v); }
|
|
148
|
+
get disabled() { return this.getProperty('disabled'); }
|
|
149
|
+
set disabled(v) { this.setProperty('disabled', v); }
|
|
150
|
+
get required() { return this.getProperty('required'); }
|
|
151
|
+
set required(v) { this.setProperty('required', v); }
|
|
152
|
+
get error() { return this.getProperty('error'); }
|
|
153
|
+
set error(v) { this.setProperty('error', v); }
|
|
154
|
+
get size() {
|
|
155
|
+
return this.getProperty('size');
|
|
156
|
+
}
|
|
157
|
+
set size(v) {
|
|
158
|
+
this.setProperty('size', v);
|
|
159
|
+
}
|
|
160
|
+
get rows() { return this.getProperty('rows'); }
|
|
161
|
+
set rows(v) { this.setProperty('rows', v); }
|
|
162
|
+
get cols() { return this.getProperty('cols'); }
|
|
163
|
+
set cols(v) { this.setProperty('cols', v); }
|
|
164
|
+
get resize() {
|
|
165
|
+
return this.getProperty('resize');
|
|
166
|
+
}
|
|
167
|
+
set resize(v) {
|
|
168
|
+
this.setProperty('resize', v);
|
|
169
|
+
}
|
|
170
|
+
get minHeight() { return this.getProperty('minHeight'); }
|
|
171
|
+
set minHeight(v) { this.setProperty('minHeight', v); }
|
|
172
|
+
get maxHeight() { return this.getProperty('maxHeight'); }
|
|
173
|
+
set maxHeight(v) { this.setProperty('maxHeight', v); }
|
|
174
|
+
// ===== HELPER METHODS =====
|
|
175
|
+
/**
|
|
176
|
+
* Extract font-related CSS properties from element
|
|
177
|
+
*/
|
|
178
|
+
getFontStyle(el) {
|
|
179
|
+
const computedStyle = window.getComputedStyle(el);
|
|
180
|
+
return {
|
|
181
|
+
fontFamily: computedStyle.fontFamily,
|
|
182
|
+
fontSize: computedStyle.fontSize,
|
|
183
|
+
fontWeight: computedStyle.fontWeight,
|
|
184
|
+
lineHeight: computedStyle.lineHeight,
|
|
185
|
+
letterSpacing: computedStyle.letterSpacing,
|
|
186
|
+
fontStyle: computedStyle.fontStyle
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Extract spacing-related CSS properties from element
|
|
191
|
+
*/
|
|
192
|
+
getSpacingStyle(el) {
|
|
193
|
+
const computedStyle = window.getComputedStyle(el);
|
|
194
|
+
return {
|
|
195
|
+
padding: computedStyle.padding,
|
|
196
|
+
paddingTop: computedStyle.paddingTop,
|
|
197
|
+
paddingRight: computedStyle.paddingRight,
|
|
198
|
+
paddingBottom: computedStyle.paddingBottom,
|
|
199
|
+
paddingLeft: computedStyle.paddingLeft,
|
|
200
|
+
margin: computedStyle.margin,
|
|
201
|
+
borderWidth: computedStyle.borderWidth
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Setup the hidden dummy element for height measurement
|
|
206
|
+
*/
|
|
207
|
+
setupDummyElement(textareaEl) {
|
|
208
|
+
const root = this.shadowRoot;
|
|
209
|
+
const existingDummy = root.querySelector('.textarea-dummy');
|
|
210
|
+
// Remove existing dummy if present
|
|
211
|
+
if (existingDummy) {
|
|
212
|
+
existingDummy.remove();
|
|
213
|
+
}
|
|
214
|
+
// Create new dummy element
|
|
215
|
+
const dummyEl = document.createElement('pre');
|
|
216
|
+
const fontStyle = this.getFontStyle(textareaEl);
|
|
217
|
+
const spacingStyle = this.getSpacingStyle(textareaEl);
|
|
218
|
+
// Set dummy element class
|
|
219
|
+
dummyEl.className = 'textarea-dummy';
|
|
220
|
+
// Apply styles to match textarea
|
|
221
|
+
const style = dummyEl.style;
|
|
222
|
+
style.position = 'absolute';
|
|
223
|
+
style.top = '0';
|
|
224
|
+
style.left = '0';
|
|
225
|
+
style.visibility = 'hidden';
|
|
226
|
+
style.whiteSpace = 'pre-wrap';
|
|
227
|
+
style.wordBreak = 'break-word';
|
|
228
|
+
style.boxSizing = 'border-box';
|
|
229
|
+
style.overflow = 'hidden';
|
|
230
|
+
style.pointerEvents = 'none';
|
|
231
|
+
// Apply font styles
|
|
232
|
+
Object.entries(fontStyle).forEach(([prop, value]) => {
|
|
233
|
+
;
|
|
234
|
+
style[prop] = value;
|
|
235
|
+
});
|
|
236
|
+
// Apply spacing styles
|
|
237
|
+
Object.entries(spacingStyle).forEach(([prop, value]) => {
|
|
238
|
+
;
|
|
239
|
+
style[prop] = value;
|
|
240
|
+
});
|
|
241
|
+
// Append to shadow root
|
|
242
|
+
root.appendChild(dummyEl);
|
|
243
|
+
this._dummyEl = dummyEl;
|
|
244
|
+
return dummyEl;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Resize textarea based on dummy element content with min/max height constraints
|
|
248
|
+
*/
|
|
249
|
+
resizeTextarea(textareaEl, dummyEl) {
|
|
250
|
+
if (!textareaEl || !dummyEl)
|
|
251
|
+
return;
|
|
252
|
+
const value = this.value;
|
|
253
|
+
const placeholder = this.placeholder;
|
|
254
|
+
const content = (value === '' && placeholder) ? placeholder : value + ' ';
|
|
255
|
+
const currentHeight = textareaEl.clientHeight;
|
|
256
|
+
// Set dummy content
|
|
257
|
+
dummyEl.textContent = content;
|
|
258
|
+
// Set dummy width to match textarea
|
|
259
|
+
dummyEl.style.width = `${textareaEl.clientWidth}px`;
|
|
260
|
+
// Get measured height
|
|
261
|
+
const measuredHeight = dummyEl.scrollHeight;
|
|
262
|
+
// Parse min/max heights
|
|
263
|
+
const minHeight = this.minHeight ? parseInt(this.minHeight.replace('px', ''), 10) : null;
|
|
264
|
+
const maxHeight = this.maxHeight ? parseInt(this.maxHeight.replace('px', ''), 10) : null;
|
|
265
|
+
// Apply constraints
|
|
266
|
+
let constrainedHeight = measuredHeight;
|
|
267
|
+
if (minHeight !== null)
|
|
268
|
+
constrainedHeight = Math.max(constrainedHeight, minHeight);
|
|
269
|
+
if (maxHeight !== null)
|
|
270
|
+
constrainedHeight = Math.min(constrainedHeight, maxHeight);
|
|
271
|
+
// Only update if height changed significantly (avoid micro-adjustments)
|
|
272
|
+
if (Math.abs(constrainedHeight - currentHeight) > 2) {
|
|
273
|
+
textareaEl.style.height = `${constrainedHeight}px`;
|
|
274
|
+
// Set overflow based on whether we hit max-height
|
|
275
|
+
const needsScroll = maxHeight !== null && measuredHeight >= maxHeight;
|
|
276
|
+
if (needsScroll) {
|
|
277
|
+
textareaEl.style.overflowY = 'auto';
|
|
278
|
+
this._setupScrollbar(textareaEl);
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
textareaEl.style.overflowY = 'hidden';
|
|
282
|
+
this._destroyScrollbar();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
// Keep scrollbar thumb in sync after resize
|
|
286
|
+
this._scrollbar?.update();
|
|
287
|
+
}
|
|
288
|
+
// ============ Custom Scrollbar ============
|
|
289
|
+
_setupScrollbar(textareaEl) {
|
|
290
|
+
if (this._scrollbar || !isCustomScrollbarEnabled())
|
|
291
|
+
return;
|
|
292
|
+
// Hide native scrollbar (Firefox + Chrome/Safari via data attribute)
|
|
293
|
+
textareaEl.style.scrollbarWidth = 'none';
|
|
294
|
+
this.setAttribute('data-custom-scroll', '');
|
|
295
|
+
this._scrollbar = new CustomScrollbar(textareaEl, {
|
|
296
|
+
vertical: true,
|
|
297
|
+
horizontal: false
|
|
298
|
+
});
|
|
299
|
+
// Append track to the textarea wrapper (position: relative)
|
|
300
|
+
const wrapper = this.shadowRoot.querySelector('.textarea-wrapper');
|
|
301
|
+
if (wrapper && this._scrollbar.trackY) {
|
|
302
|
+
wrapper.appendChild(this._scrollbar.trackY);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
_destroyScrollbar() {
|
|
306
|
+
if (!this._scrollbar)
|
|
307
|
+
return;
|
|
308
|
+
this._scrollbar.trackY?.remove();
|
|
309
|
+
this._scrollbar.destroy();
|
|
310
|
+
this._scrollbar = null;
|
|
311
|
+
// Restore native scrollbar
|
|
312
|
+
this.removeAttribute('data-custom-scroll');
|
|
313
|
+
if (this._textareaEl) {
|
|
314
|
+
this._textareaEl.style.scrollbarWidth = '';
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Emit custom input and change events
|
|
319
|
+
*/
|
|
320
|
+
emitValueEvents(originalEvent) {
|
|
321
|
+
const value = this.value;
|
|
322
|
+
// Update form internals
|
|
323
|
+
this._internals.setFormValue(value || '');
|
|
324
|
+
// Emit custom events
|
|
325
|
+
const data = {
|
|
326
|
+
bubbles: true,
|
|
327
|
+
composed: true,
|
|
328
|
+
detail: {
|
|
329
|
+
value,
|
|
330
|
+
originalEvent
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
// Use setTimeout to ensure these fire after standard events
|
|
334
|
+
setTimeout(() => {
|
|
335
|
+
this.dispatchEvent(new CustomEvent('input', data));
|
|
336
|
+
this.dispatchEvent(new CustomEvent('change', data));
|
|
337
|
+
}, 0);
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Build class list for textarea element
|
|
341
|
+
*/
|
|
342
|
+
buildClassList() {
|
|
343
|
+
const classes = [this.size];
|
|
344
|
+
if (this.disabled)
|
|
345
|
+
classes.push('disabled');
|
|
346
|
+
if (this.required)
|
|
347
|
+
classes.push('required');
|
|
348
|
+
if (this.error)
|
|
349
|
+
classes.push('error');
|
|
350
|
+
if (this.resize !== 'none')
|
|
351
|
+
classes.push(`resize-${this.resize}`);
|
|
352
|
+
const customClass = this.getAttribute('class');
|
|
353
|
+
if (customClass)
|
|
354
|
+
classes.push(customClass);
|
|
355
|
+
return classes.join(' ');
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Apply min/max height constraints to textarea element
|
|
359
|
+
*/
|
|
360
|
+
applyHeightConstraints(textareaEl) {
|
|
361
|
+
if (this.minHeight) {
|
|
362
|
+
textareaEl.style.minHeight = this.minHeight;
|
|
363
|
+
}
|
|
364
|
+
if (this.maxHeight) {
|
|
365
|
+
textareaEl.style.maxHeight = this.maxHeight;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Setup event listeners for textarea
|
|
370
|
+
*/
|
|
371
|
+
setupTextareaEvents(textareaEl) {
|
|
372
|
+
textareaEl.addEventListener('input', this.handleInputEvent);
|
|
373
|
+
textareaEl.addEventListener('change', this.handleInputEvent);
|
|
374
|
+
textareaEl.addEventListener('focus', this.handleFocusEvent);
|
|
375
|
+
textareaEl.addEventListener('blur', this.handleBlurEvent);
|
|
376
|
+
}
|
|
377
|
+
// ===== RENDER =====
|
|
378
|
+
render() {
|
|
379
|
+
const root = this.shadowRoot;
|
|
380
|
+
const existingContainer = root.querySelector('.textarea-container');
|
|
381
|
+
const existingLabel = root.querySelector('label');
|
|
382
|
+
const existingTextarea = root.querySelector('textarea');
|
|
383
|
+
const existingError = root.querySelector('.error-message');
|
|
384
|
+
if (existingContainer && existingTextarea) {
|
|
385
|
+
// Update existing elements
|
|
386
|
+
// Update label
|
|
387
|
+
if (this.label) {
|
|
388
|
+
if (existingLabel) {
|
|
389
|
+
existingLabel.innerHTML = this.label +
|
|
390
|
+
(this.required ? ` <span class="required-icon">${REQUIRED_ICON}</span>` : '');
|
|
391
|
+
existingLabel.style.display = 'block';
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
else if (existingLabel) {
|
|
395
|
+
existingLabel.style.display = 'none';
|
|
396
|
+
}
|
|
397
|
+
// Update textarea
|
|
398
|
+
existingTextarea.value = this.value || '';
|
|
399
|
+
existingTextarea.placeholder = this.placeholder || '';
|
|
400
|
+
existingTextarea.disabled = this.disabled;
|
|
401
|
+
existingTextarea.required = this.required;
|
|
402
|
+
existingTextarea.className = this.buildClassList();
|
|
403
|
+
// Set name for form association
|
|
404
|
+
if (this.name) {
|
|
405
|
+
existingTextarea.setAttribute('name', this.name);
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
existingTextarea.removeAttribute('name');
|
|
409
|
+
}
|
|
410
|
+
// Set rows/cols
|
|
411
|
+
if (this.rows)
|
|
412
|
+
existingTextarea.setAttribute('rows', this.rows);
|
|
413
|
+
if (this.cols)
|
|
414
|
+
existingTextarea.setAttribute('cols', this.cols);
|
|
415
|
+
// Apply height constraints
|
|
416
|
+
this.applyHeightConstraints(existingTextarea);
|
|
417
|
+
// Update error message
|
|
418
|
+
if (this.error) {
|
|
419
|
+
if (!existingError) {
|
|
420
|
+
const errorEl = document.createElement('div');
|
|
421
|
+
errorEl.className = 'error-message';
|
|
422
|
+
existingContainer.appendChild(errorEl);
|
|
423
|
+
}
|
|
424
|
+
const errorEl = root.querySelector('.error-message');
|
|
425
|
+
if (errorEl)
|
|
426
|
+
errorEl.textContent = this.error;
|
|
427
|
+
}
|
|
428
|
+
else if (existingError) {
|
|
429
|
+
existingError.remove();
|
|
430
|
+
}
|
|
431
|
+
// Setup dummy element and trigger resize
|
|
432
|
+
const dummyEl = this.setupDummyElement(existingTextarea);
|
|
433
|
+
setTimeout(() => this.resizeTextarea(existingTextarea, dummyEl), 0);
|
|
434
|
+
this._textareaEl = existingTextarea;
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
// Create new structure
|
|
438
|
+
const container = document.createElement('div');
|
|
439
|
+
container.className = 'textarea-container';
|
|
440
|
+
const labelEl = document.createElement('label');
|
|
441
|
+
labelEl.className = 'ty-field-label';
|
|
442
|
+
if (this.label) {
|
|
443
|
+
labelEl.innerHTML = this.label +
|
|
444
|
+
(this.required ? ` <span class="required-icon">${REQUIRED_ICON}</span>` : '');
|
|
445
|
+
labelEl.style.display = 'block';
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
labelEl.style.display = 'none';
|
|
449
|
+
}
|
|
450
|
+
const textareaEl = document.createElement('textarea');
|
|
451
|
+
textareaEl.value = this.value || '';
|
|
452
|
+
textareaEl.placeholder = this.placeholder || '';
|
|
453
|
+
textareaEl.disabled = this.disabled;
|
|
454
|
+
textareaEl.required = this.required;
|
|
455
|
+
textareaEl.className = this.buildClassList();
|
|
456
|
+
// Set name for form association
|
|
457
|
+
if (this.name) {
|
|
458
|
+
textareaEl.setAttribute('name', this.name);
|
|
459
|
+
}
|
|
460
|
+
// Set default or specified rows/cols
|
|
461
|
+
textareaEl.setAttribute('rows', this.rows || '3');
|
|
462
|
+
if (this.cols)
|
|
463
|
+
textareaEl.setAttribute('cols', this.cols);
|
|
464
|
+
// Apply height constraints
|
|
465
|
+
this.applyHeightConstraints(textareaEl);
|
|
466
|
+
// Setup event listeners
|
|
467
|
+
this.setupTextareaEvents(textareaEl);
|
|
468
|
+
// Build structure — wrapper provides position context for custom scrollbar
|
|
469
|
+
const wrapperEl = document.createElement('div');
|
|
470
|
+
wrapperEl.className = 'textarea-wrapper';
|
|
471
|
+
wrapperEl.appendChild(textareaEl);
|
|
472
|
+
container.appendChild(labelEl);
|
|
473
|
+
container.appendChild(wrapperEl);
|
|
474
|
+
// Add error message if present
|
|
475
|
+
if (this.error) {
|
|
476
|
+
const errorEl = document.createElement('div');
|
|
477
|
+
errorEl.className = 'error-message';
|
|
478
|
+
errorEl.textContent = this.error;
|
|
479
|
+
container.appendChild(errorEl);
|
|
480
|
+
}
|
|
481
|
+
root.appendChild(container);
|
|
482
|
+
// Setup dummy element and trigger initial resize
|
|
483
|
+
const dummyEl = this.setupDummyElement(textareaEl);
|
|
484
|
+
setTimeout(() => this.resizeTextarea(textareaEl, dummyEl), 0);
|
|
485
|
+
this._textareaEl = textareaEl;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
TyTextarea.formAssociated = true;
|
|
490
|
+
// ============================================================================
|
|
491
|
+
// PROPERTY CONFIGURATION - Declarative property lifecycle
|
|
492
|
+
// ============================================================================
|
|
493
|
+
TyTextarea.properties = {
|
|
494
|
+
// Core properties
|
|
495
|
+
value: {
|
|
496
|
+
type: 'string',
|
|
497
|
+
visual: true,
|
|
498
|
+
formValue: true,
|
|
499
|
+
emitChange: true,
|
|
500
|
+
default: ''
|
|
501
|
+
},
|
|
502
|
+
name: {
|
|
503
|
+
type: 'string',
|
|
504
|
+
default: ''
|
|
505
|
+
},
|
|
506
|
+
placeholder: {
|
|
507
|
+
type: 'string',
|
|
508
|
+
visual: true,
|
|
509
|
+
default: ''
|
|
510
|
+
},
|
|
511
|
+
label: {
|
|
512
|
+
type: 'string',
|
|
513
|
+
visual: true,
|
|
514
|
+
default: ''
|
|
515
|
+
},
|
|
516
|
+
disabled: {
|
|
517
|
+
type: 'boolean',
|
|
518
|
+
visual: true,
|
|
519
|
+
default: false
|
|
520
|
+
},
|
|
521
|
+
required: {
|
|
522
|
+
type: 'boolean',
|
|
523
|
+
visual: true,
|
|
524
|
+
default: false
|
|
525
|
+
},
|
|
526
|
+
error: {
|
|
527
|
+
type: 'string',
|
|
528
|
+
visual: true,
|
|
529
|
+
default: ''
|
|
530
|
+
},
|
|
531
|
+
size: {
|
|
532
|
+
type: 'string',
|
|
533
|
+
visual: true,
|
|
534
|
+
default: 'md',
|
|
535
|
+
validate: (v) => ['xs', 'sm', 'md', 'lg', 'xl'].includes(v),
|
|
536
|
+
coerce: (v) => {
|
|
537
|
+
if (!['xs', 'sm', 'md', 'lg', 'xl'].includes(v)) {
|
|
538
|
+
console.warn(`[ty-textarea] Invalid size '${v}'. Using 'md'.`);
|
|
539
|
+
return 'md';
|
|
540
|
+
}
|
|
541
|
+
return v;
|
|
542
|
+
}
|
|
543
|
+
},
|
|
544
|
+
// Layout properties
|
|
545
|
+
rows: {
|
|
546
|
+
type: 'string',
|
|
547
|
+
visual: true,
|
|
548
|
+
default: '3',
|
|
549
|
+
coerce: (v) => String(v)
|
|
550
|
+
},
|
|
551
|
+
cols: {
|
|
552
|
+
type: 'string',
|
|
553
|
+
visual: true,
|
|
554
|
+
default: '',
|
|
555
|
+
coerce: (v) => v ? String(v) : ''
|
|
556
|
+
},
|
|
557
|
+
resize: {
|
|
558
|
+
type: 'string',
|
|
559
|
+
visual: true,
|
|
560
|
+
default: 'none',
|
|
561
|
+
validate: (v) => ['none', 'both', 'horizontal', 'vertical'].includes(v),
|
|
562
|
+
coerce: (v) => {
|
|
563
|
+
if (!['none', 'both', 'horizontal', 'vertical'].includes(v)) {
|
|
564
|
+
console.warn(`[ty-textarea] Invalid resize '${v}'. Using 'none'.`);
|
|
565
|
+
return 'none';
|
|
566
|
+
}
|
|
567
|
+
return v;
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
minHeight: {
|
|
571
|
+
type: 'string',
|
|
572
|
+
visual: true,
|
|
573
|
+
default: ''
|
|
574
|
+
},
|
|
575
|
+
maxHeight: {
|
|
576
|
+
type: 'string',
|
|
577
|
+
visual: true,
|
|
578
|
+
default: ''
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
// Register the component
|
|
582
|
+
if (!customElements.get('ty-textarea')) {
|
|
583
|
+
customElements.define('ty-textarea', TyTextarea);
|
|
584
|
+
}
|
|
585
|
+
//# sourceMappingURL=textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../src/components/textarea.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAA;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAErE;;GAEG;AACH,MAAM,aAAa,GAAG,iUAAiU,CAAA;AAsDvV,MAAM,OAAO,UAAW,SAAQ,WAA0B;IA4GxD;QACE,KAAK,EAAE,CAAA,CAAE,2DAA2D;QAdtE,+EAA+E;QAC/E,kDAAkD;QAClD,sDAAsD;QACtD,+EAA+E;QAE/E,yBAAyB;QACjB,gBAAW,GAA+B,IAAI,CAAA;QAC9C,aAAQ,GAA0B,IAAI,CAAA;QACtC,eAAU,GAA2B,IA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M,EAAE,IAAI;QACZ,OAAO,EAAE,EAAE;KACZ;IACD,SAAS,EAAE;QACT,IAAI,EAAE,QAAiB;QACvB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,EAAE;KACZ;CACF,AAvF0B,CAuF1B;AAogBH,yBAAyB;AACzB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;IACvC,cAAc,CAAC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;AAClD,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip Component
|
|
3
|
+
*
|
|
4
|
+
* Shows helpful content on hover/focus with smart positioning.
|
|
5
|
+
* Follows the same shadow DOM pattern as other components.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <ty-tooltip placement="top" flavor="primary" delay="600">
|
|
9
|
+
* Helpful tooltip text
|
|
10
|
+
* </ty-tooltip>
|
|
11
|
+
*/
|
|
12
|
+
import { type Placement } from '../utils/positioning.js';
|
|
13
|
+
/**
|
|
14
|
+
* Valid tooltip flavors (semantic colors)
|
|
15
|
+
*/
|
|
16
|
+
export type TooltipFlavor = 'dark' | 'light' | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'neutral';
|
|
17
|
+
/**
|
|
18
|
+
* Tooltip attributes configuration
|
|
19
|
+
*/
|
|
20
|
+
export interface TooltipAttributes {
|
|
21
|
+
placement: Placement;
|
|
22
|
+
offset: number;
|
|
23
|
+
delay: number;
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
flavor: TooltipFlavor;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* TyTooltip Web Component
|
|
29
|
+
*/
|
|
30
|
+
export declare class TyTooltip extends HTMLElement {
|
|
31
|
+
/** Internal open state */
|
|
32
|
+
_open: boolean;
|
|
33
|
+
/** Observed attributes */
|
|
34
|
+
static get observedAttributes(): string[];
|
|
35
|
+
constructor();
|
|
36
|
+
connectedCallback(): void;
|
|
37
|
+
disconnectedCallback(): void;
|
|
38
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/components/tooltip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAA0C,KAAK,SAAS,EAAkB,MAAM,yBAAyB,CAAC;AAQjH;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,OAAO,GACP,SAAS,GACT,WAAW,GACX,SAAS,GACT,QAAQ,GACR,SAAS,GACT,MAAM,GACN,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;CACvB;AA2bD;;GAEG;AACH,qBAAa,SAAU,SAAQ,WAAW;IACxC,0BAA0B;IAC1B,KAAK,UAAS;IAEd,0BAA0B;IAC1B,MAAM,KAAK,kBAAkB,aAE5B;;IAOD,iBAAiB;IAWjB,oBAAoB;IAIpB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;CAezF"}
|