tyrell-components 1.0.0-TC44 → 1.0.0-TC46
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/dist/tyrell.js +1 -1
- package/lib/base/ty-component.d.ts +12 -7
- package/lib/base/ty-component.js +8 -139
- 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 +10 -160
- package/lib/components/date-picker.js +31 -577
- package/lib/components/file-upload.d.ts +3 -15
- package/lib/components/file-upload.js +0 -37
- 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 +4 -193
- package/lib/components/modal.d.ts +3 -26
- package/lib/components/modal.js +1 -188
- 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 +3 -130
- package/lib/components/radio.d.ts +3 -23
- package/lib/components/radio.js +0 -63
- package/lib/components/resize-observer.d.ts +2 -30
- package/lib/components/resize-observer.js +0 -45
- package/lib/components/scroll-container.d.ts +2 -12
- package/lib/components/scroll-container.js +3 -46
- package/lib/components/select.d.ts +43 -150
- package/lib/components/select.js +68 -558
- package/lib/components/selected-tags.d.ts +4 -47
- package/lib/components/selected-tags.js +0 -94
- 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 +3 -63
- package/lib/components/tabs.js +2 -282
- 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 +0 -154
- package/lib/components/wizard.d.ts +4 -54
- package/lib/components/wizard.js +0 -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 +13 -120
- package/lib/styles/calendar-month.d.ts +1 -5
- package/lib/styles/calendar-month.js +3 -60
- package/lib/styles/calendar-navigation.d.ts +2 -6
- package/lib/styles/calendar-navigation.js +1 -26
- package/lib/styles/calendar.d.ts +1 -2
- package/lib/styles/calendar.js +0 -13
- 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 +5 -35
- package/lib/styles/file-upload.d.ts +1 -2
- package/lib/styles/file-upload.js +0 -15
- package/lib/styles/icon.d.ts +2 -6
- package/lib/styles/icon.js +1 -26
- package/lib/styles/input.d.ts +1 -6
- package/lib/styles/input.js +3 -53
- package/lib/styles/modal.d.ts +1 -2
- package/lib/styles/modal.js +3 -23
- package/lib/styles/option.d.ts +2 -6
- package/lib/styles/option.js +1 -11
- package/lib/styles/popup.d.ts +1 -2
- package/lib/styles/popup.js +4 -25
- package/lib/styles/radio.d.ts +0 -1
- package/lib/styles/radio.js +1 -15
- 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 +9 -70
- package/lib/styles/select.d.ts +1 -2
- package/lib/styles/select.js +50 -18
- 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 +4 -47
- 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 +0 -44
- 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 +5 -85
- 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 +0 -2
- package/lib/utils/number-format.js +2 -65
- package/lib/utils/positioning.d.ts +4 -2
- package/lib/utils/positioning.js +2 -54
- 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
|
@@ -40,13 +40,7 @@ export declare abstract class TyComponent<T = any> extends HTMLElement {
|
|
|
40
40
|
* Sync property value to HTML attribute
|
|
41
41
|
*/
|
|
42
42
|
private _syncPropertyToAttribute;
|
|
43
|
-
/**
|
|
44
|
-
* Convert camelCase to kebab-case
|
|
45
|
-
*/
|
|
46
43
|
private _toKebabCase;
|
|
47
|
-
/**
|
|
48
|
-
* Convert kebab-case to camelCase
|
|
49
|
-
*/
|
|
50
44
|
private _toCamelCase;
|
|
51
45
|
/**
|
|
52
46
|
* Attribute changed callback - unified for all components
|
|
@@ -126,6 +120,18 @@ export declare abstract class TyComponent<T = any> extends HTMLElement {
|
|
|
126
120
|
* the role element as aria-label, giving it an accessible name.
|
|
127
121
|
*/
|
|
128
122
|
protected applyLabelName(roleEl: HTMLElement): void;
|
|
123
|
+
private _handlingActivationClick;
|
|
124
|
+
/**
|
|
125
|
+
* Guard for click-driven toggle handlers (checkbox/switch) on components
|
|
126
|
+
* whose whole host is the click target AND that expect a wrapping
|
|
127
|
+
* <label> to delegate to them. Some browsers still forward a label's own
|
|
128
|
+
* synthetic click to the associated control even when the original click
|
|
129
|
+
* already targeted that control directly, firing 'click' twice for one
|
|
130
|
+
* user gesture. Both arrive synchronously in the same task, so a flag
|
|
131
|
+
* cleared on the next microtask catches only the spurious duplicate —
|
|
132
|
+
* two genuinely separate clicks are always in different tasks.
|
|
133
|
+
*/
|
|
134
|
+
protected isDuplicateActivationClick(): boolean;
|
|
129
135
|
/**
|
|
130
136
|
* Form reset callback - called when form.reset() is invoked
|
|
131
137
|
* Resets component to its default value
|
|
@@ -137,4 +143,3 @@ export declare abstract class TyComponent<T = any> extends HTMLElement {
|
|
|
137
143
|
*/
|
|
138
144
|
protected onFormReset(): void;
|
|
139
145
|
}
|
|
140
|
-
//# sourceMappingURL=ty-component.d.ts.map
|
package/lib/base/ty-component.js
CHANGED
|
@@ -1,44 +1,21 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TyComponent - Base class for all Ty web components
|
|
3
|
-
*
|
|
4
|
-
* Provides unified property/attribute lifecycle management:
|
|
5
|
-
* - Single code path for all property updates
|
|
6
|
-
* - Declarative property configuration
|
|
7
|
-
* - Predictable rendering behavior
|
|
8
|
-
* - Form association support
|
|
9
|
-
* - Property change events via 'prop:change' (separate from user 'change' events)
|
|
10
|
-
*/
|
|
11
1
|
import { PropertyManager } from '../utils/property-manager.js';
|
|
12
|
-
/**
|
|
13
|
-
* Base class for all Ty components with unified property lifecycle
|
|
14
|
-
*/
|
|
15
2
|
export class TyComponent extends HTMLElement {
|
|
16
3
|
constructor() {
|
|
17
4
|
super();
|
|
18
|
-
// Track if component is connected
|
|
19
5
|
this._connected = false;
|
|
20
|
-
// Track if initial render happened
|
|
21
6
|
this._rendered = false;
|
|
22
|
-
|
|
7
|
+
this._handlingActivationClick = false;
|
|
23
8
|
const ctor = this.constructor;
|
|
24
9
|
this.props = new PropertyManager(ctor.properties);
|
|
25
|
-
// Form association
|
|
26
10
|
this._internals = this.attachInternals();
|
|
27
|
-
// Setup shadow DOM (subclasses can override by checking if shadowRoot exists)
|
|
28
11
|
if (!this.shadowRoot) {
|
|
29
12
|
this.attachShadow({ mode: 'open' });
|
|
30
13
|
}
|
|
31
14
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Define which attributes to observe
|
|
34
|
-
* Auto-generated from property configuration
|
|
35
|
-
* Returns kebab-case attribute names (e.g., 'minHeight' -> 'min-height')
|
|
36
|
-
*/
|
|
37
15
|
static get observedAttributes() {
|
|
38
16
|
const attrs = [];
|
|
39
17
|
for (const [name, config] of Object.entries(this.properties)) {
|
|
40
18
|
attrs.push(name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase());
|
|
41
|
-
// Include alias names so attributeChangedCallback fires for them
|
|
42
19
|
if (config.aliases) {
|
|
43
20
|
for (const alias of Object.keys(config.aliases)) {
|
|
44
21
|
attrs.push(alias);
|
|
@@ -47,37 +24,22 @@ export class TyComponent extends HTMLElement {
|
|
|
47
24
|
}
|
|
48
25
|
return attrs;
|
|
49
26
|
}
|
|
50
|
-
/**
|
|
51
|
-
* Unified property setter
|
|
52
|
-
* Use this in your property setters instead of direct field assignment
|
|
53
|
-
*/
|
|
54
27
|
setProperty(name, value) {
|
|
55
28
|
const change = this.props.updateProperty(name, value, 'property');
|
|
56
29
|
if (change) {
|
|
57
|
-
// Sync to attribute (kebab-case)
|
|
58
30
|
this._syncPropertyToAttribute(change);
|
|
59
|
-
// Handle the change through unified lifecycle
|
|
60
31
|
this._handlePropertyChanges([change]);
|
|
61
32
|
}
|
|
62
33
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Unified property getter
|
|
65
|
-
* Use this in your property getters
|
|
66
|
-
*/
|
|
67
34
|
getProperty(name) {
|
|
68
35
|
return this.props.get(name);
|
|
69
36
|
}
|
|
70
|
-
/**
|
|
71
|
-
* Sync property value to HTML attribute
|
|
72
|
-
*/
|
|
73
37
|
_syncPropertyToAttribute(change) {
|
|
74
38
|
const { name, newValue } = change;
|
|
75
39
|
const config = this.props.getConfig(name);
|
|
76
40
|
if (!config)
|
|
77
41
|
return;
|
|
78
|
-
// Convert to kebab-case for attribute
|
|
79
42
|
const attrName = this._toKebabCase(name);
|
|
80
|
-
// Handle different types
|
|
81
43
|
if (config.type === 'boolean') {
|
|
82
44
|
if (newValue) {
|
|
83
45
|
this.setAttribute(attrName, '');
|
|
@@ -96,29 +58,17 @@ export class TyComponent extends HTMLElement {
|
|
|
96
58
|
this.setAttribute(attrName, String(newValue));
|
|
97
59
|
}
|
|
98
60
|
}
|
|
99
|
-
/**
|
|
100
|
-
* Convert camelCase to kebab-case
|
|
101
|
-
*/
|
|
102
61
|
_toKebabCase(str) {
|
|
103
62
|
return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
104
63
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Convert kebab-case to camelCase
|
|
107
|
-
*/
|
|
108
64
|
_toCamelCase(str) {
|
|
109
65
|
return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
110
66
|
}
|
|
111
|
-
/**
|
|
112
|
-
* Attribute changed callback - unified for all components
|
|
113
|
-
*/
|
|
114
67
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
115
68
|
if (oldValue === newValue)
|
|
116
69
|
return;
|
|
117
|
-
// Check if this is an alias (e.g., not-clearable)
|
|
118
70
|
let change = this.props.handleAlias(name, newValue);
|
|
119
71
|
if (!change) {
|
|
120
|
-
// Properties may be registered with kebab-case (e.g., 'display-month')
|
|
121
|
-
// or camelCase. Try the attribute name as-is first, then camelCase.
|
|
122
72
|
const camelName = this._toCamelCase(name);
|
|
123
73
|
const propName = this.props.hasConfig(name) ? name : camelName;
|
|
124
74
|
change = this.props.updateProperty(propName, newValue, 'attribute');
|
|
@@ -127,41 +77,26 @@ export class TyComponent extends HTMLElement {
|
|
|
127
77
|
this._handlePropertyChanges([change]);
|
|
128
78
|
}
|
|
129
79
|
}
|
|
130
|
-
/**
|
|
131
|
-
* Connected callback - handle pre-set properties
|
|
132
|
-
*/
|
|
133
80
|
connectedCallback() {
|
|
134
81
|
this._connected = true;
|
|
135
|
-
// Capture pre-set properties (React/Vue/Reagent pattern)
|
|
136
82
|
const preSetProps = this._capturePreSetProperties();
|
|
137
|
-
// Batch process all pre-set properties
|
|
138
83
|
if (preSetProps.length > 0) {
|
|
139
84
|
this._handlePropertyChanges(preSetProps);
|
|
140
85
|
}
|
|
141
|
-
// Initialize component (subclass hook)
|
|
142
86
|
this.onConnect();
|
|
143
|
-
// Initial render
|
|
144
87
|
if (!this._rendered) {
|
|
145
88
|
this.render();
|
|
146
89
|
this._rendered = true;
|
|
147
90
|
}
|
|
148
91
|
}
|
|
149
|
-
/**
|
|
150
|
-
* Disconnected callback
|
|
151
|
-
*/
|
|
152
92
|
disconnectedCallback() {
|
|
153
93
|
this._connected = false;
|
|
154
94
|
this.onDisconnect();
|
|
155
95
|
}
|
|
156
|
-
/**
|
|
157
|
-
* Capture properties that were set before connectedCallback
|
|
158
|
-
* (React, Vue, Reagent set properties before element is connected)
|
|
159
|
-
*/
|
|
160
96
|
_capturePreSetProperties() {
|
|
161
97
|
const changes = [];
|
|
162
98
|
const ctor = this.constructor;
|
|
163
99
|
for (const propName of Object.keys(ctor.properties)) {
|
|
164
|
-
// Check if property was set on the element before connection
|
|
165
100
|
const descriptor = Object.getOwnPropertyDescriptor(this, propName);
|
|
166
101
|
if (descriptor && descriptor.value !== undefined) {
|
|
167
102
|
const change = this.props.updateProperty(propName, descriptor.value, 'property');
|
|
@@ -172,38 +107,20 @@ export class TyComponent extends HTMLElement {
|
|
|
172
107
|
}
|
|
173
108
|
return changes;
|
|
174
109
|
}
|
|
175
|
-
/**
|
|
176
|
-
* THE CORE LIFECYCLE METHOD
|
|
177
|
-
* All property changes flow through here
|
|
178
|
-
*
|
|
179
|
-
* Lifecycle order:
|
|
180
|
-
* 1. Update internal state (onPropertiesChanged hook)
|
|
181
|
-
* 2. Sync form value (if formValue property changed)
|
|
182
|
-
* 3. Render (if visual property changed)
|
|
183
|
-
* 4. Emit events (if emitChange property changed)
|
|
184
|
-
*/
|
|
185
110
|
_handlePropertyChanges(changes) {
|
|
186
111
|
if (changes.length === 0)
|
|
187
112
|
return;
|
|
188
|
-
// 1. Update internal state (subclass-specific)
|
|
189
113
|
this.onPropertiesChanged(changes);
|
|
190
|
-
// 2. Sync form value if needed
|
|
191
114
|
const formValueChanged = changes.some(c => this.props.isFormValue(c.name));
|
|
192
115
|
if (formValueChanged) {
|
|
193
116
|
this.updateFormValue();
|
|
194
117
|
}
|
|
195
|
-
// 3. Render only if visual properties changed AND component is connected
|
|
196
118
|
const visualChanged = changes.some(c => this.props.isVisual(c.name));
|
|
197
119
|
if (visualChanged && this._connected) {
|
|
198
120
|
this.render();
|
|
199
121
|
}
|
|
200
|
-
// 4. Emit change events if configured
|
|
201
122
|
this._emitChangeEvents(changes);
|
|
202
123
|
}
|
|
203
|
-
/**
|
|
204
|
-
* Emit property change events for properties that require it
|
|
205
|
-
* Uses 'prop:change' event to avoid conflicts with user interaction 'change' events
|
|
206
|
-
*/
|
|
207
124
|
_emitChangeEvents(changes) {
|
|
208
125
|
for (const change of changes) {
|
|
209
126
|
if (this.props.shouldEmitChange(change.name)) {
|
|
@@ -219,68 +136,28 @@ export class TyComponent extends HTMLElement {
|
|
|
219
136
|
}
|
|
220
137
|
}
|
|
221
138
|
}
|
|
222
|
-
/**
|
|
223
|
-
* Update form value via ElementInternals
|
|
224
|
-
* Subclasses can override to customize form value
|
|
225
|
-
*/
|
|
226
139
|
updateFormValue() {
|
|
227
140
|
const formValue = this.getFormValue();
|
|
228
141
|
this._internals.setFormValue(formValue);
|
|
229
142
|
}
|
|
230
|
-
/**
|
|
231
|
-
* Get the form value for this component
|
|
232
|
-
* Default: return 'value' property
|
|
233
|
-
* Override for custom behavior
|
|
234
|
-
*/
|
|
235
143
|
getFormValue() {
|
|
236
144
|
return this.props.get('value') ?? null;
|
|
237
145
|
}
|
|
238
|
-
/**
|
|
239
|
-
* Hook: Called when properties change
|
|
240
|
-
* Subclasses can override to update internal state
|
|
241
|
-
*
|
|
242
|
-
* This is called BEFORE rendering, so you can update
|
|
243
|
-
* internal state here and it will be reflected in the render
|
|
244
|
-
*/
|
|
245
146
|
onPropertiesChanged(changes) {
|
|
246
|
-
// Default: no-op
|
|
247
|
-
// Subclasses can override to update _state, _config, etc.
|
|
248
147
|
}
|
|
249
|
-
/**
|
|
250
|
-
* Hook: Called when component is connected
|
|
251
|
-
* Use this instead of overriding connectedCallback
|
|
252
|
-
*/
|
|
253
148
|
onConnect() {
|
|
254
|
-
// Default: no-op
|
|
255
149
|
}
|
|
256
|
-
/**
|
|
257
|
-
* Hook: Called when component is disconnected
|
|
258
|
-
* Use this for cleanup instead of overriding disconnectedCallback
|
|
259
|
-
*/
|
|
260
150
|
onDisconnect() {
|
|
261
|
-
// Default: no-op
|
|
262
151
|
}
|
|
263
|
-
/**
|
|
264
|
-
* Get the form element this component is associated with
|
|
265
|
-
*/
|
|
266
152
|
get form() {
|
|
267
153
|
return this._internals.form;
|
|
268
154
|
}
|
|
269
|
-
/**
|
|
270
|
-
* a11y helper for components whose ARIA role lives on an inner shadow element
|
|
271
|
-
* (checkbox/switch/radio). A wrapping <label> names the form-associated HOST,
|
|
272
|
-
* not the inner role element — so mirror the host's associated label text onto
|
|
273
|
-
* the role element as aria-label, giving it an accessible name.
|
|
274
|
-
*/
|
|
275
155
|
applyLabelName(roleEl) {
|
|
276
156
|
let text = Array.from(this._internals.labels ?? [])
|
|
277
157
|
.map((l) => l.textContent?.trim())
|
|
278
158
|
.filter(Boolean)
|
|
279
159
|
.join(' ');
|
|
280
160
|
if (!text) {
|
|
281
|
-
// Non-form-associated controls (e.g. ty-radio) aren't labelable, so the
|
|
282
|
-
// wrapping <label> never appears in internals.labels — read it directly,
|
|
283
|
-
// stripping this element's own subtree from the text.
|
|
284
161
|
const lbl = this.closest('label');
|
|
285
162
|
if (lbl) {
|
|
286
163
|
const clone = lbl.cloneNode(true);
|
|
@@ -293,32 +170,24 @@ export class TyComponent extends HTMLElement {
|
|
|
293
170
|
else
|
|
294
171
|
roleEl.removeAttribute('aria-label');
|
|
295
172
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
173
|
+
isDuplicateActivationClick() {
|
|
174
|
+
if (this._handlingActivationClick)
|
|
175
|
+
return true;
|
|
176
|
+
this._handlingActivationClick = true;
|
|
177
|
+
queueMicrotask(() => { this._handlingActivationClick = false; });
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
300
180
|
formResetCallback() {
|
|
301
|
-
// Get the default value from property configuration
|
|
302
181
|
const ctor = this.constructor;
|
|
303
182
|
const valueConfig = ctor.properties['value'];
|
|
304
183
|
if (valueConfig) {
|
|
305
184
|
const defaultValue = valueConfig.default ?? '';
|
|
306
|
-
// Reset the value property through setProperty to trigger lifecycle
|
|
307
185
|
this.setProperty('value', defaultValue);
|
|
308
186
|
}
|
|
309
|
-
// Call subclass hook for custom reset behavior
|
|
310
187
|
this.onFormReset();
|
|
311
188
|
}
|
|
312
|
-
/**
|
|
313
|
-
* Hook: Called when form is reset
|
|
314
|
-
* Subclasses can override to perform additional reset actions
|
|
315
|
-
*/
|
|
316
189
|
onFormReset() {
|
|
317
|
-
// Default: no-op
|
|
318
|
-
// Subclasses can override to reset additional state
|
|
319
190
|
}
|
|
320
191
|
}
|
|
321
192
|
TyComponent.formAssociated = true;
|
|
322
|
-
// Subclasses must define their property configuration
|
|
323
193
|
TyComponent.properties = {};
|
|
324
|
-
//# sourceMappingURL=ty-component.js.map
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TyButton Web Component
|
|
3
|
-
*
|
|
4
|
-
* Three appearance variants × six flavors × three tones (+/base/-).
|
|
5
|
-
* appearance="solid" saturated brand fill (default)
|
|
6
|
-
* appearance="outlined" transparent bg, text === border
|
|
7
|
-
* appearance="ghost" text only, hover bg
|
|
8
|
-
*
|
|
9
|
-
* Append `+` or `-` to a flavor for stronger/softer tone (e.g. "primary+").
|
|
2
|
+
* TyButton Web Component — three appearances (solid/outlined/ghost) × six
|
|
3
|
+
* flavors × three tones. Append `+`/`-` to a flavor for stronger/softer tone.
|
|
10
4
|
*/
|
|
11
5
|
import type { Flavor, Size, TyButtonElement } from "../types/common.js";
|
|
12
6
|
import { TyComponent } from "../base/ty-component.js";
|
|
@@ -27,13 +21,6 @@ interface ButtonState {
|
|
|
27
21
|
}
|
|
28
22
|
/**
|
|
29
23
|
* Ty Button Component
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```html
|
|
33
|
-
* <ty-button flavor="primary">Default solid</ty-button>
|
|
34
|
-
* <ty-button appearance="outlined" flavor="danger">Outlined</ty-button>
|
|
35
|
-
* <ty-button appearance="ghost" flavor="success+">Ghost stronger</ty-button>
|
|
36
|
-
* ```
|
|
37
24
|
*/
|
|
38
25
|
export declare class TyButton extends TyComponent<ButtonState> implements TyButtonElement {
|
|
39
26
|
static formAssociated: boolean;
|
|
@@ -147,4 +134,3 @@ export declare class TyButton extends TyComponent<ButtonState> implements TyButt
|
|
|
147
134
|
protected render(): void;
|
|
148
135
|
}
|
|
149
136
|
export {};
|
|
150
|
-
//# sourceMappingURL=button.d.ts.map
|
package/lib/components/button.js
CHANGED
|
@@ -1,33 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TyButton Web Component
|
|
3
|
-
*
|
|
4
|
-
* Three appearance variants × six flavors × three tones (+/base/-).
|
|
5
|
-
* appearance="solid" saturated brand fill (default)
|
|
6
|
-
* appearance="outlined" transparent bg, text === border
|
|
7
|
-
* appearance="ghost" text only, hover bg
|
|
8
|
-
*
|
|
9
|
-
* Append `+` or `-` to a flavor for stronger/softer tone (e.g. "primary+").
|
|
10
|
-
*/
|
|
11
1
|
import { TyComponent } from "../base/ty-component.js";
|
|
12
2
|
import { ensureStyles, buildClassList } from "../utils/styles.js";
|
|
13
3
|
import { buttonStyles, buttonCustomFlavorCss } from "../styles/button.js";
|
|
14
4
|
import { syncCustomFlavorSheet } from "../utils/flavor-sheet.js";
|
|
15
5
|
import { getLoaderSvg } from "../utils/loader-registry.js";
|
|
16
|
-
/**
|
|
17
|
-
* Ty Button Component
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```html
|
|
21
|
-
* <ty-button flavor="primary">Default solid</ty-button>
|
|
22
|
-
* <ty-button appearance="outlined" flavor="danger">Outlined</ty-button>
|
|
23
|
-
* <ty-button appearance="ghost" flavor="success+">Ghost stronger</ty-button>
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
6
|
export class TyButton extends TyComponent {
|
|
27
7
|
constructor() {
|
|
28
8
|
super();
|
|
29
9
|
this._structureInitialized = false;
|
|
30
|
-
// Adopted sheet with generated rules for a custom (non-built-in) flavor
|
|
31
10
|
this._customFlavorSheet = null;
|
|
32
11
|
ensureStyles(this.shadowRoot, { css: buttonStyles, id: "ty-button" });
|
|
33
12
|
}
|
|
@@ -40,19 +19,10 @@ export class TyButton extends TyComponent {
|
|
|
40
19
|
this._syncCustomFlavor();
|
|
41
20
|
}
|
|
42
21
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Custom flavors: adopt generated per-flavor rules pointed at the user's
|
|
45
|
-
* design tokens (--ty-solid-X / --ty-color-X / --ty-bg-X), falling back to
|
|
46
|
-
* neutral for any token the user didn't define. Tone (+/-) is handled by
|
|
47
|
-
* the tone-plus/tone-minus classes, so only the base flavor matters here.
|
|
48
|
-
*/
|
|
49
22
|
_syncCustomFlavor() {
|
|
50
23
|
const { base } = this.parseFlavor();
|
|
51
24
|
this._customFlavorSheet = syncCustomFlavorSheet(this.shadowRoot, this._customFlavorSheet, base, () => buttonCustomFlavorCss(base));
|
|
52
25
|
}
|
|
53
|
-
// ============================================================================
|
|
54
|
-
// PROPERTY ACCESSORS
|
|
55
|
-
// ============================================================================
|
|
56
26
|
get flavor() {
|
|
57
27
|
return this.getProperty("flavor");
|
|
58
28
|
}
|
|
@@ -125,10 +95,6 @@ export class TyButton extends TyComponent {
|
|
|
125
95
|
set value(value) {
|
|
126
96
|
this.setProperty("value", value);
|
|
127
97
|
}
|
|
128
|
-
// ============================================================================
|
|
129
|
-
// INTERNAL
|
|
130
|
-
// ============================================================================
|
|
131
|
-
/** Parse the optional `+`/`-` shade suffix from a flavor string. */
|
|
132
98
|
parseFlavor() {
|
|
133
99
|
const f = this.flavor || "";
|
|
134
100
|
if (f.length > 1 && f.endsWith("+"))
|
|
@@ -200,7 +166,6 @@ export class TyButton extends TyComponent {
|
|
|
200
166
|
button.classList.toggle("loading", isLoading);
|
|
201
167
|
if (isLoading) {
|
|
202
168
|
button.setAttribute("aria-busy", "true");
|
|
203
|
-
// Pull the latest registered loader SVG so registry changes take effect
|
|
204
169
|
const loader = button.querySelector(".loader-icon");
|
|
205
170
|
if (loader)
|
|
206
171
|
loader.innerHTML = getLoaderSvg();
|
|
@@ -304,4 +269,3 @@ TyButton.properties = {
|
|
|
304
269
|
if (!customElements.get("ty-button")) {
|
|
305
270
|
customElements.define("ty-button", TyButton);
|
|
306
271
|
}
|
|
307
|
-
//# sourceMappingURL=button.js.map
|
|
@@ -1,39 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TyCalendarMonth Web Component
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* A stateless, property-driven calendar month renderer with customizable
|
|
6
|
-
* day content and styling.
|
|
7
|
-
*
|
|
8
|
-
* Features:
|
|
9
|
-
* - 42-day grid (6 weeks × 7 days) with Monday-first ordering
|
|
10
|
-
* - Localized weekday headers
|
|
11
|
-
* - Custom day content rendering via dayContentFn
|
|
12
|
-
* - Custom day classes via dayClassesFn
|
|
13
|
-
* - Custom CSS injection via customCSS
|
|
14
|
-
* - Responsive width system (width, minWidth, maxWidth)
|
|
15
|
-
* - Rich day-click events with full context
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```html
|
|
19
|
-
* <!-- Basic usage -->
|
|
20
|
-
* <ty-calendar-month
|
|
21
|
-
* display-year="2025"
|
|
22
|
-
* display-month="10"
|
|
23
|
-
* locale="en-US">
|
|
24
|
-
* </ty-calendar-month>
|
|
25
|
-
*
|
|
26
|
-
* <!-- With custom rendering -->
|
|
27
|
-
* <ty-calendar-month id="custom"></ty-calendar-month>
|
|
28
|
-
* <script type="module">
|
|
29
|
-
* const cal = document.getElementById('custom');
|
|
30
|
-
* cal.dayContentFn = (ctx) => {
|
|
31
|
-
* const el = document.createElement('div');
|
|
32
|
-
* el.textContent = ctx.dayInMonth;
|
|
33
|
-
* return el;
|
|
34
|
-
* };
|
|
35
|
-
* </script>
|
|
36
|
-
* ```
|
|
2
|
+
* TyCalendarMonth Web Component — a stateless, property-driven calendar month
|
|
3
|
+
* renderer (42-day grid, Monday-first) with customizable day content/styling.
|
|
37
4
|
*/
|
|
38
5
|
import { type DayContext } from '../utils/calendar-utils.js';
|
|
39
6
|
/**
|
|
@@ -124,22 +91,13 @@ export declare class TyCalendarMonth extends HTMLElement {
|
|
|
124
91
|
* Apply width-related properties as CSS custom properties
|
|
125
92
|
*/
|
|
126
93
|
private applyWidthProperties;
|
|
127
|
-
/**
|
|
128
|
-
* Apply custom CSS to shadow root
|
|
129
|
-
*/
|
|
130
94
|
private applyCustomCSS;
|
|
131
95
|
/**
|
|
132
96
|
* Force re-render of the calendar month
|
|
133
97
|
* Useful when external data changes (e.g., async event loading)
|
|
134
98
|
*/
|
|
135
99
|
refresh(): void;
|
|
136
|
-
/**
|
|
137
|
-
* Dispatch day-click custom event with day context
|
|
138
|
-
*/
|
|
139
100
|
private dispatchDayClick;
|
|
140
|
-
/**
|
|
141
|
-
* Render a single day cell
|
|
142
|
-
*/
|
|
143
101
|
/**
|
|
144
102
|
* WAI-ARIA grid pattern: gridcell + roving tabindex (exactly one cell in
|
|
145
103
|
* the whole grid is tabindex="0" at a time — the rest are -1, so Tab
|
|
@@ -147,9 +105,5 @@ export declare class TyCalendarMonth extends HTMLElement {
|
|
|
147
105
|
* Disabled days are excluded from the roving set entirely.
|
|
148
106
|
*/
|
|
149
107
|
private renderDayCell;
|
|
150
|
-
/**
|
|
151
|
-
* Main render function - property-based approach
|
|
152
|
-
*/
|
|
153
108
|
private render;
|
|
154
109
|
}
|
|
155
|
-
//# sourceMappingURL=calendar-month.d.ts.map
|