cja-phoenix 0.3.6 → 0.4.0

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.
Files changed (60) hide show
  1. package/README.md +2 -2
  2. package/dist/cja-phoenix.es.js +3081 -3030
  3. package/dist/style.css +1 -1
  4. package/dist/types/components/composite/CheckoutCrossSell.vue.d.ts +24 -31
  5. package/dist/types/components/composite/CheckoutLayout.vue.d.ts +14 -11
  6. package/dist/types/components/composite/CheckoutMilestones.vue.d.ts +13 -10
  7. package/dist/types/components/composite/CjaMenuBar.vue.d.ts +38 -26
  8. package/dist/types/components/composite/FunnelLayout.vue.d.ts +20 -23
  9. package/dist/types/components/composite/FunnelSubmit.vue.d.ts +16 -15
  10. package/dist/types/components/composite/FunnelSummary.vue.d.ts +55 -54
  11. package/dist/types/components/composite/FunnelTitle.vue.d.ts +17 -22
  12. package/dist/types/components/composite/InfoShowcase.vue.d.ts +21 -24
  13. package/dist/types/components/composite/JourneyMacroSteps.vue.d.ts +13 -10
  14. package/dist/types/components/forms/CheckboxInput.vue.d.ts +32 -33
  15. package/dist/types/components/forms/CurrencyInput.vue.d.ts +53 -80
  16. package/dist/types/components/forms/FileInput.vue.d.ts +67 -92
  17. package/dist/types/components/forms/NumberInput.vue.d.ts +48 -63
  18. package/dist/types/components/forms/PhoneInput.vue.d.ts +57 -92
  19. package/dist/types/components/forms/RadioInput.vue.d.ts +38 -53
  20. package/dist/types/components/forms/SelectInput.vue.d.ts +67 -108
  21. package/dist/types/components/forms/SelectionTiles.vue.d.ts +41 -54
  22. package/dist/types/components/forms/TextInput.vue.d.ts +65 -104
  23. package/dist/types/components/forms/TileCheckboxInput.vue.d.ts +20 -31
  24. package/dist/types/components/forms/ToggleInput.vue.d.ts +44 -63
  25. package/dist/types/components/forms/structure/InputContainer.vue.d.ts +14 -9
  26. package/dist/types/components/forms/structure/InputError.vue.d.ts +13 -10
  27. package/dist/types/components/forms/structure/InputTitle.vue.d.ts +17 -22
  28. package/dist/types/components/structural/CjaButton.vue.d.ts +44 -47
  29. package/dist/types/components/structural/CollapseContainer.vue.d.ts +33 -22
  30. package/dist/types/components/structural/ContentTabs.vue.d.ts +17 -20
  31. package/dist/types/components/structural/FixedContainer.vue.d.ts +55 -56
  32. package/dist/types/components/structural/GridContainer.vue.d.ts +26 -11
  33. package/dist/types/components/structural/GridItem.vue.d.ts +18 -21
  34. package/dist/types/components/structural/InfoMessage.vue.d.ts +20 -29
  35. package/dist/types/components/structural/LoadingSpinner.vue.d.ts +16 -15
  36. package/dist/types/components/structural/Modal.vue.d.ts +49 -9
  37. package/package.json +3 -6
  38. package/src/assets/breakpoints.scss +12 -0
  39. package/src/assets/forms.scss +3 -3
  40. package/src/assets/main.scss +1 -0
  41. package/src/components/composite/CheckoutCrossSell.vue +2 -0
  42. package/src/components/composite/CheckoutMilestones.vue +4 -2
  43. package/src/components/composite/CjaMenuBar.vue +130 -64
  44. package/src/components/composite/FunnelLayout.vue +7 -5
  45. package/src/components/composite/FunnelTitle.vue +3 -1
  46. package/src/components/forms/TextInput.vue +16 -0
  47. package/src/components/forms/structure/InputError.vue +3 -1
  48. package/src/components/forms/structure/InputTitle.vue +2 -1
  49. package/src/components/structural/CjaButton.vue +37 -15
  50. package/src/components/structural/GridContainer.vue +2 -1
  51. package/src/components/structural/GridItem.vue +3 -1
  52. package/src/components/structural/InfoMessage.vue +5 -3
  53. package/src/components/structural/Modal.vue +76 -63
  54. package/src/stories/Modal.story.vue +48 -9
  55. package/src/utils/cjaStore.ts +7 -15
  56. package/src/utils/useViewportDetector.ts +2 -2
  57. package/dist/types/histoire.setup.d.ts +0 -2
  58. package/src/histoire.setup.ts +0 -2
  59. /package/src/utils/{GetI18nMessages.ts → getI18nMessages.ts} +0 -0
  60. /package/src/utils/{JsonReviver.ts → jsonReviver.ts} +0 -0
@@ -16,6 +16,7 @@ withDefaults(
16
16
  </script>
17
17
 
18
18
  <style lang="scss" scoped>
19
+ @import "../../assets/breakpoints.scss";
19
20
  @import "../../assets/grid.scss";
20
21
 
21
22
  .grid-container-1,
@@ -26,7 +27,7 @@ withDefaults(
26
27
  padding-left: $grid-side-padding-sm;
27
28
  padding-right: $grid-side-padding-sm;
28
29
 
29
- @media screen and (min-width: 768px) and (max-width: 1023px) {
30
+ @media screen and (min-width: $break-md-min) and (max-width: $break-md-max) {
30
31
  grid-template-columns: $grid-columns-md;
31
32
  column-gap: $grid-column-gap-md;
32
33
  padding-left: $grid-side-padding-md;
@@ -19,6 +19,8 @@ defineProps<{
19
19
  </script>
20
20
 
21
21
  <style lang="scss" scoped>
22
+ @import "../../assets/breakpoints.scss";
23
+
22
24
  @for $i from 0 to 4 {
23
25
  .grid-item-sm-#{$i + 1} {
24
26
  @media screen and (max-width: 767px) {
@@ -29,7 +31,7 @@ defineProps<{
29
31
 
30
32
  @for $i from 0 to 4 {
31
33
  .grid-item-md-#{$i + 1} {
32
- @media screen and (min-width: 768px) and (max-width: 1023px) {
34
+ @media screen and (min-width: $break-md-min) and (max-width: $break-md-max) {
33
35
  grid-column: span #{$i + 1};
34
36
  }
35
37
  }
@@ -35,6 +35,8 @@ defineEmits(["btn:close"]);
35
35
  </script>
36
36
 
37
37
  <style lang="scss" scoped>
38
+ @import "../../assets/breakpoints.scss";
39
+
38
40
  .info-message {
39
41
  display: grid;
40
42
  grid-template-columns: 1fr;
@@ -43,12 +45,12 @@ defineEmits(["btn:close"]);
43
45
  border: 2px solid #000;
44
46
  border-radius: 16px;
45
47
 
46
- @media screen and (min-width: 768px) {
48
+ @media screen and (min-width: $break-md-min) {
47
49
  padding: 16px 24px;
48
50
  }
49
51
 
50
52
  &.has-icon {
51
- @media screen and (min-width: 768px) {
53
+ @media screen and (min-width: $break-md-min) {
52
54
  grid-template-columns: auto 1fr;
53
55
  }
54
56
  }
@@ -58,7 +60,7 @@ defineEmits(["btn:close"]);
58
60
  }
59
61
 
60
62
  &.has-icon.has-toggle {
61
- @media screen and (min-width: 768px) {
63
+ @media screen and (min-width: $break-md-min) {
62
64
  grid-template-columns: auto 1fr 18px;
63
65
  }
64
66
  }
@@ -1,19 +1,19 @@
1
1
  <template>
2
2
  <Teleport to="body">
3
3
  <Transition name="fade">
4
- <div v-show="active" class="modal-backdrop">
4
+ <div v-show="active" class="modal-backdrop" :style="{ ...cssVars }">
5
5
  <div class="modal-overlay" @click.self="closeModal">
6
6
  <div class="modal-container" ref="modalContainer">
7
- <button
8
- type="button"
9
- class="btn-close"
10
- aria-label="Close"
11
- @click="closeModal"
12
- >
13
- <span class="m-cgg-icon--cross"></span>
14
- </button>
15
- <div class="modal-header" v-if="title">
16
- {{ title }}
7
+ <div class="modal-header" :class="{ 'has-title': $slots.header }">
8
+ <div class="modal-header-wrapper">
9
+ <slot name="header"></slot>
10
+ </div>
11
+ <button
12
+ type="button"
13
+ class="btn-close m-cgg-icon--cross"
14
+ aria-label="Close"
15
+ @click="closeModal"
16
+ ></button>
17
17
  </div>
18
18
  <div class="modal-body">
19
19
  <slot name="body"></slot>
@@ -29,27 +29,42 @@
29
29
  </template>
30
30
 
31
31
  <script lang="ts" setup>
32
- import { ref, watch } from "vue";
33
-
34
- defineProps<{
35
- title?: string;
36
- }>();
32
+ import { ref, watch, computed } from "vue";
33
+
34
+ const props = withDefaults(
35
+ defineProps<{
36
+ maxWidth?: {
37
+ md?: string;
38
+ lg?: string;
39
+ xl?: string;
40
+ };
41
+ }>(),
42
+ {
43
+ maxWidth: () => ({
44
+ md: "min(calc(100% - 48px), 768px)",
45
+ lg: "min(calc(100% - 48px), 1024px)",
46
+ xl: "1024px",
47
+ }),
48
+ }
49
+ );
37
50
 
38
51
  const active = ref(false);
39
52
  const modalContainer = ref();
40
53
 
54
+ const cssVars = computed(() => ({
55
+ "--md-max-width": props.maxWidth.md,
56
+ "--lg-max-width": props.maxWidth.lg,
57
+ "--xl-max-width": props.maxWidth.xl,
58
+ }));
59
+
41
60
  const emit = defineEmits(["close"]);
42
61
 
43
62
  watch(
44
63
  () => active.value,
45
64
  (active) => {
46
- if (active) {
47
- document.body.style.overflow = "hidden";
48
- document.documentElement.style.overflow = "hidden";
49
- } else {
50
- document.body.style.overflow = "";
51
- document.documentElement.style.overflow = "";
52
- }
65
+ document.querySelectorAll("html, body").forEach((el) => {
66
+ (el as HTMLElement).style.overflow = active ? "hidden" : "";
67
+ });
53
68
  }
54
69
  );
55
70
 
@@ -74,6 +89,8 @@ defineExpose({ active, openModal, closeModal, toggleModal });
74
89
  </script>
75
90
 
76
91
  <style lang="scss" scoped>
92
+ @import "../../assets/breakpoints.scss";
93
+
77
94
  .modal-backdrop {
78
95
  position: fixed;
79
96
  top: 0;
@@ -105,87 +122,83 @@ defineExpose({ active, openModal, closeModal, toggleModal });
105
122
  box-sizing: border-box;
106
123
  display: flex;
107
124
  flex-direction: column;
125
+ gap: 16px;
108
126
 
109
- @media screen and (min-width: 601px) {
127
+ @media screen and (min-width: $break-md-min) {
110
128
  top: 50%;
111
129
  left: 50%;
112
130
  transform: translateY(-50%) translateX(-50%);
113
- max-width: calc(100% - 60px);
114
- max-height: calc(100% - 40px);
131
+ max-width: var(--md-max-width);
132
+ max-height: calc(100% - 48px);
115
133
  border-radius: 8px;
116
134
  padding: 20px 40px;
117
135
  height: auto;
118
136
  }
119
137
 
120
- @media screen and (min-width: 1100px) {
121
- max-width: 1040px;
138
+ @media screen and (min-width: $break-lg-min) {
139
+ max-width: var(--lg-max-width);
140
+ }
141
+
142
+ @media screen and (min-width: $break-xl-min) {
143
+ max-width: var(--xl-max-width);
122
144
  }
123
145
 
124
146
  .modal-header {
125
- font-weight: 700;
126
- font-size: 18px;
127
- line-height: 21px;
128
- padding: 0 20px 15px 0;
129
- border-bottom: 1px solid #dedede;
130
-
131
- @media screen and (min-width: 601px) {
132
- font-size: 24px;
133
- line-height: 27px;
134
- }
147
+ display: grid;
148
+ grid-template-columns: 1fr 20px;
149
+ padding: 0;
135
150
 
136
151
  &:before,
137
152
  &:after {
138
153
  content: none;
139
154
  }
140
- }
141
-
142
- .btn-close {
143
- position: absolute;
144
- top: 20px;
145
- right: 20px;
146
- background: none;
147
- border: none;
148
- padding: 0;
149
- outline: 0;
150
- height: 20px;
151
- cursor: pointer;
152
- z-index: 2;
153
155
 
154
- @media screen and (min-width: 601px) {
155
- right: 40px;
156
+ &.has-title {
157
+ padding: 0 0 8px 0;
158
+ border-bottom: 1px solid #dedede;
156
159
  }
157
160
 
158
- span {
159
- display: block;
161
+ .modal-header-wrapper {
160
162
  font-size: 16px;
161
163
  line-height: 20px;
164
+ font-weight: 700;
162
165
  }
163
166
 
164
- &:focus {
167
+ .btn-close {
168
+ background: none;
169
+ border: none;
170
+ padding: 0;
165
171
  outline: 0;
172
+ height: 20px;
173
+ width: 20px;
174
+ cursor: pointer;
175
+ z-index: 2;
176
+ font-size: 16px;
177
+ line-height: 20px;
178
+
179
+ &:focus {
180
+ outline: 0;
181
+ }
166
182
  }
167
183
  }
168
184
 
169
185
  .modal-body {
170
- margin: 0 -15px -15px;
171
- font-size: 15px;
172
- line-height: 17px;
186
+ font-size: 14px;
187
+ line-height: 18px;
173
188
  overflow-y: auto;
174
189
  flex-grow: 1;
175
190
  height: auto;
176
- padding: 15px;
177
191
  }
178
192
 
179
193
  .modal-footer {
180
194
  border-top: 1px solid #dedede;
181
- padding: 15px 0 0;
182
- margin-top: 15px;
195
+ padding: 8px 0 0;
183
196
 
184
197
  :deep(.button-container) {
185
198
  display: flex;
186
199
  flex-direction: row;
187
200
  justify-content: flex-end;
188
- gap: 10px;
201
+ gap: 8px;
189
202
  }
190
203
  }
191
204
  }
@@ -1,12 +1,15 @@
1
1
  <script setup lang="ts">
2
- import { ref, reactive } from "vue";
2
+ import { ref } from "vue";
3
3
  import Modal from "../components/structural/Modal.vue";
4
4
  import CjaButton from "../components/structural/CjaButton.vue";
5
5
 
6
6
  const modal = ref();
7
7
 
8
8
  const initState = () => ({
9
- title: "Modal Title",
9
+ mdMaxWidth: "min(calc(100% - 48px), 768px)",
10
+ lgMaxWidth: "min(calc(100% - 48px), 1024px)",
11
+ xlMaxWidth: "1024px",
12
+ modalHeader: true,
10
13
  modalBody: true,
11
14
  modalFooter: false,
12
15
  });
@@ -16,7 +19,17 @@ const initState = () => ({
16
19
  <Story title="Modal">
17
20
  <Variant title="Default" :init-state="initState">
18
21
  <template #default="{ state }">
19
- <Modal ref="modal" :title="state.title">
22
+ <Modal
23
+ ref="modal"
24
+ :maxWidth="{
25
+ md: state.mdMaxWidth,
26
+ lg: state.lgMaxWidth,
27
+ xl: state.xlMaxWidth,
28
+ }"
29
+ >
30
+ <template #header v-if="state.modalHeader">
31
+ Modal Header Slot
32
+ </template>
20
33
  <template #body v-if="state.modalBody">
21
34
  <div class="modal-body">
22
35
  <h2>Modal Body Slot</h2>
@@ -27,9 +40,7 @@ const initState = () => ({
27
40
  </div>
28
41
  </template>
29
42
  <template #footer v-if="state.modalFooter">
30
- <div class="modal-footer">
31
- <CjaButton :color="'orange'">Continuar</CjaButton>
32
- </div>
43
+ <div class="modal-footer">Modal Footer Slot</div>
33
44
  </template>
34
45
  </Modal>
35
46
 
@@ -37,7 +48,10 @@ const initState = () => ({
37
48
  </template>
38
49
 
39
50
  <template #controls="{ state }">
40
- <HstText type="text" v-model="state.title" title="Modal Title" />
51
+ <HstText v-model="state.mdMaxWidth" title="Max Width md" />
52
+ <HstText v-model="state.lgMaxWidth" title="Max Width lg" />
53
+ <HstText v-model="state.xlMaxWidth" title="Max Width xl" />
54
+ <HstCheckbox v-model="state.modalHeader" title="Modal Header" />
41
55
  <HstCheckbox v-model="state.modalBody" title="Modal Body" />
42
56
  <HstCheckbox v-model="state.modalFooter" title="Modal Footer" />
43
57
  </template>
@@ -45,15 +59,29 @@ const initState = () => ({
45
59
  </Story>
46
60
  </template>
47
61
 
62
+ <style lang="scss" scoped>
63
+ h2 {
64
+ margin-top: 0;
65
+ }
66
+
67
+ p {
68
+ margin: 0;
69
+ }
70
+ </style>
71
+
48
72
  <docs lang="md">
49
73
  ### Props
50
74
 
51
- #### title
75
+ #### maxWidth
52
76
 
53
- Adds a title and a horizontal rule below it to the modal.
77
+ Defines a maxWidth CSS string for the **md**, **lg** and **xl** viewports.
54
78
 
55
79
  ### Slots
56
80
 
81
+ #### #header
82
+
83
+ Displays content inside the header slot space and adds a horizontal rule below it to the modal.
84
+
57
85
  #### #body
58
86
 
59
87
  Displays content inside the modal, becoming scrollable after a threshold. If you need to stylize slotted content, wrap the html within a div, it will be scoped to the vue scope you are currently working with.
@@ -85,4 +113,15 @@ Exposes the **closeModal** method, used to hide the modal, emits a **@close** ev
85
113
  #### toggleModal()
86
114
 
87
115
  Exposes the **toggleModal** method, used to hide or show the modal depending on the current **active** value. Emits a **@close** event if the modal was closed.
116
+
117
+ ## Defaults
118
+
119
+ - **maxWidth**:
120
+ ```
121
+ {
122
+ md: "min(calc(100% - 48px), 768px)",
123
+ lg: "min(calc(100% - 48px), 1024px)",
124
+ xl: "1024px"
125
+ }
126
+ ```
88
127
  </docs>
@@ -27,22 +27,14 @@ export const getCjaStore = (options: {
27
27
  const field = this[target][payload.key];
28
28
 
29
29
  if (field) {
30
- if (field.hasOwnProperty("options")) {
31
- if (typeof payload.value == "string" && payload.value.includes(",")) {
32
- field.value = payload.value.split(",");
33
- } else {
34
- field.value = payload.value;
35
- }
30
+ field.value = payload.value;
36
31
 
37
- if (field.options) {
38
- field.label = Array.isArray(field.value)
39
- ? field.value.map(
40
- (v) => field.options.find((k) => k.value == v)?.label
41
- )
42
- : field.options.find((k) => k.value == field.value)?.label;
43
- }
44
- } else {
45
- field.value = payload.value;
32
+ if (field.options) {
33
+ field.label = Array.isArray(payload.value)
34
+ ? field.value.map(
35
+ (v) => field.options.find((k) => k.value == v)?.label
36
+ )
37
+ : field.options.find((k) => k.value == payload.value)?.label;
46
38
  }
47
39
  }
48
40
  },
@@ -3,8 +3,8 @@ import { Ref, onMounted, onUnmounted, ref } from "vue";
3
3
  export const useViewportDetector = (
4
4
  breakpoints: { [index: string]: number } = {
5
5
  xs: 0,
6
- s: 420,
7
- m: 768,
6
+ sm: 420,
7
+ md: 768,
8
8
  lg: 1024,
9
9
  xl: 1200,
10
10
  }
@@ -1,2 +0,0 @@
1
- import "./assets/main.scss";
2
- import "./assets/iconia/style.scss";
@@ -1,2 +0,0 @@
1
- import "./assets/main.scss";
2
- import "./assets/iconia/style.scss";
File without changes