@toyu-ui/elements 0.1.0

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 (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +79 -0
  3. package/button/tyui-button.d.ts +27 -0
  4. package/button.d.ts +1 -0
  5. package/button.js +339 -0
  6. package/center/tyui-center.d.ts +13 -0
  7. package/center.d.ts +1 -0
  8. package/center.js +39 -0
  9. package/checkbox/tyui-checkbox.d.ts +25 -0
  10. package/checkbox.d.ts +1 -0
  11. package/checkbox.js +288 -0
  12. package/cluster/tyui-cluster.d.ts +16 -0
  13. package/cluster.d.ts +1 -0
  14. package/cluster.js +53 -0
  15. package/container/tyui-container.d.ts +14 -0
  16. package/container.d.ts +1 -0
  17. package/container.js +44 -0
  18. package/custom-elements.json +1651 -0
  19. package/flex/tyui-flex.d.ts +22 -0
  20. package/flex.d.ts +1 -0
  21. package/flex.js +66 -0
  22. package/frame/tyui-frame.d.ts +13 -0
  23. package/frame.d.ts +1 -0
  24. package/frame.js +35 -0
  25. package/grid/tyui-grid.d.ts +20 -0
  26. package/grid.d.ts +1 -0
  27. package/grid.js +59 -0
  28. package/index.d.ts +12 -0
  29. package/index.js +26 -0
  30. package/input/tyui-input.d.ts +40 -0
  31. package/input.d.ts +1 -0
  32. package/input.js +345 -0
  33. package/layout/layout-helpers.d.ts +9 -0
  34. package/layout-helpers-C2WgKm6F.js +171 -0
  35. package/package.json +91 -0
  36. package/radio/tyui-radio.d.ts +21 -0
  37. package/radio-group/tyui-radio-group.d.ts +28 -0
  38. package/radio-group.d.ts +1 -0
  39. package/radio-group.js +234 -0
  40. package/radio.d.ts +1 -0
  41. package/radio.js +239 -0
  42. package/sidebar/tyui-sidebar.d.ts +17 -0
  43. package/sidebar.d.ts +1 -0
  44. package/sidebar.js +53 -0
  45. package/skills/button/SKILL.md +49 -0
  46. package/skills/center/SKILL.md +45 -0
  47. package/skills/checkbox/SKILL.md +39 -0
  48. package/skills/cluster/SKILL.md +44 -0
  49. package/skills/components/SKILL.md +53 -0
  50. package/skills/container/SKILL.md +42 -0
  51. package/skills/flex/SKILL.md +45 -0
  52. package/skills/frame/SKILL.md +42 -0
  53. package/skills/grid/SKILL.md +44 -0
  54. package/skills/input/SKILL.md +59 -0
  55. package/skills/radio/SKILL.md +49 -0
  56. package/skills/radio-group/SKILL.md +51 -0
  57. package/skills/sidebar/SKILL.md +43 -0
@@ -0,0 +1,22 @@
1
+ export type TyuiFlexDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
2
+ export type TyuiFlexWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
3
+ export type TyuiFlexAlign = 'stretch' | 'start' | 'center' | 'end' | 'baseline';
4
+ export type TyuiFlexJustify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
5
+ export declare class TyuiFlexElement extends HTMLElement {
6
+ #private;
7
+ static observedAttributes: string[];
8
+ connectedCallback(): void;
9
+ attributeChangedCallback(): void;
10
+ get direction(): TyuiFlexDirection;
11
+ set direction(value: TyuiFlexDirection);
12
+ get wrap(): TyuiFlexWrap;
13
+ set wrap(value: TyuiFlexWrap);
14
+ get align(): TyuiFlexAlign;
15
+ set align(value: TyuiFlexAlign);
16
+ get justify(): TyuiFlexJustify;
17
+ set justify(value: TyuiFlexJustify);
18
+ get gap(): string;
19
+ set gap(value: string);
20
+ get inline(): boolean;
21
+ set inline(value: boolean);
22
+ }
package/flex.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './flex/tyui-flex';
package/flex.js ADDED
@@ -0,0 +1,66 @@
1
+ import { i as n, n as s, s as e, a as i, b as r } from "./layout-helpers-C2WgKm6F.js";
2
+ const a = ["row", "row-reverse", "column", "column-reverse"], l = ["nowrap", "wrap", "wrap-reverse"], c = ["stretch", "start", "center", "end", "baseline"], u = ["start", "center", "end", "between", "around", "evenly"], h = {
3
+ baseline: "baseline",
4
+ center: "center",
5
+ end: "flex-end",
6
+ start: "flex-start",
7
+ stretch: "stretch"
8
+ }, o = {
9
+ around: "space-around",
10
+ between: "space-between",
11
+ center: "center",
12
+ end: "flex-end",
13
+ evenly: "space-evenly",
14
+ start: "flex-start"
15
+ };
16
+ class y extends HTMLElement {
17
+ static observedAttributes = ["align", "direction", "gap", "inline", "justify", "wrap"];
18
+ connectedCallback() {
19
+ n(), this.#t();
20
+ }
21
+ attributeChangedCallback() {
22
+ this.#t();
23
+ }
24
+ get direction() {
25
+ return s(this.getAttribute("direction"), a, "row");
26
+ }
27
+ set direction(t) {
28
+ e(this, "direction", t);
29
+ }
30
+ get wrap() {
31
+ return s(this.getAttribute("wrap"), l, "nowrap");
32
+ }
33
+ set wrap(t) {
34
+ e(this, "wrap", t);
35
+ }
36
+ get align() {
37
+ return s(this.getAttribute("align"), c, "stretch");
38
+ }
39
+ set align(t) {
40
+ e(this, "align", t);
41
+ }
42
+ get justify() {
43
+ return s(this.getAttribute("justify"), u, "start");
44
+ }
45
+ set justify(t) {
46
+ e(this, "justify", t);
47
+ }
48
+ get gap() {
49
+ return this.getAttribute("gap") ?? "3";
50
+ }
51
+ set gap(t) {
52
+ e(this, "gap", t);
53
+ }
54
+ get inline() {
55
+ return this.hasAttribute("inline");
56
+ }
57
+ set inline(t) {
58
+ e(this, "inline", t);
59
+ }
60
+ #t() {
61
+ i(this, "--ty-flex-display", this.inline ? "inline-flex" : "flex"), i(this, "--ty-flex-direction", this.direction), i(this, "--ty-flex-wrap", this.wrap), i(this, "--ty-flex-align", h[this.align]), i(this, "--ty-flex-justify", o[this.justify]), i(this, "--ty-flex-gap", r(this.getAttribute("gap"), "3"));
62
+ }
63
+ }
64
+ export {
65
+ y as TyuiFlexElement
66
+ };
@@ -0,0 +1,13 @@
1
+ export type TyuiFrameFit = 'cover' | 'contain' | 'fill' | 'scale-down' | 'none';
2
+ export declare class TyuiFrameElement extends HTMLElement {
3
+ #private;
4
+ static observedAttributes: string[];
5
+ connectedCallback(): void;
6
+ attributeChangedCallback(): void;
7
+ get ratio(): string;
8
+ set ratio(value: string);
9
+ get fit(): TyuiFrameFit;
10
+ set fit(value: TyuiFrameFit);
11
+ get position(): string;
12
+ set position(value: string);
13
+ }
package/frame.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './frame/tyui-frame';
package/frame.js ADDED
@@ -0,0 +1,35 @@
1
+ import { i as s, s as i, n as r, a as e, r as o } from "./layout-helpers-C2WgKm6F.js";
2
+ const a = ["cover", "contain", "fill", "scale-down", "none"];
3
+ class c extends HTMLElement {
4
+ static observedAttributes = ["fit", "position", "ratio"];
5
+ connectedCallback() {
6
+ s(), this.#t();
7
+ }
8
+ attributeChangedCallback() {
9
+ this.#t();
10
+ }
11
+ get ratio() {
12
+ return this.getAttribute("ratio") ?? "16/9";
13
+ }
14
+ set ratio(t) {
15
+ i(this, "ratio", t);
16
+ }
17
+ get fit() {
18
+ return r(this.getAttribute("fit"), a, "cover");
19
+ }
20
+ set fit(t) {
21
+ i(this, "fit", t);
22
+ }
23
+ get position() {
24
+ return this.getAttribute("position") ?? "center";
25
+ }
26
+ set position(t) {
27
+ i(this, "position", t);
28
+ }
29
+ #t() {
30
+ e(this, "--ty-frame-ratio", o(this.ratio, "16 / 9")), e(this, "--ty-frame-fit", this.fit), e(this, "--ty-frame-position", this.position.trim() || "center");
31
+ }
32
+ }
33
+ export {
34
+ c as TyuiFrameElement
35
+ };
@@ -0,0 +1,20 @@
1
+ export type TyuiGridAlign = 'stretch' | 'start' | 'center' | 'end';
2
+ export type TyuiGridJustify = 'stretch' | 'start' | 'center' | 'end';
3
+ export declare class TyuiGridElement extends HTMLElement {
4
+ #private;
5
+ static observedAttributes: string[];
6
+ connectedCallback(): void;
7
+ attributeChangedCallback(): void;
8
+ get minItemSize(): string;
9
+ set minItemSize(value: string);
10
+ get align(): TyuiGridAlign;
11
+ set align(value: TyuiGridAlign);
12
+ get justify(): TyuiGridJustify;
13
+ set justify(value: TyuiGridJustify);
14
+ get gap(): string;
15
+ set gap(value: string);
16
+ get rowGap(): string | null;
17
+ set rowGap(value: string | null);
18
+ get dense(): boolean;
19
+ set dense(value: boolean);
20
+ }
package/grid.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './grid/tyui-grid';
package/grid.js ADDED
@@ -0,0 +1,59 @@
1
+ import { i as g, s as e, n as s, b as r, a as i, l as h } from "./layout-helpers-C2WgKm6F.js";
2
+ const a = ["stretch", "start", "center", "end"], n = {
3
+ center: "center",
4
+ end: "end",
5
+ start: "start",
6
+ stretch: "stretch"
7
+ };
8
+ class m extends HTMLElement {
9
+ static observedAttributes = ["align", "dense", "gap", "justify", "min-item-size", "row-gap"];
10
+ connectedCallback() {
11
+ g(), this.#t();
12
+ }
13
+ attributeChangedCallback() {
14
+ this.#t();
15
+ }
16
+ get minItemSize() {
17
+ return this.getAttribute("min-item-size") ?? "16rem";
18
+ }
19
+ set minItemSize(t) {
20
+ e(this, "min-item-size", t);
21
+ }
22
+ get align() {
23
+ return s(this.getAttribute("align"), a, "stretch");
24
+ }
25
+ set align(t) {
26
+ e(this, "align", t);
27
+ }
28
+ get justify() {
29
+ return s(this.getAttribute("justify"), a, "stretch");
30
+ }
31
+ set justify(t) {
32
+ e(this, "justify", t);
33
+ }
34
+ get gap() {
35
+ return this.getAttribute("gap") ?? "4";
36
+ }
37
+ set gap(t) {
38
+ e(this, "gap", t);
39
+ }
40
+ get rowGap() {
41
+ return this.getAttribute("row-gap");
42
+ }
43
+ set rowGap(t) {
44
+ t === null ? this.removeAttribute("row-gap") : e(this, "row-gap", t);
45
+ }
46
+ get dense() {
47
+ return this.hasAttribute("dense");
48
+ }
49
+ set dense(t) {
50
+ e(this, "dense", t);
51
+ }
52
+ #t() {
53
+ const t = r(this.getAttribute("gap"), "4");
54
+ i(this, "--ty-grid-min-item-size", h(this.minItemSize, "16rem")), i(this, "--ty-grid-align", n[this.align]), i(this, "--ty-grid-justify", n[this.justify]), i(this, "--ty-grid-gap", t), i(this, "--ty-grid-row-gap", this.rowGap ? r(this.rowGap, "4") : t), i(this, "--ty-grid-auto-flow", this.dense ? "row dense" : "row");
55
+ }
56
+ }
57
+ export {
58
+ m as TyuiGridElement
59
+ };
package/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ export * from './button';
2
+ export * from './center';
3
+ export * from './checkbox';
4
+ export * from './cluster';
5
+ export * from './container';
6
+ export * from './flex';
7
+ export * from './frame';
8
+ export * from './grid';
9
+ export * from './input';
10
+ export * from './radio';
11
+ export * from './radio-group';
12
+ export * from './sidebar';
package/index.js ADDED
@@ -0,0 +1,26 @@
1
+ import { TyuiButtonElement as o } from "./button.js";
2
+ import { TyuiCenterElement as m } from "./center.js";
3
+ import { TyuiCheckboxElement as n } from "./checkbox.js";
4
+ import { TyuiClusterElement as l } from "./cluster.js";
5
+ import { TyuiContainerElement as x } from "./container.js";
6
+ import { TyuiFlexElement as y } from "./flex.js";
7
+ import { TyuiFrameElement as T } from "./frame.js";
8
+ import { TyuiGridElement as d } from "./grid.js";
9
+ import { TyuiInputElement as b } from "./input.js";
10
+ import { TyuiRadioElement as G } from "./radio.js";
11
+ import { TyuiRadioGroupElement as c } from "./radio-group.js";
12
+ import { TyuiSidebarElement as k } from "./sidebar.js";
13
+ export {
14
+ o as TyuiButtonElement,
15
+ m as TyuiCenterElement,
16
+ n as TyuiCheckboxElement,
17
+ l as TyuiClusterElement,
18
+ x as TyuiContainerElement,
19
+ y as TyuiFlexElement,
20
+ T as TyuiFrameElement,
21
+ d as TyuiGridElement,
22
+ b as TyuiInputElement,
23
+ G as TyuiRadioElement,
24
+ c as TyuiRadioGroupElement,
25
+ k as TyuiSidebarElement
26
+ };
@@ -0,0 +1,40 @@
1
+ export type TyuiInputAppearance = 'outline' | 'filled-darker' | 'filled-lighter';
2
+ export type TyuiInputSize = 'small' | 'medium' | 'large';
3
+ export type TyuiInputType = 'text' | 'email' | 'password' | 'search' | 'tel' | 'url' | 'number';
4
+ export type TyuiInputEventDetail = {
5
+ value: string;
6
+ };
7
+ export type TyuiInputEvent = CustomEvent<TyuiInputEventDetail>;
8
+ export declare class TyuiInputElement extends HTMLElement {
9
+ #private;
10
+ static formAssociated: boolean;
11
+ static observedAttributes: string[];
12
+ constructor();
13
+ get appearance(): TyuiInputAppearance;
14
+ set appearance(value: TyuiInputAppearance);
15
+ get defaultValue(): string;
16
+ set defaultValue(value: string);
17
+ get disabled(): boolean;
18
+ set disabled(value: boolean);
19
+ get invalid(): boolean;
20
+ set invalid(value: boolean);
21
+ get name(): string;
22
+ set name(value: string);
23
+ get placeholder(): string;
24
+ set placeholder(value: string);
25
+ get readonly(): boolean;
26
+ set readonly(value: boolean);
27
+ get required(): boolean;
28
+ set required(value: boolean);
29
+ get size(): TyuiInputSize;
30
+ set size(value: TyuiInputSize);
31
+ get type(): TyuiInputType;
32
+ set type(value: TyuiInputType);
33
+ get value(): string;
34
+ set value(value: string);
35
+ connectedCallback(): void;
36
+ attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
37
+ focus(options?: FocusOptions): void;
38
+ checkValidity(): boolean;
39
+ reportValidity(): boolean;
40
+ }
package/input.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './input/tyui-input';
package/input.js ADDED
@@ -0,0 +1,345 @@
1
+ const s = new CSSStyleSheet();
2
+ s.replaceSync(`
3
+ @layer ty.component-base {
4
+ :host {
5
+ display: inline-block;
6
+ color: var(--ty-input-foreground, var(--ty-color-text, FieldText));
7
+ font-family: var(--ty-font-family, inherit);
8
+ font-size: var(--ty-input-font-size, var(--ty-control-font-size, 0.875rem));
9
+ --_ty-input-icon-size: 1.25rem;
10
+ }
11
+
12
+ :host([size='small']) {
13
+ --ty-input-min-block-size: 1.5rem;
14
+ --ty-input-padding-inline: var(--ty-space-2, 0.5rem);
15
+ --ty-input-padding-block: var(--ty-space-1, 0.25rem);
16
+ --ty-input-font-size: var(--ty-font-size-100, 0.75rem);
17
+ --ty-input-gap: var(--ty-space-1, 0.25rem);
18
+ --_ty-input-icon-size: 1rem;
19
+ }
20
+
21
+ :host(:not([size='small']):not([size='large'])),
22
+ :host([size='medium']) {
23
+ --ty-input-min-block-size: 2rem;
24
+ --ty-input-padding-inline: var(--ty-space-3, 0.75rem);
25
+ --ty-input-padding-block: var(--ty-space-2, 0.5rem);
26
+ --ty-input-font-size: var(--ty-font-size-200, 0.875rem);
27
+ --ty-input-gap: var(--ty-space-1, 0.25rem);
28
+ --_ty-input-icon-size: 1.25rem;
29
+ }
30
+
31
+ :host([size='large']) {
32
+ --ty-input-min-block-size: 2.5rem;
33
+ --ty-input-padding-inline: var(--ty-space-4, 1rem);
34
+ --ty-input-padding-block: var(--ty-space-3, 0.75rem);
35
+ --ty-input-font-size: var(--ty-font-size-300, 1rem);
36
+ --ty-input-gap: var(--ty-space-2, 0.5rem);
37
+ --_ty-input-icon-size: 1.5rem;
38
+ }
39
+
40
+ :host([disabled]) {
41
+ cursor: not-allowed;
42
+ }
43
+
44
+ [part='control'] {
45
+ position: relative;
46
+ box-sizing: border-box;
47
+ display: inline-flex;
48
+ align-items: center;
49
+ flex-wrap: nowrap;
50
+ gap: var(--ty-input-gap, var(--ty-control-gap, 0.25rem));
51
+ min-block-size: var(--ty-input-min-block-size, var(--ty-control-min-block-size, 2rem));
52
+ min-inline-size: var(--ty-input-min-inline-size, 12.5rem);
53
+ padding-inline: var(--ty-input-padding-inline, var(--ty-control-padding-inline, 0.75rem));
54
+ border:
55
+ var(--ty-input-border-width, var(--ty-control-border-width, 1px))
56
+ solid
57
+ var(--ty-input-border-color, var(--ty-color-border, ButtonBorder));
58
+ border-radius: var(--ty-input-radius, var(--ty-control-radius, 0.5rem));
59
+ background: var(--ty-input-background, var(--ty-color-surface, Field));
60
+ color: var(--ty-input-foreground, var(--ty-color-text, FieldText));
61
+ transition:
62
+ background-color var(--ty-motion-feedback-duration, 120ms) var(--ty-motion-easing, ease),
63
+ border-color var(--ty-motion-feedback-duration, 120ms) var(--ty-motion-easing, ease),
64
+ box-shadow var(--ty-motion-feedback-duration, 120ms) var(--ty-motion-easing, ease);
65
+ }
66
+
67
+ :host([appearance='filled-darker']) [part='control'] {
68
+ --ty-input-background: var(--ty-input-background-filled-darker, var(--ty-color-surface-pressed, Field));
69
+ --ty-input-border-color: transparent;
70
+ }
71
+
72
+ :host([appearance='filled-lighter']) [part='control'] {
73
+ --ty-input-background: var(--ty-input-background-filled-lighter, var(--ty-color-surface-hover, Field));
74
+ --ty-input-border-color: transparent;
75
+ }
76
+
77
+ [part='control']:hover:not(:has(input:disabled)) {
78
+ border-color: var(--ty-input-border-color-strong, var(--ty-color-border-strong, ButtonText));
79
+ }
80
+
81
+ [part='control']:focus-within {
82
+ outline: var(--ty-focus-width, 2px) solid var(--ty-input-focus-indicator-color, var(--ty-focus-color, Highlight));
83
+ outline-offset: var(--ty-focus-offset, 2px);
84
+ box-shadow: 0 0 0 2px var(--ty-focus-inner-color, Canvas);
85
+ }
86
+
87
+ :host([invalid]) [part='control'] {
88
+ border-color: var(--ty-input-invalid-border-color, var(--ty-color-danger, Mark));
89
+ }
90
+
91
+ [part='input'] {
92
+ all: unset;
93
+ box-sizing: border-box;
94
+ flex: 1 1 auto;
95
+ min-inline-size: 0;
96
+ padding-block: var(--ty-input-padding-block, var(--ty-control-padding-block, 0.5rem));
97
+ color: inherit;
98
+ font: inherit;
99
+ background: transparent;
100
+ }
101
+
102
+ [part='input']::placeholder {
103
+ color: var(--ty-input-placeholder-color, var(--ty-color-text-muted, GrayText));
104
+ opacity: 1;
105
+ }
106
+
107
+ [part='input']:disabled {
108
+ color: var(--ty-input-disabled-foreground, var(--ty-color-disabled-text, GrayText));
109
+ cursor: not-allowed;
110
+ }
111
+
112
+ [part='content-before'],
113
+ [part='content-after'] {
114
+ display: inline-flex;
115
+ flex: none;
116
+ align-items: center;
117
+ color: var(--ty-input-content-color, var(--ty-color-text-muted, GrayText));
118
+ }
119
+
120
+ ::slotted(svg),
121
+ ::slotted([slot='contentBefore']),
122
+ ::slotted([slot='contentAfter']) {
123
+ max-inline-size: var(--_ty-input-icon-size, 1.25rem);
124
+ max-block-size: var(--_ty-input-icon-size, 1.25rem);
125
+ }
126
+
127
+ @media (forced-colors: active) {
128
+ [part='control'] {
129
+ forced-color-adjust: none;
130
+ background: Field;
131
+ border-color: FieldText;
132
+ color: FieldText;
133
+ }
134
+
135
+ :host([disabled]) [part='control'],
136
+ [part='input']:disabled {
137
+ color: GrayText;
138
+ }
139
+
140
+ [part='control']:focus-within {
141
+ outline-color: Highlight;
142
+ box-shadow: none;
143
+ }
144
+ }
145
+
146
+ @media (prefers-reduced-motion: reduce) {
147
+ [part='control'] {
148
+ transition-duration: 0ms;
149
+ }
150
+ }
151
+ }
152
+ `);
153
+ const o = document.createElement("template");
154
+ o.innerHTML = `
155
+ <span part="control">
156
+ <span part="content-before"><slot name="contentBefore"></slot></span>
157
+ <input part="input" />
158
+ <span part="content-after"><slot name="contentAfter"></slot></span>
159
+ </span>
160
+ `;
161
+ function n(i, t, e) {
162
+ return t.includes(i) ? i : e;
163
+ }
164
+ function a(i, t) {
165
+ return i.hasAttribute(t);
166
+ }
167
+ class l extends HTMLElement {
168
+ static formAssociated = !0;
169
+ static observedAttributes = [
170
+ "appearance",
171
+ "aria-describedby",
172
+ "aria-invalid",
173
+ "aria-label",
174
+ "aria-labelledby",
175
+ "default-value",
176
+ "disabled",
177
+ "invalid",
178
+ "name",
179
+ "placeholder",
180
+ "readonly",
181
+ "required",
182
+ "size",
183
+ "type",
184
+ "value"
185
+ ];
186
+ #t;
187
+ #n;
188
+ #c = !1;
189
+ #o = !1;
190
+ #s = !1;
191
+ #e = "";
192
+ #i = "";
193
+ #a = "";
194
+ #r = "";
195
+ constructor() {
196
+ super();
197
+ const t = this.attachShadow({ mode: "open", delegatesFocus: !0 });
198
+ t.adoptedStyleSheets = [s], t.append(o.content.cloneNode(!0));
199
+ const e = t.querySelector("input");
200
+ if (!(e instanceof HTMLInputElement))
201
+ throw new Error("TyuiInputElement template is missing its input.");
202
+ this.#t = e, this.#t.addEventListener("input", this.#f), this.#t.addEventListener("change", this.#m), this.#n = this.#p();
203
+ }
204
+ get appearance() {
205
+ return n(
206
+ this.getAttribute("appearance"),
207
+ ["outline", "filled-darker", "filled-lighter"],
208
+ "outline"
209
+ );
210
+ }
211
+ set appearance(t) {
212
+ this.setAttribute("appearance", t);
213
+ }
214
+ get defaultValue() {
215
+ return this.#i;
216
+ }
217
+ set defaultValue(t) {
218
+ this.#i = String(t), this.setAttribute("default-value", this.#i);
219
+ }
220
+ get disabled() {
221
+ return a(this, "disabled");
222
+ }
223
+ set disabled(t) {
224
+ this.toggleAttribute("disabled", t);
225
+ }
226
+ get invalid() {
227
+ return a(this, "invalid");
228
+ }
229
+ set invalid(t) {
230
+ this.toggleAttribute("invalid", t);
231
+ }
232
+ get name() {
233
+ return this.#a;
234
+ }
235
+ set name(t) {
236
+ this.#a = String(t), this.#a ? this.setAttribute("name", this.#a) : this.removeAttribute("name");
237
+ }
238
+ get placeholder() {
239
+ return this.#r;
240
+ }
241
+ set placeholder(t) {
242
+ this.#r = String(t), this.#r ? this.setAttribute("placeholder", this.#r) : this.removeAttribute("placeholder");
243
+ }
244
+ get readonly() {
245
+ return a(this, "readonly");
246
+ }
247
+ set readonly(t) {
248
+ this.toggleAttribute("readonly", t);
249
+ }
250
+ get required() {
251
+ return a(this, "required");
252
+ }
253
+ set required(t) {
254
+ this.toggleAttribute("required", t);
255
+ }
256
+ get size() {
257
+ return n(this.getAttribute("size"), ["small", "medium", "large"], "medium");
258
+ }
259
+ set size(t) {
260
+ this.setAttribute("size", t);
261
+ }
262
+ get type() {
263
+ return n(
264
+ this.getAttribute("type"),
265
+ ["text", "email", "password", "search", "tel", "url", "number"],
266
+ "text"
267
+ );
268
+ }
269
+ set type(t) {
270
+ this.setAttribute("type", t);
271
+ }
272
+ get value() {
273
+ return this.#e;
274
+ }
275
+ set value(t) {
276
+ this.#l(String(t));
277
+ }
278
+ connectedCallback() {
279
+ this.#y(), this.#b(), this.#v(), this.#u();
280
+ }
281
+ attributeChangedCallback(t, e, r) {
282
+ t === "invalid" && this.#s || (t === "value" ? this.#l(r ?? "") : t === "default-value" ? this.#i = r ?? "" : t === "name" ? this.#a = r ?? "" : t === "placeholder" && (this.#r = r ?? ""), this.#u());
283
+ }
284
+ focus(t) {
285
+ this.#t.focus(t);
286
+ }
287
+ checkValidity() {
288
+ return this.#n?.checkValidity() ?? this.#t.checkValidity();
289
+ }
290
+ reportValidity() {
291
+ return this.#n?.reportValidity() ?? this.#t.reportValidity();
292
+ }
293
+ #p() {
294
+ if (!("attachInternals" in this)) return null;
295
+ try {
296
+ return this.attachInternals();
297
+ } catch {
298
+ return null;
299
+ }
300
+ }
301
+ #y() {
302
+ this.#e = this.getAttribute("value") ?? this.#e, this.#i = this.getAttribute("default-value") ?? this.#i, this.#a = this.getAttribute("name") ?? this.#a, this.#r = this.getAttribute("placeholder") ?? this.#r;
303
+ }
304
+ #b() {
305
+ this.#c || (this.#c = !0, !this.#e && this.#i && (this.#e = this.#i));
306
+ }
307
+ #v() {
308
+ this.hasAttribute("appearance") || this.setAttribute("appearance", "outline"), this.hasAttribute("size") || this.setAttribute("size", "medium"), this.hasAttribute("type") || this.setAttribute("type", "text");
309
+ }
310
+ #f = (t) => {
311
+ t.stopPropagation(), this.#l(this.#t.value), this.dispatchEvent(
312
+ new CustomEvent("input", {
313
+ detail: { value: this.#e },
314
+ bubbles: !0,
315
+ composed: !0
316
+ })
317
+ );
318
+ };
319
+ #m = (t) => {
320
+ t.stopPropagation(), this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 }));
321
+ };
322
+ #l(t) {
323
+ this.#e = t, this.#u();
324
+ }
325
+ #u() {
326
+ this.#t.value = this.#e, this.#t.type = this.type, this.#t.placeholder = this.#r, this.#t.disabled = this.disabled, this.#t.readOnly = this.readonly, this.#t.required = this.required, this.#d("aria-label"), this.#d("aria-labelledby"), this.#d("aria-describedby"), this.invalid ? this.#t.setAttribute("aria-invalid", "true") : this.getAttribute("aria-invalid") === "true" ? this.#t.setAttribute("aria-invalid", "true") : this.#t.removeAttribute("aria-invalid"), this.#g();
327
+ }
328
+ #d(t) {
329
+ const e = this.getAttribute(t);
330
+ e === null || e === "" ? this.#t.removeAttribute(t) : this.#t.setAttribute(t, e);
331
+ }
332
+ #g() {
333
+ if (this.#n?.setFormValue(this.disabled ? null : this.#e), this.required && !this.disabled && this.#e.length === 0) {
334
+ this.#n?.setValidity({ valueMissing: !0 }, "This field is required.", this.#t), this.#o = !0, this.#h(!0);
335
+ return;
336
+ }
337
+ this.#n?.setValidity({}), this.#o && (this.#o = !1, this.#h(!1));
338
+ }
339
+ #h(t) {
340
+ this.#s || (this.#s = !0, this.toggleAttribute("invalid", t), this.#s = !1);
341
+ }
342
+ }
343
+ export {
344
+ l as TyuiInputElement
345
+ };
@@ -0,0 +1,9 @@
1
+ export type TyuiSpace = '0' | '1' | '2' | '3' | '4';
2
+ export declare const tyuiLayoutStylesText = "\n @layer reset, tokens, product-theme, components, product-components, utilities, overrides;\n\n @layer utilities {\n .ty-flex,\n tyui-flex {\n box-sizing: border-box;\n display: var(--ty-flex-display, flex);\n flex-direction: var(--ty-flex-direction, row);\n flex-wrap: var(--ty-flex-wrap, nowrap);\n align-items: var(--ty-flex-align, stretch);\n justify-content: var(--ty-flex-justify, flex-start);\n gap: var(--ty-flex-gap, var(--ty-layout-gap, var(--ty-space-3, 0.75rem)));\n }\n\n .ty-cluster,\n tyui-cluster {\n box-sizing: border-box;\n display: flex;\n flex-wrap: wrap;\n align-items: var(--ty-cluster-align, center);\n justify-content: var(--ty-cluster-justify, flex-start);\n gap:\n var(--ty-cluster-row-gap, var(--ty-cluster-gap, var(--ty-space-2, 0.5rem)))\n var(--ty-cluster-gap, var(--ty-space-2, 0.5rem));\n }\n\n .ty-grid,\n tyui-grid {\n box-sizing: border-box;\n display: grid;\n grid-template-columns: repeat(\n auto-fit,\n minmax(min(100%, var(--ty-grid-min-item-size, 16rem)), 1fr)\n );\n align-items: var(--ty-grid-align, stretch);\n justify-items: var(--ty-grid-justify, stretch);\n grid-auto-flow: var(--ty-grid-auto-flow, row);\n gap:\n var(--ty-grid-row-gap, var(--ty-grid-gap, var(--ty-space-4, 1rem)))\n var(--ty-grid-gap, var(--ty-space-4, 1rem));\n }\n\n .ty-center,\n tyui-center {\n box-sizing: content-box;\n display: var(--ty-center-display, block);\n margin-inline: auto;\n max-inline-size: var(--ty-center-measure, var(--ty-layout-content-measure, 65ch));\n padding-inline: var(--ty-center-gutter, var(--ty-page-gutter, 1rem));\n }\n\n tyui-center[intrinsic],\n .ty-center[data-intrinsic='true'] {\n --ty-center-display: flex;\n flex-direction: column;\n align-items: center;\n }\n\n .ty-container,\n tyui-container {\n box-sizing: border-box;\n display: block;\n inline-size: 100%;\n max-inline-size: var(--ty-container-max-inline-size, var(--ty-container-wide, 72rem));\n margin-inline: auto;\n padding-inline: var(--ty-container-gutter, var(--ty-page-gutter, 1rem));\n }\n\n tyui-container[bleed],\n .ty-container[data-bleed='true'] {\n max-inline-size: none;\n padding-inline: 0;\n }\n\n .ty-frame,\n tyui-frame {\n box-sizing: border-box;\n aspect-ratio: var(--ty-frame-ratio, 16 / 9);\n display: block;\n overflow: hidden;\n }\n\n .ty-frame > *,\n tyui-frame > * {\n box-sizing: border-box;\n block-size: 100%;\n inline-size: 100%;\n }\n\n .ty-frame > img,\n .ty-frame > video,\n .ty-frame > iframe,\n .ty-frame > canvas,\n tyui-frame > img,\n tyui-frame > video,\n tyui-frame > iframe,\n tyui-frame > canvas {\n object-fit: var(--ty-frame-fit, cover);\n object-position: var(--ty-frame-position, center);\n }\n\n .ty-sidebar,\n tyui-sidebar {\n box-sizing: border-box;\n display: flex;\n flex-direction: var(--ty-sidebar-direction, row);\n flex-wrap: wrap;\n align-items: var(--ty-sidebar-align, stretch);\n gap: var(--ty-sidebar-gap, var(--ty-layout-gap, var(--ty-space-3, 0.75rem)));\n }\n\n .ty-sidebar > :first-child,\n tyui-sidebar > :first-child {\n flex-basis: var(--ty-sidebar-size, 18rem);\n flex-grow: 1;\n }\n\n .ty-sidebar > :last-child,\n tyui-sidebar > :last-child {\n flex-basis: 0;\n flex-grow: 999;\n min-inline-size: min(100%, var(--ty-sidebar-content-min-inline-size, 50%));\n }\n }\n";
3
+ export declare function installTyuiLayoutStyles(): void;
4
+ export declare function normalizeAttribute<T extends string>(value: string | null, allowed: readonly T[], fallback: T): T;
5
+ export declare function setReflectedAttribute(element: HTMLElement, name: string, value: string | boolean): void;
6
+ export declare function spaceValue(value: string | null, fallback: TyuiSpace): string;
7
+ export declare function lengthOrFallback(value: string | null, fallback: string): string;
8
+ export declare function ratioOrFallback(value: string | null, fallback: string): string;
9
+ export declare function setStyleVar(element: HTMLElement, name: string, value: string): void;