@universal-material/web 3.7.2 → 3.8.0

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 (181) hide show
  1. package/app-bar/top-app-bar.d.ts +15 -0
  2. package/app-bar/top-app-bar.d.ts.map +1 -1
  3. package/app-bar/top-app-bar.js +15 -0
  4. package/app-bar/top-app-bar.js.map +1 -1
  5. package/badge/badge.d.ts +3 -0
  6. package/badge/badge.d.ts.map +1 -1
  7. package/badge/badge.js +3 -0
  8. package/badge/badge.js.map +1 -1
  9. package/bundle.min.js +600 -482
  10. package/button/button-base.d.ts +7 -0
  11. package/button/button-base.d.ts.map +1 -1
  12. package/button/button-base.js +7 -0
  13. package/button/button-base.js.map +1 -1
  14. package/button/button.d.ts +3 -0
  15. package/button/button.d.ts.map +1 -1
  16. package/button/button.js +3 -0
  17. package/button/button.js.map +1 -1
  18. package/button/icon-button.d.ts +6 -0
  19. package/button/icon-button.d.ts.map +1 -1
  20. package/button/icon-button.js +6 -0
  21. package/button/icon-button.js.map +1 -1
  22. package/button-field/button-field.d.ts +3 -0
  23. package/button-field/button-field.d.ts.map +1 -1
  24. package/button-field/button-field.js +3 -0
  25. package/button-field/button-field.js.map +1 -1
  26. package/calendar/calendar-adapter.d.ts +3 -0
  27. package/calendar/calendar-adapter.d.ts.map +1 -1
  28. package/calendar/calendar-adapter.js.map +1 -1
  29. package/calendar/calendar-base.d.ts +17 -0
  30. package/calendar/calendar-base.d.ts.map +1 -1
  31. package/calendar/calendar-base.js +182 -19
  32. package/calendar/calendar-base.js.map +1 -1
  33. package/calendar/calendar.d.ts +4 -0
  34. package/calendar/calendar.d.ts.map +1 -1
  35. package/calendar/calendar.js +4 -0
  36. package/calendar/calendar.js.map +1 -1
  37. package/calendar/default-calendar-adapter.d.ts +3 -0
  38. package/calendar/default-calendar-adapter.d.ts.map +1 -1
  39. package/calendar/default-calendar-adapter.js +17 -5
  40. package/calendar/default-calendar-adapter.js.map +1 -1
  41. package/card/card-content.d.ts +5 -0
  42. package/card/card-content.d.ts.map +1 -1
  43. package/card/card-content.js +5 -0
  44. package/card/card-content.js.map +1 -1
  45. package/card/card-media.d.ts +3 -0
  46. package/card/card-media.d.ts.map +1 -1
  47. package/card/card-media.js +3 -0
  48. package/card/card-media.js.map +1 -1
  49. package/checkbox/checkbox.d.ts +7 -0
  50. package/checkbox/checkbox.d.ts.map +1 -1
  51. package/checkbox/checkbox.js +7 -0
  52. package/checkbox/checkbox.js.map +1 -1
  53. package/chip/chip.d.ts +3 -0
  54. package/chip/chip.d.ts.map +1 -1
  55. package/chip/chip.js +3 -0
  56. package/chip/chip.js.map +1 -1
  57. package/chip-field/chip-field.d.ts +3 -0
  58. package/chip-field/chip-field.d.ts.map +1 -1
  59. package/chip-field/chip-field.js.map +1 -1
  60. package/custom-elements.json +12881 -9853
  61. package/datepicker/datepicker.d.ts +51 -2
  62. package/datepicker/datepicker.d.ts.map +1 -1
  63. package/datepicker/datepicker.js +185 -3
  64. package/datepicker/datepicker.js.map +1 -1
  65. package/datepicker/format.d.ts +19 -0
  66. package/datepicker/format.d.ts.map +1 -0
  67. package/datepicker/format.js +47 -0
  68. package/datepicker/format.js.map +1 -0
  69. package/datepicker/range-datepicker.d.ts +56 -0
  70. package/datepicker/range-datepicker.d.ts.map +1 -0
  71. package/datepicker/range-datepicker.js +198 -0
  72. package/datepicker/range-datepicker.js.map +1 -0
  73. package/dialog/dialog.d.ts +8 -0
  74. package/dialog/dialog.d.ts.map +1 -1
  75. package/dialog/dialog.js +8 -0
  76. package/dialog/dialog.js.map +1 -1
  77. package/field/field-base.d.ts +14 -0
  78. package/field/field-base.d.ts.map +1 -1
  79. package/field/field-base.js +10 -0
  80. package/field/field-base.js.map +1 -1
  81. package/field/field.d.ts +4 -0
  82. package/field/field.d.ts.map +1 -1
  83. package/field/field.js +4 -0
  84. package/field/field.js.map +1 -1
  85. package/index.d.ts +5 -0
  86. package/index.d.ts.map +1 -1
  87. package/index.js +5 -0
  88. package/index.js.map +1 -1
  89. package/list/list-item.d.ts +3 -0
  90. package/list/list-item.d.ts.map +1 -1
  91. package/list/list-item.js +3 -0
  92. package/list/list-item.js.map +1 -1
  93. package/menu/menu-item.d.ts +6 -0
  94. package/menu/menu-item.d.ts.map +1 -1
  95. package/menu/menu-item.js +6 -0
  96. package/menu/menu-item.js.map +1 -1
  97. package/menu/menu.d.ts +16 -0
  98. package/menu/menu.d.ts.map +1 -1
  99. package/menu/menu.js +24 -5
  100. package/menu/menu.js.map +1 -1
  101. package/menu/menu.styles.d.ts.map +1 -1
  102. package/menu/menu.styles.js +5 -0
  103. package/menu/menu.styles.js.map +1 -1
  104. package/navigation/drawer-headline.styles.js +1 -1
  105. package/navigation/drawer-headline.styles.js.map +1 -1
  106. package/overflow-menu/overflow-menu-item.d.ts +8 -0
  107. package/overflow-menu/overflow-menu-item.d.ts.map +1 -1
  108. package/overflow-menu/overflow-menu-item.js +8 -0
  109. package/overflow-menu/overflow-menu-item.js.map +1 -1
  110. package/package.json +3 -3
  111. package/progress/circular-progress.d.ts +7 -0
  112. package/progress/circular-progress.d.ts.map +1 -1
  113. package/progress/circular-progress.js +3 -0
  114. package/progress/circular-progress.js.map +1 -1
  115. package/progress/progress-bar.d.ts +7 -0
  116. package/progress/progress-bar.d.ts.map +1 -1
  117. package/progress/progress-bar.js +3 -0
  118. package/progress/progress-bar.js.map +1 -1
  119. package/radio/radio.d.ts +3 -0
  120. package/radio/radio.d.ts.map +1 -1
  121. package/radio/radio.js +3 -0
  122. package/radio/radio.js.map +1 -1
  123. package/search/search.d.ts +3 -0
  124. package/search/search.d.ts.map +1 -1
  125. package/search/search.js +3 -0
  126. package/search/search.js.map +1 -1
  127. package/select/option.d.ts +6 -0
  128. package/select/option.d.ts.map +1 -1
  129. package/select/option.js +6 -0
  130. package/select/option.js.map +1 -1
  131. package/select/select.d.ts +4 -0
  132. package/select/select.d.ts.map +1 -1
  133. package/select/select.js +4 -0
  134. package/select/select.js.map +1 -1
  135. package/shared/button-wrapper.d.ts +3 -0
  136. package/shared/button-wrapper.d.ts.map +1 -1
  137. package/shared/button-wrapper.js.map +1 -1
  138. package/shared/char-count-text-field/native-text-field-wrapper.d.ts +13 -0
  139. package/shared/char-count-text-field/native-text-field-wrapper.d.ts.map +1 -1
  140. package/shared/char-count-text-field/native-text-field-wrapper.js +10 -0
  141. package/shared/char-count-text-field/native-text-field-wrapper.js.map +1 -1
  142. package/shared/selection-control/selection-control-list-item.d.ts.map +1 -1
  143. package/shared/selection-control/selection-control-list-item.js +4 -0
  144. package/shared/selection-control/selection-control-list-item.js.map +1 -1
  145. package/shared/selection-control/selection-control.d.ts +9 -0
  146. package/shared/selection-control/selection-control.d.ts.map +1 -1
  147. package/shared/selection-control/selection-control.js +9 -0
  148. package/shared/selection-control/selection-control.js.map +1 -1
  149. package/shared/text-field-base/text-field-base.d.ts +3 -0
  150. package/shared/text-field-base/text-field-base.d.ts.map +1 -1
  151. package/shared/text-field-base/text-field-base.js +3 -0
  152. package/shared/text-field-base/text-field-base.js.map +1 -1
  153. package/snackbar/snackbar.d.ts +9 -0
  154. package/snackbar/snackbar.d.ts.map +1 -1
  155. package/snackbar/snackbar.js +9 -0
  156. package/snackbar/snackbar.js.map +1 -1
  157. package/tab-bar/tab-bar.d.ts +3 -0
  158. package/tab-bar/tab-bar.d.ts.map +1 -1
  159. package/tab-bar/tab-bar.js +3 -0
  160. package/tab-bar/tab-bar.js.map +1 -1
  161. package/tab-bar/tab.d.ts +5 -0
  162. package/tab-bar/tab.d.ts.map +1 -1
  163. package/tab-bar/tab.js +5 -0
  164. package/tab-bar/tab.js.map +1 -1
  165. package/text-area/text-area.d.ts +3 -0
  166. package/text-area/text-area.d.ts.map +1 -1
  167. package/text-area/text-area.js +3 -0
  168. package/text-area/text-area.js.map +1 -1
  169. package/text-field/text-field.d.ts +16 -0
  170. package/text-field/text-field.d.ts.map +1 -1
  171. package/text-field/text-field.js +7 -0
  172. package/text-field/text-field.js.map +1 -1
  173. package/typeahead/typeahead-template-render.d.ts +4 -0
  174. package/typeahead/typeahead-template-render.d.ts.map +1 -1
  175. package/typeahead/typeahead-template-render.js +4 -0
  176. package/typeahead/typeahead-template-render.js.map +1 -1
  177. package/typeahead/typeahead.d.ts +7 -0
  178. package/typeahead/typeahead.d.ts.map +1 -1
  179. package/typeahead/typeahead.js +7 -0
  180. package/typeahead/typeahead.js.map +1 -1
  181. package/vscode.html-custom-data.json +661 -230
@@ -4,7 +4,14 @@ export declare abstract class UmButtonBase extends UmButtonWrapper {
4
4
  #private;
5
5
  static readonly formAssociated = true;
6
6
  static styles: CSSResultGroup;
7
+ /**
8
+ * The button behavior. Mirrors the native `type` attribute and accepts
9
+ * values like `submit`, `reset` or `button`.
10
+ */
7
11
  type: string;
12
+ /**
13
+ * The value submitted with the form when this button is the submitter
14
+ */
8
15
  value: string;
9
16
  get form(): HTMLFormElement | null;
10
17
  constructor();
@@ -1 +1 @@
1
- {"version":3,"file":"button-base.d.ts","sourceRoot":"","sources":["../../src/button/button-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAI/D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,8BAAsB,YAAa,SAAQ,eAAe;;IAExD,MAAM,CAAC,QAAQ,CAAC,cAAc,QAAQ;IAEtC,OAAgB,MAAM,EAAE,cAAc,CAAoC;IAE9D,IAAI,SAAY;IAEC,KAAK,SAAM;IAExC,IAAI,IAAI,IAAI,eAAe,GAAG,IAAI,CAEjC;;cASkB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI;CA8BlD"}
1
+ {"version":3,"file":"button-base.d.ts","sourceRoot":"","sources":["../../src/button/button-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAI/D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,8BAAsB,YAAa,SAAQ,eAAe;;IAExD,MAAM,CAAC,QAAQ,CAAC,cAAc,QAAQ;IAEtC,OAAgB,MAAM,EAAE,cAAc,CAAoC;IAE1E;;;OAGG;IACS,IAAI,SAAY;IAE5B;;OAEG;IAC0B,KAAK,SAAM;IAExC,IAAI,IAAI,IAAI,eAAe,GAAG,IAAI,CAEjC;;cASkB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI;CA8BlD"}
@@ -11,7 +11,14 @@ export class UmButtonBase extends UmButtonWrapper {
11
11
  #elementInternals;
12
12
  constructor() {
13
13
  super();
14
+ /**
15
+ * The button behavior. Mirrors the native `type` attribute and accepts
16
+ * values like `submit`, `reset` or `button`.
17
+ */
14
18
  this.type = 'submit';
19
+ /**
20
+ * The value submitted with the form when this button is the submitter
21
+ */
15
22
  this.value = '';
16
23
  this.#elementInternals = this.attachInternals();
17
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"button-base.js","sourceRoot":"","sources":["../../src/button/button-base.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,MAAM,OAAgB,YAAa,SAAQ,eAAe;aAExC,mBAAc,GAAG,IAAI,AAAP,CAAQ;aAEtB,WAAM,GAAmB,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,AAAnD,CAAoD;IAM1E,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;IACrC,CAAC;IAEQ,iBAAiB,CAAmB;IAE7C;QACE,KAAK,EAAE,CAAC;QAXE,SAAI,GAAG,QAAQ,CAAC;QAEC,UAAK,GAAG,EAAE,CAAC;QAUtC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;IAClD,CAAC;IAEkB,YAAY,CAAC,CAAU;QAExC,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAC1C,OAAO;QACT,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,OAAO;QACT,CAAC;QAED,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAEhD,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,gBAAgB,CACxB,QAAQ,EACR,WAAW,CAAC,EAAE;YACZ,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE;gBAC9C,YAAY,EAAE,IAAI;gBAClB,UAAU,EAAE,IAAI;gBAChB,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI;aAChB,CAAC,CAAC;QACL,CAAC,EACD,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAC9B,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;IAC5B,CAAC;;AA5CW;IAAX,QAAQ,EAAE;0CAAiB;AAEC;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAAY","sourcesContent":["import { CSSResultGroup } from '@lit/reactive-element/css-tag';\n\nimport { property } from 'lit/decorators.js';\n\nimport { UmButtonWrapper } from '../shared/button-wrapper.js';\nimport { styles } from './button-base.styles.js';\n\nexport abstract class UmButtonBase extends UmButtonWrapper {\n\n static readonly formAssociated = true;\n\n static override styles: CSSResultGroup = [UmButtonWrapper.styles, styles];\n\n @property() type = 'submit';\n\n @property({ reflect: true }) value = '';\n\n get form(): HTMLFormElement | null {\n return this.#elementInternals.form;\n }\n\n readonly #elementInternals: ElementInternals;\n\n constructor() {\n super();\n this.#elementInternals = this.attachInternals();\n }\n\n protected override _handleClick(_: UIEvent): void {\n\n if (this.type === 'button' || !!this.href) {\n return;\n }\n\n if (!this.form) {\n return;\n }\n\n this.#elementInternals.setFormValue(this.value);\n\n if (this.type === 'reset') {\n this.form.reset();\n return;\n }\n\n this.form.addEventListener(\n 'submit',\n submitEvent => {\n Object.defineProperty(submitEvent, 'submitter', {\n configurable: true,\n enumerable: true,\n get: () => this,\n });\n },\n { capture: true, once: true },\n );\n this.form.requestSubmit();\n }\n}\n"]}
1
+ {"version":3,"file":"button-base.js","sourceRoot":"","sources":["../../src/button/button-base.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,MAAM,OAAgB,YAAa,SAAQ,eAAe;aAExC,mBAAc,GAAG,IAAI,AAAP,CAAQ;aAEtB,WAAM,GAAmB,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,AAAnD,CAAoD;IAa1E,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;IACrC,CAAC;IAEQ,iBAAiB,CAAmB;IAE7C;QACE,KAAK,EAAE,CAAC;QAlBV;;;WAGG;QACS,SAAI,GAAG,QAAQ,CAAC;QAE5B;;WAEG;QAC0B,UAAK,GAAG,EAAE,CAAC;QAUtC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;IAClD,CAAC;IAEkB,YAAY,CAAC,CAAU;QAExC,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAC1C,OAAO;QACT,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,OAAO;QACT,CAAC;QAED,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAEhD,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,gBAAgB,CACxB,QAAQ,EACR,WAAW,CAAC,EAAE;YACZ,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE;gBAC9C,YAAY,EAAE,IAAI;gBAClB,UAAU,EAAE,IAAI;gBAChB,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI;aAChB,CAAC,CAAC;QACL,CAAC,EACD,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAC9B,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;IAC5B,CAAC;;AA/CW;IAAX,QAAQ,EAAE;0CAAiB;AAKC;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAAY","sourcesContent":["import { CSSResultGroup } from '@lit/reactive-element/css-tag';\n\nimport { property } from 'lit/decorators.js';\n\nimport { UmButtonWrapper } from '../shared/button-wrapper.js';\nimport { styles } from './button-base.styles.js';\n\nexport abstract class UmButtonBase extends UmButtonWrapper {\n\n static readonly formAssociated = true;\n\n static override styles: CSSResultGroup = [UmButtonWrapper.styles, styles];\n\n /**\n * The button behavior. Mirrors the native `type` attribute and accepts\n * values like `submit`, `reset` or `button`.\n */\n @property() type = 'submit';\n\n /**\n * The value submitted with the form when this button is the submitter\n */\n @property({ reflect: true }) value = '';\n\n get form(): HTMLFormElement | null {\n return this.#elementInternals.form;\n }\n\n readonly #elementInternals: ElementInternals;\n\n constructor() {\n super();\n this.#elementInternals = this.attachInternals();\n }\n\n protected override _handleClick(_: UIEvent): void {\n\n if (this.type === 'button' || !!this.href) {\n return;\n }\n\n if (!this.form) {\n return;\n }\n\n this.#elementInternals.setFormValue(this.value);\n\n if (this.type === 'reset') {\n this.form.reset();\n return;\n }\n\n this.form.addEventListener(\n 'submit',\n submitEvent => {\n Object.defineProperty(submitEvent, 'submitter', {\n configurable: true,\n enumerable: true,\n get: () => this,\n });\n },\n { capture: true, once: true },\n );\n this.form.requestSubmit();\n }\n}\n"]}
@@ -16,6 +16,9 @@ export declare class UmButton extends UmToggleButton {
16
16
  * The Button color
17
17
  */
18
18
  color: UmButtonColor;
19
+ /**
20
+ * Whether the slotted icon is rendered after the label instead of before
21
+ */
19
22
  trailingIcon: boolean;
20
23
  private _hasIcon;
21
24
  private _hasSelectionLabel;
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAQ,kBAAkB,EAAE,MAAM,KAAK,CAAC;AAK/C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,qBAAqB,CAAC;AAE7B,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;AACpF,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;AAE3E,qBACa,QAAS,SAAQ,cAAc;;IAC1C,OAAgB,MAAM,EAAE,cAAc,CAAmC;IAEzE;;OAEG;IACS,OAAO,EAAE,eAAe,CAAY;IAEhD;;OAEG;IACS,KAAK,EAAE,aAAa,CAAa;IAE2B,YAAY,UAAS;IAEpF,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,kBAAkB,CAAS;IACnC,iBAAiB,UAAS;IAEF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IACtD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;IA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AU,qBAAqB;QAC7B,UAAU,EAAE,QAAQ,CAAC;KACtB;CACF"}
package/button/button.js CHANGED
@@ -16,6 +16,9 @@ let UmButton = class UmButton extends UmToggleButton {
16
16
  * The Button color
17
17
  */
18
18
  this.color = 'primary';
19
+ /**
20
+ * Whether the slotted icon is rendered after the label instead of before
21
+ */
19
22
  this.trailingIcon = false;
20
23
  this._hasIcon = false;
21
24
  this._hasSelectionLabel = false;
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,IAAI,EAAsB,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,qBAAqB,CAAC;AAMtB,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,cAAc;IAArC;;QAGL;;WAEG;QACS,YAAO,GAAoB,QAAQ,CAAC;QAEhD;;WAEG;QACS,UAAK,GAAkB,SAAS,CAAC;QAE2B,iBAAY,GAAG,KAAK,CAAC;QAE5E,aAAQ,GAAG,KAAK,CAAC;QACjB,uBAAkB,GAAG,KAAK,CAAC;QACnC,sBAAiB,GAAG,KAAK,CAAC;IA0ErC,CAAC;aA1FiB,WAAM,GAAmB,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,AAAlD,CAAmD;IAqBzE,iBAAiB,CAAyB;IAEjC,YAAY,CAAC,iBAAiC;QACrD,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;QAEtC,IAAI,CAAC,iBAAiB,GAAG,IAAI,cAAc,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB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B,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAC/F,CAAC;IAED,8BAA8B,CAAC,CAAQ;QACrC,IAAI,CAAC,kBAAkB,GAAI,CAAC,CAAC,MAA0B,CAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACzG,CAAC;;AApFW;IAAX,QAAQ,EAAE;yCAAqC;AAKpC;IAAX,QAAQ,EAAE;uCAAkC;AAE2B;IAAvE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAsB;AAE5E;IAAhB,KAAK,EAAE;0CAA0B;AACjB;IAAhB,KAAK,EAAE;oDAAoC;AACnC;IAAR,KAAK,EAAE;mDAA2B;AAEe;IAAjD,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC;8CAA6C;AACrC;IAAvC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC;uCAAsC;AApBjD,QAAQ;IADpB,aAAa,CAAC,UAAU,CAAC;GACb,QAAQ,CA2FpB","sourcesContent":["import { PropertyValues } from '@lit/reactive-element';\nimport { CSSResultGroup } from '@lit/reactive-element/css-tag';\n\nimport { html, HTMLTemplateResult } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport { styles } from './button.styles.js';\nimport { UmToggleButton } from './toggle-button.js';\n\nimport '../ripple/ripple.js';\n\nexport type UmButtonVariant = 'filled' | 'tonal' | 'elevated' | 'outlined' | 'text';\nexport type UmButtonColor = 'primary' | 'secondary' | 'tertiary' | 'error';\n\n@customElement('u-button')\nexport class UmButton extends UmToggleButton {\n static override styles: CSSResultGroup = [UmToggleButton.styles, styles];\n\n /**\n * The Button variant to render\n */\n @property() variant: UmButtonVariant = 'filled';\n\n /**\n * The Button color\n */\n @property() color: UmButtonColor = 'primary';\n\n @property({ type: Boolean, attribute: 'trailing-icon', reflect: true }) trailingIcon = false;\n\n @state() private _hasIcon = false;\n @state() private _hasSelectionLabel = false;\n @state() animateTextChange = false;\n\n @query('.label-container', true) private readonly _textWrapper!: HTMLElement;\n @query('#label', true) private readonly _text!: HTMLElement;\n\n #textSizeObserver!: ResizeObserver | null;\n\n override firstUpdated(changedProperties: PropertyValues) {\n super.firstUpdated(changedProperties);\n\n this.#textSizeObserver = new ResizeObserver(() => this.#setTextWrapperWidth());\n this.#textSizeObserver.observe(this._text);\n this.#setTextWrapperWidth();\n }\n\n #setTextWrapperWidth(): void {\n\n const width = `${this._text.offsetWidth}px`;\n this._textWrapper.style.width = width;\n\n const animateTextChange = !!parseInt(width, 10);\n\n if (this.animateTextChange === animateTextChange) {\n return;\n }\n\n setTimeout(() =>\n this.animateTextChange = animateTextChange);\n }\n\n protected override _getContainerClasses(): Record<string, boolean> {\n return {\n ...super._getContainerClasses(),\n [this.color]: true,\n [this.variant]: true,\n 'trailing-icon': this.trailingIcon,\n 'has-icon': this._hasIcon,\n 'has-selection-label': this._hasSelectionLabel,\n };\n }\n\n protected override _renderContent(): HTMLTemplateResult {\n const labelContainerClasses = { animate: this.animateTextChange };\n\n return html`\n <span class=\"icon-container\" aria-hidden=\"true\">\n <span class=\"icon icon-default\">\n <slot name=\"icon\" @slotchange=\"${this.#handleIconSlotChange}\"></slot>\n </span>\n <span class=\"icon icon-selected\">\n <slot name=\"icon-selected\" @slotchange=\"${this._handleSelectedIconSlotChange}\"></slot>\n </span>\n </span>\n\n <span class=\"label-container ${classMap(labelContainerClasses)}\">\n <span id=\"label\">\n <span class=\"label label-default\">\n <slot></slot>\n </span>\n <span class=\"label label-selected\">\n <slot name=\"label-selected\" @slotchange=\"${this.#handleSelectedLabelSlotChange}\"></slot>\n </span>\n </span>\n </span>\n `;\n }\n\n #handleIconSlotChange(e: Event) {\n this._hasIcon = (e.target as HTMLSlotElement).assignedElements({ flatten: true }).length > 0;\n }\n\n #handleSelectedLabelSlotChange(e: Event): void {\n this._hasSelectionLabel = (e.target as HTMLSlotElement).assignedElements({ flatten: true }).length > 0;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'u-button': UmButton;\n }\n}\n"]}
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,IAAI,EAAsB,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,qBAAqB,CAAC;AAMtB,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,cAAc;IAArC;;QAGL;;WAEG;QACS,YAAO,GAAoB,QAAQ,CAAC;QAEhD;;WAEG;QACS,UAAK,GAAkB,SAAS,CAAC;QAE7C;;WAEG;QACqE,iBAAY,GAAG,KAAK,CAAC;QAE5E,aAAQ,GAAG,KAAK,CAAC;QACjB,uBAAkB,GAAG,KAAK,CAAC;QACnC,sBAAiB,GAAG,KAAK,CAAC;IA0ErC,CAAC;aA7FiB,WAAM,GAAmB,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,AAAlD,CAAmD;IAwBzE,iBAAiB,CAAyB;IAEjC,YAAY,CAAC,iBAAiC;QACrD,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;QAEtC,IAAI,CAAC,iBAAiB,GAAG,IAAI,cAAc,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;QAC/E,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3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,CAAC,CAAQ;QACrC,IAAI,CAAC,kBAAkB,GAAI,CAAC,CAAC,MAA0B,CAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACzG,CAAC;;AAvFW;IAAX,QAAQ,EAAE;yCAAqC;AAKpC;IAAX,QAAQ,EAAE;uCAAkC;AAK2B;IAAvE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAsB;AAE5E;IAAhB,KAAK,EAAE;0CAA0B;AACjB;IAAhB,KAAK,EAAE;oDAAoC;AACnC;IAAR,KAAK,EAAE;mDAA2B;AAEe;IAAjD,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC;8CAA6C;AACrC;IAAvC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC;uCAAsC;AAvBjD,QAAQ;IADpB,aAAa,CAAC,UAAU,CAAC;GACb,QAAQ,CA8FpB","sourcesContent":["import { PropertyValues } from '@lit/reactive-element';\nimport { CSSResultGroup } from '@lit/reactive-element/css-tag';\n\nimport { html, HTMLTemplateResult } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport { styles } from './button.styles.js';\nimport { UmToggleButton } from './toggle-button.js';\n\nimport '../ripple/ripple.js';\n\nexport type UmButtonVariant = 'filled' | 'tonal' | 'elevated' | 'outlined' | 'text';\nexport type UmButtonColor = 'primary' | 'secondary' | 'tertiary' | 'error';\n\n@customElement('u-button')\nexport class UmButton extends UmToggleButton {\n static override styles: CSSResultGroup = [UmToggleButton.styles, styles];\n\n /**\n * The Button variant to render\n */\n @property() variant: UmButtonVariant = 'filled';\n\n /**\n * The Button color\n */\n @property() color: UmButtonColor = 'primary';\n\n /**\n * Whether the slotted icon is rendered after the label instead of before\n */\n @property({ type: Boolean, attribute: 'trailing-icon', reflect: true }) trailingIcon = false;\n\n @state() private _hasIcon = false;\n @state() private _hasSelectionLabel = false;\n @state() animateTextChange = false;\n\n @query('.label-container', true) private readonly _textWrapper!: HTMLElement;\n @query('#label', true) private readonly _text!: HTMLElement;\n\n #textSizeObserver!: ResizeObserver | null;\n\n override firstUpdated(changedProperties: PropertyValues) {\n super.firstUpdated(changedProperties);\n\n this.#textSizeObserver = new ResizeObserver(() => this.#setTextWrapperWidth());\n this.#textSizeObserver.observe(this._text);\n this.#setTextWrapperWidth();\n }\n\n #setTextWrapperWidth(): void {\n\n const width = `${this._text.offsetWidth}px`;\n this._textWrapper.style.width = width;\n\n const animateTextChange = !!parseInt(width, 10);\n\n if (this.animateTextChange === animateTextChange) {\n return;\n }\n\n setTimeout(() =>\n this.animateTextChange = animateTextChange);\n }\n\n protected override _getContainerClasses(): Record<string, boolean> {\n return {\n ...super._getContainerClasses(),\n [this.color]: true,\n [this.variant]: true,\n 'trailing-icon': this.trailingIcon,\n 'has-icon': this._hasIcon,\n 'has-selection-label': this._hasSelectionLabel,\n };\n }\n\n protected override _renderContent(): HTMLTemplateResult {\n const labelContainerClasses = { animate: this.animateTextChange };\n\n return html`\n <span class=\"icon-container\" aria-hidden=\"true\">\n <span class=\"icon icon-default\">\n <slot name=\"icon\" @slotchange=\"${this.#handleIconSlotChange}\"></slot>\n </span>\n <span class=\"icon icon-selected\">\n <slot name=\"icon-selected\" @slotchange=\"${this._handleSelectedIconSlotChange}\"></slot>\n </span>\n </span>\n\n <span class=\"label-container ${classMap(labelContainerClasses)}\">\n <span id=\"label\">\n <span class=\"label label-default\">\n <slot></slot>\n </span>\n <span class=\"label label-selected\">\n <slot name=\"label-selected\" @slotchange=\"${this.#handleSelectedLabelSlotChange}\"></slot>\n </span>\n </span>\n </span>\n `;\n }\n\n #handleIconSlotChange(e: Event) {\n this._hasIcon = (e.target as HTMLSlotElement).assignedElements({ flatten: true }).length > 0;\n }\n\n #handleSelectedLabelSlotChange(e: Event): void {\n this._hasSelectionLabel = (e.target as HTMLSlotElement).assignedElements({ flatten: true }).length > 0;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'u-button': UmButton;\n }\n}\n"]}
@@ -4,7 +4,13 @@ export type UmIconButtonVariant = 'standard' | 'filled' | 'tonal' | 'outlined';
4
4
  export type UmIconButtonWidth = 'default' | 'narrow' | 'wide';
5
5
  export declare class UmIconButton extends UmToggleButton {
6
6
  static styles: import("lit").CSSResultGroup[];
7
+ /**
8
+ * The Icon Button variant to render
9
+ */
7
10
  variant: UmIconButtonVariant;
11
+ /**
12
+ * The width of the Icon Button
13
+ */
8
14
  width: UmIconButtonWidth;
9
15
  protected _getContainerClasses(): Record<string, boolean>;
10
16
  protected _renderContent(): HTMLTemplateResult;
@@ -1 +1 @@
1
- {"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../src/button/icon-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,kBAAkB,EAAE,MAAM,KAAK,CAAC;AAI/C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;AAC/E,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE9D,qBACa,YAAa,SAAQ,cAAc;IAE9C,OAAgB,MAAM,iCAAmC;IAE7C,OAAO,EAAE,mBAAmB,CAAc;IAC1C,KAAK,EAAE,iBAAiB,CAAa;cAE9B,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;cAQ/C,cAAc,IAAI,kBAAkB;CAaxD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,YAAY,CAAC;KAC/B;CACF"}
1
+ {"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../src/button/icon-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,kBAAkB,EAAE,MAAM,KAAK,CAAC;AAI/C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;AAC/E,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE9D,qBACa,YAAa,SAAQ,cAAc;IAE9C,OAAgB,MAAM,iCAAmC;IAEzD;;OAEG;IACS,OAAO,EAAE,mBAAmB,CAAc;IAEtD;;OAEG;IACS,KAAK,EAAE,iBAAiB,CAAa;cAE9B,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;cAQ/C,cAAc,IAAI,kBAAkB;CAaxD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,YAAY,CAAC;KAC/B;CACF"}
@@ -6,7 +6,13 @@ import { UmToggleButton } from './toggle-button.js';
6
6
  let UmIconButton = class UmIconButton extends UmToggleButton {
7
7
  constructor() {
8
8
  super(...arguments);
9
+ /**
10
+ * The Icon Button variant to render
11
+ */
9
12
  this.variant = 'standard';
13
+ /**
14
+ * The width of the Icon Button
15
+ */
10
16
  this.width = 'default';
11
17
  }
12
18
  static { this.styles = [UmToggleButton.styles, styles]; }
@@ -1 +1 @@
1
- {"version":3,"file":"icon-button.js","sourceRoot":"","sources":["../../src/button/icon-button.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAsB,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAM7C,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,cAAc;IAAzC;;QAIO,YAAO,GAAwB,UAAU,CAAC;QAC1C,UAAK,GAAsB,SAAS,CAAC;IAuBnD,CAAC;aA1BiB,WAAM,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,AAAlC,CAAmC;IAKtC,oBAAoB;QACrC,OAAO;YACL,GAAG,KAAK,CAAC,oBAAoB,EAAE;YAC/B,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI;YACpB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI;SACnB,CAAC;IACJ,CAAC;IAEkB,cAAc;QAE/B,OAAO,IAAI,CAAA;;;;;;+CAMgC,IAAI,CAAC,6BAA6B;;;KAG5E,CAAC;IACJ,CAAC;;AAvBW;IAAX,QAAQ,EAAE;6CAA2C;AAC1C;IAAX,QAAQ,EAAE;2CAAsC;AALtC,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA4BxB","sourcesContent":["import { html, HTMLTemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport { styles } from './icon-button.styles.js';\nimport { UmToggleButton } from './toggle-button.js';\n\nexport type UmIconButtonVariant = 'standard' | 'filled' | 'tonal' | 'outlined';\nexport type UmIconButtonWidth = 'default' | 'narrow' | 'wide';\n\n@customElement('u-icon-button')\nexport class UmIconButton extends UmToggleButton {\n\n static override styles = [UmToggleButton.styles, styles];\n\n @property() variant: UmIconButtonVariant = 'standard';\n @property() width: UmIconButtonWidth = 'default';\n\n protected override _getContainerClasses(): Record<string, boolean> {\n return {\n ...super._getContainerClasses(),\n [this.variant]: true,\n [this.width]: true,\n };\n }\n\n protected override _renderContent(): HTMLTemplateResult {\n\n return html`\n <span class=\"icon-container\" aria-hidden=\"true\">\n <span class=\"icon icon-default\">\n <slot></slot>\n </span>\n <span class=\"icon icon-selected\">\n <slot name=\"selected\" @slotchange=\"${this._handleSelectedIconSlotChange}\"></slot>\n </span>\n </span>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'u-icon-button': UmIconButton;\n }\n}\n"]}
1
+ {"version":3,"file":"icon-button.js","sourceRoot":"","sources":["../../src/button/icon-button.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAsB,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAM7C,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,cAAc;IAAzC;;QAIL;;WAEG;QACS,YAAO,GAAwB,UAAU,CAAC;QAEtD;;WAEG;QACS,UAAK,GAAsB,SAAS,CAAC;IAuBnD,CAAC;aAjCiB,WAAM,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,AAAlC,CAAmC;IAYtC,oBAAoB;QACrC,OAAO;YACL,GAAG,KAAK,CAAC,oBAAoB,EAAE;YAC/B,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI;YACpB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI;SACnB,CAAC;IACJ,CAAC;IAEkB,cAAc;QAE/B,OAAO,IAAI,CAAA;;;;;;+CAMgC,IAAI,CAAC,6BAA6B;;;KAG5E,CAAC;IACJ,CAAC;;AA3BW;IAAX,QAAQ,EAAE;6CAA2C;AAK1C;IAAX,QAAQ,EAAE;2CAAsC;AAZtC,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAmCxB","sourcesContent":["import { html, HTMLTemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport { styles } from './icon-button.styles.js';\nimport { UmToggleButton } from './toggle-button.js';\n\nexport type UmIconButtonVariant = 'standard' | 'filled' | 'tonal' | 'outlined';\nexport type UmIconButtonWidth = 'default' | 'narrow' | 'wide';\n\n@customElement('u-icon-button')\nexport class UmIconButton extends UmToggleButton {\n\n static override styles = [UmToggleButton.styles, styles];\n\n /**\n * The Icon Button variant to render\n */\n @property() variant: UmIconButtonVariant = 'standard';\n\n /**\n * The width of the Icon Button\n */\n @property() width: UmIconButtonWidth = 'default';\n\n protected override _getContainerClasses(): Record<string, boolean> {\n return {\n ...super._getContainerClasses(),\n [this.variant]: true,\n [this.width]: true,\n };\n }\n\n protected override _renderContent(): HTMLTemplateResult {\n\n return html`\n <span class=\"icon-container\" aria-hidden=\"true\">\n <span class=\"icon icon-default\">\n <slot></slot>\n </span>\n <span class=\"icon icon-selected\">\n <slot name=\"selected\" @slotchange=\"${this._handleSelectedIconSlotChange}\"></slot>\n </span>\n </span>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'u-icon-button': UmIconButton;\n }\n}\n"]}
@@ -3,6 +3,9 @@ import { UmTextFieldBase } from '../shared/text-field-base/text-field-base.js';
3
3
  export declare class UmButtonField extends UmTextFieldBase {
4
4
  static styles: import("lit").CSSResultGroup[];
5
5
  protected _value: string;
6
+ /**
7
+ * The current value of the field, submitted with the associated form
8
+ */
6
9
  get value(): string;
7
10
  set value(value: string);
8
11
  _button: HTMLButtonElement;
@@ -1 +1 @@
1
- {"version":3,"file":"button-field.d.ts","sourceRoot":"","sources":["../../src/button-field/button-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,MAAM,KAAK,CAAC;AAI3C,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAG/E,qBACa,aAAc,SAAQ,eAAe;IAChD,OAAgB,MAAM,iCAAoC;IAE1D,SAAS,CAAC,MAAM,SAAM;IACtB,IACI,KAAK,IAIQ,MAAM,CAFtB;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAItB;IAEuB,OAAO,EAAG,iBAAiB,CAAC;IAC7B,MAAM,EAAG,WAAW,CAAC;cAEzB,aAAa,IAAI,cAAc;cAa/B,kBAAkB,IAAI,cAAc;CAOxD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAC;KACjC;CACF"}
1
+ {"version":3,"file":"button-field.d.ts","sourceRoot":"","sources":["../../src/button-field/button-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,MAAM,KAAK,CAAC;AAI3C,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAG/E,qBACa,aAAc,SAAQ,eAAe;IAChD,OAAgB,MAAM,iCAAoC;IAE1D,SAAS,CAAC,MAAM,SAAM;IAEtB;;OAEG;IACH,IACI,KAAK,IAIQ,MAAM,CAFtB;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAItB;IAEuB,OAAO,EAAG,iBAAiB,CAAC;IAC7B,MAAM,EAAG,WAAW,CAAC;cAEzB,aAAa,IAAI,cAAc;cAa/B,kBAAkB,IAAI,cAAc;CAOxD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAC;KACjC;CACF"}
@@ -10,6 +10,9 @@ let UmButtonField = class UmButtonField extends UmTextFieldBase {
10
10
  this._value = '';
11
11
  }
12
12
  static { this.styles = [UmTextFieldBase.styles, styles]; }
13
+ /**
14
+ * The current value of the field, submitted with the associated form
15
+ */
13
16
  get value() {
14
17
  return this._value;
15
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"button-field.js","sourceRoot":"","sources":["../../src/button-field/button-field.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAG3C,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,eAAe;IAA3C;;QAGK,WAAM,GAAG,EAAE,CAAC;IAmCxB,CAAC;aArCiB,WAAM,GAAG,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,AAAnC,CAAoC;IAI1D,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,KAAK,CAAC,KAAa;QACrB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC;QACpB,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAKkB,aAAa;QAC9B,OAAO,UAAU,CAAA;;;;;qBAKA,IAAI,CAAC,QAAQ;;gBAElB,IAAI,CAAC,KAAK;;4BAEE,IAAI,CAAC,QAAQ,cAAc,CAAC;IACtD,CAAC;IAEkB,kBAAkB;QACnC,OAAO,IAAI,CAAA;;;;KAIV,CAAC;IACJ,CAAC;;AAhCD;IADC,QAAQ,EAAE;0CAGV;AAQuB;IAAvB,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC;8CAA6B;AAC7B;IAAtB,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC;6CAAsB;AAhBjC,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAsCzB","sourcesContent":["import { html, TemplateResult } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { html as staticHtml } from 'lit/static-html.js';\n\nimport { UmTextFieldBase } from '../shared/text-field-base/text-field-base.js';\nimport { styles } from './button-field.styles.js';\n\n@customElement('u-button-field')\nexport class UmButtonField extends UmTextFieldBase {\n static override styles = [UmTextFieldBase.styles, styles];\n\n protected _value = '';\n @property()\n get value() {\n return this._value;\n }\n\n set value(value: string) {\n this._value = value;\n this.empty = !value;\n this.elementInternals.setFormValue(value);\n }\n\n @query('.button', true) _button!: HTMLButtonElement;\n @query('.input', true) _input!: HTMLElement;\n\n protected override renderControl(): TemplateResult {\n return staticHtml`\n <button \n class=\"button\"\n aria-expanded=\"false\"\n aria-owns=\"select\"\n ?disabled=${this.disabled}></button>\n <div class=\"input\">\n <slot>${this.value}</slot>\n </div>\n <u-ripple ?disabled=${this.disabled}></u-ripple>`;\n }\n\n protected override renderAfterContent(): TemplateResult {\n return html`\n <u-menu>\n <slot></slot>\n </u-menu>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'u-button-field': UmButtonField;\n }\n}\n"]}
1
+ {"version":3,"file":"button-field.js","sourceRoot":"","sources":["../../src/button-field/button-field.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAG3C,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,eAAe;IAA3C;;QAGK,WAAM,GAAG,EAAE,CAAC;IAuCxB,CAAC;aAzCiB,WAAM,GAAG,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,AAAnC,CAAoC;IAI1D;;OAEG;IAEH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,KAAK,CAAC,KAAa;QACrB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC;QACpB,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAKkB,aAAa;QAC9B,OAAO,UAAU,CAAA;;;;;qBAKA,IAAI,CAAC,QAAQ;;gBAElB,IAAI,CAAC,KAAK;;4BAEE,IAAI,CAAC,QAAQ,cAAc,CAAC;IACtD,CAAC;IAEkB,kBAAkB;QACnC,OAAO,IAAI,CAAA;;;;KAIV,CAAC;IACJ,CAAC;;AAhCD;IADC,QAAQ,EAAE;0CAGV;AAQuB;IAAvB,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC;8CAA6B;AAC7B;IAAtB,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC;6CAAsB;AApBjC,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CA0CzB","sourcesContent":["import { html, TemplateResult } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { html as staticHtml } from 'lit/static-html.js';\n\nimport { UmTextFieldBase } from '../shared/text-field-base/text-field-base.js';\nimport { styles } from './button-field.styles.js';\n\n@customElement('u-button-field')\nexport class UmButtonField extends UmTextFieldBase {\n static override styles = [UmTextFieldBase.styles, styles];\n\n protected _value = '';\n\n /**\n * The current value of the field, submitted with the associated form\n */\n @property()\n get value() {\n return this._value;\n }\n\n set value(value: string) {\n this._value = value;\n this.empty = !value;\n this.elementInternals.setFormValue(value);\n }\n\n @query('.button', true) _button!: HTMLButtonElement;\n @query('.input', true) _input!: HTMLElement;\n\n protected override renderControl(): TemplateResult {\n return staticHtml`\n <button \n class=\"button\"\n aria-expanded=\"false\"\n aria-owns=\"select\"\n ?disabled=${this.disabled}></button>\n <div class=\"input\">\n <slot>${this.value}</slot>\n </div>\n <u-ripple ?disabled=${this.disabled}></u-ripple>`;\n }\n\n protected override renderAfterContent(): TemplateResult {\n return html`\n <u-menu>\n <slot></slot>\n </u-menu>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'u-button-field': UmButtonField;\n }\n}\n"]}
@@ -1,6 +1,9 @@
1
1
  export interface CalendarAdapter {
2
2
  getWeekDays(locale: string): string[];
3
+ getFirstDayOfWeek(locale: string): number;
3
4
  getDay(date: Date): string;
4
5
  getMonth(date: Date): string;
6
+ getYear(date: Date): string;
7
+ getMonthShort(month: number, locale: string): string;
5
8
  }
6
9
  //# sourceMappingURL=calendar-adapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"calendar-adapter.d.ts","sourceRoot":"","sources":["../../src/calendar/calendar-adapter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtC,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;CAC9B"}
1
+ {"version":3,"file":"calendar-adapter.d.ts","sourceRoot":"","sources":["../../src/calendar/calendar-adapter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtC,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1C,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;IAC7B,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;IAC5B,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CACtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"calendar-adapter.js","sourceRoot":"","sources":["../../src/calendar/calendar-adapter.ts"],"names":[],"mappings":"","sourcesContent":["export interface CalendarAdapter {\n getWeekDays(locale: string): string[];\n getDay(date: Date): string;\n getMonth(date: Date): string;\n}\n"]}
1
+ {"version":3,"file":"calendar-adapter.js","sourceRoot":"","sources":["../../src/calendar/calendar-adapter.ts"],"names":[],"mappings":"","sourcesContent":["export interface CalendarAdapter {\n getWeekDays(locale: string): string[];\n getFirstDayOfWeek(locale: string): number;\n getDay(date: Date): string;\n getMonth(date: Date): string;\n getYear(date: Date): string;\n getMonthShort(month: number, locale: string): string;\n}\n"]}
@@ -3,22 +3,39 @@ import { HTMLTemplateResult, LitElement } from 'lit';
3
3
  import { DirectiveResult } from 'lit-html/directive.js';
4
4
  import { ClassMapDirective } from 'lit-html/directives/class-map';
5
5
  import { DefaultCalendarAdapter } from './default-calendar-adapter.js';
6
+ export type CalendarView = 'day' | 'month' | 'year';
6
7
  export declare abstract class UmCalendarBase extends LitElement {
7
8
  #private;
8
9
  static styles: CSSResultGroup;
9
10
  weekDays: string[];
11
+ private _firstDayOfWeek;
10
12
  dateRenderer: ((date: Date, day: string) => HTMLElement) | null;
13
+ /**
14
+ * Whether to render dates from the previous and next months that
15
+ * fall inside the displayed weeks
16
+ */
11
17
  dateOutsideMonth: boolean;
18
+ /**
19
+ * Number of years displayed per page in the year picker view.
20
+ */
21
+ yearRange: number;
12
22
  get year(): number;
13
23
  set year(year: number);
14
24
  get month(): number;
15
25
  set month(month: number);
16
26
  _displayingMonthDate: Date;
27
+ view: CalendarView;
28
+ _yearPageStart: number;
29
+ /**
30
+ * The BCP 47 locale tag used to format month names and weekdays.
31
+ * When `null`, falls back to the browser's `navigator.language`.
32
+ */
17
33
  locale: string | null;
18
34
  _innerLocale: string;
19
35
  adapter: DefaultCalendarAdapter;
20
36
  protected constructor();
21
37
  connectedCallback(): void;
38
+ willUpdate(changed: Map<string, unknown>): void;
22
39
  render(): HTMLTemplateResult;
23
40
  protected _getCalendarClassMap(): DirectiveResult<typeof ClassMapDirective> | null;
24
41
  protected abstract _selectDate(date: Date): void;
@@ -1 +1 @@
1
- {"version":3,"file":"calendar-base.d.ts","sourceRoot":"","sources":["../../src/calendar/calendar-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAQ,kBAAkB,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,u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AoB,IAAI,eAAe,CAAC,OAAO,iBAAiB,CAAC,GAAG,IAAI;IAIlF,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAChD,SAAS,CAAC,QAAQ,CAAC,uBAAuB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAE/E,SAAS,CAAC,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAQpD,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM;IAenD,SAAS,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;CAuB9D"}
@@ -10,32 +10,81 @@ export class UmCalendarBase extends LitElement {
10
10
  return this._displayingMonthDate.getFullYear();
11
11
  }
12
12
  set year(year) {
13
- this._displayingMonthDate.setFullYear(year);
14
- this._displayingMonthDate = new Date(this._displayingMonthDate);
13
+ this._displayingMonthDate = new Date(year, this._displayingMonthDate.getMonth(), 1);
15
14
  }
16
15
  get month() {
17
16
  return this._displayingMonthDate.getMonth();
18
17
  }
19
18
  set month(month) {
20
- this._displayingMonthDate.setMonth(month);
21
- this._displayingMonthDate = new Date(this._displayingMonthDate);
19
+ this._displayingMonthDate = new Date(this._displayingMonthDate.getFullYear(), month, 1);
22
20
  }
23
21
  #currentDate;
24
22
  constructor() {
25
23
  super();
26
24
  this.weekDays = [];
25
+ this._firstDayOfWeek = 0;
27
26
  this.dateRenderer = null;
27
+ /**
28
+ * Whether to render dates from the previous and next months that
29
+ * fall inside the displayed weeks
30
+ */
28
31
  this.dateOutsideMonth = false;
32
+ /**
33
+ * Number of years displayed per page in the year picker view.
34
+ */
35
+ this.yearRange = 24;
29
36
  this.#currentDate = new Date();
37
+ this.view = 'day';
38
+ this._yearPageStart = 0;
39
+ /**
40
+ * The BCP 47 locale tag used to format month names and weekdays.
41
+ * When `null`, falls back to the browser's `navigator.language`.
42
+ */
30
43
  this.locale = null;
31
44
  this._innerLocale = navigator.language;
32
45
  this.adapter = new DefaultCalendarAdapter();
46
+ this.#toggleYearView = () => {
47
+ if (this.view === 'day') {
48
+ this._yearPageStart = this.#computeYearPageStart(this.year);
49
+ this.view = 'year';
50
+ return;
51
+ }
52
+ if (this.view === 'month') {
53
+ this._yearPageStart = this.#computeYearPageStart(this.year);
54
+ this.view = 'year';
55
+ return;
56
+ }
57
+ this.view = 'day';
58
+ };
59
+ this.#handlePrevClick = () => {
60
+ if (this.view === 'year') {
61
+ this._yearPageStart -= this.yearRange;
62
+ return;
63
+ }
64
+ if (this.view === 'month') {
65
+ this.year -= 1;
66
+ return;
67
+ }
68
+ this.#addMonth(-1);
69
+ };
70
+ this.#handleNextClick = () => {
71
+ if (this.view === 'year') {
72
+ this._yearPageStart += this.yearRange;
73
+ return;
74
+ }
75
+ if (this.view === 'month') {
76
+ this.year += 1;
77
+ return;
78
+ }
79
+ this.#addMonth(1);
80
+ };
33
81
  this.#currentDate.setHours(0);
34
82
  this.#currentDate.setMinutes(0);
35
83
  this.#currentDate.setSeconds(0);
36
84
  this.#currentDate.setMilliseconds(0);
37
85
  this._displayingMonthDate = new Date(this.#currentDate);
38
86
  this._displayingMonthDate.setDate(1);
87
+ this._yearPageStart = this.#computeYearPageStart(this.year);
39
88
  }
40
89
  connectedCallback() {
41
90
  super.connectedCallback();
@@ -48,14 +97,29 @@ export class UmCalendarBase extends LitElement {
48
97
  this.#setLocaleDependantProperties();
49
98
  });
50
99
  }
100
+ willUpdate(changed) {
101
+ if (changed.has('locale')) {
102
+ this._innerLocale = this.locale ?? navigator.language;
103
+ this.#setLocaleDependantProperties();
104
+ }
105
+ }
51
106
  render() {
52
107
  return html `
53
108
  <div>
54
109
  <u-button-set>
55
- <u-button class="month-button" type="button" variant="text">
56
- ${this.adapter.getMonth(this.#getDisplayingMonthDate())}
110
+ <u-button class="month-button" type="button" variant="text" @click=${this.#toggleYearView}>
111
+ ${this.#getHeaderLabel()}
112
+ <svg
113
+ class="month-button-icon ${this.view !== 'day' ? 'open' : ''}"
114
+ xmlns="http://www.w3.org/2000/svg"
115
+ height="1.5em"
116
+ viewBox="0 -960 960 960"
117
+ width="1.5em"
118
+ fill="currentColor">
119
+ <path d="M480-360 280-560h400L480-360Z" />
120
+ </svg>
57
121
  </u-button>
58
- <u-icon-button class="previous-month-button" @click=${() => this.#addMonth(-1)}>
122
+ <u-icon-button class="previous-month-button" @click=${this.#handlePrevClick}>
59
123
  <svg
60
124
  xmlns="http://www.w3.org/2000/svg"
61
125
  height="1em"
@@ -65,7 +129,7 @@ export class UmCalendarBase extends LitElement {
65
129
  <path d="M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z" />
66
130
  </svg>
67
131
  </u-icon-button>
68
- <u-icon-button @click=${() => this.#addMonth(1)}>
132
+ <u-icon-button @click=${this.#handleNextClick}>
69
133
  <svg
70
134
  xmlns="http://www.w3.org/2000/svg"
71
135
  height="1em"
@@ -77,9 +141,26 @@ export class UmCalendarBase extends LitElement {
77
141
  </u-icon-button>
78
142
  </u-button-set>
79
143
  </div>
144
+ ${this.#renderBody()}
145
+ `;
146
+ }
147
+ #renderBody() {
148
+ if (this.view === 'year') {
149
+ return html `<div class="year-grid">${this.#renderYears()}</div>`;
150
+ }
151
+ if (this.view === 'month') {
152
+ return html `<div class="month-grid">${this.#renderMonths()}</div>`;
153
+ }
154
+ return html `
80
155
  <div class="calendar ${this._getCalendarClassMap()}">${this.#renderWeekDays()}${this.#renderDays()}</div>
81
156
  `;
82
157
  }
158
+ #getHeaderLabel() {
159
+ if (this.view === 'month') {
160
+ return this.adapter.getYear(this.#getDisplayingMonthDate());
161
+ }
162
+ return this.adapter.getMonth(this.#getDisplayingMonthDate());
163
+ }
83
164
  #renderWeekDays() {
84
165
  return this.weekDays.map(weekDay => html `
85
166
  <div class="calendar-item">
@@ -88,15 +169,16 @@ export class UmCalendarBase extends LitElement {
88
169
  `);
89
170
  }
90
171
  #getDisplayingMonthDate() {
91
- return this._getDateFromIsoDate(`${this.year}-${this.month + 1}-1`);
172
+ return new Date(this.year, this.month, 1);
92
173
  }
93
174
  #renderDays() {
94
- const date = new Date(this._displayingMonthDate);
95
- date.setDate(date.getDate() - date.getDay());
96
- const month = this.month;
97
175
  const year = this.year;
176
+ const month = this.month;
177
+ const firstOfMonth = new Date(year, month, 1);
178
+ const diffToFirstDayOfWeek = (firstOfMonth.getDay() - this._firstDayOfWeek + 7) % 7;
179
+ const date = new Date(year, month, 1 - diffToFirstDayOfWeek);
98
180
  const daysTemplates = [];
99
- do {
181
+ for (let row = 0; row < 6; row++) {
100
182
  for (let i = 0; i < 7; i++) {
101
183
  const dateOutsideMonth = date.getMonth() !== month;
102
184
  const dateClasses = this._getSelectedDateClasses(date);
@@ -107,31 +189,98 @@ export class UmCalendarBase extends LitElement {
107
189
  dateClasses['date-outside-month'] = true;
108
190
  }
109
191
  const classes = classMap(dateClasses);
110
- const dateTemplate = dateOutsideMonth && !this.dateOutsideMonth
111
- ? null
112
- : html `
192
+ const renderDate = !dateOutsideMonth || this.dateOutsideMonth;
193
+ const dateTemplate = renderDate
194
+ ? html `
113
195
  <u-ripple></u-ripple>
114
196
  <span class="date">
115
197
  ${this.dateRenderer
116
198
  ? this.dateRenderer(new Date(date), this.adapter.getDay(date))
117
199
  : this.adapter.getDay(date)}
118
200
  </span>
119
- `;
201
+ `
202
+ : null;
203
+ const click = renderDate ? this.#handleDateClick(new Date(date)) : null;
120
204
  daysTemplates.push(html `
121
205
  <div
122
206
  class="calendar-item ${classes}"
123
- @click=${this.#handleDateClick(new Date(date))}>
207
+ @click=${click}>
124
208
  ${dateTemplate}
125
209
  </div>
126
210
  `);
127
211
  date.setDate(date.getDate() + 1);
128
212
  }
129
- } while (date.getMonth() <= month && date.getFullYear() <= year);
213
+ }
130
214
  return daysTemplates;
131
215
  }
216
+ #renderYears() {
217
+ const templates = [];
218
+ const currentYear = this.#currentDate.getFullYear();
219
+ const selectedYear = this.year;
220
+ for (let i = 0; i < this.yearRange; i++) {
221
+ const year = this._yearPageStart + i;
222
+ const classes = classMap({
223
+ 'year-cell': true,
224
+ 'current-year': year === currentYear && year !== selectedYear,
225
+ 'selected-year': year === selectedYear,
226
+ });
227
+ templates.push(html `
228
+ <div class=${classes} @click=${this.#handleYearClick(year)}>
229
+ <span class="year-label">
230
+ <u-ripple></u-ripple>
231
+ ${year}
232
+ </span>
233
+ </div>
234
+ `);
235
+ }
236
+ return templates;
237
+ }
238
+ #renderMonths() {
239
+ const templates = [];
240
+ const currentYear = this.#currentDate.getFullYear();
241
+ const currentMonth = this.#currentDate.getMonth();
242
+ const selectedMonth = this.month;
243
+ const displayedYear = this.year;
244
+ for (let month = 0; month < 12; month++) {
245
+ const isCurrent = displayedYear === currentYear && month === currentMonth;
246
+ const isSelected = month === selectedMonth;
247
+ const classes = classMap({
248
+ 'month-cell': true,
249
+ 'current-month': isCurrent && !isSelected,
250
+ 'selected-month': isSelected,
251
+ });
252
+ templates.push(html `
253
+ <div class=${classes} @click=${this.#handleMonthClick(month)}>
254
+ <span class="month-label">
255
+ <u-ripple></u-ripple>
256
+ ${this.adapter.getMonthShort(month, this._innerLocale)}
257
+ </span>
258
+ </div>
259
+ `);
260
+ }
261
+ return templates;
262
+ }
132
263
  #handleDateClick(date) {
133
264
  return () => this._selectDate(date);
134
265
  }
266
+ #handleYearClick(year) {
267
+ return () => {
268
+ this.year = year;
269
+ this.view = 'month';
270
+ };
271
+ }
272
+ #handleMonthClick(month) {
273
+ return () => {
274
+ this.month = month;
275
+ this.view = 'day';
276
+ };
277
+ }
278
+ #toggleYearView;
279
+ #handlePrevClick;
280
+ #handleNextClick;
281
+ #computeYearPageStart(year) {
282
+ return year - Math.floor(this.yearRange / 2);
283
+ }
135
284
  _getCalendarClassMap() {
136
285
  return null;
137
286
  }
@@ -167,21 +316,35 @@ export class UmCalendarBase extends LitElement {
167
316
  this.month += value;
168
317
  }
169
318
  #setLocaleDependantProperties() {
319
+ this.adapter.locale = this._innerLocale;
170
320
  this.weekDays = this.adapter.getWeekDays(this._innerLocale);
321
+ this._firstDayOfWeek = this.adapter.getFirstDayOfWeek(this._innerLocale);
171
322
  }
172
323
  }
173
324
  __decorate([
174
325
  state()
175
326
  ], UmCalendarBase.prototype, "weekDays", void 0);
327
+ __decorate([
328
+ state()
329
+ ], UmCalendarBase.prototype, "_firstDayOfWeek", void 0);
176
330
  __decorate([
177
331
  state()
178
332
  ], UmCalendarBase.prototype, "dateRenderer", void 0);
179
333
  __decorate([
180
334
  property({ type: Boolean })
181
335
  ], UmCalendarBase.prototype, "dateOutsideMonth", void 0);
336
+ __decorate([
337
+ property({ type: Number, attribute: 'year-range' })
338
+ ], UmCalendarBase.prototype, "yearRange", void 0);
182
339
  __decorate([
183
340
  state()
184
341
  ], UmCalendarBase.prototype, "_displayingMonthDate", void 0);
342
+ __decorate([
343
+ state()
344
+ ], UmCalendarBase.prototype, "view", void 0);
345
+ __decorate([
346
+ state()
347
+ ], UmCalendarBase.prototype, "_yearPageStart", void 0);
185
348
  __decorate([
186
349
  property()
187
350
  ], UmCalendarBase.prototype, "locale", void 0);