@redvars/peacock 3.6.3 → 3.7.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 (179) hide show
  1. package/dist/ButtonConstants-D06bY4uy.js +114 -0
  2. package/dist/ButtonConstants-D06bY4uy.js.map +1 -0
  3. package/dist/{BaseHyperlinkMixin-BNuwbiEf.js → NativeHyperlinkMixin-DrYXyfMQ.js} +8 -10
  4. package/dist/NativeHyperlinkMixin-DrYXyfMQ.js.map +1 -0
  5. package/dist/assets/components.css +1 -1
  6. package/dist/assets/components.css.map +1 -1
  7. package/dist/assets/styles.css +1 -1
  8. package/dist/assets/styles.css.map +1 -1
  9. package/dist/{button-colors-Cg6oxiz-.js → button-colors-Dwnez1tR.js} +201 -186
  10. package/dist/button-colors-Dwnez1tR.js.map +1 -0
  11. package/dist/button-group.js +8 -8
  12. package/dist/button-group.js.map +1 -1
  13. package/dist/button.js +224 -124
  14. package/dist/button.js.map +1 -1
  15. package/dist/calendar-column-view.js +0 -1
  16. package/dist/calendar-column-view.js.map +1 -1
  17. package/dist/calendar-month-view.js +0 -1
  18. package/dist/calendar-month-view.js.map +1 -1
  19. package/dist/card-content.js +0 -1
  20. package/dist/card-content.js.map +1 -1
  21. package/dist/card.js +96 -90
  22. package/dist/card.js.map +1 -1
  23. package/dist/cb-compound-expression.js +4 -1
  24. package/dist/cb-compound-expression.js.map +1 -1
  25. package/dist/cb-divider.js +0 -1
  26. package/dist/cb-divider.js.map +1 -1
  27. package/dist/cb-expression.js +0 -2
  28. package/dist/cb-expression.js.map +1 -1
  29. package/dist/cb-predicate.js +0 -1
  30. package/dist/cb-predicate.js.map +1 -1
  31. package/dist/code-highlighter.js +23 -6
  32. package/dist/code-highlighter.js.map +1 -1
  33. package/dist/custom-elements-jsdocs.json +5102 -18408
  34. package/dist/custom-elements.json +19630 -20205
  35. package/dist/fab.js +181 -117
  36. package/dist/fab.js.map +1 -1
  37. package/dist/{flow-designer-node-9Bqyn6qx.js → flow-designer-node-BWrPuxAR.js} +1 -2
  38. package/dist/flow-designer-node-BWrPuxAR.js.map +1 -0
  39. package/dist/flow-designer-node.js +1 -1
  40. package/dist/flow-designer.js +5 -5
  41. package/dist/icon-button-DJ0kZXYr.js +318 -0
  42. package/dist/icon-button-DJ0kZXYr.js.map +1 -0
  43. package/dist/index.js +8 -8
  44. package/dist/{navigation-rail-DAUuJ_Yp.js → navigation-rail-CM_svs5_.js} +511 -295
  45. package/dist/navigation-rail-CM_svs5_.js.map +1 -0
  46. package/dist/observe-slot-change-D8Xg-kSS.js +60 -0
  47. package/dist/observe-slot-change-D8Xg-kSS.js.map +1 -0
  48. package/dist/peacock-loader.js +7 -7
  49. package/dist/peacock-loader.js.map +1 -1
  50. package/dist/popover-content.js +0 -1
  51. package/dist/popover-content.js.map +1 -1
  52. package/dist/search.js +4 -1
  53. package/dist/search.js.map +1 -1
  54. package/dist/src/__controllers/attachable-controller.d.ts +109 -0
  55. package/dist/src/__mixins/{BaseButtonMixin.d.ts → NativeButtonMixin.d.ts} +3 -3
  56. package/dist/src/__mixins/{BaseHyperlinkMixin.d.ts → NativeHyperlinkMixin.d.ts} +3 -4
  57. package/dist/src/__utils/is-link.d.ts +1 -0
  58. package/dist/src/__utils/observe-slot-change.d.ts +1 -1
  59. package/dist/src/accordion/accordion-item.d.ts +0 -1
  60. package/dist/src/breadcrumb/breadcrumb-item/breadcrumb-item.d.ts +0 -1
  61. package/dist/src/button/ButtonConstants.d.ts +1 -0
  62. package/dist/src/button/GroupButtonInterface.d.ts +4 -0
  63. package/dist/src/button/button/button.d.ts +32 -7
  64. package/dist/src/button/button-group/button-group.d.ts +2 -1
  65. package/dist/src/button/icon-button/icon-button.d.ts +26 -5
  66. package/dist/src/button/index.d.ts +1 -1
  67. package/dist/src/calendar/calendar-column-view.d.ts +0 -1
  68. package/dist/src/calendar/calendar-month-view.d.ts +0 -1
  69. package/dist/src/card/card-content.d.ts +0 -1
  70. package/dist/src/card/card.d.ts +9 -6
  71. package/dist/src/chip/chip/chip.d.ts +22 -3
  72. package/dist/src/condition-builder/cb-compound-expression.d.ts +0 -1
  73. package/dist/src/condition-builder/cb-divider.d.ts +0 -1
  74. package/dist/src/condition-builder/cb-expression.d.ts +0 -1
  75. package/dist/src/condition-builder/cb-predicate.d.ts +0 -1
  76. package/dist/src/fab/fab.d.ts +20 -6
  77. package/dist/src/flow-designer/flow-designer-node.d.ts +0 -1
  78. package/dist/src/focus-ring/focus-ring.d.ts +26 -20
  79. package/dist/src/item/item.d.ts +2 -1
  80. package/dist/src/link/link.d.ts +1 -1
  81. package/dist/src/list/list-item.d.ts +1 -2
  82. package/dist/src/menu/menu-item/menu-item.d.ts +1 -2
  83. package/dist/src/menu/sub-menu/sub-menu.d.ts +0 -1
  84. package/dist/src/navigation-rail/navigation-rail-item.d.ts +0 -2
  85. package/dist/src/popover/popover-content.d.ts +0 -1
  86. package/dist/src/ripple/ripple.d.ts +9 -1
  87. package/dist/src/segmented-button/segmented-button.d.ts +0 -1
  88. package/dist/src/select/option.d.ts +0 -1
  89. package/dist/src/sidebar-menu/sidebar-menu-item.d.ts +0 -1
  90. package/dist/src/sidebar-menu/sidebar-sub-menu.d.ts +0 -1
  91. package/dist/src/tabs/tab-panel.d.ts +0 -1
  92. package/dist/src/tabs/tab.d.ts +4 -6
  93. package/dist/tsconfig.tsbuildinfo +1 -1
  94. package/package.json +4 -2
  95. package/readme.md +2 -2
  96. package/scss/components.scss +0 -1
  97. package/scss/mixin.scss +10 -13
  98. package/scss/styles.scss +1 -3
  99. package/src/__controllers/attachable-controller.ts +198 -0
  100. package/src/__mixins/NativeButtonMixin.ts +87 -0
  101. package/src/__mixins/{BaseHyperlinkMixin.ts → NativeHyperlinkMixin.ts} +15 -15
  102. package/src/__utils/is-link.ts +3 -0
  103. package/src/__utils/observe-slot-change.ts +46 -14
  104. package/src/accordion/accordion-item.scss +1 -1
  105. package/src/accordion/accordion-item.ts +0 -1
  106. package/src/breadcrumb/breadcrumb-item/breadcrumb-item.ts +0 -1
  107. package/src/button/ButtonConstants.ts +1 -0
  108. package/src/button/GroupButtonInterface.ts +4 -0
  109. package/src/button/button/button-colors.scss +2 -2
  110. package/src/button/button/button-layers.scss +124 -0
  111. package/src/button/button/button-sizes.scss +20 -42
  112. package/src/button/button/button.scss +72 -169
  113. package/src/button/button/button.ts +229 -78
  114. package/src/button/button/only-button.scss +13 -0
  115. package/src/button/button-group/button-group.ts +59 -17
  116. package/src/button/icon-button/icon-button-sizes.scss +6 -21
  117. package/src/button/icon-button/icon-button.ts +198 -93
  118. package/src/button/index.ts +1 -1
  119. package/src/calendar/calendar-column-view.ts +0 -1
  120. package/src/calendar/calendar-month-view.ts +0 -1
  121. package/src/card/card-content.ts +2 -3
  122. package/src/card/card.scss +87 -95
  123. package/src/card/card.ts +62 -60
  124. package/src/chip/chip/chip.scss +65 -70
  125. package/src/chip/chip/chip.ts +155 -56
  126. package/src/code-highlighter/code-highlighter.scss +1 -1
  127. package/src/code-highlighter/code-highlighter.ts +20 -5
  128. package/src/condition-builder/cb-compound-expression.scss +4 -0
  129. package/src/condition-builder/cb-compound-expression.ts +0 -1
  130. package/src/condition-builder/cb-divider.ts +0 -1
  131. package/src/condition-builder/cb-expression.scss +0 -1
  132. package/src/condition-builder/cb-expression.ts +0 -1
  133. package/src/condition-builder/cb-predicate.ts +0 -1
  134. package/src/elevation/elevation.scss +5 -1
  135. package/src/fab/fab-colors.scss +2 -2
  136. package/src/fab/fab-sizes.scss +24 -34
  137. package/src/fab/fab.scss +77 -71
  138. package/src/fab/fab.ts +141 -65
  139. package/src/flow-designer/flow-designer-node.ts +0 -1
  140. package/src/focus-ring/focus-ring.ts +81 -72
  141. package/src/item/item.scss +77 -66
  142. package/src/item/item.ts +61 -39
  143. package/src/link/link.scss +1 -10
  144. package/src/link/link.ts +4 -2
  145. package/src/list/list-item.ts +8 -8
  146. package/src/menu/menu-item/menu-item.ts +17 -8
  147. package/src/menu/sub-menu/sub-menu.ts +0 -1
  148. package/src/navigation-rail/navigation-rail-item.scss +5 -0
  149. package/src/navigation-rail/navigation-rail-item.ts +10 -15
  150. package/src/peacock-loader.ts +1 -1
  151. package/src/popover/popover-content.ts +0 -1
  152. package/src/ripple/ripple.ts +52 -20
  153. package/src/search/search.scss +3 -0
  154. package/src/segmented-button/segmented-button.ts +0 -1
  155. package/src/select/option.ts +0 -1
  156. package/src/sidebar-menu/sidebar-menu-item.ts +0 -1
  157. package/src/sidebar-menu/sidebar-sub-menu.ts +0 -1
  158. package/src/skeleton/skeleton.scss +5 -1
  159. package/src/tabs/tab-panel.ts +0 -1
  160. package/src/tabs/tab.ts +60 -70
  161. package/src/text/text.css-component.scss +3 -21
  162. package/src/tooltip/tooltip.scss +5 -8
  163. package/src/tooltip/tooltip.ts +1 -2
  164. package/dist/BaseButton-BNFAYn-S.js +0 -219
  165. package/dist/BaseButton-BNFAYn-S.js.map +0 -1
  166. package/dist/BaseHyperlinkMixin-BNuwbiEf.js.map +0 -1
  167. package/dist/button-colors-Cg6oxiz-.js.map +0 -1
  168. package/dist/flow-designer-node-9Bqyn6qx.js.map +0 -1
  169. package/dist/icon-button-AdJBEoNy.js +0 -251
  170. package/dist/icon-button-AdJBEoNy.js.map +0 -1
  171. package/dist/navigation-rail-DAUuJ_Yp.js.map +0 -1
  172. package/dist/observe-slot-change-BGJfgg2E.js +0 -31
  173. package/dist/observe-slot-change-BGJfgg2E.js.map +0 -1
  174. package/dist/src/button/BaseButton.d.ts +0 -28
  175. package/dist/src/focus-ring/FocusAttachableController.d.ts +0 -8
  176. package/src/__mixins/BaseButtonMixin.ts +0 -83
  177. package/src/button/BaseButton.ts +0 -113
  178. package/src/focus-ring/FocusAttachableController.ts +0 -28
  179. package/src/popover/tooltip.css-component.scss +0 -19
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.6.3",
5
+ "version": "3.7.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
@@ -41,13 +41,14 @@
41
41
  "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
42
42
  },
43
43
  "dependencies": {
44
+ "@floating-ui/dom": "^1.7.5",
45
+ "@pierre/theme": "^0.0.29",
44
46
  "@tiptap/core": "^2.11.3",
45
47
  "@tiptap/extension-mention": "^2.11.3",
46
48
  "@tiptap/extension-placeholder": "^2.11.3",
47
49
  "@tiptap/extension-underline": "^2.11.3",
48
50
  "@tiptap/pm": "^2.11.3",
49
51
  "@tiptap/starter-kit": "^2.11.3",
50
- "@floating-ui/dom": "^1.7.5",
51
52
  "@types/prettier": "^3.0.0",
52
53
  "d3": "^7.9.0",
53
54
  "install": "^0.13.0",
@@ -78,6 +79,7 @@
78
79
  "@wc-toolkit/jsdoc-tags": "^1.1.0",
79
80
  "@web/dev-server": "^0.4.6",
80
81
  "@web/test-runner": "^0.18.2",
82
+ "cem-plugin-expanded-types": "^1.4.0",
81
83
  "concurrently": "^8.2.2",
82
84
  "eslint": "^8.57.0",
83
85
  "eslint-config-prettier": "^9.1.0",
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.6.2/dist/assets/styles.css"></link>
47
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.7.0/dist/assets/styles.css"></link>
48
48
  <script type='module'
49
- src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.6.2/dist/peacock-loader.js'></script>
49
+ src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.7.0/dist/peacock-loader.js'></script>
50
50
  </head>
51
51
 
52
52
  <wc-button>Button</wc-button>
@@ -1,3 +1,2 @@
1
1
  @use '../src/text/text.css-component.scss';
2
2
  @use '../src/link/link.css-component.scss';
3
- @use '../src/popover/tooltip.css-component.scss';
package/scss/mixin.scss CHANGED
@@ -81,18 +81,15 @@
81
81
  }
82
82
  }
83
83
 
84
- @mixin apply-container-shape($name) {
85
- border-start-start-radius: var(--#{$name}-container-shape-start-start, var(--#{$name}-container-shape));
86
- border-start-end-radius: var(--#{$name}-container-shape-start-end, var(--#{$name}-container-shape));
87
- border-end-start-radius: var(--#{$name}-container-shape-end-start, var(--#{$name}-container-shape));
88
- border-end-end-radius: var(--#{$name}-container-shape-end-end, var(--#{$name}-container-shape));
89
- corner-shape: var(--#{$name}-container-shape-variant);
84
+
85
+ // Layers
86
+ @mixin layer-background {
87
+
90
88
  }
91
89
 
92
- @mixin copy-container-shape($from, $to) {
93
- --#{$to}-container-shape-start-start: var(--#{$from}-container-shape-start-start, var(--#{$from}-container-shape));
94
- --#{$to}-container-shape-start-end: var(--#{$from}-container-shape-start-end, var(--#{$from}-container-shape));
95
- --#{$to}-container-shape-end-start: var(--#{$from}-container-shape-end-start, var(--#{$from}-container-shape));
96
- --#{$to}-container-shape-end-end: var(--#{$from}-container-shape-end-end, var(--#{$from}-container-shape));
97
- --#{$to}-container-shape-variant: var(--#{$from}-container-shape-variant);
98
- }
90
+ // NOTE: `apply-container-shape` and `copy-container-shape` were removed.
91
+ // These helpers previously copied container-shape custom properties and
92
+ // applied them as physical border radii. They are intentionally deleted
93
+ // because the loader now manages container shape via CSS custom properties
94
+ // directly. If you need to reintroduce shape helpers, add small, focused
95
+ // utilities instead of the previous macros.
package/scss/styles.scss CHANGED
@@ -1,8 +1,6 @@
1
1
  @use 'tokens.css';
2
2
  @use '../src/text/text.css-component.scss';
3
3
  @use '../src/link/link.css-component.scss';
4
- @use '../src/popover/tooltip.css-component.scss';
5
-
6
4
 
7
5
 
8
6
 
@@ -61,4 +59,4 @@
61
59
  .scrollbar-primary::-webkit-scrollbar-thumb {
62
60
  background-color: var(--color-primary);
63
61
  border-radius: calc(var(--scrollbar-width) / 2);
64
- }
62
+ }
@@ -0,0 +1,198 @@
1
+ import { isServer, ReactiveController, ReactiveControllerHost } from 'lit';
2
+
3
+ /**
4
+ * An element that can be attached to an associated controlling element.
5
+ */
6
+ export interface Attachable {
7
+ /**
8
+ * Reflects the value of the `for` attribute, which is the ID of the element's
9
+ * associated control.
10
+ *
11
+ * Use this when the elements's associated control is not its parent.
12
+ *
13
+ * To manually control an element, set its `for` attribute to `""`.
14
+ *
15
+ * @example
16
+ * ```html
17
+ * <div class="container">
18
+ * <md-attachable for="interactive"></md-attachable>
19
+ * <button id="interactive">Action</button>
20
+ * </div>
21
+ * ```
22
+ *
23
+ * @example
24
+ * ```html
25
+ * <button class="manually-controlled">
26
+ * <md-attachable for=""></md-attachable>
27
+ * </button>
28
+ * ```
29
+ */
30
+ htmlFor: string | null;
31
+
32
+ /**
33
+ * Gets or sets the element that controls the visibility of the attachable
34
+ * element. It is one of:
35
+ *
36
+ * - The control referenced by the `for` attribute.
37
+ * - The control provided to `element.attach(control)`
38
+ * - The element's parent.
39
+ * - `null` if the element is not controlled.
40
+ */
41
+ control: HTMLElement | null;
42
+
43
+ /**
44
+ * Attaches the element to an interactive control.
45
+ *
46
+ * @param control The element that controls the attachable element.
47
+ */
48
+ attach(control: HTMLElement): void;
49
+
50
+ /**
51
+ * Detaches the element from its current control.
52
+ */
53
+ detach(): void;
54
+ }
55
+
56
+ /**
57
+ * A key to retrieve an `Attachable` element's `AttachableController` from a
58
+ * global `MutationObserver`.
59
+ */
60
+ const ATTACHABLE_CONTROLLER = Symbol('attachableController');
61
+
62
+ /**
63
+ * The host of an `AttachableController`. The controller will add itself to
64
+ * the host so it can be retrieved in a global `MutationObserver`.
65
+ */
66
+ interface AttachableControllerHost extends ReactiveControllerHost, HTMLElement {
67
+ [ATTACHABLE_CONTROLLER]?: AttachableController;
68
+ }
69
+
70
+ let FOR_ATTRIBUTE_OBSERVER: MutationObserver | undefined;
71
+
72
+ if (!isServer) {
73
+ /**
74
+ * A global `MutationObserver` that reacts to `for` attribute changes on
75
+ * `Attachable` elements. If the `for` attribute changes, the controller will
76
+ * re-attach to the new referenced element.
77
+ */
78
+ FOR_ATTRIBUTE_OBSERVER = new MutationObserver(records => {
79
+ for (const record of records) {
80
+ // When a control's `for` attribute changes, inform its
81
+ // `AttachableController` to update to a new control.
82
+ (record.target as AttachableControllerHost)[
83
+ ATTACHABLE_CONTROLLER
84
+ ]?.hostConnected();
85
+ }
86
+ });
87
+ }
88
+
89
+ /**
90
+ * A controller that provides an implementation for `Attachable` elements.
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * class MyElement extends LitElement implements Attachable {
95
+ * get control() { return this.attachableController.control; }
96
+ *
97
+ * private readonly attachableController = new AttachableController(
98
+ * this,
99
+ * (previousControl, newControl) => {
100
+ * previousControl?.removeEventListener('click', this.handleClick);
101
+ * newControl?.addEventListener('click', this.handleClick);
102
+ * }
103
+ * );
104
+ *
105
+ * // Implement remaining `Attachable` properties/methods that call the
106
+ * // controller's properties/methods.
107
+ * }
108
+ * ```
109
+ */
110
+ export class AttachableController implements ReactiveController, Attachable {
111
+ get htmlFor() {
112
+ return this.host.getAttribute('for');
113
+ }
114
+
115
+ set htmlFor(htmlFor: string | null) {
116
+ if (htmlFor === null) {
117
+ this.host.removeAttribute('for');
118
+ } else {
119
+ this.host.setAttribute('for', htmlFor);
120
+ }
121
+ }
122
+
123
+ get control() {
124
+ if (this.host.hasAttribute('for')) {
125
+ if (!this.htmlFor || !this.host.isConnected) {
126
+ return null;
127
+ }
128
+
129
+ return (
130
+ this.host.getRootNode() as Document | ShadowRoot
131
+ ).querySelector<HTMLElement>(`#${this.htmlFor}`);
132
+ }
133
+
134
+ return this.currentControl || this.host.parentElement;
135
+ }
136
+ set control(control: HTMLElement | null) {
137
+ if (control) {
138
+ this.attach(control);
139
+ } else {
140
+ this.detach();
141
+ }
142
+ }
143
+
144
+ private currentControl: HTMLElement | null = null;
145
+
146
+ /**
147
+ * Creates a new controller for an `Attachable` element.
148
+ *
149
+ * @param host The `Attachable` element.
150
+ * @param onControlChange A callback with two parameters for the previous and
151
+ * next control. An `Attachable` element may perform setup or teardown
152
+ * logic whenever the control changes.
153
+ */
154
+ constructor(
155
+ private readonly host: AttachableControllerHost,
156
+ private readonly onControlChange: (
157
+ prev: HTMLElement | null,
158
+ next: HTMLElement | null,
159
+ ) => void,
160
+ ) {
161
+ host.addController(this);
162
+ host[ATTACHABLE_CONTROLLER] = this;
163
+ FOR_ATTRIBUTE_OBSERVER?.observe(host, { attributeFilter: ['for'] });
164
+ }
165
+
166
+ attach(control: HTMLElement) {
167
+ if (control === this.currentControl) {
168
+ return;
169
+ }
170
+
171
+ this.setCurrentControl(control);
172
+ // When imperatively attaching, remove the `for` attribute so
173
+ // that the attached control is used instead of a referenced one.
174
+ this.host.removeAttribute('for');
175
+ }
176
+
177
+ detach() {
178
+ this.setCurrentControl(null);
179
+ // When imperatively detaching, add an empty `for=""` attribute. This will
180
+ // ensure the control is `null` rather than the `parentElement`.
181
+ this.host.setAttribute('for', '');
182
+ }
183
+
184
+ /** @private */
185
+ hostConnected() {
186
+ this.setCurrentControl(this.control);
187
+ }
188
+
189
+ /** @private */
190
+ hostDisconnected() {
191
+ this.setCurrentControl(null);
192
+ }
193
+
194
+ private setCurrentControl(control: HTMLElement | null) {
195
+ this.onControlChange(this.currentControl, control);
196
+ this.currentControl = control;
197
+ }
198
+ }
@@ -0,0 +1,87 @@
1
+ import { LitElement } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import type { MixinConstructor } from './MixinConstructor.js';
4
+
5
+ /**
6
+ * 1. Define an interface for the members the mixin adds.
7
+ * This makes the type annotation much cleaner.
8
+ */
9
+ export interface NativeButtonInterface {
10
+ htmlType: 'button' | 'submit' | 'reset';
11
+ disabled: boolean;
12
+ softDisabled: boolean;
13
+ disabledReason: string;
14
+ form: string;
15
+ name: string;
16
+ value: string;
17
+ }
18
+
19
+ /**
20
+ * 2. Apply the type annotation to the variable.
21
+ */
22
+ const NativeButtonMixin: <T extends MixinConstructor<LitElement>>(
23
+ superclass: T,
24
+ ) => T & MixinConstructor<NativeButtonInterface> = <
25
+ T extends MixinConstructor<LitElement>,
26
+ >(
27
+ superclass: T,
28
+ ) => {
29
+ // Naming the class (BaseButtonElement) instead of using 'Mixin' or anonymous
30
+ // prevents the "__childPart" visibility error.
31
+ class ButtonElement extends superclass implements NativeButtonInterface {
32
+ /**
33
+ * The type of the underlying `<button>` element. Maps to the native `type` attribute.
34
+ * Possible values are `"button"`, `"submit"`, `"reset"`. Defaults to `"button"`.
35
+ */
36
+ @property({ type: String }) htmlType: 'button' | 'submit' | 'reset' =
37
+ 'button';
38
+
39
+ /**
40
+ * When `true`, the button is disabled and cannot be interacted with. Reflects to the `disabled` attribute. Defaults to `false`.
41
+ */
42
+ @property({ type: Boolean, reflect: true })
43
+ disabled: boolean = false;
44
+
45
+ /**
46
+ * When `true`, the button is visually styled as disabled and cannot be interacted with, but remains focusable.
47
+ * Use this in combination with `disabledReason` to communicate why the button is unavailable.
48
+ * Reflects to the `soft-disabled` attribute. Defaults to `false`.
49
+ */
50
+ @property({ type: Boolean, reflect: true, attribute: 'soft-disabled' })
51
+ softDisabled: boolean = false;
52
+
53
+ /**
54
+ * A human-readable explanation of why the button is disabled or soft-disabled.
55
+ * Rendered as a visually hidden tooltip and linked via `aria-describedby` for accessibility.
56
+ * Maps to the `disabled-reason` attribute.
57
+ */
58
+ @property({ attribute: 'disabled-reason' })
59
+ disabledReason: string = '';
60
+
61
+ /**
62
+ * The `id` of the `<form>` element to associate the button with.
63
+ * If omitted, the button is associated with its nearest ancestor form.
64
+ * Maps to the native `form` attribute.
65
+ */
66
+ @property()
67
+ form: string = '';
68
+
69
+ /**
70
+ * The name of the button, submitted as part of a name/value pair when the associated form is submitted.
71
+ * Maps to the native `name` attribute.
72
+ */
73
+ @property()
74
+ name: string = '';
75
+
76
+ /**
77
+ * The value of the button, submitted as part of a name/value pair when the associated form is submitted.
78
+ * Maps to the native `value` attribute.
79
+ */
80
+ @property()
81
+ value: string = '';
82
+ }
83
+
84
+ return ButtonElement as T & MixinConstructor<NativeButtonInterface>;
85
+ };
86
+
87
+ export default NativeButtonMixin;
@@ -2,26 +2,33 @@ import { LitElement } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
3
  import type { MixinConstructor } from './MixinConstructor.js';
4
4
 
5
-
6
5
  /**
7
6
  * 1. Define an interface for the members the mixin adds.
8
7
  * This makes the type annotation much cleaner.
9
8
  */
10
- export interface BaseHyperlinkInterface {
9
+ export interface NativeHyperlinkInterface {
11
10
  href?: string;
12
11
  target: '_self' | '_parent' | '_blank' | '_top' | string;
13
12
  rel?: string;
14
13
  download?: string;
15
- __isLink(): boolean;
16
14
  }
17
15
 
18
16
  /**
19
17
  * 2. Apply the type annotation to the variable.
20
18
  */
21
- const BaseHyperlinkMixin: <T extends MixinConstructor<LitElement>>(superclass: T) => T & MixinConstructor<BaseHyperlinkInterface> = <T extends MixinConstructor<LitElement>>(superclass: T) => {
22
- // Naming the class (BaseHyperlinkElement) instead of using 'Mixin' or anonymous
19
+ const NativeHyperlinkMixin: <T extends MixinConstructor<LitElement>>(
20
+ superclass: T,
21
+ ) => T & MixinConstructor<NativeHyperlinkInterface> = <
22
+ T extends MixinConstructor<LitElement>,
23
+ >(
24
+ superclass: T,
25
+ ) => {
26
+ // Naming the class (BaseHyperlinkElement) instead of using 'Mixin' or anonymous
23
27
  // prevents the "__childPart" visibility error.
24
- class BaseHyperlinkElement extends superclass implements BaseHyperlinkInterface {
28
+ class BaseHyperlinkElement
29
+ extends superclass
30
+ implements NativeHyperlinkInterface
31
+ {
25
32
  /**
26
33
  * The URL that the hyperlink points to. When set, the component renders as an `<a>` element.
27
34
  * Maps to the native `href` attribute.
@@ -53,16 +60,9 @@ const BaseHyperlinkMixin: <T extends MixinConstructor<LitElement>>(superclass: T
53
60
  */
54
61
  @property()
55
62
  download?: string;
56
-
57
- /**
58
- * Returns `true` when `href` is set, indicating the component should render as a link.
59
- */
60
- __isLink(): boolean {
61
- return !!this.href;
62
- }
63
63
  }
64
64
 
65
- return BaseHyperlinkElement as T & MixinConstructor<BaseHyperlinkInterface>;
65
+ return BaseHyperlinkElement as T & MixinConstructor<NativeHyperlinkInterface>;
66
66
  };
67
67
 
68
- export default BaseHyperlinkMixin;
68
+ export default NativeHyperlinkMixin;
@@ -0,0 +1,3 @@
1
+ export function isLink(element: any): boolean {
2
+ return element.href !== undefined;
3
+ }
@@ -20,19 +20,51 @@ export function observerSlotChangesWithCallback(
20
20
  slot: HTMLSlotElement | null,
21
21
  callback: (hasContent: boolean) => void,
22
22
  ) {
23
- const observer = new MutationObserver(() => {
24
- callback(hasMeaningfulContent(slot));
25
- });
26
-
27
- const assignedNodes = slot?.assignedNodes({ flatten: true }) || [];
28
- assignedNodes.forEach(node => {
29
- observer.observe(node, {
30
- attributes: true,
31
- childList: true,
32
- characterData: true,
33
- subtree: true,
23
+ if (!slot) return () => {};
24
+
25
+ // Keep track of observers for current assigned nodes so we can reconnect
26
+ let observers: MutationObserver[] = [];
27
+
28
+ const observeAssignedNodes = () => {
29
+ // disconnect previous observers
30
+ observers.forEach(o => o.disconnect());
31
+ observers = [];
32
+
33
+ const assigned = slot.assignedNodes({ flatten: true }) || [];
34
+ assigned.forEach(node => {
35
+ const obs = new MutationObserver(() => {
36
+ callback(hasMeaningfulContent(slot));
37
+ });
38
+ try {
39
+ obs.observe(node as Node, {
40
+ attributes: true,
41
+ childList: true,
42
+ characterData: true,
43
+ subtree: true,
44
+ });
45
+ observers.push(obs);
46
+ } catch (e) {
47
+ // ignore nodes that cannot be observed
48
+ }
34
49
  });
35
- });
36
50
 
37
- callback(hasMeaningfulContent(slot));
38
- }
51
+ // initial check
52
+ callback(hasMeaningfulContent(slot));
53
+ };
54
+
55
+ // When assigned nodes change (elements added/removed), the slot emits a slotchange
56
+ // event — re-run observer setup so we track the new nodes. This fixes the case
57
+ // where an element (e.g. <wc-icon>) is removed from light DOM: previously we
58
+ // only observed the old node and wouldn't detect its removal.
59
+ const onSlotChange = () => observeAssignedNodes();
60
+ slot.addEventListener('slotchange', onSlotChange);
61
+
62
+ // Start observing
63
+ observeAssignedNodes();
64
+
65
+ // Return a cleanup function so callers can disconnect observers when needed.
66
+ return () => {
67
+ observers.forEach(o => o.disconnect());
68
+ slot.removeEventListener('slotchange', onSlotChange);
69
+ };
70
+ }
@@ -152,7 +152,7 @@
152
152
  }
153
153
 
154
154
  .content-inner {
155
- padding: 0 var(--spacing-300) var(--spacing-200); // 0 24dp 16dp
155
+ padding: var(--spacing-200) var(--spacing-300);
156
156
  }
157
157
 
158
158
  .toggle-icon {
@@ -8,7 +8,6 @@ import styles from './accordion-item.scss';
8
8
  * @tag wc-accordion-item
9
9
  * @rawTag accordion-item
10
10
  * @summary An expansion panel with a header that reveals or hides associated content. Follows Material Design 3 expansion panel guidelines.
11
- * @parentRawTag accordion
12
11
  *
13
12
  * @slot - The body content revealed when the panel is expanded.
14
13
  * @slot heading - The panel title. Renders as `body-large` text.
@@ -8,7 +8,6 @@ import styles from './breadcrumb-item.scss';
8
8
  * @label Breadcrumb Item
9
9
  * @tag wc-breadcrumb-item
10
10
  * @rawTag breadcrumb-item
11
- * @parentRawTag breadcrumb
12
11
  * @summary A breadcrumb item component that represents a single item in a breadcrumb navigation.
13
12
  * @tags navigation
14
13
  *
@@ -0,0 +1 @@
1
+ export const DISABLED_REASON_ID = 'button-disabled-reason';
@@ -0,0 +1,4 @@
1
+ export type GroupButtonInterface = {
2
+ color?: any;
3
+ variant?: any;
4
+ };
@@ -20,8 +20,8 @@
20
20
 
21
21
  @mixin _button-color-toggle-unselected($color) {
22
22
 
23
- --filled-button-container-color: var(--color-surface-container);
24
- --filled-button-label-text-color: var(--color-surface-container-variant);
23
+ --filled-button-container-color: var(--color-surface-container-high);
24
+ --filled-button-label-text-color: var(--color-on-surface);
25
25
 
26
26
  --tonal-button-container-color: var(--color-#{$color}-container);
27
27
  --tonal-button-label-text-color: var(--color-on-#{$color}-container);