@swell/swell-ui 0.0.0-stage → 0.1.1

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 (225) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +165 -2
  3. package/custom-elements.json +8274 -0
  4. package/dist/chunks/badge-Dt6q8Cqa.js +11 -0
  5. package/dist/chunks/button-C7nCiu-t.js +123 -0
  6. package/dist/chunks/card-CvSQEug8.js +10 -0
  7. package/dist/chunks/checkbox-BRI_A1TP.js +99 -0
  8. package/dist/chunks/chip-BtnufSMG.js +48 -0
  9. package/dist/chunks/config-C-FYxOaJ.js +588 -0
  10. package/dist/chunks/define-BlQTa1g4.js +19 -0
  11. package/dist/chunks/description-BHfQ8meK.js +19 -0
  12. package/dist/chunks/disclosure-CET8-H6f.js +56 -0
  13. package/dist/chunks/divider-BfkO0c1j.js +27 -0
  14. package/dist/chunks/element-B4-_7TLZ.js +138 -0
  15. package/dist/chunks/input-Uun-ls2_.js +53 -0
  16. package/dist/chunks/link-8qHFEKQE.js +53 -0
  17. package/dist/chunks/link-D4NC86oc.js +24 -0
  18. package/dist/chunks/lookup-5icr_T6o.js +205 -0
  19. package/dist/chunks/lookup-list-Bw6OJoDS.js +19 -0
  20. package/dist/chunks/lookup-option-Mn3k8W2M.js +26 -0
  21. package/dist/chunks/popover-D3Ob6slA.js +92 -0
  22. package/dist/chunks/popup-Dbh2fchP.js +21 -0
  23. package/dist/chunks/quantity-h3wqn8tC.js +140 -0
  24. package/dist/chunks/radio-BhFDL3pO.js +192 -0
  25. package/dist/chunks/radio-option-hT29S8Zl.js +88 -0
  26. package/dist/chunks/select-DS1n_htj.js +331 -0
  27. package/dist/chunks/select-option-DoM9GAe0.js +66 -0
  28. package/dist/chunks/skeleton-DfPjhls9.js +13 -0
  29. package/dist/chunks/status-B23JZ5RQ.js +71 -0
  30. package/dist/chunks/tab-BpjFUbFO.js +107 -0
  31. package/dist/chunks/tabs-aWKq1Iaz.js +122 -0
  32. package/dist/chunks/text-ZWPy-iB3.js +26 -0
  33. package/dist/chunks/text-field-BB_MRt5h.js +158 -0
  34. package/dist/chunks/textarea-L6_OJ2IN.js +18 -0
  35. package/dist/chunks/thumbnail-CLe9AsFg.js +21 -0
  36. package/dist/chunks/toggle-C7-oPgWR.js +22 -0
  37. package/dist/chunks/ui-HcyMKwzs.js +11 -0
  38. package/dist/editors/vscode.css-custom-data.json +824 -0
  39. package/dist/editors/vscode.html-custom-data.json +1156 -0
  40. package/dist/editors/web-types.json +1706 -0
  41. package/dist/elements/badge.d.ts +1 -0
  42. package/dist/elements/badge.js +1 -0
  43. package/dist/elements/button.d.ts +1 -0
  44. package/dist/elements/button.js +1 -0
  45. package/dist/elements/card.d.ts +1 -0
  46. package/dist/elements/card.js +1 -0
  47. package/dist/elements/checkbox.d.ts +1 -0
  48. package/dist/elements/checkbox.js +1 -0
  49. package/dist/elements/chip.d.ts +1 -0
  50. package/dist/elements/chip.js +1 -0
  51. package/dist/elements/disclosure.d.ts +1 -0
  52. package/dist/elements/disclosure.js +1 -0
  53. package/dist/elements/divider.d.ts +1 -0
  54. package/dist/elements/divider.js +1 -0
  55. package/dist/elements/input.d.ts +1 -0
  56. package/dist/elements/input.js +1 -0
  57. package/dist/elements/link.d.ts +1 -0
  58. package/dist/elements/link.js +1 -0
  59. package/dist/elements/lookup-list.d.ts +1 -0
  60. package/dist/elements/lookup-list.js +1 -0
  61. package/dist/elements/lookup-option.d.ts +1 -0
  62. package/dist/elements/lookup-option.js +1 -0
  63. package/dist/elements/lookup.d.ts +1 -0
  64. package/dist/elements/lookup.js +1 -0
  65. package/dist/elements/popover.d.ts +1 -0
  66. package/dist/elements/popover.js +1 -0
  67. package/dist/elements/quantity.d.ts +1 -0
  68. package/dist/elements/quantity.js +1 -0
  69. package/dist/elements/radio-option.d.ts +1 -0
  70. package/dist/elements/radio-option.js +1 -0
  71. package/dist/elements/radio.d.ts +1 -0
  72. package/dist/elements/radio.js +1 -0
  73. package/dist/elements/select-option.d.ts +1 -0
  74. package/dist/elements/select-option.js +1 -0
  75. package/dist/elements/select.d.ts +1 -0
  76. package/dist/elements/select.js +1 -0
  77. package/dist/elements/skeleton.d.ts +1 -0
  78. package/dist/elements/skeleton.js +1 -0
  79. package/dist/elements/status.d.ts +1 -0
  80. package/dist/elements/status.js +1 -0
  81. package/dist/elements/tab.d.ts +1 -0
  82. package/dist/elements/tab.js +1 -0
  83. package/dist/elements/tabs.d.ts +1 -0
  84. package/dist/elements/tabs.js +1 -0
  85. package/dist/elements/text.d.ts +1 -0
  86. package/dist/elements/text.js +1 -0
  87. package/dist/elements/textarea.d.ts +1 -0
  88. package/dist/elements/textarea.js +1 -0
  89. package/dist/elements/thumbnail.d.ts +1 -0
  90. package/dist/elements/thumbnail.js +1 -0
  91. package/dist/elements/ui.d.ts +1 -0
  92. package/dist/elements/ui.js +1 -0
  93. package/dist/frameworks/jsx.d.ts +3589 -0
  94. package/dist/frameworks/preact.d.ts +9 -0
  95. package/dist/frameworks/solid.d.ts +7 -0
  96. package/dist/frameworks/svelte.d.ts +1676 -0
  97. package/dist/frameworks/vue.d.ts +827 -0
  98. package/dist/index.js +80 -0
  99. package/dist/react/badge.d.ts +12 -0
  100. package/dist/react/badge.js +4 -0
  101. package/dist/react/button.d.ts +16 -0
  102. package/dist/react/button.js +4 -0
  103. package/dist/react/card.d.ts +11 -0
  104. package/dist/react/card.js +4 -0
  105. package/dist/react/checkbox.d.ts +14 -0
  106. package/dist/react/checkbox.js +4 -0
  107. package/dist/react/chip.d.ts +12 -0
  108. package/dist/react/chip.js +4 -0
  109. package/dist/react/create.js +49 -0
  110. package/dist/react/disclosure.d.ts +11 -0
  111. package/dist/react/disclosure.js +4 -0
  112. package/dist/react/divider.d.ts +9 -0
  113. package/dist/react/divider.js +4 -0
  114. package/dist/react/index.d.ts +26 -0
  115. package/dist/react/index.js +26 -0
  116. package/dist/react/input.d.ts +28 -0
  117. package/dist/react/input.js +4 -0
  118. package/dist/react/link.d.ts +15 -0
  119. package/dist/react/link.js +4 -0
  120. package/dist/react/lookup-list.d.ts +9 -0
  121. package/dist/react/lookup-list.js +4 -0
  122. package/dist/react/lookup-option.d.ts +11 -0
  123. package/dist/react/lookup-option.js +4 -0
  124. package/dist/react/lookup.d.ts +28 -0
  125. package/dist/react/lookup.js +4 -0
  126. package/dist/react/popover.d.ts +11 -0
  127. package/dist/react/popover.js +4 -0
  128. package/dist/react/quantity.d.ts +15 -0
  129. package/dist/react/quantity.js +4 -0
  130. package/dist/react/radio-option.d.ts +11 -0
  131. package/dist/react/radio-option.js +4 -0
  132. package/dist/react/radio.d.ts +18 -0
  133. package/dist/react/radio.js +4 -0
  134. package/dist/react/select-option.d.ts +11 -0
  135. package/dist/react/select-option.js +4 -0
  136. package/dist/react/select.d.ts +20 -0
  137. package/dist/react/select.js +4 -0
  138. package/dist/react/skeleton.d.ts +11 -0
  139. package/dist/react/skeleton.js +4 -0
  140. package/dist/react/status.d.ts +12 -0
  141. package/dist/react/status.js +4 -0
  142. package/dist/react/tab.d.ts +10 -0
  143. package/dist/react/tab.js +4 -0
  144. package/dist/react/tabs.d.ts +17 -0
  145. package/dist/react/tabs.js +4 -0
  146. package/dist/react/text.d.ts +12 -0
  147. package/dist/react/text.js +4 -0
  148. package/dist/react/textarea.d.ts +23 -0
  149. package/dist/react/textarea.js +4 -0
  150. package/dist/react/thumbnail.d.ts +13 -0
  151. package/dist/react/thumbnail.js +4 -0
  152. package/dist/react/ui.d.ts +10 -0
  153. package/dist/react/ui.js +4 -0
  154. package/dist/types/components/core/badge/badge.d.ts +25 -0
  155. package/dist/types/components/core/button/button.d.ts +60 -0
  156. package/dist/types/components/core/card/card.d.ts +21 -0
  157. package/dist/types/components/core/checkbox/checkbox.d.ts +46 -0
  158. package/dist/types/components/core/chip/chip.d.ts +36 -0
  159. package/dist/types/components/core/disclosure/disclosure.d.ts +37 -0
  160. package/dist/types/components/core/divider/divider.d.ts +21 -0
  161. package/dist/types/components/core/index.d.ts +21 -0
  162. package/dist/types/components/core/input/input.d.ts +57 -0
  163. package/dist/types/components/core/link/link.d.ts +42 -0
  164. package/dist/types/components/core/lookup/lookup-list.d.ts +21 -0
  165. package/dist/types/components/core/lookup/lookup-option.d.ts +27 -0
  166. package/dist/types/components/core/lookup/lookup.d.ts +32 -0
  167. package/dist/types/components/core/popover/popover.d.ts +33 -0
  168. package/dist/types/components/core/quantity/quantity.d.ts +47 -0
  169. package/dist/types/components/core/radio/radio-option.d.ts +82 -0
  170. package/dist/types/components/core/radio/radio.d.ts +65 -0
  171. package/dist/types/components/core/select/select-option.d.ts +69 -0
  172. package/dist/types/components/core/select/select.d.ts +70 -0
  173. package/dist/types/components/core/skeleton/skeleton.d.ts +23 -0
  174. package/dist/types/components/core/status/status.d.ts +38 -0
  175. package/dist/types/components/core/tabs/tab.d.ts +76 -0
  176. package/dist/types/components/core/tabs/tabs.d.ts +46 -0
  177. package/dist/types/components/core/text/text.d.ts +23 -0
  178. package/dist/types/components/core/textarea/textarea.d.ts +45 -0
  179. package/dist/types/components/core/thumbnail/thumbnail.d.ts +27 -0
  180. package/dist/types/components/core/ui/ui.d.ts +16 -0
  181. package/dist/types/components/elements.d.ts +1 -0
  182. package/dist/types/react/create.d.ts +8 -0
  183. package/dist/types/runtime/config.d.ts +25 -0
  184. package/dist/types/runtime/css.d.ts +12 -0
  185. package/dist/types/runtime/define.d.ts +4 -0
  186. package/dist/types/runtime/description.d.ts +12 -0
  187. package/dist/types/runtime/element.d.ts +61 -0
  188. package/dist/types/runtime/focus.d.ts +5 -0
  189. package/dist/types/runtime/form.d.ts +5 -0
  190. package/dist/types/runtime/index.d.ts +2 -0
  191. package/dist/types/runtime/link.d.ts +17 -0
  192. package/dist/types/runtime/loader.d.ts +21 -0
  193. package/dist/types/runtime/popup.d.ts +8 -0
  194. package/dist/types/runtime/sheet.d.ts +31 -0
  195. package/dist/types/runtime/text-field.d.ts +47 -0
  196. package/dist/types/runtime/toggle.d.ts +8 -0
  197. package/dist/types/runtime/tokens.generated.d.ts +492 -0
  198. package/dist/types/runtime/values.d.ts +6 -0
  199. package/dist/types/runtime/variants.d.ts +4 -0
  200. package/package.json +136 -4
  201. package/resolver.json +111 -0
  202. package/src/components/core/badge/tokens.json +152 -0
  203. package/src/components/core/button/tokens.dark.json +16 -0
  204. package/src/components/core/button/tokens.json +232 -0
  205. package/src/components/core/card/tokens.json +35 -0
  206. package/src/components/core/checkbox/tokens.json +15 -0
  207. package/src/components/core/chip/tokens.json +144 -0
  208. package/src/components/core/link/tokens.json +24 -0
  209. package/src/components/core/radio/tokens.dark.json +17 -0
  210. package/src/components/core/radio/tokens.json +114 -0
  211. package/src/components/core/status/tokens.dark.json +71 -0
  212. package/src/components/core/status/tokens.json +135 -0
  213. package/src/components/core/tabs/tokens.json +80 -0
  214. package/src/components/core/text/tokens.json +222 -0
  215. package/src/components/core/thumbnail/tokens.json +46 -0
  216. package/tokens/border.json +38 -0
  217. package/tokens/color.dark.json +88 -0
  218. package/tokens/color.json +115 -0
  219. package/tokens/control.json +115 -0
  220. package/tokens/field.dark.json +65 -0
  221. package/tokens/field.json +158 -0
  222. package/tokens/focus.json +26 -0
  223. package/tokens/font.json +117 -0
  224. package/tokens/motion.json +49 -0
  225. package/tokens/overlay.json +81 -0
@@ -0,0 +1,56 @@
1
+ import { n as e, r as t, t as n } from "./define-BlQTa1g4.js";
2
+ import { n as r } from "./element-B4-_7TLZ.js";
3
+ import { n as i, t as a } from "./toggle-C7-oPgWR.js";
4
+ // src/components/core/disclosure/disclosure.css?inline
5
+ var o = ":host{display:block;position:relative}:host([open]:not([toggle])) slot[name=trigger]{display:none}:host slot[name=trigger]::slotted(*){transition:opacity var(--swell-motion-duration-fast) var(--swell-motion-easing)}:host(:state(closing):not([toggle])) slot[name=trigger]::slotted(*){opacity:0;transition:none;position:absolute;inset-block-start:0;inset-inline-start:0}:host [part=content]{visibility:hidden;opacity:0;transition:grid-template-rows var(--swell-motion-duration-base) var(--swell-motion-easing), opacity var(--swell-motion-duration-fast) var(--swell-motion-easing), visibility 0s var(--swell-motion-duration-base);outline:none;grid-template-rows:0fr;display:grid}:host([open]) [part=content]{visibility:visible;opacity:1;transition:grid-template-rows var(--swell-motion-duration-slow) var(--swell-motion-easing), opacity var(--swell-motion-duration-slow) var(--swell-motion-easing);grid-template-rows:1fr}:host .clip{min-height:0;margin:calc(-1 * max(var(--swell-field-ring-width), var(--swell-focus-width) + var(--swell-focus-offset)));padding:max(var(--swell-field-ring-width), var(--swell-focus-width) + var(--swell-focus-offset));transition:transform var(--swell-motion-duration-base) var(--swell-motion-easing);overflow:clip;transform:translateY(-8px)}:host([open]) .clip{transition:transform var(--swell-motion-duration-slow) var(--swell-motion-easing), overflow 0s var(--swell-motion-duration-slow) allow-discrete;overflow:visible;transform:none}", s = /* @__PURE__ */ t({ SwellDisclosure: () => c }), c = class extends r {
6
+ static styles = o;
7
+ static template = "<slot name=\"trigger\"></slot><div part=\"content\" inert><div class=\"clip\"><slot></slot></div></div>";
8
+ static observedAttributes = [
9
+ ...r.observedAttributes,
10
+ "open",
11
+ "toggle"
12
+ ];
13
+ #e;
14
+ #t = a(this);
15
+ constructor() {
16
+ super();
17
+ let e = this.shadowRoot?.querySelector("slot[name=\"trigger\"]");
18
+ e?.addEventListener("slotchange", () => this.#n()), e?.addEventListener("click", (e) => {
19
+ let t = this.hasAttribute("toggle"), n = this.open;
20
+ (!n || t) && setTimeout(() => {
21
+ !e.defaultPrevented && this.open === n && this.isConnected && (this.open = !n, t || i(this, this.#r));
22
+ });
23
+ });
24
+ }
25
+ get open() {
26
+ return this.hasAttribute("open");
27
+ }
28
+ set open(e) {
29
+ this.toggleAttribute("open", !!e);
30
+ }
31
+ connectedCallback() {
32
+ e(this, "open"), super.connectedCallback(), this.#n();
33
+ }
34
+ #n() {
35
+ let e = this.hasAttribute("toggle") ? this.querySelector(":scope > [slot=\"trigger\"]") ?? void 0 : void 0;
36
+ this.#e !== e && this.#e?.removeAttribute("aria-expanded"), e?.setAttribute("aria-expanded", String(this.open)), this.#e = e;
37
+ }
38
+ update(e) {
39
+ if ((e === "open" || e === "toggle") && this.#n(), e !== "open") return;
40
+ this.#t();
41
+ let t = !this.open && !this.#r.inert;
42
+ if (t && this.internals.states.add("closing"), !this.open && this.matches(":focus-within") && this.querySelector(":scope > [slot=\"trigger\"]")?.focus(), this.#r.inert = !this.open, !t) {
43
+ this.internals.states.delete("closing");
44
+ return;
45
+ }
46
+ let n = this.#r.getAnimations().map((e) => e.finished.catch(() => void 0));
47
+ Promise.all(n).then(() => {
48
+ this.open || this.internals.states.delete("closing");
49
+ });
50
+ }
51
+ get #r() {
52
+ return this.shadowRoot?.querySelector("[part=\"content\"]");
53
+ }
54
+ };
55
+ n("swell-disclosure", c);
56
+ export { s as n, c as t };
@@ -0,0 +1,27 @@
1
+ import { r as e, t } from "./define-BlQTa1g4.js";
2
+ import { n } from "./element-B4-_7TLZ.js";
3
+ // src/components/core/divider/divider.css?inline
4
+ var r = ":host{--_swell-control-font-size:var(--swell-control-font-size)}:host([size=xsmall]){--_swell-control-font-size:var(--swell-control-xsmall-font-size)}:host([size=small]){--_swell-control-font-size:var(--swell-control-small-font-size)}:host([size=large]){--_swell-control-font-size:var(--swell-control-large-font-size)}:host([size=xlarge]){--_swell-control-font-size:var(--swell-control-xlarge-font-size)}:host{align-items:center;gap:var(--_swell-control-font-size);display:flex}:host [hidden]{display:none}:host .line{border-top:var(--swell-border-width) solid var(--swell-color-border);flex:1;min-width:0}:host .label{font:var(--swell-font-weight) var(--swell-font-caption-size) / var(--swell-font-leading) var(--swell-font-family);letter-spacing:var(--swell-font-tracking);text-align:center;color:var(--swell-color-secondary-foreground)}", i = /* @__PURE__ */ e({ SwellDivider: () => a }), a = class extends n {
5
+ static styles = r;
6
+ static template = "<span class=\"line\"></span><span class=\"label\" hidden><slot></slot></span><span class=\"line end\" hidden></span>";
7
+ #e = new MutationObserver(() => this.#t());
8
+ connectedCallback() {
9
+ this.#t(), this.#e.observe(this, {
10
+ childList: !0,
11
+ characterData: !0,
12
+ subtree: !0,
13
+ attributeFilter: ["hidden", "slot"]
14
+ }), super.connectedCallback();
15
+ }
16
+ disconnectedCallback() {
17
+ this.#e.disconnect(), super.disconnectedCallback();
18
+ }
19
+ #t() {
20
+ let e = ((this.shadowRoot?.querySelector("slot:not([name])"))?.assignedNodes() ?? []).some((e) => e instanceof Element ? !e.hasAttribute("hidden") : e instanceof Text && e.data.trim() !== "");
21
+ for (let t of this.shadowRoot?.querySelectorAll(".label, .end") ?? []) t.hidden = !e;
22
+ let t = this.getAttribute("role");
23
+ !e && t === null ? this.setAttribute("role", "separator") : e && t === "separator" && this.removeAttribute("role");
24
+ }
25
+ };
26
+ t("swell-divider", a);
27
+ export { i as n, a as t };
@@ -0,0 +1,138 @@
1
+ import { a as e, d as t, f as n, i as r, l as i, o as a, p as o, u as s } from "./config-C-FYxOaJ.js";
2
+ // src/runtime/variants.ts
3
+ var c = i.color?.variant ?? [], l = /* @__PURE__ */ new Map(), u = r();
4
+ e(() => {
5
+ let e = r();
6
+ if (e.join() !== u.join()) {
7
+ u = e;
8
+ for (let [e, t] of l) t.replaceSync(d(e, [...c, ...u]));
9
+ }
10
+ });
11
+ function d(e, r) {
12
+ let i = Object.entries(t[e] ?? {});
13
+ return r.map((t) => `:host([variant="${t}"]) { ${i.map(([r, i]) => `${n(`${e}.color.${r}`)}: var(${o(`color.${t}.${r}`)}, ${r === "shadow" ? "transparent" : i});`).join(" ")} }`).join("\n");
14
+ }
15
+ function f(e) {
16
+ if (!e || !t[e]) return;
17
+ let n = l.get(e);
18
+ return n || (n = new CSSStyleSheet(), n.replaceSync(d(e, [...c, ...u])), l.set(e, n)), n;
19
+ }
20
+ function p(e, n) {
21
+ return !!(e && t[e] && (c.includes(n) || u.includes(n)));
22
+ }
23
+ // src/runtime/element.ts
24
+ var m = /* @__PURE__ */ new WeakMap();
25
+ function h(e) {
26
+ let t = m.get(e);
27
+ return t || (t = new CSSStyleSheet(), t.replaceSync(e.styles), m.set(e, t)), t;
28
+ }
29
+ var g = /* @__PURE__ */ new WeakMap();
30
+ function _(e) {
31
+ let t = g.get(e);
32
+ return t || (t = document.createElement("template"), t.innerHTML = e.template, g.set(e, t)), t.content.cloneNode(!0);
33
+ }
34
+ var v;
35
+ function y() {
36
+ return v || (v = new CSSStyleSheet(), v.replaceSync(":host([hidden]) { display: none !important; }")), v;
37
+ }
38
+ var b = class extends HTMLElement {
39
+ static group = null;
40
+ static appearance = null;
41
+ static appearances = [];
42
+ static styles = "";
43
+ static observedAttributes = [
44
+ "variant",
45
+ "appearance",
46
+ "size",
47
+ "type"
48
+ ];
49
+ internals;
50
+ #e = [];
51
+ #t;
52
+ constructor() {
53
+ super(), this.internals = this.attachInternals();
54
+ }
55
+ get definition() {
56
+ return this.constructor;
57
+ }
58
+ connectedCallback() {
59
+ this.#t ??= e(() => this.updateStates()), this.updateStates();
60
+ }
61
+ disconnectedCallback() {
62
+ this.#t?.(), this.#t = void 0;
63
+ }
64
+ attributeChangedCallback(e, t, n) {
65
+ t !== n && ((e === "variant" || e === "appearance" || e === "size") && this.updateStates(), this.update(e));
66
+ }
67
+ update(e) {}
68
+ appearanceSource() {
69
+ return this;
70
+ }
71
+ extraStates() {
72
+ return [];
73
+ }
74
+ stylesheet() {
75
+ return h(this.definition);
76
+ }
77
+ updateStates() {
78
+ let e = this.#n(), t = [...e ? [e] : [], ...this.extraStates()];
79
+ for (let e of this.#e) t.includes(e) || this.internals.states.delete(e);
80
+ for (let e of t) this.internals.states.add(e);
81
+ this.#e = t;
82
+ }
83
+ #n() {
84
+ let { appearance: e, group: t } = this.definition;
85
+ if (!e) return;
86
+ let n = [...s[`${e}.appearance`]?.values ?? [], ...this.definition.appearances], r = this.appearanceSource(), i = r.getAttribute("appearance");
87
+ if (i && n.includes(i)) return i;
88
+ let o = r.getAttribute("variant");
89
+ if (o && p(t, o)) {
90
+ let t = a(`${e}.${o}`, "appearance");
91
+ if (t) return t;
92
+ }
93
+ return a(e, "appearance");
94
+ }
95
+ };
96
+ function x(e) {
97
+ return e.getAttribute("size") === "xsmall" ? "above" : a("field.label", "position");
98
+ }
99
+ function S(e, t) {
100
+ t ? e.hasAttribute("tabindex") || e.setAttribute("tabindex", "0") : e.getAttribute("tabindex") === "0" && e.removeAttribute("tabindex");
101
+ }
102
+ function C(e, t = () => !1) {
103
+ let n = !1;
104
+ e.addEventListener("keydown", (r) => {
105
+ r.defaultPrevented || r.composedPath()[0] !== e || (r.key === "Enter" ? (r.preventDefault(), t() || e.click()) : r.key === " " && (r.preventDefault(), n = !0));
106
+ }), e.addEventListener("keyup", (r) => {
107
+ r.key === " " && n && (n = !1, t() || e.click());
108
+ }), e.addEventListener("blur", () => n = !1);
109
+ }
110
+ var w = class extends b {
111
+ static template = "<slot></slot>";
112
+ static shadowOptions = { mode: "open" };
113
+ constructor() {
114
+ super();
115
+ let e = this.definition, t = this.attachShadow(e.shadowOptions), n = f(e.group);
116
+ t.adoptedStyleSheets = [
117
+ y(),
118
+ this.stylesheet(),
119
+ ...n ? [n] : []
120
+ ], t.append(_(e));
121
+ }
122
+ };
123
+ function T(e, t) {
124
+ (e instanceof Document || e instanceof ShadowRoot) && (e.adoptedStyleSheets.includes(t) || e.adoptedStyleSheets.push(t));
125
+ }
126
+ var E = class extends b {
127
+ static labelPosition = !0;
128
+ #e = !1;
129
+ connectedCallback() {
130
+ T(this.getRootNode(), this.stylesheet()), this.#e || (this.#e = !0, this.render()), super.connectedCallback();
131
+ }
132
+ extraStates() {
133
+ if (!this.definition.labelPosition) return [];
134
+ let e = x(this);
135
+ return e ? [e] : [];
136
+ }
137
+ };
138
+ export { x as a, _ as i, w as n, S as o, C as r, E as t };
@@ -0,0 +1,53 @@
1
+ import { r as e, t } from "./define-BlQTa1g4.js";
2
+ import { t as n } from "./text-field-BB_MRt5h.js";
3
+ // src/runtime/form.ts
4
+ var r = (e) => e instanceof HTMLButtonElement && e.type === "submit" || e instanceof HTMLInputElement && (e.type === "submit" || e.type === "image"), i = (e) => e.localName === "swell-button" && e.type === "submit";
5
+ function a(e, t) {
6
+ if (e.key !== "Enter" || e.defaultPrevented || e.isComposing || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
7
+ let n = t.form;
8
+ if (n) for (let t of n.elements) {
9
+ if (r(t)) return;
10
+ if (i(t)) {
11
+ e.preventDefault(), t.click();
12
+ return;
13
+ }
14
+ }
15
+ }
16
+ // src/components/core/input/input.css?inline
17
+ var o = "swell-input{--_swell-control-font-size:var(--swell-control-font-size);--_swell-control-height:var(--swell-control-height)}swell-input[size=xsmall]{--_swell-control-font-size:var(--swell-control-xsmall-font-size);--_swell-control-height:var(--swell-control-xsmall-height)}swell-input[size=small]{--_swell-control-font-size:var(--swell-control-small-font-size);--_swell-control-height:var(--swell-control-small-height)}swell-input[size=large]{--_swell-control-font-size:var(--swell-control-large-font-size);--_swell-control-height:var(--swell-control-large-height)}swell-input[size=xlarge]{--_swell-control-font-size:var(--swell-control-xlarge-font-size);--_swell-control-height:var(--swell-control-xlarge-height)}swell-input{--_swell-input-small-text:max(12px, calc(var(--_swell-control-font-size) - 1px));--_swell-input-raised:clamp(11px, calc(var(--_swell-control-font-size) - 2px), 13px);--_swell-input-raised-line:round(up, calc(var(--_swell-input-raised) * 4 / 3), 2px);--_swell-input-rise:min(calc(.6 * var(--_swell-control-font-size) + 1.6px), calc(var(--_swell-control-height) / 2 - var(--_swell-input-raised-line) / 2 - 2px));gap:var(--swell-field-gap);display:grid}swell-input[hidden]{display:none!important}swell-input [hidden]{display:none}swell-input .swell-input-label{font:var(--swell-field-label-font-weight) var(--_swell-input-small-text) / var(--swell-font-leading) var(--swell-field-label-font-family);letter-spacing:var(--swell-field-label-font-tracking);color:var(--swell-field-label-color-foreground)}swell-input::part(frame){box-sizing:border-box;height:var(--_swell-control-height);border:var(--swell-border-width) solid var(--swell-field-color-border);border-radius:var(--swell-border-radius);transition:border-color var(--swell-motion-duration-fast) var(--swell-motion-easing), box-shadow var(--swell-motion-duration-base) var(--swell-motion-easing);background:0 0;grid-template:minmax(0,1fr)/auto minmax(0,1fr) auto;align-items:center;display:grid}swell-input .swell-input-control{box-sizing:border-box;width:100%;height:100%;padding:0 var(--_swell-control-font-size);border-radius:calc(var(--swell-border-radius) - var(--swell-border-width));font:var(--swell-font-weight) var(--_swell-control-font-size) / normal var(--swell-font-family);letter-spacing:var(--swell-font-tracking);color:var(--swell-field-color-foreground);background:0 0;border:0;outline:none;grid-area:1/2;margin:0}swell-input .swell-input-control:disabled{cursor:not-allowed}swell-input::part(frame):hover{border-color:var(--swell-field-hover-color-border)}swell-input .swell-input-control::placeholder{color:var(--swell-color-secondary-foreground);opacity:1}swell-input:state(outline)::part(frame){background:var(--swell-field-outline-color-background)}swell-input:state(filled)::part(frame){border-width:0 0 var(--swell-border-width);border-radius:var(--swell-border-radius) var(--swell-border-radius) 0 0;background:var(--swell-field-color-background)}swell-input:state(underline)::part(frame){border-width:0 0 var(--swell-border-width);border-radius:0}swell-input:has(.swell-input-control:disabled)::part(frame){opacity:var(--swell-control-disabled-opacity)}swell-input:state(filled) .swell-input-control{border-radius:var(--swell-border-radius) var(--swell-border-radius) 0 0}swell-input:state(underline) .swell-input-control{border-radius:0;padding-inline:0}swell-input::part(start),swell-input::part(end){align-items:center;gap:calc(var(--_swell-control-font-size) - 6px);color:var(--swell-color-secondary-foreground);display:none}swell-input::part(start){grid-column:1;padding-inline-start:calc(var(--_swell-control-font-size) - 2px)}swell-input::part(end){grid-column:3;padding-inline-end:calc(var(--_swell-control-font-size) - 2px)}swell-input:state(underline)::part(start){padding-inline-start:0}swell-input:state(underline)::part(end){padding-inline-end:0}swell-input:has(>[slot=start]:not([hidden]))::part(start),swell-input:has(>[slot=end]:not([hidden]))::part(end){display:flex}swell-input:has(>[slot=start]:not([hidden])) .swell-input-control{border-start-start-radius:0;border-end-start-radius:0;padding-inline-start:calc(var(--_swell-control-font-size) - 4px)}swell-input:has(>[slot=end]:not([hidden])) .swell-input-control{border-start-end-radius:0;border-end-end-radius:0;padding-inline-end:calc(var(--_swell-control-font-size) - 4px)}swell-input>:where(svg[slot=start],svg[slot=end]){width:calc(var(--_swell-control-font-size) + 4px);height:calc(var(--_swell-control-font-size) + 4px);flex:none;display:block}swell-input[invalid]::part(frame){border-color:var(--swell-color-danger);animation:swell-input-shake var(--swell-motion-duration-slow) var(--swell-motion-easing)}swell-input:has(.swell-input-control:focus)::part(frame){border-color:var(--swell-focus-color)}swell-input:state(outline)[invalid]::part(frame){box-shadow:0 0 0 var(--swell-field-ring-width) var(--swell-field-invalid-color-ring)}swell-input:state(outline):has(.swell-input-control:focus)::part(frame){box-shadow:0 0 0 var(--swell-field-ring-width) var(--swell-field-focus-color-ring)}swell-input:is(:state(filled),:state(underline)):has(.swell-input-control:focus)::part(frame){box-shadow:inset 0 calc(-1 * var(--swell-border-width)) 0 var(--swell-focus-color)}swell-input[invalid]:has(.swell-input-control:focus)::part(frame){border-color:var(--swell-color-danger)}swell-input:state(outline)[invalid]:has(.swell-input-control:focus)::part(frame){box-shadow:0 0 0 var(--swell-field-ring-width) var(--swell-field-invalid-color-ring), inset 0 0 0 var(--swell-border-width) var(--swell-color-danger)}swell-input:is(:state(filled),:state(underline))[invalid]:has(.swell-input-control:focus)::part(frame){box-shadow:inset 0 calc(-1 * var(--swell-border-width)) 0 var(--swell-color-danger)}@keyframes swell-input-shake{10%,90%{transform:translate(-1px)}20%,80%{transform:translate(2px)}30%,50%,70%{transform:translate(-5px)}40%,60%{transform:translate(5px)}}swell-input .swell-input-hint,swell-input>[slot=hint],swell-input .swell-input-error{font:var(--swell-font-weight) var(--_swell-input-small-text) / var(--swell-font-leading) var(--swell-font-family);letter-spacing:var(--swell-font-tracking);color:var(--swell-color-secondary-foreground)}swell-input .swell-input-error:not([hidden]){font-weight:var(--swell-font-strong-weight);color:var(--swell-color-danger);animation:swell-input-enter var(--swell-motion-duration-base) var(--swell-motion-easing)}@keyframes swell-input-enter{0%{opacity:0;transform:translateY(-6px)}}swell-input .swell-input-optional{font-weight:var(--swell-font-weight);color:var(--swell-color-secondary-foreground)}swell-input:state(floating) .swell-input-optional{font-weight:inherit}swell-input:state(floating) .swell-input-label{z-index:1;contain:inline-size;box-sizing:border-box;max-width:100%;padding-inline:var(--_swell-control-font-size);white-space:nowrap;text-overflow:ellipsis;font-size:var(--_swell-control-font-size);font-weight:var(--swell-font-weight);line-height:round(up, calc(var(--_swell-control-font-size) * 4 / 3), 2px);color:var(--swell-color-secondary-foreground);pointer-events:none;transition:transform var(--swell-motion-duration-base) var(--swell-motion-easing), font-size var(--swell-motion-duration-base) var(--swell-motion-easing), line-height var(--swell-motion-duration-base) var(--swell-motion-easing);grid-area:1/2;overflow:hidden}swell-input:state(underline):state(floating) .swell-input-label{padding-inline:0}swell-input:is(:state(filled),:state(underline)):state(floating) .swell-input-label{margin-block-start:var(--swell-border-width)}swell-input:state(floating):has(.swell-input-label:not([hidden])) .swell-input-control{padding-top:var(--_swell-input-raised-line);padding-bottom:0;line-height:1.2}swell-input:is(:state(filled),:state(underline)):state(floating):has(.swell-input-label:not([hidden])) .swell-input-control{padding-top:calc(var(--_swell-input-raised-line) + var(--swell-border-width))}swell-input:state(floating):has(.swell-input-label:not([hidden])) .swell-input-control:not(:focus)::placeholder{opacity:0}swell-input:state(floating):has(.swell-input-control:focus,.swell-input-control:not(:placeholder-shown)) .swell-input-label{font-size:var(--_swell-input-raised);font-weight:var(--swell-font-medium-weight);line-height:var(--_swell-input-raised-line);transform:translateY(calc(-1 * var(--_swell-input-rise)))}swell-input:state(floating):has(>[slot=start]:not([hidden])) .swell-input-label{padding-inline-start:calc(var(--_swell-control-font-size) - 4px)}swell-input:state(floating):has(>[slot=end]:not([hidden])) .swell-input-label{padding-inline-end:calc(var(--_swell-control-font-size) - 4px)}@media (pointer:coarse){swell-input .swell-input-control{font-size:max(16px, var(--_swell-control-font-size))}}@media (forced-colors:active){swell-input::part(frame){box-shadow:none;border-color:fieldtext}swell-input:has(.swell-input-control:focus)::part(frame){outline:2px solid highlight}}", s = /* @__PURE__ */ e({ SwellInput: () => u }), c = [
18
+ "text",
19
+ "email",
20
+ "tel",
21
+ "password",
22
+ "number",
23
+ "search",
24
+ "url"
25
+ ], l = [
26
+ "name",
27
+ "autocomplete",
28
+ "inputmode",
29
+ "minlength",
30
+ "maxlength",
31
+ "pattern",
32
+ "min",
33
+ "max",
34
+ "step"
35
+ ], u = class extends n {
36
+ static styles = o;
37
+ static control = "input";
38
+ static prefix = "swell-input";
39
+ static template = "<slot name=\"label\"></slot><div part=\"frame\"><span part=\"start\"><slot name=\"start\"></slot></span><slot name=\"control\"></slot><span part=\"end\"><slot name=\"end\"></slot></span></div><slot name=\"hint\"></slot><slot name=\"description\"></slot>";
40
+ static passed = l;
41
+ static own = ["type"];
42
+ static observedAttributes = n.attributesOf(l, ["type"]);
43
+ setUpControl(e) {
44
+ e.addEventListener("keydown", (e) => a(e, e.currentTarget));
45
+ }
46
+ syncControl(e, t) {
47
+ if (e !== "type") return;
48
+ let n = this.getAttribute("type");
49
+ t.type = n && c.includes(n) ? n : "text";
50
+ }
51
+ };
52
+ t("swell-input", u);
53
+ export { s as n, o as r, u as t };
@@ -0,0 +1,53 @@
1
+ import { r as e, t } from "./define-BlQTa1g4.js";
2
+ import { n, o as r, r as i } from "./element-B4-_7TLZ.js";
3
+ // src/components/core/link/link.css?inline
4
+ var a = ":host{--_swell-link-color-accent:var(--swell-link-color-accent,var(--swell-color-accent));--_swell-control-font-size:var(--swell-control-font-size);--_swell-link-font-weight:var(--swell-link-font-weight,var(--swell-font-strong-weight))}:host([size=xsmall]){--_swell-control-font-size:var(--swell-control-xsmall-font-size)}:host([size=small]){--_swell-control-font-size:var(--swell-control-small-font-size)}:host([size=large]){--_swell-control-font-size:var(--swell-control-large-font-size)}:host([size=xlarge]){--_swell-control-font-size:var(--swell-control-xlarge-font-size)}:host{display:inline}:host [part=link]{color:var(--_swell-link-color-accent);text-underline-offset:2px;cursor:pointer;transition:color var(--swell-motion-duration-fast) var(--swell-motion-easing);border-radius:2px;text-decoration:underline}:host(:is(:state(start-content),:state(end-content))) [part=link]{align-items:baseline;gap:calc(1em - 7px);display:inline-flex}:host(:state(plain)) [part=link]{--_swell-link-text:max(12px, calc(var(--_swell-control-font-size) - 1px));min-height:24px;font:var(--_swell-link-font-weight) var(--_swell-link-text) / var(--swell-font-leading) var(--swell-font-family);letter-spacing:var(--swell-font-tracking);align-items:center;gap:calc(1em - 7px);text-decoration:none;display:inline-flex}:host slot:is([name=start],[name=end])::slotted(svg){flex:none;align-self:center;width:calc(1em + 2px);height:calc(1em + 2px)}:host slot:is([name=start],[name=end])::slotted([hidden]){display:none}:host(:focus-visible){outline:none}:host [part=link]:focus-visible,:host(:focus-visible) [part=link]{outline:var(--swell-focus-width) solid var(--swell-focus-color);outline-offset:var(--swell-focus-offset)}@media (forced-colors:active){:host [part=link]{color:linktext}}", o = /* @__PURE__ */ e({ SwellLink: () => c }), s = [
5
+ "href",
6
+ "target",
7
+ "rel",
8
+ "aria-label"
9
+ ], c = class extends n {
10
+ static group = "link";
11
+ static appearance = "link";
12
+ static appearances = ["plain"];
13
+ static styles = a;
14
+ static template = "<span part=\"link\"><slot name=\"start\"></slot><slot></slot><slot name=\"end\"></slot></span>";
15
+ static observedAttributes = [...n.observedAttributes, ...s];
16
+ constructor() {
17
+ super(), i(this);
18
+ for (let e of this.shadowRoot?.querySelectorAll("slot[name]") ?? []) e.addEventListener("slotchange", () => this.#e());
19
+ new MutationObserver(() => this.#e()).observe(this, {
20
+ attributeFilter: ["hidden"],
21
+ subtree: !0
22
+ });
23
+ }
24
+ connectedCallback() {
25
+ this.#e(), this.#t(), super.connectedCallback();
26
+ }
27
+ focus(e) {
28
+ this.hasAttribute("href") ? this.shadowRoot?.querySelector("a")?.focus(e) : super.focus(e);
29
+ }
30
+ update(e) {
31
+ s.includes(e) && this.#t();
32
+ }
33
+ #e() {
34
+ for (let e of this.shadowRoot?.querySelectorAll("slot[name]") ?? []) {
35
+ let t = `${e.name}-content`;
36
+ e.assignedElements().some((e) => !e.hasAttribute("hidden")) ? this.internals.states.add(t) : this.internals.states.delete(t);
37
+ }
38
+ }
39
+ #t() {
40
+ let e = this.shadowRoot?.querySelector("[part=\"link\"]");
41
+ if (!e) return;
42
+ let t = this.hasAttribute("href"), n = this.getRootNode().activeElement === this;
43
+ !t && !this.hasAttribute("role") ? this.setAttribute("role", "button") : t && this.getAttribute("role") === "button" && this.removeAttribute("role"), r(this, !t);
44
+ let i = t ? "a" : "span", a = e.localName === i ? e : this.ownerDocument.createElement(i);
45
+ if (t) for (let e of s) {
46
+ let t = this.getAttribute(e);
47
+ t === null ? a.removeAttribute(e) : a.setAttribute(e, t);
48
+ }
49
+ a !== e && (a.setAttribute("part", "link"), a.append(...e.childNodes), e.replaceWith(a), n && this.focus({ preventScroll: !0 }));
50
+ }
51
+ };
52
+ t("swell-link", c);
53
+ export { o as n, c as t };
@@ -0,0 +1,24 @@
1
+ // src/runtime/link.ts
2
+ function e() {
3
+ let e = /* @__PURE__ */ new WeakMap(), t;
4
+ return {
5
+ link(t, n) {
6
+ e.set(t, n);
7
+ },
8
+ groupOf(t) {
9
+ let n = t.parentElement;
10
+ return n && e.has(n) ? n : void 0;
11
+ },
12
+ linkOf(t) {
13
+ let n = t.parentElement;
14
+ return n ? e.get(n) : void 0;
15
+ },
16
+ receive(e) {
17
+ t = e;
18
+ },
19
+ sync(e, n) {
20
+ t(e, n);
21
+ }
22
+ };
23
+ }
24
+ export { e as t };
@@ -0,0 +1,205 @@
1
+ import { m as e } from "./config-C-FYxOaJ.js";
2
+ import { r as t, t as n } from "./define-BlQTa1g4.js";
3
+ import { n as r, t as i } from "./popup-Dbh2fchP.js";
4
+ import { r as a, t as o } from "./input-Uun-ls2_.js";
5
+ import { r as s } from "./select-option-DoM9GAe0.js";
6
+ import { r as c } from "./lookup-list-Bw6OJoDS.js";
7
+ import { n as l, t as u } from "./lookup-option-Mn3k8W2M.js";
8
+ // src/components/core/lookup/lookup.css?inline
9
+ var d = "swell-lookup{--_swell-control-font-size:var(--swell-control-font-size)}swell-lookup[size=xsmall]{--_swell-control-font-size:var(--swell-control-xsmall-font-size)}swell-lookup[size=small]{--_swell-control-font-size:var(--swell-control-small-font-size)}swell-lookup[size=large]{--_swell-control-font-size:var(--swell-control-large-font-size)}swell-lookup[size=xlarge]{--_swell-control-font-size:var(--swell-control-xlarge-font-size)}swell-lookup::part(list){box-sizing:border-box;border:var(--swell-border-width) solid var(--swell-overlay-color-border);border-radius:var(--swell-overlay-border-radius);font:var(--swell-font-weight) var(--_swell-control-font-size) / var(--swell-font-leading) var(--swell-font-family);letter-spacing:var(--swell-font-tracking);background:var(--swell-overlay-color-background);color:var(--swell-field-color-foreground);box-shadow:var(--swell-overlay-shadow) var(--swell-overlay-color-shadow);overscroll-behavior:contain;margin:0;padding:0;position:fixed;overflow:auto}@media (forced-colors:active){swell-lookup::part(list){box-shadow:none;border-color:canvastext}}swell-lookup>[slot=action]:not([hidden]){box-sizing:border-box;width:100%;padding:calc(var(--_swell-control-font-size) - 2px) calc(var(--_swell-control-font-size) + 2px);font:inherit;font-weight:var(--swell-font-strong-weight);letter-spacing:inherit;text-align:start;color:var(--swell-color-accent);cursor:pointer;transition:background-color var(--swell-motion-duration-fast) var(--swell-motion-easing);background:0 0;border:0;border-radius:0;margin:0;display:block}swell-lookup>[slot=action]:disabled{cursor:not-allowed;opacity:var(--swell-control-disabled-opacity)}swell-lookup>[slot=action]:focus-visible{outline:var(--swell-focus-width) solid var(--swell-focus-color);outline-offset:calc(var(--swell-focus-width) * -1)}swell-lookup>[slot=action]:hover:not(:disabled){background:var(--swell-color-secondary-background)}swell-lookup:has(>swell-lookup-list>swell-lookup-option:not([hidden]))>[slot=action]:not([hidden]){border-top:var(--swell-border-width) solid var(--swell-overlay-color-border)}@media (forced-colors:active){swell-lookup>[slot=action]:focus-visible{outline-color:highlight}}", f = /* @__PURE__ */ t({ SwellLookup: () => h }), p = /* @__PURE__ */ new WeakMap(), m = "<div part=\"list\" popover=\"manual\" tabindex=\"-1\"><slot></slot><slot name=\"action\"></slot></div>", h = class extends o {
10
+ static styles = a.replaceAll("swell-input", "swell-lookup") + d;
11
+ static prefix = "swell-lookup";
12
+ static template = o.template + m;
13
+ #e;
14
+ #t;
15
+ #n;
16
+ #r;
17
+ #i = !1;
18
+ #a = !1;
19
+ #o = !1;
20
+ #s;
21
+ #c = !1;
22
+ #l;
23
+ #u;
24
+ constructor() {
25
+ super();
26
+ let e = this.shadowRoot;
27
+ this.#n = e.querySelector("[part=\"frame\"]"), this.#r = e.querySelector("[part=\"list\"]");
28
+ for (let e of this.#r.querySelectorAll("slot")) e.addEventListener("slotchange", () => this.#g());
29
+ new MutationObserver(() => this.#g()).observe(this, {
30
+ attributeFilter: ["hidden"],
31
+ childList: !0,
32
+ characterData: !0,
33
+ subtree: !0
34
+ }), this.#r.addEventListener("mousedown", (e) => e.preventDefault()), this.addEventListener("click", this.#A), this.addEventListener("focusout", this.#E), this.addEventListener("keydown", this.#k);
35
+ }
36
+ disconnectedCallback() {
37
+ super.disconnectedCallback(), this.#a = !1, this.#S(!1);
38
+ }
39
+ setUpControl(e) {
40
+ e.addEventListener("keydown", this.#T), super.setUpControl(e), this.#e = e, e.addEventListener("change", (t) => {
41
+ t.isTrusted && (e.value === this.#s && t.stopImmediatePropagation(), this.#s = void 0);
42
+ }), e.addEventListener("input", () => {
43
+ this.#o || (this.#s = void 0, this.#a = !0, this.#y(void 0), this.#x());
44
+ });
45
+ }
46
+ render() {
47
+ super.render();
48
+ let e = this.#e;
49
+ this.#t = this.querySelector(":scope > .swell-lookup-label"), this.#t.id = `${e.id}-label`, this.#_();
50
+ }
51
+ update(e) {
52
+ super.update(e), (e === "disabled" || e === "readonly") && this.#x();
53
+ }
54
+ #d() {
55
+ return [...this.children].find((e) => e.localName === "swell-lookup-list");
56
+ }
57
+ #f() {
58
+ return [...this.#d()?.children ?? []].filter((e) => e instanceof u && !e.hidden);
59
+ }
60
+ #p() {
61
+ return this.#d() !== void 0 && this.#f().length > 0;
62
+ }
63
+ #m() {
64
+ return this.getRootNode().activeElement;
65
+ }
66
+ #h() {
67
+ let e = this.#m();
68
+ return e !== null && this.contains(e);
69
+ }
70
+ #g() {
71
+ this.#i || (this.#i = !0, queueMicrotask(() => {
72
+ this.#i = !1, this.#_();
73
+ }));
74
+ }
75
+ #_() {
76
+ let e = this.#e;
77
+ if (!e) return;
78
+ let t = this.#d();
79
+ if (t) {
80
+ s.link(t, {
81
+ choose: () => {},
82
+ refresh: () => this.#g()
83
+ }), c(t, "swell-lookup-list");
84
+ let n = this.#t.id, r = t.getAttribute("aria-labelledby");
85
+ t.hasAttribute("aria-label") || r !== null && p.get(t) !== r || (t.setAttribute("aria-labelledby", n), p.set(t, n)), e.setAttribute("role", "combobox"), e.setAttribute("aria-autocomplete", "list"), e.setAttribute("aria-expanded", String(this.#c)), e.setAttribute("aria-controls", t.id);
86
+ } else for (let t of [
87
+ "role",
88
+ "aria-autocomplete",
89
+ "aria-expanded",
90
+ "aria-controls"
91
+ ]) e.removeAttribute(t);
92
+ this.#f().forEach((e, t) => s.sync(e, {
93
+ selected: !1,
94
+ disabled: e.disabled,
95
+ first: t === 0
96
+ })), this.#u && !this.#v().includes(this.#u) ? this.#y(void 0) : this.#u && l(this.#u, !0), this.#x();
97
+ }
98
+ #v() {
99
+ return this.#f().filter((e) => !e.disabled);
100
+ }
101
+ #y(e) {
102
+ this.#u && this.#u !== e && l(this.#u, !1), this.#u = e;
103
+ let t = this.#e;
104
+ e ? (l(e, !0), t.setAttribute("aria-activedescendant", e.id), e.scrollIntoView({ block: "nearest" })) : t.removeAttribute("aria-activedescendant");
105
+ }
106
+ #b(e) {
107
+ let t = this.#v();
108
+ if (t.length === 0) return;
109
+ let n = this.#u ? t.indexOf(this.#u) : -1, r = n < 0 ? e > 0 ? 0 : t.length - 1 : (n + e + t.length) % t.length;
110
+ this.#y(t[r]);
111
+ }
112
+ #x() {
113
+ let e = this.#e;
114
+ this.#S(this.#a && this.isConnected && !this.disabled && !this.readOnly && e !== void 0 && this.#h() && this.#p());
115
+ }
116
+ #S(e) {
117
+ if (e === this.#c) e && this.#C();
118
+ else if (this.#c = e, this.#l?.(), this.#l = void 0, this.#d() && this.#e?.setAttribute("aria-expanded", String(e)), e) {
119
+ this.#r.showPopover();
120
+ let e = this.#C();
121
+ this.#l = i(this.#C), this.#w(e);
122
+ } else this.#O(this.#m()) && this.#e?.focus(), this.#r.isConnected && this.#r.matches(":popover-open") && this.#r.hidePopover(), this.#y(void 0);
123
+ }
124
+ #C = () => {
125
+ let e = r(this.#n, this.#r, this);
126
+ return this.#r.style.transformOrigin = e ? "bottom" : "top", e;
127
+ };
128
+ #w(t) {
129
+ let n = getComputedStyle(this.#r), r = e(n.getPropertyValue("--swell-motion-duration-base"));
130
+ if (r) try {
131
+ this.#r.animate([{
132
+ opacity: 0,
133
+ transform: `scale(0.96) translateY(${t ? 6 : -6}px)`
134
+ }, {
135
+ opacity: 1,
136
+ transform: "none"
137
+ }], {
138
+ duration: r,
139
+ easing: n.getPropertyValue("--swell-motion-easing")
140
+ });
141
+ } catch {}
142
+ }
143
+ #T = (e) => {
144
+ if (e.defaultPrevented || e.isComposing || this.disabled || this.readOnly || !this.#d()) return;
145
+ let { key: t } = e;
146
+ if (t === "ArrowDown" || t === "ArrowUp") {
147
+ if (e.ctrlKey || e.metaKey || e.shiftKey || !this.#p()) return;
148
+ if (e.preventDefault(), e.altKey && t === "ArrowUp") {
149
+ this.#D();
150
+ return;
151
+ }
152
+ this.#a = !0, this.#x(), e.altKey || this.#b(t === "ArrowDown" ? 1 : -1);
153
+ } else t === "Enter" && this.#c && this.#u ? (e.preventDefault(), this.#u.click()) : t === "Escape" && this.#c ? (e.preventDefault(), this.#D()) : [
154
+ "ArrowLeft",
155
+ "ArrowRight",
156
+ "Home",
157
+ "End"
158
+ ].includes(t) && this.#y(void 0);
159
+ };
160
+ #E = (e) => {
161
+ let t = e.relatedTarget;
162
+ t instanceof Node && this.contains(t) || this.#D();
163
+ };
164
+ #D() {
165
+ this.#a = !1, this.#S(!1);
166
+ }
167
+ #O(e) {
168
+ let t = e instanceof Element ? e.closest("[slot=\"action\"]") : null;
169
+ return t?.parentElement === this ? t : void 0;
170
+ }
171
+ #k = (e) => {
172
+ e.key === "Escape" && !e.defaultPrevented && this.#c && this.#O(e.target) && (e.preventDefault(), this.#e?.focus(), this.#D());
173
+ };
174
+ #A = (e) => {
175
+ let t = e.target, n = this.#O(t);
176
+ if (n) {
177
+ n.contains(this.#m()) && this.#e?.focus(), this.#D();
178
+ return;
179
+ }
180
+ let r = t.closest?.("swell-lookup-option");
181
+ if (!(r instanceof u) || r.parentElement !== this.#d() || r.disabled || this.disabled || this.readOnly) return;
182
+ this.#h() && this.#e?.focus(), this.#D();
183
+ let i = r.label;
184
+ setTimeout(() => {
185
+ !e.defaultPrevented && this.isConnected && this.#j(i);
186
+ });
187
+ };
188
+ #j(e) {
189
+ let t = this.#e;
190
+ t.value = e, this.#o = !0;
191
+ try {
192
+ t.dispatchEvent(new InputEvent("input", {
193
+ bubbles: !0,
194
+ composed: !0,
195
+ inputType: "insertReplacementText",
196
+ data: e
197
+ }));
198
+ } finally {
199
+ this.#o = !1;
200
+ }
201
+ this.#s = e, t.dispatchEvent(new Event("change", { bubbles: !0 }));
202
+ }
203
+ };
204
+ n("swell-lookup", h);
205
+ export { f as n, h as t };
@@ -0,0 +1,19 @@
1
+ import { r as e, t } from "./define-BlQTa1g4.js";
2
+ import { n } from "./element-B4-_7TLZ.js";
3
+ // src/components/core/lookup/lookup-list.ts
4
+ var r = /* @__PURE__ */ e({
5
+ SwellLookupList: () => c,
6
+ ownId: () => s
7
+ }), i = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new Set(), o = 0;
8
+ function s(e, t) {
9
+ let n = e.id;
10
+ (!n || a.has(n) && i.get(e) !== n) && (e.id = `${t}-${++o}`, a.add(e.id), i.set(e, e.id));
11
+ }
12
+ var c = class extends n {
13
+ static styles = ":host { display: block; }";
14
+ connectedCallback() {
15
+ this.hasAttribute("role") || this.setAttribute("role", "listbox"), s(this, "swell-lookup-list"), super.connectedCallback();
16
+ }
17
+ };
18
+ t("swell-lookup-list", c);
19
+ export { r as n, s as r, c as t };
@@ -0,0 +1,26 @@
1
+ import { r as e, t } from "./define-BlQTa1g4.js";
2
+ import { t as n } from "./select-option-DoM9GAe0.js";
3
+ import { r } from "./lookup-list-Bw6OJoDS.js";
4
+ // src/components/core/lookup/lookup-option.css?inline
5
+ var i = ":host .check{display:none}:host(:state(focused)){background:var(--swell-color-secondary-background);outline:var(--swell-focus-width) solid var(--swell-focus-color);outline-offset:calc(var(--swell-focus-width) * -1)}@media (forced-colors:active){:host(:state(focused)){forced-color-adjust:none;color:highlighttext;background:highlight;outline-color:highlighttext}:host(:state(focused)) .hint{color:inherit}}", a = /* @__PURE__ */ e({
6
+ SwellLookupOption: () => c,
7
+ activate: () => s
8
+ }), o;
9
+ function s(e, t) {
10
+ o(e, t);
11
+ }
12
+ var c = class extends n {
13
+ static styles = n.styles + i;
14
+ static focusable = !1;
15
+ static {
16
+ o = (e, t) => e.#e(t);
17
+ }
18
+ connectedCallback() {
19
+ r(this, "swell-lookup-option"), super.connectedCallback();
20
+ }
21
+ #e(e) {
22
+ this.setAttribute("aria-selected", String(e)), e ? this.internals.states.add("focused") : this.internals.states.delete("focused");
23
+ }
24
+ };
25
+ t("swell-lookup-option", c);
26
+ export { s as n, a as r, c as t };