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
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TyCheckbox Web Component
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Label, required asterisk, and error display are the consumer's
|
|
6
|
-
* responsibility — wrap in a `<label>` for click delegation.
|
|
7
|
-
*
|
|
8
|
-
* - Boolean checked state, form-associated
|
|
9
|
-
* - Keyboard accessibility (Space/Enter)
|
|
10
|
-
* - Sizes (xs, sm, md, lg, xl) and semantic flavors
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* <label>
|
|
14
|
-
* <ty-checkbox name="terms" required></ty-checkbox>
|
|
15
|
-
* I agree to the <a href="/terms">terms</a>
|
|
16
|
-
* </label>
|
|
2
|
+
* TyCheckbox Web Component — "just the box" primitive: renders only the
|
|
3
|
+
* checkbox visual + state. Label, required asterisk and error display are the
|
|
4
|
+
* consumer's responsibility — wrap in a `<label>` for click delegation.
|
|
17
5
|
*/
|
|
18
6
|
import type { Flavor, Size } from "../types/common.js";
|
|
19
7
|
import { TyComponent } from "../base/ty-component.js";
|
|
@@ -41,42 +29,6 @@ export interface TyCheckboxElement extends HTMLElement {
|
|
|
41
29
|
}
|
|
42
30
|
/**
|
|
43
31
|
* Ty Checkbox Component
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```html
|
|
47
|
-
* <!-- Basic checkbox -->
|
|
48
|
-
* <ty-checkbox>Subscribe to newsletter</ty-checkbox>
|
|
49
|
-
*
|
|
50
|
-
* <!-- Pre-checked with custom value -->
|
|
51
|
-
* <ty-checkbox
|
|
52
|
-
* checked
|
|
53
|
-
* value="accepted"
|
|
54
|
-
* required>
|
|
55
|
-
* Accept terms
|
|
56
|
-
* </ty-checkbox>
|
|
57
|
-
*
|
|
58
|
-
* <!-- With error state -->
|
|
59
|
-
* <ty-checkbox
|
|
60
|
-
* required
|
|
61
|
-
* error="You must agree to continue"
|
|
62
|
-
* flavor="danger">
|
|
63
|
-
* Agree to terms
|
|
64
|
-
* </ty-checkbox>
|
|
65
|
-
*
|
|
66
|
-
* <!-- Different sizes -->
|
|
67
|
-
* <ty-checkbox size="sm">Small</ty-checkbox>
|
|
68
|
-
* <ty-checkbox size="lg">Large</ty-checkbox>
|
|
69
|
-
*
|
|
70
|
-
* <!-- Semantic flavors -->
|
|
71
|
-
* <ty-checkbox flavor="primary" checked>Primary</ty-checkbox>
|
|
72
|
-
* <ty-checkbox flavor="success" checked>Success</ty-checkbox>
|
|
73
|
-
*
|
|
74
|
-
* <!-- Rich content (with icon) -->
|
|
75
|
-
* <ty-checkbox checked>
|
|
76
|
-
* <ty-icon name="star"></ty-icon>
|
|
77
|
-
* Premium feature
|
|
78
|
-
* </ty-checkbox>
|
|
79
|
-
* ```
|
|
80
32
|
*/
|
|
81
33
|
export declare class TyCheckbox extends TyComponent<CheckboxState> implements TyCheckboxElement {
|
|
82
34
|
static formAssociated: boolean;
|
|
@@ -131,16 +83,10 @@ export declare class TyCheckbox extends TyComponent<CheckboxState> implements Ty
|
|
|
131
83
|
private _focusHandler;
|
|
132
84
|
private _blurHandler;
|
|
133
85
|
constructor();
|
|
134
|
-
/**
|
|
135
|
-
* Called when component connects to DOM
|
|
136
|
-
* TyComponent already handled pre-connection property capture
|
|
137
|
-
*/
|
|
86
|
+
/** TyComponent already handled pre-connection property capture. */
|
|
138
87
|
protected onConnect(): void;
|
|
139
88
|
/** Custom (non-built-in) flavors — see utils/flavor-sheet.ts. */
|
|
140
89
|
private _syncCustomFlavor;
|
|
141
|
-
/**
|
|
142
|
-
* Called when component disconnects from DOM
|
|
143
|
-
*/
|
|
144
90
|
protected onDisconnect(): void;
|
|
145
91
|
/**
|
|
146
92
|
* Handle property changes - called BEFORE render
|
|
@@ -150,21 +96,9 @@ export declare class TyCheckbox extends TyComponent<CheckboxState> implements Ty
|
|
|
150
96
|
* Override form value to return value when checked, null when unchecked
|
|
151
97
|
*/
|
|
152
98
|
protected getFormValue(): FormDataEntryValue | null;
|
|
153
|
-
/**
|
|
154
|
-
* Build CSS class list for checkbox container
|
|
155
|
-
*/
|
|
156
99
|
private buildClassList;
|
|
157
|
-
/**
|
|
158
|
-
* Handle checkbox click event - standards compliant approach
|
|
159
|
-
*/
|
|
160
100
|
private handleCheckboxClick;
|
|
161
|
-
/**
|
|
162
|
-
* Handle checkbox keyboard events - space/enter to toggle
|
|
163
|
-
*/
|
|
164
101
|
private handleCheckboxKeydown;
|
|
165
|
-
/**
|
|
166
|
-
* Remove event listeners for cleanup
|
|
167
|
-
*/
|
|
168
102
|
private removeEventListeners;
|
|
169
103
|
/**
|
|
170
104
|
* Setup event listeners for checkbox functionality
|
|
@@ -197,4 +131,3 @@ export declare class TyCheckbox extends TyComponent<CheckboxState> implements Ty
|
|
|
197
131
|
get form(): HTMLFormElement | null;
|
|
198
132
|
}
|
|
199
133
|
export {};
|
|
200
|
-
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -1,136 +1,39 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TyCheckbox Web Component
|
|
3
|
-
*
|
|
4
|
-
* "Just the box" primitive — renders only the checkbox visual + state.
|
|
5
|
-
* Label, required asterisk, and error display are the consumer's
|
|
6
|
-
* responsibility — wrap in a `<label>` for click delegation.
|
|
7
|
-
*
|
|
8
|
-
* - Boolean checked state, form-associated
|
|
9
|
-
* - Keyboard accessibility (Space/Enter)
|
|
10
|
-
* - Sizes (xs, sm, md, lg, xl) and semantic flavors
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* <label>
|
|
14
|
-
* <ty-checkbox name="terms" required></ty-checkbox>
|
|
15
|
-
* I agree to the <a href="/terms">terms</a>
|
|
16
|
-
* </label>
|
|
17
|
-
*/
|
|
18
1
|
import { TyComponent } from "../base/ty-component.js";
|
|
19
2
|
import { ensureStyles } from "../utils/styles.js";
|
|
20
3
|
import { syncCustomFlavorSheet } from "../utils/flavor-sheet.js";
|
|
21
4
|
import { checkboxStyles, checkboxCustomFlavorCss } from "../styles/checkbox.js";
|
|
22
|
-
/**
|
|
23
|
-
* Checkmark icon (Lucide `check`, same glyph as ty-option's selected check;
|
|
24
|
-
* stroke-width 3 for presence at 16px — it replaces a heavy fill glyph).
|
|
25
|
-
* Same glyph for checked and unchecked — checked shows it at full color,
|
|
26
|
-
* unchecked at faint color (see styles).
|
|
27
|
-
*/
|
|
28
5
|
const CHECK_ICON = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>`;
|
|
29
|
-
/**
|
|
30
|
-
* Dash icon (Lucide `minus`) — shown while indeterminate.
|
|
31
|
-
*/
|
|
32
6
|
const DASH_ICON = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/></svg>`;
|
|
33
|
-
/**
|
|
34
|
-
* Ty Checkbox Component
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```html
|
|
38
|
-
* <!-- Basic checkbox -->
|
|
39
|
-
* <ty-checkbox>Subscribe to newsletter</ty-checkbox>
|
|
40
|
-
*
|
|
41
|
-
* <!-- Pre-checked with custom value -->
|
|
42
|
-
* <ty-checkbox
|
|
43
|
-
* checked
|
|
44
|
-
* value="accepted"
|
|
45
|
-
* required>
|
|
46
|
-
* Accept terms
|
|
47
|
-
* </ty-checkbox>
|
|
48
|
-
*
|
|
49
|
-
* <!-- With error state -->
|
|
50
|
-
* <ty-checkbox
|
|
51
|
-
* required
|
|
52
|
-
* error="You must agree to continue"
|
|
53
|
-
* flavor="danger">
|
|
54
|
-
* Agree to terms
|
|
55
|
-
* </ty-checkbox>
|
|
56
|
-
*
|
|
57
|
-
* <!-- Different sizes -->
|
|
58
|
-
* <ty-checkbox size="sm">Small</ty-checkbox>
|
|
59
|
-
* <ty-checkbox size="lg">Large</ty-checkbox>
|
|
60
|
-
*
|
|
61
|
-
* <!-- Semantic flavors -->
|
|
62
|
-
* <ty-checkbox flavor="primary" checked>Primary</ty-checkbox>
|
|
63
|
-
* <ty-checkbox flavor="success" checked>Success</ty-checkbox>
|
|
64
|
-
*
|
|
65
|
-
* <!-- Rich content (with icon) -->
|
|
66
|
-
* <ty-checkbox checked>
|
|
67
|
-
* <ty-icon name="star"></ty-icon>
|
|
68
|
-
* Premium feature
|
|
69
|
-
* </ty-checkbox>
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
7
|
export class TyCheckbox extends TyComponent {
|
|
73
8
|
constructor() {
|
|
74
|
-
super();
|
|
75
|
-
// ============================================================================
|
|
76
|
-
// INTERNAL STATE - Not managed by PropertyManager
|
|
77
|
-
// NOTE: _internals provided by TyComponent base class
|
|
78
|
-
// ============================================================================
|
|
9
|
+
super();
|
|
79
10
|
this._customFlavorSheet = null;
|
|
80
11
|
this._listenersSetup = false;
|
|
81
|
-
// Store references to handlers for cleanup
|
|
82
12
|
this._clickHandler = null;
|
|
83
13
|
this._keydownHandler = null;
|
|
84
14
|
this._focusHandler = null;
|
|
85
15
|
this._blurHandler = null;
|
|
86
|
-
// Apply styles to shadow root
|
|
87
16
|
const shadow = this.shadowRoot;
|
|
88
17
|
ensureStyles(shadow, { css: checkboxStyles, id: "ty-checkbox" });
|
|
89
18
|
}
|
|
90
|
-
// observedAttributes auto-generated by TyComponent from properties config
|
|
91
|
-
// ============================================================================
|
|
92
|
-
// TYCOMPONENT LIFECYCLE HOOKS
|
|
93
|
-
// ============================================================================
|
|
94
|
-
/**
|
|
95
|
-
* Called when component connects to DOM
|
|
96
|
-
* TyComponent already handled pre-connection property capture
|
|
97
|
-
*/
|
|
98
19
|
onConnect() {
|
|
99
|
-
// Re-arm listeners on RE-connect: the base class skips render() when
|
|
100
|
-
// already rendered, and onDisconnect removed the listeners. No-ops on
|
|
101
|
-
// first connect (no container yet — render() attaches them).
|
|
102
20
|
this.setupEventListeners();
|
|
103
21
|
this._syncCustomFlavor();
|
|
104
22
|
}
|
|
105
|
-
/** Custom (non-built-in) flavors — see utils/flavor-sheet.ts. */
|
|
106
23
|
_syncCustomFlavor() {
|
|
107
24
|
this._customFlavorSheet = syncCustomFlavorSheet(this.shadowRoot, this._customFlavorSheet, this.flavor, ({ base }) => checkboxCustomFlavorCss(base));
|
|
108
25
|
}
|
|
109
|
-
/**
|
|
110
|
-
* Called when component disconnects from DOM
|
|
111
|
-
*/
|
|
112
26
|
onDisconnect() {
|
|
113
|
-
// Clean up event listeners when component is removed from DOM
|
|
114
27
|
this.removeEventListeners();
|
|
115
28
|
}
|
|
116
|
-
/**
|
|
117
|
-
* Handle property changes - called BEFORE render
|
|
118
|
-
*/
|
|
119
29
|
onPropertiesChanged(changes) {
|
|
120
30
|
if (changes.some((c) => c.name === "flavor")) {
|
|
121
31
|
this._syncCustomFlavor();
|
|
122
32
|
}
|
|
123
33
|
}
|
|
124
|
-
/**
|
|
125
|
-
* Override form value to return value when checked, null when unchecked
|
|
126
|
-
*/
|
|
127
34
|
getFormValue() {
|
|
128
35
|
return this.checked ? this.value : null;
|
|
129
36
|
}
|
|
130
|
-
// Removed old attributeChangedCallback, initializeCheckboxState, validateFlavor - handled by TyComponent
|
|
131
|
-
/**
|
|
132
|
-
* Build CSS class list for checkbox container
|
|
133
|
-
*/
|
|
134
37
|
buildClassList() {
|
|
135
38
|
const classes = [this.size];
|
|
136
39
|
if (this.disabled)
|
|
@@ -139,18 +42,15 @@ export class TyCheckbox extends TyComponent {
|
|
|
139
42
|
classes.push("required");
|
|
140
43
|
return classes.join(" ");
|
|
141
44
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Handle checkbox click event - standards compliant approach
|
|
144
|
-
*/
|
|
145
45
|
handleCheckboxClick(e) {
|
|
146
46
|
if (this.disabled)
|
|
147
47
|
return;
|
|
148
|
-
|
|
48
|
+
if (this.isDuplicateActivationClick())
|
|
49
|
+
return;
|
|
149
50
|
const newValue = this.indeterminate ? true : !this.checked;
|
|
150
51
|
if (this.indeterminate)
|
|
151
52
|
this.indeterminate = false;
|
|
152
|
-
this.checked = newValue;
|
|
153
|
-
// Emit custom events after property update
|
|
53
|
+
this.checked = newValue;
|
|
154
54
|
setTimeout(() => {
|
|
155
55
|
const eventDetail = {
|
|
156
56
|
value: newValue,
|
|
@@ -170,26 +70,18 @@ export class TyCheckbox extends TyComponent {
|
|
|
170
70
|
}));
|
|
171
71
|
}, 0);
|
|
172
72
|
}
|
|
173
|
-
/**
|
|
174
|
-
* Handle checkbox keyboard events - space/enter to toggle
|
|
175
|
-
*/
|
|
176
73
|
handleCheckboxKeydown(e) {
|
|
177
74
|
if (this.disabled)
|
|
178
75
|
return;
|
|
179
76
|
if (["Space", " ", "Enter"].includes(e.key)) {
|
|
180
|
-
e.preventDefault();
|
|
77
|
+
e.preventDefault();
|
|
181
78
|
e.stopPropagation();
|
|
182
79
|
this.handleCheckboxClick(e);
|
|
183
80
|
}
|
|
184
81
|
}
|
|
185
|
-
/**
|
|
186
|
-
* Remove event listeners for cleanup
|
|
187
|
-
*/
|
|
188
82
|
removeEventListeners() {
|
|
189
83
|
if (!this._listenersSetup)
|
|
190
84
|
return;
|
|
191
|
-
// Click lives on the HOST (label delegation + full-element trigger) —
|
|
192
|
-
// remove it before the shadow-container guard below.
|
|
193
85
|
if (this._clickHandler) {
|
|
194
86
|
this.removeEventListener("click", this._clickHandler);
|
|
195
87
|
this._clickHandler = null;
|
|
@@ -216,10 +108,6 @@ export class TyCheckbox extends TyComponent {
|
|
|
216
108
|
}
|
|
217
109
|
this._listenersSetup = false;
|
|
218
110
|
}
|
|
219
|
-
/**
|
|
220
|
-
* Setup event listeners for checkbox functionality
|
|
221
|
-
* IMPORTANT: Only called ONCE, not on every render
|
|
222
|
-
*/
|
|
223
111
|
setupEventListeners() {
|
|
224
112
|
if (this._listenersSetup)
|
|
225
113
|
return;
|
|
@@ -227,7 +115,6 @@ export class TyCheckbox extends TyComponent {
|
|
|
227
115
|
const checkboxEl = shadow.querySelector(".checkbox-container");
|
|
228
116
|
if (!checkboxEl)
|
|
229
117
|
return;
|
|
230
|
-
// Create and store handler references for cleanup
|
|
231
118
|
this._clickHandler = (e) => {
|
|
232
119
|
this.handleCheckboxClick(e);
|
|
233
120
|
};
|
|
@@ -240,19 +127,12 @@ export class TyCheckbox extends TyComponent {
|
|
|
240
127
|
this._blurHandler = () => {
|
|
241
128
|
checkboxEl.classList.remove("focused");
|
|
242
129
|
};
|
|
243
|
-
// Click on the HOST: makes the whole element a trigger and lets a wrapping
|
|
244
|
-
// <label> delegate (the synthetic click lands on the host, not the shadow).
|
|
245
|
-
// Keyboard/focus stay on the focusable container.
|
|
246
130
|
this.addEventListener("click", this._clickHandler);
|
|
247
131
|
checkboxEl.addEventListener("keydown", this._keydownHandler);
|
|
248
132
|
checkboxEl.addEventListener("focus", this._focusHandler);
|
|
249
133
|
checkboxEl.addEventListener("blur", this._blurHandler);
|
|
250
134
|
this._listenersSetup = true;
|
|
251
135
|
}
|
|
252
|
-
/**
|
|
253
|
-
* Render the checkbox — just the box visual.
|
|
254
|
-
* Label, required asterisk, and error UI are the consumer's responsibility.
|
|
255
|
-
*/
|
|
256
136
|
render() {
|
|
257
137
|
const shadow = this.shadowRoot;
|
|
258
138
|
let checkboxEl = shadow.querySelector(".checkbox-container");
|
|
@@ -278,21 +158,12 @@ export class TyCheckbox extends TyComponent {
|
|
|
278
158
|
checkboxEl.setAttribute("aria-disabled", String(this.disabled));
|
|
279
159
|
checkboxEl.setAttribute("aria-required", String(this.required));
|
|
280
160
|
}
|
|
281
|
-
// Dash while indeterminate, tick otherwise (tick's color/opacity carries
|
|
282
|
-
// the checked/unchecked distinction via CSS).
|
|
283
161
|
const icon = checkboxEl.querySelector(".checkbox-icon");
|
|
284
162
|
icon.innerHTML = this.indeterminate ? DASH_ICON : CHECK_ICON;
|
|
285
|
-
// (Re)attach listeners — onDisconnect removes them, so a reconnected
|
|
286
|
-
// element needs them again even though the container already exists.
|
|
287
163
|
this.setupEventListeners();
|
|
288
|
-
// a11y: role="checkbox" lives on this inner element, but the associated
|
|
289
|
-
// <label> names the (form-associated) host. Mirror that name onto the role
|
|
290
|
-
// element so it has an accessible name.
|
|
291
164
|
this.applyLabelName(checkboxEl);
|
|
292
|
-
// Reflect constraint validation to the owning <form> (required was cosmetic).
|
|
293
165
|
this.updateValidity();
|
|
294
166
|
}
|
|
295
|
-
/** required + unchecked => valueMissing; otherwise valid. */
|
|
296
167
|
updateValidity() {
|
|
297
168
|
const anchor = this.shadowRoot?.querySelector(".checkbox-container");
|
|
298
169
|
if (this.disabled) {
|
|
@@ -306,9 +177,6 @@ export class TyCheckbox extends TyComponent {
|
|
|
306
177
|
this._internals.setValidity({});
|
|
307
178
|
}
|
|
308
179
|
}
|
|
309
|
-
// ============================================================================
|
|
310
|
-
// PROPERTY ACCESSORS - Simple wrappers (no logic!)
|
|
311
|
-
// ============================================================================
|
|
312
180
|
get checked() {
|
|
313
181
|
return this.getProperty("checked");
|
|
314
182
|
}
|
|
@@ -362,26 +230,19 @@ export class TyCheckbox extends TyComponent {
|
|
|
362
230
|
}
|
|
363
231
|
}
|
|
364
232
|
TyCheckbox.formAssociated = true;
|
|
365
|
-
// ============================================================================
|
|
366
|
-
// PROPERTY CONFIGURATION - Declarative property lifecycle
|
|
367
|
-
// ============================================================================
|
|
368
233
|
TyCheckbox.properties = {
|
|
369
|
-
// Core boolean state
|
|
370
234
|
checked: {
|
|
371
235
|
type: "boolean",
|
|
372
236
|
visual: true,
|
|
373
|
-
formValue: true,
|
|
374
|
-
emitChange: true,
|
|
237
|
+
formValue: true,
|
|
238
|
+
emitChange: true,
|
|
375
239
|
default: false,
|
|
376
240
|
},
|
|
377
|
-
// Visual/ARIA "mixed" state (native semantics: no form-value effect,
|
|
378
|
-
// clicking resolves to checked)
|
|
379
241
|
indeterminate: {
|
|
380
242
|
type: "boolean",
|
|
381
243
|
visual: true,
|
|
382
244
|
default: false,
|
|
383
245
|
},
|
|
384
|
-
// Form submission value (when checked)
|
|
385
246
|
value: {
|
|
386
247
|
type: "string",
|
|
387
248
|
default: "on",
|
|
@@ -413,17 +274,12 @@ TyCheckbox.properties = {
|
|
|
413
274
|
return v;
|
|
414
275
|
},
|
|
415
276
|
},
|
|
416
|
-
// Any string is accepted: built-ins get static CSS, other identifiers
|
|
417
|
-
// become custom flavors (see _syncCustomFlavor), garbage degrades to
|
|
418
|
-
// the default look.
|
|
419
277
|
flavor: {
|
|
420
278
|
type: "string",
|
|
421
279
|
visual: true,
|
|
422
280
|
default: "neutral",
|
|
423
281
|
},
|
|
424
282
|
};
|
|
425
|
-
// Register the custom element
|
|
426
283
|
if (!customElements.get("ty-checkbox")) {
|
|
427
284
|
customElements.define("ty-checkbox", TyCheckbox);
|
|
428
285
|
}
|
|
429
|
-
//# sourceMappingURL=checkbox.js.map
|
package/lib/components/copy.d.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TyCopy Web Component
|
|
3
|
-
*
|
|
4
|
-
* Read-only field with copy-to-clipboard functionality
|
|
5
|
-
* Perfect for API keys, tokens, URLs, code snippets, etc.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Read-only display (not an input)
|
|
9
|
-
* - Copy icon on the right
|
|
10
|
-
* - Icon animation on copy (copy → check → copy)
|
|
11
|
-
* - Same styling as ty-input for consistency
|
|
12
|
-
* - Label support
|
|
13
|
-
* - Size and flavor variants
|
|
2
|
+
* TyCopy Web Component — read-only field with copy-to-clipboard, styled like
|
|
3
|
+
* ty-input. For API keys, tokens, URLs, code snippets, etc.
|
|
14
4
|
*/
|
|
15
5
|
import type { Flavor, Size } from '../types/common.js';
|
|
16
6
|
import { TyComponent } from '../base/ty-component.js';
|
|
@@ -45,30 +35,6 @@ export interface TyCopyElement extends HTMLElement {
|
|
|
45
35
|
}
|
|
46
36
|
/**
|
|
47
37
|
* Ty Copy Field Component
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```html
|
|
51
|
-
* <!-- Basic copy field -->
|
|
52
|
-
* <ty-copy
|
|
53
|
-
* label="API Key"
|
|
54
|
-
* value="sk_live_1234567890abcdef">
|
|
55
|
-
* </ty-copy>
|
|
56
|
-
*
|
|
57
|
-
* <!-- Code format -->
|
|
58
|
-
* <ty-copy
|
|
59
|
-
* label="Install Command"
|
|
60
|
-
* value="npm install tyrell-components"
|
|
61
|
-
* format="code">
|
|
62
|
-
* </ty-copy>
|
|
63
|
-
*
|
|
64
|
-
* <!-- Different sizes -->
|
|
65
|
-
* <ty-copy size="sm" value="Small field"></ty-copy>
|
|
66
|
-
* <ty-copy size="lg" value="Large field"></ty-copy>
|
|
67
|
-
*
|
|
68
|
-
* <!-- Semantic flavors -->
|
|
69
|
-
* <ty-copy flavor="primary" value="Primary"></ty-copy>
|
|
70
|
-
* <ty-copy flavor="success" value="Success"></ty-copy>
|
|
71
|
-
* ```
|
|
72
38
|
*/
|
|
73
39
|
export declare class TyCopy extends TyComponent<CopyState> implements TyCopyElement {
|
|
74
40
|
static formAssociated: boolean;
|
|
@@ -127,28 +93,16 @@ export declare class TyCopy extends TyComponent<CopyState> implements TyCopyElem
|
|
|
127
93
|
private _showingSuccess;
|
|
128
94
|
private _customFlavorSheet;
|
|
129
95
|
constructor();
|
|
130
|
-
/**
|
|
131
|
-
* Called when component connects to DOM
|
|
132
|
-
* TyComponent already handled pre-connection property capture
|
|
133
|
-
*/
|
|
96
|
+
/** TyComponent already handled pre-connection property capture. */
|
|
134
97
|
protected onConnect(): void;
|
|
135
98
|
/** Custom (non-built-in) flavors — see utils/flavor-sheet.ts. */
|
|
136
99
|
private _syncCustomFlavor;
|
|
137
|
-
/**
|
|
138
|
-
* Called when component disconnects from DOM
|
|
139
|
-
*/
|
|
140
100
|
protected onDisconnect(): void;
|
|
141
101
|
/**
|
|
142
102
|
* Handle property changes - called BEFORE render
|
|
143
103
|
*/
|
|
144
104
|
protected onPropertiesChanged(changes: PropertyChange[]): void;
|
|
145
|
-
/**
|
|
146
|
-
* Build CSS class list
|
|
147
|
-
*/
|
|
148
105
|
private buildClassList;
|
|
149
|
-
/**
|
|
150
|
-
* Copy value to clipboard
|
|
151
|
-
*/
|
|
152
106
|
private copyToClipboard;
|
|
153
107
|
/**
|
|
154
108
|
* Show copy success animation
|
|
@@ -160,13 +114,7 @@ export declare class TyCopy extends TyComponent<CopyState> implements TyCopyElem
|
|
|
160
114
|
* Swaps copy icon → red X icon → copy icon
|
|
161
115
|
*/
|
|
162
116
|
private showCopyError;
|
|
163
|
-
/**
|
|
164
|
-
* Setup event listeners
|
|
165
|
-
*/
|
|
166
117
|
private setupEventListeners;
|
|
167
|
-
/**
|
|
168
|
-
* Render the component
|
|
169
|
-
*/
|
|
170
118
|
protected render(): void;
|
|
171
119
|
get value(): string;
|
|
172
120
|
set value(val: string);
|
|
@@ -188,4 +136,3 @@ export declare class TyCopy extends TyComponent<CopyState> implements TyCopyElem
|
|
|
188
136
|
set required(value: boolean);
|
|
189
137
|
}
|
|
190
138
|
export {};
|
|
191
|
-
//# sourceMappingURL=copy.d.ts.map
|