tinkiet 0.11.4 → 0.11.8

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.
package/index.js CHANGED
@@ -143,20 +143,21 @@ let TkListItem = class TkListItem extends box/* TkBox */.P {
143
143
  return (0,external_lit_.html) `
144
144
  <slot name="before" @click=${this.handleClick}></slot>
145
145
  <div id="content">
146
- <slot></slot>
146
+ <slot @slotchange=${this.ensureAriaLabel}></slot>
147
147
  </div>
148
148
  <slot name="after" @click=${this.handleClick}></slot>
149
149
  ${this.href
150
150
  ? (0,external_lit_.html) `
151
- <a tabindex="-1" id="ahref" href="${this.href}" target=${(0,if_defined_js_.ifDefined)(this.target)} rel="noreferrer" aria-label=${this.ariaLabel}></a>
151
+ <a tabindex="-1" id="ahref" href=${this.href} target=${(0,if_defined_js_.ifDefined)(this.target)} rel="noreferrer" aria-label=${this.ariaLabel}></a>
152
152
  `
153
- : ""}
153
+ : external_lit_.nothing}
154
154
  `;
155
155
  }
156
156
  constructor() {
157
157
  super();
158
158
  this.href = "";
159
159
  this.target = "";
160
+ this.ariaLabel = "";
160
161
  this.onKeyDown = (e) => {
161
162
  if (e.code === "Space" || e.code === "Enter") {
162
163
  e.preventDefault();
@@ -170,19 +171,16 @@ let TkListItem = class TkListItem extends box/* TkBox */.P {
170
171
  if (target.tagName == "BUTTON" || target.tagName == "TK-BUTTON" || target.tagName == "TK-SWITCH" || target.tagName == "TK-CHECKBOX") {
171
172
  return;
172
173
  }
173
- if (this.href && e.isTrusted) {
174
+ if (this.href && e.isTrusted && this.$ahref) {
174
175
  e.stopPropagation();
175
176
  e.preventDefault();
176
177
  this.$ahref.click();
177
178
  }
178
179
  };
179
180
  }
180
- firstUpdated() {
181
- if (!this.ariaLabel && this.innerText)
182
- this.ariaLabel = this.innerText;
183
- }
184
181
  connectedCallback() {
185
182
  super.connectedCallback();
183
+ this.ensureAriaLabel();
186
184
  this.addEventListener("keydown", this.onKeyDown);
187
185
  this.addEventListener("click", this.handleClick);
188
186
  }
@@ -191,15 +189,23 @@ let TkListItem = class TkListItem extends box/* TkBox */.P {
191
189
  this.removeEventListener("click", this.handleClick);
192
190
  this.removeEventListener("keydown", this.onKeyDown);
193
191
  }
192
+ ensureAriaLabel() {
193
+ var _a;
194
+ if (this.ariaLabel)
195
+ return;
196
+ const text = (_a = this.textContent) === null || _a === void 0 ? void 0 : _a.trim();
197
+ if (text)
198
+ this.ariaLabel = text;
199
+ }
194
200
  };
195
201
  __decorate([
196
- (0,decorators_js_.property)({ attribute: true })
202
+ (0,decorators_js_.property)({ type: String, reflect: true })
197
203
  ], TkListItem.prototype, "href", void 0);
198
204
  __decorate([
199
- (0,decorators_js_.property)({ attribute: true })
205
+ (0,decorators_js_.property)({ type: String, reflect: true })
200
206
  ], TkListItem.prototype, "target", void 0);
201
207
  __decorate([
202
- (0,decorators_js_.property)({ attribute: "aria-label" })
208
+ (0,decorators_js_.property)({ attribute: "aria-label", reflect: true })
203
209
  ], TkListItem.prototype, "ariaLabel", void 0);
204
210
  __decorate([
205
211
  (0,decorators_js_.query)("#ahref")
@@ -608,13 +614,37 @@ let TkCheckbox = class TkCheckbox extends external_lit_.LitElement {
608
614
  this.onKeyDown = this.onKeyDown.bind(this);
609
615
  }
610
616
  render() {
617
+ var _a, _b;
618
+ const labelId = `${this._id}-label`;
619
+ const ariaChecked = this.indeterminate ? "mixed" : this.checked ? "true" : "false";
611
620
  const containerClasses = {
612
621
  state: true,
613
622
  disabled: this.disabled
614
623
  };
615
624
  return (0,external_lit_.html) `
625
+ <input
626
+ type="checkbox"
627
+ aria-hidden="true"
628
+ tabindex="-1"
629
+ style="display: none"
630
+ .id=${this._id}
631
+ .name=${(_a = this.name) !== null && _a !== void 0 ? _a : ""}
632
+ .value=${(_b = this.value) !== null && _b !== void 0 ? _b : "on"}
633
+ ?checked=${this.checked}
634
+ ?disabled=${this.disabled}
635
+ .indeterminate=${this.indeterminate}
636
+ />
616
637
  <tk-box direction="row" align-items="center" @click=${this.handleClick}>
617
- <tk-box ripple tabindex="${this.disabled ? -1 : 0}" class=${(0,class_map_js_.classMap)(containerClasses)} @keydown=${this.onKeyDown}>
638
+ <tk-box
639
+ ripple
640
+ tabindex="${this.disabled ? -1 : 0}"
641
+ class=${(0,class_map_js_.classMap)(containerClasses)}
642
+ role="checkbox"
643
+ aria-checked=${ariaChecked}
644
+ aria-disabled=${this.disabled ? "true" : "false"}
645
+ aria-labelledby=${labelId}
646
+ @keydown=${this.onKeyDown}
647
+ >
618
648
  <div class="checkbox">
619
649
  <svg id="checkmark" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" preserveAspectRatio="none" viewBox="0 0 24 24">
620
650
  <path id="checkmark-path" fill="none" d="M1.73,12.91 8.1,19.28 22.79,4.59"></path>
@@ -622,22 +652,15 @@ let TkCheckbox = class TkCheckbox extends external_lit_.LitElement {
622
652
  </svg>
623
653
  </div>
624
654
  </tk-box>
625
- <span class="label"><slot></slot></span>
655
+ <span class="label" id=${labelId}><slot></slot></span>
626
656
  </tk-box>
627
657
  `;
628
658
  }
629
- firstUpdated() {
630
- this.$input = document.createElement("input");
631
- this.$input.type = "checkbox";
632
- this.$input.slot = "none";
633
- this.$input.style.display = "none";
634
- this.$input.setAttribute("aria-hidden", "true");
635
- this.$input.tabIndex = -1;
636
- this.syncInput();
637
- this.appendChild(this.$input);
638
- }
639
- updated() {
640
- this.syncInput();
659
+ updated(changedProps) {
660
+ super.updated(changedProps);
661
+ if (changedProps.has("indeterminate") && this.$input) {
662
+ this.$input.indeterminate = this.indeterminate;
663
+ }
641
664
  }
642
665
  onKeyDown(e) {
643
666
  if (this.disabled)
@@ -645,7 +668,7 @@ let TkCheckbox = class TkCheckbox extends external_lit_.LitElement {
645
668
  if (e.code === "Space" || e.code === "Enter") {
646
669
  e.preventDefault();
647
670
  e.stopPropagation();
648
- this.click();
671
+ this.handleClick();
649
672
  }
650
673
  }
651
674
  handleClick() {
@@ -654,18 +677,11 @@ let TkCheckbox = class TkCheckbox extends external_lit_.LitElement {
654
677
  this.checked = !this.checked;
655
678
  if (this.indeterminate)
656
679
  this.indeterminate = false;
657
- setTimeout(() => this.dispatchEvent(new Event("change", { bubbles: true, composed: true })));
658
- }
659
- syncInput() {
660
- var _a, _b;
661
- if (!this.$input)
662
- return;
663
- this.$input.id = this._id;
664
- this.$input.name = (_a = this.name) !== null && _a !== void 0 ? _a : "";
665
- this.$input.value = (_b = this.value) !== null && _b !== void 0 ? _b : "on";
666
- this.$input.checked = this.checked;
667
- this.$input.disabled = this.disabled;
668
- this.$input.indeterminate = this.indeterminate;
680
+ this.dispatchEvent(new CustomEvent("change", {
681
+ bubbles: true,
682
+ composed: true,
683
+ detail: { checked: this.checked, indeterminate: this.indeterminate }
684
+ }));
669
685
  }
670
686
  };
671
687
  TkCheckbox.styles = (0,external_lit_.css) `
@@ -686,6 +702,9 @@ __decorate([
686
702
  __decorate([
687
703
  (0,decorators_js_.property)({ attribute: true, type: Boolean, reflect: true })
688
704
  ], TkCheckbox.prototype, "indeterminate", void 0);
705
+ __decorate([
706
+ (0,decorators_js_.query)("input[aria-hidden]")
707
+ ], TkCheckbox.prototype, "$input", void 0);
689
708
  TkCheckbox = __decorate([
690
709
  (0,decorators_js_.customElement)("tk-checkbox")
691
710
  ], TkCheckbox);
@@ -741,14 +760,14 @@ class TkFocusableBox extends box_box/* TkBox */.P {
741
760
  }
742
761
  }
743
762
  __decorate([
744
- (0,decorators_js_.property)({ type: Boolean })
763
+ (0,decorators_js_.property)({ type: String })
745
764
  ], TkFocusableBox.prototype, "_id", void 0);
746
765
  __decorate([
747
766
  (0,decorators_js_.property)({ type: Boolean })
748
767
  ], TkFocusableBox.prototype, "disabled", void 0);
749
768
 
750
769
  ;// ./tinkiet/accordion/accordion.scss
751
- /* harmony default export */ const accordion = ("*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}:host .header{position:relative;overflow:hidden;color:hsl(var(--on-surface));background-color:hsl(var(--surface-container-low));padding:16px;border:1px solid hsl(var(--outline-variant));border-radius:12px;box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 1px 3px 1px rgba(0,0,0,.15);gap:12px;cursor:pointer;transition:background-color var(--transition-duration-medium, 180ms) var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),color var(--transition-duration-medium, 180ms) var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),box-shadow var(--transition-duration-medium, 180ms) var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),border-color var(--transition-duration-medium, 180ms) var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1))}:host .header:after{transition:transform .3s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1));content:\"▼\";display:inline-block;font-size:12px;margin-inline-start:8px}:host .header:before{content:\"\";position:absolute;inset:0;background:hsl(var(--on-surface));opacity:0;transition:opacity var(--transition-duration-medium, 180ms) var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1));pointer-events:none}:host .header .before{width:fit-content}:host .header .header-content{flex:1}:host .content{width:100%;margin:4px 0 0;padding:0 16px;opacity:0;visibility:hidden;max-height:0;overflow:hidden;transform:translateY(-8px);transition:max-height .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),opacity .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),transform .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1));background:hsl(var(--surface-container-lowest));border-radius:0 0 12px 12px}:host h3,:host h5{margin:0}:host .header:hover:before{opacity:.08}:host .header:active:before{opacity:.12}:host .header:focus-visible{outline:none;border-color:hsl(var(--primary));box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 2px 6px 2px rgba(0,0,0,.15),0 0 0 3px hsl(var(--primary)/0.2)}:host([checked]) .header{background-color:hsl(var(--primary-container));color:hsl(var(--on-primary-container));border-color:hsl(var(--primary));box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 2px 6px 2px rgba(0,0,0,.15)}:host([checked]) .header:after{transform:rotate(180deg)}:host([checked]) .header:before{background:hsl(var(--on-primary-container))}:host([checked]) .content{opacity:1;visibility:visible;max-height:var(--tk-accordion-max-height, 1000px);padding:12px 16px;transform:translateY(0);transition:max-height .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),opacity .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),transform .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1))}:host([pill]) .header{border-radius:9999px}@media(prefers-reduced-motion: reduce){:host .header:after{transition:none}:host .header:before{transition:none}:host .header{transition:none}:host .content{transition:none}}");
770
+ /* harmony default export */ const accordion = ("*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}:host .header{position:relative;overflow:hidden;color:hsl(var(--on-surface));background-color:hsl(var(--surface-container-low));padding:16px;border:1px solid hsl(var(--outline-variant));border-radius:12px;box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 1px 3px 1px rgba(0,0,0,.15);gap:12px;cursor:pointer;transition:background-color var(--transition-duration-medium, 180ms) var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),color var(--transition-duration-medium, 180ms) var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),box-shadow var(--transition-duration-medium, 180ms) var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),border-color var(--transition-duration-medium, 180ms) var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1))}:host .header:after{transition:transform .3s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1));content:\"▼\";display:inline-block;font-size:12px;margin-inline-start:8px}:host .header:before{content:\"\";position:absolute;inset:0;background:hsl(var(--on-surface));opacity:0;transition:opacity var(--transition-duration-medium, 180ms) var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1));pointer-events:none}:host .header .before{width:fit-content}:host .header .header-content{flex:1}:host .content{width:100%;margin:4px 0 0;padding:0 16px;opacity:0;visibility:hidden;max-height:0;overflow:hidden;transform:translateY(-8px);transition:max-height .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),opacity .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),transform .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1));background:hsl(var(--surface-container-lowest));border-radius:0 0 12px 12px}:host h3,:host h5{margin:0}:host .header:hover:before{opacity:.08}:host .header:active:before{opacity:.12}:host .header:focus-visible{outline:none;border-color:hsl(var(--primary));box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 2px 6px 2px rgba(0,0,0,.15),0 0 0 3px hsl(var(--primary)/0.2)}:host([checked]) .header{background-color:hsl(var(--primary-container));color:hsl(var(--on-primary-container));border-color:hsl(var(--primary));box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 2px 6px 2px rgba(0,0,0,.15)}:host([checked]) .header:after{transform:rotate(180deg)}:host([checked]) .header:before{background:hsl(var(--on-primary-container))}:host([checked]) .content{opacity:1;visibility:visible;max-height:var(--tk-accordion-max-height, 1000px);overflow-y:scroll;padding:12px 16px;transform:translateY(0);transition:max-height .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),opacity .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),transform .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1))}:host([pill]) .header{border-radius:9999px}@media(prefers-reduced-motion: reduce){:host .header:after{transition:none}:host .header:before{transition:none}:host .header{transition:none}:host .content{transition:none}}");
752
771
  ;// ./tinkiet/accordion/accordion.ts
753
772
  var accordion_decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
754
773
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -772,6 +791,7 @@ let TkAccordion = class TkAccordion extends TkFocusableBox {
772
791
  }
773
792
  constructor() {
774
793
  super();
794
+ this.name = "";
775
795
  this.checked = false;
776
796
  this.rippleHeader = false;
777
797
  this.handleClick = this.handleClick.bind(this);
@@ -781,10 +801,14 @@ let TkAccordion = class TkAccordion extends TkFocusableBox {
781
801
  <tk-box margin="small">
782
802
  <tk-box
783
803
  @click=${this.handleClick}
804
+ @keydown=${this.onKeyDown}
784
805
  ?ripple=${this.rippleHeader}
785
806
  class="header"
786
807
  direction="row"
787
808
  align-items="center"
809
+ role="button"
810
+ tabindex="0"
811
+ aria-expanded=${this.checked}
788
812
  >
789
813
  <tk-box class="before">
790
814
  <slot name="before"></slot>
@@ -812,16 +836,21 @@ let TkAccordion = class TkAccordion extends TkFocusableBox {
812
836
  }
813
837
  updated(changed) {
814
838
  super.updated(changed);
815
- this.syncInput();
839
+ if (changed.has("checked") || changed.has("name") || changed.has("disabled"))
840
+ this.syncInput();
816
841
  }
817
842
  onKeyDown(e) {
843
+ if (this.disabled)
844
+ return;
818
845
  if (e.code === "Space" || e.code === "Enter") {
819
846
  e.preventDefault();
820
847
  e.stopPropagation();
821
- this.click();
848
+ this.handleClick();
822
849
  }
823
850
  }
824
851
  handleClick() {
852
+ if (this.disabled)
853
+ return;
825
854
  this.checked = !this.checked;
826
855
  if (this.checked && this.name)
827
856
  this.getRootNode()
@@ -1159,6 +1188,8 @@ __webpack_require__.d(__webpack_exports__, {
1159
1188
  var external_lit_ = __webpack_require__(2927);
1160
1189
  // EXTERNAL MODULE: external "lit/decorators.js"
1161
1190
  var decorators_js_ = __webpack_require__(8899);
1191
+ // EXTERNAL MODULE: external "lit/directives/class-map.js"
1192
+ var class_map_js_ = __webpack_require__(4955);
1162
1193
  ;// ./tinkiet/chip/chip.scss
1163
1194
  /* harmony default export */ const chip = ("*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}.chip{display:inline-flex;align-items:center;border-radius:10px;padding:3px 10px;background:hsl(var(--surface-container-highest));border:1px solid hsl(var(--outline-variant));font-size:13px;height:30px;gap:6px;line-height:1;cursor:pointer}.chip.disabled{opacity:.4;pointer-events:none}.chip .leading{display:inline-flex;align-items:center}.chip .leading slot::slotted(*){display:inline-flex;align-items:center}.chip .label{white-space:nowrap;display:inline-flex;align-items:center;line-height:1}.chip .trailing{display:inline-flex;align-items:center}.chip .trailing slot::slotted(*){display:inline-flex;align-items:center}.chip .trailing .remove{background:none;border:none;cursor:pointer;font-size:13px;line-height:1;opacity:.7}.chip .trailing .remove:hover{opacity:1}");
1164
1195
  ;// ./tinkiet/chip/chip.ts
@@ -1171,6 +1202,7 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
1171
1202
 
1172
1203
 
1173
1204
 
1205
+
1174
1206
  /**
1175
1207
  * Material-style Chip component.
1176
1208
  *
@@ -1188,14 +1220,21 @@ let TkChip = class TkChip extends external_lit_.LitElement {
1188
1220
  super(...arguments);
1189
1221
  this.disabled = false;
1190
1222
  this.removable = false;
1191
- }
1192
- onRemove() {
1193
- this.dispatchEvent(new CustomEvent("remove", { bubbles: true, composed: true }));
1223
+ this.onRemove = (event) => {
1224
+ event.stopPropagation();
1225
+ if (this.disabled)
1226
+ return;
1227
+ this.dispatchEvent(new CustomEvent("remove", { bubbles: true, composed: true }));
1228
+ };
1194
1229
  }
1195
1230
  render() {
1231
+ const classes = {
1232
+ chip: true,
1233
+ disabled: this.disabled
1234
+ };
1196
1235
  return (0,external_lit_.html) `
1197
- <div class="chip ${this.disabled ? "disabled" : ""}">
1198
-
1236
+ <div class=${(0,class_map_js_.classMap)(classes)} aria-disabled=${this.disabled ? "true" : "false"}>
1237
+
1199
1238
  <!-- 3. LEADING ICON (optional) -->
1200
1239
  <span class="leading">
1201
1240
  <slot name="leading"></slot>
@@ -1210,7 +1249,7 @@ let TkChip = class TkChip extends external_lit_.LitElement {
1210
1249
  <span class="trailing">
1211
1250
  <slot name="trailing">
1212
1251
  ${this.removable
1213
- ? (0,external_lit_.html) `<button class="remove" @click=${this.onRemove}>✕</button>`
1252
+ ? (0,external_lit_.html) `<button class="remove" type="button" ?disabled=${this.disabled} aria-label="Remove" @click=${this.onRemove}>✕</button>`
1214
1253
  : ""}
1215
1254
  </slot>
1216
1255
  </span>
@@ -1221,10 +1260,10 @@ let TkChip = class TkChip extends external_lit_.LitElement {
1221
1260
  };
1222
1261
  TkChip.styles = (0,external_lit_.css) `${(0,external_lit_.unsafeCSS)(chip)}`;
1223
1262
  __decorate([
1224
- (0,decorators_js_.property)({ type: Boolean })
1263
+ (0,decorators_js_.property)({ type: Boolean, reflect: true })
1225
1264
  ], TkChip.prototype, "disabled", void 0);
1226
1265
  __decorate([
1227
- (0,decorators_js_.property)({ type: Boolean })
1266
+ (0,decorators_js_.property)({ type: Boolean, reflect: true })
1228
1267
  ], TkChip.prototype, "removable", void 0);
1229
1268
  TkChip = __decorate([
1230
1269
  (0,decorators_js_.customElement)("tk-chip")
@@ -2009,7 +2048,7 @@ var external_lit_ = __webpack_require__(2927);
2009
2048
  // EXTERNAL MODULE: external "lit/decorators.js"
2010
2049
  var decorators_js_ = __webpack_require__(8899);
2011
2050
  ;// ./tinkiet/drawer/drawer.scss
2012
- /* harmony default export */ const drawer = ("*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}:host{display:block;height:100%;width:100%;position:relative;overflow:hidden;background-color:hsl(var(--surface))}.drawer{display:grid;grid-template-columns:var(--drawer-width, 256px) 10px;grid-template-rows:auto 1fr auto;grid-template-areas:\"header swipe\" \"content swipe\" \"footer swipe\";position:absolute;top:0;bottom:0;transform:translateX(calc(-100% + 10px));transition:transform cubic-bezier(0.4, 0, 0.2, 1) var(--transition-duration-medium, 180ms);will-change:transform;touch-action:pan-y;z-index:var(--drawer-z-index, 200);background-color:hsl(var(--surface))}.drawer .drawer-header{grid-area:header}.drawer .drawer-content{grid-area:content;overflow:auto}.drawer .drawer-footer{grid-area:footer}.drawer .drawer-swipe{grid-area:swipe;background-color:rgba(0,0,0,0)}:host([right]) .drawer{right:0;transform:translateX(calc(100% + 10px))}.overlay{position:absolute;top:0;left:0;right:0;bottom:0;z-index:var(--drawer-overlay-z-index, 200);background-color:rgba(0,0,0,.5);display:none}.container{transition:padding cubic-bezier(0.4, 0, 0.2, 1) var(--transition-duration-slow, 250ms);overflow:auto;height:100%}:host([open]) .drawer{transform:none}:host([open]) .container{padding-left:var(--drawer-width, 256px)}:host([open][over]) .drawer{background-color:hsl(var(--surface-container-low));box-shadow:0px 1px 2px 0px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15)}:host([open][over]) .container{padding-left:0}:host([open][over]) .overlay{display:block}@media(max-width: var(--drawer-trigger-width, 400px)){:host([open]) .container{padding-left:0}:host([open]) .overlay{display:block}}");
2051
+ /* harmony default export */ const drawer = ("*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}:host{display:block;height:100%;width:100%;position:relative;overflow:hidden;background-color:hsl(var(--surface))}.drawer{display:grid;grid-template-columns:var(--drawer-width, 256px) 10px;grid-template-rows:auto 1fr auto;grid-template-areas:\"header swipe\" \"content swipe\" \"footer swipe\";position:absolute;top:0;bottom:0;transform:translateX(calc(-100% + 10px));transition:transform cubic-bezier(0.4, 0, 0.2, 1) var(--transition-duration-medium, 180ms);will-change:transform;touch-action:pan-y;z-index:var(--drawer-z-index, 200);background-color:hsl(var(--surface))}.drawer .drawer-header{grid-area:header}.drawer .drawer-content{grid-area:content;overflow:auto;position:relative;transition:opacity var(--transition-duration-medium, 180ms) ease}.drawer .drawer-content::before,.drawer .drawer-content::after{content:\"\";position:sticky;display:block;height:14px;pointer-events:none;opacity:0;transition:opacity var(--transition-duration-medium, 180ms) ease;left:0;right:0;width:100%;z-index:1}.drawer .drawer-content::before{top:0;margin-top:-14px;background:linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0))}.drawer .drawer-content::after{bottom:0;margin-bottom:-14px;background:linear-gradient(0deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0))}.drawer .drawer-content.has-top-shadow::before{opacity:1}.drawer .drawer-content.has-bottom-shadow::after{opacity:1}.drawer .drawer-footer{grid-area:footer}.drawer .drawer-swipe{grid-area:swipe;background-color:rgba(0,0,0,0)}:host([right]) .drawer{right:0;transform:translateX(calc(100% + 10px))}.overlay{position:absolute;top:0;left:0;right:0;bottom:0;z-index:var(--drawer-overlay-z-index, 200);background-color:rgba(0,0,0,.5);display:none}.container{transition:padding cubic-bezier(0.4, 0, 0.2, 1) var(--transition-duration-slow, 250ms);overflow:auto;height:100%}:host([open]) .drawer{transform:none}:host([open]) .container{padding-left:var(--drawer-width, 256px)}:host([open][over]) .drawer{background-color:hsl(var(--surface-container-low));box-shadow:0px 1px 2px 0px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15)}:host([open][over]) .container{padding-left:0}:host([open][over]) .overlay{display:block}@media(max-width: var(--drawer-trigger-width, 400px)){:host([open]) .container{padding-left:0}:host([open]) .overlay{display:block}}");
2013
2052
  ;// ./tinkiet/drawer/drawer.ts
2014
2053
  var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2015
2054
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -2020,46 +2059,47 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
2020
2059
 
2021
2060
 
2022
2061
 
2023
-
2024
2062
  let TkDrawer = class TkDrawer extends external_lit_.LitElement {
2025
2063
  constructor() {
2026
2064
  super(...arguments);
2027
- this._open = false;
2065
+ this.open = false;
2028
2066
  this.over = false;
2029
2067
  this.right = false;
2030
2068
  this.swipeable = false;
2069
+ this.contentScrolled = false;
2070
+ this.contentHasBottomShadow = false;
2031
2071
  this.overMediaQueryListener = (e) => {
2032
2072
  e.matches ? this.setAttribute("over", "") : this.removeAttribute("over");
2033
2073
  };
2074
+ this.handleOverlayClick = () => {
2075
+ this.hide();
2076
+ };
2077
+ this.handleContentScroll = () => {
2078
+ if (!this.$content)
2079
+ return;
2080
+ const { scrollTop, scrollHeight, clientHeight } = this.$content;
2081
+ this.contentScrolled = scrollTop > 0;
2082
+ const atBottom = Math.ceil(scrollTop + clientHeight) >= scrollHeight;
2083
+ this.contentHasBottomShadow = !atBottom && scrollHeight > clientHeight;
2084
+ };
2034
2085
  this.swipeX = 0;
2035
2086
  this.swipeY = 0;
2036
2087
  this.isHorizontalSwipe = false;
2037
2088
  }
2038
- set open(value) {
2039
- if (value === this._open)
2040
- return;
2041
- const oldValue = this._open;
2042
- this._open = value;
2043
- this.requestUpdate("open", oldValue);
2044
- if (this._open)
2045
- this.dispatchEvent(new Event("did-show"));
2046
- if (!this._open)
2047
- this.dispatchEvent(new Event("did-close"));
2048
- }
2049
- get open() {
2050
- return this._open;
2051
- }
2052
2089
  render() {
2053
2090
  return (0,external_lit_.html) `
2054
2091
  <div class="container">
2055
2092
  <slot name="drawer-container"></slot>
2056
2093
  </div>
2057
- <div class="overlay" @click=${() => (this.open = false)}></div>
2094
+ <div class="overlay" @click=${this.handleOverlayClick}></div>
2058
2095
  <div class="drawer" @touchstart=${this.touchStart} @touchmove=${this.touchMove} @touchend=${this.touchEnd}>
2059
2096
  <div class="drawer-header">
2060
2097
  <slot name="drawer-header"></slot>
2061
2098
  </div>
2062
- <div class="drawer-content">
2099
+ <div
2100
+ class="drawer-content ${this.contentScrolled ? "has-top-shadow" : ""} ${this.contentHasBottomShadow ? "has-bottom-shadow" : ""}"
2101
+ @scroll=${this.handleContentScroll}
2102
+ >
2063
2103
  <slot name="drawer-content"></slot>
2064
2104
  </div>
2065
2105
  <div class="drawer-footer">
@@ -2070,17 +2110,31 @@ let TkDrawer = class TkDrawer extends external_lit_.LitElement {
2070
2110
 
2071
2111
  `;
2072
2112
  }
2113
+ firstUpdated() {
2114
+ if (this.overQuery)
2115
+ this.overMediaQuery();
2116
+ if (this.openQuery && window.matchMedia(this.openQuery).matches)
2117
+ this.show();
2118
+ this.handleContentScroll();
2119
+ }
2073
2120
  updated(props) {
2074
- if (props.has("overQuery"))
2121
+ super.updated(props);
2122
+ if (props.has("overQuery") && this.overQuery)
2075
2123
  this.overMediaQuery();
2076
- if (props.has("openQuery")) {
2077
- if (window.matchMedia(this.openQuery).matches)
2078
- this.show();
2079
- }
2080
- if (props.has("open") && this.swipeable) {
2081
- requestAnimationFrame(_ => {
2082
- this.$drawer.removeAttribute('style');
2083
- });
2124
+ if (props.has("openQuery") && this.openQuery && window.matchMedia(this.openQuery).matches)
2125
+ this.show();
2126
+ if (props.has("open")) {
2127
+ if (this.open) {
2128
+ this.dispatchEvent(new CustomEvent("did-show", { bubbles: true }));
2129
+ }
2130
+ else if (props.get("open") === true) {
2131
+ this.dispatchEvent(new CustomEvent("did-close", { bubbles: true }));
2132
+ }
2133
+ if (this.swipeable && this.$drawer) {
2134
+ requestAnimationFrame(() => {
2135
+ this.$drawer.removeAttribute("style");
2136
+ });
2137
+ }
2084
2138
  }
2085
2139
  }
2086
2140
  overMediaQuery() {
@@ -2105,42 +2159,43 @@ let TkDrawer = class TkDrawer extends external_lit_.LitElement {
2105
2159
  this.open = !this.open;
2106
2160
  }
2107
2161
  touchStart(event) {
2108
- if (!this.swipeable)
2162
+ if (!this.swipeable || !this.$drawer)
2109
2163
  return;
2110
2164
  this.$drawer.style.transition = "transform 0ms ease";
2111
2165
  this.swipeX = event.touches[0].clientX;
2112
2166
  this.swipeY = event.touches[0].clientY;
2113
2167
  }
2114
2168
  touchMove(event) {
2115
- if (!this.swipeable)
2169
+ if (!this.swipeable || !this.$drawer)
2116
2170
  return;
2117
2171
  const deltaX = event.touches[0].clientX - this.swipeX;
2118
2172
  const deltaY = event.touches[0].clientY - this.swipeY;
2119
2173
  this.isHorizontalSwipe = Math.abs(deltaX) > Math.abs(deltaY);
2120
2174
  if (!this.isHorizontalSwipe)
2121
2175
  return;
2122
- var x = this.open ?
2123
- deltaX > 0 ? 0 : deltaX :
2124
- deltaX < 0 ? 0 : deltaX;
2125
- var transformString;
2126
- this.open ?
2127
- transformString = "translateX(" + x + "px)" :
2128
- transformString = `translateX(min(calc(-100% + 10px + ${x}px), 0px)`;
2129
- requestAnimationFrame(_ => {
2176
+ const x = this.open
2177
+ ? deltaX > 0 ? 0 : deltaX
2178
+ : deltaX < 0 ? 0 : deltaX;
2179
+ const transformString = this.open
2180
+ ? `translateX(${x}px)`
2181
+ : `translateX(min(calc(-100% + 10px + ${x}px), 0px))`;
2182
+ requestAnimationFrame(() => {
2183
+ if (!this.$drawer)
2184
+ return;
2130
2185
  this.$drawer.style.transform = transformString;
2131
2186
  });
2132
2187
  }
2133
2188
  touchEnd(event) {
2134
- if (!this.swipeable)
2189
+ if (!this.swipeable || !this.$drawer)
2135
2190
  return;
2136
- requestAnimationFrame(_ => {
2137
- this.$drawer.removeAttribute('style');
2191
+ requestAnimationFrame(() => {
2192
+ var _a;
2193
+ (_a = this.$drawer) === null || _a === void 0 ? void 0 : _a.removeAttribute("style");
2138
2194
  });
2139
2195
  const deltaX = event.changedTouches[0].clientX - this.swipeX;
2140
2196
  if (this.isHorizontalSwipe && this.open)
2141
2197
  this.open = -50 > deltaX ? false : true;
2142
2198
  else if (this.isHorizontalSwipe && !this.open) {
2143
- console.log("bbb", deltaX, 50 < Math.abs(deltaX) ? true : false);
2144
2199
  this.open = 50 < deltaX ? true : false;
2145
2200
  }
2146
2201
  this.isHorizontalSwipe = false;
@@ -2156,7 +2211,7 @@ TkDrawer.styles = (0,external_lit_.css) `
2156
2211
  `;
2157
2212
  __decorate([
2158
2213
  (0,decorators_js_.property)({ type: Boolean, reflect: true })
2159
- ], TkDrawer.prototype, "open", null);
2214
+ ], TkDrawer.prototype, "open", void 0);
2160
2215
  __decorate([
2161
2216
  (0,decorators_js_.property)({ type: Boolean, reflect: true })
2162
2217
  ], TkDrawer.prototype, "over", void 0);
@@ -2175,6 +2230,15 @@ __decorate([
2175
2230
  __decorate([
2176
2231
  (0,decorators_js_.query)("div.drawer")
2177
2232
  ], TkDrawer.prototype, "$drawer", void 0);
2233
+ __decorate([
2234
+ (0,decorators_js_.query)("div.drawer-content")
2235
+ ], TkDrawer.prototype, "$content", void 0);
2236
+ __decorate([
2237
+ (0,decorators_js_.state)()
2238
+ ], TkDrawer.prototype, "contentScrolled", void 0);
2239
+ __decorate([
2240
+ (0,decorators_js_.state)()
2241
+ ], TkDrawer.prototype, "contentHasBottomShadow", void 0);
2178
2242
  __decorate([
2179
2243
  (0,decorators_js_.eventOptions)({ passive: true })
2180
2244
  ], TkDrawer.prototype, "touchStart", null);
@@ -2323,7 +2387,7 @@ var box = __webpack_require__(3433);
2323
2387
  // EXTERNAL MODULE: ./tinkiet/utils/unique.ts
2324
2388
  var unique = __webpack_require__(3770);
2325
2389
  ;// ./tinkiet/button/button.scss
2326
- /* harmony default export */ const button_button = ("*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}:host{display:inline-flex;justify-content:center;flex-shrink:0;flex-direction:row;align-items:center;position:relative;cursor:pointer;text-align:center;text-decoration:none;vertical-align:middle;text-overflow:ellipsis;user-select:none;overflow:hidden;border-radius:20px;height:40px;width:40px;color:hsl(var(--primary))}:host tk-icon{width:24px;height:24px}:host([extended]){width:auto}:host([extended]) .content{display:flex;align-items:center;pointer-events:none;font-family:Roboto,sans-serif;line-height:20px;font-size:var(--font-size, 14px);font-weight:500;margin:0 24px}:host([extended]) .content.has-icon{margin:0 24px 0 8px}:host([extended]) tk-icon{margin-left:16px;width:18px;height:18px}:host(:hover),:host(:focus){background-color:hsla(var(--primary), 0.3);outline:none}:host([elevated]){background-color:hsl(var(--surface-container-low));color:hsl(var(--primary));box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 1px 3px 1px rgba(0,0,0,.15)}:host([elevated]:hover),:host([elevated]:focus){box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 2px 6px 2px rgba(0,0,0,.15);background-color:hsl(var(--surface-container-high));outline:none}:host([filled]){background-color:hsl(var(--primary));color:hsl(var(--on-primary))}:host([filled]:hover){box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 1px 3px 1px rgba(0,0,0,.15);background-color:hsla(var(--primary), 0.6)}:host([filled]:focus){background-color:hsla(var(--primary), 0.6);outline:none}:host([tonal]){background-color:hsl(var(--secondary-container));color:hsl(var(--on-secondary-container))}:host([tonal]:hover){box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 1px 3px 1px rgba(0,0,0,.15);background-color:hsla(var(--on-secondary-container), 0.3)}:host([tonal]:focus){background-color:hsla(var(--on-secondary-container), 0.3);outline:none}:host([outlined]){background-color:rgba(0,0,0,0);border:solid 1px hsl(var(--outline));color:hsl(var(--primary))}:host([outlined]:hover){background-color:hsla(var(--primary), 0.08);color:hsl(var(--primary))}:host([outlined]:focus){background-color:hsla(var(--primary), 0.12);border-color:hsl(var(--primary));outline:none}:host([fab]){background-color:hsl(var(--primary));display:inline-flex;justify-content:center;align-items:center;color:hsl(var(--on-primary));box-shadow:0px 1px 3px 0px rgba(0,0,0,.3),0px 4px 8px 3px rgba(0,0,0,.15);width:56px;height:56px;padding:12px;border-radius:16px}:host([fab]) tk-icon{margin-left:0;width:24px;height:24px}:host([fab]) .content{margin:0}:host([fab][extended]){width:auto;min-width:80px}:host([fab][extended]) .content{margin:0 24px}:host([fab][extended]) .content.has-icon{margin:0 24px 0 8px}:host([fab][extended]) tk-icon{margin-left:16px}:host([fab]:hover){background-color:hsla(var(--on-primary-container), 0.3)}:host([fab]:focus){box-shadow:0px 1px 3px 0px rgba(0,0,0,.3),0px 4px 8px 3px rgba(0,0,0,.15);background-color:hsla(var(--on-primary-container), 0.3);outline:none}:host([fab][small]){width:40px;height:40px;border-radius:12px}:host([fab][small]) tk-icon{width:24px;height:24px}:host([fab][large]){width:96px;height:96px;border-radius:28px}:host([fab][large]) tk-icon{width:36px;height:36px}:host([disabled]){pointer-events:none;cursor:not-allowed;background-color:hsla(var(--on-surface), 0.12);box-shadow:none;opacity:.5;color:hsl(var(--on-surface))}");
2390
+ /* harmony default export */ const button_button = ("*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}:host{display:inline-flex;justify-content:center;flex-shrink:0;flex-direction:row;align-items:center;position:relative;cursor:pointer;text-align:center;text-decoration:none;vertical-align:middle;text-overflow:ellipsis;user-select:none;overflow:hidden;border-radius:20px;height:40px;width:40px;color:hsl(var(--primary))}:host tk-icon{width:24px;height:24px}.badge-in,.badge-out{display:none}:host([has-badge-in]) .badge-in,:host([has-badge-out]) .badge-out{display:inline-flex;align-items:center}.badge-in{align-items:center;margin:0 12px 0 8px}.badge-out{position:absolute;top:0;right:0;transform:translate(50%, -50%);pointer-events:none}:host([extended]){width:auto}:host([extended]) .content{display:flex;align-items:center;pointer-events:none;font-family:Roboto,sans-serif;line-height:20px;font-size:var(--font-size, 14px);font-weight:500;margin:0 24px}:host([extended]) .content.has-icon{margin:0 24px 0 8px}:host([extended]) tk-icon{margin-left:16px;width:18px;height:18px}:host(:hover),:host(:focus){background-color:hsla(var(--primary), 0.3);outline:none}:host([elevated]){background-color:hsl(var(--surface-container-low));color:hsl(var(--primary));box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 1px 3px 1px rgba(0,0,0,.15)}:host([elevated]:hover),:host([elevated]:focus){box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 2px 6px 2px rgba(0,0,0,.15);background-color:hsl(var(--surface-container-high));outline:none}:host([filled]){background-color:hsl(var(--primary));color:hsl(var(--on-primary))}:host([filled]:hover){box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 1px 3px 1px rgba(0,0,0,.15);background-color:hsla(var(--primary), 0.6)}:host([filled]:focus){background-color:hsla(var(--primary), 0.6);outline:none}:host([tonal]){background-color:hsl(var(--secondary-container));color:hsl(var(--on-secondary-container))}:host([tonal]:hover){box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 1px 3px 1px rgba(0,0,0,.15);background-color:hsla(var(--on-secondary-container), 0.3)}:host([tonal]:focus){background-color:hsla(var(--on-secondary-container), 0.3);outline:none}:host([outlined]){background-color:rgba(0,0,0,0);border:solid 1px hsl(var(--outline));color:hsl(var(--primary))}:host([outlined]:hover){background-color:hsla(var(--primary), 0.08);color:hsl(var(--primary))}:host([outlined]:focus){background-color:hsla(var(--primary), 0.12);border-color:hsl(var(--primary));outline:none}:host([fab]){background-color:hsl(var(--primary));display:inline-flex;justify-content:center;align-items:center;color:hsl(var(--on-primary));box-shadow:0px 1px 3px 0px rgba(0,0,0,.3),0px 4px 8px 3px rgba(0,0,0,.15);width:56px;height:56px;padding:12px;border-radius:16px}:host([fab]) tk-icon{margin-left:0;width:24px;height:24px}:host([fab]) .content{margin:0}:host([fab][extended]){width:auto;min-width:80px}:host([fab][extended]) .content{margin:0 24px}:host([fab][extended]) .content.has-icon{margin:0 24px 0 8px}:host([fab][extended]) tk-icon{margin-left:16px}:host([fab]:hover){background-color:hsla(var(--on-primary-container), 0.3)}:host([fab]:focus){box-shadow:0px 1px 3px 0px rgba(0,0,0,.3),0px 4px 8px 3px rgba(0,0,0,.15);background-color:hsla(var(--on-primary-container), 0.3);outline:none}:host([fab][small]){width:40px;height:40px;border-radius:12px}:host([fab][small]) tk-icon{width:24px;height:24px}:host([fab][large]){width:96px;height:96px;border-radius:28px}:host([fab][large]) tk-icon{width:36px;height:36px}:host([disabled]){pointer-events:none;cursor:not-allowed;background-color:hsla(var(--on-surface), 0.12);box-shadow:none;opacity:.5;color:hsl(var(--on-surface))}");
2327
2391
  ;// ./tinkiet/button/button.ts
2328
2392
  var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2329
2393
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -2379,6 +2443,15 @@ let TkButton = class TkButton extends box/* TkBox */.P {
2379
2443
  (_a = this.querySelector("button")) === null || _a === void 0 ? void 0 : _a.click();
2380
2444
  }
2381
2445
  };
2446
+ this.slotChanged = () => {
2447
+ this.toggleAttributeForSlot(this.$defaultSlot, "extended");
2448
+ };
2449
+ this.badgeInChanged = () => {
2450
+ this.toggleAttributeForSlot(this.$badgeInSlot, "has-badge-in");
2451
+ };
2452
+ this.badgeOutChanged = () => {
2453
+ this.toggleAttributeForSlot(this.$badgeOutSlot, "has-badge-out");
2454
+ };
2382
2455
  }
2383
2456
  static get styles() {
2384
2457
  return [
@@ -2388,6 +2461,24 @@ let TkButton = class TkButton extends box/* TkBox */.P {
2388
2461
  `
2389
2462
  ];
2390
2463
  }
2464
+ hasSlotContent(slot) {
2465
+ var _a;
2466
+ const nodes = (_a = slot === null || slot === void 0 ? void 0 : slot.assignedNodes({ flatten: true })) !== null && _a !== void 0 ? _a : [];
2467
+ return nodes.some(node => {
2468
+ var _a;
2469
+ if (node.nodeType === Node.TEXT_NODE)
2470
+ return !!((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim());
2471
+ return node.nodeType !== Node.COMMENT_NODE;
2472
+ });
2473
+ }
2474
+ toggleAttributeForSlot(slot, attribute) {
2475
+ if (this.hasSlotContent(slot)) {
2476
+ this.setAttribute(attribute, "");
2477
+ }
2478
+ else {
2479
+ this.removeAttribute(attribute);
2480
+ }
2481
+ }
2391
2482
  render() {
2392
2483
  return (0,external_lit_.html) `
2393
2484
  ${this.iconPath
@@ -2396,8 +2487,14 @@ let TkButton = class TkButton extends box/* TkBox */.P {
2396
2487
  `
2397
2488
  : ""}
2398
2489
 
2399
- <div class="content ${this.iconPath ? "has-icon" : ""}" @slotchange=${this.slotChanged}>
2400
- <slot></slot>
2490
+ <div class="content ${this.iconPath ? "has-icon" : ""}">
2491
+ <slot @slotchange=${this.slotChanged}></slot>
2492
+ </div>
2493
+ <div class="badge-in">
2494
+ <slot name="badge-in" @slotchange=${this.badgeInChanged}></slot>
2495
+ </div>
2496
+ <div class="badge-out">
2497
+ <slot name="badge-out" @slotchange=${this.badgeOutChanged}></slot>
2401
2498
  </div>
2402
2499
 
2403
2500
  ${this.href
@@ -2425,17 +2522,9 @@ let TkButton = class TkButton extends box/* TkBox */.P {
2425
2522
  firstUpdated() {
2426
2523
  if (this.type == "submit" || this.type == "reset")
2427
2524
  this.appendChild(this.$button);
2428
- }
2429
- slotChanged() {
2430
- var _a;
2431
- const slot = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot');
2432
- const elements = slot === null || slot === void 0 ? void 0 : slot.assignedNodes({ flatten: true });
2433
- if (elements && elements.length > 0) {
2434
- this.setAttribute('extended', '');
2435
- }
2436
- else {
2437
- this.removeAttribute('extended');
2438
- }
2525
+ this.slotChanged();
2526
+ this.badgeInChanged();
2527
+ this.badgeOutChanged();
2439
2528
  }
2440
2529
  };
2441
2530
  __decorate([
@@ -2457,7 +2546,7 @@ __decorate([
2457
2546
  (0,decorators_js_.property)({ type: String })
2458
2547
  ], TkButton.prototype, "iconPath", void 0);
2459
2548
  __decorate([
2460
- (0,decorators_js_.property)()
2549
+ (0,decorators_js_.property)({ type: Boolean })
2461
2550
  ], TkButton.prototype, "ripple", void 0);
2462
2551
  __decorate([
2463
2552
  (0,decorators_js_.query)("#ahref")
@@ -2465,6 +2554,15 @@ __decorate([
2465
2554
  __decorate([
2466
2555
  (0,decorators_js_.query)("button")
2467
2556
  ], TkButton.prototype, "$button", void 0);
2557
+ __decorate([
2558
+ (0,decorators_js_.query)("slot:not([name])")
2559
+ ], TkButton.prototype, "$defaultSlot", void 0);
2560
+ __decorate([
2561
+ (0,decorators_js_.query)('slot[name="badge-in"]')
2562
+ ], TkButton.prototype, "$badgeInSlot", void 0);
2563
+ __decorate([
2564
+ (0,decorators_js_.query)('slot[name="badge-out"]')
2565
+ ], TkButton.prototype, "$badgeOutSlot", void 0);
2468
2566
  TkButton = __decorate([
2469
2567
  (0,decorators_js_.customElement)("tk-button")
2470
2568
  ], TkButton);
@@ -2987,8 +3085,13 @@ let TkTheme = class TkTheme extends external_lit_.LitElement {
2987
3085
  this.error = "#B3261E";
2988
3086
  this.neutral = "#5E5F5C";
2989
3087
  this.neutralVariant = "#5c6057";
2990
- this.forceBody = false;
2991
3088
  this.inverted = false;
3089
+ this.primary_hsl = [];
3090
+ this.secondary_hsl = [];
3091
+ this.tertiary_hsl = [];
3092
+ this.error_hsl = [];
3093
+ this.neutral_hsl = [];
3094
+ this.neutral_variant_hsl = [];
2992
3095
  }
2993
3096
  render() {
2994
3097
  return (0,external_lit_.html) `
@@ -2998,6 +3101,17 @@ let TkTheme = class TkTheme extends external_lit_.LitElement {
2998
3101
  firstUpdated(_changedProperties) {
2999
3102
  this.setThemeColor();
3000
3103
  }
3104
+ updated(changedProps) {
3105
+ if (changedProps.has("primary") ||
3106
+ changedProps.has("secondary") ||
3107
+ changedProps.has("tertiary") ||
3108
+ changedProps.has("error") ||
3109
+ changedProps.has("neutral") ||
3110
+ changedProps.has("neutralVariant")) {
3111
+ this.setThemeColor();
3112
+ }
3113
+ super.updated(changedProps);
3114
+ }
3001
3115
  hexToHSL(hex) {
3002
3116
  const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(hex);
3003
3117
  if (result == null)
@@ -3034,8 +3148,11 @@ let TkTheme = class TkTheme extends external_lit_.LitElement {
3034
3148
  this.error_hsl = this.hexToHSL(this.error);
3035
3149
  this.neutral_hsl = this.hexToHSL(this.neutral);
3036
3150
  this.neutral_variant_hsl = this.hexToHSL(this.neutralVariant);
3037
- const style = document.createElement("style");
3038
- style.innerHTML = `
3151
+ if (!this.styleEl) {
3152
+ this.styleEl = document.createElement("style");
3153
+ document.body.appendChild(this.styleEl);
3154
+ }
3155
+ this.styleEl.innerHTML = `
3039
3156
  :root {
3040
3157
  --primary-h: ${this.primary_hsl[0]};
3041
3158
  --primary-s: ${this.primary_hsl[1]};
@@ -3057,7 +3174,6 @@ let TkTheme = class TkTheme extends external_lit_.LitElement {
3057
3174
  --neutral-variant-l: ${this.neutral_variant_hsl[2]};
3058
3175
  }
3059
3176
  `;
3060
- document.body.appendChild(style);
3061
3177
  }
3062
3178
  };
3063
3179
  TkTheme.styles = (0,external_lit_.css) `
@@ -3081,30 +3197,9 @@ __decorate([
3081
3197
  __decorate([
3082
3198
  (0,decorators_js_.property)()
3083
3199
  ], TkTheme.prototype, "neutralVariant", void 0);
3084
- __decorate([
3085
- (0,decorators_js_.property)({ type: Boolean, attribute: "force-body", reflect: true })
3086
- ], TkTheme.prototype, "forceBody", void 0);
3087
3200
  __decorate([
3088
3201
  (0,decorators_js_.property)({ type: Boolean, attribute: true, reflect: true })
3089
3202
  ], TkTheme.prototype, "inverted", void 0);
3090
- __decorate([
3091
- (0,decorators_js_.state)()
3092
- ], TkTheme.prototype, "primary_hsl", void 0);
3093
- __decorate([
3094
- (0,decorators_js_.state)()
3095
- ], TkTheme.prototype, "secondary_hsl", void 0);
3096
- __decorate([
3097
- (0,decorators_js_.state)()
3098
- ], TkTheme.prototype, "tertiary_hsl", void 0);
3099
- __decorate([
3100
- (0,decorators_js_.state)()
3101
- ], TkTheme.prototype, "error_hsl", void 0);
3102
- __decorate([
3103
- (0,decorators_js_.state)()
3104
- ], TkTheme.prototype, "neutral_hsl", void 0);
3105
- __decorate([
3106
- (0,decorators_js_.state)()
3107
- ], TkTheme.prototype, "neutral_variant_hsl", void 0);
3108
3203
  TkTheme = __decorate([
3109
3204
  (0,decorators_js_.customElement)("tk-theme")
3110
3205
  ], TkTheme);
@@ -3178,29 +3273,43 @@ let TkIcon = class TkIcon extends box/* TkBox */.P {
3178
3273
  `;
3179
3274
  }
3180
3275
  updated(props) {
3181
- if (props.has("name") && this.name)
3276
+ if ((props.has("name") || props.has("library")) && this.name && !this.path)
3182
3277
  this.loadIcon();
3183
3278
  }
3184
3279
  loadIcon() {
3185
3280
  return __awaiter(this, void 0, void 0, function* () {
3281
+ if (!this.name || this.path) {
3282
+ this.svg = "";
3283
+ return;
3284
+ }
3285
+ const name = this.name;
3286
+ const library = this.library;
3186
3287
  const resolver = this.library
3187
3288
  ? document.querySelector(`tk-icons[library=${this.library}]`)
3188
3289
  : document.querySelector("tk-icons");
3189
- if (resolver) {
3190
- this.svg = yield fetch(resolver.resolve(this.name))
3191
- .then(response => {
3192
- return response.blob().then(blob => {
3193
- return {
3194
- contentType: response.headers.get("Content-Type"),
3195
- raw: blob
3196
- };
3197
- });
3198
- })
3199
- .then(data => {
3200
- if (data.contentType && /svg/.test(data.contentType))
3201
- return data.raw.text();
3202
- return "";
3203
- });
3290
+ if (!resolver) {
3291
+ this.svg = "";
3292
+ return;
3293
+ }
3294
+ try {
3295
+ const response = yield fetch(resolver.resolve(name));
3296
+ if (!response.ok) {
3297
+ this.svg = "";
3298
+ return;
3299
+ }
3300
+ const contentType = response.headers.get("Content-Type") || "";
3301
+ if (!/svg/i.test(contentType)) {
3302
+ this.svg = "";
3303
+ return;
3304
+ }
3305
+ const svg = yield response.text();
3306
+ // Ensure the props are still current to avoid race conditions
3307
+ if (name === this.name && library === this.library && !this.path) {
3308
+ this.svg = svg;
3309
+ }
3310
+ }
3311
+ catch (_e) {
3312
+ this.svg = "";
3204
3313
  }
3205
3314
  });
3206
3315
  }
@@ -3215,7 +3324,7 @@ __decorate([
3215
3324
  (0,decorators_js_.property)()
3216
3325
  ], TkIcon.prototype, "path", void 0);
3217
3326
  __decorate([
3218
- (0,decorators_js_.property)()
3327
+ (0,decorators_js_.state)()
3219
3328
  ], TkIcon.prototype, "svg", void 0);
3220
3329
  TkIcon = __decorate([
3221
3330
  (0,decorators_js_.customElement)("tk-icon")
@@ -3571,24 +3680,32 @@ let TkDialog = class TkDialog extends external_lit_.LitElement {
3571
3680
  if (event.key === "Escape" && this.open && !this.modal)
3572
3681
  this.hide();
3573
3682
  };
3683
+ this.onOverlayClick = () => {
3684
+ if (!this.modal)
3685
+ this.hide();
3686
+ };
3574
3687
  }
3575
3688
  render() {
3576
3689
  return (0,external_lit_.html) `
3577
3690
  ${this.open
3578
3691
  ? (0,external_lit_.html) `
3579
- <div class="overlay ${this.blurOverlay ? "blur" : ""}" @click=${() => (this.modal ? null : this.hide())}></div>
3580
- <div class="container">
3692
+ <div class="overlay ${this.blurOverlay ? "blur" : ""}" @click=${this.onOverlayClick}></div>
3693
+ <div class="container" role="dialog" aria-modal=${this.modal ? "true" : "false"}>
3581
3694
  <slot></slot>
3582
3695
  </div>
3583
3696
  `
3584
- : ""}
3697
+ : external_lit_.nothing}
3585
3698
  `;
3586
3699
  }
3587
- updated(_changedProperties) {
3588
- if (_changedProperties.has("open") && this.open)
3589
- this.dispatchEvent(new Event("did-show"));
3590
- if (_changedProperties.has("open") && _changedProperties.get("open") == true && !this.open)
3591
- this.dispatchEvent(new Event("did-close"));
3700
+ updated(changedProps) {
3701
+ if (changedProps.has("open")) {
3702
+ if (this.open) {
3703
+ this.dispatchEvent(new CustomEvent("did-show", { bubbles: true }));
3704
+ }
3705
+ else if (changedProps.get("open") === true) {
3706
+ this.dispatchEvent(new CustomEvent("did-close", { bubbles: true }));
3707
+ }
3708
+ }
3592
3709
  }
3593
3710
  connectedCallback() {
3594
3711
  super.connectedCallback();