@designcrowd/fe-shared-lib 1.0.4 → 1.0.6

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": "@designcrowd/fe-shared-lib",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "scripts": {
5
5
  "start": "npm run storybook",
6
6
  "build": "npm run build:css --production",
@@ -5,7 +5,7 @@
5
5
  :class="[elementClasses, disabled && 'tw-opacity-40 tw-cursor-not-allowed']"
6
6
  @click="() => !disabled && onToggleMenu()"
7
7
  >
8
- <div class="tw-text-left tw-flex-auto tw-pl-3">
8
+ <div class="tw-text-left tw-flex-auto tw-pl-3 tw-truncate">
9
9
  <slot name="title">
10
10
  {{ title }}
11
11
  </slot>
@@ -20,7 +20,7 @@
20
20
 
21
21
  <div
22
22
  v-show="isMenuVisible"
23
- class="tw-origin-top-right tw-absolute tw-left-0 tw-mt-2 tw-w-full tw-rounded-md tw-shadow-lg tw-bg-white tw-ring-1 tw-ring-black tw-ring-opacity-5"
23
+ class="tw-origin-top-right tw-absolute tw-left-0 tw-mt-2 tw-w-full tw-rounded-md tw-shadow-lg tw-bg-white tw-ring-1 tw-ring-black tw-ring-opacity-5 tw-z-20"
24
24
  :class="[
25
25
  menuElementClasses,
26
26
  {
@@ -72,7 +72,7 @@ export default {
72
72
  type: Boolean,
73
73
  required: false,
74
74
  default: false,
75
- }
75
+ },
76
76
  },
77
77
  data: () => ({
78
78
  isMenuVisible: false,
@@ -85,7 +85,7 @@ export default {
85
85
  watch: {
86
86
  show() {
87
87
  this.isMenuVisible = this.show;
88
- }
88
+ },
89
89
  },
90
90
  mounted() {
91
91
  this.isMenuVisible = this.show;
@@ -1,6 +1,8 @@
1
1
  <template>
2
- <div class="tw-flex tw-items-center tw-px-2 tw-py-2 drop-down-item tw-cursor-pointer" @click="onClick">
3
- <slot></slot>
2
+ <div>
3
+ <div class="tw-flex tw-items-center tw-px-2 tw-py-2 drop-down-item tw-cursor-pointer" @click="onClick">
4
+ <slot></slot>
5
+ </div>
4
6
  </div>
5
7
  </template>
6
8
  <script>
@@ -1,6 +1,5 @@
1
1
  <template>
2
2
  <path
3
3
  d="M8.58929 1.26673L12.0179 4.76844C12.3661 5.09673 12.3661 5.67123 12.0179 5.99951C11.6964 6.35515 11.1339 6.35515 10.8125 5.99951L8.85714 4.00244V9.74744C8.85714 10.2399 8.45536 10.6229 8 10.6229C7.51786 10.6229 7.14286 10.2399 7.14286 9.74744V4.00244L5.16071 5.99951C4.83929 6.35515 4.27679 6.35515 3.95536 5.99951C3.60714 5.67123 3.60714 5.09673 3.95536 4.76844L7.38393 1.26673C7.70536 0.911089 8.26786 0.911089 8.58929 1.26673ZM3.71429 10.6229V12.3737C3.71429 12.8661 4.08929 13.2491 4.57143 13.2491H11.4286C11.8839 13.2491 12.2857 12.8661 12.2857 12.3737V10.6229C12.2857 10.1578 12.6607 9.74744 13.1429 9.74744C13.5982 9.74744 14 10.1578 14 10.6229V12.3737C14 13.8236 12.8482 15 11.4286 15H4.57143C3.15179 15 2 13.8236 2 12.3737V10.6229C2 10.1578 2.375 9.74744 2.85714 9.74744C3.3125 9.74744 3.71429 10.1578 3.71429 10.6229Z"
4
- fill="black"
5
4
  />
6
5
  </template>
@@ -21,6 +21,7 @@
21
21
  <input
22
22
  :ref="numberStepperRef"
23
23
  class="tw-w-full tw-text-center tw-border tw-border-solid tw-border-secondary-200"
24
+ :class="inputClasses"
24
25
  type="text"
25
26
  :value="number"
26
27
  pattern="[0-9]"
@@ -97,6 +98,10 @@ export default {
97
98
  type: String,
98
99
  default: 'medium',
99
100
  },
101
+ inputClasses: {
102
+ type: String,
103
+ default: undefined,
104
+ },
100
105
  },
101
106
  setup(props) {
102
107
  const numberStepperRef = `js-number-stepper-${props.id}`;
@@ -106,6 +111,7 @@ export default {
106
111
  return {
107
112
  num: null,
108
113
  longPress: null,
114
+ longPressDelayTimeout: null,
109
115
  longPressTimeout: null,
110
116
  longPressInterval: null,
111
117
  };
@@ -140,6 +146,7 @@ export default {
140
146
  },
141
147
  },
142
148
  created() {
149
+ this.DELAY_BEFORE_LONG_PRESS_START = 300;
143
150
  this.LONG_PRESS_DELAY = 1000;
144
151
  this.LONG_PRESS_INTERVAL_DELAY = 100;
145
152
  this.LONG_PRESS_AMOUNT = 5;
@@ -212,20 +219,25 @@ export default {
212
219
 
213
220
  vm.changeNumber(direction);
214
221
 
215
- vm.longPressInterval = setInterval(() => {
216
- vm.changeNumber(direction, longPressValue);
217
- }, vm.LONG_PRESS_INTERVAL_DELAY);
222
+ // Small delay before long press logic other wise sometimes slight long click once registers twice
223
+ vm.longPressDelayTimeout = setTimeout(() => {
224
+ vm.longPressInterval = setInterval(() => {
225
+ vm.changeNumber(direction, longPressValue);
226
+ }, vm.LONG_PRESS_INTERVAL_DELAY);
218
227
 
219
- vm.longPressTimeout = setTimeout(() => {
220
- longPressValue = vm.LONG_PRESS_AMOUNT;
221
- }, vm.LONG_PRESS_DELAY);
228
+ vm.longPressTimeout = setTimeout(() => {
229
+ longPressValue = vm.LONG_PRESS_AMOUNT;
230
+ }, vm.LONG_PRESS_DELAY);
231
+ }, vm.DELAY_BEFORE_LONG_PRESS_START);
222
232
  }
223
233
  },
224
234
  clearLongPressTimers(e) {
225
235
  // eslint-disable-next-line no-unused-expressions
226
236
  e && e.preventDefault();
237
+ clearTimeout(this.longPressDelayTimeout);
227
238
  clearTimeout(this.longPressTimeout);
228
239
  clearInterval(this.longPressInterval);
240
+ this.longPressDelayTimeout = null;
229
241
  this.longPressTimeout = null;
230
242
  this.longPressInterval = null;
231
243
  this.longPress = false;