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,271 +1,273 @@
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
+ button.setAttribute("part", "button");
136
+ const loader = document.createElement("span");
137
+ loader.className = "loader-icon";
138
+ loader.setAttribute("aria-hidden", "true");
139
+ loader.innerHTML = getLoaderSvg();
140
+ const startSlot = document.createElement("slot");
141
+ startSlot.name = "start";
142
+ startSlot.className = "start";
143
+ const defaultSlot = document.createElement("slot");
144
+ const endSlot = document.createElement("slot");
145
+ endSlot.name = "end";
146
+ endSlot.className = "end";
147
+ button.appendChild(loader);
148
+ button.appendChild(startSlot);
149
+ button.appendChild(defaultSlot);
150
+ button.appendChild(endSlot);
151
+ button.addEventListener("click", (e) => {
152
+ if (this.disabled || this.loading)
153
+ return;
154
+ e.stopPropagation();
155
+ this.handleFormAction();
156
+ this.dispatchEvent(new CustomEvent("click", {
157
+ bubbles: true,
158
+ composed: true,
159
+ detail: { originalEvent: e },
160
+ }));
161
+ });
162
+ this.applyLoadingState(button);
163
+ shadow.appendChild(button);
164
+ this._structureInitialized = true;
165
+ }
166
+ applyLoadingState(button) {
167
+ const isLoading = this.loading;
168
+ button.classList.toggle("loading", isLoading);
169
+ if (isLoading) {
170
+ button.setAttribute("aria-busy", "true");
171
+ const loader = button.querySelector(".loader-icon");
172
+ if (loader)
173
+ loader.innerHTML = getLoaderSvg();
174
+ }
175
+ else {
176
+ button.removeAttribute("aria-busy");
177
+ }
178
+ }
179
+ render() {
180
+ const shadow = this.shadowRoot;
181
+ if (!this._structureInitialized) {
182
+ this.initializeButtonStructure();
183
+ return;
184
+ }
185
+ const classes = this.buildClasses();
186
+ const button = shadow.querySelector("button");
187
+ if (button) {
188
+ button.disabled = this.disabled;
189
+ button.className = classes;
190
+ this.applyLoadingState(button);
191
+ }
192
+ }
191
193
  }
192
194
  TyButton.formAssociated = true;
193
195
  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
- },
196
+ flavor: {
197
+ type: "string",
198
+ visual: true,
199
+ default: "neutral",
200
+ },
201
+ size: {
202
+ type: "string",
203
+ visual: true,
204
+ default: DEFAULT_SIZE,
205
+ validate: (v) => ["xs", "sm", "md", "lg", "xl"].includes(v),
206
+ coerce: (v) => {
207
+ if (!["xs", "sm", "md", "lg", "xl"].includes(v)) {
208
+ console.warn(`[ty-button] Invalid size '${v}'. Using '${DEFAULT_SIZE}'.`);
209
+ return DEFAULT_SIZE;
210
+ }
211
+ return v;
212
+ },
213
+ },
214
+ appearance: {
215
+ type: "string",
216
+ visual: true,
217
+ default: "solid",
218
+ validate: (v) => ["solid", "outlined", "ghost"].includes(v),
219
+ coerce: (v) => {
220
+ if (!["solid", "outlined", "ghost"].includes(v)) {
221
+ console.warn(`[ty-button] Invalid appearance '${v}'. Using 'solid'.`);
222
+ return "solid";
223
+ }
224
+ return v;
225
+ },
226
+ },
227
+ disabled: {
228
+ type: "boolean",
229
+ visual: true,
230
+ default: false,
231
+ },
232
+ loading: {
233
+ type: "boolean",
234
+ visual: true,
235
+ default: false,
236
+ },
237
+ type: {
238
+ type: "string",
239
+ visual: false,
240
+ default: "submit",
241
+ },
242
+ pill: {
243
+ type: "boolean",
244
+ visual: true,
245
+ default: false,
246
+ },
247
+ action: {
248
+ type: "boolean",
249
+ visual: true,
250
+ default: false,
251
+ },
252
+ muted: {
253
+ type: "boolean",
254
+ visual: true,
255
+ default: false,
256
+ },
257
+ wide: {
258
+ type: "boolean",
259
+ visual: false,
260
+ default: false,
261
+ },
262
+ name: {
263
+ type: "string",
264
+ default: "",
265
+ },
266
+ value: {
267
+ type: "string",
268
+ default: "",
269
+ },
268
270
  };
269
271
  if (!customElements.get("ty-button")) {
270
- customElements.define("ty-button", TyButton);
272
+ customElements.define("ty-button", TyButton);
271
273
  }
@@ -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();