@haiyue/ui 0.2.2 → 0.3.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 (119) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +506 -2
  3. package/dist/adapters/web/renderer.js +1 -8
  4. package/dist/adapters/web/styles.d.ts +2 -3
  5. package/dist/adapters/web/styles.js +26 -23
  6. package/dist/alert.d.ts +39 -0
  7. package/dist/alert.js +144 -0
  8. package/dist/anchor.d.ts +60 -0
  9. package/dist/anchor.js +274 -0
  10. package/dist/auto-complete.d.ts +83 -0
  11. package/dist/auto-complete.js +267 -0
  12. package/dist/avatar.d.ts +45 -0
  13. package/dist/avatar.js +135 -0
  14. package/dist/badge.js +5 -5
  15. package/dist/border-beam.js +1 -1
  16. package/dist/breadcrumb.js +5 -5
  17. package/dist/button-group.js +8 -8
  18. package/dist/button.js +10 -10
  19. package/dist/card.d.ts +29 -0
  20. package/dist/card.js +101 -0
  21. package/dist/carousel.js +6 -6
  22. package/dist/cascader.js +12 -12
  23. package/dist/checkbox.d.ts +12 -0
  24. package/dist/checkbox.js +22 -6
  25. package/dist/collapse.js +6 -6
  26. package/dist/context-menu.js +3 -3
  27. package/dist/date-picker.js +13 -13
  28. package/dist/descriptions.d.ts +44 -0
  29. package/dist/descriptions.js +169 -0
  30. package/dist/dialog.js +11 -11
  31. package/dist/divider.js +2 -2
  32. package/dist/draggable.js +1 -1
  33. package/dist/drawer.js +12 -12
  34. package/dist/dropdown.js +3 -3
  35. package/dist/empty.d.ts +20 -0
  36. package/dist/empty.js +58 -0
  37. package/dist/expandable.js +4 -4
  38. package/dist/form-item.d.ts +60 -0
  39. package/dist/form-item.js +212 -0
  40. package/dist/form.d.ts +41 -0
  41. package/dist/form.js +154 -0
  42. package/dist/history-controls.js +5 -5
  43. package/dist/image-preview.d.ts +22 -0
  44. package/dist/image-preview.js +38 -0
  45. package/dist/image.d.ts +52 -0
  46. package/dist/image.js +152 -0
  47. package/dist/index.d.ts +48 -0
  48. package/dist/index.js +72 -0
  49. package/dist/input.d.ts +11 -0
  50. package/dist/input.js +29 -15
  51. package/dist/internal/anchored-popup.d.ts +19 -0
  52. package/dist/internal/anchored-popup.js +89 -0
  53. package/dist/internal/form-control.d.ts +22 -0
  54. package/dist/internal/form-control.js +52 -0
  55. package/dist/internal/image-viewer.d.ts +51 -0
  56. package/dist/internal/image-viewer.js +210 -0
  57. package/dist/internal/pagination.d.ts +35 -0
  58. package/dist/internal/pagination.js +169 -0
  59. package/dist/internal/popover-base.d.ts +87 -0
  60. package/dist/internal/popover-base.js +365 -0
  61. package/dist/internal/presentation.d.ts +2 -0
  62. package/dist/internal/presentation.js +28 -0
  63. package/dist/mentions.d.ts +115 -0
  64. package/dist/mentions.js +485 -0
  65. package/dist/menu-shared.d.ts +1 -1
  66. package/dist/menu-shared.js +3 -3
  67. package/dist/menu.d.ts +63 -0
  68. package/dist/menu.js +339 -0
  69. package/dist/modal.js +10 -10
  70. package/dist/notification.js +9 -9
  71. package/dist/pagination.d.ts +34 -0
  72. package/dist/pagination.js +73 -0
  73. package/dist/popconfirm.d.ts +6 -0
  74. package/dist/popconfirm.js +7 -0
  75. package/dist/popover.d.ts +6 -0
  76. package/dist/popover.js +7 -0
  77. package/dist/progress.d.ts +30 -0
  78. package/dist/progress.js +102 -0
  79. package/dist/qr-code.js +3 -3
  80. package/dist/radio.d.ts +10 -0
  81. package/dist/radio.js +18 -5
  82. package/dist/range.js +7 -7
  83. package/dist/rate.js +3 -3
  84. package/dist/resizable.js +4 -4
  85. package/dist/result.d.ts +22 -0
  86. package/dist/result.js +88 -0
  87. package/dist/ribbon.d.ts +19 -0
  88. package/dist/ribbon.js +106 -0
  89. package/dist/segmented.d.ts +39 -0
  90. package/dist/segmented.js +192 -0
  91. package/dist/select.d.ts +12 -0
  92. package/dist/select.js +31 -13
  93. package/dist/skeleton.js +10 -10
  94. package/dist/spin.d.ts +26 -0
  95. package/dist/spin.js +80 -0
  96. package/dist/steps.js +13 -13
  97. package/dist/switch.d.ts +44 -0
  98. package/dist/switch.js +104 -0
  99. package/dist/table.d.ts +0 -2
  100. package/dist/table.js +46 -87
  101. package/dist/tabs.js +7 -7
  102. package/dist/tag.js +8 -8
  103. package/dist/time-picker.js +10 -10
  104. package/dist/timeline.js +12 -12
  105. package/dist/toast.js +9 -9
  106. package/dist/tooltip.js +4 -4
  107. package/dist/tour.js +11 -11
  108. package/dist/tree-node.js +2 -2
  109. package/dist/tree-select.d.ts +94 -0
  110. package/dist/tree-select.js +398 -0
  111. package/dist/tree.js +6 -5
  112. package/dist/upload.d.ts +107 -0
  113. package/dist/upload.js +353 -0
  114. package/dist/virtual-keyboard.js +5 -5
  115. package/dist/virtual-list.js +4 -4
  116. package/dist/virtual-mouse.js +5 -5
  117. package/package.json +82 -1
  118. package/themes/haiyue-dark.css +51 -0
  119. package/themes/haiyue-light.css +51 -0
package/dist/avatar.js ADDED
@@ -0,0 +1,135 @@
1
+ import { presentationIcon } from './internal/presentation.js';
2
+ /** Image avatar with text or slotted fallback and stale-request protection. */
3
+ export class HYAvatar extends HTMLElement {
4
+ _frame = document.createElement('span');
5
+ _imageHost = document.createElement('span');
6
+ _fallback = document.createElement('slot');
7
+ _text = document.createElement('span');
8
+ _icon = presentationIcon('avatar');
9
+ _image = null;
10
+ _listeners = null;
11
+ _key = '';
12
+ _status = 'empty';
13
+ static get observedAttributes() { return ['src', 'srcset', 'sizes', 'alt', 'text', 'shape', 'size', 'fit', 'aria-label']; }
14
+ constructor() {
15
+ super();
16
+ const root = this.attachShadow({ mode: 'open' });
17
+ const style = document.createElement('style');
18
+ style.textContent = `
19
+ :host { display: inline-block; flex: 0 0 auto; vertical-align: middle; max-width: 100%; color: var(--hy-avatar-text-color, var(--hy-active-text-color, #eef0ff)); font-family: var(--hy-font-family, system-ui, sans-serif); }
20
+ .avatar { display: inline-grid; place-items: center; box-sizing: border-box; position: relative; width: var(--hy-avatar-size, var(--_size, 40px)); height: var(--hy-avatar-size, var(--_size, 40px)); max-width: 100%; overflow: hidden; border-radius: var(--hy-avatar-radius, 50%); background: var(--hy-avatar-bg-color, var(--hy-hover-bg-color, #242752)); line-height: 1; }
21
+ :host([shape="square"]) .avatar { border-radius: var(--hy-avatar-radius, var(--hy-radius-md, 6px)); }
22
+ .image-host { display: contents; } img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: var(--_fit, cover); }
23
+ .fallback { display: grid; place-items: center; width: 100%; height: 100%; min-width: 0; min-height: 0; max-height: 100%; font-size: var(--hy-avatar-font-size, var(--_font-size, 16px)); font-weight: var(--hy-font-weight-semibold, 600); }
24
+ .fallback svg { width: 64%; height: 64%; } .text { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
25
+ .fallback::slotted(*) { max-width: 100%; max-height: 100%; } [hidden] { display: none !important; }
26
+ `;
27
+ this._frame.className = 'avatar';
28
+ this._frame.part.add('avatar');
29
+ this._imageHost.className = 'image-host';
30
+ this._fallback.className = 'fallback';
31
+ this._fallback.part.add('fallback');
32
+ this._text.className = 'text';
33
+ this._text.part.add('text');
34
+ this._fallback.append(this._text, this._icon);
35
+ this._frame.append(this._imageHost, this._fallback);
36
+ root.append(style, this._frame);
37
+ this._fallback.addEventListener('slotchange', this._render);
38
+ }
39
+ connectedCallback() { this._syncSource(); this._render(); }
40
+ disconnectedCallback() { this._listeners?.abort(); this._listeners = null; this._key = ''; }
41
+ attributeChangedCallback() { if (this.isConnected)
42
+ this._syncSource(); this._render(); }
43
+ get src() { return this.getAttribute('src') ?? ''; }
44
+ set src(value) { this.setAttribute('src', value); }
45
+ get alt() { return this.getAttribute('alt') ?? this.text; }
46
+ set alt(value) { this.setAttribute('alt', value); }
47
+ get text() { return this.getAttribute('text') ?? ''; }
48
+ set text(value) { this.setAttribute('text', value); }
49
+ get shape() { return this.getAttribute('shape') === 'square' ? 'square' : 'circle'; }
50
+ set shape(value) { this.setAttribute('shape', value); }
51
+ get size() {
52
+ const value = this.getAttribute('size');
53
+ if (value === 'small' || value === 'large')
54
+ return value;
55
+ if (value?.trim() && Number.isFinite(Number(value)))
56
+ return Math.max(16, Math.min(256, Number(value)));
57
+ return 'default';
58
+ }
59
+ set size(value) { this.setAttribute('size', String(value)); }
60
+ get fit() { const value = this.getAttribute('fit'); return value === 'contain' || value === 'fill' ? value : 'cover'; }
61
+ set fit(value) { this.setAttribute('fit', value); }
62
+ get status() { return this._status; }
63
+ _syncSource() {
64
+ const srcset = this.getAttribute('srcset') ?? '';
65
+ const sizes = this.getAttribute('sizes') ?? '';
66
+ const key = JSON.stringify([this.src, srcset, sizes]);
67
+ if (key === this._key)
68
+ return;
69
+ this._key = key;
70
+ this._listeners?.abort();
71
+ this._listeners = null;
72
+ this._imageHost.replaceChildren();
73
+ this._image = null;
74
+ if (!this.src && !srcset) {
75
+ this._status = 'empty';
76
+ return;
77
+ }
78
+ const image = document.createElement('img');
79
+ this._image = image;
80
+ this._status = 'loading';
81
+ image.alt = '';
82
+ image.part.add('image');
83
+ this._listeners = new AbortController();
84
+ const signal = this._listeners.signal;
85
+ image.addEventListener('load', () => {
86
+ if (this._image !== image || !this.isConnected)
87
+ return;
88
+ this._status = 'loaded';
89
+ this._render();
90
+ this.dispatchEvent(new CustomEvent('avatar-load', { bubbles: true, composed: true, detail: { src: image.currentSrc || this.src, naturalWidth: image.naturalWidth, naturalHeight: image.naturalHeight } }));
91
+ }, { signal });
92
+ image.addEventListener('error', () => {
93
+ if (this._image !== image || !this.isConnected)
94
+ return;
95
+ this._status = 'error';
96
+ this._render();
97
+ this.dispatchEvent(new CustomEvent('avatar-error', { bubbles: true, composed: true, detail: { src: this.src || srcset } }));
98
+ }, { signal });
99
+ this._imageHost.append(image);
100
+ if (sizes)
101
+ image.sizes = sizes;
102
+ if (srcset)
103
+ image.srcset = srcset;
104
+ if (this.src)
105
+ image.src = this.src;
106
+ }
107
+ _render = () => {
108
+ const size = typeof this.size === 'number' ? this.size : this.size === 'small' ? 28 : this.size === 'large' ? 56 : 40;
109
+ this._frame.style.setProperty('--_size', `${size}px`);
110
+ this._frame.style.setProperty('--_fit', this.fit);
111
+ const text = this.text || this._fallback.assignedNodes().map(node => node.textContent ?? '').join('').trim();
112
+ this._frame.style.setProperty('--_font-size', `${Math.max(8, Math.min(size * .4, size * .8 / Math.max(1, [...text].length)))}px`);
113
+ if (this._text.textContent !== this.text)
114
+ this._text.textContent = this.text;
115
+ this._text.hidden = !this.text;
116
+ this._icon.style.display = this.text ? 'none' : '';
117
+ if (this._image)
118
+ this._image.hidden = this._status !== 'loaded';
119
+ this._fallback.hidden = this._status === 'loaded';
120
+ const decorative = this.hasAttribute('alt') && this.alt === '' && !this.getAttribute('aria-label');
121
+ this._frame.toggleAttribute('aria-hidden', decorative);
122
+ if (decorative) {
123
+ this._frame.setAttribute('aria-hidden', 'true');
124
+ this._frame.removeAttribute('role');
125
+ this._frame.removeAttribute('aria-label');
126
+ }
127
+ else {
128
+ this._frame.setAttribute('role', 'img');
129
+ this._frame.setAttribute('aria-label', this.getAttribute('aria-label') || this.alt || text || 'Avatar');
130
+ }
131
+ };
132
+ }
133
+ export function defineAvatarComponents() { if (!customElements.get('hy-avatar'))
134
+ customElements.define('hy-avatar', HYAvatar); }
135
+ //# sourceMappingURL=avatar.js.map
package/dist/badge.js CHANGED
@@ -21,17 +21,17 @@ export class HYBadge extends HTMLElement {
21
21
  const root = this.attachShadow({ mode: 'open' });
22
22
  const style = document.createElement('style');
23
23
  style.textContent = `
24
- :host { display: inline-block; max-width: 100%; color: var(--hy-text-color, #eef3ff); font: 12px/1.4 system-ui, sans-serif; vertical-align: middle; }
24
+ :host { display: inline-block; max-width: 100%; color: var(--hy-text-color, #eef3ff); font: var(--hy-font-size-sm, 12px)/var(--hy-line-height-snug, 1.4) var(--hy-font-family, system-ui, sans-serif); vertical-align: middle; }
25
25
  .wrapper { position: relative; display: inline-flex; max-width: 100%; align-items: center; }
26
- .badge { display: inline-flex; min-width: var(--hy-badge-height, 20px); height: var(--hy-badge-height, 20px); align-items: center; justify-content: center; box-sizing: border-box; margin: 0; padding: 0 var(--hy-badge-padding, 6px); border: var(--hy-badge-border-width, 2px) solid var(--hy-surface-color, #111722); border-radius: 999px; color: var(--hy-badge-text-color, #fff); background: var(--_badge-color, var(--hy-error-color, #ef5b72)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--_badge-color, var(--hy-error-color, #ef5b72)) 12%, transparent); font: 650 var(--hy-badge-font-size, 11px)/1 system-ui, sans-serif; white-space: nowrap; }
26
+ .badge { display: inline-flex; min-width: var(--hy-badge-height, 20px); height: var(--hy-badge-height, 20px); align-items: center; justify-content: center; box-sizing: border-box; margin: 0; padding: 0 var(--hy-badge-padding, var(--hy-space-3, 6px)); border: var(--hy-badge-border-width, 2px) solid var(--hy-surface-color, #111722); border-radius: var(--hy-radius-full, 999px); color: var(--hy-badge-text-color, var(--hy-on-status-color, #fff)); background: var(--_badge-color, var(--hy-error-color, #ef5b72)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--_badge-color, var(--hy-error-color, #ef5b72)) 12%, transparent); font: calc(var(--hy-font-weight-semibold, 600) + 50) var(--hy-badge-font-size, calc(var(--hy-font-size-xs, 10px) + 1px))/var(--hy-line-height-tight, 1) var(--hy-font-family, system-ui, sans-serif); white-space: nowrap; }
27
27
  .wrapper.has-content .badge { position: absolute; z-index: 1; inset-block-start: 0; inset-inline-end: 0; transform: translate(calc(50% + var(--_offset-x, 0px)), calc(-50% + var(--_offset-y, 0px))); transform-origin: 100% 0; }
28
28
  .badge.dot { min-width: var(--hy-badge-dot-size, 8px); width: var(--hy-badge-dot-size, 8px); height: var(--hy-badge-dot-size, 8px); padding: 0; border-width: var(--hy-badge-dot-border-width, 1px); }
29
29
  .badge[hidden], .status[hidden] { display: none; }
30
- .status { display: inline-flex; align-items: center; gap: var(--hy-badge-status-gap, 7px); color: var(--hy-secondary-text-color, #aebbd0); }
31
- .wrapper.has-content .status { margin-inline-start: 10px; }
30
+ .status { display: inline-flex; align-items: center; gap: var(--hy-badge-status-gap, calc(var(--hy-space-3, 6px) + 1px)); color: var(--hy-secondary-text-color, #aebbd0); }
31
+ .wrapper.has-content .status { margin-inline-start: var(--hy-space-5, 10px); }
32
32
  .status-dot { position: relative; width: var(--hy-badge-status-size, 8px); height: var(--hy-badge-status-size, 8px); flex: 0 0 auto; border-radius: 50%; background: var(--_badge-color, var(--hy-muted-color, #788697)); }
33
33
  .status.processing .status-dot::after { content: ''; position: absolute; inset: -3px; border: 1px solid var(--_badge-color, var(--hy-accent-color, #79a8ff)); border-radius: inherit; animation: hy-badge-pulse 1.5s ease-out infinite; }
34
- :host([size="small"]) .badge { --hy-badge-height: 16px; --hy-badge-padding: 4px; --hy-badge-font-size: 9px; }
34
+ :host([size="small"]) .badge { --hy-badge-height: 16px; --hy-badge-padding: var(--hy-space-2, 4px); --hy-badge-font-size: calc(var(--hy-font-size-xs, 10px) - 1px); }
35
35
  @keyframes hy-badge-pulse { 0% { opacity: .75; transform: scale(.55); } 100% { opacity: 0; transform: scale(1.35); } }
36
36
  @media (prefers-reduced-motion: reduce) { .status.processing .status-dot::after { animation: none; } }
37
37
  `;
@@ -26,7 +26,7 @@ export class HYBorderBeam extends HTMLElement {
26
26
  position: relative;
27
27
  display: block;
28
28
  min-width: 0;
29
- border-radius: var(--hy-border-beam-radius, 10px);
29
+ border-radius: var(--hy-border-beam-radius, calc(var(--hy-radius-lg, 8px) + 2px));
30
30
  isolation: isolate;
31
31
  --_beam-color: var(--hy-accent-color, #7dd3fc);
32
32
  }
@@ -19,7 +19,7 @@ export class HYBreadcrumb extends HTMLElement {
19
19
  display: block;
20
20
  min-width: 0;
21
21
  color: var(--hy-secondary-text-color, #aebbd0);
22
- font: 12px/1.4 system-ui, sans-serif;
22
+ font: var(--hy-font-size-sm, 12px)/var(--hy-line-height-snug, 1.4) var(--hy-font-family, system-ui, sans-serif);
23
23
  }
24
24
  nav { min-width: 0; }
25
25
  ol {
@@ -46,10 +46,10 @@ export class HYBreadcrumb extends HTMLElement {
46
46
  min-width: 0;
47
47
  max-width: var(--hy-breadcrumb-item-max-width, 240px);
48
48
  box-sizing: border-box;
49
- padding: var(--hy-breadcrumb-item-padding, 3px 5px);
49
+ padding: var(--hy-breadcrumb-item-padding, calc(var(--hy-space-1, 2px) + 1px) calc(var(--hy-space-2, 4px) + 1px));
50
50
  overflow: hidden;
51
51
  border: 0;
52
- border-radius: var(--hy-breadcrumb-radius, 4px);
52
+ border-radius: var(--hy-breadcrumb-radius, var(--hy-radius-sm, 4px));
53
53
  color: inherit;
54
54
  background: transparent;
55
55
  font: inherit;
@@ -68,7 +68,7 @@ export class HYBreadcrumb extends HTMLElement {
68
68
  }
69
69
  .current {
70
70
  color: var(--hy-text-color, #eef3ff);
71
- font-weight: 600;
71
+ font-weight: var(--hy-font-weight-semibold, 600);
72
72
  }
73
73
  .disabled { color: var(--hy-disabled-text-color, #657185); cursor: not-allowed; }
74
74
  .separator {
@@ -76,7 +76,7 @@ export class HYBreadcrumb extends HTMLElement {
76
76
  align-items: center;
77
77
  justify-content: center;
78
78
  min-width: 14px;
79
- padding: 0 var(--hy-breadcrumb-separator-gap, 3px);
79
+ padding: 0 var(--hy-breadcrumb-separator-gap, calc(var(--hy-space-1, 2px) + 1px));
80
80
  color: var(--hy-muted-color, #657185);
81
81
  user-select: none;
82
82
  }
@@ -18,21 +18,21 @@ export class HYButtonGroup extends HTMLElement {
18
18
  }
19
19
  :host(:not([orientation="vertical"])) ::slotted(hy-button:not(:first-child)) { margin-left: -1px; }
20
20
  :host(:not([orientation="vertical"])) ::slotted(hy-button:first-child) {
21
- --hy-button-radius-top-left: var(--hy-button-group-radius, 4px);
22
- --hy-button-radius-bottom-left: var(--hy-button-group-radius, 4px);
21
+ --hy-button-radius-top-left: var(--hy-button-group-radius, var(--hy-radius-sm, 4px));
22
+ --hy-button-radius-bottom-left: var(--hy-button-group-radius, var(--hy-radius-sm, 4px));
23
23
  }
24
24
  :host(:not([orientation="vertical"])) ::slotted(hy-button:last-child) {
25
- --hy-button-radius-top-right: var(--hy-button-group-radius, 4px);
26
- --hy-button-radius-bottom-right: var(--hy-button-group-radius, 4px);
25
+ --hy-button-radius-top-right: var(--hy-button-group-radius, var(--hy-radius-sm, 4px));
26
+ --hy-button-radius-bottom-right: var(--hy-button-group-radius, var(--hy-radius-sm, 4px));
27
27
  }
28
28
  :host([orientation="vertical"]) ::slotted(hy-button:not(:first-child)) { margin-top: -1px; }
29
29
  :host([orientation="vertical"]) ::slotted(hy-button:first-child) {
30
- --hy-button-radius-top-left: var(--hy-button-group-radius, 4px);
31
- --hy-button-radius-top-right: var(--hy-button-group-radius, 4px);
30
+ --hy-button-radius-top-left: var(--hy-button-group-radius, var(--hy-radius-sm, 4px));
31
+ --hy-button-radius-top-right: var(--hy-button-group-radius, var(--hy-radius-sm, 4px));
32
32
  }
33
33
  :host([orientation="vertical"]) ::slotted(hy-button:last-child) {
34
- --hy-button-radius-bottom-left: var(--hy-button-group-radius, 4px);
35
- --hy-button-radius-bottom-right: var(--hy-button-group-radius, 4px);
34
+ --hy-button-radius-bottom-left: var(--hy-button-group-radius, var(--hy-radius-sm, 4px));
35
+ --hy-button-radius-bottom-right: var(--hy-button-group-radius, var(--hy-radius-sm, 4px));
36
36
  }
37
37
  ::slotted(hy-button:hover), ::slotted(hy-button:focus-within) { z-index: 1; }
38
38
  `;
package/dist/button.js CHANGED
@@ -19,19 +19,19 @@ export class HYButton extends HTMLElement {
19
19
  display: inline-flex;
20
20
  align-items: center;
21
21
  justify-content: center;
22
- gap: var(--hy-button-icon-gap, 7px);
22
+ gap: var(--hy-button-icon-gap, calc(var(--hy-space-3, 6px) + 1px));
23
23
  width: 100%;
24
- min-height: 28px;
25
- padding: 0 10px;
24
+ min-height: var(--hy-control-height-sm, 28px);
25
+ padding: 0 var(--hy-space-5, 10px);
26
26
  border: 1px solid var(--hy-border-color, #3d4654);
27
27
  border-radius:
28
- var(--hy-button-radius-top-left, var(--hy-button-radius, 4px))
29
- var(--hy-button-radius-top-right, var(--hy-button-radius, 4px))
30
- var(--hy-button-radius-bottom-right, var(--hy-button-radius, 4px))
31
- var(--hy-button-radius-bottom-left, var(--hy-button-radius, 4px));
28
+ var(--hy-button-radius-top-left, var(--hy-button-radius, var(--hy-radius-sm, 4px)))
29
+ var(--hy-button-radius-top-right, var(--hy-button-radius, var(--hy-radius-sm, 4px)))
30
+ var(--hy-button-radius-bottom-right, var(--hy-button-radius, var(--hy-radius-sm, 4px)))
31
+ var(--hy-button-radius-bottom-left, var(--hy-button-radius, var(--hy-radius-sm, 4px)));
32
32
  background: var(--hy-surface-elevated-color, #202733);
33
33
  color: var(--hy-text-color, #eef3ff);
34
- font: 12px system-ui, sans-serif;
34
+ font: var(--hy-font-size-sm, 12px) var(--hy-font-family, system-ui, sans-serif);
35
35
  cursor: pointer;
36
36
  }
37
37
  button:hover:not(:disabled) {
@@ -43,11 +43,11 @@ export class HYButton extends HTMLElement {
43
43
  outline-offset: 1px;
44
44
  }
45
45
  button.icon-only {
46
- width: 28px;
46
+ width: var(--hy-control-height-sm, 28px);
47
47
  padding: 0;
48
48
  gap: 0;
49
49
  }
50
- .icon { display: inline-grid; flex: 0 0 auto; place-items: center; line-height: 1; }
50
+ .icon { display: inline-grid; flex: 0 0 auto; place-items: center; line-height: var(--hy-line-height-tight, 1); }
51
51
  button.icon-end .icon { order: 2; }
52
52
  .icon[hidden], .spinner[hidden] { display: none; }
53
53
  .spinner {
package/dist/card.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ export type HYCardSize = 'small' | 'default';
2
+ /** Content surface with header, cover, body and footer slots. */
3
+ export declare class HYCard extends HTMLElement {
4
+ private readonly _surface;
5
+ private readonly _header;
6
+ private readonly _heading;
7
+ private readonly _title;
8
+ private readonly _extra;
9
+ private readonly _cover;
10
+ private readonly _body;
11
+ private readonly _loading;
12
+ private readonly _footer;
13
+ static get observedAttributes(): string[];
14
+ constructor();
15
+ connectedCallback(): void;
16
+ attributeChangedCallback(): void;
17
+ get heading(): string;
18
+ set heading(value: string);
19
+ get bordered(): boolean;
20
+ set bordered(value: boolean);
21
+ get hoverable(): boolean;
22
+ set hoverable(value: boolean);
23
+ get loading(): boolean;
24
+ set loading(value: boolean);
25
+ get size(): HYCardSize;
26
+ set size(value: HYCardSize);
27
+ private _render;
28
+ }
29
+ export declare function defineCardComponents(): void;
package/dist/card.js ADDED
@@ -0,0 +1,101 @@
1
+ import { hasSlotContent } from './internal/presentation.js';
2
+ /** Content surface with header, cover, body and footer slots. */
3
+ export class HYCard extends HTMLElement {
4
+ _surface = document.createElement('article');
5
+ _header = document.createElement('header');
6
+ _heading = document.createElement('slot');
7
+ _title = document.createElement('h3');
8
+ _extra = document.createElement('slot');
9
+ _cover = document.createElement('slot');
10
+ _body = document.createElement('div');
11
+ _loading = document.createElement('div');
12
+ _footer = document.createElement('slot');
13
+ static get observedAttributes() { return ['heading', 'bordered', 'hoverable', 'loading', 'size', 'aria-label']; }
14
+ constructor() {
15
+ super();
16
+ const root = this.attachShadow({ mode: 'open' });
17
+ const style = document.createElement('style');
18
+ style.textContent = `
19
+ :host { display: block; min-width: 0; color: var(--hy-text-color, #eef0ff); font: var(--hy-font-size-sm, 12px)/var(--hy-line-height-relaxed, 1.5) var(--hy-font-family, system-ui, sans-serif); }
20
+ .card { min-width: 0; box-sizing: border-box; overflow: hidden; border: 1px solid var(--hy-border-color, #343765); border-radius: var(--hy-card-radius, var(--hy-radius-lg, 8px)); background: var(--hy-card-bg-color, var(--hy-surface-elevated-color, #181a40)); transition: box-shadow 160ms ease, border-color 160ms ease; }
21
+ :host([bordered="false"]) .card { border-color: transparent; }
22
+ :host([hoverable]:hover) .card { border-color: var(--hy-hover-border-color, #777baf); box-shadow: 0 8px 24px var(--hy-shadow-color, #0003); }
23
+ header { display: flex; align-items: center; justify-content: space-between; gap: var(--hy-space-6, 12px); padding: var(--hy-card-header-padding, var(--hy-space-8, 16px) var(--hy-space-10, 20px)); border-bottom: 1px solid var(--hy-border-color, #343765); }
24
+ h3 { flex: 1; min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: var(--hy-font-size-md, 14px); font-weight: var(--hy-font-weight-semibold, 600); }
25
+ .extra { flex: 0 0 auto; } .cover { display: block; } .cover::slotted(*) { display: block; max-width: 100%; } .cover::slotted(img) { width: 100%; object-fit: cover; }
26
+ .body, .loading { padding: var(--hy-card-body-padding, var(--hy-space-10, 20px)); overflow-wrap: anywhere; }
27
+ .footer { display: block; padding: var(--hy-space-6, 12px) var(--hy-space-10, 20px); border-top: 1px solid var(--hy-border-color, #343765); }
28
+ .loading span { display: block; height: 12px; margin-block: var(--hy-space-4, 8px); border-radius: var(--hy-radius-sm, 4px); background: var(--hy-hover-bg-color, #242752); } .loading span:first-child { width: 40%; } .loading span:last-child { width: 70%; }
29
+ :host([size="small"]) header, :host([size="small"]) .body, :host([size="small"]) .footer, :host([size="small"]) .loading { padding: var(--hy-space-6, 12px); }
30
+ [hidden] { display: none !important; } @media (prefers-reduced-motion: reduce) { .card { transition: none; } }
31
+ `;
32
+ this._surface.className = 'card';
33
+ this._surface.part.add('card');
34
+ this._header.part.add('header');
35
+ this._title.id = 'card-heading';
36
+ this._title.part.add('heading');
37
+ this._heading.name = 'heading';
38
+ this._title.append(this._heading);
39
+ this._extra.name = 'extra';
40
+ this._extra.className = 'extra';
41
+ this._extra.part.add('extra');
42
+ this._header.append(this._title, this._extra);
43
+ this._cover.name = 'cover';
44
+ this._cover.className = 'cover';
45
+ this._cover.part.add('cover');
46
+ this._body.className = 'body';
47
+ this._body.part.add('body');
48
+ this._body.append(document.createElement('slot'));
49
+ this._loading.className = 'loading';
50
+ this._loading.part.add('loading');
51
+ this._loading.setAttribute('aria-hidden', 'true');
52
+ this._loading.append(...Array.from({ length: 3 }, () => document.createElement('span')));
53
+ this._footer.name = 'footer';
54
+ this._footer.className = 'footer';
55
+ this._footer.part.add('footer');
56
+ this._surface.append(this._header, this._cover, this._body, this._loading, this._footer);
57
+ root.append(style, this._surface);
58
+ for (const slot of [this._heading, this._extra, this._cover, this._footer])
59
+ slot.addEventListener('slotchange', this._render);
60
+ }
61
+ connectedCallback() { this._render(); }
62
+ attributeChangedCallback() { this._render(); }
63
+ get heading() { return this.getAttribute('heading') ?? ''; }
64
+ set heading(value) { this.setAttribute('heading', value); }
65
+ get bordered() { return this.getAttribute('bordered') !== 'false'; }
66
+ set bordered(value) { this.setAttribute('bordered', String(value)); }
67
+ get hoverable() { return this.hasAttribute('hoverable'); }
68
+ set hoverable(value) { this.toggleAttribute('hoverable', Boolean(value)); }
69
+ get loading() { return this.hasAttribute('loading'); }
70
+ set loading(value) { this.toggleAttribute('loading', Boolean(value)); }
71
+ get size() { return this.getAttribute('size') === 'small' ? 'small' : 'default'; }
72
+ set size(value) { this.setAttribute('size', value); }
73
+ _render = () => {
74
+ if (this._heading.textContent !== this.heading)
75
+ this._heading.textContent = this.heading;
76
+ const heading = Boolean(this.heading) || hasSlotContent(this._heading);
77
+ this._title.hidden = !heading;
78
+ this._extra.hidden = !hasSlotContent(this._extra);
79
+ this._header.hidden = !heading && this._extra.hidden;
80
+ this._cover.hidden = !hasSlotContent(this._cover);
81
+ this._body.hidden = this.loading;
82
+ this._body.inert = this.loading;
83
+ this._loading.hidden = !this.loading;
84
+ this._footer.hidden = this.loading || !hasSlotContent(this._footer);
85
+ this._surface.setAttribute('aria-busy', String(this.loading));
86
+ if (heading)
87
+ this._surface.setAttribute('aria-labelledby', 'card-heading');
88
+ else
89
+ this._surface.removeAttribute('aria-labelledby');
90
+ const label = this.getAttribute('aria-label');
91
+ if (label) {
92
+ this._surface.setAttribute('aria-label', label);
93
+ this._surface.removeAttribute('aria-labelledby');
94
+ }
95
+ else
96
+ this._surface.removeAttribute('aria-label');
97
+ };
98
+ }
99
+ export function defineCardComponents() { if (!customElements.get('hy-card'))
100
+ customElements.define('hy-card', HYCard); }
101
+ //# sourceMappingURL=card.js.map
package/dist/carousel.js CHANGED
@@ -40,7 +40,7 @@ export class HYCarousel extends HTMLElement {
40
40
  style.textContent = `
41
41
  :host { display: block; position: relative; box-sizing: border-box; width: 100%; height: var(--hy-carousel-height, 240px); min-width: 0; min-height: 0; color: var(--hy-text-color, #eef0ff); font: inherit; }
42
42
  :host([hidden]), [hidden] { display: none !important; }
43
- .viewport { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: var(--hy-carousel-radius, 10px); background: var(--hy-carousel-bg-color, var(--hy-surface-color, #10132f)); touch-action: pan-y; }
43
+ .viewport { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: var(--hy-carousel-radius, calc(var(--hy-radius-lg, 8px) + 2px)); background: var(--hy-carousel-bg-color, var(--hy-surface-color, #10132f)); touch-action: pan-y; }
44
44
  :host([direction="vertical"]) .viewport { touch-action: pan-x; }
45
45
  :host([draggable="false"]) .viewport { touch-action: auto; }
46
46
  slot { display: contents; }
@@ -61,17 +61,17 @@ export class HYCarousel extends HTMLElement {
61
61
  :host(:not([direction="vertical"])[indicator-position="left"]) .arrow,
62
62
  :host(:not([direction="vertical"])[indicator-position="right"]) .arrow { top: auto; bottom: 12px; }
63
63
  :host([direction="vertical"]:not([indicator-position="left"]):not([indicator-position="right"])) .arrow { left: auto; right: auto; inset-inline-start: 12px; }
64
- .playback { top: 12px; inset-inline-end: 12px; font-size: 12px; }
65
- .indicators { position: absolute; z-index: 2; display: flex; align-items: center; max-width: calc(100% - 88px); overflow: auto; gap: var(--hy-carousel-indicator-gap, 4px); bottom: var(--hy-carousel-indicator-offset, 12px); left: 50%; transform: translateX(-50%); }
64
+ .playback { top: 12px; inset-inline-end: 12px; font-size: var(--hy-font-size-sm, 12px); }
65
+ .indicators { position: absolute; z-index: 2; display: flex; align-items: center; max-width: calc(100% - 88px); overflow: auto; gap: var(--hy-carousel-indicator-gap, var(--hy-space-2, 4px)); bottom: var(--hy-carousel-indicator-offset, 12px); left: 50%; transform: translateX(-50%); }
66
66
  :host([indicator-position="top"]) .indicators { top: var(--hy-carousel-indicator-offset, 12px); bottom: auto; }
67
67
  :host([indicator-position="left"]) .indicators, :host([indicator-position="right"]) .indicators { flex-direction: column; max-height: calc(100% - 88px); top: 50%; bottom: auto; transform: translateY(-50%); }
68
68
  :host([indicator-position="left"]) .indicators { left: var(--hy-carousel-indicator-offset, 12px); }
69
69
  :host([indicator-position="right"]) .indicators { left: auto; right: var(--hy-carousel-indicator-offset, 12px); }
70
- .indicator { display: grid; flex: 0 0 auto; place-items: center; min-width: 24px; min-height: 24px; padding: 4px; background: transparent; border-radius: 4px; }
70
+ .indicator { display: grid; flex: 0 0 auto; place-items: center; min-width: 24px; min-height: 24px; padding: var(--hy-space-2, 4px); background: transparent; border-radius: var(--hy-radius-sm, 4px); }
71
71
  .indicator-content { display: grid; place-items: center; width: var(--hy-carousel-indicator-size, 8px); height: var(--hy-carousel-indicator-size, 8px); border-radius: var(--hy-carousel-indicator-radius, 50%); background: var(--hy-carousel-indicator-color, var(--hy-muted-color, #747ba8)); }
72
72
  .indicator[aria-current="true"] .indicator-content { background: var(--hy-carousel-indicator-active-color, var(--hy-accent-color, #8177f2)); }
73
- :host([indicator-style="line"]) .indicator-content { width: var(--hy-carousel-indicator-width, 24px); height: var(--hy-carousel-indicator-thickness, 3px); border-radius: var(--hy-carousel-indicator-radius, 2px); }
74
- :host([indicator-style="number"]) .indicator-content { width: 24px; height: 24px; font-size: 12px; color: var(--hy-carousel-indicator-text-color, var(--hy-text-color, #eef0ff)); }
73
+ :host([indicator-style="line"]) .indicator-content { width: var(--hy-carousel-indicator-width, 24px); height: var(--hy-carousel-indicator-thickness, 3px); border-radius: var(--hy-carousel-indicator-radius, var(--hy-radius-xs, 2px)); }
74
+ :host([indicator-style="number"]) .indicator-content { width: 24px; height: 24px; font-size: var(--hy-font-size-sm, 12px); color: var(--hy-carousel-indicator-text-color, var(--hy-text-color, #eef0ff)); }
75
75
  .indicators.custom .indicator-content { width: auto; height: auto; background: transparent; }
76
76
  `;
77
77
  this._viewport.className = 'viewport';
package/dist/cascader.js CHANGED
@@ -47,16 +47,16 @@ export class HYCascader extends HTMLElement {
47
47
  display: inline-block;
48
48
  min-width: 180px;
49
49
  color: var(--hy-text-color, #eef3ff);
50
- font: 12px/1.4 system-ui, sans-serif;
50
+ font: var(--hy-font-size-sm, 12px)/var(--hy-line-height-snug, 1.4) var(--hy-font-family, system-ui, sans-serif);
51
51
  }
52
52
  .control {
53
53
  display: grid;
54
54
  grid-template-columns: minmax(0, 1fr) auto;
55
55
  min-width: 0;
56
- height: var(--hy-cascader-height, 34px);
56
+ height: var(--hy-cascader-height, var(--hy-control-height-md, 34px));
57
57
  box-sizing: border-box;
58
58
  border: 1px solid var(--hy-border-color, #3d4654);
59
- border-radius: var(--hy-cascader-radius, 6px);
59
+ border-radius: var(--hy-cascader-radius, var(--hy-radius-md, 6px));
60
60
  background: var(--hy-input-bg-color, #111722);
61
61
  }
62
62
  :host(:not([disabled])) .control:hover { border-color: var(--hy-hover-border-color, #596779); }
@@ -68,8 +68,8 @@ export class HYCascader extends HTMLElement {
68
68
  display: flex;
69
69
  align-items: center;
70
70
  min-width: 0;
71
- gap: 8px;
72
- padding: 0 8px 0 10px;
71
+ gap: var(--hy-space-4, 8px);
72
+ padding: 0 var(--hy-space-4, 8px) 0 var(--hy-space-5, 10px);
73
73
  overflow: hidden;
74
74
  border: 0;
75
75
  color: inherit;
@@ -89,7 +89,7 @@ export class HYCascader extends HTMLElement {
89
89
  color: var(--hy-muted-color, #788697);
90
90
  background: transparent;
91
91
  cursor: pointer;
92
- font: 15px/1 system-ui, sans-serif;
92
+ font: calc(var(--hy-font-size-md, 14px) + 1px)/var(--hy-line-height-tight, 1) var(--hy-font-family, system-ui, sans-serif);
93
93
  }
94
94
  .clear:hover { color: var(--hy-text-color, #eef3ff); }
95
95
  .clear[hidden] { display: none; }
@@ -105,7 +105,7 @@ export class HYCascader extends HTMLElement {
105
105
  max-width: min(720px, 90vw);
106
106
  overflow: auto;
107
107
  border: 1px solid var(--hy-border-color, #3d4654);
108
- border-radius: var(--hy-cascader-panel-radius, 7px);
108
+ border-radius: var(--hy-cascader-panel-radius, calc(var(--hy-radius-md, 6px) + 1px));
109
109
  background: var(--hy-menu-bg-color, var(--hy-surface-elevated-color, #171d27));
110
110
  box-shadow: 0 12px 32px var(--hy-menu-shadow-color, rgba(0, 0, 0, 0.36));
111
111
  }
@@ -116,7 +116,7 @@ export class HYCascader extends HTMLElement {
116
116
  max-height: var(--hy-cascader-panel-height, 260px);
117
117
  box-sizing: border-box;
118
118
  margin: 0;
119
- padding: 5px;
119
+ padding: calc(var(--hy-space-2, 4px) + 1px);
120
120
  overflow-y: auto;
121
121
  list-style: none;
122
122
  scrollbar-color: var(--hy-border-strong-color, #596779) transparent;
@@ -128,11 +128,11 @@ export class HYCascader extends HTMLElement {
128
128
  width: 100%;
129
129
  min-height: 32px;
130
130
  align-items: center;
131
- gap: 8px;
132
- padding: 6px 8px;
131
+ gap: var(--hy-space-4, 8px);
132
+ padding: var(--hy-space-3, 6px) var(--hy-space-4, 8px);
133
133
  overflow: hidden;
134
134
  border: 0;
135
- border-radius: 4px;
135
+ border-radius: var(--hy-radius-sm, 4px);
136
136
  color: var(--hy-secondary-text-color, #aebbd0);
137
137
  background: transparent;
138
138
  cursor: pointer;
@@ -148,7 +148,7 @@ export class HYCascader extends HTMLElement {
148
148
  }
149
149
  .option[aria-selected="true"] { color: var(--hy-accent-color, #79a8ff); }
150
150
  .option:disabled { cursor: not-allowed; opacity: 0.46; }
151
- .empty { min-width: 184px; padding: 28px 18px; color: var(--hy-muted-color, #788697); text-align: center; }
151
+ .empty { min-width: 184px; padding: calc(var(--hy-space-12, 24px) + 4px) calc(var(--hy-space-8, 16px) + 2px); color: var(--hy-muted-color, #788697); text-align: center; }
152
152
  `;
153
153
  this._control.className = 'control';
154
154
  this._control.part.add('control');
@@ -3,10 +3,12 @@ export interface HYCheckboxChangeDetail {
3
3
  value: string;
4
4
  }
5
5
  export declare class HYCheckbox extends HTMLElement {
6
+ static readonly formAssociated = true;
6
7
  private readonly _input;
7
8
  private readonly _box;
8
9
  private readonly _label;
9
10
  private readonly _slot;
11
+ private readonly _formControl;
10
12
  static get observedAttributes(): string[];
11
13
  constructor();
12
14
  connectedCallback(): void;
@@ -25,6 +27,16 @@ export declare class HYCheckbox extends HTMLElement {
25
27
  get name(): string;
26
28
  set name(value: string);
27
29
  private _sync;
30
+ get form(): HTMLFormElement | null;
31
+ get validity(): ValidityState;
32
+ get validationMessage(): string;
33
+ checkValidity(): boolean;
34
+ reportValidity(): boolean;
35
+ setCustomValidity(message: string): void;
36
+ formDisabledCallback(disabled: boolean): void;
37
+ formResetCallback(): void;
38
+ formStateRestoreCallback(state: string | File | FormData | null): void;
39
+ focus(options?: FocusOptions): void;
28
40
  private _onChange;
29
41
  }
30
42
  export declare function defineCheckboxComponents(): void;
package/dist/checkbox.js CHANGED
@@ -1,10 +1,13 @@
1
+ import { HYFormControl } from './internal/form-control.js';
1
2
  export class HYCheckbox extends HTMLElement {
3
+ static formAssociated = true;
2
4
  _input = document.createElement('input');
3
5
  _box = document.createElement('span');
4
6
  _label = document.createElement('span');
5
7
  _slot = document.createElement('slot');
8
+ _formControl = new HYFormControl(this, this._input);
6
9
  static get observedAttributes() {
7
- return ['checked', 'disabled', 'indeterminate', 'label', 'value', 'name', 'aria-label'];
10
+ return ['checked', 'disabled', 'indeterminate', 'label', 'value', 'name', 'aria-label', 'required'];
8
11
  }
9
12
  constructor() {
10
13
  super();
@@ -16,7 +19,7 @@ export class HYCheckbox extends HTMLElement {
16
19
  width: max-content;
17
20
  min-width: 0;
18
21
  color: var(--hy-checkbox-text-color, var(--hy-text-color, #d8e2f2));
19
- font: 12px system-ui, sans-serif;
22
+ font: var(--hy-font-size-sm, 12px) var(--hy-font-family, system-ui, sans-serif);
20
23
  }
21
24
  :host([disabled]) {
22
25
  opacity: 0.55;
@@ -25,7 +28,7 @@ export class HYCheckbox extends HTMLElement {
25
28
  label {
26
29
  display: inline-flex;
27
30
  align-items: center;
28
- gap: 8px;
31
+ gap: var(--hy-space-4, 8px);
29
32
  min-width: 0;
30
33
  cursor: pointer;
31
34
  user-select: none;
@@ -52,7 +55,7 @@ export class HYCheckbox extends HTMLElement {
52
55
  display: inline-grid;
53
56
  place-items: center;
54
57
  border: 1px solid var(--hy-checkbox-border-color, var(--hy-border-color, #303746));
55
- border-radius: 3px;
58
+ border-radius: calc(var(--hy-radius-xs, 2px) + 1px);
56
59
  background: var(--hy-checkbox-bg-color, var(--hy-input-bg-color, #121822));
57
60
  color: var(--hy-checkbox-mark-color, var(--hy-selected-text-color, #ffffff));
58
61
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
@@ -107,6 +110,7 @@ export class HYCheckbox extends HTMLElement {
107
110
  connectedCallback() {
108
111
  this._input.addEventListener('change', this._onChange);
109
112
  this._sync();
113
+ this._formControl.connect();
110
114
  }
111
115
  disconnectedCallback() {
112
116
  this._input.removeEventListener('change', this._onChange);
@@ -167,7 +171,8 @@ export class HYCheckbox extends HTMLElement {
167
171
  }
168
172
  _sync() {
169
173
  this._input.checked = this.checked;
170
- this._input.disabled = this.disabled;
174
+ this._input.disabled = this.disabled || this._formControl.disabled;
175
+ this._input.required = this.hasAttribute('required');
171
176
  this._input.indeterminate = this.indeterminate;
172
177
  this._input.value = this.value;
173
178
  this._input.name = this.name;
@@ -181,7 +186,18 @@ export class HYCheckbox extends HTMLElement {
181
186
  this._input.setAttribute('aria-label', ariaLabel);
182
187
  else
183
188
  this._input.removeAttribute('aria-label');
184
- }
189
+ this._formControl.sync();
190
+ }
191
+ get form() { return this._formControl.internals.form; }
192
+ get validity() { return this._formControl.internals.validity; }
193
+ get validationMessage() { return this._formControl.internals.validationMessage; }
194
+ checkValidity() { return this._formControl.internals.checkValidity(); }
195
+ reportValidity() { return this._formControl.internals.reportValidity(); }
196
+ setCustomValidity(message) { this._formControl.setCustomValidity(message); }
197
+ formDisabledCallback(disabled) { this._formControl.disabled = disabled; this._sync(); }
198
+ formResetCallback() { this._formControl.reset(); }
199
+ formStateRestoreCallback(state) { this._formControl.restore(state); }
200
+ focus(options) { this._input.focus(options); }
185
201
  _onChange = () => {
186
202
  if (this._input.checked)
187
203
  this.setAttribute('checked', '');