cja-phoenix 0.2.23 → 0.3.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.
@@ -0,0 +1,180 @@
1
+ <script setup lang="ts" setup>
2
+ import { ref } from "vue";
3
+ import { CjaButton, TextInput } from "../components";
4
+
5
+ const initState = () => ({
6
+ content: "Button Text",
7
+ });
8
+
9
+ const initStateAllConfigs = () => ({
10
+ content: "Button Text",
11
+ type: "primary" as "primary" | "secondary" | "tertiary",
12
+ color: "blue" as "blue" | "orange" | "white",
13
+ size: "md" as "sm" | "md" | "lg",
14
+ icon: "" as string,
15
+ iconAny: "" as string,
16
+ iconPosition: "right" as "left" | "right",
17
+ loading: false as boolean,
18
+ disabled: false as boolean,
19
+ });
20
+
21
+ const initStateIcon = () => ({
22
+ type: "primary" as "primary" | "secondary" | "tertiary",
23
+ color: "blue" as "blue" | "orange" | "white",
24
+ size: "md" as "sm" | "md" | "lg",
25
+ icon: "m-cgg-icon--gears" as string,
26
+ iconAny: "" as string,
27
+ iconPosition: "right" as "left" | "right",
28
+ loading: false as boolean,
29
+ disabled: false as boolean,
30
+ });
31
+
32
+ const options = {
33
+ type: ["primary", "secondary", "tertiary"],
34
+ color: ["blue", "orange", "white"],
35
+ size: ["sm", "md", "lg"],
36
+ icon: [
37
+ { label: "None", value: "" },
38
+ { label: "Chevron Right", value: "m-cgg-icon--chevron-right" },
39
+ { label: "Chevron Down", value: "m-cgg-icon--chevron-down" },
40
+ { label: "Gears", value: "m-cgg-icon--gears" },
41
+ ],
42
+ iconPosition: ["right", "left"],
43
+ };
44
+
45
+ const inputValue = ref();
46
+ </script>
47
+
48
+ <template>
49
+ <Story title="Button">
50
+ <Variant title="Default" :init-state="initState">
51
+ <template #default="{ state }">
52
+ <CjaButton>{{ state.content }}</CjaButton>
53
+ </template>
54
+
55
+ <template #controls="{ state }">
56
+ <HstText type="text" v-model="state.content" title="Content" />
57
+ </template>
58
+ </Variant>
59
+ <Variant title="All Configs" :init-state="initStateAllConfigs">
60
+ <template #default="{ state }">
61
+ <TextInput v-model="inputValue" :size="state.size" />
62
+ <CjaButton
63
+ :type="state.type"
64
+ :color="state.color"
65
+ :size="state.size"
66
+ :icon="state.iconAny || state.icon"
67
+ :iconPosition="state.iconPosition"
68
+ :loading="state.loading"
69
+ :disabled="state.disabled"
70
+ >{{ state.content }}</CjaButton
71
+ >
72
+ </template>
73
+
74
+ <template #controls="{ state }">
75
+ <HstText type="text" v-model="state.content" title="Content" />
76
+ <HstSelect v-model="state.type" :options="options.type" title="Type" />
77
+ <HstSelect
78
+ v-model="state.color"
79
+ :options="options.color"
80
+ title="Color"
81
+ />
82
+ <HstSelect v-model="state.size" :options="options.size" title="Size" />
83
+ <HstText type="text" v-model="state.iconAny" title="Icon Any" />
84
+ <HstSelect v-model="state.icon" :options="options.icon" title="Icon" />
85
+ <HstSelect
86
+ v-model="state.iconPosition"
87
+ :options="options.iconPosition"
88
+ title="Icon Position"
89
+ />
90
+ <HstCheckbox v-model="state.loading" title="Loading" />
91
+ <HstCheckbox v-model="state.disabled" title="Disabled" />
92
+ </template>
93
+ </Variant>
94
+ <Variant title="Icon Button" :init-state="initStateIcon">
95
+ <template #default="{ state }">
96
+ <TextInput v-model="inputValue" :size="state.size" />
97
+ <CjaButton
98
+ :type="state.type"
99
+ :color="state.color"
100
+ :size="state.size"
101
+ :icon="state.iconAny || state.icon"
102
+ :iconPosition="state.iconPosition"
103
+ :loading="state.loading"
104
+ :disabled="state.disabled"
105
+ />
106
+ </template>
107
+
108
+ <template #controls="{ state }">
109
+ <HstSelect v-model="state.type" :options="options.type" title="Type" />
110
+ <HstSelect
111
+ v-model="state.color"
112
+ :options="options.color"
113
+ title="Color"
114
+ />
115
+ <HstSelect v-model="state.size" :options="options.size" title="Size" />
116
+ <HstText type="text" v-model="state.iconAny" title="Icon Any" />
117
+ <HstSelect v-model="state.icon" :options="options.icon" title="Icon" />
118
+ <HstSelect
119
+ v-model="state.iconPosition"
120
+ :options="options.iconPosition"
121
+ title="Icon Position"
122
+ />
123
+ <HstCheckbox v-model="state.loading" title="Loading" />
124
+ <HstCheckbox v-model="state.disabled" title="Disabled" />
125
+ </template>
126
+ </Variant>
127
+ </Story>
128
+ </template>
129
+
130
+ <docs lang="md">
131
+ ## Props
132
+
133
+ #### type
134
+
135
+ Defines fill and border type
136
+
137
+ - **primary** has background fill
138
+ - **secondary** is bordered without fill
139
+ - **tertiary** does not have background or border
140
+
141
+ #### color
142
+
143
+ Defines button color profile
144
+
145
+ - <b style="color: #076b9c">blue</b>
146
+ - <b style="color: #f58423">orange</b>
147
+ - <b style="color: #fff">white</b>
148
+
149
+ #### size
150
+
151
+ Defines button size, changing padding and font-size
152
+
153
+ - **sm**
154
+ - **md**
155
+ - **lg**
156
+
157
+ #### icon
158
+
159
+ An iconia class icon, inserted as a class into a span
160
+
161
+ #### iconPosition
162
+
163
+ Defines icon position relative to button text
164
+
165
+ - **left**
166
+ - **right**
167
+
168
+ #### loading
169
+
170
+ Displays a spinner when boolean is true, prevents display of button text and icon
171
+
172
+ ## Defaults
173
+
174
+ When implementing a **CjaButton** component with no props, the following props are pre-defined as default:
175
+
176
+ - **type**: primary
177
+ - **color**: <b style="color: #076b9c">blue</b>
178
+ - **size**: md
179
+ - **iconPosition**: right
180
+ </docs>
@@ -0,0 +1,59 @@
1
+ <script lang="ts" setup>
2
+ import { ContentTabs } from "../components";
3
+
4
+ const initState = () => ({
5
+ tabs: ["Tab 1", "Tab 2"],
6
+ });
7
+ </script>
8
+
9
+ <template>
10
+ <Story title="Content Tabs">
11
+ <Variant title="Default" :init-state="initState">
12
+ <template #default="{ state }">
13
+ <ContentTabs :defaultTab="0" :tabs="state.tabs">
14
+ <template #[i] v-for="(tab, i) in state.tabs">
15
+ Each tab must match a numbered slot equivalent to the position on
16
+ the array, this is the slot for: {{ tab }}
17
+ </template>
18
+ </ContentTabs>
19
+ </template>
20
+
21
+ <template #controls="{ state }">
22
+ <HstJson v-model="state.tabs" title="Tabs"></HstJson>
23
+ </template>
24
+
25
+ <template #source>
26
+ <textarea v-pre>
27
+ <ContentTabs :defaultTab="0" :tabs="['Tab 1', 'Tab 2']">
28
+ <template #0> Slot content </template>
29
+ <template #1> Slot content </template>
30
+ </ContentTabs>
31
+ </textarea>
32
+ </template>
33
+ </Variant>
34
+ </Story>
35
+ </template>
36
+
37
+ <docs lang="md">
38
+ ### Props
39
+
40
+ #### defaultTab
41
+
42
+ The initial active tab when the component is first rendered.
43
+
44
+ #### tabs
45
+
46
+ An array of strings displayed on the tab controls, each one must match a numbered slot in order to display content properly.
47
+
48
+ ### Emits
49
+
50
+ #### tab:changed
51
+
52
+ Triggered when the tab controls are clicked, sends the new tab number.
53
+
54
+ ### Exposed
55
+
56
+ #### activeTab
57
+
58
+ Exposes the **activeTab** variable, used to display the current selected tab.
59
+ </docs>
@@ -1,18 +1,88 @@
1
1
  <script setup lang="ts">
2
2
  import { ref, reactive } from "vue";
3
3
  import Modal from "../components/structural/Modal.vue";
4
+ import { CjaButton } from "../components";
4
5
 
5
6
  const modal = ref();
6
7
 
7
- const state = reactive({
8
- title: "",
8
+ const initState = () => ({
9
+ title: "Modal Title",
10
+ modalBody: true,
11
+ modalFooter: false,
9
12
  });
10
13
  </script>
11
14
 
12
15
  <template>
13
16
  <Story title="Modal">
14
- <modal ref="modal" :title="state.title"></modal>
17
+ <Variant title="Default" :init-state="initState">
18
+ <template #default="{ state }">
19
+ <Modal ref="modal" :title="state.title">
20
+ <template #body v-if="state.modalBody">
21
+ <div class="modal-body">
22
+ <h2>Modal Body Slot</h2>
23
+ <p>
24
+ The modal body slot can host whatever component you need to use
25
+ inside
26
+ </p>
27
+ </div>
28
+ </template>
29
+ <template #footer v-if="state.modalFooter">
30
+ <div class="modal-footer">
31
+ <CjaButton :color="'orange'">Continuar</CjaButton>
32
+ </div>
33
+ </template>
34
+ </Modal>
15
35
 
16
- <button @click="modal.openModal()" type="button">Open modal</button>
36
+ <CjaButton @click="modal.openModal()">Open modal</CjaButton>
37
+ </template>
38
+
39
+ <template #controls="{ state }">
40
+ <HstText type="text" v-model="state.title" title="Modal Title" />
41
+ <HstCheckbox v-model="state.modalBody" title="Modal Body" />
42
+ <HstCheckbox v-model="state.modalFooter" title="Modal Footer" />
43
+ </template>
44
+ </Variant>
17
45
  </Story>
18
46
  </template>
47
+
48
+ <docs lang="md">
49
+ ### Props
50
+
51
+ #### title
52
+
53
+ Adds a title and a horizontal rule below it to the modal.
54
+
55
+ ### Slots
56
+
57
+ #### #body
58
+
59
+ 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.
60
+
61
+ #### #footer
62
+
63
+ Displays content below the modal body, separated by a horizontal ruler. Exempt from the scrollable container.
64
+
65
+ ### Emits
66
+
67
+ #### @close
68
+
69
+ Triggered when the modal is closed, through the close button or clicking outside the modal window.
70
+
71
+ ### Exposed
72
+
73
+ #### active
74
+
75
+ Exposes the modal's current **active** status, allows you to detect if the modal is opened or closed.
76
+
77
+ #### openModal()
78
+
79
+ Exposes the **openModal** method, used to display the modal, typically wrapped in a local function to perform additional changes before opening the modal.
80
+
81
+ #### closeModal()
82
+
83
+ Exposes the **closeModal** method, used to hide the modal, emits a **@close** event.
84
+
85
+ #### toggleModal()
86
+
87
+ 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.
88
+ </docs>
@@ -2,4 +2,5 @@ export interface MacroStep {
2
2
  label: string;
3
3
  icon: string;
4
4
  status: "past" | "current" | "future";
5
+ navigationUrl?: string;
5
6
  }
@@ -1,5 +1,4 @@
1
1
  import { MacroStep } from "./MacroStep";
2
- import { Tab } from "./Tab";
3
2
  import { SelectOption } from "./SelectOption";
4
3
  import { TileOption } from "./TileOption";
5
4
  import { CheckoutMilestone } from "./CheckoutMilestone";
@@ -7,7 +6,6 @@ import { StoreData, StoreDataValue } from "./StoreDataValue";
7
6
 
8
7
  export type {
9
8
  MacroStep,
10
- Tab,
11
9
  SelectOption,
12
10
  TileOption,
13
11
  CheckoutMilestone,
package/src/utils/gtm.ts CHANGED
@@ -16,6 +16,7 @@ export const useCjaGtm = (
16
16
  stepName: string;
17
17
  stepNumber: number;
18
18
  stepDetails?: any;
19
+ action?: string;
19
20
  }) => {
20
21
  gtm?.trackEvent({
21
22
  event: `${gtmOptions.location} Step`,
@@ -24,6 +25,7 @@ export const useCjaGtm = (
24
25
  value: options.stepName,
25
26
  noninteraction: false,
26
27
  location: gtmOptions.location,
28
+ action: options.action,
27
29
  properties: {
28
30
  stepName: options.stepName,
29
31
  stepNumber: options.stepNumber,
@@ -1,4 +0,0 @@
1
- export interface Tab {
2
- label: string;
3
- control: string;
4
- }
package/src/types/Tab.ts DELETED
@@ -1,4 +0,0 @@
1
- export interface Tab {
2
- label: string;
3
- control: string;
4
- }