tyrell-components 1.0.0-TC45 → 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 +5 -162
- package/lib/components/date-picker.js +28 -583
- 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 +11 -150
- package/lib/components/select.js +7 -581
- 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 +2 -14
- 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 +0 -2
- package/lib/utils/positioning.js +0 -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
package/lib/components/copy.js
CHANGED
|
@@ -1,115 +1,38 @@
|
|
|
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
|
|
14
|
-
*/
|
|
15
1
|
import { TyComponent } from '../base/ty-component.js';
|
|
16
2
|
import { ensureStyles } from '../utils/styles.js';
|
|
17
3
|
import { syncCustomFlavorSheet } from '../utils/flavor-sheet.js';
|
|
18
4
|
import { inputStyles } from '../styles/input.js';
|
|
19
5
|
import { copyStyles, copyCustomFlavorCss } from '../styles/copy.js';
|
|
20
|
-
/**
|
|
21
|
-
* Copy icon SVG (from Lucide)
|
|
22
|
-
*/
|
|
23
6
|
const COPY_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`;
|
|
24
|
-
/**
|
|
25
|
-
* Check icon SVG (from Lucide) - shown after successful copy
|
|
26
|
-
*/
|
|
27
7
|
const CHECK_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>`;
|
|
28
|
-
/**
|
|
29
|
-
* X icon SVG (from Lucide) - shown on copy failure
|
|
30
|
-
*/
|
|
31
8
|
const ERROR_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`;
|
|
32
9
|
import { REQUIRED_ICON_SVG } from '../utils/icons.js';
|
|
33
|
-
/**
|
|
34
|
-
* Ty Copy Field Component
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```html
|
|
38
|
-
* <!-- Basic copy field -->
|
|
39
|
-
* <ty-copy
|
|
40
|
-
* label="API Key"
|
|
41
|
-
* value="sk_live_1234567890abcdef">
|
|
42
|
-
* </ty-copy>
|
|
43
|
-
*
|
|
44
|
-
* <!-- Code format -->
|
|
45
|
-
* <ty-copy
|
|
46
|
-
* label="Install Command"
|
|
47
|
-
* value="npm install tyrell-components"
|
|
48
|
-
* format="code">
|
|
49
|
-
* </ty-copy>
|
|
50
|
-
*
|
|
51
|
-
* <!-- Different sizes -->
|
|
52
|
-
* <ty-copy size="sm" value="Small field"></ty-copy>
|
|
53
|
-
* <ty-copy size="lg" value="Large field"></ty-copy>
|
|
54
|
-
*
|
|
55
|
-
* <!-- Semantic flavors -->
|
|
56
|
-
* <ty-copy flavor="primary" value="Primary"></ty-copy>
|
|
57
|
-
* <ty-copy flavor="success" value="Success"></ty-copy>
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
10
|
export class TyCopy extends TyComponent {
|
|
61
11
|
constructor() {
|
|
62
|
-
super();
|
|
63
|
-
// ============================================================================
|
|
64
|
-
// INTERNAL STATE - Not managed by PropertyManager
|
|
65
|
-
// ============================================================================
|
|
12
|
+
super();
|
|
66
13
|
this._copyTimeout = null;
|
|
67
14
|
this._showingSuccess = false;
|
|
68
15
|
this._customFlavorSheet = null;
|
|
69
|
-
// Apply both input and copy-specific styles
|
|
70
16
|
ensureStyles(this.shadowRoot, { css: inputStyles, id: 'ty-input' });
|
|
71
17
|
ensureStyles(this.shadowRoot, { css: copyStyles, id: 'ty-copy' });
|
|
72
18
|
}
|
|
73
|
-
// observedAttributes auto-generated by TyComponent from properties config
|
|
74
|
-
// ============================================================================
|
|
75
|
-
// TYCOMPONENT LIFECYCLE HOOKS
|
|
76
|
-
// ============================================================================
|
|
77
|
-
/**
|
|
78
|
-
* Called when component connects to DOM
|
|
79
|
-
* TyComponent already handled pre-connection property capture
|
|
80
|
-
*/
|
|
81
19
|
onConnect() {
|
|
82
|
-
// TyComponent will call render() automatically after this hook
|
|
83
20
|
this._syncCustomFlavor();
|
|
84
21
|
}
|
|
85
|
-
/** Custom (non-built-in) flavors — see utils/flavor-sheet.ts. */
|
|
86
22
|
_syncCustomFlavor() {
|
|
87
23
|
this._customFlavorSheet = syncCustomFlavorSheet(this.shadowRoot, this._customFlavorSheet, this.flavor, ({ base }) => copyCustomFlavorCss(base));
|
|
88
24
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Called when component disconnects from DOM
|
|
91
|
-
*/
|
|
92
25
|
onDisconnect() {
|
|
93
|
-
// Clear any pending timeout
|
|
94
26
|
if (this._copyTimeout !== null) {
|
|
95
27
|
clearTimeout(this._copyTimeout);
|
|
96
28
|
this._copyTimeout = null;
|
|
97
29
|
}
|
|
98
30
|
}
|
|
99
|
-
/**
|
|
100
|
-
* Handle property changes - called BEFORE render
|
|
101
|
-
*/
|
|
102
31
|
onPropertiesChanged(changes) {
|
|
103
32
|
if (changes.some((c) => c.name === 'flavor')) {
|
|
104
33
|
this._syncCustomFlavor();
|
|
105
34
|
}
|
|
106
35
|
}
|
|
107
|
-
// ============================================================================
|
|
108
|
-
// PRIVATE METHODS
|
|
109
|
-
// ============================================================================
|
|
110
|
-
/**
|
|
111
|
-
* Build CSS class list
|
|
112
|
-
*/
|
|
113
36
|
buildClassList() {
|
|
114
37
|
const classes = [this.size];
|
|
115
38
|
if (this.disabled)
|
|
@@ -118,15 +41,11 @@ export class TyCopy extends TyComponent {
|
|
|
118
41
|
classes.push('required');
|
|
119
42
|
return classes.join(' ');
|
|
120
43
|
}
|
|
121
|
-
/**
|
|
122
|
-
* Copy value to clipboard
|
|
123
|
-
*/
|
|
124
44
|
async copyToClipboard() {
|
|
125
45
|
if (this.disabled || !this.value)
|
|
126
46
|
return;
|
|
127
47
|
try {
|
|
128
48
|
await navigator.clipboard.writeText(this.value);
|
|
129
|
-
// Emit success event
|
|
130
49
|
this.dispatchEvent(new CustomEvent('copy-success', {
|
|
131
50
|
detail: { value: this.value },
|
|
132
51
|
bubbles: true,
|
|
@@ -134,7 +53,6 @@ export class TyCopy extends TyComponent {
|
|
|
134
53
|
}));
|
|
135
54
|
}
|
|
136
55
|
catch (err) {
|
|
137
|
-
// Fallback for non-secure contexts (non-HTTPS)
|
|
138
56
|
try {
|
|
139
57
|
const textarea = document.createElement('textarea');
|
|
140
58
|
textarea.value = this.value;
|
|
@@ -161,27 +79,19 @@ export class TyCopy extends TyComponent {
|
|
|
161
79
|
return;
|
|
162
80
|
}
|
|
163
81
|
}
|
|
164
|
-
// Show success animation (after either method succeeds)
|
|
165
82
|
this.showCopySuccess();
|
|
166
83
|
}
|
|
167
|
-
/**
|
|
168
|
-
* Show copy success animation
|
|
169
|
-
* Uses state flag so render() can show the correct icon
|
|
170
|
-
*/
|
|
171
84
|
showCopySuccess() {
|
|
172
|
-
// Clear any existing timeout
|
|
173
85
|
if (this._copyTimeout !== null) {
|
|
174
86
|
clearTimeout(this._copyTimeout);
|
|
175
87
|
}
|
|
176
88
|
this._showingSuccess = true;
|
|
177
|
-
// Update just the button without full re-render
|
|
178
89
|
const copyButton = this.shadowRoot.querySelector('.copy-button');
|
|
179
90
|
if (copyButton) {
|
|
180
91
|
copyButton.classList.add('success');
|
|
181
92
|
copyButton.innerHTML = CHECK_ICON_SVG;
|
|
182
93
|
copyButton.setAttribute('aria-label', 'Copied!');
|
|
183
94
|
}
|
|
184
|
-
// Reset after 2 seconds
|
|
185
95
|
this._copyTimeout = window.setTimeout(() => {
|
|
186
96
|
this._showingSuccess = false;
|
|
187
97
|
const btn = this.shadowRoot.querySelector('.copy-button');
|
|
@@ -193,10 +103,6 @@ export class TyCopy extends TyComponent {
|
|
|
193
103
|
this._copyTimeout = null;
|
|
194
104
|
}, 2000);
|
|
195
105
|
}
|
|
196
|
-
/**
|
|
197
|
-
* Show copy error animation
|
|
198
|
-
* Swaps copy icon → red X icon → copy icon
|
|
199
|
-
*/
|
|
200
106
|
showCopyError() {
|
|
201
107
|
if (this._copyTimeout !== null) {
|
|
202
108
|
clearTimeout(this._copyTimeout);
|
|
@@ -218,40 +124,29 @@ export class TyCopy extends TyComponent {
|
|
|
218
124
|
this._copyTimeout = null;
|
|
219
125
|
}, 2000);
|
|
220
126
|
}
|
|
221
|
-
/**
|
|
222
|
-
* Setup event listeners
|
|
223
|
-
*/
|
|
224
127
|
setupEventListeners() {
|
|
225
128
|
const shadow = this.shadowRoot;
|
|
226
129
|
const inputWrapper = shadow.querySelector('.input-wrapper');
|
|
227
130
|
const copyButton = shadow.querySelector('.copy-button');
|
|
228
|
-
// Make entire field clickable for copying
|
|
229
131
|
if (inputWrapper && !this.disabled) {
|
|
230
132
|
const wrapperEl = inputWrapper;
|
|
231
133
|
wrapperEl.addEventListener('click', (e) => {
|
|
232
|
-
// Prevent double-triggering if button was clicked
|
|
233
134
|
if (e.target === copyButton || e.target.closest('.copy-button')) {
|
|
234
135
|
return;
|
|
235
136
|
}
|
|
236
137
|
this.copyToClipboard();
|
|
237
138
|
});
|
|
238
|
-
// Add visual feedback - make it look clickable
|
|
239
139
|
wrapperEl.style.cursor = 'pointer';
|
|
240
140
|
}
|
|
241
|
-
// Button click handler
|
|
242
141
|
if (copyButton) {
|
|
243
142
|
copyButton.addEventListener('click', () => {
|
|
244
143
|
this.copyToClipboard();
|
|
245
144
|
});
|
|
246
145
|
}
|
|
247
146
|
}
|
|
248
|
-
/**
|
|
249
|
-
* Render the component
|
|
250
|
-
*/
|
|
251
147
|
render() {
|
|
252
148
|
const shadow = this.shadowRoot;
|
|
253
149
|
const classes = this.buildClassList();
|
|
254
|
-
// Determine display element based on format, multiline and scroll
|
|
255
150
|
const valueClass = [
|
|
256
151
|
'copy-field-value',
|
|
257
152
|
this.multiline ? 'multiline' : '',
|
|
@@ -277,12 +172,8 @@ export class TyCopy extends TyComponent {
|
|
|
277
172
|
</div>
|
|
278
173
|
</div>
|
|
279
174
|
`;
|
|
280
|
-
// Re-setup event listeners after render
|
|
281
175
|
this.setupEventListeners();
|
|
282
176
|
}
|
|
283
|
-
// ============================================================================
|
|
284
|
-
// PROPERTY ACCESSORS - Simple wrappers (no logic!)
|
|
285
|
-
// ============================================================================
|
|
286
177
|
get value() {
|
|
287
178
|
return this.getProperty('value');
|
|
288
179
|
}
|
|
@@ -339,9 +230,6 @@ export class TyCopy extends TyComponent {
|
|
|
339
230
|
}
|
|
340
231
|
}
|
|
341
232
|
TyCopy.formAssociated = true;
|
|
342
|
-
// ============================================================================
|
|
343
|
-
// PROPERTY CONFIGURATION - Declarative property lifecycle
|
|
344
|
-
// ============================================================================
|
|
345
233
|
TyCopy.properties = {
|
|
346
234
|
value: {
|
|
347
235
|
type: 'string',
|
|
@@ -367,9 +255,6 @@ TyCopy.properties = {
|
|
|
367
255
|
return v;
|
|
368
256
|
},
|
|
369
257
|
},
|
|
370
|
-
// Any string is accepted: built-ins get static CSS, other identifiers
|
|
371
|
-
// become custom flavors (see _syncCustomFlavor), garbage degrades to
|
|
372
|
-
// the default look.
|
|
373
258
|
flavor: {
|
|
374
259
|
type: 'string',
|
|
375
260
|
visual: true,
|
|
@@ -402,14 +287,10 @@ TyCopy.properties = {
|
|
|
402
287
|
default: false,
|
|
403
288
|
},
|
|
404
289
|
};
|
|
405
|
-
// Register the custom element
|
|
406
290
|
if (!customElements.get('ty-copy')) {
|
|
407
291
|
customElements.define('ty-copy', TyCopy);
|
|
408
292
|
}
|
|
409
|
-
// Also exposed as ty-copy-field — says what it is (a read-only field with a
|
|
410
|
-
// copy button). A constructor can only register once, hence the subclass.
|
|
411
293
|
if (!customElements.get('ty-copy-field')) {
|
|
412
294
|
customElements.define('ty-copy-field', class TyCopyField extends TyCopy {
|
|
413
295
|
});
|
|
414
296
|
}
|
|
415
|
-
//# sourceMappingURL=copy.js.map
|
|
@@ -1,50 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TyDatePicker Web Component
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* A date picker component with read-only input and calendar dropdown.
|
|
6
|
-
* Supports date-only and date+time modes with smart time input.
|
|
7
|
-
*
|
|
8
|
-
* Architecture:
|
|
9
|
-
* - Read-only input stub (displays formatted date)
|
|
10
|
-
* - Calendar dropdown (modal dialog with ty-calendar)
|
|
11
|
-
* - Optional time input (with smart digit navigation)
|
|
12
|
-
* - Form participation via ElementInternals
|
|
13
|
-
* - UTC output, local display
|
|
14
|
-
*
|
|
15
|
-
* Features:
|
|
16
|
-
* - Date selection with calendar dropdown
|
|
17
|
-
* - Optional time input with smart navigation
|
|
18
|
-
* - Form integration (works with FormData)
|
|
19
|
-
* - UTC value output for server communication
|
|
20
|
-
* - Localized display formatting (Intl API)
|
|
21
|
-
* - Clearable with clear button
|
|
22
|
-
* - Keyboard navigation (Escape to close)
|
|
23
|
-
* - Outside click handling
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```html
|
|
27
|
-
* <!-- Basic date picker -->
|
|
28
|
-
* <ty-date-picker
|
|
29
|
-
* label="Select Date"
|
|
30
|
-
* placeholder="Choose a date">
|
|
31
|
-
* </ty-date-picker>
|
|
32
|
-
*
|
|
33
|
-
* <!-- With time -->
|
|
34
|
-
* <ty-date-picker
|
|
35
|
-
* with-time="true"
|
|
36
|
-
* label="Select Date & Time">
|
|
37
|
-
* </ty-date-picker>
|
|
38
|
-
*
|
|
39
|
-
* <!-- Form integration -->
|
|
40
|
-
* <form>
|
|
41
|
-
* <ty-date-picker name="booking-date"></ty-date-picker>
|
|
42
|
-
* <button type="submit">Submit</button>
|
|
43
|
-
* </form>
|
|
44
|
-
*
|
|
45
|
-
* <!-- Pre-filled value (UTC) -->
|
|
46
|
-
* <ty-date-picker value="2024-09-21T08:30:00.000Z"></ty-date-picker>
|
|
47
|
-
* ```
|
|
2
|
+
* TyDatePicker Web Component — read-only input stub + calendar dropdown
|
|
3
|
+
* (modal <dialog>), optional time input, form participation via
|
|
4
|
+
* ElementInternals. Value is UTC; display is local.
|
|
48
5
|
*/
|
|
49
6
|
import { TyComponent } from '../base/ty-component.js';
|
|
50
7
|
import type { Flavor } from '../types/common.js';
|
|
@@ -66,17 +23,11 @@ interface DatePickerState extends DateComponents {
|
|
|
66
23
|
withTime: boolean;
|
|
67
24
|
open: boolean;
|
|
68
25
|
}
|
|
69
|
-
/**
|
|
70
|
-
* Date picker sizes
|
|
71
|
-
*/
|
|
72
26
|
type DatePickerSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
73
27
|
/**
|
|
74
28
|
* Date picker flavors (visual styles)
|
|
75
29
|
*/
|
|
76
30
|
type DatePickerFlavor = 'default' | Flavor;
|
|
77
|
-
/**
|
|
78
|
-
* Date format types
|
|
79
|
-
*/
|
|
80
31
|
type DateFormatType = 'short' | 'medium' | 'long' | 'full';
|
|
81
32
|
/**
|
|
82
33
|
* Change event detail
|
|
@@ -178,35 +129,20 @@ export declare class TyDatePicker extends TyComponent<DatePickerState> {
|
|
|
178
129
|
private _timeInput?;
|
|
179
130
|
private _localeObserver?;
|
|
180
131
|
private _customFlavorSheet;
|
|
181
|
-
/**
|
|
182
|
-
* Form-associated custom element
|
|
183
|
-
*/
|
|
184
132
|
static formAssociated: boolean;
|
|
185
133
|
constructor();
|
|
186
|
-
/**
|
|
187
|
-
* Called when component connects to DOM
|
|
188
|
-
* TyComponent handles property capture automatically
|
|
189
|
-
*/
|
|
134
|
+
/** TyComponent handles property capture automatically. */
|
|
190
135
|
protected onConnect(): void;
|
|
191
136
|
/** Custom (non-built-in) flavors — see utils/flavor-sheet.ts. */
|
|
192
137
|
private _syncCustomFlavor;
|
|
193
|
-
/**
|
|
194
|
-
* Called when component disconnects from DOM
|
|
195
|
-
*/
|
|
196
138
|
protected onDisconnect(): void;
|
|
197
|
-
/**
|
|
198
|
-
* Called when properties change
|
|
199
|
-
* Handle state updates BEFORE render
|
|
200
|
-
*/
|
|
139
|
+
/** Handle state updates BEFORE render. */
|
|
201
140
|
protected onPropertiesChanged(changes: PropertyChange[]): void;
|
|
202
141
|
/**
|
|
203
142
|
* Get form value - returns UTC string from current state
|
|
204
143
|
* TyComponent calls this automatically when value property changes
|
|
205
144
|
*/
|
|
206
145
|
protected getFormValue(): FormDataEntryValue | null;
|
|
207
|
-
/**
|
|
208
|
-
* Extract current date components from internal state
|
|
209
|
-
*/
|
|
210
146
|
private getComponents;
|
|
211
147
|
/**
|
|
212
148
|
* Whether internal state has a complete date
|
|
@@ -218,15 +154,8 @@ export declare class TyDatePicker extends TyComponent<DatePickerState> {
|
|
|
218
154
|
private getFormattedValue;
|
|
219
155
|
/**
|
|
220
156
|
* Initialize component state from attributes
|
|
221
|
-
*
|
|
222
|
-
* PORTED FROM: init-component-state! in date_picker.cljs
|
|
223
157
|
*/
|
|
224
158
|
private initializeState;
|
|
225
|
-
/**
|
|
226
|
-
* Update internal state
|
|
227
|
-
*
|
|
228
|
-
* PORTED FROM: update-component-state! in date_picker.cljs
|
|
229
|
-
*/
|
|
230
159
|
private updateState;
|
|
231
160
|
/**
|
|
232
161
|
* Sync form value with current state
|
|
@@ -235,15 +164,8 @@ export declare class TyDatePicker extends TyComponent<DatePickerState> {
|
|
|
235
164
|
private syncFormValue;
|
|
236
165
|
/**
|
|
237
166
|
* Handle time input changes from TimeInput class
|
|
238
|
-
*
|
|
239
|
-
* PORTED FROM: handle-time-change! in date_picker.cljs
|
|
240
167
|
*/
|
|
241
168
|
handleTimeInputChange(hour: number, minute: number): void;
|
|
242
|
-
/**
|
|
243
|
-
* Emit change event
|
|
244
|
-
*
|
|
245
|
-
* PORTED FROM: emit-change-event! in date_picker.cljs
|
|
246
|
-
*/
|
|
247
169
|
private emitChangeEvent;
|
|
248
170
|
get size(): DatePickerSize;
|
|
249
171
|
set size(v: DatePickerSize);
|
|
@@ -289,33 +211,10 @@ export declare class TyDatePicker extends TyComponent<DatePickerState> {
|
|
|
289
211
|
* without needing the built-in clear button. Mirrors ty-select's clear().
|
|
290
212
|
*/
|
|
291
213
|
clear(): void;
|
|
292
|
-
/**
|
|
293
|
-
* Build CSS classes for the stub element
|
|
294
|
-
*
|
|
295
|
-
* PORTED FROM: build-stub-classes in date_picker.cljs
|
|
296
|
-
*/
|
|
297
214
|
private buildStubClasses;
|
|
298
|
-
/**
|
|
299
|
-
* Render the date picker stub (input display)
|
|
300
|
-
*
|
|
301
|
-
* PORTED FROM: render-date-picker-stub in date_picker.cljs
|
|
302
|
-
*/
|
|
303
215
|
private renderStub;
|
|
304
|
-
/**
|
|
305
|
-
* Create time input element
|
|
306
|
-
*
|
|
307
|
-
* PORTED FROM: create-time-input in date_picker.cljs
|
|
308
|
-
*/
|
|
309
216
|
private createTimeInputElement;
|
|
310
|
-
/**
|
|
311
|
-
* Render time input section
|
|
312
|
-
*/
|
|
313
217
|
private renderTimeSection;
|
|
314
|
-
/**
|
|
315
|
-
* Render calendar dropdown with dialog
|
|
316
|
-
*
|
|
317
|
-
* PORTED FROM: render-calendar-dropdown in date_picker.cljs
|
|
318
|
-
*/
|
|
319
218
|
private renderCalendarDropdown;
|
|
320
219
|
/**
|
|
321
220
|
* Render native date input for mobile touch devices.
|
|
@@ -323,33 +222,13 @@ export declare class TyDatePicker extends TyComponent<DatePickerState> {
|
|
|
323
222
|
* Reuses .date-picker-stub styling and existing event/state infrastructure.
|
|
324
223
|
*/
|
|
325
224
|
private renderNativeInput;
|
|
326
|
-
/**
|
|
327
|
-
* Calculate calendar position
|
|
328
|
-
*
|
|
329
|
-
* PORTED FROM: calculate-calendar-position! in date_picker.cljs
|
|
330
|
-
*/
|
|
331
225
|
private calculateCalendarPosition;
|
|
332
|
-
/**
|
|
333
|
-
* Render container structure
|
|
334
|
-
*
|
|
335
|
-
* PORTED FROM: render-container-structure in date_picker.cljs
|
|
336
|
-
*/
|
|
337
226
|
private renderContainer;
|
|
338
|
-
/**
|
|
339
|
-
* Main render method
|
|
340
|
-
*
|
|
341
|
-
* PORTED FROM: render! in date_picker.cljs
|
|
342
|
-
*/
|
|
343
227
|
protected render(): void;
|
|
344
228
|
/**
|
|
345
229
|
* Update display without destroying DOM (for open dialog)
|
|
346
|
-
*
|
|
347
|
-
* PORTED FROM: update-display! in date_picker.cljs
|
|
348
230
|
*/
|
|
349
231
|
private updateDisplay;
|
|
350
|
-
/**
|
|
351
|
-
* Setup document-level event listeners
|
|
352
|
-
*/
|
|
353
232
|
private setupEventListeners;
|
|
354
233
|
private handleStubClick;
|
|
355
234
|
/**
|
|
@@ -357,48 +236,12 @@ export declare class TyDatePicker extends TyComponent<DatePickerState> {
|
|
|
357
236
|
*/
|
|
358
237
|
private clearValue;
|
|
359
238
|
private handleClearClick;
|
|
360
|
-
/**
|
|
361
|
-
* Handle calendar date selection
|
|
362
|
-
*
|
|
363
|
-
* PORTED FROM: handle-calendar-change! in date_picker.cljs
|
|
364
|
-
*/
|
|
365
239
|
private handleCalendarChange;
|
|
366
|
-
/**
|
|
367
|
-
* Handle dialog backdrop clicks
|
|
368
|
-
*
|
|
369
|
-
* PORTED FROM: handle-dialog-click! in date_picker.cljs
|
|
370
|
-
*/
|
|
371
240
|
private handleDialogClick;
|
|
372
|
-
/**
|
|
373
|
-
* Handle clicks outside the date picker
|
|
374
|
-
*
|
|
375
|
-
* PORTED FROM: handle-outside-click! in date_picker.cljs
|
|
376
|
-
*/
|
|
377
241
|
private handleOutsideClick;
|
|
378
|
-
/**
|
|
379
|
-
* Handle Escape key press
|
|
380
|
-
*
|
|
381
|
-
* PORTED FROM: handle-escape-key! in date_picker.cljs
|
|
382
|
-
*/
|
|
383
242
|
private handleEscapeKey;
|
|
384
|
-
/**
|
|
385
|
-
* Open calendar dropdown
|
|
386
|
-
*
|
|
387
|
-
* PORTED FROM: open-dropdown! in date_picker.cljs
|
|
388
|
-
*/
|
|
389
243
|
private openDropdown;
|
|
390
|
-
/**
|
|
391
|
-
* Close calendar dropdown
|
|
392
|
-
*
|
|
393
|
-
* PORTED FROM: close-dropdown! in date_picker.cljs
|
|
394
|
-
*/
|
|
395
244
|
private closeDropdown;
|
|
396
|
-
/**
|
|
397
|
-
* Clean up event listeners and state
|
|
398
|
-
*
|
|
399
|
-
* PORTED FROM: cleanup! in date_picker.cljs
|
|
400
|
-
*/
|
|
401
245
|
private cleanup;
|
|
402
246
|
}
|
|
403
247
|
export {};
|
|
404
|
-
//# sourceMappingURL=date-picker.d.ts.map
|