@redvars/peacock 3.3.3 → 3.4.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 (155) hide show
  1. package/dist/IndividualComponent-DUINtMGK.js +67 -0
  2. package/dist/IndividualComponent-DUINtMGK.js.map +1 -0
  3. package/dist/assets/images/empty-state/no-document.svg +11 -12
  4. package/dist/assets/images/empty-state/page.svg +15 -9
  5. package/dist/bottom-sheet.js +238 -0
  6. package/dist/bottom-sheet.js.map +1 -0
  7. package/dist/{button-ClzS8JLq.js → button-COYCtuA8.js} +306 -149
  8. package/dist/button-COYCtuA8.js.map +1 -0
  9. package/dist/button-group-DsXquZQn.js +440 -0
  10. package/dist/button-group-DsXquZQn.js.map +1 -0
  11. package/dist/button-group.js +6 -4
  12. package/dist/button-group.js.map +1 -1
  13. package/dist/button.js +5 -3
  14. package/dist/button.js.map +1 -1
  15. package/dist/card-content.js +29 -0
  16. package/dist/card-content.js.map +1 -0
  17. package/dist/card.js +418 -44
  18. package/dist/card.js.map +1 -1
  19. package/dist/{chart-bar-DbnXQgvS.js → chart-bar-cn6rrna-.js} +2 -2
  20. package/dist/{chart-bar-DbnXQgvS.js.map → chart-bar-cn6rrna-.js.map} +1 -1
  21. package/dist/chart-bar.js +4 -3
  22. package/dist/chart-bar.js.map +1 -1
  23. package/dist/chart-doughnut.js +2 -1
  24. package/dist/chart-doughnut.js.map +1 -1
  25. package/dist/chart-pie.js +2 -1
  26. package/dist/chart-pie.js.map +1 -1
  27. package/dist/chart-stacked-bar.js +4 -3
  28. package/dist/chart-stacked-bar.js.map +1 -1
  29. package/dist/{class-map-59YGWLnx.js → class-map-3TAnCMAX.js} +3 -9
  30. package/dist/class-map-3TAnCMAX.js.map +1 -0
  31. package/dist/clock.js +2 -1
  32. package/dist/clock.js.map +1 -1
  33. package/dist/code-editor.js +6 -4
  34. package/dist/code-editor.js.map +1 -1
  35. package/dist/code-highlighter.js +5 -3
  36. package/dist/code-highlighter.js.map +1 -1
  37. package/dist/custom-elements-jsdocs.json +2458 -2753
  38. package/dist/custom-elements.json +2742 -757
  39. package/dist/dispatch-event-utils-B4odODQf.js.map +1 -1
  40. package/dist/index.js +14 -10
  41. package/dist/index.js.map +1 -1
  42. package/dist/number-counter.js +3 -2
  43. package/dist/number-counter.js.map +1 -1
  44. package/dist/{observe-theme-change-pALI5fmV.js → observe-theme-change-DKAIv5BB.js} +3 -2
  45. package/dist/observe-theme-change-DKAIv5BB.js.map +1 -0
  46. package/dist/peacock-loader.js +34 -8
  47. package/dist/peacock-loader.js.map +1 -1
  48. package/dist/property-1psGvXOq.js +10 -0
  49. package/dist/property-1psGvXOq.js.map +1 -0
  50. package/dist/{radio-b70_Ie9n.js → select-C3XAzenC.js} +1706 -192
  51. package/dist/select-C3XAzenC.js.map +1 -0
  52. package/dist/side-sheet.js +186 -0
  53. package/dist/side-sheet.js.map +1 -0
  54. package/dist/src/bottom-sheet/bottom-sheet.d.ts +42 -0
  55. package/dist/src/bottom-sheet/index.d.ts +1 -0
  56. package/dist/src/button/BaseButton.d.ts +4 -3
  57. package/dist/src/button/button/button.d.ts +4 -0
  58. package/dist/src/button/button-group/button-group.d.ts +32 -3
  59. package/dist/src/button/icon-button/icon-button.d.ts +4 -0
  60. package/dist/src/card/card-content.d.ts +15 -0
  61. package/dist/src/card/card.d.ts +37 -3
  62. package/dist/src/card/index.d.ts +1 -0
  63. package/dist/src/container/container.d.ts +1 -1
  64. package/dist/src/empty-state/empty-state.d.ts +1 -1
  65. package/dist/src/focus-ring/focus-ring.d.ts +4 -1
  66. package/dist/src/index.d.ts +6 -1
  67. package/dist/src/menu/menu/menu.d.ts +1 -0
  68. package/dist/src/menu/menu-item/menu-item.d.ts +0 -1
  69. package/dist/src/ripple/ripple.d.ts +19 -3
  70. package/dist/src/segmented-button/index.d.ts +2 -0
  71. package/dist/src/segmented-button/segmented-button-group.d.ts +46 -0
  72. package/dist/src/segmented-button/segmented-button.d.ts +65 -0
  73. package/dist/src/select/index.d.ts +3 -0
  74. package/dist/src/select/option.d.ts +55 -0
  75. package/dist/src/select/select.d.ts +116 -0
  76. package/dist/src/side-sheet/index.d.ts +1 -0
  77. package/dist/src/side-sheet/side-sheet.d.ts +41 -0
  78. package/dist/src/tabs/tab-group.d.ts +0 -1
  79. package/dist/src/tabs/tab.d.ts +8 -2
  80. package/dist/src/tabs/tabs.d.ts +13 -1
  81. package/dist/state-DwbEjqVk.js +10 -0
  82. package/dist/state-DwbEjqVk.js.map +1 -0
  83. package/dist/{style-map-DcB52w-l.js → style-map-CRFEoCEg.js} +2 -2
  84. package/dist/{style-map-DcB52w-l.js.map → style-map-CRFEoCEg.js.map} +1 -1
  85. package/dist/tsconfig.tsbuildinfo +1 -1
  86. package/dist/{unsafe-html-C2r3PyzF.js → unsafe-html-D3GHRaGQ.js} +2 -2
  87. package/dist/{unsafe-html-C2r3PyzF.js.map → unsafe-html-D3GHRaGQ.js.map} +1 -1
  88. package/package.json +1 -1
  89. package/readme.md +2 -2
  90. package/src/bottom-sheet/bottom-sheet.scss +88 -0
  91. package/src/bottom-sheet/bottom-sheet.ts +135 -0
  92. package/src/bottom-sheet/index.ts +1 -0
  93. package/src/button/BaseButton.ts +16 -7
  94. package/src/button/button/button-colors.scss +76 -5
  95. package/src/button/button/button-sizes.scss +39 -19
  96. package/src/button/button/button.scss +117 -116
  97. package/src/button/button/button.ts +23 -1
  98. package/src/button/button-group/button-group.scss +25 -22
  99. package/src/button/button-group/button-group.ts +121 -4
  100. package/src/button/icon-button/icon-button-sizes.scss +35 -15
  101. package/src/button/icon-button/icon-button.ts +21 -1
  102. package/src/card/card-colors.scss +10 -0
  103. package/src/card/card-content.ts +26 -0
  104. package/src/card/card.scss +221 -41
  105. package/src/card/card.ts +240 -7
  106. package/src/card/index.ts +1 -0
  107. package/src/code-editor/code-editor.ts +1 -1
  108. package/src/container/container.ts +1 -1
  109. package/src/empty-state/empty-state.scss +8 -0
  110. package/src/empty-state/empty-state.ts +2 -2
  111. package/src/focus-ring/focus-ring.ts +37 -19
  112. package/src/index.ts +7 -1
  113. package/src/menu/menu/menu.scss +24 -3
  114. package/src/menu/menu/menu.ts +23 -2
  115. package/src/menu/menu-item/menu-item.scss +1 -0
  116. package/src/menu/menu-item/menu-item.ts +1 -9
  117. package/src/peacock-loader.ts +28 -0
  118. package/src/ripple/ripple.ts +19 -3
  119. package/src/segmented-button/index.ts +2 -0
  120. package/src/segmented-button/segmented-button-group.scss +21 -0
  121. package/src/segmented-button/segmented-button-group.ts +110 -0
  122. package/src/segmented-button/segmented-button.scss +115 -0
  123. package/src/segmented-button/segmented-button.ts +175 -0
  124. package/src/select/index.ts +3 -0
  125. package/src/select/option.ts +109 -0
  126. package/src/select/select.scss +120 -0
  127. package/src/select/select.ts +486 -0
  128. package/src/side-sheet/index.ts +1 -0
  129. package/src/side-sheet/side-sheet.scss +79 -0
  130. package/src/side-sheet/side-sheet.ts +100 -0
  131. package/src/slider/slider.scss +0 -1
  132. package/src/tabs/demo/index.html +90 -0
  133. package/src/tabs/tab-group.ts +0 -3
  134. package/src/tabs/tab.scss +237 -25
  135. package/src/tabs/tab.ts +85 -11
  136. package/src/tabs/tabs.scss +37 -3
  137. package/src/tabs/tabs.ts +118 -2
  138. package/src/utils/dispatch-event-utils.ts +1 -0
  139. package/dist/IndividualComponent-Dt5xirYG.js +0 -73
  140. package/dist/IndividualComponent-Dt5xirYG.js.map +0 -1
  141. package/dist/button-ClzS8JLq.js.map +0 -1
  142. package/dist/button-group-BMS5WvaF.js +0 -292
  143. package/dist/button-group-BMS5WvaF.js.map +0 -1
  144. package/dist/chart-donut.js +0 -309
  145. package/dist/chart-donut.js.map +0 -1
  146. package/dist/class-map-59YGWLnx.js.map +0 -1
  147. package/dist/observe-theme-change-pALI5fmV.js.map +0 -1
  148. package/dist/radio-b70_Ie9n.js.map +0 -1
  149. package/dist/src/chart-donut/chart-donut.d.ts +0 -53
  150. package/dist/src/chart-donut/index.d.ts +0 -1
  151. package/dist/test/card.test.d.ts +0 -1
  152. package/src/chart-donut/chart-donut.scss +0 -37
  153. package/src/chart-donut/chart-donut.ts +0 -287
  154. package/src/chart-donut/demo/index.html +0 -51
  155. package/src/chart-donut/index.ts +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"unsafe-html-C2r3PyzF.js","sources":["../node_modules/lit-html/directives/unsafe-html.js"],"sourcesContent":["import{nothing as t,noChange as i}from\"../lit-html.js\";import{directive as r,Directive as s,PartType as n}from\"../directive.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */class e extends s{constructor(i){if(super(i),this.it=t,i.type!==n.CHILD)throw Error(this.constructor.directiveName+\"() can only be used in child bindings\")}render(r){if(r===t||null==r)return this._t=void 0,this.it=r;if(r===i)return r;if(\"string\"!=typeof r)throw Error(this.constructor.directiveName+\"() called with a non-string value\");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName=\"unsafeHTML\",e.resultType=1;const o=r(e);export{e as UnsafeHTMLDirective,o as unsafeHTML};\n//# sourceMappingURL=unsafe-html.js.map\n"],"names":["s","t","n","i","r"],"mappings":";;;AACA;AACA;AACA;AACA;AACA,GAAG,MAAM,CAAC,SAASA,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAACC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAGC,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,uCAAuC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAGD,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAGE,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,mCAAmC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAM,MAAC,CAAC,CAACC,GAAC,CAAC,CAAC;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"unsafe-html-D3GHRaGQ.js","sources":["../node_modules/lit-html/directives/unsafe-html.js"],"sourcesContent":["import{nothing as t,noChange as i}from\"../lit-html.js\";import{directive as r,Directive as s,PartType as n}from\"../directive.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */class e extends s{constructor(i){if(super(i),this.it=t,i.type!==n.CHILD)throw Error(this.constructor.directiveName+\"() can only be used in child bindings\")}render(r){if(r===t||null==r)return this._t=void 0,this.it=r;if(r===i)return r;if(\"string\"!=typeof r)throw Error(this.constructor.directiveName+\"() called with a non-string value\");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName=\"unsafeHTML\",e.resultType=1;const o=r(e);export{e as UnsafeHTMLDirective,o as unsafeHTML};\n//# sourceMappingURL=unsafe-html.js.map\n"],"names":["s","t","n","i","r"],"mappings":";;;AACA;AACA;AACA;AACA;AACA,GAAG,MAAM,CAAC,SAASA,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAACC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAGC,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,uCAAuC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAGD,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAGE,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,mCAAmC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAM,MAAC,CAAC,CAACC,GAAC,CAAC,CAAC;;;;","x_google_ignoreList":[0]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@redvars/peacock",
3
3
  "description": "The foundation for beautiful user interfaces",
4
4
  "license": "Apache-2.0",
5
- "version": "3.3.3",
5
+ "version": "3.4.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
package/readme.md CHANGED
@@ -44,9 +44,9 @@ Visit [https://peacock.redvars.com](https://peacock.redvars.com) to view the doc
44
44
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
45
45
  <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
46
46
 
47
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.3.3/dist/assets/styles.css"></link>
47
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.4.0/dist/assets/styles.css"></link>
48
48
  <script type='module'
49
- src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.3.3/dist/peacock-loader.js'></script>
49
+ src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.4.0/dist/peacock-loader.js'></script>
50
50
  </head>
51
51
 
52
52
  <wc-button>Button</wc-button>
@@ -0,0 +1,88 @@
1
+ @use "../../scss/mixin";
2
+
3
+ @include mixin.base-styles;
4
+
5
+ :host {
6
+ display: contents;
7
+
8
+ --bottom-sheet-container-color: var(--color-surface-container-low, #f7f2fa);
9
+ --bottom-sheet-scrim-color: rgba(0, 0, 0, 0.32);
10
+ --bottom-sheet-shape: var(--shape-corner-extra-large, 28px);
11
+ --bottom-sheet-max-height: 90dvh;
12
+ --bottom-sheet-handle-color: var(--color-on-surface-variant, #49454f);
13
+ --bottom-sheet-transition-duration: var(--duration-medium2, 300ms);
14
+ --bottom-sheet-transition-easing: var(--easing-standard, cubic-bezier(0.2, 0, 0, 1));
15
+ }
16
+
17
+ .scrim {
18
+ inset: 0;
19
+ position: fixed;
20
+ background-color: var(--bottom-sheet-scrim-color);
21
+ opacity: 0;
22
+ pointer-events: none;
23
+ transition:
24
+ opacity var(--bottom-sheet-transition-duration) var(--bottom-sheet-transition-easing);
25
+ z-index: 1000;
26
+ }
27
+
28
+ .scrim.visible {
29
+ opacity: 1;
30
+ pointer-events: auto;
31
+ }
32
+
33
+ .sheet {
34
+ background-color: var(--bottom-sheet-container-color);
35
+ border-radius: var(--bottom-sheet-shape) var(--bottom-sheet-shape) 0 0;
36
+ bottom: 0;
37
+ display: flex;
38
+ flex-direction: column;
39
+ left: 0;
40
+ max-height: var(--bottom-sheet-max-height);
41
+ overflow: hidden;
42
+ position: fixed;
43
+ right: 0;
44
+ transform: translateY(100%);
45
+ transition:
46
+ transform var(--bottom-sheet-transition-duration) var(--bottom-sheet-transition-easing);
47
+ will-change: transform;
48
+ z-index: 1001;
49
+ }
50
+
51
+ .sheet.variant-standard {
52
+ position: relative;
53
+ z-index: 1;
54
+ }
55
+
56
+ .sheet.open {
57
+ transform: translateY(0);
58
+ }
59
+
60
+ .sheet.dragging {
61
+ transition: none;
62
+ }
63
+
64
+ .handle-area {
65
+ cursor: grab;
66
+ display: flex;
67
+ justify-content: center;
68
+ padding: var(--spacing-100, 0.5rem) var(--spacing-200, 1rem);
69
+ touch-action: none;
70
+ }
71
+
72
+ .handle-area:active {
73
+ cursor: grabbing;
74
+ }
75
+
76
+ .handle {
77
+ background-color: var(--bottom-sheet-handle-color);
78
+ border-radius: var(--shape-corner-full, 9999px);
79
+ height: 4px;
80
+ opacity: 0.4;
81
+ width: 2rem;
82
+ }
83
+
84
+ .content {
85
+ flex: 1 1 auto;
86
+ overflow-y: auto;
87
+ padding: var(--spacing-100, 0.5rem) var(--spacing-300, 1.5rem) var(--spacing-300, 1.5rem);
88
+ }
@@ -0,0 +1,135 @@
1
+ import { LitElement, html, nothing } from 'lit';
2
+ import { property, state } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import IndividualComponent from '../IndividualComponent.js';
5
+ import styles from './bottom-sheet.scss';
6
+
7
+ /**
8
+ * @label Bottom Sheet
9
+ * @tag wc-bottom-sheet
10
+ * @rawTag bottom-sheet
11
+ * @summary Bottom sheets slide up from the bottom of the screen to reveal additional content. Supports standard and modal variants per Material Design 3.
12
+ *
13
+ * @cssprop --bottom-sheet-container-color - Background color of the sheet container.
14
+ * @cssprop --bottom-sheet-scrim-color - Color of the modal scrim overlay.
15
+ * @cssprop --bottom-sheet-shape - Corner radius of the top edge.
16
+ * @cssprop --bottom-sheet-max-height - Maximum height of the sheet.
17
+ *
18
+ * @example
19
+ * ```html
20
+ * Bottom Sheet
21
+ * ```
22
+ * @tags navigation, overlay
23
+ */
24
+ @IndividualComponent
25
+ export class BottomSheet extends LitElement {
26
+ static styles = [styles];
27
+
28
+ /** Whether the sheet is visible. */
29
+ @property({ type: Boolean, reflect: true }) open = false;
30
+
31
+ /**
32
+ * Sheet variant.
33
+ * - `"standard"`: Coexists with page content; no scrim.
34
+ * - `"modal"`: Overlays page content with a scrim backdrop.
35
+ */
36
+ @property({ type: String, reflect: true }) variant: 'standard' | 'modal' =
37
+ 'modal';
38
+
39
+ /** Whether to show the drag handle. */
40
+ @property({ type: Boolean, attribute: 'show-handle' }) showHandle = true;
41
+
42
+ @state() private _dragging = false;
43
+ @state() private _dragStartY = 0;
44
+ @state() private _dragOffsetY = 0;
45
+
46
+ show() {
47
+ this.open = true;
48
+ }
49
+
50
+ hide() {
51
+ this._close('programmatic');
52
+ }
53
+
54
+ private _close(reason: string) {
55
+ if (!this.open) return;
56
+ this.open = false;
57
+ this.dispatchEvent(
58
+ new CustomEvent('bottom-sheet-close', {
59
+ detail: { reason },
60
+ bubbles: true,
61
+ composed: true,
62
+ }),
63
+ );
64
+ }
65
+
66
+ private _handleScrimClick() {
67
+ if (this.variant === 'modal') {
68
+ this._close('scrim');
69
+ }
70
+ }
71
+
72
+ private _handleDragStart(e: PointerEvent) {
73
+ this._dragging = true;
74
+ this._dragStartY = e.clientY;
75
+ this._dragOffsetY = 0;
76
+ (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);
77
+ }
78
+
79
+ private _handleDragMove(e: PointerEvent) {
80
+ if (!this._dragging) return;
81
+ const delta = e.clientY - this._dragStartY;
82
+ this._dragOffsetY = Math.max(0, delta);
83
+ }
84
+
85
+ private _handleDragEnd() {
86
+ if (!this._dragging) return;
87
+ this._dragging = false;
88
+ if (this._dragOffsetY > 80) {
89
+ this._close('drag');
90
+ }
91
+ this._dragOffsetY = 0;
92
+ }
93
+
94
+ render() {
95
+ const translateY = this._dragging ? `${this._dragOffsetY}px` : undefined;
96
+
97
+ return html`
98
+ ${this.variant === 'modal'
99
+ ? html`<div
100
+ class=${classMap({ scrim: true, visible: this.open })}
101
+ @click=${this._handleScrimClick}
102
+ ></div>`
103
+ : nothing}
104
+
105
+ <div
106
+ class=${classMap({
107
+ sheet: true,
108
+ open: this.open,
109
+ dragging: this._dragging,
110
+ [`variant-${this.variant}`]: true,
111
+ })}
112
+ style=${translateY ? `transform: translateY(${translateY})` : ''}
113
+ role="dialog"
114
+ aria-modal=${this.variant === 'modal' ? 'true' : 'false'}
115
+ aria-hidden=${!this.open ? 'true' : 'false'}
116
+ >
117
+ ${this.showHandle
118
+ ? html`<div
119
+ class="handle-area"
120
+ @pointerdown=${this._handleDragStart}
121
+ @pointermove=${this._handleDragMove}
122
+ @pointerup=${this._handleDragEnd}
123
+ @pointercancel=${this._handleDragEnd}
124
+ >
125
+ <div class="handle"></div>
126
+ </div>`
127
+ : nothing}
128
+
129
+ <div class="content">
130
+ <slot></slot>
131
+ </div>
132
+ </div>
133
+ `;
134
+ }
135
+ }
@@ -0,0 +1 @@
1
+ export { BottomSheet } from './bottom-sheet.js';
@@ -47,7 +47,7 @@ export class BaseButton extends LitElement {
47
47
  * Button size.
48
48
  * Possible values are `"sm"`, `"md"`, `"lg"`. Defaults to `"md"`.
49
49
  */
50
- @property() size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';
50
+ @property({ reflect: true }) size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';
51
51
 
52
52
  /**
53
53
  * If true, the user cannot interact with the button. Defaults to `false`.
@@ -55,12 +55,12 @@ export class BaseButton extends LitElement {
55
55
  @property({ type: Boolean, reflect: true })
56
56
  disabled: boolean = false;
57
57
 
58
- @property() skeleton: boolean = false;
58
+ @property({ type: Boolean, reflect: true }) skeleton: boolean = false;
59
59
 
60
60
  /**
61
61
  * If true, the user cannot interact with the button and the button is visually styled as disabled. But the button is still focusable. Defaults to `false`.
62
62
  */
63
- @property({ reflect: true, attribute: 'soft-disabled' })
63
+ @property({ type: Boolean, reflect: true, attribute: 'soft-disabled' })
64
64
  softDisabled: boolean = false;
65
65
 
66
66
  /**
@@ -74,15 +74,20 @@ export class BaseButton extends LitElement {
74
74
  */
75
75
  @property({ reflect: true }) href?: string;
76
76
 
77
- @property({ reflect: true })
78
- configAria?: { [key: string]: any };
79
-
80
77
  /**
81
78
  * Sets or retrieves the window or frame at which to target content.
82
79
  */
83
80
  @property() target: string = '_self';
81
+
82
+
83
+ @property({ reflect: true })
84
+ configAria?: { [key: string]: any };
85
+
86
+
87
+
88
+ @property({ type: Boolean, reflect: true }) toggle: boolean = false;
84
89
 
85
- @property() selected: boolean = false;
90
+ @property({ type: Boolean, reflect: true }) selected: boolean = false;
86
91
 
87
92
  /**
88
93
  * Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.
@@ -157,6 +162,10 @@ export class BaseButton extends LitElement {
157
162
  return;
158
163
  }
159
164
 
165
+ if (this.toggle) {
166
+ this.selected = !this.selected;
167
+ }
168
+
160
169
  this.focus();
161
170
  dispatchActivationClick(this.buttonElement);
162
171
  };
@@ -18,26 +18,97 @@
18
18
  --neo-button-label-text-color: var(--color-on-#{$color});
19
19
  }
20
20
 
21
- :host([color=primary]) {
21
+ @mixin _button-color-toggle-unselected($color) {
22
+
23
+ --filled-button-container-color: var(--color-surface-container);
24
+ --filled-button-label-text-color: var(--color-surface-container-variant);
25
+
26
+ --tonal-button-container-color: var(--color-#{$color}-container);
27
+ --tonal-button-label-text-color: var(--color-on-#{$color}-container);
28
+
29
+ --elevated-button-container-color: var(--color-surface-container-low);
30
+ --elevated-button-label-text-color: var(--color-#{$color});
31
+
32
+ --outlined-button-outline-color: var(--color-#{$color});
33
+ --outlined-button-label-text-color: var(--color-#{$color});
34
+ }
35
+
36
+ @mixin _button-color-toggle-selected($color) {
37
+
38
+ --filled-button-container-color: var(--color-#{$color});
39
+ --filled-button-label-text-color: var(--color-on-#{$color});
40
+
41
+ --tonal-button-container-color: var(--color-#{$color});
42
+ --tonal-button-label-text-color: var(--color-on-#{$color});
43
+
44
+ --elevated-button-container-color: var(--color-#{$color});
45
+ --elevated-button-label-text-color: var(--color-on-#{$color});
46
+
47
+ --outlined-button-outline-color: var(--color-inverse-surface);
48
+ --outlined-button-label-text-color: var(--color-inverse-on-surface);
49
+ }
50
+
51
+ :host([color=primary]:not([toggle])) {
22
52
  @include _button-color(primary);
23
53
  }
24
54
 
25
- :host([color=secondary]) {
55
+ :host([color=primary][toggle][selected]) {
56
+ @include _button-color-toggle-selected(primary);
57
+ }
58
+
59
+ :host([color=primary][toggle]:not([selected])) {
60
+ @include _button-color-toggle-unselected(primary);
61
+ }
62
+
63
+ :host([color=secondary]:not([toggle])) {
26
64
  @include _button-color(secondary);
27
65
  }
28
66
 
29
- :host([color=tertiary]) {
67
+ :host([color=secondary][toggle][selected]) {
68
+ @include _button-color-toggle-selected(secondary);
69
+ }
70
+
71
+ :host([color=secondary][toggle]:not([selected])) {
72
+ @include _button-color-toggle-unselected(secondary);
73
+ }
74
+
75
+ :host([color=tertiary]:not([toggle])) {
30
76
  @include _button-color(tertiary);
31
77
  }
32
78
 
33
- :host([color=success]) {
79
+ :host([color=tertiary][toggle][selected]) {
80
+ @include _button-color-toggle-selected(tertiary);
81
+ }
82
+
83
+ :host([color=tertiary][toggle]:not([selected])) {
84
+ @include _button-color-toggle-unselected(tertiary);
85
+ }
86
+
87
+ :host([color=success]:not([toggle])) {
34
88
  @include _button-color(success);
35
89
  }
36
90
 
37
- :host([color=danger]) {
91
+ :host([color=success][toggle][selected]) {
92
+ @include _button-color-toggle-selected(success);
93
+ }
94
+
95
+ :host([color=success][toggle]:not([selected])) {
96
+ @include _button-color-toggle-unselected(success);
97
+ }
98
+
99
+
100
+ :host([color=danger]:not([toggle])) {
38
101
  @include _button-color(error);
39
102
  }
40
103
 
104
+ :host([color=danger][toggle][selected]) {
105
+ @include _button-color-toggle-selected(error);
106
+ }
107
+
108
+ :host([color=danger][toggle]:not([selected])) {
109
+ @include _button-color-toggle-unselected(error);
110
+ }
111
+
41
112
 
42
113
  :host([color=dark]) {
43
114
  --filled-button-container-color: var(--color-on-surface);
@@ -1,10 +1,15 @@
1
1
  @use '../../../scss/mixin';
2
2
 
3
- .button.size-xs,
4
- .button.size-extra-small {
5
- --_button-height: 2rem;
3
+
4
+ :host([size='xs']),
5
+ :host([size='extra-small']) {
6
+ --button-height: 2rem;
7
+ }
8
+
9
+ :host([size='xs']) .button,
10
+ :host([size='extra-small']) .button {
6
11
  --_button-icon-size: 1rem;
7
- --_container-padding: 0.75rem;
12
+ --_button_container-padding: 0.75rem;
8
13
 
9
14
  font-size: 0.875rem !important;
10
15
  font-weight: var(--font-weight-medium) !important;
@@ -13,11 +18,15 @@
13
18
  }
14
19
 
15
20
 
16
- .button.size-sm,
17
- .button.size-small {
18
- --_button-height: 2.5rem;
21
+ :host([size='sm']),
22
+ :host([size='small']) {
23
+ --button-height: 2.5rem;
24
+ }
25
+
26
+ :host([size='sm']) .button,
27
+ :host([size='small']) .button {
19
28
  --_button-icon-size: 1.25rem;
20
- --_container-padding: 1rem;
29
+ --_button_container-padding: 1rem;
21
30
  --_button-icon-label-spacing: 0.5rem;
22
31
 
23
32
  font-size: 0.875rem !important;
@@ -26,11 +35,15 @@
26
35
  letter-spacing: 0.1px !important;
27
36
  }
28
37
 
29
- .button.size-md,
30
- .button.size-medium {
31
- --_button-height: 3.5rem;
38
+ :host([size='md']),
39
+ :host([size='medium']) {
40
+ --button-height: 3.5rem;
41
+ }
42
+
43
+ :host([size='md']) .button,
44
+ :host([size='medium']) .button {
32
45
  --_button-icon-size: 1.5rem;
33
- --_container-padding: 1.5rem;
46
+ --_button_container-padding: 1.5rem;
34
47
 
35
48
  font-size: 1rem !important;
36
49
  font-weight: var(--font-weight-medium) !important;
@@ -38,11 +51,15 @@
38
51
  letter-spacing: 0.15px !important;
39
52
  }
40
53
 
41
- .button.size-lg,
42
- .button.size-large {
43
- --_button-height: 6rem;
54
+ :host([size='lg']),
55
+ :host([size='large']) {
56
+ --button-height: 6rem;
57
+ }
58
+
59
+ :host([size='lg']) .button,
60
+ :host([size='large']) .button {
44
61
  --_button-icon-size: 2rem;
45
- --_container-padding: 3rem;
62
+ --_button_container-padding: 3rem;
46
63
 
47
64
  font-size: 1.5rem !important;
48
65
  font-weight: var(--font-weight-regular) !important;
@@ -50,10 +67,13 @@
50
67
  letter-spacing: 0 !important;
51
68
  }
52
69
 
53
- .button.size-xl {
54
- --_button-height: 8.5rem;
70
+ :host([size='xl']) {
71
+ --button-height: 8.5rem;
72
+ }
73
+
74
+ :host([size='xl']) .button {
55
75
  --_button-icon-size: 2.5rem;
56
- --_container-padding: 4rem;
76
+ --_button_container-padding: 4rem;
57
77
 
58
78
  font-size: 2rem !important;
59
79
  font-weight: var(--font-weight-regular) !important;