@momentum-design/components 0.103.3 → 0.104.1

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.
@@ -24,15 +24,19 @@ import Component from '../../components/button';
24
24
  * - **Pill button**: A button that contains text value. Commonly used for call to action, tags, or filters.
25
25
  * - **Pill button with icons**: A button containing an icon either on the left or right side of the button.
26
26
  * - **Icon button**: A button represented by just an icon without any text.
27
- * The type of button is inferred based on the presence of slot and/or prefix and postfix icons.
27
+ * The type of button is inferred based on the presence of slot and/or prefix and postfix icons/slots.
28
28
  *
29
29
  * @dependency mdc-icon
30
30
  *
31
31
  * @tagname mdc-button
32
32
  *
33
33
  * @slot - Text label of the button.
34
+ * @slot prefix - Content to be displayed before the text label.
35
+ * @slot postfix - Content to be displayed after the text label.
34
36
  *
35
37
  * @csspart button-text - Text label of the button, passed in default slot
38
+ * @csspart prefix - Content before the text label, passed in `prefix` slot
39
+ * @csspart postfix - Content after the text label, passed in `postfix` slot
36
40
  */
37
41
  declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {
38
42
  onClick: EventName<MouseEvent>;
@@ -26,15 +26,19 @@ import { TAG_NAME } from '../../components/button/button.constants';
26
26
  * - **Pill button**: A button that contains text value. Commonly used for call to action, tags, or filters.
27
27
  * - **Pill button with icons**: A button containing an icon either on the left or right side of the button.
28
28
  * - **Icon button**: A button represented by just an icon without any text.
29
- * The type of button is inferred based on the presence of slot and/or prefix and postfix icons.
29
+ * The type of button is inferred based on the presence of slot and/or prefix and postfix icons/slots.
30
30
  *
31
31
  * @dependency mdc-icon
32
32
  *
33
33
  * @tagname mdc-button
34
34
  *
35
35
  * @slot - Text label of the button.
36
+ * @slot prefix - Content to be displayed before the text label.
37
+ * @slot postfix - Content to be displayed after the text label.
36
38
  *
37
39
  * @csspart button-text - Text label of the button, passed in default slot
40
+ * @csspart prefix - Content before the text label, passed in `prefix` slot
41
+ * @csspart postfix - Content after the text label, passed in `postfix` slot
38
42
  */
39
43
  const reactWrapper = createComponent({
40
44
  tagName: TAG_NAME,
@@ -12,10 +12,10 @@ export { default as Bullet } from './bullet';
12
12
  export { default as Button } from './button';
13
13
  export { default as ButtonGroup } from './buttongroup';
14
14
  export { default as ButtonLink } from './buttonlink';
15
- export { default as Buttonsimple } from './buttonsimple';
16
- export { default as Card } from './card';
17
15
  export { default as CardButton } from './cardbutton';
18
16
  export { default as CardCheckbox } from './cardcheckbox';
17
+ export { default as Card } from './card';
18
+ export { default as Buttonsimple } from './buttonsimple';
19
19
  export { default as CardRadio } from './cardradio';
20
20
  export { default as Checkbox } from './checkbox';
21
21
  export { default as Chip } from './chip';
@@ -74,5 +74,5 @@ export { default as Toast } from './toast';
74
74
  export { default as Toggle } from './toggle';
75
75
  export { default as ToggleTip } from './toggletip';
76
76
  export { default as Tooltip } from './tooltip';
77
- export { default as Typewriter } from './typewriter';
78
77
  export { default as VirtualizedList } from './virtualizedlist';
78
+ export { default as Typewriter } from './typewriter';
@@ -12,10 +12,10 @@ export { default as Bullet } from './bullet';
12
12
  export { default as Button } from './button';
13
13
  export { default as ButtonGroup } from './buttongroup';
14
14
  export { default as ButtonLink } from './buttonlink';
15
- export { default as Buttonsimple } from './buttonsimple';
16
- export { default as Card } from './card';
17
15
  export { default as CardButton } from './cardbutton';
18
16
  export { default as CardCheckbox } from './cardcheckbox';
17
+ export { default as Card } from './card';
18
+ export { default as Buttonsimple } from './buttonsimple';
19
19
  export { default as CardRadio } from './cardradio';
20
20
  export { default as Checkbox } from './checkbox';
21
21
  export { default as Chip } from './chip';
@@ -74,5 +74,5 @@ export { default as Toast } from './toast';
74
74
  export { default as Toggle } from './toggle';
75
75
  export { default as ToggleTip } from './toggletip';
76
76
  export { default as Tooltip } from './tooltip';
77
- export { default as Typewriter } from './typewriter';
78
77
  export { default as VirtualizedList } from './virtualizedlist';
78
+ export { default as Typewriter } from './typewriter';
@@ -74,13 +74,20 @@ export const ButtonComponentMixin = (superClass) => {
74
74
  * @param slot - default slot of button
75
75
  */
76
76
  inferButtonType() {
77
- var _a, _b;
78
- const slot = (_b = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot')) === null || _b === void 0 ? void 0 : _b.assignedNodes().filter(node => { var _a; return node.nodeType !== Node.TEXT_NODE || ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim()); }).length;
79
- if (slot && (this.prefixIcon || this.postfixIcon)) {
77
+ var _a, _b, _c, _d, _e, _f;
78
+ // Check for text content in the default slot
79
+ const defaultSlot = (_b = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot:not([name])')) === null || _b === void 0 ? void 0 : _b.assignedNodes().filter(node => { var _a; return node.nodeType !== Node.TEXT_NODE || ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim()); }).length;
80
+ // Check for prefix content (either icon property or slot content)
81
+ const prefixSlot = (_d = (_c = this.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('slot[name="prefix"]')) === null || _d === void 0 ? void 0 : _d.assignedNodes().filter(node => { var _a; return node.nodeType !== Node.TEXT_NODE || ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim()); }).length;
82
+ const hasPrefix = this.prefixIcon || (prefixSlot && prefixSlot > 0);
83
+ // Check for postfix content (either icon property or slot content)
84
+ const postfixSlot = (_f = (_e = this.shadowRoot) === null || _e === void 0 ? void 0 : _e.querySelector('slot[name="postfix"]')) === null || _f === void 0 ? void 0 : _f.assignedNodes().filter(node => { var _a; return node.nodeType !== Node.TEXT_NODE || ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim()); }).length;
85
+ const hasPostfix = this.postfixIcon || (postfixSlot && postfixSlot > 0);
86
+ if (defaultSlot && (hasPrefix || hasPostfix)) {
80
87
  this.typeInternal = BUTTON_TYPE_INTERNAL.PILL_WITH_ICON;
81
88
  this.setAttribute('data-btn-type', 'pill-with-icon');
82
89
  }
83
- else if (!slot && (this.prefixIcon || this.postfixIcon)) {
90
+ else if (!defaultSlot && (hasPrefix || hasPostfix)) {
84
91
  this.typeInternal = BUTTON_TYPE_INTERNAL.ICON;
85
92
  this.setAttribute('data-btn-type', 'icon');
86
93
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@momentum-design/components",
3
3
  "packageManager": "yarn@3.2.4",
4
- "version": "0.103.3",
4
+ "version": "0.104.1",
5
5
  "engines": {
6
6
  "node": ">=20.0.0",
7
7
  "npm": ">=8.0.0"