tinkiet 0.11.4 → 0.11.10

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.
@@ -49,14 +49,14 @@ class TkFocusableBox extends box_box/* TkBox */.P {
49
49
  }
50
50
  }
51
51
  __decorate([
52
- (0,decorators_js_.property)({ type: Boolean })
52
+ (0,decorators_js_.property)({ type: String })
53
53
  ], TkFocusableBox.prototype, "_id", void 0);
54
54
  __decorate([
55
55
  (0,decorators_js_.property)({ type: Boolean })
56
56
  ], TkFocusableBox.prototype, "disabled", void 0);
57
57
 
58
58
  ;// ./tinkiet/accordion/accordion.scss
59
- /* 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}}");
59
+ /* 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}}");
60
60
  ;// ./tinkiet/accordion/accordion.ts
61
61
  var accordion_decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
62
62
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -80,6 +80,7 @@ let TkAccordion = class TkAccordion extends TkFocusableBox {
80
80
  }
81
81
  constructor() {
82
82
  super();
83
+ this.name = "";
83
84
  this.checked = false;
84
85
  this.rippleHeader = false;
85
86
  this.handleClick = this.handleClick.bind(this);
@@ -89,10 +90,14 @@ let TkAccordion = class TkAccordion extends TkFocusableBox {
89
90
  <tk-box margin="small">
90
91
  <tk-box
91
92
  @click=${this.handleClick}
93
+ @keydown=${this.onKeyDown}
92
94
  ?ripple=${this.rippleHeader}
93
95
  class="header"
94
96
  direction="row"
95
97
  align-items="center"
98
+ role="button"
99
+ tabindex="0"
100
+ aria-expanded=${this.checked}
96
101
  >
97
102
  <tk-box class="before">
98
103
  <slot name="before"></slot>
@@ -120,16 +125,21 @@ let TkAccordion = class TkAccordion extends TkFocusableBox {
120
125
  }
121
126
  updated(changed) {
122
127
  super.updated(changed);
123
- this.syncInput();
128
+ if (changed.has("checked") || changed.has("name") || changed.has("disabled"))
129
+ this.syncInput();
124
130
  }
125
131
  onKeyDown(e) {
132
+ if (this.disabled)
133
+ return;
126
134
  if (e.code === "Space" || e.code === "Enter") {
127
135
  e.preventDefault();
128
136
  e.stopPropagation();
129
- this.click();
137
+ this.handleClick();
130
138
  }
131
139
  }
132
140
  handleClick() {
141
+ if (this.disabled)
142
+ return;
133
143
  this.checked = !this.checked;
134
144
  if (this.checked && this.name)
135
145
  this.getRootNode()
@@ -26,6 +26,11 @@ export declare class TkButton extends TkBox {
26
26
  ripple: boolean;
27
27
  protected $ahref: HTMLAnchorElement;
28
28
  protected $button: HTMLButtonElement;
29
+ protected $defaultSlot: HTMLSlotElement;
30
+ protected $badgeInSlot: HTMLSlotElement;
31
+ protected $badgeOutSlot: HTMLSlotElement;
32
+ private hasSlotContent;
33
+ private toggleAttributeForSlot;
29
34
  render(): import("lit").TemplateResult<1>;
30
35
  connectedCallback(): void;
31
36
  disconnectedCallback(): void;
@@ -33,7 +38,9 @@ export declare class TkButton extends TkBox {
33
38
  protected onKeyDown: (e: KeyboardEvent) => void;
34
39
  firstUpdated(): void;
35
40
  protected handleClick: (e: Event) => void;
36
- slotChanged(): void;
41
+ slotChanged: () => void;
42
+ protected badgeInChanged: () => void;
43
+ protected badgeOutChanged: () => void;
37
44
  }
38
45
  declare global {
39
46
  interface HTMLElementTagNameMap {
package/button/index.js CHANGED
@@ -286,7 +286,7 @@ var box = __webpack_require__(3433);
286
286
  // EXTERNAL MODULE: ./tinkiet/utils/unique.ts
287
287
  var unique = __webpack_require__(3770);
288
288
  ;// ./tinkiet/button/button.scss
289
- /* 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))}");
289
+ /* 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))}");
290
290
  ;// ./tinkiet/button/button.ts
291
291
  var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
292
292
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -342,6 +342,15 @@ let TkButton = class TkButton extends box/* TkBox */.P {
342
342
  (_a = this.querySelector("button")) === null || _a === void 0 ? void 0 : _a.click();
343
343
  }
344
344
  };
345
+ this.slotChanged = () => {
346
+ this.toggleAttributeForSlot(this.$defaultSlot, "extended");
347
+ };
348
+ this.badgeInChanged = () => {
349
+ this.toggleAttributeForSlot(this.$badgeInSlot, "has-badge-in");
350
+ };
351
+ this.badgeOutChanged = () => {
352
+ this.toggleAttributeForSlot(this.$badgeOutSlot, "has-badge-out");
353
+ };
345
354
  }
346
355
  static get styles() {
347
356
  return [
@@ -351,6 +360,24 @@ let TkButton = class TkButton extends box/* TkBox */.P {
351
360
  `
352
361
  ];
353
362
  }
363
+ hasSlotContent(slot) {
364
+ var _a;
365
+ const nodes = (_a = slot === null || slot === void 0 ? void 0 : slot.assignedNodes({ flatten: true })) !== null && _a !== void 0 ? _a : [];
366
+ return nodes.some(node => {
367
+ var _a;
368
+ if (node.nodeType === Node.TEXT_NODE)
369
+ return !!((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim());
370
+ return node.nodeType !== Node.COMMENT_NODE;
371
+ });
372
+ }
373
+ toggleAttributeForSlot(slot, attribute) {
374
+ if (this.hasSlotContent(slot)) {
375
+ this.setAttribute(attribute, "");
376
+ }
377
+ else {
378
+ this.removeAttribute(attribute);
379
+ }
380
+ }
354
381
  render() {
355
382
  return (0,external_lit_.html) `
356
383
  ${this.iconPath
@@ -359,8 +386,14 @@ let TkButton = class TkButton extends box/* TkBox */.P {
359
386
  `
360
387
  : ""}
361
388
 
362
- <div class="content ${this.iconPath ? "has-icon" : ""}" @slotchange=${this.slotChanged}>
363
- <slot></slot>
389
+ <div class="content ${this.iconPath ? "has-icon" : ""}">
390
+ <slot @slotchange=${this.slotChanged}></slot>
391
+ </div>
392
+ <div class="badge-in">
393
+ <slot name="badge-in" @slotchange=${this.badgeInChanged}></slot>
394
+ </div>
395
+ <div class="badge-out">
396
+ <slot name="badge-out" @slotchange=${this.badgeOutChanged}></slot>
364
397
  </div>
365
398
 
366
399
  ${this.href
@@ -388,17 +421,9 @@ let TkButton = class TkButton extends box/* TkBox */.P {
388
421
  firstUpdated() {
389
422
  if (this.type == "submit" || this.type == "reset")
390
423
  this.appendChild(this.$button);
391
- }
392
- slotChanged() {
393
- var _a;
394
- const slot = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot');
395
- const elements = slot === null || slot === void 0 ? void 0 : slot.assignedNodes({ flatten: true });
396
- if (elements && elements.length > 0) {
397
- this.setAttribute('extended', '');
398
- }
399
- else {
400
- this.removeAttribute('extended');
401
- }
424
+ this.slotChanged();
425
+ this.badgeInChanged();
426
+ this.badgeOutChanged();
402
427
  }
403
428
  };
404
429
  __decorate([
@@ -420,7 +445,7 @@ __decorate([
420
445
  (0,decorators_js_.property)({ type: String })
421
446
  ], TkButton.prototype, "iconPath", void 0);
422
447
  __decorate([
423
- (0,decorators_js_.property)()
448
+ (0,decorators_js_.property)({ type: Boolean })
424
449
  ], TkButton.prototype, "ripple", void 0);
425
450
  __decorate([
426
451
  (0,decorators_js_.query)("#ahref")
@@ -428,6 +453,15 @@ __decorate([
428
453
  __decorate([
429
454
  (0,decorators_js_.query)("button")
430
455
  ], TkButton.prototype, "$button", void 0);
456
+ __decorate([
457
+ (0,decorators_js_.query)("slot:not([name])")
458
+ ], TkButton.prototype, "$defaultSlot", void 0);
459
+ __decorate([
460
+ (0,decorators_js_.query)('slot[name="badge-in"]')
461
+ ], TkButton.prototype, "$badgeInSlot", void 0);
462
+ __decorate([
463
+ (0,decorators_js_.query)('slot[name="badge-out"]')
464
+ ], TkButton.prototype, "$badgeOutSlot", void 0);
431
465
  TkButton = __decorate([
432
466
  (0,decorators_js_.customElement)("tk-button")
433
467
  ], TkButton);
@@ -1,4 +1,4 @@
1
- import { LitElement } from "lit";
1
+ import { LitElement, PropertyValues } from "lit";
2
2
  import "../box";
3
3
  export declare class TkCheckbox extends LitElement {
4
4
  static styles: import("lit").CSSResult;
@@ -11,11 +11,9 @@ export declare class TkCheckbox extends LitElement {
11
11
  private $input;
12
12
  constructor();
13
13
  render(): import("lit").TemplateResult<1>;
14
- protected firstUpdated(): void;
15
- protected updated(): void;
14
+ protected updated(changedProps: PropertyValues<this>): void;
16
15
  protected onKeyDown(e: KeyboardEvent): void;
17
16
  protected handleClick(): void;
18
- private syncInput;
19
17
  }
20
18
  declare global {
21
19
  interface HTMLElementTagNameMap {
package/checkbox/index.js CHANGED
@@ -48,13 +48,37 @@ let TkCheckbox = class TkCheckbox extends external_lit_.LitElement {
48
48
  this.onKeyDown = this.onKeyDown.bind(this);
49
49
  }
50
50
  render() {
51
+ var _a, _b;
52
+ const labelId = `${this._id}-label`;
53
+ const ariaChecked = this.indeterminate ? "mixed" : this.checked ? "true" : "false";
51
54
  const containerClasses = {
52
55
  state: true,
53
56
  disabled: this.disabled
54
57
  };
55
58
  return (0,external_lit_.html) `
59
+ <input
60
+ type="checkbox"
61
+ aria-hidden="true"
62
+ tabindex="-1"
63
+ style="display: none"
64
+ .id=${this._id}
65
+ .name=${(_a = this.name) !== null && _a !== void 0 ? _a : ""}
66
+ .value=${(_b = this.value) !== null && _b !== void 0 ? _b : "on"}
67
+ ?checked=${this.checked}
68
+ ?disabled=${this.disabled}
69
+ .indeterminate=${this.indeterminate}
70
+ />
56
71
  <tk-box direction="row" align-items="center" @click=${this.handleClick}>
57
- <tk-box ripple tabindex="${this.disabled ? -1 : 0}" class=${(0,class_map_js_.classMap)(containerClasses)} @keydown=${this.onKeyDown}>
72
+ <tk-box
73
+ ripple
74
+ tabindex="${this.disabled ? -1 : 0}"
75
+ class=${(0,class_map_js_.classMap)(containerClasses)}
76
+ role="checkbox"
77
+ aria-checked=${ariaChecked}
78
+ aria-disabled=${this.disabled ? "true" : "false"}
79
+ aria-labelledby=${labelId}
80
+ @keydown=${this.onKeyDown}
81
+ >
58
82
  <div class="checkbox">
59
83
  <svg id="checkmark" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" preserveAspectRatio="none" viewBox="0 0 24 24">
60
84
  <path id="checkmark-path" fill="none" d="M1.73,12.91 8.1,19.28 22.79,4.59"></path>
@@ -62,22 +86,15 @@ let TkCheckbox = class TkCheckbox extends external_lit_.LitElement {
62
86
  </svg>
63
87
  </div>
64
88
  </tk-box>
65
- <span class="label"><slot></slot></span>
89
+ <span class="label" id=${labelId}><slot></slot></span>
66
90
  </tk-box>
67
91
  `;
68
92
  }
69
- firstUpdated() {
70
- this.$input = document.createElement("input");
71
- this.$input.type = "checkbox";
72
- this.$input.slot = "none";
73
- this.$input.style.display = "none";
74
- this.$input.setAttribute("aria-hidden", "true");
75
- this.$input.tabIndex = -1;
76
- this.syncInput();
77
- this.appendChild(this.$input);
78
- }
79
- updated() {
80
- this.syncInput();
93
+ updated(changedProps) {
94
+ super.updated(changedProps);
95
+ if (changedProps.has("indeterminate") && this.$input) {
96
+ this.$input.indeterminate = this.indeterminate;
97
+ }
81
98
  }
82
99
  onKeyDown(e) {
83
100
  if (this.disabled)
@@ -85,7 +102,7 @@ let TkCheckbox = class TkCheckbox extends external_lit_.LitElement {
85
102
  if (e.code === "Space" || e.code === "Enter") {
86
103
  e.preventDefault();
87
104
  e.stopPropagation();
88
- this.click();
105
+ this.handleClick();
89
106
  }
90
107
  }
91
108
  handleClick() {
@@ -94,18 +111,11 @@ let TkCheckbox = class TkCheckbox extends external_lit_.LitElement {
94
111
  this.checked = !this.checked;
95
112
  if (this.indeterminate)
96
113
  this.indeterminate = false;
97
- setTimeout(() => this.dispatchEvent(new Event("change", { bubbles: true, composed: true })));
98
- }
99
- syncInput() {
100
- var _a, _b;
101
- if (!this.$input)
102
- return;
103
- this.$input.id = this._id;
104
- this.$input.name = (_a = this.name) !== null && _a !== void 0 ? _a : "";
105
- this.$input.value = (_b = this.value) !== null && _b !== void 0 ? _b : "on";
106
- this.$input.checked = this.checked;
107
- this.$input.disabled = this.disabled;
108
- this.$input.indeterminate = this.indeterminate;
114
+ this.dispatchEvent(new CustomEvent("change", {
115
+ bubbles: true,
116
+ composed: true,
117
+ detail: { checked: this.checked, indeterminate: this.indeterminate }
118
+ }));
109
119
  }
110
120
  };
111
121
  TkCheckbox.styles = (0,external_lit_.css) `
@@ -126,6 +136,9 @@ __decorate([
126
136
  __decorate([
127
137
  (0,decorators_js_.property)({ attribute: true, type: Boolean, reflect: true })
128
138
  ], TkCheckbox.prototype, "indeterminate", void 0);
139
+ __decorate([
140
+ (0,decorators_js_.query)("input[aria-hidden]")
141
+ ], TkCheckbox.prototype, "$input", void 0);
129
142
  TkCheckbox = __decorate([
130
143
  (0,decorators_js_.customElement)("tk-checkbox")
131
144
  ], TkCheckbox);
@@ -403,7 +416,7 @@ var x = (y) => {
403
416
  var x = {}; __webpack_require__.d(x, y); return x
404
417
  }
405
418
  var y = (x) => (() => (x))
406
- module.exports = x({ ["customElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.customElement), ["property"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.property) });
419
+ module.exports = x({ ["customElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.customElement), ["property"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.property), ["query"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.query) });
407
420
 
408
421
  /***/ })
409
422
 
package/chip/chip.d.ts CHANGED
@@ -15,7 +15,7 @@ export declare class TkChip extends LitElement {
15
15
  disabled: boolean;
16
16
  removable: boolean;
17
17
  static styles: import("lit").CSSResult;
18
- private onRemove;
18
+ private readonly onRemove;
19
19
  render(): import("lit").TemplateResult<1>;
20
20
  }
21
21
  declare global {
package/chip/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_lit__ from "lit";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_lit_directives_class_map_js_2f88e643__ from "lit/directives/class-map.js";
2
3
  import * as __WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__ from "lit/decorators.js";
3
4
  /******/ var __webpack_modules__ = ({
4
5
 
@@ -26,6 +27,8 @@ __webpack_require__.d(__webpack_exports__, {
26
27
  var external_lit_ = __webpack_require__(2927);
27
28
  // EXTERNAL MODULE: external "lit/decorators.js"
28
29
  var decorators_js_ = __webpack_require__(8899);
30
+ // EXTERNAL MODULE: external "lit/directives/class-map.js"
31
+ var class_map_js_ = __webpack_require__(4955);
29
32
  ;// ./tinkiet/chip/chip.scss
30
33
  /* 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}");
31
34
  ;// ./tinkiet/chip/chip.ts
@@ -38,6 +41,7 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
38
41
 
39
42
 
40
43
 
44
+
41
45
  /**
42
46
  * Material-style Chip component.
43
47
  *
@@ -55,14 +59,21 @@ let TkChip = class TkChip extends external_lit_.LitElement {
55
59
  super(...arguments);
56
60
  this.disabled = false;
57
61
  this.removable = false;
58
- }
59
- onRemove() {
60
- this.dispatchEvent(new CustomEvent("remove", { bubbles: true, composed: true }));
62
+ this.onRemove = (event) => {
63
+ event.stopPropagation();
64
+ if (this.disabled)
65
+ return;
66
+ this.dispatchEvent(new CustomEvent("remove", { bubbles: true, composed: true }));
67
+ };
61
68
  }
62
69
  render() {
70
+ const classes = {
71
+ chip: true,
72
+ disabled: this.disabled
73
+ };
63
74
  return (0,external_lit_.html) `
64
- <div class="chip ${this.disabled ? "disabled" : ""}">
65
-
75
+ <div class=${(0,class_map_js_.classMap)(classes)} aria-disabled=${this.disabled ? "true" : "false"}>
76
+
66
77
  <!-- 3. LEADING ICON (optional) -->
67
78
  <span class="leading">
68
79
  <slot name="leading"></slot>
@@ -77,7 +88,7 @@ let TkChip = class TkChip extends external_lit_.LitElement {
77
88
  <span class="trailing">
78
89
  <slot name="trailing">
79
90
  ${this.removable
80
- ? (0,external_lit_.html) `<button class="remove" @click=${this.onRemove}>✕</button>`
91
+ ? (0,external_lit_.html) `<button class="remove" type="button" ?disabled=${this.disabled} aria-label="Remove" @click=${this.onRemove}>✕</button>`
81
92
  : ""}
82
93
  </slot>
83
94
  </span>
@@ -88,10 +99,10 @@ let TkChip = class TkChip extends external_lit_.LitElement {
88
99
  };
89
100
  TkChip.styles = (0,external_lit_.css) `${(0,external_lit_.unsafeCSS)(chip)}`;
90
101
  __decorate([
91
- (0,decorators_js_.property)({ type: Boolean })
102
+ (0,decorators_js_.property)({ type: Boolean, reflect: true })
92
103
  ], TkChip.prototype, "disabled", void 0);
93
104
  __decorate([
94
- (0,decorators_js_.property)({ type: Boolean })
105
+ (0,decorators_js_.property)({ type: Boolean, reflect: true })
95
106
  ], TkChip.prototype, "removable", void 0);
96
107
  TkChip = __decorate([
97
108
  (0,decorators_js_.customElement)("tk-chip")
@@ -99,6 +110,17 @@ TkChip = __decorate([
99
110
 
100
111
 
101
112
 
113
+ /***/ }),
114
+
115
+ /***/ 4955:
116
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
117
+
118
+ var x = (y) => {
119
+ var x = {}; __webpack_require__.d(x, y); return x
120
+ }
121
+ var y = (x) => (() => (x))
122
+ module.exports = x({ ["classMap"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_directives_class_map_js_2f88e643__.classMap) });
123
+
102
124
  /***/ }),
103
125
 
104
126
  /***/ 8899:
@@ -4,10 +4,11 @@ export declare class TkDialog extends LitElement {
4
4
  modal: boolean;
5
5
  open: boolean;
6
6
  blurOverlay: boolean;
7
- private resolve;
7
+ private resolve?;
8
8
  private handleKeyDown;
9
+ private onOverlayClick;
9
10
  render(): import("lit").TemplateResult<1>;
10
- protected updated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
11
+ protected updated(changedProps: PropertyValueMap<this>): void;
11
12
  connectedCallback(): void;
12
13
  disconnectedCallback(): void;
13
14
  show(): Promise<string | boolean | null>;
package/dialog/index.js CHANGED
@@ -9,7 +9,7 @@ var x = (y) => {
9
9
  var x = {}; __webpack_require__.d(x, y); return x
10
10
  }
11
11
  var y = (x) => (() => (x))
12
- module.exports = x({ ["LitElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.LitElement), ["css"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.css), ["html"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.html), ["unsafeCSS"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.unsafeCSS) });
12
+ module.exports = x({ ["LitElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.LitElement), ["css"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.css), ["html"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.html), ["nothing"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.nothing), ["unsafeCSS"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.unsafeCSS) });
13
13
 
14
14
  /***/ }),
15
15
 
@@ -59,24 +59,32 @@ let TkDialog = class TkDialog extends external_lit_.LitElement {
59
59
  if (event.key === "Escape" && this.open && !this.modal)
60
60
  this.hide();
61
61
  };
62
+ this.onOverlayClick = () => {
63
+ if (!this.modal)
64
+ this.hide();
65
+ };
62
66
  }
63
67
  render() {
64
68
  return (0,external_lit_.html) `
65
69
  ${this.open
66
70
  ? (0,external_lit_.html) `
67
- <div class="overlay ${this.blurOverlay ? "blur" : ""}" @click=${() => (this.modal ? null : this.hide())}></div>
68
- <div class="container">
71
+ <div class="overlay ${this.blurOverlay ? "blur" : ""}" @click=${this.onOverlayClick}></div>
72
+ <div class="container" role="dialog" aria-modal=${this.modal ? "true" : "false"}>
69
73
  <slot></slot>
70
74
  </div>
71
75
  `
72
- : ""}
76
+ : external_lit_.nothing}
73
77
  `;
74
78
  }
75
- updated(_changedProperties) {
76
- if (_changedProperties.has("open") && this.open)
77
- this.dispatchEvent(new Event("did-show"));
78
- if (_changedProperties.has("open") && _changedProperties.get("open") == true && !this.open)
79
- this.dispatchEvent(new Event("did-close"));
79
+ updated(changedProps) {
80
+ if (changedProps.has("open")) {
81
+ if (this.open) {
82
+ this.dispatchEvent(new CustomEvent("did-show", { bubbles: true }));
83
+ }
84
+ else if (changedProps.get("open") === true) {
85
+ this.dispatchEvent(new CustomEvent("did-close", { bubbles: true }));
86
+ }
87
+ }
80
88
  }
81
89
  connectedCallback() {
82
90
  super.connectedCallback();
@@ -1,20 +1,24 @@
1
- import { LitElement } from "lit";
1
+ import { LitElement, PropertyValues } from "lit";
2
2
  export declare class TkDrawer extends LitElement {
3
3
  static styles: import("lit").CSSResult;
4
- _open: boolean;
5
- set open(value: boolean);
6
- get open(): boolean;
4
+ open: boolean;
7
5
  over: boolean;
8
6
  openQuery: string;
9
7
  overQuery: string;
10
8
  right: boolean;
11
9
  swipeable: boolean;
12
10
  private $drawer;
11
+ private $content;
12
+ private contentScrolled;
13
+ private contentHasBottomShadow;
13
14
  private mql;
14
15
  private overMediaQueryListener;
16
+ private handleOverlayClick;
15
17
  render(): import("lit").TemplateResult<1>;
16
- updated(props: any): void;
18
+ protected firstUpdated(): void;
19
+ updated(props: PropertyValues<this>): void;
17
20
  protected overMediaQuery(): void;
21
+ private handleContentScroll;
18
22
  hideIfOver(): void;
19
23
  show(): void;
20
24
  hide(): void;