@design.estate/dees-catalog 1.0.232 → 1.0.235

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.
@@ -69617,6 +69617,7 @@ var DeesWindowLayer = class extends DeesElement {
69617
69617
  .visible {
69618
69618
  background: rgba(0, 0, 0, 0.2);
69619
69619
  backdrop-filter: brightness(0.9) ${this.options.blur ? "blur(2px)" : ""};
69620
+ pointer-events: all;
69620
69621
  }
69621
69622
  </style>
69622
69623
  <div class="windowOverlay ${this.visible ? "visible" : null}">
@@ -70431,7 +70432,7 @@ var DeesInputText = class extends DeesElement {
70431
70432
  return x`
70432
70433
  <style>
70433
70434
  input {
70434
- font-family: ${this.isPasswordBool ? "monospace" : "Inter"};
70435
+ font-family: ${this.isPasswordBool ? "monospace" : "Roboto"};
70435
70436
  letter-spacing: ${this.isPasswordBool ? "1px" : "normal"};
70436
70437
  color: ${this.goBright ? "#333" : "#ccc"};
70437
70438
  }
@@ -70565,6 +70566,7 @@ DeesInputText.styles = [
70565
70566
  border-radius: 7px;
70566
70567
  padding: 4px 0px;
70567
70568
  width: 40px;
70569
+ z-index: 3;
70568
70570
  }
70569
70571
 
70570
70572
  .showPassword:hover {
@@ -71624,9 +71626,22 @@ var demoFunc7 = () => x`
71624
71626
  form.setStatus("success", "authenticated!");
71625
71627
  }}
71626
71628
  >
71629
+ <dees-input-dropdown
71630
+ .label=${"title"}
71631
+ .options=${[
71632
+ { option: "option 1", key: "option1" },
71633
+ { option: "option 2", key: "option2" },
71634
+ { option: "option 3", key: "option3" }
71635
+ ]}
71636
+ ></dees-input-dropdown>
71627
71637
  <dees-input-text .required="${true}" key="hello1" label="a text"></dees-input-text>
71628
71638
  <dees-input-text .required="${true}" key="hello2" label="also a text"></dees-input-text>
71629
- <dees-input-text .required="${true}" key="hello3" label="a password" isPasswordBool></dees-input-text>
71639
+ <dees-input-text
71640
+ .required="${true}"
71641
+ key="hello3"
71642
+ label="a password"
71643
+ isPasswordBool
71644
+ ></dees-input-text>
71630
71645
  <dees-input-checkbox
71631
71646
  .required="${true}"
71632
71647
  key="hello3"
@@ -76096,6 +76111,22 @@ var demoFunc11 = () => x`
76096
76111
  { option: "option 3", key: "option3" }
76097
76112
  ]}
76098
76113
  ></dees-input-dropdown>
76114
+ <dees-input-dropdown
76115
+ .enableSearch=${false}
76116
+ .options=${[
76117
+ { option: "option 1", key: "option1" },
76118
+ { option: "option 2", key: "option2" },
76119
+ { option: "option 3", key: "option3" }
76120
+ ]}
76121
+ ></dees-input-dropdown>
76122
+ <div style="height: 300px"></div>
76123
+ <dees-input-dropdown
76124
+ .options=${[
76125
+ { option: "option 1", key: "option1" },
76126
+ { option: "option 2", key: "option2" },
76127
+ { option: "option 3", key: "option3" }
76128
+ ]}
76129
+ ></dees-input-dropdown>
76099
76130
  `;
76100
76131
 
76101
76132
  // ts_web/elements/dees-input-dropdown.ts
@@ -76106,51 +76137,132 @@ var DeesInputDropdown = class extends DeesElement {
76106
76137
  this.changeSubject = new plugins.smartrx.rxjs.Subject();
76107
76138
  this.label = "Label";
76108
76139
  this.options = [];
76109
- this.selectedOption = {
76110
- key: null,
76111
- option: null,
76112
- payload: null
76113
- };
76140
+ this.selectedOption = null;
76114
76141
  this.required = false;
76142
+ this.enableSearch = true;
76115
76143
  this.disabled = false;
76144
+ this.opensToTop = false;
76145
+ this.isElevated = false;
76116
76146
  }
76117
76147
  render() {
76118
76148
  return x`
76119
76149
  <div class="maincontainer">
76120
- <div class="selectedBox show" @click="${(event) => {
76121
- this.openSelectionBox();
76122
- }}">
76123
- ${this.selectedOption?.option}
76124
- </div>
76150
+ ${this.label ? x`<div class="label">${this.label}</div>` : x``}
76125
76151
  <div class="selectionBox">
76152
+ ${this.enableSearch && !this.opensToTop ? x`
76153
+ <div class="search">
76154
+ <input type="text" placeholder="Search" />
76155
+ </div>
76156
+ ` : null}
76126
76157
  ${this.options.map((option) => {
76127
76158
  return x`
76128
- <div class="option" @click=${() => {
76159
+ <div
76160
+ class="option"
76161
+ @click=${() => {
76129
76162
  this.updateSelection(option);
76130
- }}>${option.option}</div>
76163
+ }}
76164
+ >
76165
+ ${option.option}
76166
+ </div>
76131
76167
  `;
76132
76168
  })}
76169
+ ${this.enableSearch && this.opensToTop ? x`
76170
+ <div class="search">
76171
+ <input type="text" placeholder="Search" />
76172
+ </div>
76173
+ ` : null}
76174
+ </div>
76175
+ <div
76176
+ class="selectedBox"
76177
+ @click="${(event) => {
76178
+ if (!this.isElevated) {
76179
+ this.toggleSelectionBox();
76180
+ } else {
76181
+ this.updateSelection(this.selectedOption);
76182
+ }
76183
+ }}"
76184
+ >
76185
+ ${this.selectedOption?.option}
76133
76186
  </div>
76134
76187
  </div>
76135
76188
  `;
76136
76189
  }
76137
76190
  firstUpdated() {
76138
- this.selectedOption = this.options[0] || null;
76191
+ this.selectedOption = this.selectedOption || this.options[0] || null;
76139
76192
  }
76140
76193
  async updateSelection(selectedOption) {
76141
76194
  this.selectedOption = selectedOption;
76142
- this.dispatchEvent(new CustomEvent("selectedOption", {
76143
- detail: selectedOption,
76144
- bubbles: true
76145
- }));
76146
- this.openSelectionBox();
76195
+ this.dispatchEvent(
76196
+ new CustomEvent("selectedOption", {
76197
+ detail: selectedOption,
76198
+ bubbles: true
76199
+ })
76200
+ );
76201
+ if (this.isElevated) {
76202
+ this.toggleSelectionBox();
76203
+ }
76147
76204
  this.changeSubject.next(this);
76148
76205
  }
76149
- openSelectionBox() {
76150
- this.shadowRoot.querySelector(".selectedBox").classList.toggle("show");
76151
- this.shadowRoot.querySelector(".selectionBox").classList.toggle("show");
76152
- }
76153
- closeSelectionBox() {
76206
+ async toggleSelectionBox() {
76207
+ const domtoolsInstance = await this.domtoolsPromise;
76208
+ const selectedBox = this.shadowRoot.querySelector(".selectedBox");
76209
+ const selectionBox = this.shadowRoot.querySelector(".selectionBox");
76210
+ if (!this.isElevated) {
76211
+ this.windowOverlay = await DeesWindowLayer.createAndShow({
76212
+ blur: false
76213
+ });
76214
+ const elevatedDropdown = new DeesInputDropdown();
76215
+ elevatedDropdown.isElevated = true;
76216
+ elevatedDropdown.label = this.label;
76217
+ elevatedDropdown.enableSearch = this.enableSearch;
76218
+ elevatedDropdown.required = this.required;
76219
+ elevatedDropdown.disabled = this.disabled;
76220
+ elevatedDropdown.style.position = "fixed";
76221
+ elevatedDropdown.style.top = this.getBoundingClientRect().top + "px";
76222
+ elevatedDropdown.style.left = this.getBoundingClientRect().left + "px";
76223
+ elevatedDropdown.style.width = this.clientWidth + "px";
76224
+ elevatedDropdown.options = this.options;
76225
+ elevatedDropdown.selectedOption = this.selectedOption;
76226
+ console.log(elevatedDropdown.selectedOption);
76227
+ this.windowOverlay.appendChild(elevatedDropdown);
76228
+ await domtoolsInstance.convenience.smartdelay.delayFor(0);
76229
+ elevatedDropdown.toggleSelectionBox();
76230
+ const destroyOverlay = async () => {
76231
+ elevatedDropdown.shadowRoot.querySelector(".selectionBox").style.opacity = "0";
76232
+ elevatedDropdown.removeEventListener("selectedOption", handleSelection);
76233
+ this.windowOverlay.removeEventListener("clicked", destroyOverlay);
76234
+ this.windowOverlay.destroy();
76235
+ };
76236
+ const handleSelection = async (event) => {
76237
+ await this.updateSelection(elevatedDropdown.selectedOption);
76238
+ destroyOverlay();
76239
+ };
76240
+ elevatedDropdown.addEventListener("selectedOption", handleSelection);
76241
+ this.windowOverlay.addEventListener("clicked", destroyOverlay);
76242
+ } else {
76243
+ if (!selectionBox.classList.contains("show")) {
76244
+ selectionBox.style.width = selectedBox.clientWidth + "px";
76245
+ selectionBox.classList.add("show");
76246
+ const spaceData = selectedBox.getBoundingClientRect();
76247
+ if (300 > window.innerHeight - spaceData.bottom) {
76248
+ this.opensToTop = true;
76249
+ selectedBox.classList.add("accentTop");
76250
+ selectionBox.style.bottom = selectedBox.clientHeight + 2 + "px";
76251
+ } else {
76252
+ selectedBox.classList.add("accentBottom");
76253
+ this.opensToTop = false;
76254
+ const labelOffset = this.label ? 24 : 0;
76255
+ selectionBox.style.top = selectedBox.clientHeight + labelOffset + "px";
76256
+ }
76257
+ await domtoolsInstance.convenience.smartdelay.delayFor(0);
76258
+ const searchInput = selectionBox.querySelector("input");
76259
+ searchInput.focus();
76260
+ } else {
76261
+ selectedBox.style.pointerEvents = "none";
76262
+ selectionBox.classList.remove("show");
76263
+ selectedBox.style.opacity = "0";
76264
+ }
76265
+ }
76154
76266
  }
76155
76267
  };
76156
76268
  DeesInputDropdown.demo = demoFunc11;
@@ -76158,80 +76270,107 @@ DeesInputDropdown.styles = [
76158
76270
  cssManager.defaultStyles,
76159
76271
  i`
76160
76272
  * {
76161
- box-sizing: border-box;
76162
- }
76273
+ box-sizing: border-box;
76274
+ }
76163
76275
 
76164
- :host {
76165
- position: relative;
76166
- display: block;
76167
- height: 40px;
76168
- color: ${cssManager.bdTheme("#222", "#fff")};
76169
- }
76276
+ :host {
76277
+ font-family: Roboto;
76278
+ position: relative;
76279
+ display: block;
76280
+ color: ${cssManager.bdTheme("#222", "#fff")};
76281
+ margin-bottom: 24px;
76282
+ }
76170
76283
 
76171
- .maincontainer {
76172
- display: block;
76173
- }
76284
+ .maincontainer {
76285
+ display: block;
76286
+ }
76174
76287
 
76175
- .label {
76176
- font-size: 14px;
76177
- margin-bottom: 15px;
76178
- }
76288
+ .label {
76289
+ font-size: 14px;
76290
+ margin-bottom: 4px;
76291
+ }
76179
76292
 
76180
- .selectedBox {
76181
- cursor: pointer;
76182
- position: relative;
76183
- max-width: 420px;
76184
- height: 40px;
76185
- line-height: 40px;
76186
- padding: 0px 8px;
76187
- z-index: 0px;
76188
- background: ${cssManager.bdTheme("#ffffff", "#333333")};
76189
- box-shadow: ${cssManager.bdTheme("0px 1px 4px rgba(0,0,0,0.3)", "none")};
76190
- border-radius: 3px;
76191
- border-top: 1px solid #CCCCCC00;
76192
- border-bottom: 1px solid #66666600;
76193
- }
76293
+ .selectedBox {
76294
+ user-select: none;
76295
+ cursor: pointer;
76296
+ position: relative;
76297
+ max-width: 420px;
76298
+ height: 40px;
76299
+ line-height: 40px;
76300
+ padding: 0px 8px;
76301
+ background: ${cssManager.bdTheme("#fafafa", "#222")};
76302
+ box-shadow: ${cssManager.bdTheme("0px 1px 4px rgba(0,0,0,0.3)", "none")};
76303
+ border-radius: 3px;
76304
+ border-top: ${cssManager.bdTheme("1px solid #CCC", "1px solid #444")};
76305
+ border-bottom: ${cssManager.bdTheme("1px solid #CCC", "1px solid #333")};
76306
+ transition: all 0.2s ease;
76307
+ }
76194
76308
 
76195
- .selectedBox.show {
76196
- border-top: 1px solid ${cssManager.bdTheme("#ffffff", "#666666")};
76197
- border-bottom: 1px solid ${cssManager.bdTheme("#fafafa", "#222222")};
76198
- }
76309
+ .accentTop {
76310
+ border-top: 1px solid #e4002b;
76311
+ }
76199
76312
 
76200
- .selectionBox {
76201
- will-change:transform;
76202
- pointer-events: none;
76203
- cursor: pointer;
76204
- transition: all 0.2s ease;
76205
- opacity: 0;
76206
- position: absolute;
76207
- background: ${cssManager.bdTheme("#ffffff", "#222222")};
76208
- max-width: 420px;
76209
- box-shadow: 0px 0px 5px rgba(0,0,0,0.2);
76210
- min-height: 40px;
76211
- z-index: 100;
76212
- border-radius: 3px;
76213
- padding: 4px;
76214
- transform: scale(0.99,0.99);
76215
- }
76313
+ .accentBottom {
76314
+ border-bottom: 1px solid #e4002b;
76315
+ }
76216
76316
 
76217
- .selectionBox.show {
76218
- pointer-events: all;
76219
- opacity: 1;
76220
- transform: scale(1,1);
76221
- }
76317
+ .selectionBox {
76318
+ will-change: transform;
76319
+ pointer-events: none;
76320
+ cursor: pointer;
76321
+ transition: all 0.2s ease;
76322
+ opacity: 0;
76323
+ background: ${cssManager.bdTheme("#ffffff", "#222222")};
76324
+ max-width: 420px;
76325
+ box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
76326
+ min-height: 40px;
76327
+ border-radius: 3px;
76328
+ padding: 4px;
76329
+ transform: scale(0.99, 0.99);
76330
+ position: absolute;
76331
+ }
76222
76332
 
76223
- .option {
76224
- transition: all 0.1s;
76225
- line-height: 40px;
76226
- padding: 0px 4px;
76227
- border-radius: 3px;
76228
- }
76333
+ .selectionBox.show {
76334
+ pointer-events: all;
76335
+ opacity: 1;
76336
+ transform: scale(1, 1);
76337
+ }
76229
76338
 
76230
- .option:hover {
76231
- color: #fff;
76232
- padding-left: 8px;
76233
- background: #0277bd;
76234
- }
76339
+ .option {
76340
+ transition: all 0.1s;
76341
+ line-height: 40px;
76342
+ padding: 0px 4px;
76343
+ border-radius: 3px;
76344
+ }
76345
+
76346
+ .option:hover {
76347
+ color: #fff;
76348
+ padding-left: 8px;
76349
+ background: #0277bd;
76350
+ }
76351
+
76352
+ .search {
76353
+ padding: 8px;
76354
+ }
76355
+ .search input {
76356
+ display: block;
76357
+ width: 80%;
76358
+ background: none;
76359
+ border: none;
76360
+ height: 24px;
76361
+ color: inherit;
76362
+ text-align: center;
76363
+ font-size: 12px;
76364
+ font-weight: 600;
76365
+ background: ${cssManager.bdTheme("#00000010", "#ffffff08")};
76366
+ border-radius: 16px;
76367
+ margin: auto;
76368
+ }
76369
+
76370
+ .search input:focus {
76371
+ border: none;
76372
+ outline: none;
76373
+ }
76235
76374
  `
76236
76375
  ];
76237
76376
  __decorateClass([
@@ -76254,11 +76393,19 @@ __decorateClass([
76254
76393
  type: Boolean
76255
76394
  })
76256
76395
  ], DeesInputDropdown.prototype, "required", 2);
76396
+ __decorateClass([
76397
+ n4({
76398
+ type: Boolean
76399
+ })
76400
+ ], DeesInputDropdown.prototype, "enableSearch", 2);
76257
76401
  __decorateClass([
76258
76402
  n4({
76259
76403
  type: Boolean
76260
76404
  })
76261
76405
  ], DeesInputDropdown.prototype, "disabled", 2);
76406
+ __decorateClass([
76407
+ r6()
76408
+ ], DeesInputDropdown.prototype, "opensToTop", 2);
76262
76409
  DeesInputDropdown = __decorateClass([
76263
76410
  t4("dees-input-dropdown")
76264
76411
  ], DeesInputDropdown);