@designcrowd/fe-shared-lib 1.1.3 → 1.1.4-rte-1

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.
@@ -143,6 +143,18 @@ export const SampleIconsTextStyle = () => {
143
143
  value: 'strikethrough',
144
144
  iconName: 'maker-strikethrough',
145
145
  },
146
+ {
147
+ value: 'spacing',
148
+ iconName: 'maker-spacing',
149
+ },
150
+ {
151
+ value: 'text color',
152
+ iconName: 'maker-text-color',
153
+ },
154
+ {
155
+ value: 'text background color',
156
+ iconName: 'maker-text-background-color',
157
+ },
146
158
  ],
147
159
  }),
148
160
  methods: {
@@ -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 tw-z-20"
23
+ class="tw-origin-top-right tw-absolute tw-mt-2 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
  {
@@ -1,12 +1,24 @@
1
1
  <template>
2
2
  <div>
3
- <div class="tw-flex tw-items-center tw-px-2 tw-py-2 drop-down-item tw-cursor-pointer" @click="onClick">
3
+ <div
4
+ class="tw-flex tw-items-center tw-px-2 tw-py-2 tw-cursor-pointer"
5
+ @click="onClick"
6
+ :class="{
7
+ 'dropdown-item-hover': backgroundHover,
8
+ }"
9
+ >
4
10
  <slot></slot>
5
11
  </div>
6
12
  </div>
7
13
  </template>
8
14
  <script>
9
15
  export default {
16
+ props: {
17
+ backgroundHover: {
18
+ type: Boolean,
19
+ default: true,
20
+ },
21
+ },
10
22
  methods: {
11
23
  onClick() {
12
24
  this.$emit('click');
@@ -15,7 +27,7 @@ export default {
15
27
  };
16
28
  </script>
17
29
  <style scoped>
18
- .drop-down-item:hover {
30
+ .dropdown-item-hover:hover {
19
31
  background-color: #eee;
20
32
  }
21
33
  </style>
@@ -355,6 +355,9 @@ import IconMakerItalic from './icons/maker/italic.vue';
355
355
  import IconMakerBold from './icons/maker/bold.vue';
356
356
  import IconMakerUnderline from './icons/maker/underline.vue';
357
357
  import IconMakerStrikethrough from './icons/maker/strikethrough.vue';
358
+ import IconMakerSpacing from './icons/maker/spacing.vue';
359
+ import IconMakerTextColor from './icons/maker/text-color.vue';
360
+ import IconMakerTextBackgroundColor from './icons/maker/text-background-color.vue';
358
361
  import IconMakerPlay from './icons/maker/play.vue';
359
362
  import IconMakerPause from './icons/maker/pause.vue';
360
363
  import IconMakerEraser from './icons/maker/eraser.vue';
@@ -698,6 +701,9 @@ export default {
698
701
  IconMakerBold,
699
702
  IconMakerUnderline,
700
703
  IconMakerStrikethrough,
704
+ IconMakerSpacing,
705
+ IconMakerTextColor,
706
+ IconMakerTextBackgroundColor,
701
707
  IconMakerPlay,
702
708
  IconMakerPause,
703
709
  IconMakerEraser,
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <path
3
+ d="M8.25 4.5H2.75C2.336 4.5 2 4.16475 2 3.75C2 3.33525 2.336 3 2.75 3H8.25C8.664 3 9 3.33525 9 3.75C9 4.16475 8.664 4.5 8.25 4.5Z"
4
+ fill="black"
5
+ />
6
+ <path
7
+ d="M8.25 9H2.75C2.336 9 2 8.66475 2 8.25C2 7.83525 2.336 7.5 2.75 7.5H8.25C8.664 7.5 9 7.83525 9 8.25C9 8.66475 8.664 9 8.25 9Z"
8
+ fill="black"
9
+ />
10
+ <path
11
+ d="M2.75 13.5H8.25C8.664 13.5 9 13.1648 9 12.75C9 12.3352 8.664 12 8.25 12H2.75C2.336 12 2 12.3352 2 12.75C2 13.1648 2.336 13.5 2.75 13.5Z"
12
+ fill="black"
13
+ />
14
+ <path
15
+ d="M10.1661 11.7138C9.94463 11.9247 9.94463 12.2658 10.1661 12.4767L11.5995 13.8418C11.821 14.0527 12.1791 14.0527 12.4006 13.8418L13.834 12.4767C13.9445 12.3715 14 12.2333 14 12.0953C14 11.9572 13.9445 11.819 13.834 11.7138C13.6125 11.5029 13.2544 11.5029 13.0329 11.7138L12.5666 12.1579L12.5666 3.84211L13.0329 4.2862C13.2544 4.49712 13.6125 4.49712 13.834 4.2862C13.9445 4.18102 14 4.04278 14 3.90474C14 3.7667 13.9445 3.62845 13.834 3.52328L12.4006 2.15819C12.1791 1.94727 11.821 1.94727 11.5995 2.15819L10.1661 3.52328C9.94463 3.73419 9.94463 4.07528 10.1661 4.2862C10.3876 4.49712 10.7457 4.49712 10.9672 4.2862L11.4335 3.84211V12.1579L10.9672 11.7138C10.7457 11.5029 10.3876 11.5029 10.1661 11.7138Z"
16
+ fill="black"
17
+ />
18
+ </template>
@@ -0,0 +1,12 @@
1
+ <template>
2
+ <path
3
+ fill-rule="evenodd"
4
+ clip-rule="evenodd"
5
+ d="M0.5 13.75C0.5 13.0596 1.05964 12.5 1.75 12.5H14.25C14.9404 12.5 15.5 13.0596 15.5 13.75V13.75C15.5 14.4404 14.9404 15 14.25 15H1.75C1.05964 15 0.5 14.4404 0.5 13.75V13.75Z"
6
+ fill="black"
7
+ />
8
+ <path
9
+ d="M4.70659 11H1L3.6025 8.3975L3.05045 7.76659L6.67817 4.13887L9.83271 7.37228L6.67817 10.6845C6.52045 10.8423 6.20499 10.8423 6.04727 10.6845L5.57408 10.1325L4.70659 11ZM8.64976 5.08523L7.30908 3.66569L9.67499 1.37865C9.96068 1.13428 10.3243 1 10.7002 1C11.0762 1 11.4397 1.13428 11.7254 1.37865L12.8295 2.5616C13.3816 3.11365 13.3816 4.13887 12.8295 4.69092L10.5425 6.97796L9.12294 5.55842L8.72863 5.08523"
10
+ fill="black"
11
+ />
12
+ </template>
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <path
3
+ fill-rule="evenodd"
4
+ clip-rule="evenodd"
5
+ d="M8.00585 1C8.28092 1 8.51171 1.05167 8.69736 1.155C8.88216 1.25833 9.03204 1.39167 9.14531 1.55417C9.25857 1.7175 9.35395 1.89167 9.43315 2.07833C9.50979 2.265 9.61028 2.515 9.72951 2.8275L12.2894 9.06667C12.4904 9.54167 12.5909 9.8875 12.5909 10.1033C12.5909 10.3267 12.4955 10.5325 12.3073 10.7192C12.1174 10.9058 11.8883 11 11.6218 11C11.4651 11 11.3314 10.9717 11.2198 10.9175C11.1091 10.8617 11.0154 10.7875 10.9396 10.6933C10.8638 10.5983 10.7821 10.4533 10.6952 10.2583C10.6084 10.0617 10.5334 9.88917 10.4713 9.74L10.0037 8.52667H6.01991L5.55237 9.76667C5.36928 10.25 5.21343 10.5767 5.08399 10.7467C4.9554 10.915 4.7442 11 4.44954 11C4.19917 11 3.9786 10.91 3.78784 10.7292C3.59623 10.5483 3.5 10.345 3.5 10.1158C3.5 9.98417 3.52214 9.84833 3.56728 9.7075C3.61156 9.56667 3.6848 9.37 3.78784 9.12L6.29498 2.84C6.36481 2.66 6.45167 2.44333 6.55131 2.19C6.6518 1.9375 6.7591 1.7275 6.87237 1.56C6.98563 1.39333 7.13466 1.25833 7.32031 1.155C7.50511 1.05167 7.73249 1 8.00585 1ZM7.99138 3.06417L6.54109 7.055H9.46892L7.99138 3.06417Z"
6
+ fill="black"
7
+ />
8
+ <path
9
+ fill-rule="evenodd"
10
+ clip-rule="evenodd"
11
+ d="M0.5 13.75C0.5 13.0596 1.05964 12.5 1.75 12.5H14.25C14.9404 12.5 15.5 13.0596 15.5 13.75V13.75C15.5 14.4404 14.9404 15 14.25 15H1.75C1.05964 15 0.5 14.4404 0.5 13.75V13.75Z"
12
+ fill="black"
13
+ />
14
+ </template>
@@ -0,0 +1,26 @@
1
+ import NumberInput from './NumberInput.vue';
2
+
3
+ export default {
4
+ title: 'Components/Number Input',
5
+ component: NumberInput,
6
+ parameters: {
7
+ layout: 'centered',
8
+ },
9
+ };
10
+
11
+ export const NumberInputStory = () => {
12
+ return {
13
+ components: {
14
+ NumberInput,
15
+ },
16
+ template: `
17
+ <div>
18
+ <div>Min 12, Max 128</div>
19
+ <NumberInput :min="12" :max="128" :model-value="16"/>
20
+ <div class="tw-mt-8">Min 0, max 100, Manually emptying the input box should fall back to 0 as min value</div>
21
+ <NumberInput :min="0" :max="100" :model-value="16"/>
22
+ </div>
23
+
24
+ `,
25
+ };
26
+ };
@@ -0,0 +1,119 @@
1
+ <template>
2
+ <input
3
+ ref="numberInput"
4
+ :value="numberValue"
5
+ type="text"
6
+ class="tw-w-full"
7
+ :class="[
8
+ elementClasses,
9
+ {
10
+ 'border-radius-none': !roundedCorners,
11
+ },
12
+ ]"
13
+ @input.stop="setInput"
14
+ @blur.stop="checkLimit"
15
+ />
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ props: {
21
+ min: {
22
+ type: Number,
23
+ required: false,
24
+ default: 0,
25
+ },
26
+ max: {
27
+ type: Number,
28
+ required: false,
29
+ default: 100,
30
+ },
31
+ modelValue: {
32
+ type: String,
33
+ required: false,
34
+ default: undefined,
35
+ },
36
+ elementClasses: {
37
+ type: String,
38
+ required: false,
39
+ default: '',
40
+ },
41
+ label: {
42
+ type: String,
43
+ required: false,
44
+ default: undefined,
45
+ },
46
+ roundedCorners: {
47
+ type: Boolean,
48
+ default: true,
49
+ },
50
+ step: {
51
+ type: Number,
52
+ required: false,
53
+ default: 1,
54
+ },
55
+ },
56
+ data() {
57
+ return {
58
+ numberValue: this.modelValue,
59
+ };
60
+ },
61
+ watch: {
62
+ modelValue(v) {
63
+ this.numberValue = v;
64
+ },
65
+ },
66
+ methods: {
67
+ focus() {
68
+ this.$refs.numberInput.focus();
69
+ },
70
+ setInput(e) {
71
+ if (e.target.value === '' || e.target.value === '-') {
72
+ return;
73
+ }
74
+
75
+ const newVal = parseFloat(e.target.value);
76
+ let newNumber = 0;
77
+ if (newVal > this.max) {
78
+ newNumber = this.max;
79
+ } else if (Number.isNaN(newVal)) {
80
+ newNumber = this.min;
81
+ } else {
82
+ newNumber = newVal;
83
+ }
84
+ this.updateValue(newNumber, e);
85
+ },
86
+ checkLimit(e) {
87
+ let newNumber = 0;
88
+ if (e.target.value === '') {
89
+ newNumber = this.min;
90
+ } else if (Number.isNaN(this.numberValue)) {
91
+ newNumber = this.min;
92
+ } else if (this.numberValue <= this.min) {
93
+ newNumber = this.min;
94
+ } else if (this.numberValue > this.max) {
95
+ newNumber = this.max;
96
+ } else {
97
+ newNumber = this.numberValue;
98
+ }
99
+ this.updateValue(newNumber, e);
100
+ },
101
+ updateValue(value, e) {
102
+ this.numberValue = value;
103
+ e.target.value = value;
104
+ this.$emit('input', e, value);
105
+ },
106
+ },
107
+ };
108
+ </script>
109
+ <style scoped>
110
+ input::-webkit-outer-spin-button,
111
+ input::-webkit-inner-spin-button {
112
+ -webkit-appearance: none;
113
+ margin: 0;
114
+ }
115
+
116
+ .border-radius-none {
117
+ border-radius: 0 !important;
118
+ }
119
+ </style>
@@ -23,8 +23,8 @@ export const Primary = () => {
23
23
  ...data,
24
24
  template: `
25
25
  <div>
26
- <div>Full width min 18 max 25</div>
27
- <NumberStepper v-model="numberValue" id="id1" :min="18" :max="25" :disabled="false" />
26
+ <div>Full width min 12 max 128</div>
27
+ <NumberStepper v-model="numberValue" id="id1" :min="12" :max="128" :disabled="false" />
28
28
  <div class="tw-mt-4 tw-w-64">
29
29
  <div>Fixed container width</div>
30
30
  <NumberStepper v-model="numberValue" id="id2" :min="18" :max="25" :disabled="false" />
@@ -45,6 +45,10 @@ export const Primary = () => {
45
45
  <div>Bigger size</div>
46
46
  <NumberStepper v-model="numberValue" id="id2" :min="18" :max="25" :disabled="false" />
47
47
  </div>
48
+ <div class="tw-h-8 tw-mt-4 tw-w-64">
49
+ <div> Outer size dependent</div>
50
+ <NumberStepper size="xs" :full-height="true" :input-classes="'tw-min-w-12'" v-model="numberValue" id="id2" :min="18" :max="25" :disabled="false" />
51
+ </div>
48
52
  </div>
49
53
  `,
50
54
  };
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="tw-flex tw-items-stretch">
2
+ <div class="tw-flex tw-items-stretch" :class="containerClass">
3
3
  <Button
4
4
  variant="flat"
5
5
  icon="minus"
@@ -8,6 +8,7 @@
8
8
  :classes="buttonStyle"
9
9
  :rounded="false"
10
10
  :rounded-left="true"
11
+ :full-height="fullHeight"
11
12
  :disabled="disabled"
12
13
  @mousedown.left="onMouseDown('down')"
13
14
  @mousedown.right="clearLongPressTimers"
@@ -19,11 +20,12 @@
19
20
  @touchcancel="clearLongPressTimers($event)"
20
21
  />
21
22
  <input
23
+ v-if="disableManualInput"
22
24
  :ref="numberStepperRef"
23
- class="tw-w-full tw-text-center tw-border tw-border-solid tw-border-secondary-200"
25
+ class="tw-w-full tw-text-center tw-border tw-border-solid tw-border-grayscale-500 tw-border-l-0 tw-border-r-0 tw-rounded-none"
24
26
  :class="inputClasses"
25
27
  type="text"
26
- :value="number"
28
+ :model-value="number"
27
29
  pattern="[0-9]"
28
30
  :disabled="disabled || disableManualInput"
29
31
  @wheel="onMouseWheel"
@@ -34,10 +36,27 @@
34
36
  @focus="$emit(FOCUSED_EVENT)"
35
37
  @blur="$emit(BLUR_EVENT)"
36
38
  />
39
+ <NumberInput
40
+ v-else
41
+ :min="min"
42
+ :max="max"
43
+ :model-value="number"
44
+ :element-classes="[
45
+ inputClasses,
46
+ 'tw-w-full tw-text-center tw-border tw-border-solid tw-border-grayscale-500 tw-border-l-0 tw-border-r-0 tw-rounded-none',
47
+ ]"
48
+ :rounded-corners="false"
49
+ @wheel="onMouseWheel"
50
+ @input="onSetInput"
51
+ @keyup="clearLongPressTimers"
52
+ @keydown.up="onArrowDown('up')"
53
+ @keydown.down="onArrowDown('down')"
54
+ />
37
55
  <Button
38
56
  variant="flat"
39
57
  :rounded="false"
40
58
  :rounded-right="true"
59
+ :full-height="fullHeight"
41
60
  icon="plus"
42
61
  :icon-size="buttonIconSize"
43
62
  class="tw-rounded-l-none"
@@ -58,10 +77,12 @@
58
77
  <script>
59
78
  import { ref } from 'vue';
60
79
  import Button from '../Button/Button.vue';
80
+ import NumberInput from '../NumberInput/NumberInput.vue';
61
81
 
62
82
  export default {
63
83
  components: {
64
84
  Button,
85
+ NumberInput,
65
86
  },
66
87
  props: {
67
88
  // The value returned when a variable is assigned to v-model
@@ -102,6 +123,14 @@ export default {
102
123
  type: String,
103
124
  default: undefined,
104
125
  },
126
+ containerClass: {
127
+ type: String,
128
+ default: undefined,
129
+ },
130
+ fullHeight: {
131
+ type: Boolean,
132
+ default: false,
133
+ },
105
134
  },
106
135
  setup(props) {
107
136
  const numberStepperRef = `js-number-stepper-${props.id}`;
@@ -293,6 +322,13 @@ export default {
293
322
  this.$emit('input', this.number);
294
323
  }
295
324
  },
325
+ onSetInput(e, val) {
326
+ const value = Math.round(parseFloat(e.target.value));
327
+ this.number = value;
328
+ e.target.value = value;
329
+ this.$emit('update:modelValue', this.number);
330
+ this.$emit('input', this.number);
331
+ },
296
332
  },
297
333
  };
298
334
  </script>
@@ -24,7 +24,24 @@ const getPaymentConfigsByBrandPageToken = async (brandPageToken) => {
24
24
  }
25
25
  };
26
26
 
27
+ const deletePaymentConfigByBrandPageTokenAndConfigId = async (brandPageToken, paymentConfigId) => {
28
+ try {
29
+ const response = await getAxios().delete(`/maker/api/brand-pages/${brandPageToken}/payment-configs`, {
30
+ data: { PaymentConfigId: paymentConfigId },
31
+ });
32
+
33
+ if (response.status === 200) {
34
+ return response.data;
35
+ }
36
+
37
+ return null;
38
+ } catch (err) {
39
+ return null;
40
+ }
41
+ };
42
+
27
43
  export default {
28
44
  setBrandPageApiClientAxios,
29
45
  getPaymentConfigsByBrandPageToken,
46
+ deletePaymentConfigByBrandPageTokenAndConfigId,
30
47
  };
@@ -1,4 +1,5 @@
1
1
  import brandPageApiClient from '../../clients/brand-page-api.client';
2
+ import vClickOutside from 'click-outside-vue3';
2
3
 
3
4
  export const paymentConfigStatuses = Object.freeze({
4
5
  active: 'Active',
@@ -24,9 +25,14 @@ export default {
24
25
  default: undefined,
25
26
  },
26
27
  },
28
+ directives: {
29
+ clickOutside: vClickOutside,
30
+ },
27
31
  data: () => ({
28
32
  isLoading: true,
29
33
  paymentConfigs: [],
34
+ selectedPaymentConfig: {},
35
+ isStripeOptionActionVisible: false,
30
36
  }),
31
37
  methods: {
32
38
  getPaymentConfigStatusDisplayText(paymentConfigStatus) {
@@ -0,0 +1,106 @@
1
+ <template>
2
+ <Modal
3
+ full-screen-breakpoint="sm"
4
+ classes="publish-bp--modal tw-px-2 md:tw-px-8"
5
+ close-on-esc
6
+ :visible="true"
7
+ :hide-scrollbar="false"
8
+ @close-modal="onCloseModal"
9
+ >
10
+ <template #header>
11
+ <div class="tw-text-center tw-font-bold tw-mb-4 tw-mt-8 tw-text-2xl">
12
+ <span>Delete Payment Provider</span>
13
+ </div>
14
+ </template>
15
+ <template #default>
16
+ <div class="tw-text-center tw-w-full tw-border-0 tw-border-solid tw-border-grayscale-400 tw-border-t tw-p-4">
17
+ <div v-if="isLoading" class="tw-flex tw-justify-center">
18
+ <Loader />
19
+ </div>
20
+ <div v-else>
21
+ <div class="tw-text-center tw-w-full">
22
+ <p class="tw-text-grayscale-600">Are you sure you want to delete this payment provider?</p>
23
+ <p class="tw-text-grayscale-600">
24
+ Once deleted, your site will no longer show any payment options to visitors. You won’t be able to accept
25
+ payments unless you set up a new provider.
26
+ </p>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ </template>
31
+ <template #footer>
32
+ <div
33
+ class="tw-font-sans tw-text-center tw-flex tw-gap-2 tw-justify-center tw-mt-4 tw-border-0 tw-border-solid tw-border-grayscale-400 tw-border-t"
34
+ :style="isMobile ? 'padding-left: 1.5rem; padding-right: 1.5rem;' : ''"
35
+ >
36
+ <Button label="Cancel" size="medium" variant="outline" class="tw-my-4" @on-click="onCloseModal" />
37
+ <Button label="Delete Provider" variant="primary" size="medium" class="tw-my-4" @on-click="onConfirmDelete" />
38
+ </div>
39
+ </template>
40
+ </Modal>
41
+ </template>
42
+ <script>
43
+ import Modal from '../../../../src/atoms/components/Modal/Modal.vue';
44
+ import Button from '../../../../src/atoms/components/Button/Button.vue';
45
+ import Loader from '../../../../src/atoms/components/Loader/Loader.vue';
46
+ import brandPageApiClient from './../../clients/brand-page-api.client';
47
+ export default {
48
+ components: {
49
+ Modal,
50
+ Button,
51
+ Loader,
52
+ },
53
+ emits: ['close-modal', 'on-delete'],
54
+ props: {
55
+ paymentConfig: {
56
+ type: Object,
57
+ required: true,
58
+ default: () => ({}),
59
+ },
60
+ brandPageToken: {
61
+ type: String,
62
+ required: false,
63
+ },
64
+ },
65
+ data: () => ({
66
+ isLoading: false,
67
+ }),
68
+ methods: {
69
+ onCloseModal() {
70
+ this.$emit('close-modal');
71
+ },
72
+
73
+ async onConfirmDelete() {
74
+ const paymentConfigId = this.paymentConfig.id;
75
+ if (!this.brandPageToken) {
76
+ if (process.env.NODE_ENV !== 'production') {
77
+ console.error(`brandPageToken is required`);
78
+ }
79
+ return;
80
+ }
81
+
82
+ if (!paymentConfigId) {
83
+ if (process.env.NODE_ENV !== 'production') {
84
+ console.error(`paymentConfigId is required`);
85
+ }
86
+ return;
87
+ }
88
+
89
+ try {
90
+ this.isLoading = true;
91
+
92
+ const result = await brandPageApiClient.deletePaymentConfigByBrandPageTokenAndConfigId(
93
+ this.brandPageToken,
94
+ paymentConfigId,
95
+ );
96
+
97
+ if (result) {
98
+ this.$emit('on-delete', paymentConfigId);
99
+ }
100
+ } finally {
101
+ this.isLoading = false;
102
+ }
103
+ },
104
+ },
105
+ };
106
+ </script>