@universal-material/web 3.0.0 → 3.0.2

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 (198) hide show
  1. package/README.md +28 -0
  2. package/button/button-base.d.ts +15 -9
  3. package/button/button-base.d.ts.map +1 -1
  4. package/button/button-base.js +46 -93
  5. package/button/button-base.js.map +1 -1
  6. package/button/button-base.styles.d.ts +2 -0
  7. package/button/button-base.styles.d.ts.map +1 -0
  8. package/button/button-base.styles.js +75 -0
  9. package/button/button-base.styles.js.map +1 -0
  10. package/button/button-set.d.ts +10 -2
  11. package/button/button-set.d.ts.map +1 -1
  12. package/button/button-set.js +27 -16
  13. package/button/button-set.js.map +1 -1
  14. package/button/button-set.styles.d.ts +2 -0
  15. package/button/button-set.styles.d.ts.map +1 -0
  16. package/button/button-set.styles.js +39 -0
  17. package/button/button-set.styles.js.map +1 -0
  18. package/button/button.d.ts +18 -4
  19. package/button/button.d.ts.map +1 -1
  20. package/button/button.js +29 -102
  21. package/button/button.js.map +1 -1
  22. package/button/button.styles.d.ts +2 -0
  23. package/button/button.styles.d.ts.map +1 -0
  24. package/button/button.styles.js +96 -0
  25. package/button/button.styles.js.map +1 -0
  26. package/button/fab.d.ts +14 -2
  27. package/button/fab.d.ts.map +1 -1
  28. package/button/fab.js +25 -106
  29. package/button/fab.js.map +1 -1
  30. package/button/fab.styles.d.ts +2 -0
  31. package/button/fab.styles.d.ts.map +1 -0
  32. package/button/fab.styles.js +89 -0
  33. package/button/fab.styles.js.map +1 -0
  34. package/button/icon-button.d.ts +3 -4
  35. package/button/icon-button.d.ts.map +1 -1
  36. package/button/icon-button.js +15 -89
  37. package/button/icon-button.js.map +1 -1
  38. package/button/icon-button.styles.d.ts +2 -0
  39. package/button/icon-button.styles.d.ts.map +1 -0
  40. package/button/icon-button.styles.js +70 -0
  41. package/button/icon-button.styles.js.map +1 -0
  42. package/card/card-content.d.ts +5 -3
  43. package/card/card-content.d.ts.map +1 -1
  44. package/card/card-content.js +33 -13
  45. package/card/card-content.js.map +1 -1
  46. package/card/card-content.styles.d.ts +2 -0
  47. package/card/card-content.styles.d.ts.map +1 -0
  48. package/card/card-content.styles.js +15 -0
  49. package/card/card-content.styles.js.map +1 -0
  50. package/card/card-media.d.ts +3 -3
  51. package/card/card-media.d.ts.map +1 -1
  52. package/card/card-media.js +9 -17
  53. package/card/card-media.js.map +1 -1
  54. package/card/card-media.styles.d.ts +2 -0
  55. package/card/card-media.styles.d.ts.map +1 -0
  56. package/card/card-media.styles.js +13 -0
  57. package/card/card-media.styles.js.map +1 -0
  58. package/card/card.d.ts +9 -6
  59. package/card/card.d.ts.map +1 -1
  60. package/card/card.js +22 -34
  61. package/card/card.js.map +1 -1
  62. package/card/card.styles.d.ts +2 -0
  63. package/card/card.styles.d.ts.map +1 -0
  64. package/card/card.styles.js +26 -0
  65. package/card/card.styles.js.map +1 -0
  66. package/checkbox/checkbox.d.ts +16 -0
  67. package/checkbox/checkbox.d.ts.map +1 -0
  68. package/checkbox/checkbox.js +75 -0
  69. package/checkbox/checkbox.js.map +1 -0
  70. package/container/container.d.ts +14 -0
  71. package/container/container.d.ts.map +1 -0
  72. package/container/container.js +23 -0
  73. package/container/container.js.map +1 -0
  74. package/container/container.styles.d.ts +2 -0
  75. package/container/container.styles.d.ts.map +1 -0
  76. package/container/container.styles.js +43 -0
  77. package/container/container.styles.js.map +1 -0
  78. package/custom-elements.json +3706 -0
  79. package/divider/divider.d.ts +5 -2
  80. package/divider/divider.d.ts.map +1 -1
  81. package/divider/divider.js +11 -19
  82. package/divider/divider.js.map +1 -1
  83. package/divider/divider.styles.d.ts +2 -0
  84. package/divider/divider.styles.d.ts.map +1 -0
  85. package/divider/divider.styles.js +15 -0
  86. package/divider/divider.styles.js.map +1 -0
  87. package/elevation/elevation.d.ts +4 -3
  88. package/elevation/elevation.d.ts.map +1 -1
  89. package/elevation/elevation.js +11 -37
  90. package/elevation/elevation.js.map +1 -1
  91. package/elevation/elevation.styles.d.ts +2 -0
  92. package/elevation/elevation.styles.d.ts.map +1 -0
  93. package/elevation/elevation.styles.js +28 -0
  94. package/elevation/elevation.styles.js.map +1 -0
  95. package/index.d.ts +24 -0
  96. package/index.d.ts.map +1 -0
  97. package/index.js +24 -0
  98. package/index.js.map +1 -0
  99. package/package.json +35 -26
  100. package/ripple/ripple.d.ts +11 -5
  101. package/ripple/ripple.d.ts.map +1 -1
  102. package/ripple/ripple.js +66 -120
  103. package/ripple/ripple.js.map +1 -1
  104. package/ripple/ripple.styles.d.ts +2 -0
  105. package/ripple/ripple.styles.d.ts.map +1 -0
  106. package/ripple/ripple.styles.js +74 -0
  107. package/ripple/ripple.styles.js.map +1 -0
  108. package/shared/base.styles.d.ts +2 -0
  109. package/shared/base.styles.d.ts.map +1 -0
  110. package/shared/base.styles.js +9 -0
  111. package/shared/base.styles.js.map +1 -0
  112. package/table/table-body.d.ts +11 -0
  113. package/table/table-body.d.ts.map +1 -0
  114. package/table/table-body.js +21 -0
  115. package/table/table-body.js.map +1 -0
  116. package/table/table-body.styles.d.ts +2 -0
  117. package/table/table-body.styles.d.ts.map +1 -0
  118. package/table/table-body.styles.js +11 -0
  119. package/table/table-body.styles.js.map +1 -0
  120. package/table/table-cell.d.ts +11 -0
  121. package/table/table-cell.d.ts.map +1 -0
  122. package/table/table-cell.js +21 -0
  123. package/table/table-cell.js.map +1 -0
  124. package/table/table-cell.styles.d.ts +2 -0
  125. package/table/table-cell.styles.d.ts.map +1 -0
  126. package/table/table-cell.styles.js +11 -0
  127. package/table/table-cell.styles.js.map +1 -0
  128. package/table/table-head.d.ts +11 -0
  129. package/table/table-head.d.ts.map +1 -0
  130. package/table/table-head.js +21 -0
  131. package/table/table-head.js.map +1 -0
  132. package/table/table-head.styles.d.ts +2 -0
  133. package/table/table-head.styles.d.ts.map +1 -0
  134. package/table/table-head.styles.js +11 -0
  135. package/table/table-head.styles.js.map +1 -0
  136. package/table/table-header-cell.d.ts +11 -0
  137. package/table/table-header-cell.d.ts.map +1 -0
  138. package/table/table-header-cell.js +21 -0
  139. package/table/table-header-cell.js.map +1 -0
  140. package/table/table-header-cell.styles.d.ts +2 -0
  141. package/table/table-header-cell.styles.d.ts.map +1 -0
  142. package/table/table-header-cell.styles.js +12 -0
  143. package/table/table-header-cell.styles.js.map +1 -0
  144. package/table/table-row.d.ts +11 -0
  145. package/table/table-row.d.ts.map +1 -0
  146. package/{card/button-set.js → table/table-row.js} +10 -15
  147. package/table/table-row.js.map +1 -0
  148. package/table/table-row.styles.d.ts +2 -0
  149. package/table/table-row.styles.d.ts.map +1 -0
  150. package/table/table-row.styles.js +7 -0
  151. package/table/table-row.styles.js.map +1 -0
  152. package/table/table.d.ts +16 -0
  153. package/table/table.d.ts.map +1 -0
  154. package/table/table.js +19 -0
  155. package/table/table.js.map +1 -0
  156. package/table/table.styles.d.ts +2 -0
  157. package/table/table.styles.d.ts.map +1 -0
  158. package/table/table.styles.js +16 -0
  159. package/table/table.styles.js.map +1 -0
  160. package/theme/color.d.ts +7 -0
  161. package/theme/color.d.ts.map +1 -0
  162. package/theme/color.js +2 -0
  163. package/theme/color.js.map +1 -0
  164. package/theme/css-var-builder.d.ts +9 -0
  165. package/theme/css-var-builder.d.ts.map +1 -0
  166. package/theme/css-var-builder.js +25 -0
  167. package/theme/css-var-builder.js.map +1 -0
  168. package/theme/index.d.ts +2 -0
  169. package/theme/index.d.ts.map +1 -0
  170. package/theme/index.js +2 -0
  171. package/theme/index.js.map +1 -0
  172. package/theme/neutral-colors.d.ts +4 -0
  173. package/theme/neutral-colors.d.ts.map +1 -0
  174. package/theme/neutral-colors.js +19 -0
  175. package/theme/neutral-colors.js.map +1 -0
  176. package/theme/rgb-color.d.ts +9 -0
  177. package/theme/rgb-color.d.ts.map +1 -0
  178. package/theme/rgb-color.js +13 -0
  179. package/theme/rgb-color.js.map +1 -0
  180. package/theme/theme-builder.d.ts +27 -0
  181. package/theme/theme-builder.d.ts.map +1 -0
  182. package/theme/theme-builder.js +146 -0
  183. package/theme/theme-builder.js.map +1 -0
  184. package/theme/theme-color.d.ts +6 -0
  185. package/theme/theme-color.d.ts.map +1 -0
  186. package/theme/theme-color.js +2 -0
  187. package/theme/theme-color.js.map +1 -0
  188. package/all.d.ts +0 -9
  189. package/all.d.ts.map +0 -1
  190. package/all.js +0 -9
  191. package/all.js.map +0 -1
  192. package/card/button-set.d.ts +0 -11
  193. package/card/button-set.d.ts.map +0 -1
  194. package/card/button-set.js.map +0 -1
  195. package/shared/area-hidden-element.d.ts +0 -5
  196. package/shared/area-hidden-element.d.ts.map +0 -1
  197. package/shared/area-hidden-element.js +0 -10
  198. package/shared/area-hidden-element.js.map +0 -1
package/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # Universal Material
2
+
3
+ ### Getting started
4
+
5
+ #### Install
6
+ Install Universal Material components using [npm and node](https://nodejs.org/).
7
+
8
+ ```
9
+ npm i @universal-material/web
10
+ ```
11
+
12
+ ### Import
13
+ Import element definitions from `@universal-material/web/<component>/<component-variant>.js` or import everything from `@universal-material/web`.
14
+ ```
15
+ // index.js
16
+ import '@universal-material/web/button/button.js';
17
+ import '@universal-material/web/card/card.js';
18
+ import '@universal-material/web/checkbox/checkbox.js';
19
+ ```
20
+
21
+ ### Documentation
22
+ https://universal-material.github.io
23
+
24
+ ## Thanks
25
+
26
+ <img src="https://live.browserstack.com/images/opensource/browserstack-logo.svg" alt="BrowserStack Logo" width="490" height="106">
27
+
28
+ Thanks to [BrowserStack](https://www.browserstack.com/) for providing the infrastructure that allows us to test in real browsers!
@@ -1,11 +1,11 @@
1
- import { CSSResult, HTMLTemplateResult, LitElement, nothing } from 'lit';
2
- import '../elevation/elevation';
3
- import '../ripple/ripple';
1
+ import { HTMLTemplateResult, LitElement, nothing } from 'lit';
2
+ import '../elevation/elevation.js';
3
+ import '../ripple/ripple.js';
4
4
  export declare abstract class ButtonBase extends LitElement {
5
+ #private;
5
6
  static readonly formAssociated = true;
6
- static styles: CSSResult | CSSResult[];
7
7
  /**
8
- * Whether or not the button is disabled.
8
+ * Whether the button is disabled or not.
9
9
  */
10
10
  disabled: boolean;
11
11
  /**
@@ -16,11 +16,18 @@ export declare abstract class ButtonBase extends LitElement {
16
16
  * Where to display the linked `href` URL for a link button. Common options
17
17
  * include `_blank` to open in a new tab.
18
18
  */
19
- target: '_blank' | '_parent' | '_self' | '_top' | '';
20
- type: 'submit' | 'button' | 'reset';
21
- form: string | null;
19
+ target: string;
20
+ type: string;
21
+ value: string;
22
+ name: string | undefined;
22
23
  private readonly buttonElement;
23
24
  private readonly ripple;
25
+ /**
26
+ * The `<form>` element to associate the button with (its form owner). The value of this attribute must be the id of a `<form>` in the same document. (If this attribute is not set, the button is associated with its ancestor `<form>` element, if any.)
27
+ * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#form
28
+ */
29
+ get form(): HTMLFormElement | null;
30
+ constructor();
24
31
  protected render(): import("lit-html").TemplateResult<1>;
25
32
  private renderButton;
26
33
  private renderLink;
@@ -32,6 +39,5 @@ export declare abstract class ButtonBase extends LitElement {
32
39
  protected getAriaLabel(): string | null | typeof nothing;
33
40
  private innerHandleClick;
34
41
  protected handleClick(_: UIEvent): void;
35
- private getFormElement;
36
42
  }
37
43
  //# sourceMappingURL=button-base.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"button-base.d.ts","sourceRoot":"","sources":["../../src/button/button-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,SAAS,EAAQ,kBAAkB,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AAGlF,OAAO,wBAAwB,CAAC;AAChC,OAAO,kBAAkB,CAAC;AAG1B,8BAAsB,UAAW,SAAQ,UAAU;IAEjD,MAAM,CAAC,QAAQ,CAAC,cAAc,QAAQ;IAEtC,OAAgB,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,CAmE/C;IAEA;;OAEG;IACuC,QAAQ,UAAS;IAE3D;;OAEG;IACS,IAAI,SAAM;IAEtB;;;OAGG;I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GG;IACH,IACI,IAAI,IAAI,eAAe,GAAG,IAAI,CAEjC;;cASkB,MAAM;IAMzB,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,UAAU;IAelB,SAAS,CAAC,QAAQ,CAAC,aAAa,IAAI,kBAAkB;IAE7C,iBAAiB;IAMjB,oBAAoB;IAMpB,KAAK;IAIL,IAAI;IAIb,SAAS,CAAC,YAAY,IAAI,MAAM,GAAG,IAAI,GAAG,OAAO,OAAO;IAIxD,OAAO,CAAC,gBAAgB;IA8BxB,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI;CAGxC"}
@@ -4,15 +4,34 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { css, html, LitElement, nothing } from 'lit';
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13
+ if (kind === "m") throw new TypeError("Private method is not writable");
14
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
15
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
16
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
17
+ };
18
+ var _ButtonBase_elementInternals;
19
+ import { html, LitElement, nothing } from 'lit';
8
20
  import { property, query } from 'lit/decorators.js';
9
- import '../elevation/elevation';
10
- import '../ripple/ripple';
21
+ import '../elevation/elevation.js';
22
+ import '../ripple/ripple.js';
11
23
  export class ButtonBase extends LitElement {
24
+ /**
25
+ * The `<form>` element to associate the button with (its form owner). The value of this attribute must be the id of a `<form>` in the same document. (If this attribute is not set, the button is associated with its ancestor `<form>` element, if any.)
26
+ * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#form
27
+ */
28
+ get form() {
29
+ return __classPrivateFieldGet(this, _ButtonBase_elementInternals, "f").form;
30
+ }
12
31
  constructor() {
13
- super(...arguments);
32
+ super();
14
33
  /**
15
- * Whether or not the button is disabled.
34
+ * Whether the button is disabled or not.
16
35
  */
17
36
  this.disabled = false;
18
37
  /**
@@ -25,8 +44,9 @@ export class ButtonBase extends LitElement {
25
44
  */
26
45
  this.target = '';
27
46
  this.type = 'submit';
28
- // @property() variant: 'filled' | 'tonal' | 'outlined' | 'text' = 'filled';
29
- this.form = null;
47
+ this.value = '';
48
+ _ButtonBase_elementInternals.set(this, void 0);
49
+ __classPrivateFieldSet(this, _ButtonBase_elementInternals, this.attachInternals(), "f");
30
50
  }
31
51
  render() {
32
52
  return this.href
@@ -34,7 +54,6 @@ export class ButtonBase extends LitElement {
34
54
  : this.renderButton();
35
55
  }
36
56
  renderButton() {
37
- // Needed for closure conformance
38
57
  return html `
39
58
  <button
40
59
  id="button"
@@ -42,14 +61,12 @@ export class ButtonBase extends LitElement {
42
61
  ?disabled=${this.disabled}
43
62
  aria-label="${this.getAriaLabel()}"
44
63
  type="button">
45
- <u-elevation></u-elevation>
46
64
  <u-ripple ?disabled=${this.disabled}></u-ripple>
47
- ${this.renderContent()}
48
- </button>`;
65
+ <u-elevation></u-elevation>
66
+ </button>
67
+ ${this.renderContent()}`;
49
68
  }
50
69
  renderLink() {
51
- // Needed for closure conformance
52
- // const {ariaLabel, ariaHasPopup, ariaExpanded} = this as ARIAMixinStrict;
53
70
  return html `<a
54
71
  id="link"
55
72
  class="button"
@@ -59,8 +76,8 @@ export class ButtonBase extends LitElement {
59
76
  target=${this.target || nothing}>
60
77
  <u-elevation></u-elevation>
61
78
  <u-ripple ?disabled=${this.disabled}></u-ripple>
62
- ${this.renderContent()}
63
- </a>`;
79
+ </a>
80
+ ${this.renderContent()}`;
64
81
  }
65
82
  connectedCallback() {
66
83
  super.connectedCallback();
@@ -90,91 +107,21 @@ export class ButtonBase extends LitElement {
90
107
  if (this.type === 'button' || !!this.href) {
91
108
  return;
92
109
  }
93
- const formElement = this.getFormElement();
110
+ if (!this.form) {
111
+ return;
112
+ }
113
+ __classPrivateFieldGet(this, _ButtonBase_elementInternals, "f").setFormValue(this.value);
94
114
  if (this.type === 'submit') {
95
- formElement?.submit();
115
+ this.form.requestSubmit();
96
116
  return;
97
117
  }
98
- formElement?.reset();
118
+ this.form.reset();
99
119
  }
100
120
  handleClick(_) {
101
121
  }
102
- getFormElement() {
103
- if (!this.form) {
104
- return this.closest('FORM');
105
- }
106
- return document.getElementById(this.form);
107
- }
108
122
  }
123
+ _ButtonBase_elementInternals = new WeakMap();
109
124
  ButtonBase.formAssociated = true;
110
- ButtonBase.styles = css `
111
-
112
- :host {
113
- --_primary-color: var(--u-primary-color, #6750a4);
114
- --_shadow-color-rgb: var(--u-shadow-color-rgb, 0,0,0);
115
-
116
- -webkit-tap-highlight-color: transparent;
117
- display: inline-block;
118
- vertical-align: baseline;
119
- transition: color 150ms ease-in-out, background-color 150ms ease-in-out;
120
- }
121
-
122
- :host([disabled]) {
123
- --u-elevation-level: 0 !important;
124
- background-color: var(--u-button-disabled-background-color, rgba(var(--u-on-surface-color-rgb, 29, 27, 32), .12)) !important;
125
- color: var(--u-button-disabled-text-color, rgba(var(--u-on-surface-color-rgb, 29, 27, 32), .38)) !important;
126
- }
127
-
128
- :host([disabled]) .button {
129
- cursor: default;
130
- }
131
-
132
- * {
133
- color: inherit;
134
- }
135
-
136
- u-elevation {
137
- z-index: -1;
138
- }
139
-
140
- .button {
141
- cursor: pointer;
142
- display: flex;
143
- align-items: center;
144
- justify-content: center;
145
- position: relative;
146
- width: 100%;
147
- height: 100%;
148
- margin: 0;
149
- font-family: inherit;
150
- border-radius: inherit;
151
- color: inherit;
152
- border: none;
153
- text-align: center;
154
- white-space: nowrap;
155
- background: transparent;
156
- user-select: none;
157
- text-decoration: none;
158
- outline: 0;
159
- z-index: 0;
160
- }
161
-
162
- .button:focus-visible {
163
- animation: offset-pulse 400ms ease;
164
- animation-fill-mode: forwards;
165
- outline-offset: 2px;
166
- }
167
-
168
- ::slotted([slot=icon]) {
169
- display: inline-block;
170
- }
171
-
172
- @keyframes offset-pulse {
173
- 0% {outline: 4px solid var(--u-primary-color, #6750a4)}
174
- 50% {outline: 8px solid var(--u-primary-color, #6750a4)}
175
- 100% {outline: 4px solid var(--u-primary-color, #6750a4)}
176
- }
177
- `;
178
125
  __decorate([
179
126
  property({ type: Boolean, reflect: true })
180
127
  ], ButtonBase.prototype, "disabled", void 0);
@@ -187,13 +134,19 @@ __decorate([
187
134
  __decorate([
188
135
  property()
189
136
  ], ButtonBase.prototype, "type", void 0);
137
+ __decorate([
138
+ property({ reflect: true })
139
+ ], ButtonBase.prototype, "value", void 0);
190
140
  __decorate([
191
141
  property()
192
- ], ButtonBase.prototype, "form", void 0);
142
+ ], ButtonBase.prototype, "name", void 0);
193
143
  __decorate([
194
144
  query('.button')
195
145
  ], ButtonBase.prototype, "buttonElement", void 0);
196
146
  __decorate([
197
147
  query('u-ripple')
198
148
  ], ButtonBase.prototype, "ripple", void 0);
149
+ __decorate([
150
+ property()
151
+ ], ButtonBase.prototype, "form", null);
199
152
  //# sourceMappingURL=button-base.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"button-base.js","sourceRoot":"","sources":["../../src/button/button-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,GAAG,EAAa,IAAI,EAAsB,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AAClF,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmEtD,AAnEuB,CAmEtB;AAK0C;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;4CAAkB;AAK/C;IAAX,QAAQ,EAAE;wCAAW;AAMV;IAAX,QAAQ,EAAE;0CAA2D;AAE1D;IAAX,QAAQ,EAAE;wCAAiD;AAGhD;IAAX,QAAQ,EAAE;wCAA4B;AAEJ;IAAlC,KAAK,CAAC,SAAS,CAAC;iDAA8C;AAC3B;IAAnC,KAAK,CAAC,UAAU,CAAC;0CAAkC","sourcesContent":["import {css, CSSResult, html, HTMLTemplateResult, LitElement, nothing} from 'lit';\nimport {property, query} from 'lit/decorators.js';\n\nimport '../elevation/elevation';\nimport '../ripple/ripple';\nimport {Ripple} from '../ripple/ripple';\n\nexport abstract class ButtonBase extends LitElement {\n\n static readonly formAssociated = true;\n\n static override styles: CSSResult | CSSResult[] = css`\n\n :host {\n --_primary-color: var(--u-primary-color, #6750a4);\n --_shadow-color-rgb: var(--u-shadow-color-rgb, 0,0,0);\n\n -webkit-tap-highlight-color: transparent;\n display: inline-block;\n vertical-align: baseline;\n transition: color 150ms ease-in-out, background-color 150ms ease-in-out;\n }\n\n :host([disabled]) {\n --u-elevation-level: 0 !important;\n background-color: var(--u-button-disabled-background-color, rgba(var(--u-on-surface-color-rgb, 29, 27, 32), .12)) !important;\n color: var(--u-button-disabled-text-color, rgba(var(--u-on-surface-color-rgb, 29, 27, 32), .38)) !important;\n }\n\n :host([disabled]) .button {\n cursor: default;\n }\n \n * {\n color: inherit;\n }\n \n u-elevation {\n z-index: -1;\n }\n\n .button {\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n width: 100%;\n height: 100%;\n margin: 0;\n font-family: inherit;\n border-radius: inherit;\n color: inherit;\n border: none;\n text-align: center;\n white-space: nowrap;\n background: transparent;\n user-select: none;\n text-decoration: none;\n outline: 0;\n z-index: 0;\n }\n \n .button:focus-visible {\n animation: offset-pulse 400ms ease;\n animation-fill-mode: forwards;\n outline-offset: 2px;\n }\n\n ::slotted([slot=icon]) {\n display: inline-block;\n }\n \n @keyframes offset-pulse {\n 0% {outline: 4px solid var(--u-primary-color, #6750a4)}\n 50% {outline: 8px solid var(--u-primary-color, #6750a4)}\n 100% {outline: 4px solid var(--u-primary-color, #6750a4)}\n }\n`;\n\n /**\n * Whether or not the button is disabled.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * The URL that the link button points to.\n */\n @property() href = '';\n\n /**\n * Where to display the linked `href` URL for a link button. Common options\n * include `_blank` to open in a new tab.\n */\n @property() target: '_blank' | '_parent' | '_self' | '_top' | '' = '';\n\n @property() type : 'submit' | 'button' | 'reset' = 'submit';\n // @property() variant: 'filled' | 'tonal' | 'outlined' | 'text' = 'filled';\n\n @property() form: string | null = null;\n\n @query('.button') private readonly buttonElement!: HTMLElement;\n @query('u-ripple') private readonly ripple!: Ripple;\n\n\n protected override render() {\n return this.href\n ? this.renderLink()\n : this.renderButton();\n }\n\n\n private renderButton() {\n\n // Needed for closure conformance\n return html`\n <button\n id=\"button\"\n class=\"button\"\n ?disabled=${this.disabled}\n aria-label=\"${this.getAriaLabel()}\"\n type=\"button\">\n <u-elevation></u-elevation>\n <u-ripple ?disabled=${this.disabled}></u-ripple>\n ${this.renderContent()}\n </button>`;\n }\n\n private renderLink() {\n // Needed for closure conformance\n // const {ariaLabel, ariaHasPopup, ariaExpanded} = this as ARIAMixinStrict;\n return html`<a\n id=\"link\"\n class=\"button\"\n href=${this.disabled ? nothing : this.href}\n aria-disabled=${this.disabled || nothing}\n aria-label=\"${this.getAriaLabel()}\"\n target=${this.target || nothing}>\n <u-elevation></u-elevation>\n <u-ripple ?disabled=${this.disabled}></u-ripple>\n ${this.renderContent()}\n </a>`;\n }\n\n protected abstract renderContent(): HTMLTemplateResult;\n\n override connectedCallback() {\n super.connectedCallback();\n\n this.addEventListener('click', this.innerHandleClick);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('click', this.innerHandleClick);\n }\n\n override focus() {\n this.buttonElement?.focus();\n }\n\n override blur() {\n this.buttonElement?.blur();\n }\n\n protected getAriaLabel(): string | null | typeof nothing {\n return this.ariaLabel || nothing;\n }\n\n private innerHandleClick(event: UIEvent): void {\n\n if (this.disabled) {\n return;\n }\n\n if (event.detail === 0) {\n this.ripple.createRipple();\n }\n\n this.handleClick(event);\n\n if (this.type === 'button' || !!this.href) {\n return;\n }\n\n const formElement = this.getFormElement();\n\n if (this.type === 'submit') {\n formElement?.submit()\n return;\n }\n\n formElement?.reset();\n }\n\n protected handleClick(_: UIEvent): void {\n\n }\n\n private getFormElement(): HTMLFormElement | null {\n if (!this.form) {\n return this.closest<HTMLFormElement>('FORM');\n }\n\n return <HTMLFormElement>document.getElementById(this.form);\n }\n}\n"]}
1
+ {"version":3,"file":"button-base.js","sourceRoot":"","sources":["../../src/button/button-base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAsB,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,2BAA2B,CAAC;AACnC,OAAO,qBAAqB,CAAC;AAG7B,MAAM,OAAgB,UAAW,SAAQ,UAAU;IA4BjD;;;OAGG;IAEH,IAAI,IAAI;QACN,OAAO,uBAAA,IAAI,oCAAkB,CAAC,IAAI,CAAC;IACrC,CAAC;IAID;QACE,KAAK,EAAE,CAAC;QApCV;;WAEG;QACuC,aAAQ,GAAG,KAAK,CAAC;QAE3D;;WAEG;QACS,SAAI,GAAG,EAAE,CAAC;QAEtB;;;WAGG;QACS,WAAM,GAAW,EAAE,CAAC;QAEpB,SAAI,GAAW,QAAQ,CAAC;QAET,UAAK,GAAW,EAAE,CAAC;QAerC,+CAAo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ateResult, LitElement, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\n\nimport '../elevation/elevation.js';\nimport '../ripple/ripple.js';\nimport { UmRipple } from '../ripple/ripple';\n\nexport abstract class ButtonBase extends LitElement {\n\n static readonly formAssociated = true;\n\n /**\n * Whether the button is disabled or not.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * The URL that the link button points to.\n */\n @property() href = '';\n\n /**\n * Where to display the linked `href` URL for a link button. Common options\n * include `_blank` to open in a new tab.\n */\n @property() target: string = '';\n\n @property() type: string = 'submit';\n\n @property({reflect: true}) value: string = '';\n @property() name: string | undefined;\n\n @query('.button') private readonly buttonElement!: HTMLElement;\n @query('u-ripple') private readonly ripple!: UmRipple;\n\n /**\n * The `<form>` element to associate the button with (its form owner). The value of this attribute must be the id of a `<form>` in the same document. (If this attribute is not set, the button is associated with its ancestor `<form>` element, if any.)\n * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#form\n */\n @property()\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 render() {\n return this.href\n ? this.renderLink()\n : this.renderButton();\n }\n\n private renderButton() {\n\n return html`\n <button\n id=\"button\"\n class=\"button\"\n ?disabled=${this.disabled}\n aria-label=\"${this.getAriaLabel()}\"\n type=\"button\">\n <u-ripple ?disabled=${this.disabled}></u-ripple>\n <u-elevation></u-elevation>\n </button>\n ${this.renderContent()}`;\n }\n\n private renderLink() {\n\n return html`<a\n id=\"link\"\n class=\"button\"\n href=${this.disabled ? nothing : this.href}\n aria-disabled=${this.disabled || nothing}\n aria-label=\"${this.getAriaLabel()}\"\n target=${this.target || nothing}>\n <u-elevation></u-elevation>\n <u-ripple ?disabled=${this.disabled}></u-ripple>\n </a>\n ${this.renderContent()}`;\n }\n\n protected abstract renderContent(): HTMLTemplateResult;\n\n override connectedCallback() {\n super.connectedCallback();\n\n this.addEventListener('click', this.innerHandleClick);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n\n this.removeEventListener('click', this.innerHandleClick);\n }\n\n override focus() {\n this.buttonElement?.focus();\n }\n\n override blur() {\n this.buttonElement?.blur();\n }\n\n protected getAriaLabel(): string | null | typeof nothing {\n return this.ariaLabel || nothing;\n }\n\n private innerHandleClick(event: UIEvent): void {\n\n if (this.disabled) {\n return;\n }\n\n if (event.detail === 0) {\n this.ripple.createRipple();\n }\n\n this.handleClick(event);\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 === 'submit') {\n this.form.requestSubmit();\n return;\n }\n\n this.form.reset();\n }\n\n protected handleClick(_: UIEvent): void {\n\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const styles: import("lit").CSSResult;
2
+ //# sourceMappingURL=button-base.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button-base.styles.d.ts","sourceRoot":"","sources":["../../src/button/button-base.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAwElB,CAAC"}
@@ -0,0 +1,75 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ :host {
4
+ --_color-primary: var(--u-color-primary, rgb(103, 80, 164));
5
+ -webkit-tap-highlight-color: transparent;
6
+ display: inline-flex;
7
+ align-items: center;
8
+ justify-content: center;
9
+ vertical-align: baseline;
10
+ position: relative;
11
+ white-space: nowrap;
12
+ font-family: var(--u-font-family-base, system-ui);
13
+ transition: color 150ms ease-in-out, background-color 150ms ease-in-out;
14
+ }
15
+
16
+ :host([disabled]) {
17
+ --u-elevation-level: 0 !important;
18
+ background-color: var(--u-button-disabled-background-color, rgba(var(--u-color-on-surface, 29, 27, 32), 0.12)) !important;
19
+ color: var(--u-button-disabled-text-color, rgba(var(--u-color-on-surface, 29, 27, 32), 0.38)) !important;
20
+ }
21
+
22
+ :host([disabled]) .button {
23
+ cursor: default;
24
+ }
25
+
26
+ * {
27
+ color: inherit;
28
+ }
29
+
30
+ u-elevation {
31
+ z-index: -1;
32
+ }
33
+
34
+ .button {
35
+ cursor: pointer;
36
+ position: absolute;
37
+ inset: 0;
38
+ font-family: inherit;
39
+ border-radius: inherit;
40
+ color: inherit;
41
+ border: none;
42
+ margin: 0;
43
+ padding: 0;
44
+ text-align: center;
45
+ white-space: nowrap;
46
+ background: transparent;
47
+ user-select: none;
48
+ text-decoration: none;
49
+ outline: 0;
50
+ z-index: 0;
51
+ }
52
+
53
+ .button:focus-visible {
54
+ animation: offset-pulse 400ms ease;
55
+ animation-fill-mode: forwards;
56
+ outline-offset: 2px;
57
+ }
58
+
59
+ ::slotted([slot=icon]) {
60
+ display: inline-block;
61
+ }
62
+
63
+ @keyframes offset-pulse {
64
+ 0% {
65
+ outline: 4px solid var(--_color-primary);
66
+ }
67
+ 50% {
68
+ outline: 8px solid var(--_color-primary);
69
+ }
70
+ 100% {
71
+ outline: 4px solid var(--_color-primary);
72
+ }
73
+ }
74
+ `;
75
+ //# sourceMappingURL=button-base.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button-base.styles.js","sourceRoot":"","sources":["../../src/button/button-base.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwEzB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css `\n :host {\n --_color-primary: var(--u-color-primary, rgb(103, 80, 164));\n -webkit-tap-highlight-color: transparent;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n vertical-align: baseline;\n position: relative;\n white-space: nowrap;\n font-family: var(--u-font-family-base, system-ui);\n transition: color 150ms ease-in-out, background-color 150ms ease-in-out;\n }\n\n :host([disabled]) {\n --u-elevation-level: 0 !important;\n background-color: var(--u-button-disabled-background-color, rgba(var(--u-color-on-surface, 29, 27, 32), 0.12)) !important;\n color: var(--u-button-disabled-text-color, rgba(var(--u-color-on-surface, 29, 27, 32), 0.38)) !important;\n }\n\n :host([disabled]) .button {\n cursor: default;\n }\n\n * {\n color: inherit;\n }\n\n u-elevation {\n z-index: -1;\n }\n\n .button {\n cursor: pointer;\n position: absolute;\n inset: 0;\n font-family: inherit;\n border-radius: inherit;\n color: inherit;\n border: none;\n margin: 0;\n padding: 0;\n text-align: center;\n white-space: nowrap;\n background: transparent;\n user-select: none;\n text-decoration: none;\n outline: 0;\n z-index: 0;\n }\n\n .button:focus-visible {\n animation: offset-pulse 400ms ease;\n animation-fill-mode: forwards;\n outline-offset: 2px;\n }\n\n ::slotted([slot=icon]) {\n display: inline-block;\n }\n\n @keyframes offset-pulse {\n 0% {\n outline: 4px solid var(--_color-primary);\n }\n 50% {\n outline: 8px solid var(--_color-primary);\n }\n 100% {\n outline: 4px solid var(--_color-primary);\n }\n }\n`;\n"]}
@@ -1,11 +1,19 @@
1
1
  import { HTMLTemplateResult, LitElement } from 'lit';
2
- export declare class ButtonSet extends LitElement {
2
+ export declare class UmButtonSet extends LitElement {
3
3
  static styles: import("lit").CSSResult;
4
+ /**
5
+ * Set the alignment of the buttons at the `start`, `center` or at the `end`.
6
+ */
7
+ align: 'start' | 'center' | 'end';
8
+ /**
9
+ * Whether to render the buttons stacked or not
10
+ */
11
+ stack: boolean;
4
12
  render(): HTMLTemplateResult;
5
13
  }
6
14
  declare global {
7
15
  interface HTMLElementTagNameMap {
8
- 'u-button-set': ButtonSet;
16
+ 'u-button-set': UmButtonSet;
9
17
  }
10
18
  }
11
19
  //# sourceMappingURL=button-set.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"button-set.d.ts","sourceRoot":"","sources":["../../src/button/button-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,UAAU,EAAY,MAAM,KAAK,CAAC;AAG9D,qBACa,SAAU,SAAQ,UAAU;IAEvC,OAAgB,MAAM,0BAQpB;IAEO,MAAM,IAAI,kBAAkB;CAGtC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,SAAS,CAAC;KAC3B;CACF"}
1
+ {"version":3,"file":"button-set.d.ts","sourceRoot":"","sources":["../../src/button/button-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,kBAAkB,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAK3D,qBACa,WAAY,SAAQ,UAAU;IAEzC,OAAgB,MAAM,0BAAU;IAEhC;;OAEG;IACwB,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAS;IAErE;;OAEG;IACuC,KAAK,UAAS;IAE/C,MAAM,IAAI,kBAAkB;CAItC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
@@ -4,24 +4,35 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { LitElement, css, html } from 'lit';
8
- import { customElement } from 'lit/decorators.js';
9
- let ButtonSet = class ButtonSet extends LitElement {
7
+ import { html, LitElement } from 'lit';
8
+ import { customElement, property } from 'lit/decorators.js';
9
+ import { styles } from './button-set.styles';
10
+ let UmButtonSet = class UmButtonSet extends LitElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ /**
14
+ * Set the alignment of the buttons at the `start`, `center` or at the `end`.
15
+ */
16
+ this.align = 'end';
17
+ /**
18
+ * Whether to render the buttons stacked or not
19
+ */
20
+ this.stack = false;
21
+ }
10
22
  render() {
11
- return html `<slot></slot>`;
23
+ return html `
24
+ <slot></slot>`;
12
25
  }
13
26
  };
14
- ButtonSet.styles = css `
15
- :host {
16
- display: flex;
17
- gap: 8px;
18
- align-items: center;
19
- justify-content: flex-end;
20
- flex-wrap: wrap;
21
- }
22
- `;
23
- ButtonSet = __decorate([
27
+ UmButtonSet.styles = styles;
28
+ __decorate([
29
+ property({ reflect: true })
30
+ ], UmButtonSet.prototype, "align", void 0);
31
+ __decorate([
32
+ property({ type: Boolean, reflect: true })
33
+ ], UmButtonSet.prototype, "stack", void 0);
34
+ UmButtonSet = __decorate([
24
35
  customElement('u-button-set')
25
- ], ButtonSet);
26
- export { ButtonSet };
36
+ ], UmButtonSet);
37
+ export { UmButtonSet };
27
38
  //# sourceMappingURL=button-set.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"button-set.js","sourceRoot":"","sources":["../../src/button/button-set.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAqB,UAAU,EAAE,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG3C,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAY9B,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;;AAZe,gBAAM,GAAG,GAAG,CAAA;;;;;;;;GAQ3B,AARqB,CAQpB;AAVS,SAAS;IADrB,aAAa,CAAC,cAAc,CAAC;GACjB,SAAS,CAerB","sourcesContent":["import {HTMLTemplateResult, LitElement, css, html} from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\n@customElement('u-button-set')\nexport class ButtonSet extends LitElement {\n\n static override styles = css`\n :host {\n display: flex;\n gap: 8px;\n align-items: center;\n justify-content: flex-end;\n flex-wrap: wrap;\n }\n `;\n\n override render(): HTMLTemplateResult {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'u-button-set': ButtonSet;\n }\n}\n"]}
1
+ {"version":3,"file":"button-set.js","sourceRoot":"","sources":["../../src/button/button-set.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAsB,UAAU,EAAE,MAAM,KAAK,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGtC,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QAIL;;WAEG;QACwB,UAAK,GAA+B,KAAK,CAAC;QAErE;;WAEG;QACuC,UAAK,GAAG,KAAK,CAAC;IAM1D,CAAC;IAJU,MAAM;QACb,OAAO,IAAI,CAAA;oBACK,CAAC;IACnB,CAAC;;AAfe,kBAAM,GAAG,MAAM,AAAT,CAAU;AAKL;IAA1B,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;0CAA2C;AAK3B;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;0CAAe;AAZ7C,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAkBvB","sourcesContent":["import { html, HTMLTemplateResult, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport { styles } from './button-set.styles';\n\n@customElement('u-button-set')\nexport class UmButtonSet extends LitElement {\n\n static override styles = styles;\n\n /**\n * Set the alignment of the buttons at the `start`, `center` or at the `end`.\n */\n @property({reflect: true}) align: 'start' | 'center' | 'end' = 'end';\n\n /**\n * Whether to render the buttons stacked or not\n */\n @property({type: Boolean, reflect: true}) stack = false;\n\n override render(): HTMLTemplateResult {\n return html`\n <slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'u-button-set': UmButtonSet;\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const styles: import("lit").CSSResult;
2
+ //# sourceMappingURL=button-set.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button-set.styles.d.ts","sourceRoot":"","sources":["../../src/button/button-set.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAoClB,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ :host {
4
+ display: flex;
5
+ gap: 8px;
6
+ align-items: center;
7
+ flex-wrap: wrap;
8
+ }
9
+
10
+ :host([align=start]) {
11
+ justify-content: flex-start;
12
+ }
13
+
14
+ :host([align=center]) {
15
+ justify-content: center;
16
+ }
17
+
18
+ :host([align=end]) {
19
+ justify-content: flex-end;
20
+ }
21
+
22
+ :host([stack][align=start]) {
23
+ align-items: flex-start;
24
+ }
25
+
26
+ :host([stack][align=center]) {
27
+ align-items: center;
28
+ }
29
+
30
+ :host([stack][align=end]) {
31
+ align-items: flex-end;
32
+ }
33
+
34
+ :host([stack]) {
35
+ flex-direction: column;
36
+ justify-content: flex-start;
37
+ }
38
+ `;
39
+ //# sourceMappingURL=button-set.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button-set.styles.js","sourceRoot":"","sources":["../../src/button/button-set.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCzB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css `\n :host {\n display: flex;\n gap: 8px;\n align-items: center;\n flex-wrap: wrap;\n }\n\n :host([align=start]) {\n justify-content: flex-start;\n }\n\n :host([align=center]) {\n justify-content: center;\n }\n\n :host([align=end]) {\n justify-content: flex-end;\n }\n\n :host([stack][align=start]) {\n align-items: flex-start;\n }\n\n :host([stack][align=center]) {\n align-items: center;\n }\n\n :host([stack][align=end]) {\n align-items: flex-end;\n }\n\n :host([stack]) {\n flex-direction: column;\n justify-content: flex-start;\n }\n`;\n"]}
@@ -1,10 +1,24 @@
1
1
  import { CSSResult, HTMLTemplateResult } from 'lit';
2
- import '../ripple/ripple';
3
2
  import { ButtonBase } from './button-base';
4
- export declare class Button extends ButtonBase {
3
+ import '../ripple/ripple.js';
4
+ export declare class UmButton extends ButtonBase {
5
5
  static styles: CSSResult | CSSResult[];
6
- variant: 'filled' | 'tonal' | 'outlined' | 'text';
6
+ /**
7
+ * The Button variant to render
8
+ */
9
+ variant: 'filled' | 'tonal' | 'elevated' | 'outlined' | 'text';
10
+ /**
11
+ * The Button color
12
+ *
13
+ * _Note:_ Filled buttons only
14
+ */
15
+ color: 'primary' | 'secondary' | 'tertiary' | 'error' | undefined;
7
16
  trailingIcon: boolean;
17
+ /**
18
+ * Whether the button has icon or not
19
+ *
20
+ * _Note:_ Readonly
21
+ */
8
22
  hasIcon: boolean;
9
23
  private readonly assignedIcons;
10
24
  protected renderContent(): HTMLTemplateResult;
@@ -12,7 +26,7 @@ export declare class Button extends ButtonBase {
12
26
  }
13
27
  declare global {
14
28
  interface HTMLElementTagNameMap {
15
- 'u-button': Button;
29
+ 'u-button': UmButton;
16
30
  }
17
31
  }
18
32
  //# sourceMappingURL=button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,SAAS,EAAQ,kBAAkB,EAAU,MAAM,KAAK,CAAC;AAGtE,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC,qBACa,MAAO,SAAQ,UAAU;IAEpC,OAAgB,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,CAuF7C;IAEyB,OAAO,EAAE,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAY;IAElB,YAAY,UAAS;IAC1B,OAAO,UAAS;IAGjF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;cAE5B,aAAa,IAAI,kBAAkB;IAatD,OAAO,CAAC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