mdui 2.0.5 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/components/avatar/index.js +2 -7
  2. package/components/avatar/style.js +1 -31
  3. package/components/badge/style.js +1 -25
  4. package/components/bottom-app-bar/style.js +1 -92
  5. package/components/button/button-base-style.js +1 -28
  6. package/components/button/button-base.js +1 -8
  7. package/components/button/index.js +8 -18
  8. package/components/button/style.js +2 -111
  9. package/components/button-icon/index.js +5 -22
  10. package/components/button-icon/style.js +2 -103
  11. package/components/card/index.js +1 -5
  12. package/components/card/style.js +1 -72
  13. package/components/checkbox/index.js +7 -50
  14. package/components/checkbox/style.js +1 -131
  15. package/components/chip/index.js +9 -33
  16. package/components/chip/style.js +2 -205
  17. package/components/circular-progress/index.js +5 -39
  18. package/components/circular-progress/style.js +1 -136
  19. package/components/collapse/collapse-item-style.js +1 -21
  20. package/components/collapse/collapse-item.js +2 -10
  21. package/components/collapse/collapse-style.js +1 -5
  22. package/components/collapse/collapse.js +1 -4
  23. package/components/dialog/index.js +7 -35
  24. package/components/dialog/style.js +1 -116
  25. package/components/divider/style.js +1 -18
  26. package/components/dropdown/index.js +1 -8
  27. package/components/dropdown/style.js +1 -11
  28. package/components/fab/index.js +5 -13
  29. package/components/fab/style.js +4 -153
  30. package/components/icon/index.js +1 -5
  31. package/components/icon/style.js +1 -29
  32. package/components/layout/layout-item-style.js +1 -6
  33. package/components/layout/layout-main-style.js +1 -7
  34. package/components/layout/layout-style.js +1 -11
  35. package/components/linear-progress/index.js +2 -6
  36. package/components/linear-progress/style.js +1 -73
  37. package/components/list/list-item-style.js +2 -153
  38. package/components/list/list-item.js +8 -27
  39. package/components/list/list-style.js +1 -10
  40. package/components/list/list-subheader-style.js +1 -19
  41. package/components/menu/menu-item-style.js +1 -125
  42. package/components/menu/menu-item.js +13 -55
  43. package/components/menu/menu-style.js +1 -19
  44. package/components/menu/menu.js +1 -5
  45. package/components/navigation-bar/navigation-bar-item-style.js +1 -132
  46. package/components/navigation-bar/navigation-bar-item.js +7 -23
  47. package/components/navigation-bar/navigation-bar-style.js +1 -28
  48. package/components/navigation-bar/navigation-bar.js +1 -4
  49. package/components/navigation-drawer/index.js +1 -12
  50. package/components/navigation-drawer/style.js +1 -66
  51. package/components/navigation-rail/navigation-rail-item-style.js +1 -122
  52. package/components/navigation-rail/navigation-rail-item.js +7 -26
  53. package/components/navigation-rail/navigation-rail-style.js +1 -79
  54. package/components/navigation-rail/navigation-rail.js +1 -10
  55. package/components/radio/radio-group-style.js +1 -20
  56. package/components/radio/radio-group.js +1 -19
  57. package/components/radio/radio-style.js +1 -107
  58. package/components/radio/radio.js +5 -23
  59. package/components/range-slider/index.d.ts +1 -1
  60. package/components/range-slider/index.js +5 -53
  61. package/components/ripple/index.js +2 -5
  62. package/components/ripple/style.js +1 -96
  63. package/components/segmented-button/segmented-button-group-style.js +1 -28
  64. package/components/segmented-button/segmented-button-group.js +1 -21
  65. package/components/segmented-button/segmented-button-style.js +2 -81
  66. package/components/segmented-button/segmented-button.js +11 -27
  67. package/components/select/index.js +6 -87
  68. package/components/select/style.js +1 -27
  69. package/components/slider/index.js +2 -33
  70. package/components/slider/slider-base-style.js +1 -173
  71. package/components/slider/slider-base.js +1 -6
  72. package/components/slider/style.js +1 -7
  73. package/components/snackbar/index.js +5 -32
  74. package/components/snackbar/style.js +1 -100
  75. package/components/switch/index.js +6 -40
  76. package/components/switch/style.js +1 -202
  77. package/components/tabs/tab-panel-style.js +1 -10
  78. package/components/tabs/tab-style.js +1 -85
  79. package/components/tabs/tab.js +4 -24
  80. package/components/tabs/tabs-style.js +1 -138
  81. package/components/tabs/tabs.js +1 -9
  82. package/components/text-field/index.js +32 -160
  83. package/components/text-field/style.js +1 -362
  84. package/components/tooltip/index.js +1 -10
  85. package/components/tooltip/style.js +1 -57
  86. package/components/top-app-bar/top-app-bar-style.js +1 -78
  87. package/components/top-app-bar/top-app-bar-title-style.js +1 -81
  88. package/components/top-app-bar/top-app-bar-title.js +3 -17
  89. package/custom-elements.json +1105 -1105
  90. package/mdui.esm.js +22 -0
  91. package/mdui.global.js +22 -0
  92. package/package.json +1 -1
  93. package/web-types.en.json +1 -1
  94. package/web-types.zh-cn.json +1 -1
@@ -384,25 +384,9 @@ let TextField = class TextField extends FocusableMixin(MduiElement) {
384
384
  'is-firefox': navigator.userAgent.includes('Firefox'),
385
385
  ...invalidClassNameObj,
386
386
  });
387
- return html `<div part="container" class=${className}>
388
- ${this.renderPrefix()}
389
- <div class="input-container">
390
- ${this.renderLabel()}
391
- ${this.isTextarea
387
+ return html `<div part="container" class="${className}">${this.renderPrefix()}<div class="input-container">${this.renderLabel()} ${this.isTextarea
392
388
  ? this.renderTextArea(hasInputSlot)
393
- : this.renderInput(hasInputSlot)}
394
- ${when(hasInputSlot, () => html `<slot name="input" class="input"></slot>`)}
395
- </div>
396
- ${this.renderClearButton()}${this.renderTogglePasswordButton()}
397
- ${this.renderSuffix(hasErrorIcon)}
398
- </div>
399
- ${when(hasError || hasHelper || hasCounter, () => html `<div
400
- part="supporting"
401
- class=${classMap({ supporting: true, ...invalidClassNameObj })}
402
- >
403
- ${this.renderHelper(hasError, hasHelper)}
404
- ${this.renderCounter(hasCounter)}
405
- </div>`)}`;
389
+ : this.renderInput(hasInputSlot)} ${when(hasInputSlot, () => html `<slot name="input" class="input"></slot>`)}</div>${this.renderClearButton()}${this.renderTogglePasswordButton()} ${this.renderSuffix(hasErrorIcon)}</div>${when(hasError || hasHelper || hasCounter, () => html `<div part="supporting" class="${classMap({ supporting: true, ...invalidClassNameObj })}">${this.renderHelper(hasError, hasHelper)} ${this.renderCounter(hasCounter)}</div>`)}`;
406
390
  }
407
391
  onChange() {
408
392
  this.value = this.inputRef.value.value;
@@ -464,168 +448,62 @@ let TextField = class TextField extends FocusableMixin(MduiElement) {
464
448
  }
465
449
  renderLabel() {
466
450
  return this.label
467
- ? html `<label
468
- part="label"
469
- class="label"
470
- ${animate({
451
+ ? html `<label part="label" class="label" ${animate({
471
452
  keyframeOptions: {
472
453
  duration: getDuration(this, 'short4'),
473
454
  easing: getEasing(this, 'standard'),
474
455
  },
475
- })}
476
- >
477
- ${this.label}
478
- </label>`
456
+ })}>${this.label}</label>`
479
457
  : nothingTemplate;
480
458
  }
481
459
  renderPrefix() {
482
- return html `<slot name="icon" part="icon" class="icon">
483
- ${this.icon
484
- ? html `<mdui-icon name=${this.icon} class="i"></mdui-icon>`
485
- : nothingTemplate}
486
- </slot>
487
- <slot name="prefix" part="prefix" class="prefix">${this.prefix}</slot>`;
460
+ return html `<slot name="icon" part="icon" class="icon">${this.icon
461
+ ? html `<mdui-icon name="${this.icon}" class="i"></mdui-icon>`
462
+ : nothingTemplate}</slot><slot name="prefix" part="prefix" class="prefix">${this.prefix}</slot>`;
488
463
  }
489
464
  renderSuffix(hasErrorIcon) {
490
- return html `<slot name="suffix" part="suffix" class="suffix">
491
- ${this.suffix}
492
- </slot>
493
- ${hasErrorIcon
494
- ? html `<slot name="error-icon" part="error-icon" class="right-icon">
495
- ${this.errorIcon
496
- ? html `<mdui-icon name=${this.errorIcon} class="i"></mdui-icon>`
497
- : html `<mdui-icon-error class="i"></mdui-icon-error>`}
498
- </slot>`
499
- : html `<slot
500
- name="end-icon"
501
- part="end-icon"
502
- class="end-icon right-icon"
503
- >
504
- ${this.endIcon
505
- ? html `<mdui-icon name=${this.endIcon} class="i"></mdui-icon>`
506
- : nothingTemplate}
507
- </slot>`}`;
465
+ return html `<slot name="suffix" part="suffix" class="suffix">${this.suffix}</slot>${hasErrorIcon
466
+ ? html `<slot name="error-icon" part="error-icon" class="right-icon">${this.errorIcon
467
+ ? html `<mdui-icon name="${this.errorIcon}" class="i"></mdui-icon>`
468
+ : html `<mdui-icon-error class="i"></mdui-icon-error>`}</slot>`
469
+ : html `<slot name="end-icon" part="end-icon" class="end-icon right-icon">${this.endIcon
470
+ ? html `<mdui-icon name="${this.endIcon}" class="i"></mdui-icon>`
471
+ : nothingTemplate}</slot>`}`;
508
472
  }
509
473
  renderClearButton() {
510
474
  const hasClearButton = this.clearable &&
511
475
  !this.disabled &&
512
476
  (!this.readonly || this.readonlyButClearable) &&
513
477
  (typeof this.value === 'number' || this.value.length > 0);
514
- return when(hasClearButton, () => html `<slot
515
- name="clear-button"
516
- part="clear-button"
517
- class="right-icon"
518
- @click=${this.onClear}
519
- >
520
- <mdui-button-icon tabindex="-1">
521
- <slot name="clear-icon" part="clear-icon">
522
- ${this.clearIcon
523
- ? html `<mdui-icon name=${this.clearIcon} class="i"></mdui-icon>`
524
- : html `<mdui-icon-cancel--outlined
525
- class="i"
526
- ></mdui-icon-cancel--outlined>`}
527
- </slot>
528
- </mdui-button-icon>
529
- </slot>`);
478
+ return when(hasClearButton, () => html `<slot name="clear-button" part="clear-button" class="right-icon" @click="${this.onClear}"><mdui-button-icon tabindex="-1"><slot name="clear-icon" part="clear-icon">${this.clearIcon
479
+ ? html `<mdui-icon name="${this.clearIcon}" class="i"></mdui-icon>`
480
+ : html `<mdui-icon-cancel--outlined class="i"></mdui-icon-cancel--outlined>`}</slot></mdui-button-icon></slot>`);
530
481
  }
531
482
  renderTogglePasswordButton() {
532
483
  const hasTogglePasswordButton = this.type === 'password' && this.togglePassword && !this.disabled;
533
- return when(hasTogglePasswordButton, () => html `<slot
534
- name="toggle-password-button"
535
- part="toggle-password-button"
536
- class="right-icon"
537
- @click=${this.onTogglePassword}
538
- >
539
- <mdui-button-icon tabindex="-1">
540
- ${this.isPasswordVisible
541
- ? html `<slot name="show-password-icon" part="show-password-icon">
542
- ${this.showPasswordIcon
543
- ? html `<mdui-icon
544
- name=${this.showPasswordIcon}
545
- class="i"
546
- ></mdui-icon>`
547
- : html `<mdui-icon-visibility-off
548
- class="i"
549
- ></mdui-icon-visibility-off>`}
550
- </slot>`
551
- : html `<slot name="hide-password-icon" part="hide-password-icon">
552
- ${this.hidePasswordIcon
553
- ? html `<mdui-icon
554
- name=${this.hidePasswordIcon}
555
- class="i"
556
- ></mdui-icon>`
557
- : html `<mdui-icon-visibility
558
- class="i"
559
- ></mdui-icon-visibility>`}
560
- </slot>`}
561
- </mdui-button-icon>
562
- </slot>`);
484
+ return when(hasTogglePasswordButton, () => html `<slot name="toggle-password-button" part="toggle-password-button" class="right-icon" @click="${this.onTogglePassword}"><mdui-button-icon tabindex="-1">${this.isPasswordVisible
485
+ ? html `<slot name="show-password-icon" part="show-password-icon">${this.showPasswordIcon
486
+ ? html `<mdui-icon name="${this.showPasswordIcon}" class="i"></mdui-icon>`
487
+ : html `<mdui-icon-visibility-off class="i"></mdui-icon-visibility-off>`}</slot>`
488
+ : html `<slot name="hide-password-icon" part="hide-password-icon">${this.hidePasswordIcon
489
+ ? html `<mdui-icon name="${this.hidePasswordIcon}" class="i"></mdui-icon>`
490
+ : html `<mdui-icon-visibility class="i"></mdui-icon-visibility>`}</slot>`}</mdui-button-icon></slot>`);
563
491
  }
564
492
  renderInput(hasInputSlot) {
565
- return html `<input
566
- ${ref(this.inputRef)}
567
- part="input"
568
- class="input ${classMap({ 'hide-input': hasInputSlot })}"
569
- type=${this.type === 'password' && this.isPasswordVisible
493
+ return html `<input ${ref(this.inputRef)} part="input" class="input ${classMap({ 'hide-input': hasInputSlot })}" type="${this.type === 'password' && this.isPasswordVisible
570
494
  ? 'text'
571
- : this.type}
572
- name=${ifDefined(this.name)}
573
- .value=${live(this.value)}
574
- placeholder=${ifDefined(
495
+ : this.type}" name="${ifDefined(this.name)}" .value="${live(this.value)}" placeholder="${ifDefined(
575
496
  // @ts-ignore
576
497
  !this.label || this.isFocusedStyle || this.hasValue
577
498
  ? this.placeholder
578
- : undefined)}
579
- ?readonly=${this.readonly}
580
- ?disabled=${this.disabled}
581
- ?required=${this.required}
582
- minlength=${ifDefined(this.minlength)}
583
- maxlength=${ifDefined(this.maxlength)}
584
- min=${ifDefined(this.min)}
585
- max=${ifDefined(this.max)}
586
- step=${ifDefined(this.step)}
587
- autocapitalize=${ifDefined(this.type === 'password' ? 'off' : this.autocapitalize)}
588
- autocomplete=${ifDefined(this.type === 'password' ? 'off' : this.autocomplete)}
589
- autocorrect=${ifDefined(this.type === 'password' ? 'off' : this.autocorrect)}
590
- spellcheck=${ifDefined(this.spellcheck)}
591
- pattern=${ifDefined(this.pattern)}
592
- enterkeyhint=${ifDefined(this.enterkeyhint)}
593
- inputmode=${ifDefined(this.inputmode)}
594
- @change=${this.onChange}
595
- @input=${this.onInput}
596
- @invalid=${this.onInvalid}
597
- @keydown=${this.onKeyDown}
598
- />`;
499
+ : undefined)}" ?readonly="${this.readonly}" ?disabled="${this.disabled}" ?required="${this.required}" minlength="${ifDefined(this.minlength)}" maxlength="${ifDefined(this.maxlength)}" min="${ifDefined(this.min)}" max="${ifDefined(this.max)}" step="${ifDefined(this.step)}" autocapitalize="${ifDefined(this.type === 'password' ? 'off' : this.autocapitalize)}" autocomplete="${ifDefined(this.type === 'password' ? 'off' : this.autocomplete)}" autocorrect="${ifDefined(this.type === 'password' ? 'off' : this.autocorrect)}" spellcheck="${ifDefined(this.spellcheck)}" pattern="${ifDefined(this.pattern)}" enterkeyhint="${ifDefined(this.enterkeyhint)}" inputmode="${ifDefined(this.inputmode)}" @change="${this.onChange}" @input="${this.onInput}" @invalid="${this.onInvalid}" @keydown="${this.onKeyDown}">`;
599
500
  }
600
501
  renderTextArea(hasInputSlot) {
601
- return html `<textarea
602
- ${ref(this.inputRef)}
603
- part="input"
604
- class="input ${classMap({ 'hide-input': hasInputSlot })}"
605
- name=${ifDefined(this.name)}
606
- .value=${live(this.value)}
607
- placeholder=${ifDefined(
502
+ return html `<textarea ${ref(this.inputRef)} part="input" class="input ${classMap({ 'hide-input': hasInputSlot })}" name="${ifDefined(this.name)}" .value="${live(this.value)}" placeholder="${ifDefined(
608
503
  // @ts-ignore
609
504
  !this.label || this.isFocusedStyle || this.hasValue
610
505
  ? this.placeholder
611
- : undefined)}
612
- ?readonly=${this.readonly}
613
- ?disabled=${this.disabled}
614
- ?required=${this.required}
615
- minlength=${ifDefined(this.minlength)}
616
- maxlength=${ifDefined(this.maxlength)}
617
- rows=${this.rows ?? 1}
618
- autocapitalize=${ifDefined(this.autocapitalize)}
619
- autocorrect=${ifDefined(this.autocorrect)}
620
- spellcheck=${ifDefined(this.spellcheck)}
621
- enterkeyhint=${ifDefined(this.enterkeyhint)}
622
- inputmode=${ifDefined(this.inputmode)}
623
- @change=${this.onChange}
624
- @input=${this.onInput}
625
- @invalid=${this.onInvalid}
626
- @keydown=${this.onKeyDown}
627
- @keyup=${this.onTextAreaKeyUp}
628
- ></textarea>`;
506
+ : undefined)}" ?readonly="${this.readonly}" ?disabled="${this.disabled}" ?required="${this.required}" minlength="${ifDefined(this.minlength)}" maxlength="${ifDefined(this.maxlength)}" rows="${this.rows ?? 1}" autocapitalize="${ifDefined(this.autocapitalize)}" autocorrect="${ifDefined(this.autocorrect)}" spellcheck="${ifDefined(this.spellcheck)}" enterkeyhint="${ifDefined(this.enterkeyhint)}" inputmode="${ifDefined(this.inputmode)}" @change="${this.onChange}" @input="${this.onInput}" @invalid="${this.onInvalid}" @keydown="${this.onKeyDown}" @keyup="${this.onTextAreaKeyUp}"></textarea>`;
629
507
  }
630
508
  /**
631
509
  * @param hasError 是否包含错误提示
@@ -633,21 +511,15 @@ let TextField = class TextField extends FocusableMixin(MduiElement) {
633
511
  */
634
512
  renderHelper(hasError, hasHelper) {
635
513
  return hasError
636
- ? html `<div part="error" class="error">
637
- ${this.error || this.inputRef.value.validationMessage}
638
- </div>`
514
+ ? html `<div part="error" class="error">${this.error || this.inputRef.value.validationMessage}</div>`
639
515
  : hasHelper
640
- ? html `<slot name="helper" part="helper" class="helper">
641
- ${this.helper}
642
- </slot>`
516
+ ? html `<slot name="helper" part="helper" class="helper">${this.helper}</slot>`
643
517
  : // 右边有 counter,需要占位
644
518
  html `<span></span>`;
645
519
  }
646
520
  renderCounter(hasCounter) {
647
521
  return hasCounter
648
- ? html `<div part="counter" class="counter">
649
- ${this.value.length}/${this.maxlength}
650
- </div>`
522
+ ? html `<div part="counter" class="counter">${this.value.length}/${this.maxlength}</div>`
651
523
  : nothingTemplate;
652
524
  }
653
525
  };
@@ -1,363 +1,2 @@
1
1
  import { css } from 'lit';
2
- export const style = css `
3
- :host {
4
- display: inline-block;
5
- width: 100%;
6
- }
7
- :host([disabled]) {
8
- pointer-events: none;
9
- }
10
- :host([type='hidden']) {
11
- display: none;
12
- }
13
- .container {
14
- position: relative;
15
- display: flex;
16
- align-items: center;
17
- transition: box-shadow var(--mdui-motion-duration-short4)
18
- var(--mdui-motion-easing-standard);
19
- padding: 0rem 1rem;
20
- }
21
- .container.has-icon {
22
- padding-left: 0.75rem;
23
- }
24
- .container.has-end-icon,
25
- .container.has-error-icon {
26
- padding-right: 0.75rem;
27
- }
28
- :host([variant='filled']) .container {
29
- box-shadow: inset 0 -0.0625rem 0 0 rgb(var(--mdui-color-on-surface-variant));
30
- background-color: rgb(var(--mdui-color-surface-container-highest));
31
- border-radius: var(--mdui-shape-corner-extra-small)
32
- var(--mdui-shape-corner-extra-small) 0 0;
33
- }
34
- :host([variant='filled']) .container.invalid,
35
- :host([variant='filled']) .container.invalid-style {
36
- box-shadow: inset 0 -0.0625rem 0 0 rgb(var(--mdui-color-error));
37
- }
38
- :host([variant='filled']:hover) .container {
39
- box-shadow: inset 0 -0.0625rem 0 0 rgb(var(--mdui-color-on-surface));
40
- }
41
- :host([variant='filled']:hover) .container.invalid,
42
- :host([variant='filled']:hover) .container.invalid-style {
43
- box-shadow: inset 0 -0.0625rem 0 0 rgb(var(--mdui-color-on-error-container));
44
- }
45
- :host([variant='filled'][focused]) .container,
46
- :host([variant='filled'][focused-style]) .container {
47
- box-shadow: inset 0 -0.125rem 0 0 rgb(var(--mdui-color-primary));
48
- }
49
- :host([variant='filled'][focused]) .container.invalid,
50
- :host([variant='filled'][focused-style]) .container.invalid,
51
- :host([variant='filled'][focused]) .container.invalid-style,
52
- :host([variant='filled'][focused-style]) .container.invalid-style {
53
- box-shadow: inset 0 -0.125rem 0 0 rgb(var(--mdui-color-error));
54
- }
55
- :host([variant='filled'][disabled]) .container {
56
- box-shadow: inset 0 -0.0625rem 0 0 rgba(var(--mdui-color-on-surface), 38%);
57
- background-color: rgba(var(--mdui-color-on-surface), 4%);
58
- }
59
- :host([variant='outlined']) .container {
60
- box-shadow: inset 0 0 0 0.0625rem rgb(var(--mdui-color-outline));
61
- border-radius: var(--mdui-shape-corner-extra-small);
62
- }
63
- :host([variant='outlined']) .container.invalid,
64
- :host([variant='outlined']) .container.invalid-style {
65
- box-shadow: inset 0 0 0 0.0625rem rgb(var(--mdui-color-error));
66
- }
67
- :host([variant='outlined']:hover) .container {
68
- box-shadow: inset 0 0 0 0.0625rem rgb(var(--mdui-color-on-surface));
69
- }
70
- :host([variant='outlined']:hover) .container.invalid,
71
- :host([variant='outlined']:hover) .container.invalid-style {
72
- box-shadow: inset 0 0 0 0.0625rem rgb(var(--mdui-color-on-error-container));
73
- }
74
- :host([variant='outlined'][focused]) .container,
75
- :host([variant='outlined'][focused-style]) .container {
76
- box-shadow: inset 0 0 0 0.125rem rgb(var(--mdui-color-primary));
77
- }
78
- :host([variant='outlined'][focused]) .container.invalid,
79
- :host([variant='outlined'][focused-style]) .container.invalid,
80
- :host([variant='outlined'][focused]) .container.invalid-style,
81
- :host([variant='outlined'][focused-style]) .container.invalid-style {
82
- box-shadow: inset 0 0 0 0.125rem rgb(var(--mdui-color-error));
83
- }
84
- :host([variant='outlined'][disabled]) .container {
85
- box-shadow: inset 0 0 0 0.125rem rgba(var(--mdui-color-on-surface), 12%);
86
- }
87
- .icon,
88
- .right-icon,
89
- .prefix,
90
- .suffix {
91
- display: flex;
92
- -webkit-user-select: none;
93
- user-select: none;
94
- color: rgb(var(--mdui-color-on-surface-variant));
95
- }
96
- :host([disabled]) .icon,
97
- :host([disabled]) .right-icon,
98
- :host([disabled]) .prefix,
99
- :host([disabled]) .suffix {
100
- color: rgba(var(--mdui-color-on-surface), 38%);
101
- }
102
- .invalid .right-icon,
103
- .invalid .suffix,
104
- .invalid-style .right-icon,
105
- .invalid-style .suffix {
106
- color: rgb(var(--mdui-color-error));
107
- }
108
- :host(:hover) .invalid .right-icon,
109
- :host(:hover) .invalid .suffix,
110
- :host(:hover) .invalid-style .right-icon,
111
- :host(:hover) .invalid-style .suffix {
112
- color: rgb(var(--mdui-color-on-error-container));
113
- }
114
- :host([focused]) .invalid .right-icon,
115
- :host([focused]) .invalid .suffix,
116
- :host([focused-style]) .invalid .right-icon,
117
- :host([focused-style]) .invalid .suffix,
118
- :host([focused]) .invalid-style .right-icon,
119
- :host([focused]) .invalid-style .suffix,
120
- :host([focused-style]) .invalid-style .right-icon,
121
- :host([focused-style]) .invalid-style .suffix {
122
- color: rgb(var(--mdui-color-error));
123
- }
124
- .icon,
125
- .right-icon {
126
- font-size: 1.5rem;
127
- }
128
- .icon mdui-button-icon,
129
- .right-icon mdui-button-icon,
130
- ::slotted(mdui-button-icon[slot]) {
131
- margin-left: -0.5rem;
132
- margin-right: -0.5rem;
133
- }
134
- .icon .i,
135
- .right-icon .i,
136
- ::slotted([slot$='icon']) {
137
- font-size: inherit;
138
- }
139
- .has-icon .icon {
140
- margin-right: 1rem;
141
- }
142
- .right-icon:not(.end-icon),
143
- .has-end-icon .end-icon {
144
- margin-left: 1rem;
145
- }
146
- .prefix,
147
- .suffix {
148
- display: none;
149
- font-size: var(--mdui-typescale-body-large-size);
150
- font-weight: var(--mdui-typescale-body-large-weight);
151
- letter-spacing: var(--mdui-typescale-body-large-tracking);
152
- line-height: var(--mdui-typescale-body-large-line-height);
153
- }
154
- :host([variant='filled'][label]) .prefix,
155
- :host([variant='filled'][label]) .suffix {
156
- padding-top: 1rem;
157
- }
158
- :host([focused]) .prefix,
159
- :host([focused]) .suffix,
160
- :host([focused-style]) .prefix,
161
- :host([focused-style]) .suffix,
162
- .has-value .prefix,
163
- .has-value .suffix {
164
- display: flex;
165
- }
166
- .prefix {
167
- padding-right: 0.125rem;
168
- }
169
- .suffix {
170
- padding-left: 0.125rem;
171
- }
172
- .input-container {
173
- width: 100%;
174
- }
175
- .label {
176
- position: absolute;
177
- pointer-events: none;
178
- max-width: calc(100% - 1rem);
179
- display: -webkit-box;
180
- overflow: hidden;
181
- -webkit-box-orient: vertical;
182
- -webkit-line-clamp: 1;
183
- top: 1rem;
184
- color: rgb(var(--mdui-color-on-surface-variant));
185
- font-size: var(--mdui-typescale-body-large-size);
186
- font-weight: var(--mdui-typescale-body-large-weight);
187
- letter-spacing: var(--mdui-typescale-body-large-tracking);
188
- line-height: var(--mdui-typescale-body-large-line-height);
189
- }
190
- .invalid .label,
191
- .invalid-style .label {
192
- color: rgb(var(--mdui-color-error));
193
- }
194
- :host([variant='outlined']) .label {
195
- padding: 0rem 0.25rem;
196
- margin: 0rem -0.25rem;
197
- }
198
- :host([variant='outlined']:hover) .label {
199
- color: rgb(var(--mdui-color-on-surface));
200
- }
201
- :host([variant='filled']:hover) .invalid .label,
202
- :host([variant='outlined']:hover) .invalid .label,
203
- :host([variant='filled']:hover) .invalid-style .label,
204
- :host([variant='outlined']:hover) .invalid-style .label {
205
- color: rgb(var(--mdui-color-on-error-container));
206
- }
207
- :host([variant='filled'][focused]) .label,
208
- :host([variant='filled'][focused-style]) .label,
209
- :host([variant='outlined'][focused]) .label,
210
- :host([variant='outlined'][focused-style]) .label {
211
- color: rgb(var(--mdui-color-primary));
212
- }
213
- :host([variant='filled'][focused]) .label,
214
- :host([variant='filled'][focused-style]) .label,
215
- :host([variant='filled']) .has-value .label,
216
- :host([variant='filled'][type='date']) .label,
217
- :host([variant='filled'][type='datetime-local']) .label,
218
- :host([variant='filled'][type='month']) .label,
219
- :host([variant='filled'][type='time']) .label,
220
- :host([variant='filled'][type='week']) .label {
221
- font-size: var(--mdui-typescale-body-small-size);
222
- font-weight: var(--mdui-typescale-body-small-weight);
223
- letter-spacing: var(--mdui-typescale-body-small-tracking);
224
- line-height: var(--mdui-typescale-body-small-line-height);
225
- top: 0.25rem;
226
- }
227
- :host([variant='outlined'][focused]) .label,
228
- :host([variant='outlined'][focused-style]) .label,
229
- :host([variant='outlined']) .has-value .label,
230
- :host([variant='outlined'][type='date']) .label,
231
- :host([variant='outlined'][type='datetime-local']) .label,
232
- :host([variant='outlined'][type='month']) .label,
233
- :host([variant='outlined'][type='time']) .label,
234
- :host([variant='outlined'][type='week']) .label {
235
- font-size: var(--mdui-typescale-body-small-size);
236
- font-weight: var(--mdui-typescale-body-small-weight);
237
- letter-spacing: var(--mdui-typescale-body-small-tracking);
238
- line-height: var(--mdui-typescale-body-small-line-height);
239
- top: -0.5rem;
240
- left: 0.75rem;
241
- background-color: rgb(var(--mdui-color-background));
242
- }
243
- :host([variant='filled'][focused]) .invalid .label,
244
- :host([variant='filled'][focused-style]) .invalid .label,
245
- :host([variant='outlined'][focused]) .invalid .label,
246
- :host([variant='outlined'][focused-style]) .invalid .label,
247
- :host([variant='filled'][focused]) .invalid-style .label,
248
- :host([variant='filled'][focused-style]) .invalid-style .label,
249
- :host([variant='outlined'][focused]) .invalid-style .label,
250
- :host([variant='outlined'][focused-style]) .invalid-style .label {
251
- color: rgb(var(--mdui-color-error));
252
- }
253
- :host([variant='filled'][disabled]) .label,
254
- :host([variant='outlined'][disabled]) .label {
255
- color: rgba(var(--mdui-color-on-surface), 38%);
256
- }
257
- .input {
258
- display: flex;
259
- flex-wrap: wrap;
260
- width: 100%;
261
- border: none;
262
- outline: none;
263
- background: none;
264
- -webkit-appearance: none;
265
- appearance: none;
266
- resize: none;
267
- cursor: inherit;
268
- font-family: inherit;
269
- padding: 1rem 0rem;
270
- font-size: var(--mdui-typescale-body-large-size);
271
- font-weight: var(--mdui-typescale-body-large-weight);
272
- letter-spacing: var(--mdui-typescale-body-large-tracking);
273
- line-height: var(--mdui-typescale-body-large-line-height);
274
- color: rgb(var(--mdui-color-on-surface));
275
- caret-color: rgb(var(--mdui-color-primary));
276
- }
277
- .input.hide-input {
278
- opacity: 0;
279
- height: 0;
280
- padding: 0 !important;
281
- overflow: hidden;
282
- }
283
- .input::placeholder {
284
- color: rgb(var(--mdui-color-on-surface-variant));
285
- }
286
- .invalid .input,
287
- .invalid-style .input {
288
- caret-color: rgb(var(--mdui-color-error));
289
- }
290
- :host([disabled]) .input {
291
- color: rgba(var(--mdui-color-on-surface), 38%);
292
- }
293
- :host([end-aligned]) .input {
294
- text-align: right;
295
- }
296
- :host([variant='filled']) .label + .input {
297
- padding: 1.5rem 0rem 0.5rem 0rem;
298
- }
299
- .supporting {
300
- display: flex;
301
- justify-content: space-between;
302
- padding: 0.25rem 1rem;
303
- color: rgb(var(--mdui-color-on-surface-variant));
304
- }
305
- .supporting.invalid,
306
- .supporting.invalid-style {
307
- color: rgb(var(--mdui-color-error));
308
- }
309
- .helper {
310
- display: block;
311
- opacity: 1;
312
- transition: opacity var(--mdui-motion-duration-short4)
313
- var(--mdui-motion-easing-linear);
314
- font-size: var(--mdui-typescale-body-small-size);
315
- font-weight: var(--mdui-typescale-body-small-weight);
316
- letter-spacing: var(--mdui-typescale-body-small-tracking);
317
- line-height: var(--mdui-typescale-body-small-line-height);
318
- }
319
- :host([disabled]) .helper {
320
- color: rgba(var(--mdui-color-on-surface), 38%);
321
- }
322
- :host([helper-on-focus]) .helper {
323
- opacity: 0;
324
- }
325
- :host([helper-on-focus][focused]) .helper,
326
- :host([helper-on-focus][focused-style]) .helper {
327
- opacity: 1;
328
- }
329
- .error {
330
- font-size: var(--mdui-typescale-body-small-size);
331
- font-weight: var(--mdui-typescale-body-small-weight);
332
- letter-spacing: var(--mdui-typescale-body-small-tracking);
333
- line-height: var(--mdui-typescale-body-small-line-height);
334
- }
335
- .counter {
336
- flex-wrap: nowrap;
337
- padding-left: 1rem;
338
- font-size: var(--mdui-typescale-body-small-size);
339
- font-weight: var(--mdui-typescale-body-small-weight);
340
- letter-spacing: var(--mdui-typescale-body-small-tracking);
341
- line-height: var(--mdui-typescale-body-small-line-height);
342
- }
343
- ::-ms-reveal {
344
- display: none;
345
- }
346
- .is-firefox .input[type='date'],
347
- .is-firefox .input[type='datetime-local'],
348
- .is-firefox .input[type='time'] {
349
- -webkit-clip-path: inset(0 2em 0 0);
350
- clip-path: inset(0 2em 0 0);
351
- }
352
- .input[type='number']::-webkit-outer-spin-button,
353
- .input[type='number']::-webkit-inner-spin-button {
354
- -webkit-appearance: none;
355
- display: none;
356
- }
357
- .input[type='number'] {
358
- -moz-appearance: textfield;
359
- }
360
- .input[type='search']::-webkit-search-cancel-button {
361
- -webkit-appearance: none;
362
- }
363
- `;
2
+ export const style = css `:host{display:inline-block;width:100%}:host([disabled]){pointer-events:none}:host([type=hidden]){display:none}.container{position:relative;display:flex;align-items:center;transition:box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard);padding:0 1rem}.container.has-icon{padding-left:.75rem}.container.has-end-icon,.container.has-error-icon{padding-right:.75rem}:host([variant=filled]) .container{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-on-surface-variant));background-color:rgb(var(--mdui-color-surface-container-highest));border-radius:var(--mdui-shape-corner-extra-small) var(--mdui-shape-corner-extra-small) 0 0}:host([variant=filled]) .container.invalid,:host([variant=filled]) .container.invalid-style{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-error))}:host([variant=filled]:hover) .container{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-on-surface))}:host([variant=filled]:hover) .container.invalid,:host([variant=filled]:hover) .container.invalid-style{box-shadow:inset 0 -.0625rem 0 0 rgb(var(--mdui-color-on-error-container))}:host([variant=filled][focused-style]) .container,:host([variant=filled][focused]) .container{box-shadow:inset 0 -.125rem 0 0 rgb(var(--mdui-color-primary))}:host([variant=filled][focused-style]) .container.invalid,:host([variant=filled][focused-style]) .container.invalid-style,:host([variant=filled][focused]) .container.invalid,:host([variant=filled][focused]) .container.invalid-style{box-shadow:inset 0 -.125rem 0 0 rgb(var(--mdui-color-error))}:host([variant=filled][disabled]) .container{box-shadow:inset 0 -.0625rem 0 0 rgba(var(--mdui-color-on-surface),38%);background-color:rgba(var(--mdui-color-on-surface),4%)}:host([variant=outlined]) .container{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-outline));border-radius:var(--mdui-shape-corner-extra-small)}:host([variant=outlined]) .container.invalid,:host([variant=outlined]) .container.invalid-style{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-error))}:host([variant=outlined]:hover) .container{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-on-surface))}:host([variant=outlined]:hover) .container.invalid,:host([variant=outlined]:hover) .container.invalid-style{box-shadow:inset 0 0 0 .0625rem rgb(var(--mdui-color-on-error-container))}:host([variant=outlined][focused-style]) .container,:host([variant=outlined][focused]) .container{box-shadow:inset 0 0 0 .125rem rgb(var(--mdui-color-primary))}:host([variant=outlined][focused-style]) .container.invalid,:host([variant=outlined][focused-style]) .container.invalid-style,:host([variant=outlined][focused]) .container.invalid,:host([variant=outlined][focused]) .container.invalid-style{box-shadow:inset 0 0 0 .125rem rgb(var(--mdui-color-error))}:host([variant=outlined][disabled]) .container{box-shadow:inset 0 0 0 .125rem rgba(var(--mdui-color-on-surface),12%)}.icon,.prefix,.right-icon,.suffix{display:flex;-webkit-user-select:none;user-select:none;color:rgb(var(--mdui-color-on-surface-variant))}:host([disabled]) .icon,:host([disabled]) .prefix,:host([disabled]) .right-icon,:host([disabled]) .suffix{color:rgba(var(--mdui-color-on-surface),38%)}.invalid .right-icon,.invalid .suffix,.invalid-style .right-icon,.invalid-style .suffix{color:rgb(var(--mdui-color-error))}:host(:hover) .invalid .right-icon,:host(:hover) .invalid .suffix,:host(:hover) .invalid-style .right-icon,:host(:hover) .invalid-style .suffix{color:rgb(var(--mdui-color-on-error-container))}:host([focused-style]) .invalid .right-icon,:host([focused-style]) .invalid .suffix,:host([focused-style]) .invalid-style .right-icon,:host([focused-style]) .invalid-style .suffix,:host([focused]) .invalid .right-icon,:host([focused]) .invalid .suffix,:host([focused]) .invalid-style .right-icon,:host([focused]) .invalid-style .suffix{color:rgb(var(--mdui-color-error))}.icon,.right-icon{font-size:1.5rem}.icon mdui-button-icon,.right-icon mdui-button-icon,::slotted(mdui-button-icon[slot]){margin-left:-.5rem;margin-right:-.5rem}.icon .i,.right-icon .i,::slotted([slot$=icon]){font-size:inherit}.has-icon .icon{margin-right:1rem}.has-end-icon .end-icon,.right-icon:not(.end-icon){margin-left:1rem}.prefix,.suffix{display:none;font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height)}:host([variant=filled][label]) .prefix,:host([variant=filled][label]) .suffix{padding-top:1rem}.has-value .prefix,.has-value .suffix,:host([focused-style]) .prefix,:host([focused-style]) .suffix,:host([focused]) .prefix,:host([focused]) .suffix{display:flex}.prefix{padding-right:.125rem}.suffix{padding-left:.125rem}.input-container{width:100%}.label{position:absolute;pointer-events:none;max-width:calc(100% - 1rem);display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1;top:1rem;color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height)}.invalid .label,.invalid-style .label{color:rgb(var(--mdui-color-error))}:host([variant=outlined]) .label{padding:0 .25rem;margin:0 -.25rem}:host([variant=outlined]:hover) .label{color:rgb(var(--mdui-color-on-surface))}:host([variant=filled]:hover) .invalid .label,:host([variant=filled]:hover) .invalid-style .label,:host([variant=outlined]:hover) .invalid .label,:host([variant=outlined]:hover) .invalid-style .label{color:rgb(var(--mdui-color-on-error-container))}:host([variant=filled][focused-style]) .label,:host([variant=filled][focused]) .label,:host([variant=outlined][focused-style]) .label,:host([variant=outlined][focused]) .label{color:rgb(var(--mdui-color-primary))}:host([variant=filled]) .has-value .label,:host([variant=filled][focused-style]) .label,:host([variant=filled][focused]) .label,:host([variant=filled][type=date]) .label,:host([variant=filled][type=datetime-local]) .label,:host([variant=filled][type=month]) .label,:host([variant=filled][type=time]) .label,:host([variant=filled][type=week]) .label{font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height);top:.25rem}:host([variant=outlined]) .has-value .label,:host([variant=outlined][focused-style]) .label,:host([variant=outlined][focused]) .label,:host([variant=outlined][type=date]) .label,:host([variant=outlined][type=datetime-local]) .label,:host([variant=outlined][type=month]) .label,:host([variant=outlined][type=time]) .label,:host([variant=outlined][type=week]) .label{font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height);top:-.5rem;left:.75rem;background-color:rgb(var(--mdui-color-background))}:host([variant=filled][focused-style]) .invalid .label,:host([variant=filled][focused-style]) .invalid-style .label,:host([variant=filled][focused]) .invalid .label,:host([variant=filled][focused]) .invalid-style .label,:host([variant=outlined][focused-style]) .invalid .label,:host([variant=outlined][focused-style]) .invalid-style .label,:host([variant=outlined][focused]) .invalid .label,:host([variant=outlined][focused]) .invalid-style .label{color:rgb(var(--mdui-color-error))}:host([variant=filled][disabled]) .label,:host([variant=outlined][disabled]) .label{color:rgba(var(--mdui-color-on-surface),38%)}.input{display:flex;flex-wrap:wrap;width:100%;border:none;outline:0;background:0 0;-webkit-appearance:none;appearance:none;resize:none;cursor:inherit;font-family:inherit;padding:1rem 0;font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height);color:rgb(var(--mdui-color-on-surface));caret-color:rgb(var(--mdui-color-primary))}.input.hide-input{opacity:0;height:0;padding:0!important;overflow:hidden}.input::placeholder{color:rgb(var(--mdui-color-on-surface-variant))}.invalid .input,.invalid-style .input{caret-color:rgb(var(--mdui-color-error))}:host([disabled]) .input{color:rgba(var(--mdui-color-on-surface),38%)}:host([end-aligned]) .input{text-align:right}:host([variant=filled]) .label+.input{padding:1.5rem 0 .5rem 0}.supporting{display:flex;justify-content:space-between;padding:.25rem 1rem;color:rgb(var(--mdui-color-on-surface-variant))}.supporting.invalid,.supporting.invalid-style{color:rgb(var(--mdui-color-error))}.helper{display:block;opacity:1;transition:opacity var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}:host([disabled]) .helper{color:rgba(var(--mdui-color-on-surface),38%)}:host([helper-on-focus]) .helper{opacity:0}:host([helper-on-focus][focused-style]) .helper,:host([helper-on-focus][focused]) .helper{opacity:1}.error{font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}.counter{flex-wrap:nowrap;padding-left:1rem;font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}::-ms-reveal{display:none}.is-firefox .input[type=date],.is-firefox .input[type=datetime-local],.is-firefox .input[type=time]{-webkit-clip-path:inset(0 2em 0 0);clip-path:inset(0 2em 0 0)}.input[type=number]::-webkit-inner-spin-button,.input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;display:none}.input[type=number]{-moz-appearance:textfield}.input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none}`;
@@ -215,16 +215,7 @@ let Tooltip = class Tooltip extends MduiElement {
215
215
  const hasHeadline = this.isRich() &&
216
216
  (this.headline || this.hasSlotController.test('headline'));
217
217
  const hasAction = this.isRich() && this.hasSlotController.test('action');
218
- return html `<slot></slot>
219
- <div ${ref(this.popupRef)} part="popup" class="popup" hidden>
220
- ${when(hasHeadline, () => html `<slot name="headline" part="headline" class="headline">
221
- ${this.headline}
222
- </slot>`)}
223
- <slot name="content" part="content" class="content">
224
- ${this.content}
225
- </slot>
226
- ${when(hasAction, () => html `<slot name="action" part="action" class="action"></slot>`)}
227
- </div>`;
218
+ return html `<slot></slot><div ${ref(this.popupRef)} part="popup" class="popup" hidden>${when(hasHeadline, () => html `<slot name="headline" part="headline" class="headline">${this.headline}</slot>`)}<slot name="content" part="content" class="content">${this.content}</slot>${when(hasAction, () => html `<slot name="action" part="action" class="action"></slot>`)}</div>`;
228
219
  }
229
220
  isRich() {
230
221
  return this.variant === 'rich';