tyrell-components 1.0.0-RC13 → 1.0.0-RC14
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/README.md +1 -1
- package/css/tyrell-theme.css +167 -178
- package/css/tyrell.css +19 -0
- package/dist/tyrell-theme.css +167 -178
- package/dist/tyrell.css +19 -0
- package/dist/tyrell.js +1 -1
- package/lib/base/ty-component.d.ts +20 -10
- package/lib/base/ty-component.js +21 -144
- package/lib/components/button.d.ts +2 -16
- package/lib/components/button.js +0 -36
- package/lib/components/calendar-month.d.ts +2 -48
- package/lib/components/calendar-month.js +4 -166
- package/lib/components/calendar-navigation.d.ts +3 -48
- package/lib/components/calendar-navigation.js +3 -126
- package/lib/components/calendar.d.ts +3 -80
- package/lib/components/calendar.js +8 -230
- package/lib/components/checkbox.d.ts +4 -71
- package/lib/components/checkbox.js +7 -151
- package/lib/components/copy.d.ts +3 -56
- package/lib/components/copy.js +1 -120
- package/lib/components/date-picker.d.ts +13 -162
- package/lib/components/date-picker.js +41 -592
- package/lib/components/file-upload.d.ts +9 -15
- package/lib/components/file-upload.js +19 -41
- package/lib/components/icon.d.ts +3 -24
- package/lib/components/icon.js +1 -90
- package/lib/components/input.d.ts +7 -107
- package/lib/components/input.js +5 -193
- package/lib/components/modal.d.ts +17 -26
- package/lib/components/modal.js +57 -201
- package/lib/components/option.d.ts +2 -9
- package/lib/components/option.js +0 -48
- package/lib/components/popup.d.ts +2 -17
- package/lib/components/popup.js +8 -139
- package/lib/components/radio.d.ts +3 -23
- package/lib/components/radio.js +10 -65
- package/lib/components/resize-observer.d.ts +3 -30
- package/lib/components/resize-observer.js +12 -46
- package/lib/components/scroll-container.d.ts +2 -12
- package/lib/components/scroll-container.js +3 -46
- package/lib/components/select.d.ts +22 -153
- package/lib/components/select.js +33 -590
- package/lib/components/selected-tags.d.ts +4 -47
- package/lib/components/selected-tags.js +1 -95
- package/lib/components/step.d.ts +1 -6
- package/lib/components/step.js +0 -6
- package/lib/components/switch.d.ts +0 -11
- package/lib/components/switch.js +2 -36
- package/lib/components/tab.d.ts +1 -6
- package/lib/components/tab.js +0 -7
- package/lib/components/tabs.d.ts +5 -63
- package/lib/components/tabs.js +20 -283
- package/lib/components/tag.d.ts +2 -36
- package/lib/components/tag.js +5 -105
- package/lib/components/textarea.d.ts +6 -86
- package/lib/components/textarea.js +2 -173
- package/lib/components/tooltip.d.ts +3 -11
- package/lib/components/tooltip.js +24 -160
- package/lib/components/wizard.d.ts +6 -54
- package/lib/components/wizard.js +15 -228
- package/lib/icons/fontawesome/brands.d.ts +0 -1
- package/lib/icons/fontawesome/brands.js +0 -8
- package/lib/icons/fontawesome/regular.d.ts +0 -1
- package/lib/icons/fontawesome/regular.js +0 -8
- package/lib/icons/fontawesome/solid.d.ts +0 -1
- package/lib/icons/fontawesome/solid.js +0 -8
- package/lib/icons/heroicons/micro.d.ts +0 -1
- package/lib/icons/heroicons/micro.js +0 -8
- package/lib/icons/heroicons/mini.d.ts +0 -1
- package/lib/icons/heroicons/mini.js +0 -8
- package/lib/icons/heroicons/outline.d.ts +0 -1
- package/lib/icons/heroicons/outline.js +0 -8
- package/lib/icons/heroicons/solid.d.ts +0 -1
- package/lib/icons/heroicons/solid.js +0 -8
- package/lib/icons/lucide.d.ts +0 -1
- package/lib/icons/lucide.js +0 -1872
- package/lib/icons/material/filled.d.ts +0 -1
- package/lib/icons/material/filled.js +0 -10
- package/lib/icons/material/outlined.d.ts +0 -1
- package/lib/icons/material/outlined.js +0 -10
- package/lib/icons/material/round.d.ts +0 -1
- package/lib/icons/material/round.js +0 -10
- package/lib/icons/material/sharp.d.ts +0 -1
- package/lib/icons/material/sharp.js +0 -10
- package/lib/icons/material/two-tone.d.ts +0 -1
- package/lib/icons/material/two-tone.js +0 -10
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -20
- package/lib/styles/button.d.ts +2 -20
- package/lib/styles/button.js +22 -122
- package/lib/styles/calendar-month.d.ts +1 -5
- package/lib/styles/calendar-month.js +4 -61
- package/lib/styles/calendar-navigation.d.ts +2 -6
- package/lib/styles/calendar-navigation.js +2 -27
- package/lib/styles/calendar.d.ts +1 -2
- package/lib/styles/calendar.js +1 -14
- package/lib/styles/checkbox.d.ts +0 -1
- package/lib/styles/checkbox.js +1 -23
- package/lib/styles/copy.d.ts +0 -1
- package/lib/styles/copy.js +2 -17
- package/lib/styles/custom-scrollbar.d.ts +1 -2
- package/lib/styles/custom-scrollbar.js +3 -18
- package/lib/styles/date-picker.d.ts +1 -5
- package/lib/styles/date-picker.js +35 -39
- package/lib/styles/file-upload.d.ts +1 -2
- package/lib/styles/file-upload.js +1 -16
- package/lib/styles/icon.d.ts +2 -6
- package/lib/styles/icon.js +7 -21
- package/lib/styles/input.d.ts +1 -6
- package/lib/styles/input.js +5 -54
- package/lib/styles/modal.d.ts +1 -2
- package/lib/styles/modal.js +21 -23
- package/lib/styles/option.d.ts +2 -6
- package/lib/styles/option.js +17 -12
- package/lib/styles/popup.d.ts +1 -2
- package/lib/styles/popup.js +26 -30
- package/lib/styles/radio.d.ts +0 -1
- package/lib/styles/radio.js +2 -16
- package/lib/styles/resize-observer.d.ts +1 -2
- package/lib/styles/resize-observer.js +0 -7
- package/lib/styles/scroll-container.d.ts +1 -2
- package/lib/styles/scroll-container.js +0 -19
- package/lib/styles/select-base.d.ts +0 -1
- package/lib/styles/select-base.js +68 -79
- package/lib/styles/select.d.ts +1 -2
- package/lib/styles/select.js +7 -15
- package/lib/styles/step.d.ts +1 -2
- package/lib/styles/step.js +0 -4
- package/lib/styles/switch.d.ts +0 -1
- package/lib/styles/switch.js +2 -20
- package/lib/styles/tab.d.ts +1 -2
- package/lib/styles/tab.js +0 -5
- package/lib/styles/tabs.d.ts +3 -11
- package/lib/styles/tabs.js +10 -48
- package/lib/styles/tag.d.ts +1 -5
- package/lib/styles/tag.js +2 -31
- package/lib/styles/textarea.d.ts +1 -2
- package/lib/styles/textarea.js +2 -45
- package/lib/styles/tooltip.d.ts +0 -1
- package/lib/styles/tooltip.js +0 -10
- package/lib/styles/wizard.d.ts +5 -21
- package/lib/styles/wizard.js +8 -88
- package/lib/types/common.d.ts +0 -2
- package/lib/types/common.js +0 -12
- package/lib/utils/calendar-utils.d.ts +4 -21
- package/lib/utils/calendar-utils.js +4 -177
- package/lib/utils/custom-scrollbar.d.ts +6 -20
- package/lib/utils/custom-scrollbar.js +1 -45
- package/lib/utils/flavor-sheet.d.ts +0 -1
- package/lib/utils/flavor-sheet.js +0 -23
- package/lib/utils/icon-registry.d.ts +0 -2
- package/lib/utils/icon-registry.js +1 -107
- package/lib/utils/icons.d.ts +0 -1
- package/lib/utils/icons.js +0 -9
- package/lib/utils/loader-registry.d.ts +0 -1
- package/lib/utils/loader-registry.js +0 -32
- package/lib/utils/locale.d.ts +2 -23
- package/lib/utils/locale.js +0 -86
- package/lib/utils/mobile.d.ts +0 -1
- package/lib/utils/mobile.js +0 -17
- package/lib/utils/number-format.d.ts +6 -3
- package/lib/utils/number-format.js +11 -67
- package/lib/utils/positioning.d.ts +50 -7
- package/lib/utils/positioning.js +52 -62
- package/lib/utils/property-capture.d.ts +5 -27
- package/lib/utils/property-capture.js +0 -108
- package/lib/utils/property-manager.d.ts +0 -1
- package/lib/utils/property-manager.js +0 -70
- package/lib/utils/resize-observer.d.ts +0 -1
- package/lib/utils/resize-observer.js +0 -36
- package/lib/utils/scroll-lock.d.ts +4 -11
- package/lib/utils/scroll-lock.js +0 -107
- package/lib/utils/styles.d.ts +0 -1
- package/lib/utils/styles.js +0 -24
- package/lib/version.d.ts +1 -2
- package/lib/version.js +1 -11
- package/package.json +2 -2
- package/lib/base/ty-component.d.ts.map +0 -1
- package/lib/base/ty-component.js.map +0 -1
- package/lib/components/button.d.ts.map +0 -1
- package/lib/components/button.js.map +0 -1
- package/lib/components/calendar-month.d.ts.map +0 -1
- package/lib/components/calendar-month.js.map +0 -1
- package/lib/components/calendar-navigation.d.ts.map +0 -1
- package/lib/components/calendar-navigation.js.map +0 -1
- package/lib/components/calendar.d.ts.map +0 -1
- package/lib/components/calendar.js.map +0 -1
- package/lib/components/checkbox.d.ts.map +0 -1
- package/lib/components/checkbox.js.map +0 -1
- package/lib/components/copy.d.ts.map +0 -1
- package/lib/components/copy.js.map +0 -1
- package/lib/components/date-picker.d.ts.map +0 -1
- package/lib/components/date-picker.js.map +0 -1
- package/lib/components/file-upload.d.ts.map +0 -1
- package/lib/components/file-upload.js.map +0 -1
- package/lib/components/icon.d.ts.map +0 -1
- package/lib/components/icon.js.map +0 -1
- package/lib/components/input.d.ts.map +0 -1
- package/lib/components/input.js.map +0 -1
- package/lib/components/modal.d.ts.map +0 -1
- package/lib/components/modal.js.map +0 -1
- package/lib/components/option.d.ts.map +0 -1
- package/lib/components/option.js.map +0 -1
- package/lib/components/popup.d.ts.map +0 -1
- package/lib/components/popup.js.map +0 -1
- package/lib/components/radio.d.ts.map +0 -1
- package/lib/components/radio.js.map +0 -1
- package/lib/components/resize-observer.d.ts.map +0 -1
- package/lib/components/resize-observer.js.map +0 -1
- package/lib/components/scroll-container.d.ts.map +0 -1
- package/lib/components/scroll-container.js.map +0 -1
- package/lib/components/select.d.ts.map +0 -1
- package/lib/components/select.js.map +0 -1
- package/lib/components/selected-tags.d.ts.map +0 -1
- package/lib/components/selected-tags.js.map +0 -1
- package/lib/components/step.d.ts.map +0 -1
- package/lib/components/step.js.map +0 -1
- package/lib/components/switch.d.ts.map +0 -1
- package/lib/components/switch.js.map +0 -1
- package/lib/components/tab.d.ts.map +0 -1
- package/lib/components/tab.js.map +0 -1
- package/lib/components/tabs.d.ts.map +0 -1
- package/lib/components/tabs.js.map +0 -1
- package/lib/components/tag.d.ts.map +0 -1
- package/lib/components/tag.js.map +0 -1
- package/lib/components/textarea.d.ts.map +0 -1
- package/lib/components/textarea.js.map +0 -1
- package/lib/components/tooltip.d.ts.map +0 -1
- package/lib/components/tooltip.js.map +0 -1
- package/lib/components/wizard.d.ts.map +0 -1
- package/lib/components/wizard.js.map +0 -1
- package/lib/icons/fontawesome/brands.d.ts.map +0 -1
- package/lib/icons/fontawesome/brands.js.map +0 -1
- package/lib/icons/fontawesome/regular.d.ts.map +0 -1
- package/lib/icons/fontawesome/regular.js.map +0 -1
- package/lib/icons/fontawesome/solid.d.ts.map +0 -1
- package/lib/icons/fontawesome/solid.js.map +0 -1
- package/lib/icons/heroicons/micro.d.ts.map +0 -1
- package/lib/icons/heroicons/micro.js.map +0 -1
- package/lib/icons/heroicons/mini.d.ts.map +0 -1
- package/lib/icons/heroicons/mini.js.map +0 -1
- package/lib/icons/heroicons/outline.d.ts.map +0 -1
- package/lib/icons/heroicons/outline.js.map +0 -1
- package/lib/icons/heroicons/solid.d.ts.map +0 -1
- package/lib/icons/heroicons/solid.js.map +0 -1
- package/lib/icons/lucide.d.ts.map +0 -1
- package/lib/icons/lucide.js.map +0 -1
- package/lib/icons/material/filled.d.ts.map +0 -1
- package/lib/icons/material/filled.js.map +0 -1
- package/lib/icons/material/outlined.d.ts.map +0 -1
- package/lib/icons/material/outlined.js.map +0 -1
- package/lib/icons/material/round.d.ts.map +0 -1
- package/lib/icons/material/round.js.map +0 -1
- package/lib/icons/material/sharp.d.ts.map +0 -1
- package/lib/icons/material/sharp.js.map +0 -1
- package/lib/icons/material/two-tone.d.ts.map +0 -1
- package/lib/icons/material/two-tone.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/styles/button.d.ts.map +0 -1
- package/lib/styles/button.js.map +0 -1
- package/lib/styles/calendar-month.d.ts.map +0 -1
- package/lib/styles/calendar-month.js.map +0 -1
- package/lib/styles/calendar-navigation.d.ts.map +0 -1
- package/lib/styles/calendar-navigation.js.map +0 -1
- package/lib/styles/calendar.d.ts.map +0 -1
- package/lib/styles/calendar.js.map +0 -1
- package/lib/styles/checkbox.d.ts.map +0 -1
- package/lib/styles/checkbox.js.map +0 -1
- package/lib/styles/copy.d.ts.map +0 -1
- package/lib/styles/copy.js.map +0 -1
- package/lib/styles/custom-scrollbar.d.ts.map +0 -1
- package/lib/styles/custom-scrollbar.js.map +0 -1
- package/lib/styles/date-picker.d.ts.map +0 -1
- package/lib/styles/date-picker.js.map +0 -1
- package/lib/styles/file-upload.d.ts.map +0 -1
- package/lib/styles/file-upload.js.map +0 -1
- package/lib/styles/icon.d.ts.map +0 -1
- package/lib/styles/icon.js.map +0 -1
- package/lib/styles/input.d.ts.map +0 -1
- package/lib/styles/input.js.map +0 -1
- package/lib/styles/modal.d.ts.map +0 -1
- package/lib/styles/modal.js.map +0 -1
- package/lib/styles/multiselect.d.ts +0 -8
- package/lib/styles/multiselect.d.ts.map +0 -1
- package/lib/styles/multiselect.js +0 -849
- package/lib/styles/multiselect.js.map +0 -1
- package/lib/styles/option.d.ts.map +0 -1
- package/lib/styles/option.js.map +0 -1
- package/lib/styles/popup.d.ts.map +0 -1
- package/lib/styles/popup.js.map +0 -1
- package/lib/styles/radio.d.ts.map +0 -1
- package/lib/styles/radio.js.map +0 -1
- package/lib/styles/resize-observer.d.ts.map +0 -1
- package/lib/styles/resize-observer.js.map +0 -1
- package/lib/styles/scroll-container.d.ts.map +0 -1
- package/lib/styles/scroll-container.js.map +0 -1
- package/lib/styles/select-base.d.ts.map +0 -1
- package/lib/styles/select-base.js.map +0 -1
- package/lib/styles/select.d.ts.map +0 -1
- package/lib/styles/select.js.map +0 -1
- package/lib/styles/step.d.ts.map +0 -1
- package/lib/styles/step.js.map +0 -1
- package/lib/styles/switch.d.ts.map +0 -1
- package/lib/styles/switch.js.map +0 -1
- package/lib/styles/tab.d.ts.map +0 -1
- package/lib/styles/tab.js.map +0 -1
- package/lib/styles/tabs.d.ts.map +0 -1
- package/lib/styles/tabs.js.map +0 -1
- package/lib/styles/tag.d.ts.map +0 -1
- package/lib/styles/tag.js.map +0 -1
- package/lib/styles/textarea.d.ts.map +0 -1
- package/lib/styles/textarea.js.map +0 -1
- package/lib/styles/tooltip.d.ts.map +0 -1
- package/lib/styles/tooltip.js.map +0 -1
- package/lib/styles/wizard.d.ts.map +0 -1
- package/lib/styles/wizard.js.map +0 -1
- package/lib/types/common.d.ts.map +0 -1
- package/lib/types/common.js.map +0 -1
- package/lib/utils/calendar-utils.d.ts.map +0 -1
- package/lib/utils/calendar-utils.js.map +0 -1
- package/lib/utils/custom-scrollbar.d.ts.map +0 -1
- package/lib/utils/custom-scrollbar.js.map +0 -1
- package/lib/utils/flavor-sheet.d.ts.map +0 -1
- package/lib/utils/flavor-sheet.js.map +0 -1
- package/lib/utils/icon-registry.d.ts.map +0 -1
- package/lib/utils/icon-registry.js.map +0 -1
- package/lib/utils/icons.d.ts.map +0 -1
- package/lib/utils/icons.js.map +0 -1
- package/lib/utils/loader-registry.d.ts.map +0 -1
- package/lib/utils/loader-registry.js.map +0 -1
- package/lib/utils/locale.d.ts.map +0 -1
- package/lib/utils/locale.js.map +0 -1
- package/lib/utils/mobile.d.ts.map +0 -1
- package/lib/utils/mobile.js.map +0 -1
- package/lib/utils/number-format.d.ts.map +0 -1
- package/lib/utils/number-format.js.map +0 -1
- package/lib/utils/parse-boolean.d.ts +0 -39
- package/lib/utils/parse-boolean.d.ts.map +0 -1
- package/lib/utils/parse-boolean.js +0 -58
- package/lib/utils/parse-boolean.js.map +0 -1
- package/lib/utils/positioning.d.ts.map +0 -1
- package/lib/utils/positioning.js.map +0 -1
- package/lib/utils/property-capture.d.ts.map +0 -1
- package/lib/utils/property-capture.js.map +0 -1
- package/lib/utils/property-manager.d.ts.map +0 -1
- package/lib/utils/property-manager.js.map +0 -1
- package/lib/utils/resize-observer.d.ts.map +0 -1
- package/lib/utils/resize-observer.js.map +0 -1
- package/lib/utils/scroll-lock.d.ts.map +0 -1
- package/lib/utils/scroll-lock.js.map +0 -1
- package/lib/utils/styles.d.ts.map +0 -1
- package/lib/utils/styles.js.map +0 -1
- package/lib/version.d.ts.map +0 -1
- package/lib/version.js.map +0 -1
package/lib/components/tag.d.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TyTag Web Component
|
|
3
|
-
* PORTED FROM: clj/ty/components/tag.cljs
|
|
4
|
-
* Tag component with slots and semantic flavors
|
|
2
|
+
* TyTag Web Component — tag/chip with slots and semantic flavors.
|
|
5
3
|
*/
|
|
6
4
|
import type { Flavor, Size, TyTagElement } from "../types/common.js";
|
|
7
5
|
import { TyComponent } from "../base/ty-component.js";
|
|
8
6
|
import type { PropertyChange } from "../utils/property-manager.js";
|
|
9
|
-
/**
|
|
10
|
-
* Component internal state (for typing TyComponent)
|
|
11
|
-
*/
|
|
12
7
|
interface TagState {
|
|
13
8
|
flavor: Flavor;
|
|
14
9
|
size: Size;
|
|
@@ -82,11 +77,7 @@ export declare class TyTag extends TyComponent<TagState> implements TyTagElement
|
|
|
82
77
|
private _cleanup;
|
|
83
78
|
private _customFlavorSheet;
|
|
84
79
|
constructor();
|
|
85
|
-
/**
|
|
86
|
-
* Called when component connects to DOM
|
|
87
|
-
* TyComponent already handled pre-connection property capture
|
|
88
|
-
* TyComponent will call render() automatically after this hook
|
|
89
|
-
*/
|
|
80
|
+
/** TyComponent calls render() automatically after this hook. */
|
|
90
81
|
protected onConnect(): void;
|
|
91
82
|
/**
|
|
92
83
|
* Custom (non-built-in) flavors: generate the same --tag-* wiring the
|
|
@@ -95,41 +86,17 @@ export declare class TyTag extends TyComponent<TagState> implements TyTagElement
|
|
|
95
86
|
* for why this is an adopted sheet and how page-level overrides survive.
|
|
96
87
|
*/
|
|
97
88
|
private _syncCustomFlavor;
|
|
98
|
-
/**
|
|
99
|
-
* Called when component disconnects from DOM
|
|
100
|
-
*/
|
|
101
89
|
protected onDisconnect(): void;
|
|
102
90
|
/**
|
|
103
91
|
* Handle property changes - called BEFORE render
|
|
104
92
|
*/
|
|
105
93
|
protected onPropertiesChanged(changes: PropertyChange[]): void;
|
|
106
|
-
/**
|
|
107
|
-
* Handle tag click events
|
|
108
|
-
*/
|
|
109
94
|
private handleClick;
|
|
110
|
-
/**
|
|
111
|
-
* Handle tag dismiss events
|
|
112
|
-
*/
|
|
113
95
|
private handleDismiss;
|
|
114
|
-
/**
|
|
115
|
-
* Handle keyboard interactions
|
|
116
|
-
*/
|
|
117
96
|
private handleKeydown;
|
|
118
|
-
/**
|
|
119
|
-
* Dispatch custom tag events
|
|
120
|
-
*/
|
|
121
97
|
private dispatchTagEvent;
|
|
122
|
-
/**
|
|
123
|
-
* Clean up existing event listeners
|
|
124
|
-
*/
|
|
125
98
|
private cleanupEventListeners;
|
|
126
|
-
/**
|
|
127
|
-
* Setup event listeners for tag interactions
|
|
128
|
-
*/
|
|
129
99
|
private setupEventListeners;
|
|
130
|
-
/**
|
|
131
|
-
* Render the tag component
|
|
132
|
-
*/
|
|
133
100
|
protected render(): void;
|
|
134
101
|
get flavor(): Flavor;
|
|
135
102
|
set flavor(value: Flavor);
|
|
@@ -149,4 +116,3 @@ export declare class TyTag extends TyComponent<TagState> implements TyTagElement
|
|
|
149
116
|
set disabled(value: boolean);
|
|
150
117
|
}
|
|
151
118
|
export {};
|
|
152
|
-
//# sourceMappingURL=tag.d.ts.map
|
package/lib/components/tag.js
CHANGED
|
@@ -1,41 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TyTag Web Component
|
|
3
|
-
* PORTED FROM: clj/ty/components/tag.cljs
|
|
4
|
-
* Tag component with slots and semantic flavors
|
|
5
|
-
*/
|
|
6
1
|
import { syncCustomFlavorSheet } from "../utils/flavor-sheet.js";
|
|
7
2
|
import { TyComponent } from "../base/ty-component.js";
|
|
8
3
|
import { ensureStyles } from "../utils/styles.js";
|
|
9
4
|
import { tagStyles } from "../styles/tag.js";
|
|
10
|
-
/**
|
|
11
|
-
* Ty Tag Component
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```html
|
|
15
|
-
* <ty-tag flavor="primary">Primary Tag</ty-tag>
|
|
16
|
-
* <ty-tag flavor="success" dismissible>Success Tag</ty-tag>
|
|
17
|
-
* <ty-tag flavor="danger" clickable>Clickable Tag</ty-tag>
|
|
18
|
-
* <ty-tag value="tag-1" selected>Selected Tag</ty-tag>
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
5
|
export class TyTag extends TyComponent {
|
|
22
6
|
constructor() {
|
|
23
|
-
super();
|
|
24
|
-
// ============================================================================
|
|
25
|
-
// INTERNAL STATE
|
|
26
|
-
// ============================================================================
|
|
27
|
-
// Event listener cleanup function
|
|
7
|
+
super();
|
|
28
8
|
this._cleanup = null;
|
|
29
|
-
// Adopted sheet holding generated rules for a custom (non-built-in) flavor.
|
|
30
|
-
// Must be an adopted sheet, not a <style> element — render() replaces
|
|
31
|
-
// shadowRoot.innerHTML, which would destroy an injected element.
|
|
32
9
|
this._customFlavorSheet = null;
|
|
33
|
-
// ============================================================================
|
|
34
|
-
// EVENT HANDLERS (arrow functions for stable references)
|
|
35
|
-
// ============================================================================
|
|
36
|
-
/**
|
|
37
|
-
* Handle tag click events
|
|
38
|
-
*/
|
|
39
10
|
this.handleClick = (event) => {
|
|
40
11
|
if (this.clickable && !this.disabled) {
|
|
41
12
|
event.preventDefault();
|
|
@@ -44,9 +15,6 @@ export class TyTag extends TyComponent {
|
|
|
44
15
|
this.dispatchTagEvent("pointerdown", { target: this });
|
|
45
16
|
}
|
|
46
17
|
};
|
|
47
|
-
/**
|
|
48
|
-
* Handle tag dismiss events
|
|
49
|
-
*/
|
|
50
18
|
this.handleDismiss = (event) => {
|
|
51
19
|
if (this.dismissible && !this.disabled) {
|
|
52
20
|
event.preventDefault();
|
|
@@ -54,26 +22,21 @@ export class TyTag extends TyComponent {
|
|
|
54
22
|
this.dispatchTagEvent("dismiss", { target: this });
|
|
55
23
|
}
|
|
56
24
|
};
|
|
57
|
-
/**
|
|
58
|
-
* Handle keyboard interactions
|
|
59
|
-
*/
|
|
60
25
|
this.handleKeydown = (event) => {
|
|
61
26
|
const keyboardEvent = event;
|
|
62
27
|
if (this.disabled)
|
|
63
28
|
return;
|
|
64
29
|
const keyCode = keyboardEvent.keyCode;
|
|
65
30
|
switch (keyCode) {
|
|
66
|
-
|
|
67
|
-
case
|
|
68
|
-
case 32: // Space
|
|
31
|
+
case 13:
|
|
32
|
+
case 32:
|
|
69
33
|
if (this.clickable) {
|
|
70
34
|
keyboardEvent.preventDefault();
|
|
71
35
|
this.dispatchTagEvent("click", { target: this });
|
|
72
36
|
}
|
|
73
37
|
break;
|
|
74
|
-
|
|
75
|
-
case
|
|
76
|
-
case 46: // Delete
|
|
38
|
+
case 8:
|
|
39
|
+
case 46:
|
|
77
40
|
if (this.dismissible) {
|
|
78
41
|
keyboardEvent.preventDefault();
|
|
79
42
|
this.dispatchTagEvent("dismiss", { target: this });
|
|
@@ -81,32 +44,14 @@ export class TyTag extends TyComponent {
|
|
|
81
44
|
break;
|
|
82
45
|
}
|
|
83
46
|
};
|
|
84
|
-
// Apply styles to shadow root
|
|
85
47
|
ensureStyles(this.shadowRoot, { css: tagStyles, id: "ty-tag" });
|
|
86
48
|
}
|
|
87
|
-
// observedAttributes auto-generated by TyComponent from properties config
|
|
88
|
-
// ============================================================================
|
|
89
|
-
// TYCOMPONENT LIFECYCLE HOOKS
|
|
90
|
-
// ============================================================================
|
|
91
|
-
/**
|
|
92
|
-
* Called when component connects to DOM
|
|
93
|
-
* TyComponent already handled pre-connection property capture
|
|
94
|
-
* TyComponent will call render() automatically after this hook
|
|
95
|
-
*/
|
|
96
49
|
onConnect() {
|
|
97
50
|
this._syncCustomFlavor();
|
|
98
|
-
// Setup event listeners after initial render happens
|
|
99
|
-
// Use queueMicrotask to ensure render() has been called by TyComponent
|
|
100
51
|
queueMicrotask(() => {
|
|
101
52
|
this.setupEventListeners();
|
|
102
53
|
});
|
|
103
54
|
}
|
|
104
|
-
/**
|
|
105
|
-
* Custom (non-built-in) flavors: generate the same --tag-* wiring the
|
|
106
|
-
* built-in flavors get, pointed at the user's design tokens
|
|
107
|
-
* (--ty-bg-X / --ty-color-X / --ty-border-X). See utils/flavor-sheet.ts
|
|
108
|
-
* for why this is an adopted sheet and how page-level overrides survive.
|
|
109
|
-
*/
|
|
110
55
|
_syncCustomFlavor() {
|
|
111
56
|
this._customFlavorSheet = syncCustomFlavorSheet(this.shadowRoot, this._customFlavorSheet, this.flavor, ({ flavor, base, shade }) => {
|
|
112
57
|
const bg = shade === "+" ? `--ty-bg-${base}-bold`
|
|
@@ -127,26 +72,14 @@ export class TyTag extends TyComponent {
|
|
|
127
72
|
}`;
|
|
128
73
|
});
|
|
129
74
|
}
|
|
130
|
-
/**
|
|
131
|
-
* Called when component disconnects from DOM
|
|
132
|
-
*/
|
|
133
75
|
onDisconnect() {
|
|
134
76
|
this.cleanupEventListeners();
|
|
135
77
|
}
|
|
136
|
-
/**
|
|
137
|
-
* Handle property changes - called BEFORE render
|
|
138
|
-
*/
|
|
139
78
|
onPropertiesChanged(changes) {
|
|
140
79
|
if (changes.some((c) => c.name === "flavor")) {
|
|
141
80
|
this._syncCustomFlavor();
|
|
142
81
|
}
|
|
143
82
|
}
|
|
144
|
-
// ============================================================================
|
|
145
|
-
// EVENT HELPERS
|
|
146
|
-
// ============================================================================
|
|
147
|
-
/**
|
|
148
|
-
* Dispatch custom tag events
|
|
149
|
-
*/
|
|
150
83
|
dispatchTagEvent(eventType, detail) {
|
|
151
84
|
this.dispatchEvent(new CustomEvent(eventType, {
|
|
152
85
|
detail,
|
|
@@ -155,34 +88,24 @@ export class TyTag extends TyComponent {
|
|
|
155
88
|
cancelable: true,
|
|
156
89
|
}));
|
|
157
90
|
}
|
|
158
|
-
/**
|
|
159
|
-
* Clean up existing event listeners
|
|
160
|
-
*/
|
|
161
91
|
cleanupEventListeners() {
|
|
162
92
|
if (this._cleanup) {
|
|
163
93
|
this._cleanup();
|
|
164
94
|
this._cleanup = null;
|
|
165
95
|
}
|
|
166
96
|
}
|
|
167
|
-
/**
|
|
168
|
-
* Setup event listeners for tag interactions
|
|
169
|
-
*/
|
|
170
97
|
setupEventListeners() {
|
|
171
|
-
// Clean up any existing listeners first
|
|
172
98
|
this.cleanupEventListeners();
|
|
173
99
|
const shadow = this.shadowRoot;
|
|
174
100
|
const container = shadow.querySelector(".tag-container");
|
|
175
101
|
const dismissBtn = shadow.querySelector(".tag-dismiss");
|
|
176
102
|
if (!container)
|
|
177
103
|
return;
|
|
178
|
-
// Click handler for main tag
|
|
179
104
|
container.addEventListener("click", this.handleClick);
|
|
180
105
|
container.addEventListener("keydown", this.handleKeydown);
|
|
181
|
-
// Dismiss button handler
|
|
182
106
|
if (dismissBtn) {
|
|
183
107
|
dismissBtn.addEventListener("click", this.handleDismiss);
|
|
184
108
|
}
|
|
185
|
-
// Store cleanup function
|
|
186
109
|
this._cleanup = () => {
|
|
187
110
|
container.removeEventListener("click", this.handleClick);
|
|
188
111
|
container.removeEventListener("keydown", this.handleKeydown);
|
|
@@ -191,19 +114,11 @@ export class TyTag extends TyComponent {
|
|
|
191
114
|
}
|
|
192
115
|
};
|
|
193
116
|
}
|
|
194
|
-
// ============================================================================
|
|
195
|
-
// RENDER
|
|
196
|
-
// ============================================================================
|
|
197
|
-
/**
|
|
198
|
-
* Render the tag component
|
|
199
|
-
*/
|
|
200
117
|
render() {
|
|
201
118
|
const shadow = this.shadowRoot;
|
|
202
|
-
// Build the tag container
|
|
203
119
|
const tabindex = this.clickable ? ' tabindex="0"' : "";
|
|
204
120
|
const ariaDisabled = this.disabled ? ' aria-disabled="true"' : "";
|
|
205
121
|
const dataValue = this.value ? ` data-value="${this.value}"` : "";
|
|
206
|
-
// Build dismiss button SVG
|
|
207
122
|
const dismissButton = this.dismissible
|
|
208
123
|
? `
|
|
209
124
|
<button class="tag-dismiss" type="button" aria-label="Remove tag">
|
|
@@ -227,14 +142,10 @@ export class TyTag extends TyComponent {
|
|
|
227
142
|
</div>
|
|
228
143
|
</div>
|
|
229
144
|
`;
|
|
230
|
-
// Re-setup event listeners after innerHTML replace (destroys old elements)
|
|
231
145
|
if (this._connected) {
|
|
232
146
|
this.setupEventListeners();
|
|
233
147
|
}
|
|
234
148
|
}
|
|
235
|
-
// ============================================================================
|
|
236
|
-
// PROPERTY ACCESSORS - Simple wrappers (no logic!)
|
|
237
|
-
// ============================================================================
|
|
238
149
|
get flavor() {
|
|
239
150
|
return this.getProperty("flavor");
|
|
240
151
|
}
|
|
@@ -285,20 +196,11 @@ export class TyTag extends TyComponent {
|
|
|
285
196
|
}
|
|
286
197
|
}
|
|
287
198
|
TyTag.formAssociated = true;
|
|
288
|
-
// ============================================================================
|
|
289
|
-
// PROPERTY CONFIGURATION - Declarative property lifecycle
|
|
290
|
-
// ============================================================================
|
|
291
199
|
TyTag.properties = {
|
|
292
200
|
flavor: {
|
|
293
201
|
type: "string",
|
|
294
202
|
visual: true,
|
|
295
203
|
default: "neutral",
|
|
296
|
-
// Built-in: primary | success | danger | warning | neutral.
|
|
297
|
-
// Append `+` for stronger or `-` for softer shade (e.g. "primary+",
|
|
298
|
-
// "danger-"). Any other string is a custom flavor: if you define the
|
|
299
|
-
// design tokens (--ty-bg-X, --ty-color-X, --ty-border-X) it just works
|
|
300
|
-
// (see _syncCustomFlavor), and ty-tag[flavor="X"] { --tag-bg: ...; }
|
|
301
|
-
// rules in the page still override.
|
|
302
204
|
},
|
|
303
205
|
size: {
|
|
304
206
|
type: "string",
|
|
@@ -345,8 +247,6 @@ TyTag.properties = {
|
|
|
345
247
|
default: false,
|
|
346
248
|
},
|
|
347
249
|
};
|
|
348
|
-
// Register the custom element
|
|
349
250
|
if (!customElements.get("ty-tag")) {
|
|
350
251
|
customElements.define("ty-tag", TyTag);
|
|
351
252
|
}
|
|
352
|
-
//# sourceMappingURL=tag.js.map
|
|
@@ -1,48 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ty-textarea -
|
|
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
|
-
* ```
|
|
2
|
+
* ty-textarea — form-associated textarea that auto-resizes to its content,
|
|
3
|
+
* within optional min-height/max-height constraints.
|
|
36
4
|
*
|
|
37
5
|
* @fires {CustomEvent<{value: string, originalEvent: Event}>} input - Emitted on input
|
|
38
6
|
* @fires {CustomEvent<{value: string, originalEvent: Event}>} change - Emitted on change
|
|
39
7
|
*/
|
|
40
8
|
import { TyComponent } from '../base/ty-component.js';
|
|
41
9
|
import type { PropertyChange } from '../utils/property-manager.js';
|
|
42
|
-
/**
|
|
43
|
-
* Component internal state (for typing TyComponent)
|
|
44
|
-
* Actual state stored as private fields
|
|
45
|
-
*/
|
|
10
|
+
/** For typing TyComponent only — actual state lives in private fields. */
|
|
46
11
|
interface TextareaState {
|
|
47
12
|
value: string;
|
|
48
13
|
isFocused: boolean;
|
|
@@ -145,23 +110,10 @@ export declare class TyTextarea extends TyComponent<TextareaState> implements Ty
|
|
|
145
110
|
private _scrollbar;
|
|
146
111
|
private _isFocused;
|
|
147
112
|
constructor();
|
|
148
|
-
/**
|
|
149
|
-
* Called when component connects to DOM
|
|
150
|
-
* TyComponent already handled pre-connection property capture
|
|
151
|
-
*/
|
|
152
113
|
protected onConnect(): void;
|
|
153
|
-
/**
|
|
154
|
-
* Called when component disconnects from DOM
|
|
155
|
-
*/
|
|
156
114
|
protected onDisconnect(): void;
|
|
157
|
-
/**
|
|
158
|
-
* Handle property changes - called BEFORE render
|
|
159
|
-
* This replaces the old attributeChangedCallback logic
|
|
160
|
-
*/
|
|
115
|
+
/** Called BEFORE render. Visual property changes re-render automatically. */
|
|
161
116
|
protected onPropertiesChanged(changes: PropertyChange[]): void;
|
|
162
|
-
/**
|
|
163
|
-
* Override form value to return current value
|
|
164
|
-
*/
|
|
165
117
|
protected getFormValue(): FormDataEntryValue | null;
|
|
166
118
|
get value(): string;
|
|
167
119
|
set value(v: string);
|
|
@@ -189,51 +141,20 @@ export declare class TyTextarea extends TyComponent<TextareaState> implements Ty
|
|
|
189
141
|
set minHeight(v: string);
|
|
190
142
|
get maxHeight(): string;
|
|
191
143
|
set maxHeight(v: string);
|
|
192
|
-
/**
|
|
193
|
-
* Extract font-related CSS properties from element
|
|
194
|
-
*/
|
|
195
144
|
private getFontStyle;
|
|
196
|
-
/**
|
|
197
|
-
* Extract spacing-related CSS properties from element
|
|
198
|
-
*/
|
|
199
145
|
private getSpacingStyle;
|
|
200
|
-
/**
|
|
201
|
-
* Setup the hidden dummy element for height measurement
|
|
202
|
-
*/
|
|
146
|
+
/** Hidden dummy element used to measure the content height. */
|
|
203
147
|
private setupDummyElement;
|
|
204
|
-
/**
|
|
205
|
-
* Resize textarea based on dummy element content with min/max height constraints
|
|
206
|
-
*/
|
|
148
|
+
/** Resize the textarea to the dummy's measured height, within min/max. */
|
|
207
149
|
private resizeTextarea;
|
|
208
150
|
private _setupScrollbar;
|
|
209
151
|
private _destroyScrollbar;
|
|
210
|
-
/**
|
|
211
|
-
* Emit custom input and change events
|
|
212
|
-
*/
|
|
213
152
|
private emitValueEvents;
|
|
214
|
-
/**
|
|
215
|
-
* Handle textarea input event
|
|
216
|
-
*/
|
|
217
153
|
private handleInputEvent;
|
|
218
|
-
/**
|
|
219
|
-
* Handle textarea focus event
|
|
220
|
-
*/
|
|
221
154
|
private handleFocusEvent;
|
|
222
|
-
/**
|
|
223
|
-
* Handle textarea blur event
|
|
224
|
-
*/
|
|
225
155
|
private handleBlurEvent;
|
|
226
|
-
/**
|
|
227
|
-
* Build class list for textarea element
|
|
228
|
-
*/
|
|
229
156
|
private buildClassList;
|
|
230
|
-
/**
|
|
231
|
-
* Apply min/max height constraints to textarea element
|
|
232
|
-
*/
|
|
233
157
|
private applyHeightConstraints;
|
|
234
|
-
/**
|
|
235
|
-
* Setup event listeners for textarea
|
|
236
|
-
*/
|
|
237
158
|
private setupTextareaEvents;
|
|
238
159
|
protected render(): void;
|
|
239
160
|
/** required + empty => valueMissing; otherwise valid. Disabled fields are
|
|
@@ -241,4 +162,3 @@ export declare class TyTextarea extends TyComponent<TextareaState> implements Ty
|
|
|
241
162
|
private updateValidity;
|
|
242
163
|
}
|
|
243
164
|
export {};
|
|
244
|
-
//# sourceMappingURL=textarea.d.ts.map
|