@rypen-dev/shared-components 5.0.0 → 5.0.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.
@@ -193,6 +193,60 @@
193
193
  }
194
194
  }
195
195
 
196
+ &.minimal {
197
+ padding-top: 10px;
198
+
199
+ .inner {
200
+ border: 0;
201
+ border-radius: 2px;
202
+ background-color: $tooltip-minimal-bg-color;
203
+ padding: 12px;
204
+ box-shadow: none;
205
+ }
206
+
207
+ &::before {
208
+ display: none;
209
+ }
210
+
211
+ &::after {
212
+ border-left-width: 10px;
213
+ border-right-width: 10px;
214
+ border-bottom-width: 10px;
215
+ border-bottom-color: $tooltip-minimal-bg-color;
216
+ top: 0;
217
+ }
218
+
219
+ &.up {
220
+ padding-top: 0;
221
+ padding-bottom: 10px;
222
+
223
+ &::after {
224
+ bottom: 0;
225
+ border-bottom: 0;
226
+ top: auto;
227
+ border-top: solid 10px $tooltip-minimal-bg-color;
228
+ }
229
+ }
230
+
231
+ &.right-tooltip::after {
232
+ right: 0;
233
+ border-right: 0;
234
+ border-top: 0;
235
+ border-bottom: solid 10px $tooltip-minimal-bg-color;
236
+ border-left: solid 10px transparent;
237
+ }
238
+
239
+ @media (min-width: map-get($breakpoints, medium)) {
240
+ &.medium-right-tooltip::after {
241
+ right: 0;
242
+ border-right: 0;
243
+ border-top: 0;
244
+ border-bottom: solid 10px $tooltip-minimal-bg-color;
245
+ border-left: solid 10px transparent;
246
+ }
247
+ }
248
+ }
249
+
196
250
  @media (max-width: map-get($breakpoints, medium) - 1px) {
197
251
  &.small-left-tooltip {
198
252
  left: 0;
@@ -271,58 +325,4 @@
271
325
  }
272
326
  }
273
327
  }
274
-
275
- &.minimal {
276
- padding-top: 10px;
277
-
278
- .inner {
279
- border: 0;
280
- border-radius: 2px;
281
- background-color: $tooltip-minimal-bg-color;
282
- padding: 12px;
283
- box-shadow: none;
284
- }
285
-
286
- &::before {
287
- display: none;
288
- }
289
-
290
- &::after {
291
- border-left-width: 10px;
292
- border-right-width: 10px;
293
- border-bottom-width: 10px;
294
- border-bottom-color: $tooltip-minimal-bg-color;
295
- top: 0;
296
- }
297
-
298
- &.up {
299
- padding-top: 0;
300
- padding-bottom: 10px;
301
-
302
- &::after {
303
- bottom: 0;
304
- border-bottom: 0;
305
- top: auto;
306
- border-top: solid 10px $tooltip-minimal-bg-color;
307
- }
308
- }
309
-
310
- &.right-tooltip::after {
311
- right: 0;
312
- border-right: 0;
313
- border-top: 0;
314
- border-bottom: solid 10px $tooltip-minimal-bg-color;
315
- border-left: solid 10px transparent;
316
- }
317
-
318
- @media (min-width: map-get($breakpoints, medium)) {
319
- &.medium-right-tooltip::after {
320
- right: 0;
321
- border-right: 0;
322
- border-top: 0;
323
- border-bottom: solid 10px $tooltip-minimal-bg-color;
324
- border-left: solid 10px transparent;
325
- }
326
- }
327
- }
328
328
  }
@@ -121,6 +121,10 @@ h6 {
121
121
  margin-bottom: 0 !important;
122
122
  }
123
123
 
124
+ &.inline {
125
+ display: inline-block;
126
+ }
127
+
124
128
  &.white-text {
125
129
  color: $white;
126
130
  }
@@ -226,6 +230,14 @@ h5 {
226
230
  border-bottom: solid 3px $headline-divider-border-color;
227
231
  padding-bottom: 5px;
228
232
  margin-bottom: 20px;
233
+
234
+ &.secondary {
235
+ border-bottom-color: $secondary;
236
+ }
237
+
238
+ &.tertiary-alt {
239
+ border-bottom-color: $tertiary-alt;
240
+ }
229
241
  }
230
242
 
231
243
  &.card-style {
@@ -235,6 +247,11 @@ h5 {
235
247
  font-weight: $headline-weight-normal;
236
248
  color: $body-font-color;
237
249
  margin-bottom: 0.5rem;
250
+
251
+ > span {
252
+ border: 0;
253
+ padding-bottom: 0;
254
+ }
238
255
  }
239
256
 
240
257
  &.byline {
@@ -527,10 +544,25 @@ small,
527
544
  color: $success;
528
545
  }
529
546
 
547
+ &.discount,
530
548
  &.color-success-alt {
531
549
  color: $success-alt;
532
550
  }
533
551
 
552
+ &.strike {
553
+ position: relative;
554
+
555
+ &::after {
556
+ content: '';
557
+ position: absolute;
558
+ top: 50%;
559
+ left: -4px;
560
+ right: -6px;
561
+ border-bottom: solid 2px $secondary-alt;
562
+ transform: translateY(-50%);
563
+ }
564
+ }
565
+
534
566
  .plus {
535
567
  font-size: 1rem;
536
568
  vertical-align: middle;
@@ -570,6 +602,14 @@ small,
570
602
  display: block;
571
603
  font-size: 0.85rem;
572
604
  color: $text-gray;
605
+
606
+ &.inline {
607
+ display: inline-block;
608
+ }
609
+
610
+ &.bigger {
611
+ font-size: 1rem;
612
+ }
573
613
  }
574
614
 
575
615
  .intro-text {
@@ -601,6 +641,11 @@ small,
601
641
  letter-spacing: 1px;
602
642
  padding: 60px 0;
603
643
  text-align: center;
644
+
645
+ &.compact {
646
+ padding: 30px 0;
647
+ font-size: 0.875rem;
648
+ }
604
649
  }
605
650
 
606
651
  .store-code {
@@ -1,16 +1,17 @@
1
1
  <template>
2
2
  <div class="lookup-container" :class="{ small: small }">
3
- <div class="input-container" :class="{ loading: loading, suggestions: suggestionsOpen, small: small }">
4
- <input type="text" autocomplete="off" v-model="value" @focus="focusOn" @blur="focusOff" />
5
- <span v-if="loading" class="mini-loader"></span>
3
+ <div class="input-container" :class="{ loading: loading, suggestions: suggestionsOpen, small: small, error: invalid }">
4
+ <input v-if="useExternalValue" ref="inputforexternal" type="text" autocomplete="off" :value="externalValue" :maxlength="maxLength" @input="updateExternalValue" @focus="focusOn" @blur="focusOff" @keyup.enter="enterMethod" :disabled="disabled" />
5
+ <input v-else ref="input" type="text" autocomplete="off" v-model="value" :maxlength="maxLength" @focus="focusOn" @blur="focusOff" @keyup.enter="enterMethod" :disabled="disabled" />
6
+ <span v-if="loading" class="mini-loader"></span>
7
+ </div>
8
+ <div v-if="suggestionsOpen" class="lookup-suggestions">
9
+ <ul>
10
+ <li v-if="suggestions.length === 0" class="empty">No {{ searchType }} found</li>
11
+ <li v-for="suggestion in suggestions" :key="suggestion.Id"><a @click="selectSuggestion(suggestion)">{{ suggestion.Name }}</a></li>
12
+ </ul>
13
+ </div>
6
14
  </div>
7
- <div v-if="suggestionsOpen" class="lookup-suggestions">
8
- <ul>
9
- <li v-if="suggestions.length === 0" class="empty">No products found</li>
10
- <li v-for="suggestion in suggestions" :key="suggestion.Id"><a @click="selectSuggestion(suggestion)">{{ suggestion.Name }}</a></li>
11
- </ul>
12
- </div>
13
- </div>
14
15
  </template>
15
16
  <script>
16
17
  import { debounce } from "@rypen-dev/helpers";
@@ -26,15 +27,39 @@
26
27
  type: Array,
27
28
  default: () => [],
28
29
  },
29
- error: String,
30
+ invalid: {
31
+ type: Boolean,
32
+ default: false,
33
+ },
30
34
  minimumLength: {
31
35
  type: Number,
32
36
  default: 3,
33
37
  },
38
+ maxLength: {
39
+ type: Number,
40
+ default: 200,
41
+ },
34
42
  small: {
35
43
  type: Boolean,
36
44
  default: false,
37
45
  },
46
+ disabled: {
47
+ type: Boolean,
48
+ default: false,
49
+ },
50
+ useExternalValue: {
51
+ type: Boolean,
52
+ default: false,
53
+ },
54
+ externalValue: String,
55
+ nameOnly: {
56
+ type: Boolean,
57
+ default: false,
58
+ },
59
+ searchType: {
60
+ type: String,
61
+ default: 'products'
62
+ },
38
63
  },
39
64
  data: () => {
40
65
  return {
@@ -52,14 +77,31 @@
52
77
  },
53
78
  methods: {
54
79
  getSuggestions() {
55
- if (this.value.length === 0 || this.value.length >= this.minimumLength) {
56
- this.$emit('search', this.value);
80
+ const usedValue = this.useExternalValue ? this.externalValue : this.value;
81
+ if (usedValue.length === 0 || usedValue.length >= this.minimumLength) {
82
+ this.$emit('search', usedValue);
57
83
  }
58
84
  },
59
85
  selectSuggestion(suggestion) {
60
- this.$emit('select', suggestion);
86
+ let data = suggestion;
87
+ if (this.nameOnly) {
88
+ data = suggestion.Name;
89
+ }
90
+
91
+ this.$emit('select', data);
92
+ },
93
+
94
+ updateExternalValue(e) {
95
+ this.$emit('select', e.target.value);
61
96
  },
62
97
 
98
+ focusInput() {
99
+ if (this.$refs.inputforexternal) {
100
+ this.$refs.inputforexternal.focus();
101
+ } else if (this.$refs.input) {
102
+ this.$refs.input.focus();
103
+ }
104
+ },
63
105
  focusOn() {
64
106
  this.focused = true;
65
107
  },
@@ -69,6 +111,10 @@
69
111
  this.value = '';
70
112
  }, 200);
71
113
  },
114
+
115
+ enterMethod() {
116
+ this.$emit('enter');
117
+ },
72
118
  },
73
119
  computed: {
74
120
  suggestionsOpen() {
@@ -79,6 +125,9 @@
79
125
  value(newValue) {
80
126
  this.debouncedGetSuggestions(newValue);
81
127
  },
128
+ externalValue(newValue) {
129
+ this.debouncedGetSuggestions(newValue);
130
+ },
82
131
  },
83
132
  }
84
133
  </script>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="image-selector">
3
3
  <div class="image-area">
4
- <div class="images-wrapper" :class="{ sliding: slidingDirection !== '', left: slidingDirection === 'left', right: slidingDirection === 'right' }">
4
+ <div class="images-wrapper">
5
5
  <div class="image-container" :style="currentImageStyle" :class="{ empty: showEmpty && selectedImage === '' }">
6
6
  <small v-if="substitutedImage" class="substitute-warning">*Image may not be representative of actual product with options currently selected</small>
7
7
  </div>
@@ -63,9 +63,6 @@
63
63
 
64
64
  carouselIndex: 0,
65
65
  maxImagesShown: 6,
66
- slidingDirection: '',
67
-
68
- timer: null,
69
66
  }
70
67
  },
71
68
  created: function () {
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div>
3
- <generic-loader v-if="generic" :cssClass="cssClass" />
3
+ <generic-loader v-if="useGeneric" :cssClass="cssClass" />
4
4
  <branded-loader v-else />
5
5
  </div>
6
6
  </template>
@@ -17,6 +17,11 @@
17
17
  default: false,
18
18
  },
19
19
  },
20
+ computed: {
21
+ useGeneric() {
22
+ return USE_GENERIC_LOADER === true || this.generic;
23
+ },
24
+ },
20
25
  components: {
21
26
  BrandedLoader,
22
27
  GenericLoader,