@fluid-topics/ft-reorderable-list 1.3.45 → 1.3.46

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.
@@ -11,7 +11,7 @@ import { repeat } from "lit/directives/repeat.js";
11
11
  import { live } from "lit/directives/live.js";
12
12
  import { DesignSystemFamily, DesignSystemSize, FtLitElement } from "@fluid-topics/ft-wc-utils";
13
13
  import { styles } from "./ftds-reorderable-list.styles";
14
- import { FtTypography, FtTypographyVariants } from "@fluid-topics/ft-typography";
14
+ import { FtdsTypography, FtdsTypographyVariants } from "@fluid-topics/ft-typography";
15
15
  import { FtdsButton } from "@fluid-topics/ft-button";
16
16
  import { FtIcon, FtIcons } from "@fluid-topics/ft-icon";
17
17
  import { FtdsNotice } from "@fluid-topics/ft-notice";
@@ -30,9 +30,9 @@ class FtdsReorderableList extends FtLitElement {
30
30
  <div class="ftds-reorderable-list--container">
31
31
  <ol role="listbox"
32
32
  aria-activedescendant=""
33
- @dragstart="${this.onDragStart}"
34
- @dragover="${this.onDragOver}"
35
- @dragend="${this.onDragEnd}">
33
+ @dragstart=${this.onDragStart}
34
+ @dragover=${this.onDragOver}
35
+ @dragend=${this.onDragEnd}>
36
36
  ${this.items.length > 0 ? repeat(this.items, (item) => live(item.id), (item) => {
37
37
  return html `
38
38
  <li role="option"
@@ -49,23 +49,23 @@ class FtdsReorderableList extends FtLitElement {
49
49
  </div>
50
50
  <div class="ftds-reorderable-list-item--right">
51
51
  ${this.editable ? html `
52
- <ftds-button icon=${FtIcons.ADMIN}
52
+ <ftds-button icon="${FtIcons.ADMIN}"
53
53
  family="${DesignSystemFamily.brand}"
54
54
  size="${DesignSystemSize.large}"
55
- @click="${() => this.dispatchEvent(new EditItemEvent(item.id))}"
55
+ @click=${() => this.dispatchEvent(new EditItemEvent(item.id))}
56
56
  ></ftds-button>
57
57
  ` : nothing}
58
58
  ${this.removable ? html `
59
- <ftds-button icon=${FtIcons.TRASH}
59
+ <ftds-button icon="${FtIcons.TRASH}"
60
60
  family="${DesignSystemFamily.brand}"
61
61
  size="${DesignSystemSize.large}"
62
- @click="${() => this.dispatchEvent(new RemoveItemEvent(item.id))}"
62
+ @click=${() => this.dispatchEvent(new RemoveItemEvent(item.id))}
63
63
  ></ftds-button>
64
64
  ` : nothing}
65
65
  </div>
66
66
  </li>`;
67
67
  }) : html `
68
- <ft-typography variant="${FtTypographyVariants.body2semibold}">${this.emptyListMessage}</ft-typography>`}
68
+ <ftds-typography variant="${FtdsTypographyVariants.body2semibold}">${this.emptyListMessage}</ftds-typography>`}
69
69
  </ol>
70
70
  <slot part="actions"></slot>
71
71
  </div>
@@ -79,27 +79,27 @@ class FtdsReorderableList extends FtLitElement {
79
79
  size="${DesignSystemSize.medium}"
80
80
  data-item-id="${item.id}"
81
81
  tabindex="1"
82
- @keydown="${this.onDragButtonKeyDown}"
83
- @focus="${(event) => {
82
+ @keydown=${this.onDragButtonKeyDown}
83
+ @focus=${(event) => {
84
84
  var _a;
85
- let selected = this.getSelectedOption(event);
85
+ const selected = this.getSelectedOption(event);
86
86
  selected.setAttribute("aria-selected", "true");
87
87
  (_a = this.list) === null || _a === void 0 ? void 0 : _a.setAttribute("aria-activedescendant", `option-${item.id}`);
88
- }}"
89
- @focusout="${(event) => {
88
+ }}
89
+ @focusout=${(event) => {
90
90
  var _a;
91
- let selected = this.getSelectedOption(event);
91
+ const selected = this.getSelectedOption(event);
92
92
  selected.setAttribute("aria-selected", "false");
93
93
  (_a = this.list) === null || _a === void 0 ? void 0 : _a.setAttribute("aria-activedescendant", "");
94
- }}"
95
- @click="${(e) => {
94
+ }}
95
+ @click=${(e) => {
96
96
  e.target.focus();
97
- }}"
97
+ }}
98
98
 
99
99
  ></ft-icon>
100
- <ft-typography variant="${FtTypographyVariants.body2semibold}">
100
+ <ftds-typography variant="${FtdsTypographyVariants.body2semibold}">
101
101
  ${item.label}
102
- </ft-typography>
102
+ </ftds-typography>
103
103
  `;
104
104
  }
105
105
  renderItemLeftActions(item) {
@@ -112,7 +112,7 @@ class FtdsReorderableList extends FtLitElement {
112
112
  family="${DesignSystemFamily.neutral}"
113
113
  size="${DesignSystemSize.large}"
114
114
  label="${ifDefined(action.label)}"
115
- @click="${action.run}">
115
+ @click=${action.run}>
116
116
  ${ifDefined(action.text)}
117
117
  </ftds-button>
118
118
  `)}
@@ -152,7 +152,7 @@ class FtdsReorderableList extends FtLitElement {
152
152
  }
153
153
  async keepFocusOnItem(itemId) {
154
154
  await this.updateComplete;
155
- let gripButton = this.shadowRoot.querySelector(`ft-icon[data-item-id="${itemId}"]`);
155
+ const gripButton = this.shadowRoot.querySelector(`ft-icon[data-item-id="${itemId}"]`);
156
156
  gripButton.classList.add("dragging");
157
157
  gripButton.focus();
158
158
  }
@@ -183,7 +183,7 @@ class FtdsReorderableList extends FtLitElement {
183
183
  event.preventDefault();
184
184
  const draggingOverItem = this.getDragAfterElement(this.list, event.clientY);
185
185
  this.draggingItem.style.cursor = "grabbing";
186
- (_a = this.draggableItems) === null || _a === void 0 ? void 0 : _a.forEach(item => item.classList.remove("over"));
186
+ (_a = this.draggableItems) === null || _a === void 0 ? void 0 : _a.forEach((item) => item.classList.remove("over"));
187
187
  if (draggingOverItem) {
188
188
  this.list.insertBefore(this.draggingItem, draggingOverItem);
189
189
  }
@@ -195,14 +195,14 @@ class FtdsReorderableList extends FtLitElement {
195
195
  var _a;
196
196
  this.syncReferenceList();
197
197
  event.target.classList.remove("dragging");
198
- (_a = this.draggableItems) === null || _a === void 0 ? void 0 : _a.forEach(item => item.classList.remove("over"));
198
+ (_a = this.draggableItems) === null || _a === void 0 ? void 0 : _a.forEach((item) => item.classList.remove("over"));
199
199
  this.draggingItem.remove();
200
200
  this.draggingItem = undefined;
201
201
  this.dispatchEvent(new OrderChangeEvent());
202
202
  }
203
203
  syncReferenceList() {
204
- let newOrder = [...this.dragGrips].map((e) => e.dataset.itemId);
205
- this.items = newOrder.map(id => this.items.find(item => item.id === id));
204
+ const newOrder = [...this.dragGrips].map((e) => e.dataset.itemId);
205
+ this.items = newOrder.map((id) => this.items.find((item) => item.id === id));
206
206
  }
207
207
  getDragAfterElement(container, y) {
208
208
  const draggableElements = [...this.notDraggedItems];
@@ -219,24 +219,24 @@ class FtdsReorderableList extends FtLitElement {
219
219
  }
220
220
  moveFocusToPreviousItem(itemIndex) {
221
221
  if (itemIndex > 0) {
222
- let buttonToFocus = this.dragGrips[itemIndex - 1];
222
+ const buttonToFocus = this.dragGrips[itemIndex - 1];
223
223
  buttonToFocus === null || buttonToFocus === void 0 ? void 0 : buttonToFocus.focus();
224
224
  }
225
225
  }
226
226
  moveFocusToNextItem(itemIndex) {
227
227
  if (itemIndex < this.items.length - 1) {
228
- let buttonToFocus = this.dragGrips[itemIndex + 1];
228
+ const buttonToFocus = this.dragGrips[itemIndex + 1];
229
229
  buttonToFocus === null || buttonToFocus === void 0 ? void 0 : buttonToFocus.focus();
230
230
  }
231
231
  }
232
232
  getSelectedOption(event) {
233
- let target = event.target;
233
+ const target = event.target;
234
234
  const itemId = target.dataset.itemId;
235
235
  return [...this.draggableItems].find((e) => e.id === itemId);
236
236
  }
237
237
  }
238
238
  FtdsReorderableList.elementDefinitions = {
239
- "ft-typography": FtTypography,
239
+ "ftds-typography": FtdsTypography,
240
240
  "ftds-button": FtdsButton,
241
241
  "ft-icon": FtIcon,
242
242
  "ftds-notice": FtdsNotice,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reorderable-list",
3
- "version": "1.3.45",
3
+ "version": "1.3.46",
4
4
  "description": "An reorderable list component",
5
5
  "keywords": [
6
6
  "Lit"
@@ -20,11 +20,11 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@fluid-topics/design-system-variables": "2.53.1",
23
- "@fluid-topics/ft-wc-utils": "1.3.45",
23
+ "@fluid-topics/ft-wc-utils": "1.3.46",
24
24
  "lit": "3.1.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@fluid-topics/ft-wc-test-utils": "1.3.45"
27
+ "@fluid-topics/ft-wc-test-utils": "1.3.46"
28
28
  },
29
- "gitHead": "3fd3d1375535575f012653afcbcb81dc3c25b7c7"
29
+ "gitHead": "d6cf25d6ed0dead8c7aff4f94a493c35d12f1392"
30
30
  }