tyrell-components 1.0.0-RC14 → 1.0.0-RC15

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.
Files changed (113) hide show
  1. package/README.md +9 -1
  2. package/css/tyrell-theme.css +25 -2
  3. package/css/tyrell.css +4 -0
  4. package/dist/tyrell-colors-static.css +1 -316
  5. package/dist/tyrell-theme.css +1 -1443
  6. package/dist/tyrell.css +1 -1390
  7. package/dist/tyrell.js +1 -1
  8. package/lib/base/ty-component.js +196 -196
  9. package/lib/components/button.d.ts +1 -1
  10. package/lib/components/button.js +261 -259
  11. package/lib/components/calendar-month.d.ts +2 -2
  12. package/lib/components/calendar-month.js +439 -416
  13. package/lib/components/calendar-navigation.js +238 -238
  14. package/lib/components/calendar.d.ts +5 -3
  15. package/lib/components/calendar.js +611 -602
  16. package/lib/components/checkbox.d.ts +1 -1
  17. package/lib/components/checkbox.js +273 -272
  18. package/lib/components/copy.d.ts +1 -1
  19. package/lib/components/copy.js +280 -278
  20. package/lib/components/date-picker.d.ts +8 -1
  21. package/lib/components/date-picker.js +1128 -1108
  22. package/lib/components/file-upload.js +404 -404
  23. package/lib/components/icon.js +141 -141
  24. package/lib/components/input.d.ts +1 -1
  25. package/lib/components/input.js +593 -596
  26. package/lib/components/modal.js +319 -319
  27. package/lib/components/option.js +167 -167
  28. package/lib/components/popup.js +233 -233
  29. package/lib/components/radio.d.ts +2 -2
  30. package/lib/components/radio.js +407 -406
  31. package/lib/components/resize-observer.js +67 -67
  32. package/lib/components/scroll-container.js +292 -294
  33. package/lib/components/select.d.ts +71 -12
  34. package/lib/components/select.js +1605 -1529
  35. package/lib/components/selected-tags.d.ts +1 -1
  36. package/lib/components/selected-tags.js +188 -182
  37. package/lib/components/step.js +62 -62
  38. package/lib/components/switch.d.ts +1 -1
  39. package/lib/components/switch.js +214 -213
  40. package/lib/components/tab.js +62 -62
  41. package/lib/components/tabs.d.ts +1 -0
  42. package/lib/components/tabs.js +523 -492
  43. package/lib/components/tag.d.ts +1 -1
  44. package/lib/components/tag.js +236 -235
  45. package/lib/components/textarea.d.ts +1 -1
  46. package/lib/components/textarea.js +457 -456
  47. package/lib/components/tooltip.js +283 -283
  48. package/lib/components/wizard.js +384 -384
  49. package/lib/icons/heroicons/micro.js +392 -392
  50. package/lib/icons/heroicons/mini.js +382 -382
  51. package/lib/icons/heroicons/outline.js +337 -337
  52. package/lib/icons/heroicons/solid.js +407 -407
  53. package/lib/icons/lucide.js +22843 -22843
  54. package/lib/icons/material/filled.js +9653 -9653
  55. package/lib/icons/material/outlined.js +10271 -10271
  56. package/lib/icons/material/round.js +10495 -10495
  57. package/lib/icons/material/sharp.js +9905 -9905
  58. package/lib/icons/material/two-tone.js +12792 -12792
  59. package/lib/index.js +21 -21
  60. package/lib/styles/button.js +200 -302
  61. package/lib/styles/calendar-month.js +123 -183
  62. package/lib/styles/calendar-navigation.d.ts +1 -1
  63. package/lib/styles/calendar-navigation.js +64 -79
  64. package/lib/styles/calendar.d.ts +1 -1
  65. package/lib/styles/calendar.js +9 -9
  66. package/lib/styles/checkbox.js +45 -72
  67. package/lib/styles/copy.js +67 -91
  68. package/lib/styles/custom-scrollbar.js +80 -100
  69. package/lib/styles/date-picker.js +261 -331
  70. package/lib/styles/field-size.d.ts +6 -0
  71. package/lib/styles/field-size.js +91 -0
  72. package/lib/styles/file-upload.js +139 -169
  73. package/lib/styles/icon.js +92 -156
  74. package/lib/styles/input.js +125 -241
  75. package/lib/styles/modal.js +67 -102
  76. package/lib/styles/option.d.ts +1 -1
  77. package/lib/styles/option.js +47 -67
  78. package/lib/styles/popup.js +34 -65
  79. package/lib/styles/radio.js +69 -96
  80. package/lib/styles/resize-observer.js +2 -5
  81. package/lib/styles/scroll-container.js +100 -130
  82. package/lib/styles/select-base.js +596 -773
  83. package/lib/styles/select.js +140 -228
  84. package/lib/styles/step.js +22 -29
  85. package/lib/styles/switch.js +34 -55
  86. package/lib/styles/tab.d.ts +1 -1
  87. package/lib/styles/tab.js +22 -29
  88. package/lib/styles/tabs.d.ts +1 -1
  89. package/lib/styles/tabs.js +186 -180
  90. package/lib/styles/tag.js +135 -188
  91. package/lib/styles/textarea.d.ts +1 -1
  92. package/lib/styles/textarea.js +205 -271
  93. package/lib/styles/tooltip.js +3 -3
  94. package/lib/styles/wizard.js +170 -226
  95. package/lib/types/common.d.ts +2 -0
  96. package/lib/types/common.js +6 -5
  97. package/lib/utils/calendar-utils.js +100 -100
  98. package/lib/utils/custom-scrollbar.js +272 -272
  99. package/lib/utils/flavor-sheet.js +14 -14
  100. package/lib/utils/icon-registry.js +127 -127
  101. package/lib/utils/loader-registry.js +3 -3
  102. package/lib/utils/locale.js +34 -34
  103. package/lib/utils/mobile.js +1 -1
  104. package/lib/utils/number-format.js +54 -54
  105. package/lib/utils/positioning.js +212 -212
  106. package/lib/utils/property-capture.js +36 -36
  107. package/lib/utils/property-manager.js +125 -125
  108. package/lib/utils/resize-observer.js +23 -23
  109. package/lib/utils/scroll-lock.js +57 -57
  110. package/lib/utils/styles.js +17 -17
  111. package/lib/version.d.ts +1 -1
  112. package/lib/version.js +1 -1
  113. package/package.json +4 -4
@@ -1,3 +1,4 @@
1
+ import { DEFAULT_SIZE } from '../types/common.js';
1
2
  import { TyComponent } from '../base/ty-component.js';
2
3
  import { ensureStyles } from '../utils/styles.js';
3
4
  import { syncCustomFlavorSheet } from '../utils/flavor-sheet.js';
@@ -8,289 +9,290 @@ const CHECK_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="24" heigh
8
9
  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>`;
9
10
  import { REQUIRED_ICON_SVG } from '../utils/icons.js';
10
11
  export class TyCopy extends TyComponent {
11
- constructor() {
12
- super();
13
- this._copyTimeout = null;
14
- this._showingSuccess = false;
15
- this._customFlavorSheet = null;
16
- ensureStyles(this.shadowRoot, { css: inputStyles, id: 'ty-input' });
17
- ensureStyles(this.shadowRoot, { css: copyStyles, id: 'ty-copy' });
18
- }
19
- onConnect() {
20
- this._syncCustomFlavor();
21
- }
22
- _syncCustomFlavor() {
23
- this._customFlavorSheet = syncCustomFlavorSheet(this.shadowRoot, this._customFlavorSheet, this.flavor, ({ base }) => copyCustomFlavorCss(base));
24
- }
25
- onDisconnect() {
26
- if (this._copyTimeout !== null) {
27
- clearTimeout(this._copyTimeout);
28
- this._copyTimeout = null;
29
- }
30
- }
31
- onPropertiesChanged(changes) {
32
- if (changes.some((c) => c.name === 'flavor')) {
33
- this._syncCustomFlavor();
34
- }
35
- }
36
- buildClassList() {
37
- const classes = [this.size];
38
- if (this.disabled)
39
- classes.push('disabled');
40
- if (this.required)
41
- classes.push('required');
42
- return classes.join(' ');
43
- }
44
- async copyToClipboard() {
45
- if (this.disabled || !this.value)
46
- return;
47
- try {
48
- await navigator.clipboard.writeText(this.value);
49
- this.dispatchEvent(new CustomEvent('copy-success', {
50
- detail: { value: this.value },
51
- bubbles: true,
52
- composed: true
53
- }));
54
- }
55
- catch (err) {
56
- try {
57
- const textarea = document.createElement('textarea');
58
- textarea.value = this.value;
59
- textarea.style.position = 'fixed';
60
- textarea.style.opacity = '0';
61
- document.body.appendChild(textarea);
62
- textarea.select();
63
- document.execCommand('copy');
64
- document.body.removeChild(textarea);
65
- this.dispatchEvent(new CustomEvent('copy-success', {
66
- detail: { value: this.value },
67
- bubbles: true,
68
- composed: true
69
- }));
70
- }
71
- catch (fallbackErr) {
72
- console.error('[ty-copy] Failed to copy:', fallbackErr);
73
- this.dispatchEvent(new CustomEvent('copy-error', {
74
- detail: { error: fallbackErr },
75
- bubbles: true,
76
- composed: true
77
- }));
78
- this.showCopyError();
79
- return;
80
- }
81
- }
82
- this.showCopySuccess();
83
- }
84
- showCopySuccess() {
85
- if (this._copyTimeout !== null) {
86
- clearTimeout(this._copyTimeout);
87
- }
88
- this._showingSuccess = true;
89
- const copyButton = this.shadowRoot.querySelector('.copy-button');
90
- if (copyButton) {
91
- copyButton.classList.add('success');
92
- copyButton.innerHTML = CHECK_ICON_SVG;
93
- copyButton.setAttribute('aria-label', 'Copied!');
94
- }
95
- this._copyTimeout = window.setTimeout(() => {
96
- this._showingSuccess = false;
97
- const btn = this.shadowRoot.querySelector('.copy-button');
98
- if (btn) {
99
- btn.classList.remove('success');
100
- btn.innerHTML = COPY_ICON_SVG;
101
- btn.setAttribute('aria-label', 'Copy to clipboard');
102
- }
103
- this._copyTimeout = null;
104
- }, 2000);
105
- }
106
- showCopyError() {
107
- if (this._copyTimeout !== null) {
108
- clearTimeout(this._copyTimeout);
109
- }
110
- this._showingSuccess = false;
111
- const copyButton = this.shadowRoot.querySelector('.copy-button');
112
- if (copyButton) {
113
- copyButton.classList.add('error');
114
- copyButton.innerHTML = ERROR_ICON_SVG;
115
- copyButton.setAttribute('aria-label', 'Copy failed');
116
- }
117
- this._copyTimeout = window.setTimeout(() => {
118
- const btn = this.shadowRoot.querySelector('.copy-button');
119
- if (btn) {
120
- btn.classList.remove('error');
121
- btn.innerHTML = COPY_ICON_SVG;
122
- btn.setAttribute('aria-label', 'Copy to clipboard');
123
- }
124
- this._copyTimeout = null;
125
- }, 2000);
126
- }
127
- setupEventListeners() {
128
- const shadow = this.shadowRoot;
129
- const inputWrapper = shadow.querySelector('.input-wrapper');
130
- const copyButton = shadow.querySelector('.copy-button');
131
- if (inputWrapper && !this.disabled) {
132
- const wrapperEl = inputWrapper;
133
- wrapperEl.addEventListener('click', (e) => {
134
- if (e.target === copyButton || e.target.closest('.copy-button')) {
135
- return;
136
- }
137
- this.copyToClipboard();
138
- });
139
- wrapperEl.style.cursor = 'pointer';
140
- }
141
- if (copyButton) {
142
- copyButton.addEventListener('click', () => {
143
- this.copyToClipboard();
144
- });
145
- }
146
- }
147
- render() {
148
- const shadow = this.shadowRoot;
149
- const classes = this.buildClassList();
150
- const valueClass = [
151
- 'copy-field-value',
152
- this.multiline ? 'multiline' : '',
153
- this.horizontalScroll ? 'horizontal-scroll' : '',
154
- ].filter(Boolean).join(' ');
155
- const displayElement = this.format === 'code'
156
- ? `<code class="${valueClass}">${this.value || ''}</code>`
157
- : `<div class="${valueClass}">${this.value || ''}</div>`;
158
- const labelHtml = this.label ? `
159
- <label class="ty-field-label">
160
- ${this.label}
161
- ${this.required ? `<span class="required-icon">${REQUIRED_ICON_SVG}</span>` : ''}
162
- </label>
163
- ` : '';
164
- shadow.innerHTML = `
165
- <div class="input-container">
166
- ${labelHtml}
167
- <div class="input-wrapper ${classes}">
168
- ${displayElement}
169
- <button class="copy-button${this._showingSuccess ? ' success' : ''}" type="button" aria-label="${this._showingSuccess ? 'Copied!' : 'Copy to clipboard'}" ${this.disabled ? 'disabled' : ''}>
170
- ${this._showingSuccess ? CHECK_ICON_SVG : COPY_ICON_SVG}
171
- </button>
172
- </div>
173
- </div>
174
- `;
175
- this.setupEventListeners();
176
- }
177
- get value() {
178
- return this.getProperty('value');
179
- }
180
- set value(val) {
181
- this.setProperty('value', val);
182
- }
183
- get label() {
184
- return this.getProperty('label');
185
- }
186
- set label(val) {
187
- this.setProperty('label', val);
188
- }
189
- get size() {
190
- return this.getProperty('size');
191
- }
192
- set size(value) {
193
- this.setProperty('size', value);
194
- }
195
- get flavor() {
196
- return this.getProperty('flavor');
197
- }
198
- set flavor(value) {
199
- this.setProperty('flavor', value);
200
- }
201
- get format() {
202
- return this.getProperty('format');
203
- }
204
- set format(value) {
205
- this.setProperty('format', value);
206
- }
207
- get multiline() {
208
- return this.getProperty('multiline');
209
- }
210
- set multiline(value) {
211
- this.setProperty('multiline', value);
212
- }
213
- get horizontalScroll() {
214
- return this.getProperty('horizontalScroll');
215
- }
216
- set horizontalScroll(value) {
217
- this.setProperty('horizontalScroll', value);
218
- }
219
- get disabled() {
220
- return this.getProperty('disabled');
221
- }
222
- set disabled(value) {
223
- this.setProperty('disabled', value);
224
- }
225
- get required() {
226
- return this.getProperty('required');
227
- }
228
- set required(value) {
229
- this.setProperty('required', value);
230
- }
12
+ constructor() {
13
+ super();
14
+ this._copyTimeout = null;
15
+ this._showingSuccess = false;
16
+ this._customFlavorSheet = null;
17
+ ensureStyles(this.shadowRoot, { css: inputStyles, id: 'ty-input' });
18
+ ensureStyles(this.shadowRoot, { css: copyStyles, id: 'ty-copy' });
19
+ }
20
+ onConnect() {
21
+ this._syncCustomFlavor();
22
+ }
23
+ _syncCustomFlavor() {
24
+ this._customFlavorSheet = syncCustomFlavorSheet(this.shadowRoot, this._customFlavorSheet, this.flavor, ({ base }) => copyCustomFlavorCss(base));
25
+ }
26
+ onDisconnect() {
27
+ if (this._copyTimeout !== null) {
28
+ clearTimeout(this._copyTimeout);
29
+ this._copyTimeout = null;
30
+ }
31
+ }
32
+ onPropertiesChanged(changes) {
33
+ if (changes.some((c) => c.name === 'flavor')) {
34
+ this._syncCustomFlavor();
35
+ }
36
+ }
37
+ buildClassList() {
38
+ const classes = [];
39
+ if (this.disabled)
40
+ classes.push('disabled');
41
+ if (this.required)
42
+ classes.push('required');
43
+ return classes.join(' ');
44
+ }
45
+ async copyToClipboard() {
46
+ if (this.disabled || !this.value)
47
+ return;
48
+ const value = this.value;
49
+ try {
50
+ await navigator.clipboard.writeText(value);
51
+ this.dispatchEvent(new CustomEvent('copy-success', {
52
+ detail: { value },
53
+ bubbles: true,
54
+ composed: true
55
+ }));
56
+ }
57
+ catch (err) {
58
+ try {
59
+ const textarea = document.createElement('textarea');
60
+ textarea.value = value;
61
+ textarea.style.position = 'fixed';
62
+ textarea.style.opacity = '0';
63
+ document.body.appendChild(textarea);
64
+ textarea.select();
65
+ document.execCommand('copy');
66
+ document.body.removeChild(textarea);
67
+ this.dispatchEvent(new CustomEvent('copy-success', {
68
+ detail: { value },
69
+ bubbles: true,
70
+ composed: true
71
+ }));
72
+ }
73
+ catch (fallbackErr) {
74
+ console.error('[ty-copy] Failed to copy:', fallbackErr);
75
+ this.dispatchEvent(new CustomEvent('copy-error', {
76
+ detail: { error: fallbackErr },
77
+ bubbles: true,
78
+ composed: true
79
+ }));
80
+ this.showCopyError();
81
+ return;
82
+ }
83
+ }
84
+ this.showCopySuccess();
85
+ }
86
+ showCopySuccess() {
87
+ if (this._copyTimeout !== null) {
88
+ clearTimeout(this._copyTimeout);
89
+ }
90
+ this._showingSuccess = true;
91
+ const copyButton = this.shadowRoot.querySelector('.copy-button');
92
+ if (copyButton) {
93
+ copyButton.classList.add('success');
94
+ copyButton.innerHTML = CHECK_ICON_SVG;
95
+ copyButton.setAttribute('aria-label', 'Copied!');
96
+ }
97
+ this._copyTimeout = window.setTimeout(() => {
98
+ this._showingSuccess = false;
99
+ const btn = this.shadowRoot.querySelector('.copy-button');
100
+ if (btn) {
101
+ btn.classList.remove('success');
102
+ btn.innerHTML = COPY_ICON_SVG;
103
+ btn.setAttribute('aria-label', 'Copy to clipboard');
104
+ }
105
+ this._copyTimeout = null;
106
+ }, 2000);
107
+ }
108
+ showCopyError() {
109
+ if (this._copyTimeout !== null) {
110
+ clearTimeout(this._copyTimeout);
111
+ }
112
+ this._showingSuccess = false;
113
+ const copyButton = this.shadowRoot.querySelector('.copy-button');
114
+ if (copyButton) {
115
+ copyButton.classList.add('error');
116
+ copyButton.innerHTML = ERROR_ICON_SVG;
117
+ copyButton.setAttribute('aria-label', 'Copy failed');
118
+ }
119
+ this._copyTimeout = window.setTimeout(() => {
120
+ const btn = this.shadowRoot.querySelector('.copy-button');
121
+ if (btn) {
122
+ btn.classList.remove('error');
123
+ btn.innerHTML = COPY_ICON_SVG;
124
+ btn.setAttribute('aria-label', 'Copy to clipboard');
125
+ }
126
+ this._copyTimeout = null;
127
+ }, 2000);
128
+ }
129
+ setupEventListeners() {
130
+ const shadow = this.shadowRoot;
131
+ const inputWrapper = shadow.querySelector('.input-wrapper');
132
+ const copyButton = shadow.querySelector('.copy-button');
133
+ if (inputWrapper && !this.disabled) {
134
+ const wrapperEl = inputWrapper;
135
+ wrapperEl.addEventListener('click', (e) => {
136
+ if (e.target === copyButton || e.target.closest('.copy-button')) {
137
+ return;
138
+ }
139
+ this.copyToClipboard();
140
+ });
141
+ wrapperEl.style.cursor = 'pointer';
142
+ }
143
+ if (copyButton) {
144
+ copyButton.addEventListener('click', () => {
145
+ this.copyToClipboard();
146
+ });
147
+ }
148
+ }
149
+ render() {
150
+ const shadow = this.shadowRoot;
151
+ const classes = this.buildClassList();
152
+ const valueClass = [
153
+ 'copy-field-value',
154
+ this.multiline ? 'multiline' : '',
155
+ this.horizontalScroll ? 'horizontal-scroll' : '',
156
+ ].filter(Boolean).join(' ');
157
+ const displayElement = this.format === 'code'
158
+ ? `<code class="${valueClass}">${this.value || ''}</code>`
159
+ : `<div class="${valueClass}">${this.value || ''}</div>`;
160
+ const labelHtml = this.label ? `
161
+ <label class="ty-field-label">
162
+ ${this.label}
163
+ ${this.required ? `<span class="required-icon">${REQUIRED_ICON_SVG}</span>` : ''}
164
+ </label>
165
+ ` : '';
166
+ shadow.innerHTML = `
167
+ <div class="input-container">
168
+ ${labelHtml}
169
+ <div class="input-wrapper ${classes}">
170
+ ${displayElement}
171
+ <button class="copy-button${this._showingSuccess ? ' success' : ''}" type="button" aria-label="${this._showingSuccess ? 'Copied!' : 'Copy to clipboard'}" ${this.disabled ? 'disabled' : ''}>
172
+ ${this._showingSuccess ? CHECK_ICON_SVG : COPY_ICON_SVG}
173
+ </button>
174
+ </div>
175
+ </div>
176
+ `;
177
+ this.setupEventListeners();
178
+ }
179
+ get value() {
180
+ return this.getProperty('value');
181
+ }
182
+ set value(val) {
183
+ this.setProperty('value', val);
184
+ }
185
+ get label() {
186
+ return this.getProperty('label');
187
+ }
188
+ set label(val) {
189
+ this.setProperty('label', val);
190
+ }
191
+ get size() {
192
+ return this.getProperty('size');
193
+ }
194
+ set size(value) {
195
+ this.setProperty('size', value);
196
+ }
197
+ get flavor() {
198
+ return this.getProperty('flavor');
199
+ }
200
+ set flavor(value) {
201
+ this.setProperty('flavor', value);
202
+ }
203
+ get format() {
204
+ return this.getProperty('format');
205
+ }
206
+ set format(value) {
207
+ this.setProperty('format', value);
208
+ }
209
+ get multiline() {
210
+ return this.getProperty('multiline');
211
+ }
212
+ set multiline(value) {
213
+ this.setProperty('multiline', value);
214
+ }
215
+ get horizontalScroll() {
216
+ return this.getProperty('horizontalScroll');
217
+ }
218
+ set horizontalScroll(value) {
219
+ this.setProperty('horizontalScroll', value);
220
+ }
221
+ get disabled() {
222
+ return this.getProperty('disabled');
223
+ }
224
+ set disabled(value) {
225
+ this.setProperty('disabled', value);
226
+ }
227
+ get required() {
228
+ return this.getProperty('required');
229
+ }
230
+ set required(value) {
231
+ this.setProperty('required', value);
232
+ }
231
233
  }
232
234
  TyCopy.formAssociated = true;
233
235
  TyCopy.properties = {
234
- value: {
235
- type: 'string',
236
- visual: true,
237
- formValue: true,
238
- default: '',
239
- },
240
- label: {
241
- type: 'string',
242
- visual: true,
243
- default: '',
244
- },
245
- size: {
246
- type: 'string',
247
- visual: true,
248
- default: 'md',
249
- validate: (v) => ['xs', 'sm', 'md', 'lg', 'xl'].includes(v),
250
- coerce: (v) => {
251
- if (!['xs', 'sm', 'md', 'lg', 'xl'].includes(v)) {
252
- console.warn(`[ty-copy] Invalid size '${v}'. Using 'md'.`);
253
- return 'md';
254
- }
255
- return v;
256
- },
257
- },
258
- flavor: {
259
- type: 'string',
260
- visual: true,
261
- default: 'neutral',
262
- },
263
- format: {
264
- type: 'string',
265
- visual: true,
266
- default: 'text',
267
- coerce: (v) => (v === 'code' ? 'code' : 'text'),
268
- },
269
- multiline: {
270
- type: 'boolean',
271
- visual: true,
272
- default: false,
273
- },
274
- horizontalScroll: {
275
- type: 'boolean',
276
- visual: true,
277
- default: false,
278
- },
279
- disabled: {
280
- type: 'boolean',
281
- visual: true,
282
- default: false,
283
- },
284
- required: {
285
- type: 'boolean',
286
- visual: true,
287
- default: false,
288
- },
236
+ value: {
237
+ type: 'string',
238
+ visual: true,
239
+ formValue: true,
240
+ default: '',
241
+ },
242
+ label: {
243
+ type: 'string',
244
+ visual: true,
245
+ default: '',
246
+ },
247
+ size: {
248
+ type: 'string',
249
+ visual: true,
250
+ default: DEFAULT_SIZE,
251
+ validate: (v) => ['xs', 'sm', 'md', 'lg', 'xl'].includes(v),
252
+ coerce: (v) => {
253
+ if (!['xs', 'sm', 'md', 'lg', 'xl'].includes(v)) {
254
+ console.warn(`[ty-copy] Invalid size '${v}'. Using '${DEFAULT_SIZE}'.`);
255
+ return DEFAULT_SIZE;
256
+ }
257
+ return v;
258
+ },
259
+ },
260
+ flavor: {
261
+ type: 'string',
262
+ visual: true,
263
+ default: 'neutral',
264
+ },
265
+ format: {
266
+ type: 'string',
267
+ visual: true,
268
+ default: 'text',
269
+ coerce: (v) => (v === 'code' ? 'code' : 'text'),
270
+ },
271
+ multiline: {
272
+ type: 'boolean',
273
+ visual: true,
274
+ default: false,
275
+ },
276
+ horizontalScroll: {
277
+ type: 'boolean',
278
+ visual: true,
279
+ default: false,
280
+ },
281
+ disabled: {
282
+ type: 'boolean',
283
+ visual: true,
284
+ default: false,
285
+ },
286
+ required: {
287
+ type: 'boolean',
288
+ visual: true,
289
+ default: false,
290
+ },
289
291
  };
290
292
  if (!customElements.get('ty-copy')) {
291
- customElements.define('ty-copy', TyCopy);
293
+ customElements.define('ty-copy', TyCopy);
292
294
  }
293
295
  if (!customElements.get('ty-copy-field')) {
294
- customElements.define('ty-copy-field', class TyCopyField extends TyCopy {
295
- });
296
+ customElements.define('ty-copy-field', class TyCopyField extends TyCopy {
297
+ });
296
298
  }
@@ -50,7 +50,7 @@ export declare class TyDatePicker extends TyComponent<DatePickerState> {
50
50
  size: {
51
51
  type: "string";
52
52
  visual: boolean;
53
- default: string;
53
+ default: import("../types/common.js").Size;
54
54
  validate: (v: any) => boolean;
55
55
  coerce: (v: any) => any;
56
56
  };
@@ -168,6 +168,13 @@ export declare class TyDatePicker extends TyComponent<DatePickerState> {
168
168
  * Compares before setting to prevent circular triggers
169
169
  */
170
170
  private syncFormValue;
171
+ /**
172
+ * Reflect constraint validation to the owning <form> via ElementInternals.
173
+ * Without this `required` is only cosmetic — unlike ty-input/ty-select/
174
+ * ty-calendar, which all call setValidity, an empty required date-picker
175
+ * never blocks form submission.
176
+ */
177
+ private updateValidity;
171
178
  /**
172
179
  * Handle time input changes from TimeInput class
173
180
  */