design-system-next 1.15.13 → 1.15.14

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.
Binary file
package/dist/main.css.gz CHANGED
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "design-system-next",
3
3
  "private": false,
4
- "version": "1.15.13",
4
+ "version": "1.15.14",
5
5
  "main": "./dist/design-system-next.js",
6
6
  "module": "./dist/design-system-next.js",
7
7
  "repository": {
package/src/App.vue CHANGED
@@ -1,65 +1,3 @@
1
1
  <template>
2
- <spr-dropdown id="sample-dropdown" :menu-list="menuList" @infinite-scroll-trigger="handleInfiniteScrollTrigger">
3
- <spr-input v-model="inputTextModel" label="Dropdown Label" placeholder="Select item..." readonly />
4
- </spr-dropdown>
2
+ <div>Test Component Here</div>
5
3
  </template>
6
-
7
- <script lang="ts" setup>
8
- import { ref } from 'vue';
9
-
10
- import SprDropdown from '@/components/dropdown/dropdown.vue';
11
- import SprInput from '@/components/input/input.vue';
12
-
13
- const inputTextModel = ref('');
14
-
15
- const menuList = ref([
16
- { text: 'Apple', value: 'apple' },
17
- { text: 'Banana', value: 'banana' },
18
- { text: 'Cherry', value: 'cherry' },
19
- ]);
20
-
21
- const pagination = ref({
22
- totalpages: 10,
23
- currentPage: 1,
24
- });
25
-
26
- const handleInfiniteScrollTrigger = () => {
27
- if (pagination.value.currentPage === pagination.value.totalpages) return;
28
-
29
- pagination.value.currentPage += 1;
30
-
31
- // For testing purposes only
32
- const fastFoodItems = [
33
- 'Burger',
34
- 'Pizza',
35
- 'Fries',
36
- 'Hot Dog',
37
- 'Sandwich',
38
- 'Tacos',
39
- 'Chicken Wings',
40
- 'Chicken Nuggets',
41
- 'Wrap',
42
- 'Pasta',
43
- 'Onion Rings',
44
- 'Shakes',
45
- 'Fried Chicken',
46
- 'Salad',
47
- 'Milkshake',
48
- 'Mozzarella Sticks',
49
- 'Popcorn Chicken',
50
- 'Bagel',
51
- 'Quesadilla',
52
- 'Breakfast Burrito',
53
- ];
54
-
55
- // For testing purposes only
56
- for (let i = 0; i < 10; i++) {
57
- const randomFood = fastFoodItems[Math.floor(Math.random() * fastFoodItems.length)];
58
-
59
- menuList.value.push({
60
- text: randomFood,
61
- value: randomFood.toLowerCase().replace(' ', '_'),
62
- });
63
- }
64
- };
65
- </script>
@@ -1,8 +1,14 @@
1
1
  <template>
2
2
  <div :class="collapsibleClasses.container">
3
3
  <slot name="trigger" :toggle-collapsible="toggleCollapsible" />
4
- <Transition @before-enter="onBeforeEnter" @enter="onEnter" @leave="onLeave">
5
- <div v-if="modelValue" ref="contentRef" :style="contentStyle">
4
+ <Transition
5
+ :css="false"
6
+ @before-enter="onBeforeEnter"
7
+ @enter="onEnter"
8
+ @before-leave="onBeforeLeave"
9
+ @leave="onLeave"
10
+ >
11
+ <div v-show="modelValue" :style="contentStyle">
6
12
  <slot />
7
13
  </div>
8
14
  </Transition>
@@ -17,8 +23,6 @@ import { useCollapsible } from './use-collapsible';
17
23
  const props = defineProps(collapsiblePropTypes);
18
24
  const emit = defineEmits(collapsibleEmitTypes);
19
25
 
20
- const { collapsibleClasses, contentStyle, toggleCollapsible, onBeforeEnter, onEnter, onLeave } = useCollapsible(
21
- props,
22
- emit,
23
- );
26
+ const { collapsibleClasses, contentStyle, toggleCollapsible, onBeforeEnter, onEnter, onBeforeLeave, onLeave } =
27
+ useCollapsible(props, emit);
24
28
  </script>
@@ -1,4 +1,4 @@
1
- import { computed, toRefs, nextTick, SetupContext } from 'vue';
1
+ import { computed, toRefs, nextTick, type SetupContext } from 'vue';
2
2
  import type { CollapsibleProps, CollapsibleEmitTypes } from './collapsible';
3
3
 
4
4
  export const useCollapsible = (props: CollapsibleProps, emit: SetupContext<CollapsibleEmitTypes>['emit']) => {
@@ -9,7 +9,8 @@ export const useCollapsible = (props: CollapsibleProps, emit: SetupContext<Colla
9
9
  }));
10
10
 
11
11
  const contentStyle = computed(() => ({
12
- transition: `max-height ${transitionDuration.value}ms ease-in-out, opacity ${transitionDuration.value}ms ease-in-out`,
12
+ overflow: 'hidden',
13
+ transition: `max-height ${transitionDuration.value}ms ease-in-out`,
13
14
  }));
14
15
 
15
16
  const toggleCollapsible = () => {
@@ -17,25 +18,29 @@ export const useCollapsible = (props: CollapsibleProps, emit: SetupContext<Colla
17
18
  };
18
19
 
19
20
  const onBeforeEnter = (el: Element) => {
20
- const element = el as HTMLElement;
21
- element.style.maxHeight = '0px';
22
- element.style.opacity = '0';
21
+ (el as HTMLElement).style.maxHeight = '0px';
23
22
  };
24
23
 
25
24
  const onEnter = async (el: Element, done: () => void) => {
26
25
  await nextTick();
27
26
  const element = el as HTMLElement;
28
- element.style.transition = `max-height ${transitionDuration.value}ms ease-in-out, opacity ${transitionDuration.value}ms ease-in-out`;
29
27
  element.style.maxHeight = `${element.scrollHeight}px`;
30
- element.style.opacity = '1';
31
- setTimeout(done, transitionDuration.value);
28
+ setTimeout(() => {
29
+ element.style.maxHeight = ''; // clear inline style after transition
30
+ done();
31
+ }, transitionDuration.value);
32
+ };
33
+
34
+ const onBeforeLeave = (el: Element) => {
35
+ const element = el as HTMLElement;
36
+ element.style.maxHeight = `${element.scrollHeight}px`;
32
37
  };
33
38
 
34
39
  const onLeave = (el: Element, done: () => void) => {
35
40
  const element = el as HTMLElement;
36
- element.style.transition = `max-height ${transitionDuration.value}ms ease-in-out, opacity ${transitionDuration.value}ms ease-in-out`;
41
+ // Force reflow
42
+ void element.offsetHeight;
37
43
  element.style.maxHeight = '0px';
38
- element.style.opacity = '0';
39
44
  setTimeout(done, transitionDuration.value);
40
45
  };
41
46
 
@@ -45,6 +50,7 @@ export const useCollapsible = (props: CollapsibleProps, emit: SetupContext<Colla
45
50
  toggleCollapsible,
46
51
  onBeforeEnter,
47
52
  onEnter,
53
+ onBeforeLeave,
48
54
  onLeave,
49
55
  };
50
56
  };