tyrell-components 1.0.0-TC51 → 1.0.0-TC53

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 (108) hide show
  1. package/css/tyrell-theme.css +25 -2
  2. package/css/tyrell.css +4 -0
  3. package/dist/tyrell-colors-static.css +1 -316
  4. package/dist/tyrell-theme.css +1 -1443
  5. package/dist/tyrell.css +1 -1390
  6. package/dist/tyrell.js +1 -1
  7. package/lib/base/ty-component.js +196 -196
  8. package/lib/components/button.d.ts +1 -1
  9. package/lib/components/button.js +260 -259
  10. package/lib/components/calendar-month.d.ts +2 -2
  11. package/lib/components/calendar-month.js +426 -416
  12. package/lib/components/calendar-navigation.js +238 -238
  13. package/lib/components/calendar.js +605 -602
  14. package/lib/components/checkbox.d.ts +1 -1
  15. package/lib/components/checkbox.js +273 -272
  16. package/lib/components/copy.d.ts +1 -1
  17. package/lib/components/copy.js +279 -278
  18. package/lib/components/date-picker.d.ts +1 -1
  19. package/lib/components/date-picker.js +1103 -1108
  20. package/lib/components/file-upload.js +404 -404
  21. package/lib/components/icon.js +141 -141
  22. package/lib/components/input.d.ts +1 -1
  23. package/lib/components/input.js +593 -596
  24. package/lib/components/modal.js +319 -319
  25. package/lib/components/option.js +167 -167
  26. package/lib/components/popup.js +233 -233
  27. package/lib/components/radio.d.ts +2 -2
  28. package/lib/components/radio.js +407 -406
  29. package/lib/components/resize-observer.js +67 -67
  30. package/lib/components/scroll-container.js +294 -294
  31. package/lib/components/select.d.ts +1 -1
  32. package/lib/components/select.js +1524 -1532
  33. package/lib/components/selected-tags.js +184 -184
  34. package/lib/components/step.js +62 -62
  35. package/lib/components/switch.d.ts +1 -1
  36. package/lib/components/switch.js +214 -213
  37. package/lib/components/tab.js +62 -62
  38. package/lib/components/tabs.d.ts +1 -0
  39. package/lib/components/tabs.js +507 -479
  40. package/lib/components/tag.d.ts +1 -1
  41. package/lib/components/tag.js +236 -235
  42. package/lib/components/textarea.d.ts +1 -1
  43. package/lib/components/textarea.js +457 -456
  44. package/lib/components/tooltip.js +283 -283
  45. package/lib/components/wizard.js +384 -384
  46. package/lib/icons/heroicons/micro.js +392 -392
  47. package/lib/icons/heroicons/mini.js +382 -382
  48. package/lib/icons/heroicons/outline.js +337 -337
  49. package/lib/icons/heroicons/solid.js +407 -407
  50. package/lib/icons/lucide.js +22843 -22843
  51. package/lib/icons/material/filled.js +9653 -9653
  52. package/lib/icons/material/outlined.js +10271 -10271
  53. package/lib/icons/material/round.js +10495 -10495
  54. package/lib/icons/material/sharp.js +9905 -9905
  55. package/lib/icons/material/two-tone.js +12792 -12792
  56. package/lib/index.js +21 -21
  57. package/lib/styles/button.js +176 -288
  58. package/lib/styles/calendar-month.js +123 -183
  59. package/lib/styles/calendar-navigation.js +60 -79
  60. package/lib/styles/calendar.js +8 -9
  61. package/lib/styles/checkbox.js +45 -72
  62. package/lib/styles/copy.js +67 -91
  63. package/lib/styles/custom-scrollbar.js +80 -100
  64. package/lib/styles/date-picker.js +261 -331
  65. package/lib/styles/field-size.d.ts +6 -0
  66. package/lib/styles/field-size.js +91 -0
  67. package/lib/styles/file-upload.js +139 -169
  68. package/lib/styles/icon.js +92 -156
  69. package/lib/styles/input.js +125 -241
  70. package/lib/styles/modal.js +67 -102
  71. package/lib/styles/option.d.ts +1 -1
  72. package/lib/styles/option.js +47 -67
  73. package/lib/styles/popup.js +34 -65
  74. package/lib/styles/radio.js +69 -96
  75. package/lib/styles/resize-observer.js +2 -5
  76. package/lib/styles/scroll-container.js +100 -130
  77. package/lib/styles/select-base.js +525 -778
  78. package/lib/styles/select.js +140 -228
  79. package/lib/styles/step.js +22 -29
  80. package/lib/styles/switch.js +34 -55
  81. package/lib/styles/tab.d.ts +1 -1
  82. package/lib/styles/tab.js +22 -29
  83. package/lib/styles/tabs.d.ts +1 -1
  84. package/lib/styles/tabs.js +175 -237
  85. package/lib/styles/tag.js +135 -188
  86. package/lib/styles/textarea.d.ts +1 -1
  87. package/lib/styles/textarea.js +205 -271
  88. package/lib/styles/tooltip.js +3 -3
  89. package/lib/styles/wizard.js +170 -226
  90. package/lib/types/common.d.ts +2 -0
  91. package/lib/types/common.js +6 -5
  92. package/lib/utils/calendar-utils.js +100 -100
  93. package/lib/utils/custom-scrollbar.js +272 -272
  94. package/lib/utils/flavor-sheet.js +14 -14
  95. package/lib/utils/icon-registry.js +127 -127
  96. package/lib/utils/loader-registry.js +3 -3
  97. package/lib/utils/locale.js +34 -34
  98. package/lib/utils/mobile.js +1 -1
  99. package/lib/utils/number-format.js +54 -54
  100. package/lib/utils/positioning.js +212 -212
  101. package/lib/utils/property-capture.js +36 -36
  102. package/lib/utils/property-manager.js +125 -125
  103. package/lib/utils/resize-observer.js +23 -23
  104. package/lib/utils/scroll-lock.js +57 -57
  105. package/lib/utils/styles.js +17 -17
  106. package/lib/version.d.ts +1 -1
  107. package/lib/version.js +1 -1
  108. package/package.json +4 -4
@@ -1,271 +1,272 @@
1
+ import { DEFAULT_SIZE } from "../types/common.js";
1
2
  import { TyComponent } from "../base/ty-component.js";
2
3
  import { ensureStyles, buildClassList } from "../utils/styles.js";
3
4
  import { buttonStyles, buttonCustomFlavorCss } from "../styles/button.js";
4
5
  import { syncCustomFlavorSheet } from "../utils/flavor-sheet.js";
5
6
  import { getLoaderSvg } from "../utils/loader-registry.js";
6
7
  export class TyButton extends TyComponent {
7
- constructor() {
8
- super();
9
- this._structureInitialized = false;
10
- this._customFlavorSheet = null;
11
- ensureStyles(this.shadowRoot, { css: buttonStyles, id: "ty-button" });
12
- }
13
- onConnect() {
14
- this._syncCustomFlavor();
15
- }
16
- onDisconnect() { }
17
- onPropertiesChanged(changes) {
18
- if (changes.some((c) => c.name === "flavor")) {
19
- this._syncCustomFlavor();
20
- }
21
- }
22
- _syncCustomFlavor() {
23
- const { base } = this.parseFlavor();
24
- this._customFlavorSheet = syncCustomFlavorSheet(this.shadowRoot, this._customFlavorSheet, base, () => buttonCustomFlavorCss(base));
25
- }
26
- get flavor() {
27
- return this.getProperty("flavor");
28
- }
29
- set flavor(value) {
30
- this.setProperty("flavor", value);
31
- }
32
- get size() {
33
- return this.getProperty("size");
34
- }
35
- set size(value) {
36
- this.setProperty("size", value);
37
- }
38
- get appearance() {
39
- return this.getProperty("appearance");
40
- }
41
- set appearance(value) {
42
- this.setProperty("appearance", value);
43
- }
44
- get disabled() {
45
- return this.getProperty("disabled");
46
- }
47
- set disabled(value) {
48
- this.setProperty("disabled", value);
49
- }
50
- get loading() {
51
- return this.getProperty("loading");
52
- }
53
- set loading(value) {
54
- this.setProperty("loading", value);
55
- }
56
- get type() {
57
- return this.getProperty("type");
58
- }
59
- set type(value) {
60
- this.setProperty("type", value);
61
- }
62
- get pill() {
63
- return this.getProperty("pill");
64
- }
65
- set pill(value) {
66
- this.setProperty("pill", value);
67
- }
68
- get action() {
69
- return this.getProperty("action");
70
- }
71
- set action(value) {
72
- this.setProperty("action", value);
73
- }
74
- get muted() {
75
- return this.getProperty("muted");
76
- }
77
- set muted(value) {
78
- this.setProperty("muted", value);
79
- }
80
- get wide() {
81
- return this.getProperty("wide");
82
- }
83
- set wide(value) {
84
- this.setProperty("wide", value);
85
- }
86
- get name() {
87
- return this.getProperty("name");
88
- }
89
- set name(value) {
90
- this.setProperty("name", value);
91
- }
92
- get value() {
93
- return this.getProperty("value");
94
- }
95
- set value(value) {
96
- this.setProperty("value", value);
97
- }
98
- parseFlavor() {
99
- const f = this.flavor || "";
100
- if (f.length > 1 && f.endsWith("+"))
101
- return { base: f.slice(0, -1), tone: "+" };
102
- if (f.length > 1 && f.endsWith("-"))
103
- return { base: f.slice(0, -1), tone: "-" };
104
- return { base: f, tone: "" };
105
- }
106
- buildClasses() {
107
- const { base, tone } = this.parseFlavor();
108
- return buildClassList(base, this.size, this.appearance, this.pill && "pill", this.action && "action", this.muted && "muted", tone === "+" && "tone-plus", tone === "-" && "tone-minus");
109
- }
110
- handleFormAction() {
111
- const form = this._internals.form;
112
- if (!form)
113
- return;
114
- switch (this.type) {
115
- case "submit":
116
- if (this.name && this.value) {
117
- this._internals.setFormValue(this.value);
118
- }
119
- form.requestSubmit();
120
- break;
121
- case "reset":
122
- form.reset();
123
- break;
124
- case "button":
125
- break;
126
- }
127
- }
128
- initializeButtonStructure() {
129
- const shadow = this.shadowRoot;
130
- const classes = this.buildClasses();
131
- const button = document.createElement("button");
132
- button.disabled = this.disabled;
133
- button.className = classes;
134
- const loader = document.createElement("span");
135
- loader.className = "loader-icon";
136
- loader.setAttribute("aria-hidden", "true");
137
- loader.innerHTML = getLoaderSvg();
138
- const startSlot = document.createElement("slot");
139
- startSlot.name = "start";
140
- startSlot.className = "start";
141
- const defaultSlot = document.createElement("slot");
142
- const endSlot = document.createElement("slot");
143
- endSlot.name = "end";
144
- endSlot.className = "end";
145
- button.appendChild(loader);
146
- button.appendChild(startSlot);
147
- button.appendChild(defaultSlot);
148
- button.appendChild(endSlot);
149
- button.addEventListener("click", (e) => {
150
- if (this.disabled || this.loading)
151
- return;
152
- e.stopPropagation();
153
- this.handleFormAction();
154
- this.dispatchEvent(new CustomEvent("click", {
155
- bubbles: true,
156
- composed: true,
157
- detail: { originalEvent: e },
158
- }));
159
- });
160
- this.applyLoadingState(button);
161
- shadow.appendChild(button);
162
- this._structureInitialized = true;
163
- }
164
- applyLoadingState(button) {
165
- const isLoading = this.loading;
166
- button.classList.toggle("loading", isLoading);
167
- if (isLoading) {
168
- button.setAttribute("aria-busy", "true");
169
- const loader = button.querySelector(".loader-icon");
170
- if (loader)
171
- loader.innerHTML = getLoaderSvg();
172
- }
173
- else {
174
- button.removeAttribute("aria-busy");
175
- }
176
- }
177
- render() {
178
- const shadow = this.shadowRoot;
179
- if (!this._structureInitialized) {
180
- this.initializeButtonStructure();
181
- return;
182
- }
183
- const classes = this.buildClasses();
184
- const button = shadow.querySelector("button");
185
- if (button) {
186
- button.disabled = this.disabled;
187
- button.className = classes;
188
- this.applyLoadingState(button);
189
- }
190
- }
8
+ constructor() {
9
+ super();
10
+ this._structureInitialized = false;
11
+ this._customFlavorSheet = null;
12
+ ensureStyles(this.shadowRoot, { css: buttonStyles, id: "ty-button" });
13
+ }
14
+ onConnect() {
15
+ this._syncCustomFlavor();
16
+ }
17
+ onDisconnect() { }
18
+ onPropertiesChanged(changes) {
19
+ if (changes.some((c) => c.name === "flavor")) {
20
+ this._syncCustomFlavor();
21
+ }
22
+ }
23
+ _syncCustomFlavor() {
24
+ const { base } = this.parseFlavor();
25
+ this._customFlavorSheet = syncCustomFlavorSheet(this.shadowRoot, this._customFlavorSheet, base, () => buttonCustomFlavorCss(base));
26
+ }
27
+ get flavor() {
28
+ return this.getProperty("flavor");
29
+ }
30
+ set flavor(value) {
31
+ this.setProperty("flavor", value);
32
+ }
33
+ get size() {
34
+ return this.getProperty("size");
35
+ }
36
+ set size(value) {
37
+ this.setProperty("size", value);
38
+ }
39
+ get appearance() {
40
+ return this.getProperty("appearance");
41
+ }
42
+ set appearance(value) {
43
+ this.setProperty("appearance", value);
44
+ }
45
+ get disabled() {
46
+ return this.getProperty("disabled");
47
+ }
48
+ set disabled(value) {
49
+ this.setProperty("disabled", value);
50
+ }
51
+ get loading() {
52
+ return this.getProperty("loading");
53
+ }
54
+ set loading(value) {
55
+ this.setProperty("loading", value);
56
+ }
57
+ get type() {
58
+ return this.getProperty("type");
59
+ }
60
+ set type(value) {
61
+ this.setProperty("type", value);
62
+ }
63
+ get pill() {
64
+ return this.getProperty("pill");
65
+ }
66
+ set pill(value) {
67
+ this.setProperty("pill", value);
68
+ }
69
+ get action() {
70
+ return this.getProperty("action");
71
+ }
72
+ set action(value) {
73
+ this.setProperty("action", value);
74
+ }
75
+ get muted() {
76
+ return this.getProperty("muted");
77
+ }
78
+ set muted(value) {
79
+ this.setProperty("muted", value);
80
+ }
81
+ get wide() {
82
+ return this.getProperty("wide");
83
+ }
84
+ set wide(value) {
85
+ this.setProperty("wide", value);
86
+ }
87
+ get name() {
88
+ return this.getProperty("name");
89
+ }
90
+ set name(value) {
91
+ this.setProperty("name", value);
92
+ }
93
+ get value() {
94
+ return this.getProperty("value");
95
+ }
96
+ set value(value) {
97
+ this.setProperty("value", value);
98
+ }
99
+ parseFlavor() {
100
+ const f = this.flavor || "";
101
+ if (f.length > 1 && f.endsWith("+"))
102
+ return { base: f.slice(0, -1), tone: "+" };
103
+ if (f.length > 1 && f.endsWith("-"))
104
+ return { base: f.slice(0, -1), tone: "-" };
105
+ return { base: f, tone: "" };
106
+ }
107
+ buildClasses() {
108
+ const { base, tone } = this.parseFlavor();
109
+ return buildClassList(base, this.size, this.appearance, this.pill && "pill", this.action && "action", this.muted && "muted", tone === "+" && "tone-plus", tone === "-" && "tone-minus");
110
+ }
111
+ handleFormAction() {
112
+ const form = this._internals.form;
113
+ if (!form)
114
+ return;
115
+ switch (this.type) {
116
+ case "submit":
117
+ if (this.name && this.value) {
118
+ this._internals.setFormValue(this.value);
119
+ }
120
+ form.requestSubmit();
121
+ break;
122
+ case "reset":
123
+ form.reset();
124
+ break;
125
+ case "button":
126
+ break;
127
+ }
128
+ }
129
+ initializeButtonStructure() {
130
+ const shadow = this.shadowRoot;
131
+ const classes = this.buildClasses();
132
+ const button = document.createElement("button");
133
+ button.disabled = this.disabled;
134
+ button.className = classes;
135
+ const loader = document.createElement("span");
136
+ loader.className = "loader-icon";
137
+ loader.setAttribute("aria-hidden", "true");
138
+ loader.innerHTML = getLoaderSvg();
139
+ const startSlot = document.createElement("slot");
140
+ startSlot.name = "start";
141
+ startSlot.className = "start";
142
+ const defaultSlot = document.createElement("slot");
143
+ const endSlot = document.createElement("slot");
144
+ endSlot.name = "end";
145
+ endSlot.className = "end";
146
+ button.appendChild(loader);
147
+ button.appendChild(startSlot);
148
+ button.appendChild(defaultSlot);
149
+ button.appendChild(endSlot);
150
+ button.addEventListener("click", (e) => {
151
+ if (this.disabled || this.loading)
152
+ return;
153
+ e.stopPropagation();
154
+ this.handleFormAction();
155
+ this.dispatchEvent(new CustomEvent("click", {
156
+ bubbles: true,
157
+ composed: true,
158
+ detail: { originalEvent: e },
159
+ }));
160
+ });
161
+ this.applyLoadingState(button);
162
+ shadow.appendChild(button);
163
+ this._structureInitialized = true;
164
+ }
165
+ applyLoadingState(button) {
166
+ const isLoading = this.loading;
167
+ button.classList.toggle("loading", isLoading);
168
+ if (isLoading) {
169
+ button.setAttribute("aria-busy", "true");
170
+ const loader = button.querySelector(".loader-icon");
171
+ if (loader)
172
+ loader.innerHTML = getLoaderSvg();
173
+ }
174
+ else {
175
+ button.removeAttribute("aria-busy");
176
+ }
177
+ }
178
+ render() {
179
+ const shadow = this.shadowRoot;
180
+ if (!this._structureInitialized) {
181
+ this.initializeButtonStructure();
182
+ return;
183
+ }
184
+ const classes = this.buildClasses();
185
+ const button = shadow.querySelector("button");
186
+ if (button) {
187
+ button.disabled = this.disabled;
188
+ button.className = classes;
189
+ this.applyLoadingState(button);
190
+ }
191
+ }
191
192
  }
192
193
  TyButton.formAssociated = true;
193
194
  TyButton.properties = {
194
- flavor: {
195
- type: "string",
196
- visual: true,
197
- default: "neutral",
198
- },
199
- size: {
200
- type: "string",
201
- visual: true,
202
- default: "md",
203
- validate: (v) => ["xs", "sm", "md", "lg", "xl"].includes(v),
204
- coerce: (v) => {
205
- if (!["xs", "sm", "md", "lg", "xl"].includes(v)) {
206
- console.warn(`[ty-button] Invalid size '${v}'. Using 'md'.`);
207
- return "md";
208
- }
209
- return v;
210
- },
211
- },
212
- appearance: {
213
- type: "string",
214
- visual: true,
215
- default: "solid",
216
- validate: (v) => ["solid", "outlined", "ghost"].includes(v),
217
- coerce: (v) => {
218
- if (!["solid", "outlined", "ghost"].includes(v)) {
219
- console.warn(`[ty-button] Invalid appearance '${v}'. Using 'solid'.`);
220
- return "solid";
221
- }
222
- return v;
223
- },
224
- },
225
- disabled: {
226
- type: "boolean",
227
- visual: true,
228
- default: false,
229
- },
230
- loading: {
231
- type: "boolean",
232
- visual: true,
233
- default: false,
234
- },
235
- type: {
236
- type: "string",
237
- visual: false,
238
- default: "submit",
239
- },
240
- pill: {
241
- type: "boolean",
242
- visual: true,
243
- default: false,
244
- },
245
- action: {
246
- type: "boolean",
247
- visual: true,
248
- default: false,
249
- },
250
- muted: {
251
- type: "boolean",
252
- visual: true,
253
- default: false,
254
- },
255
- wide: {
256
- type: "boolean",
257
- visual: false,
258
- default: false,
259
- },
260
- name: {
261
- type: "string",
262
- default: "",
263
- },
264
- value: {
265
- type: "string",
266
- default: "",
267
- },
195
+ flavor: {
196
+ type: "string",
197
+ visual: true,
198
+ default: "neutral",
199
+ },
200
+ size: {
201
+ type: "string",
202
+ visual: true,
203
+ default: DEFAULT_SIZE,
204
+ validate: (v) => ["xs", "sm", "md", "lg", "xl"].includes(v),
205
+ coerce: (v) => {
206
+ if (!["xs", "sm", "md", "lg", "xl"].includes(v)) {
207
+ console.warn(`[ty-button] Invalid size '${v}'. Using '${DEFAULT_SIZE}'.`);
208
+ return DEFAULT_SIZE;
209
+ }
210
+ return v;
211
+ },
212
+ },
213
+ appearance: {
214
+ type: "string",
215
+ visual: true,
216
+ default: "solid",
217
+ validate: (v) => ["solid", "outlined", "ghost"].includes(v),
218
+ coerce: (v) => {
219
+ if (!["solid", "outlined", "ghost"].includes(v)) {
220
+ console.warn(`[ty-button] Invalid appearance '${v}'. Using 'solid'.`);
221
+ return "solid";
222
+ }
223
+ return v;
224
+ },
225
+ },
226
+ disabled: {
227
+ type: "boolean",
228
+ visual: true,
229
+ default: false,
230
+ },
231
+ loading: {
232
+ type: "boolean",
233
+ visual: true,
234
+ default: false,
235
+ },
236
+ type: {
237
+ type: "string",
238
+ visual: false,
239
+ default: "submit",
240
+ },
241
+ pill: {
242
+ type: "boolean",
243
+ visual: true,
244
+ default: false,
245
+ },
246
+ action: {
247
+ type: "boolean",
248
+ visual: true,
249
+ default: false,
250
+ },
251
+ muted: {
252
+ type: "boolean",
253
+ visual: true,
254
+ default: false,
255
+ },
256
+ wide: {
257
+ type: "boolean",
258
+ visual: false,
259
+ default: false,
260
+ },
261
+ name: {
262
+ type: "string",
263
+ default: "",
264
+ },
265
+ value: {
266
+ type: "string",
267
+ default: "",
268
+ },
268
269
  };
269
270
  if (!customElements.get("ty-button")) {
270
- customElements.define("ty-button", TyButton);
271
+ customElements.define("ty-button", TyButton);
271
272
  }
@@ -47,8 +47,8 @@ export declare class TyCalendarMonth extends HTMLElement {
47
47
  private _focusedIndex;
48
48
  private _cellElements;
49
49
  /**
50
- * Observed attributes (minimal - mainly for debugging)
51
- * Properties are the primary API
50
+ * Observed attributes. `display-year`/`display-month` mirror the
51
+ * displayYear/displayMonth properties (which are what ty-calendar drives).
52
52
  */
53
53
  static get observedAttributes(): string[];
54
54
  constructor();