@design.estate/dees-catalog 1.0.232 → 1.0.233

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