vueless 1.4.12-beta.0 → 1.4.12-beta.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "1.4.12-beta.0",
3
+ "version": "1.4.12-beta.2",
4
4
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
5
5
  "author": "Johnny Grid <hello@vueless.com> (https://vueless.com)",
6
6
  "homepage": "https://vueless.com",
@@ -59,7 +59,7 @@
59
59
  "@vue/eslint-config-typescript": "^14.7.0",
60
60
  "@vue/test-utils": "^2.4.8",
61
61
  "@vue/tsconfig": "^0.9.1",
62
- "@vueless/storybook": "^1.7.0",
62
+ "@vueless/storybook": "^1.7.3",
63
63
  "eslint": "^10.2.1",
64
64
  "eslint-plugin-storybook": "^10.3.5",
65
65
  "eslint-plugin-tailwindcss": "^4.0.0-alpha.7",
@@ -129,6 +129,9 @@ const {
129
129
  :animation="animationDuration"
130
130
  :ghost-class="config.draggableGhost"
131
131
  :drag-class="config.draggableDrag"
132
+ :force-fallback="forceFallback"
133
+ :fallback-on-body="fallbackOnBody"
134
+ :fallback-class="fallbackClass"
132
135
  v-bind="draggableAttrs"
133
136
  :data-test="getDataTest()"
134
137
  @end="onDragEnd"
@@ -55,6 +55,9 @@ export default /*tw*/ {
55
55
  labelKey: "label",
56
56
  valueKey: "value",
57
57
  animationDuration: 200,
58
+ forceFallback: false,
59
+ fallbackOnBody: false,
60
+ fallbackClass: "sortable-fallback",
58
61
  /* icons */
59
62
  dragIcon: "drag_indicator",
60
63
  },
@@ -118,6 +118,22 @@ Nesting.args = {
118
118
  export const Sizes = EnumTemplate.bind({});
119
119
  Sizes.args = { enum: "size" };
120
120
 
121
+ export const ForceFallback = DefaultTemplate.bind({});
122
+ ForceFallback.args = {
123
+ forceFallback: true,
124
+ fallbackOnBody: true,
125
+ fallbackClass: "sortable-fallback",
126
+ };
127
+ ForceFallback.parameters = {
128
+ docs: {
129
+ description: {
130
+ story:
131
+ // eslint-disable-next-line vue/max-len
132
+ "Use `forceFallback` to drag with Sortable's JS fallback instead of native HTML5 DnD (browsers force translucency on native drag images). Pair with `fallbackOnBody` when the list sits inside an `overflow: hidden` container, and `fallbackClass` to style the floating clone.",
133
+ },
134
+ },
135
+ };
136
+
121
137
  export const LabelSlot = DefaultTemplate.bind({});
122
138
  LabelSlot.args = {
123
139
  slotTemplate: `
@@ -162,6 +162,83 @@ describe("UDataList.vue", () => {
162
162
  expect(draggableComponent.vm.$attrs.animation).toBe(animationDuration);
163
163
  });
164
164
 
165
+ it("Force Fallback – passes forceFallback to draggable", () => {
166
+ const component = mount(UDataList, {
167
+ props: {
168
+ list: defaultList,
169
+ forceFallback: true,
170
+ },
171
+ });
172
+
173
+ const draggableComponent = component.findComponent(draggable);
174
+
175
+ expect(draggableComponent.vm.$attrs["force-fallback"]).toBe(true);
176
+ });
177
+
178
+ it("Force Fallback – defaults to false", () => {
179
+ const component = mount(UDataList, {
180
+ props: {
181
+ list: defaultList,
182
+ },
183
+ });
184
+
185
+ const draggableComponent = component.findComponent(draggable);
186
+
187
+ expect(draggableComponent.vm.$attrs["force-fallback"]).toBe(false);
188
+ });
189
+
190
+ it("Fallback On Body – passes fallbackOnBody to draggable", () => {
191
+ const component = mount(UDataList, {
192
+ props: {
193
+ list: defaultList,
194
+ fallbackOnBody: true,
195
+ },
196
+ });
197
+
198
+ const draggableComponent = component.findComponent(draggable);
199
+
200
+ expect(draggableComponent.vm.$attrs["fallback-on-body"]).toBe(true);
201
+ });
202
+
203
+ it("Fallback On Body – defaults to false", () => {
204
+ const component = mount(UDataList, {
205
+ props: {
206
+ list: defaultList,
207
+ },
208
+ });
209
+
210
+ const draggableComponent = component.findComponent(draggable);
211
+
212
+ expect(draggableComponent.vm.$attrs["fallback-on-body"]).toBe(false);
213
+ });
214
+
215
+ it("Fallback Class – passes fallbackClass to draggable", () => {
216
+ const fallbackClass = "custom-drag-fallback";
217
+
218
+ const component = mount(UDataList, {
219
+ props: {
220
+ list: defaultList,
221
+ fallbackClass,
222
+ },
223
+ });
224
+
225
+ const draggableComponent = component.findComponent(draggable);
226
+
227
+ expect(draggableComponent.vm.$attrs["fallback-class"]).toBe(fallbackClass);
228
+ });
229
+
230
+ it("Fallback Class – defaults to sortable-fallback", () => {
231
+ const component = mount(UDataList, {
232
+ props: {
233
+ list: defaultList,
234
+ },
235
+ });
236
+
237
+ const draggableComponent = component.findComponent(draggable);
238
+
239
+ expect(draggableComponent.vm.$attrs["fallback-class"]).toBe("sortable-fallback");
240
+ });
241
+
165
242
  it("Nesting – renders nested items when children array is present", async () => {
166
243
  const component = mount(UDataList, {
167
244
  props: {
@@ -49,6 +49,21 @@ export interface Props {
49
49
  */
50
50
  animationDuration?: number;
51
51
 
52
+ /**
53
+ * Sortable JS fallback (instead of native HTML5 DnD).
54
+ */
55
+ forceFallback?: boolean;
56
+
57
+ /**
58
+ * Append the fallback drag clone to document.body.
59
+ */
60
+ fallbackOnBody?: boolean;
61
+
62
+ /**
63
+ * CSS class for the Sortable fallback drag clone (forceFallback mode).
64
+ */
65
+ fallbackClass?: string;
66
+
52
67
  /**
53
68
  * Disable empty state for nested elements if empty (internal props).
54
69
  * @ignore