@limetech/lime-elements 34.1.0-next.25 → 34.1.0-next.26

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.
@@ -55,6 +55,7 @@ export class ListRenderer {
55
55
  'mdc-deprecated-list-item': true,
56
56
  'mdc-deprecated-list-item--disabled': item.disabled,
57
57
  'mdc-deprecated-list-item--selected': item.selected,
58
+ 'has-primary-component': this.hasPrimaryComponent(item),
58
59
  };
59
60
  const attributes = {};
60
61
  if (index === this.applyTabIndexToItemAtIndex) {
@@ -62,10 +63,15 @@ export class ListRenderer {
62
63
  }
63
64
  return (h("li", Object.assign({ class: classNames, "aria-disabled": item.disabled ? 'true' : 'false', "aria-selected": item.selected ? 'true' : 'false', "data-index": index }, attributes),
64
65
  item.icon ? this.renderIcon(this.config, item) : null,
66
+ this.getPrimaryComponent(item),
65
67
  this.renderText(item),
66
68
  this.twoLines && this.avatarList ? this.renderDivider() : null,
67
69
  this.renderActionMenu(item.actions)));
68
70
  };
71
+ this.hasPrimaryComponent = (item) => {
72
+ var _a;
73
+ return !!((_a = item === null || item === void 0 ? void 0 : item.primaryComponent) === null || _a === void 0 ? void 0 : _a.name);
74
+ };
69
75
  /**
70
76
  * Render the text of the list item
71
77
  *
@@ -135,6 +141,7 @@ export class ListRenderer {
135
141
  'mdc-deprecated-list-item': true,
136
142
  'mdc-deprecated-list-item--disabled': item.disabled,
137
143
  'mdc-deprecated-list-item__text': !item.secondaryText,
144
+ 'has-primary-component': this.hasPrimaryComponent(item),
138
145
  };
139
146
  const attributes = {};
140
147
  if (index === this.applyTabIndexToItemAtIndex) {
@@ -146,12 +153,14 @@ export class ListRenderer {
146
153
  if (this.hasIcons) {
147
154
  return [
148
155
  item.icon ? this.renderIcon(config, item) : null,
156
+ this.getPrimaryComponent(item),
149
157
  this.renderText(item),
150
158
  h("div", { class: "mdc-deprecated-list-item__meta" }, itemTemplate),
151
159
  ];
152
160
  }
153
161
  return [
154
162
  h("div", { class: "mdc-deprecated-list-item__graphic" }, itemTemplate),
163
+ this.getPrimaryComponent(item),
155
164
  this.renderText(item),
156
165
  ];
157
166
  };
@@ -191,4 +200,12 @@ export class ListRenderer {
191
200
  };
192
201
  return (h("ul", { class: classNames, role: role, "aria-orientation": "vertical" }, items.map(this.renderListItem)));
193
202
  }
203
+ getPrimaryComponent(item) {
204
+ if (!this.hasPrimaryComponent(item)) {
205
+ return;
206
+ }
207
+ const PrimaryComponent = item.primaryComponent.name;
208
+ const props = item.primaryComponent.props;
209
+ return h(PrimaryComponent, Object.assign({}, props));
210
+ }
194
211
  }
@@ -3146,6 +3146,9 @@ a.mdc-list-item {
3146
3146
  align-self: center;
3147
3147
  width: 100%;
3148
3148
  }
3149
+ .mdc-deprecated-list .has-primary-component .mdc-deprecated-list-item__text {
3150
+ margin-left: 0.5rem;
3151
+ }
3149
3152
  .mdc-deprecated-list .mdc-deprecated-list-item__primary-command-text {
3150
3153
  display: flex;
3151
3154
  flex-direction: row;
@@ -18,6 +18,7 @@ const { ACTION_EVENT } = listStrings;
18
18
  * @exampleComponent limel-example-list-striped
19
19
  * @exampleComponent limel-example-list-badge-icons-with-multiple-lines
20
20
  * @exampleComponent limel-example-list-grid
21
+ * @exampleComponent limel-example-list-primary-component
21
22
  */
22
23
  export class List {
23
24
  constructor() {
@@ -3152,6 +3152,9 @@ a.mdc-list-item {
3152
3152
  align-self: center;
3153
3153
  width: 100%;
3154
3154
  }
3155
+ .mdc-deprecated-list .has-primary-component .mdc-deprecated-list-item__text {
3156
+ margin-left: 0.5rem;
3157
+ }
3155
3158
  .mdc-deprecated-list .mdc-deprecated-list-item__primary-command-text {
3156
3159
  display: flex;
3157
3160
  flex-direction: row;