dap-design-system 0.62.0 → 0.62.2

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 (45) hide show
  1. package/dist/components/combobox/comboboxBase.d.ts +6 -0
  2. package/dist/components/combobox/comboboxBase.js +79 -61
  3. package/dist/components/combobox/comboboxBase.js.map +1 -1
  4. package/dist/components/command/command-item.scss.js +1 -1
  5. package/dist/components/command/command.component.js +12 -12
  6. package/dist/components/command/command.component.js.map +1 -1
  7. package/dist/components/datatable/datatable.component.d.ts +2 -0
  8. package/dist/components/datatable/datatable.component.js +131 -112
  9. package/dist/components/datatable/datatable.component.js.map +1 -1
  10. package/dist/components/datatable/datatable.scss.js +1 -1
  11. package/dist/components/icon-button/icon-button.component.js +15 -12
  12. package/dist/components/icon-button/icon-button.component.js.map +1 -1
  13. package/dist/components/input/input-base-element.js +42 -38
  14. package/dist/components/input/input-base-element.js.map +1 -1
  15. package/dist/components/input/input.component.d.ts +1 -0
  16. package/dist/components/input/input.component.js.map +1 -1
  17. package/dist/components/option-list/option-list.component.js +16 -12
  18. package/dist/components/option-list/option-list.component.js.map +1 -1
  19. package/dist/components/select/select.component.js +71 -66
  20. package/dist/components/select/select.component.js.map +1 -1
  21. package/dist/components/snackbar/snackbar-message.component.js +16 -18
  22. package/dist/components/snackbar/snackbar-message.component.js.map +1 -1
  23. package/dist/components/snackbar/snackbar.component.js +48 -35
  24. package/dist/components/snackbar/snackbar.component.js.map +1 -1
  25. package/dist/components/table/table.component.d.ts +3 -0
  26. package/dist/components/table/table.component.js +30 -27
  27. package/dist/components/table/table.component.js.map +1 -1
  28. package/dist/components/textarea/textarea.component.d.ts +6 -1
  29. package/dist/components/textarea/textarea.component.js +43 -36
  30. package/dist/components/textarea/textarea.component.js.map +1 -1
  31. package/dist/components/tooltip/tooltip.component.d.ts +2 -0
  32. package/dist/components/tooltip/tooltip.component.js +51 -53
  33. package/dist/components/tooltip/tooltip.component.js.map +1 -1
  34. package/dist/internal/mixin/labelableMixin.d.ts +3 -0
  35. package/dist/internal/mixin/labelableMixin.js +15 -12
  36. package/dist/internal/mixin/labelableMixin.js.map +1 -1
  37. package/dist/manifest/types/vue/index.d.ts +87 -84
  38. package/dist/manifest/vscode.html-custom-data.json +64 -60
  39. package/dist/manifest/web-types.json +83 -73
  40. package/dist/react/dap-ds-input/index.d.ts +1 -0
  41. package/dist/react/dap-ds-input/index.js.map +1 -1
  42. package/dist/react/index.d.ts +4 -4
  43. package/dist/react-types.ts +4 -4
  44. package/dist/react.js +22 -22
  45. package/package.json +1 -1
@@ -60,8 +60,10 @@ export default class DapDSTooltip extends DdsElement {
60
60
  connectedCallback(): void;
61
61
  disconnectedCallback(): void;
62
62
  protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
63
+ private setTriggerExpanded;
63
64
  showTooltip(): Promise<void>;
64
65
  hideTooltip(): Promise<void>;
66
+ private readonly handleDocumentKeyDown;
65
67
  private readonly handleBlur;
66
68
  private readonly handleClick;
67
69
  private readonly handleFocus;
@@ -1,38 +1,40 @@
1
- var g = (d, t, s) => new Promise((l, o) => {
2
- var p = (h) => {
1
+ var g = (a, e, t) => new Promise((h, s) => {
2
+ var p = (n) => {
3
3
  try {
4
- u(s.next(h));
4
+ u(t.next(n));
5
5
  } catch (c) {
6
- o(c);
6
+ s(c);
7
7
  }
8
- }, n = (h) => {
8
+ }, l = (n) => {
9
9
  try {
10
- u(s.throw(h));
10
+ u(t.throw(n));
11
11
  } catch (c) {
12
- o(c);
12
+ s(c);
13
13
  }
14
- }, u = (h) => h.done ? l(h.value) : Promise.resolve(h.value).then(p, n);
15
- u((s = s.apply(d, t)).next());
14
+ }, u = (n) => n.done ? h(n.value) : Promise.resolve(n.value).then(p, l);
15
+ u((t = t.apply(a, e)).next());
16
16
  });
17
- import { clsx as m } from "../../node_modules/clsx/dist/clsx.js";
17
+ import { clsx as f } from "../../node_modules/clsx/dist/clsx.js";
18
18
  import "../../node_modules/@lit/reactive-element/reactive-element.js";
19
19
  import "../../node_modules/lit-html/lit-html.js";
20
20
  import "../../node_modules/lit-element/lit-element.js";
21
21
  import { property as r } from "../../node_modules/@lit/reactive-element/decorators/property.js";
22
22
  import { state as v } from "../../node_modules/@lit/reactive-element/decorators/state.js";
23
- import { html as f } from "../../node_modules/lit-html/static.js";
23
+ import { html as m } from "../../node_modules/lit-html/static.js";
24
24
  import { DdsElement as y } from "../../internal/dds-hu-element.js";
25
- import b from "../popup/popup.component.js";
25
+ import w from "../popup/popup.component.js";
26
26
  import T from "./tooltip.scss.js";
27
- import { unsafeCSS as w } from "../../node_modules/@lit/reactive-element/css-tag.js";
28
- var O = Object.defineProperty, C = Object.getOwnPropertyDescriptor, i = (d, t, s, l) => {
29
- for (var o = l > 1 ? void 0 : l ? C(t, s) : t, p = d.length - 1, n; p >= 0; p--)
30
- (n = d[p]) && (o = (l ? n(t, s, o) : n(o)) || o);
31
- return l && o && O(t, s, o), o;
27
+ import { unsafeCSS as b } from "../../node_modules/@lit/reactive-element/css-tag.js";
28
+ var E = Object.defineProperty, O = Object.getOwnPropertyDescriptor, i = (a, e, t, h) => {
29
+ for (var s = h > 1 ? void 0 : h ? O(e, t) : e, p = a.length - 1, l; p >= 0; p--)
30
+ (l = a[p]) && (s = (h ? l(e, t, s) : l(s)) || s);
31
+ return h && s && E(e, t, s), s;
32
32
  };
33
- const $ = 8, a = class a extends y {
33
+ const L = 8, d = class d extends y {
34
34
  constructor() {
35
- super(...arguments), this.placement = "bottom", this.opened = !1, this.mode = "tooltip", this.noArrow = !1, this.floatingStrategy = "absolute", this.disableViewportAutoClose = !1, this._trigger = "hover focus", this.mouseOverTooltip = !1, this.handleBlur = () => {
35
+ super(...arguments), this.placement = "bottom", this.opened = !1, this.mode = "tooltip", this.noArrow = !1, this.floatingStrategy = "absolute", this.disableViewportAutoClose = !1, this._trigger = "hover focus", this.mouseOverTooltip = !1, this.handleDocumentKeyDown = (e) => {
36
+ e.key === "Escape" && this.opened && (e.preventDefault(), e.stopPropagation(), this.hideTooltip());
37
+ }, this.handleBlur = () => {
36
38
  this.hasTrigger("focus") && this.hideTooltip();
37
39
  }, this.handleClick = () => {
38
40
  this.hasTrigger("click") && (this.opened && !this.hasTrigger("focus") ? this.hideTooltip() : this.showTooltip());
@@ -42,10 +44,10 @@ const $ = 8, a = class a extends y {
42
44
  this.hasTrigger("hover") && this.showTooltip();
43
45
  }, this.handleMouseOut = () => {
44
46
  this.mouseOverTooltip || this.hasTrigger("hover") && this.hideTooltip();
45
- }, this.hasTrigger = (t) => this.trigger.split(" ").includes(t);
47
+ }, this.hasTrigger = (e) => this.trigger.split(" ").includes(e);
46
48
  }
47
- set trigger(t) {
48
- this._trigger = t;
49
+ set trigger(e) {
50
+ this._trigger = e;
49
51
  }
50
52
  get trigger() {
51
53
  return this.mode ? this.mode === "toggle" ? "click" : this._trigger : "hover focus";
@@ -54,31 +56,27 @@ const $ = 8, a = class a extends y {
54
56
  super.connectedCallback(), this.addEventListener("blur", this.handleBlur, !0), this.addEventListener("focus", this.handleFocus, !0), this.addEventListener("click", this.handleClick), this.addEventListener("mouseover", this.handleMouseOver), this.addEventListener("mouseout", this.handleMouseOut);
55
57
  }
56
58
  disconnectedCallback() {
57
- this.removeEventListener("blur", this.handleBlur, !0), this.removeEventListener("focus", this.handleFocus, !0), this.removeEventListener("click", this.handleClick), this.removeEventListener("mouseover", this.handleMouseOver), this.removeEventListener("mouseout", this.handleMouseOut), super.disconnectedCallback();
59
+ this.removeEventListener("blur", this.handleBlur, !0), this.removeEventListener("focus", this.handleFocus, !0), this.removeEventListener("click", this.handleClick), this.removeEventListener("mouseover", this.handleMouseOver), this.removeEventListener("mouseout", this.handleMouseOut), document.removeEventListener("keydown", this.handleDocumentKeyDown, !0), super.disconnectedCallback();
58
60
  }
59
- firstUpdated(t) {
60
- super.firstUpdated(t), this.setAttribute("role", "status");
61
+ firstUpdated(e) {
62
+ super.firstUpdated(e), this.setAttribute("role", "status"), this.setTriggerExpanded(!!this.opened), this.opened && document.addEventListener("keydown", this.handleDocumentKeyDown, !0);
63
+ }
64
+ setTriggerExpanded(e) {
65
+ const t = this.querySelector('[slot="trigger"]');
66
+ t && t.setAttribute("aria-expanded", String(e));
61
67
  }
62
68
  showTooltip() {
63
69
  return g(this, null, function* () {
64
- if (this.opened)
65
- return;
66
- this.opened = !0;
67
- const t = this.querySelector('[slot="trigger"]');
68
- t && t.setAttribute("aria-expanded", "true");
70
+ this.opened || (this.opened = !0, this.setTriggerExpanded(!0), document.addEventListener("keydown", this.handleDocumentKeyDown, !0));
69
71
  });
70
72
  }
71
73
  hideTooltip() {
72
74
  return g(this, null, function* () {
73
- if (!this.opened)
74
- return;
75
- this.opened = !1;
76
- const t = this.querySelector('[slot="trigger"]');
77
- t && t.setAttribute("aria-expanded", "false");
75
+ this.opened && (this.opened = !1, this.setTriggerExpanded(!1), document.removeEventListener("keydown", this.handleDocumentKeyDown, !0));
78
76
  });
79
77
  }
80
78
  render() {
81
- return f`
79
+ return m`
82
80
  <dap-ds-popup
83
81
  part="base"
84
82
  role="tooltip"
@@ -87,14 +85,14 @@ const $ = 8, a = class a extends y {
87
85
  popup:base__popup,
88
86
  arrow:base__arrow
89
87
  "
90
- class=${m("tooltip", {
88
+ class=${f("tooltip", {
91
89
  "tooltip--open": this.opened,
92
90
  "tooltip--tooltip": this.mode === "tooltip",
93
91
  "tooltip--toggle": this.mode === "toggle"
94
92
  })}
95
93
  ?opened=${this.opened}
96
94
  placement=${this.placement}
97
- offset=${$}
95
+ offset=${L}
98
96
  floatingStrategy=${this.floatingStrategy}
99
97
  ?disableViewportAutoClose=${this.disableViewportAutoClose}
100
98
  ?hasArrow=${!this.noArrow}
@@ -106,43 +104,43 @@ const $ = 8, a = class a extends y {
106
104
  name="trigger"
107
105
  slot="trigger"
108
106
  aria-describedby="tooltip"></slot>
109
- ${this.content ? f`${this.content}` : f`<slot></slot>`}
107
+ ${this.content ? m`${this.content}` : m`<slot></slot>`}
110
108
  </dap-ds-popup>
111
109
  `;
112
110
  }
113
111
  };
114
- a.tagName = "dap-ds-tooltip", a.dependencies = {
115
- "dap-ds-popup": b
116
- }, a.styles = w(T);
117
- let e = a;
112
+ d.tagName = "dap-ds-tooltip", d.dependencies = {
113
+ "dap-ds-popup": w
114
+ }, d.styles = b(T);
115
+ let o = d;
118
116
  i([
119
117
  r()
120
- ], e.prototype, "content", 2);
118
+ ], o.prototype, "content", 2);
121
119
  i([
122
120
  r({ reflect: !0 })
123
- ], e.prototype, "placement", 2);
121
+ ], o.prototype, "placement", 2);
124
122
  i([
125
123
  r({ type: Boolean, reflect: !0 })
126
- ], e.prototype, "opened", 2);
124
+ ], o.prototype, "opened", 2);
127
125
  i([
128
126
  r()
129
- ], e.prototype, "mode", 2);
127
+ ], o.prototype, "mode", 2);
130
128
  i([
131
129
  r({ type: Boolean, reflect: !0 })
132
- ], e.prototype, "noArrow", 2);
130
+ ], o.prototype, "noArrow", 2);
133
131
  i([
134
132
  r({ reflect: !0 })
135
- ], e.prototype, "floatingStrategy", 2);
133
+ ], o.prototype, "floatingStrategy", 2);
136
134
  i([
137
135
  r({ type: Boolean })
138
- ], e.prototype, "disableViewportAutoClose", 2);
136
+ ], o.prototype, "disableViewportAutoClose", 2);
139
137
  i([
140
138
  r()
141
- ], e.prototype, "trigger", 1);
139
+ ], o.prototype, "trigger", 1);
142
140
  i([
143
141
  v()
144
- ], e.prototype, "mouseOverTooltip", 2);
142
+ ], o.prototype, "mouseOverTooltip", 2);
145
143
  export {
146
- e as default
144
+ o as default
147
145
  };
148
146
  //# sourceMappingURL=tooltip.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.component.js","sources":["../../../src/components/tooltip/tooltip.component.ts"],"sourcesContent":["import { clsx } from 'clsx'\nimport { PropertyValueMap, unsafeCSS } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { html } from 'lit/static-html.js'\n\nimport { PopupPlacement } from '../../common/types'\nimport { DdsElement } from '../../internal/dds-hu-element'\nimport DapDSPopup from '../popup/popup.component'\nimport styles from './tooltip.scss?inline'\nexport type TooltipMode = 'tooltip' | 'toggle'\n\n/**\n * The distance in pixels between the tooltip and the trigger element.\n */\nconst TOOLTIP_OFFSET = 8\n\n/**\n * `dap-ds-tooltip`\n * @summary A tooltip is a container for tooltip content.\n * @element dap-ds-tooltip\n * @title - Tooltip\n *\n * @slot - The content of the tooltip.\n * @slot trigger - The trigger element of the tooltip.\n *\n * @csspart base - The main tooltip container.\n * @csspart trigger - The trigger element of the tooltip.\n * @csspart popup - The popup of the tooltip.\n * @csspart arrow - The arrow of the tooltip.\n *\n * @cssproperty --dds-tooltip-max-width - The maximum width of the tooltip before its content will wrap (default: 14rem)\n * @cssproperty --dds-tooltip-padding - The padding inside the tooltip (default: var(--dds-spacing-400))\n * @cssproperty --dds-tooltip-border-color - The border color of the tooltip (default: var(--dds-border-neutral-subtle))\n * @cssproperty --dds-tooltip-bg-color - The background color of the tooltip (default: var(--dds-background-neutral-base))\n * @cssproperty --dds-tooltip-text-color - The text color of the tooltip (default: var(--dds-text-neutral-base))\n * @cssproperty --dds-tooltip-font-size - The font size of the tooltip text (default: var(--dds-font-sm))\n * @cssproperty --dds-tooltip-box-shadow - The box shadow of the tooltip (default: 0 8px 12px -2px rgb(0 0 0 / 8%), 0 2px 6px -2px rgb(0 0 0 / 6%))\n */\nexport default class DapDSTooltip extends DdsElement {\n static tagName = 'dap-ds-tooltip'\n\n static dependencies = {\n 'dap-ds-popup': DapDSPopup,\n }\n\n static readonly styles = unsafeCSS(styles)\n\n /** The content of the tooltip, supporting text only. */\n @property() content: string\n\n /** The position of the tooltip around the trigger element.\n * @type { 'top' | 'right' | 'bottom' | 'left' }\n */\n @property({ reflect: true }) placement: PopupPlacement = 'bottom'\n\n /** Sets the tooltip to opened by default (will still be closed on closing events). */\n @property({ type: Boolean, reflect: true }) opened? = false\n\n /** Sets the tooltip to toggle mode.\n * @type { 'tooltip' | 'toggle' }\n */\n @property() mode?: TooltipMode = 'tooltip'\n\n /** Hides the arrow of the tooltip. */\n @property({ type: Boolean, reflect: true }) noArrow? = false\n\n /** The floating strategy of the tooltip. Default is `absolute`. Can be `absolute` or `fixed`.\n * @type { 'absolute' | 'fixed' }\n */\n @property({ reflect: true })\n floatingStrategy: 'absolute' | 'fixed' = 'absolute'\n\n /** Whether to keep popup open when trigger leaves viewport. */\n @property({ type: Boolean }) disableViewportAutoClose: boolean = false\n\n private _trigger: string = 'hover focus'\n\n /** Sets custom trigger event (hover, focus, click). Default is `hover focus`. */\n @property()\n set trigger(value: string) {\n this._trigger = value\n }\n get trigger() {\n if (!this.mode) {\n return 'hover focus'\n }\n\n if (this.mode === 'toggle') {\n return 'click'\n }\n\n return this._trigger\n }\n\n /** @ignore */\n @state() mouseOverTooltip: boolean = false\n\n connectedCallback() {\n super.connectedCallback()\n this.addEventListener('blur', this.handleBlur, true)\n this.addEventListener('focus', this.handleFocus, true)\n this.addEventListener('click', this.handleClick)\n this.addEventListener('mouseover', this.handleMouseOver)\n this.addEventListener('mouseout', this.handleMouseOut)\n }\n\n disconnectedCallback() {\n this.removeEventListener('blur', this.handleBlur, true)\n this.removeEventListener('focus', this.handleFocus, true)\n this.removeEventListener('click', this.handleClick)\n this.removeEventListener('mouseover', this.handleMouseOver)\n this.removeEventListener('mouseout', this.handleMouseOut)\n super.disconnectedCallback()\n }\n\n protected firstUpdated(\n _changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>,\n ): void {\n super.firstUpdated(_changedProperties)\n\n this.setAttribute('role', 'status')\n }\n\n async showTooltip() {\n if (this.opened) {\n return\n }\n\n this.opened = true\n\n const trigger = this.querySelector('[slot=\"trigger\"]')\n if (trigger) {\n trigger.setAttribute('aria-expanded', 'true')\n }\n }\n\n async hideTooltip() {\n if (!this.opened) {\n return\n }\n\n this.opened = false\n\n const trigger = this.querySelector('[slot=\"trigger\"]')\n if (trigger) {\n trigger.setAttribute('aria-expanded', 'false')\n }\n }\n\n private readonly handleBlur = () => {\n if (this.hasTrigger('focus')) {\n this.hideTooltip()\n }\n }\n\n private readonly handleClick = () => {\n if (this.hasTrigger('click')) {\n this.opened && !this.hasTrigger('focus')\n ? this.hideTooltip()\n : this.showTooltip()\n }\n }\n\n private readonly handleFocus = () => {\n if (this.hasTrigger('focus')) {\n this.showTooltip()\n }\n }\n\n private readonly handleMouseOver = () => {\n if (this.hasTrigger('hover')) {\n this.showTooltip()\n }\n }\n\n private readonly handleMouseOut = () => {\n if (!this.mouseOverTooltip) {\n if (this.hasTrigger('hover')) {\n this.hideTooltip()\n }\n }\n }\n\n private readonly hasTrigger = (triggerType: string) => {\n const triggers = this.trigger.split(' ')\n return triggers.includes(triggerType)\n }\n\n render() {\n return html`\n <dap-ds-popup\n part=\"base\"\n role=\"tooltip\"\n id=\"tooltip\"\n exportparts=\"\n popup:base__popup,\n arrow:base__arrow\n \"\n class=${clsx('tooltip', {\n 'tooltip--open': this.opened,\n 'tooltip--tooltip': this.mode === 'tooltip',\n 'tooltip--toggle': this.mode === 'toggle',\n })}\n ?opened=${this.opened}\n placement=${this.placement}\n offset=${TOOLTIP_OFFSET}\n floatingStrategy=${this.floatingStrategy}\n ?disableViewportAutoClose=${this.disableViewportAutoClose}\n ?hasArrow=${!this.noArrow}\n @dds-close=${this.hideTooltip}\n @dds-closed=${this.hideTooltip}\n @dds-opened=${this.showTooltip}>\n <slot\n part=\"trigger\"\n name=\"trigger\"\n slot=\"trigger\"\n aria-describedby=\"tooltip\"></slot>\n ${this.content ? html`${this.content}` : html`<slot></slot>`}\n </dap-ds-popup>\n `\n }\n}\n"],"names":["TOOLTIP_OFFSET","_DapDSTooltip","DdsElement","triggerType","value","_changedProperties","__async","trigger","html","clsx","DapDSPopup","unsafeCSS","styles","DapDSTooltip","__decorateClass","property","state"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAMA,IAAiB,GAwBFC,IAArB,MAAqBA,UAAqBC,EAAW;AAAA,EAArD,cAAA;AA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KA,gBAAmB;AAAA;AAAA;AAAA,EAAA;AAIpE;AAtLEP,EAAO,UAAU,kBAEjBA,EAAO,eAAe;AAAA,EACpB,gBAAgBS;AAClB,GAEgBT,EAAA,SAASU,EAAUC,CAAM;AAP3C,IAAqBC,IAArBZ;AAUca,EAAA;AAAA,EAAXC,EAAS;AAAA,GAVSF,EAUP,WAAA,WAAA,CAAA;AAKiBC,EAAA;AAAA,EAA5BC,EAAS,EAAE,SAAS,GAAM,CAAA;AAAA,GAfRF,EAeU,WAAA,aAAA,CAAA;AAGeC,EAAA;AAAA,EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,GAAM,CAAA;AAAA,GAlBvBF,EAkByB,WAAA,UAAA,CAAA;AAKhCC,EAAA;AAAA,EAAXC,EAAS;AAAA,GAvBSF,EAuBP,WAAA,QAAA,CAAA;AAGgCC,EAAA;AAAA,EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,GAAM,CAAA;AAAA,GA1BvBF,EA0ByB,WAAA,WAAA,CAAA;AAM5CC,EAAA;AAAA,EADCC,EAAS,EAAE,SAAS,GAAM,CAAA;AAAA,GA/BRF,EAgCnB,WAAA,oBAAA,CAAA;AAG6BC,EAAA;AAAA,EAA5BC,EAAS,EAAE,MAAM,QAAS,CAAA;AAAA,GAnCRF,EAmCU,WAAA,4BAAA,CAAA;AAMzBC,EAAA;AAAA,EADHC,EAAS;AAAA,GAxCSF,EAyCf,WAAA,WAAA,CAAA;AAgBKC,EAAA;AAAA,EAARE,EAAM;AAAA,GAzDYH,EAyDV,WAAA,oBAAA,CAAA;"}
1
+ {"version":3,"file":"tooltip.component.js","sources":["../../../src/components/tooltip/tooltip.component.ts"],"sourcesContent":["import { clsx } from 'clsx'\nimport { PropertyValueMap, unsafeCSS } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { html } from 'lit/static-html.js'\n\nimport { PopupPlacement } from '../../common/types'\nimport { DdsElement } from '../../internal/dds-hu-element'\nimport DapDSPopup from '../popup/popup.component'\nimport styles from './tooltip.scss?inline'\nexport type TooltipMode = 'tooltip' | 'toggle'\n\n/**\n * The distance in pixels between the tooltip and the trigger element.\n */\nconst TOOLTIP_OFFSET = 8\n\n/**\n * `dap-ds-tooltip`\n * @summary A tooltip is a container for tooltip content.\n * @element dap-ds-tooltip\n * @title - Tooltip\n *\n * @slot - The content of the tooltip.\n * @slot trigger - The trigger element of the tooltip.\n *\n * @csspart base - The main tooltip container.\n * @csspart trigger - The trigger element of the tooltip.\n * @csspart popup - The popup of the tooltip.\n * @csspart arrow - The arrow of the tooltip.\n *\n * @cssproperty --dds-tooltip-max-width - The maximum width of the tooltip before its content will wrap (default: 14rem)\n * @cssproperty --dds-tooltip-padding - The padding inside the tooltip (default: var(--dds-spacing-400))\n * @cssproperty --dds-tooltip-border-color - The border color of the tooltip (default: var(--dds-border-neutral-subtle))\n * @cssproperty --dds-tooltip-bg-color - The background color of the tooltip (default: var(--dds-background-neutral-base))\n * @cssproperty --dds-tooltip-text-color - The text color of the tooltip (default: var(--dds-text-neutral-base))\n * @cssproperty --dds-tooltip-font-size - The font size of the tooltip text (default: var(--dds-font-sm))\n * @cssproperty --dds-tooltip-box-shadow - The box shadow of the tooltip (default: 0 8px 12px -2px rgb(0 0 0 / 8%), 0 2px 6px -2px rgb(0 0 0 / 6%))\n */\nexport default class DapDSTooltip extends DdsElement {\n static tagName = 'dap-ds-tooltip'\n\n static dependencies = {\n 'dap-ds-popup': DapDSPopup,\n }\n\n static readonly styles = unsafeCSS(styles)\n\n /** The content of the tooltip, supporting text only. */\n @property() content: string\n\n /** The position of the tooltip around the trigger element.\n * @type { 'top' | 'right' | 'bottom' | 'left' }\n */\n @property({ reflect: true }) placement: PopupPlacement = 'bottom'\n\n /** Sets the tooltip to opened by default (will still be closed on closing events). */\n @property({ type: Boolean, reflect: true }) opened? = false\n\n /** Sets the tooltip to toggle mode.\n * @type { 'tooltip' | 'toggle' }\n */\n @property() mode?: TooltipMode = 'tooltip'\n\n /** Hides the arrow of the tooltip. */\n @property({ type: Boolean, reflect: true }) noArrow? = false\n\n /** The floating strategy of the tooltip. Default is `absolute`. Can be `absolute` or `fixed`.\n * @type { 'absolute' | 'fixed' }\n */\n @property({ reflect: true })\n floatingStrategy: 'absolute' | 'fixed' = 'absolute'\n\n /** Whether to keep popup open when trigger leaves viewport. */\n @property({ type: Boolean }) disableViewportAutoClose: boolean = false\n\n private _trigger: string = 'hover focus'\n\n /** Sets custom trigger event (hover, focus, click). Default is `hover focus`. */\n @property()\n set trigger(value: string) {\n this._trigger = value\n }\n get trigger() {\n if (!this.mode) {\n return 'hover focus'\n }\n\n if (this.mode === 'toggle') {\n return 'click'\n }\n\n return this._trigger\n }\n\n /** @ignore */\n @state() mouseOverTooltip: boolean = false\n\n connectedCallback() {\n super.connectedCallback()\n this.addEventListener('blur', this.handleBlur, true)\n this.addEventListener('focus', this.handleFocus, true)\n this.addEventListener('click', this.handleClick)\n this.addEventListener('mouseover', this.handleMouseOver)\n this.addEventListener('mouseout', this.handleMouseOut)\n }\n\n disconnectedCallback() {\n this.removeEventListener('blur', this.handleBlur, true)\n this.removeEventListener('focus', this.handleFocus, true)\n this.removeEventListener('click', this.handleClick)\n this.removeEventListener('mouseover', this.handleMouseOver)\n this.removeEventListener('mouseout', this.handleMouseOut)\n document.removeEventListener('keydown', this.handleDocumentKeyDown, true)\n super.disconnectedCallback()\n }\n\n protected firstUpdated(\n _changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>,\n ): void {\n super.firstUpdated(_changedProperties)\n\n this.setAttribute('role', 'status')\n\n // Expose the collapsed state from the start, not only after the first open\n this.setTriggerExpanded(!!this.opened)\n if (this.opened) {\n document.addEventListener('keydown', this.handleDocumentKeyDown, true)\n }\n }\n\n private setTriggerExpanded(expanded: boolean) {\n const trigger = this.querySelector('[slot=\"trigger\"]')\n if (trigger) {\n trigger.setAttribute('aria-expanded', String(expanded))\n }\n }\n\n async showTooltip() {\n if (this.opened) {\n return\n }\n\n this.opened = true\n this.setTriggerExpanded(true)\n document.addEventListener('keydown', this.handleDocumentKeyDown, true)\n }\n\n async hideTooltip() {\n if (!this.opened) {\n return\n }\n\n this.opened = false\n this.setTriggerExpanded(false)\n document.removeEventListener('keydown', this.handleDocumentKeyDown, true)\n }\n\n // Escape dismisses the tooltip without moving focus or pointer (WCAG 1.4.13).\n // Captured on document so it works for hover too, and stopped so an enclosing\n // modal does not close on the same keypress.\n private readonly handleDocumentKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape' && this.opened) {\n event.preventDefault()\n event.stopPropagation()\n this.hideTooltip()\n }\n }\n\n private readonly handleBlur = () => {\n if (this.hasTrigger('focus')) {\n this.hideTooltip()\n }\n }\n\n private readonly handleClick = () => {\n if (this.hasTrigger('click')) {\n this.opened && !this.hasTrigger('focus')\n ? this.hideTooltip()\n : this.showTooltip()\n }\n }\n\n private readonly handleFocus = () => {\n if (this.hasTrigger('focus')) {\n this.showTooltip()\n }\n }\n\n private readonly handleMouseOver = () => {\n if (this.hasTrigger('hover')) {\n this.showTooltip()\n }\n }\n\n private readonly handleMouseOut = () => {\n if (!this.mouseOverTooltip) {\n if (this.hasTrigger('hover')) {\n this.hideTooltip()\n }\n }\n }\n\n private readonly hasTrigger = (triggerType: string) => {\n const triggers = this.trigger.split(' ')\n return triggers.includes(triggerType)\n }\n\n render() {\n return html`\n <dap-ds-popup\n part=\"base\"\n role=\"tooltip\"\n id=\"tooltip\"\n exportparts=\"\n popup:base__popup,\n arrow:base__arrow\n \"\n class=${clsx('tooltip', {\n 'tooltip--open': this.opened,\n 'tooltip--tooltip': this.mode === 'tooltip',\n 'tooltip--toggle': this.mode === 'toggle',\n })}\n ?opened=${this.opened}\n placement=${this.placement}\n offset=${TOOLTIP_OFFSET}\n floatingStrategy=${this.floatingStrategy}\n ?disableViewportAutoClose=${this.disableViewportAutoClose}\n ?hasArrow=${!this.noArrow}\n @dds-close=${this.hideTooltip}\n @dds-closed=${this.hideTooltip}\n @dds-opened=${this.showTooltip}>\n <slot\n part=\"trigger\"\n name=\"trigger\"\n slot=\"trigger\"\n aria-describedby=\"tooltip\"></slot>\n ${this.content ? html`${this.content}` : html`<slot></slot>`}\n </dap-ds-popup>\n `\n }\n}\n"],"names":["TOOLTIP_OFFSET","_DapDSTooltip","DdsElement","event","triggerType","value","_changedProperties","expanded","trigger","__async","html","clsx","DapDSPopup","unsafeCSS","styles","DapDSTooltip","__decorateClass","property","state"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAMA,IAAiB,GAwBFC,IAArB,MAAqBA,UAAqBC,EAAW;AAAA,EAArD,cAAA;AAAA,UAAA,GAAA,SAAA,GAe2D,KAAA,YAAA,UAGH,KAAA,SAAA,IAKrB,KAAA,OAAA,WAGsB,KAAA,UAAA,IAMd,KAAA,mBAAA,YAGwB,KAAA,2BAAA,IAEjE,KAAQ,WAAmB,eAoBU,KAAA,mBAAA,IAiEpB,KAAA,wBAAwB,CAACC,MAAyB;AACjE,MAAIA,EAAM,QAAQ,YAAY,KAAK,WACjCA,EAAM,eAAe,GACrBA,EAAM,gBAAgB,GACtB,KAAK,YAAY;AAAA,IAErB,GAEA,KAAiB,aAAa,MAAM;AAC9B,MAAA,KAAK,WAAW,OAAO,KACzB,KAAK,YAAY;AAAA,IAErB,GAEA,KAAiB,cAAc,MAAM;AAC/B,MAAA,KAAK,WAAW,OAAO,MACpB,KAAA,UAAU,CAAC,KAAK,WAAW,OAAO,IACnC,KAAK,YAAA,IACL,KAAK,YAAY;AAAA,IAEzB,GAEA,KAAiB,cAAc,MAAM;AAC/B,MAAA,KAAK,WAAW,OAAO,KACzB,KAAK,YAAY;AAAA,IAErB,GAEA,KAAiB,kBAAkB,MAAM;AACnC,MAAA,KAAK,WAAW,OAAO,KACzB,KAAK,YAAY;AAAA,IAErB,GAEA,KAAiB,iBAAiB,MAAM;AAClC,MAAC,KAAK,oBACJ,KAAK,WAAW,OAAO,KACzB,KAAK,YAAY;AAAA,IAGvB,GAEiB,K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hCC,EAAA;AAAA,EAAXC,EAAS;AAAA,GAvBSF,EAuBP,WAAA,QAAA,CAAA;AAGgCC,EAAA;AAAA,EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,GAAM,CAAA;AAAA,GA1BvBF,EA0ByB,WAAA,WAAA,CAAA;AAM5CC,EAAA;AAAA,EADCC,EAAS,EAAE,SAAS,GAAM,CAAA;AAAA,GA/BRF,EAgCnB,WAAA,oBAAA,CAAA;AAG6BC,EAAA;AAAA,EAA5BC,EAAS,EAAE,MAAM,QAAS,CAAA;AAAA,GAnCRF,EAmCU,WAAA,4BAAA,CAAA;AAMzBC,EAAA;AAAA,EADHC,EAAS;AAAA,GAxCSF,EAyCf,WAAA,WAAA,CAAA;AAgBKC,EAAA;AAAA,EAARE,EAAM;AAAA,GAzDYH,EAyDV,WAAA,oBAAA,CAAA;"}
@@ -1,5 +1,7 @@
1
1
  import { LitElement } from 'lit';
2
2
  import { PopupPlacement, Size } from '../../common/types';
3
+ /** How a form label tooltip opens: `click` (click/Enter toggle) or `hover` (hover + keyboard focus). */
4
+ export type TooltipTrigger = 'click' | 'hover';
3
5
  type Constructor<T = Record<string, unknown>> = {
4
6
  new (...args: any[]): T;
5
7
  prototype: T;
@@ -10,6 +12,7 @@ export interface LabelableElementInterface {
10
12
  description?: string;
11
13
  tooltip?: string;
12
14
  tooltipPlacement: PopupPlacement;
15
+ tooltipTrigger: TooltipTrigger;
13
16
  size: Size;
14
17
  required: boolean;
15
18
  requiredLabel: string;
@@ -1,26 +1,26 @@
1
1
  import { clsx as d } from "../../node_modules/clsx/dist/clsx.js";
2
2
  import "../../node_modules/@lit/reactive-element/reactive-element.js";
3
- import { html as r } from "../../node_modules/lit-html/lit-html.js";
3
+ import { html as a } from "../../node_modules/lit-html/lit-html.js";
4
4
  import "../../node_modules/lit-element/lit-element.js";
5
5
  import { property as e } from "../../node_modules/@lit/reactive-element/decorators/property.js";
6
6
  import { ifDefined as b } from "../../node_modules/lit-html/directives/if-defined.js";
7
7
  import "../../localization/localization.js";
8
8
  import { t as h } from "../../node_modules/i18next/dist/esm/i18next.js";
9
- var c = Object.defineProperty, o = (l, t, p, a) => {
9
+ var c = Object.defineProperty, o = (l, t, p, r) => {
10
10
  for (var i = void 0, s = l.length - 1, n; s >= 0; s--)
11
11
  (n = l[s]) && (i = n(t, p, i) || i);
12
12
  return i && c(t, p, i), i;
13
13
  };
14
- const g = (l) => {
14
+ const q = (l) => {
15
15
  class t extends l {
16
16
  constructor() {
17
- super(...arguments), this.hideLabel = !1, this.tooltipPlacement = "bottom", this.size = "sm", this.optional = !1, this.optionalLabel = h("label.optional"), this.subtle = !1, this.required = !1, this.requiredLabel = "*", this.disabled = !1, this.tooltipAriaLabel = h("label.tooltip");
17
+ super(...arguments), this.hideLabel = !1, this.tooltipPlacement = "bottom", this.tooltipTrigger = "click", this.size = "sm", this.optional = !1, this.optionalLabel = h("label.optional"), this.subtle = !1, this.required = !1, this.requiredLabel = "*", this.disabled = !1, this.tooltipAriaLabel = h("label.tooltip");
18
18
  }
19
- renderLabel(a, i) {
20
- return r` <div class="label-container">
21
- ${this.label && r`<dap-ds-form-label
19
+ renderLabel(r, i) {
20
+ return a` <div class="label-container">
21
+ ${this.label && a`<dap-ds-form-label
22
22
  part="label"
23
- id=${a != null ? a : "label"}
23
+ id=${r != null ? r : "label"}
24
24
  exportparts="base: label-base, required: label-required, optional: label-optional"
25
25
  .size=${this.size}
26
26
  .required=${this.required}
@@ -35,10 +35,11 @@ const g = (l) => {
35
35
  for="input"
36
36
  label=${b(this.label)}></dap-ds-form-label>`}
37
37
  </dap-ds-form-label>
38
- ${this.tooltip && r` <dap-ds-tooltip
38
+ ${this.tooltip && a` <dap-ds-tooltip
39
39
  part="tooltip"
40
40
  content=${this.tooltip}
41
- mode="toggle"
41
+ mode=${this.tooltipTrigger === "hover" ? "tooltip" : "toggle"}
42
+ trigger=${this.tooltipTrigger === "hover" ? "hover focus" : "click"}
42
43
  placement=${this.tooltipPlacement}>
43
44
  <dap-ds-icon-button
44
45
  slot="trigger"
@@ -53,7 +54,7 @@ const g = (l) => {
53
54
  </dap-ds-icon-button>
54
55
  </dap-ds-tooltip>`}
55
56
  </div>
56
- ${this.description && r`
57
+ ${this.description && a`
57
58
  <dap-ds-typography
58
59
  part="description"
59
60
  variant="description"
@@ -78,6 +79,8 @@ const g = (l) => {
78
79
  e()
79
80
  ], t.prototype, "tooltipPlacement"), o([
80
81
  e()
82
+ ], t.prototype, "tooltipTrigger"), o([
83
+ e()
81
84
  ], t.prototype, "size"), o([
82
85
  e({ type: Boolean, reflect: !0 })
83
86
  ], t.prototype, "optional"), o([
@@ -95,6 +98,6 @@ const g = (l) => {
95
98
  ], t.prototype, "tooltipAriaLabel"), t;
96
99
  };
97
100
  export {
98
- g as LabelableMixin
101
+ q as LabelableMixin
99
102
  };
100
103
  //# sourceMappingURL=labelableMixin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"labelableMixin.js","sources":["../../../src/internal/mixin/labelableMixin.ts"],"sourcesContent":["import clsx from 'clsx'\nimport { html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\nimport { CommonFormElementSize, PopupPlacement, Size } from '@/common/types'\nimport { t } from '@/localization/localization'\n\ntype Constructor<T = Record<string, unknown>> = {\n new (...args: any[]): T\n prototype: T\n}\n\nexport interface LabelableElementInterface {\n label?: string\n hideLabel: boolean\n description?: string\n tooltip?: string\n tooltipPlacement: PopupPlacement\n size: Size\n required: boolean\n requiredLabel: string\n disabled: boolean\n optional: boolean\n optionalLabel: string\n subtle: boolean\n tooltipAriaLabel: string\n renderLabel(id?: string, content?: unknown): unknown\n}\n\nexport const LabelableMixin = <T extends Constructor<LitElement>>(base: T) => {\n class LabelableElement extends base {\n @property() label?: string\n // Visually hides the label WITHOUT removing it: the <label for=...> association is\n // what names the control, so omitting the element would leave it unnamed.\n @property({ type: Boolean, reflect: true }) hideLabel = false\n @property() description?: string\n @property() tooltip?: string\n @property() tooltipPlacement: PopupPlacement = 'bottom'\n @property() size: Size = 'sm'\n @property({ type: Boolean, reflect: true }) optional = false\n @property() optionalLabel = t('label.optional')\n @property({ type: Boolean, reflect: true }) subtle = false\n @property({ type: Boolean, reflect: true }) required = false\n // Not localized like optionalLabel: the default is a glyph, not a word. Consumers\n // who swap it for text supply their own localized string.\n @property() requiredLabel = '*'\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: String }) tooltipAriaLabel = t('label.tooltip')\n\n renderLabel(id?: string, content?: unknown) {\n return html` <div class=\"label-container\">\n ${\n this.label &&\n html`<dap-ds-form-label\n part=\"label\"\n id=${id ?? 'label'}\n exportparts=\"base: label-base, required: label-required, optional: label-optional\"\n .size=${this.size}\n .required=${this.required}\n .requiredLabel=${this.requiredLabel}\n .disabled=${this.disabled}\n .subtle=${this.subtle}\n .optional=${this.optional}\n .optionalLabel=${this.optionalLabel}\n .hideLabel=${this.hideLabel}\n class=${clsx('label')}\n .noMargin=${!!this.description}\n for=\"input\"\n label=${ifDefined(this.label)}></dap-ds-form-label>`\n }\n </dap-ds-form-label>\n ${\n this.tooltip &&\n html` <dap-ds-tooltip\n part=\"tooltip\"\n content=${this.tooltip}\n mode=\"toggle\"\n placement=${this.tooltipPlacement}>\n <dap-ds-icon-button\n slot=\"trigger\"\n size=${this.size as 'xs' | 'sm' | 'md' | 'lg'}\n iconSize=${this.size === 'xs' ? '16' : '22'}\n clean\n aria-label=${this.tooltipAriaLabel}>\n <dap-ds-icon\n name=\"information-line\"\n aria-hidden=\"true\"\n class=\"info-button\"></dap-ds-icon>\n </dap-ds-icon-button>\n </dap-ds-tooltip>`\n }\n </div>\n ${\n this.description &&\n html`\n <dap-ds-typography\n part=\"description\"\n variant=\"description\"\n class=${clsx('input-description')}\n size=${ifDefined(this.size as CommonFormElementSize)}\n id=\"description\">\n ${this.description}\n </dap-ds-typography>\n `\n }\n ${content}`\n }\n }\n\n return LabelableElement as Constructor<LabelableElementInterface> & T\n}\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AA,EAAA,GAjBtBR,EAiBwB,WAAA,kBAAA,GA8DvBA;AACT;"}
1
+ {"version":3,"file":"labelableMixin.js","sources":["../../../src/internal/mixin/labelableMixin.ts"],"sourcesContent":["import clsx from 'clsx'\nimport { html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\nimport { CommonFormElementSize, PopupPlacement, Size } from '@/common/types'\nimport { t } from '@/localization/localization'\n\n/** How a form label tooltip opens: `click` (click/Enter toggle) or `hover` (hover + keyboard focus). */\nexport type TooltipTrigger = 'click' | 'hover'\n\ntype Constructor<T = Record<string, unknown>> = {\n new (...args: any[]): T\n prototype: T\n}\n\nexport interface LabelableElementInterface {\n label?: string\n hideLabel: boolean\n description?: string\n tooltip?: string\n tooltipPlacement: PopupPlacement\n tooltipTrigger: TooltipTrigger\n size: Size\n required: boolean\n requiredLabel: string\n disabled: boolean\n optional: boolean\n optionalLabel: string\n subtle: boolean\n tooltipAriaLabel: string\n renderLabel(id?: string, content?: unknown): unknown\n}\n\nexport const LabelableMixin = <T extends Constructor<LitElement>>(base: T) => {\n class LabelableElement extends base {\n @property() label?: string\n // Visually hides the label WITHOUT removing it: the <label for=...> association is\n // what names the control, so omitting the element would leave it unnamed.\n @property({ type: Boolean, reflect: true }) hideLabel = false\n @property() description?: string\n @property() tooltip?: string\n @property() tooltipPlacement: PopupPlacement = 'bottom'\n /** How the tooltip opens: `click` (click/Enter, default) or `hover` (hover and keyboard focus). */\n @property() tooltipTrigger: TooltipTrigger = 'click'\n @property() size: Size = 'sm'\n @property({ type: Boolean, reflect: true }) optional = false\n @property() optionalLabel = t('label.optional')\n @property({ type: Boolean, reflect: true }) subtle = false\n @property({ type: Boolean, reflect: true }) required = false\n // Not localized like optionalLabel: the default is a glyph, not a word. Consumers\n // who swap it for text supply their own localized string.\n @property() requiredLabel = '*'\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: String }) tooltipAriaLabel = t('label.tooltip')\n\n renderLabel(id?: string, content?: unknown) {\n return html` <div class=\"label-container\">\n ${\n this.label &&\n html`<dap-ds-form-label\n part=\"label\"\n id=${id ?? 'label'}\n exportparts=\"base: label-base, required: label-required, optional: label-optional\"\n .size=${this.size}\n .required=${this.required}\n .requiredLabel=${this.requiredLabel}\n .disabled=${this.disabled}\n .subtle=${this.subtle}\n .optional=${this.optional}\n .optionalLabel=${this.optionalLabel}\n .hideLabel=${this.hideLabel}\n class=${clsx('label')}\n .noMargin=${!!this.description}\n for=\"input\"\n label=${ifDefined(this.label)}></dap-ds-form-label>`\n }\n </dap-ds-form-label>\n ${\n this.tooltip &&\n html` <dap-ds-tooltip\n part=\"tooltip\"\n content=${this.tooltip}\n mode=${this.tooltipTrigger === 'hover' ? 'tooltip' : 'toggle'}\n trigger=${this.tooltipTrigger === 'hover' ? 'hover focus' : 'click'}\n placement=${this.tooltipPlacement}>\n <dap-ds-icon-button\n slot=\"trigger\"\n size=${this.size as 'xs' | 'sm' | 'md' | 'lg'}\n iconSize=${this.size === 'xs' ? '16' : '22'}\n clean\n aria-label=${this.tooltipAriaLabel}>\n <dap-ds-icon\n name=\"information-line\"\n aria-hidden=\"true\"\n class=\"info-button\"></dap-ds-icon>\n </dap-ds-icon-button>\n </dap-ds-tooltip>`\n }\n </div>\n ${\n this.description &&\n html`\n <dap-ds-typography\n part=\"description\"\n variant=\"description\"\n class=${clsx('input-description')}\n size=${ifDefined(this.size as CommonFormElementSize)}\n id=\"description\">\n ${this.description}\n </dap-ds-typography>\n `\n }\n ${content}`\n }\n }\n\n return LabelableElement as Constructor<LabelableElementInterface> & T\n}\n"],"names":["LabelableMixin","base","LabelableElement","t","id","content","html","clsx","ifDefined","__decorateClass","property"],"mappings":";;;;;;;;;;;;;AAkCa,MAAAA,IAAiB,CAAoCC,MAAY;AAAA,EAC5E,MAAMC,UAAyBD,EAAK;AAAA,IAApC,cAAA;AAAA,YAAA,GAAA,SAAA,GAI0D,KAAA,YAAA,IAGT,KAAA,mBAA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