cja-phoenix 0.6.0 → 0.6.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.
- package/dist/cja-phoenix.es.js +3816 -4306
- package/dist/style.css +1 -0
- package/dist/types/components/composite/CheckoutCrossSell.vue.d.ts +29 -0
- package/dist/types/components/composite/CheckoutLayout.vue.d.ts +23 -0
- package/dist/types/components/composite/CheckoutMilestones.vue.d.ts +16 -0
- package/dist/types/components/composite/CjaFooter.vue.d.ts +34 -0
- package/dist/types/components/composite/CjaMenuBar.vue.d.ts +52 -0
- package/dist/types/components/composite/FunnelLayout.vue.d.ts +35 -0
- package/dist/types/components/composite/FunnelSubmit.vue.d.ts +26 -0
- package/dist/types/components/composite/FunnelSummary.vue.d.ts +77 -0
- package/dist/types/components/composite/FunnelTitle.vue.d.ts +19 -0
- package/dist/types/components/composite/InfoShowcase.vue.d.ts +25 -0
- package/dist/types/components/composite/JourneyMacroSteps.vue.d.ts +16 -0
- package/dist/types/components/composite/ResultsSidebar.vue.d.ts +9 -0
- package/dist/types/components/forms/CheckboxInput.vue.d.ts +41 -0
- package/dist/types/components/forms/CurrencyInput.vue.d.ts +65 -0
- package/dist/types/components/forms/FileInput.vue.d.ts +89 -0
- package/dist/types/components/forms/NumberInput.vue.d.ts +58 -0
- package/dist/types/components/forms/PhoneInput.vue.d.ts +69 -0
- package/dist/types/components/forms/RadioInput.vue.d.ts +43 -0
- package/dist/types/components/forms/RadioInputList.vue.d.ts +65 -0
- package/dist/types/components/forms/SelectInput.vue.d.ts +80 -0
- package/dist/types/components/forms/SelectionTiles.vue.d.ts +51 -0
- package/dist/types/components/forms/TextInput.vue.d.ts +76 -0
- package/dist/types/components/forms/TileCheckboxInput.vue.d.ts +23 -0
- package/dist/types/components/forms/ToggleInput.vue.d.ts +51 -0
- package/dist/types/components/forms/structure/InputContainer.vue.d.ts +22 -0
- package/dist/types/components/forms/structure/InputError.vue.d.ts +15 -0
- package/dist/types/components/forms/structure/InputTitle.vue.d.ts +21 -0
- package/dist/types/components/structural/CjaButton.vue.d.ts +59 -0
- package/dist/types/components/structural/CollapseContainer.vue.d.ts +51 -0
- package/dist/{components → types/components}/structural/ContentTabs.vue.d.ts +17 -20
- package/dist/types/components/structural/FixedContainer.vue.d.ts +68 -0
- package/dist/types/components/structural/GridContainer.vue.d.ts +36 -0
- package/dist/types/components/structural/GridItem.vue.d.ts +26 -0
- package/dist/types/components/structural/InfoMessage.vue.d.ts +30 -0
- package/dist/types/components/structural/LoadingSpinner.vue.d.ts +17 -0
- package/dist/types/components/structural/Modal.vue.d.ts +65 -0
- package/dist/types/components/structural/Scaffold.vue.d.ts +9 -0
- package/dist/types/index.d.ts +16 -7
- package/dist/types/stories/CjaButton.story.vue.d.ts +2 -0
- package/dist/types/stories/ContentTabs.story.vue.d.ts +2 -0
- package/dist/types/stories/Modal.story.vue.d.ts +2 -0
- package/dist/types/stories/RadioInputList.story.vue.d.ts +2 -0
- package/dist/types/{Router.d.ts → types/Router.d.ts} +1 -0
- package/dist/types/types/index.d.ts +7 -0
- package/dist/{utils → types/utils}/formValidations.d.ts +3 -0
- package/package.json +21 -30
- package/src/assets/backdrop.scss +10 -0
- package/src/assets/breakpoints.scss +12 -0
- package/src/assets/fonts.scss +1 -0
- package/src/assets/forms.scss +97 -0
- package/src/assets/grid.scss +14 -0
- package/src/assets/iconia/Read Me.txt +7 -0
- package/src/assets/iconia/demo-files/demo.css +155 -0
- package/src/assets/iconia/demo-files/demo.js +30 -0
- package/src/assets/iconia/demo.html +7055 -0
- package/src/assets/iconia/fonts/CGG-icomoon.eot +0 -0
- package/src/assets/iconia/fonts/CGG-icomoon.svg +513 -0
- package/src/assets/iconia/fonts/CGG-icomoon.ttf +0 -0
- package/src/assets/iconia/fonts/CGG-icomoon.woff +0 -0
- package/src/assets/iconia/selection.json +1 -0
- package/src/assets/iconia/style.css +1547 -0
- package/src/assets/iconia/style.scss +2556 -0
- package/src/assets/iconia/variables.scss +507 -0
- package/src/assets/main.scss +30 -0
- package/src/assets/radioOld.scss +52 -0
- package/src/assets/shadows.scss +3 -0
- package/src/assets/tippy.scss +45 -0
- package/src/assets/vars/development.scss +4 -0
- package/src/assets/vars/production.scss +4 -0
- package/src/components/composite/CheckoutCrossSell.vue +478 -0
- package/src/components/composite/CheckoutLayout.vue +59 -0
- package/src/components/composite/CheckoutMilestones.vue +161 -0
- package/src/components/composite/CjaFooter.vue +223 -0
- package/src/components/composite/CjaMenuBar.vue +543 -0
- package/src/components/composite/FunnelLayout.vue +197 -0
- package/src/components/composite/FunnelSubmit.vue +53 -0
- package/src/components/composite/FunnelSummary.vue +198 -0
- package/src/components/composite/FunnelTitle.vue +59 -0
- package/src/components/composite/InfoShowcase.vue +87 -0
- package/src/components/composite/JourneyMacroSteps.vue +104 -0
- package/src/components/composite/ProductDetails.vue +149 -0
- package/src/components/composite/ResultsLayout.vue +156 -0
- package/src/components/composite/ResultsSidebar.vue +74 -0
- package/src/components/forms/CheckboxInput.vue +103 -0
- package/src/components/forms/CurrencyInput.vue +126 -0
- package/src/components/forms/FileInput.vue +250 -0
- package/src/components/forms/NumberInput.vue +165 -0
- package/src/components/forms/PhoneInput.vue +122 -0
- package/src/components/forms/RadioInput.vue +98 -0
- package/src/components/forms/RadioInputList.vue +156 -0
- package/src/components/forms/SelectInput.vue +392 -0
- package/src/components/forms/SelectionTiles.vue +196 -0
- package/src/components/forms/TextInput.vue +144 -0
- package/src/components/forms/TileCheckboxInput.vue +96 -0
- package/src/components/forms/ToggleInput.vue +88 -0
- package/src/components/forms/structure/InputContainer.vue +28 -0
- package/src/components/forms/structure/InputError.vue +26 -0
- package/src/components/forms/structure/InputTitle.vue +52 -0
- package/src/components/index.ts +73 -0
- package/src/components/structural/CjaButton.vue +332 -0
- package/src/components/structural/CollapseContainer.vue +141 -0
- package/src/components/structural/ContentTabs.vue +105 -0
- package/src/components/structural/FixedContainer.vue +107 -0
- package/src/components/structural/GridContainer.vue +70 -0
- package/src/components/structural/GridItem.vue +47 -0
- package/src/components/structural/InfoMessage.vue +105 -0
- package/src/components/structural/LoadingSpinner.vue +39 -0
- package/src/components/structural/Modal.vue +209 -0
- package/src/components/structural/Scaffold.vue +3 -0
- package/src/constants/MyConstants.ts +1 -0
- package/src/constants/index.ts +5 -0
- package/src/env.d.ts +11 -0
- package/src/index.ts +31 -0
- package/src/stories/CjaButton.story.vue +192 -0
- package/src/stories/ContentTabs.story.vue +59 -0
- package/src/stories/Modal.story.vue +127 -0
- package/src/stories/RadioInputList.story.vue +61 -0
- package/src/types/CheckoutMilestone.ts +5 -0
- package/src/types/Footer.ts +17 -0
- package/src/types/Menu.ts +19 -0
- package/src/types/RadioOption.ts +7 -0
- package/src/types/Router.ts +19 -0
- package/src/types/SelectOption.ts +6 -0
- package/src/types/StoreDataValue.ts +12 -0
- package/src/types/Storyblok.ts +10 -0
- package/src/types/TileOption.ts +8 -0
- package/src/types/index.ts +19 -0
- package/src/utils/cjaRouter.ts +74 -0
- package/src/utils/cjaStore.ts +43 -0
- package/src/utils/findScrollAncestor.ts +16 -0
- package/src/utils/formValidations.ts +192 -0
- package/src/utils/generateRoutes.ts +36 -0
- package/src/utils/getFromUrl.ts +25 -0
- package/src/utils/getMessages.ts +23 -0
- package/src/utils/gtm.ts +158 -0
- package/src/utils/index.ts +31 -0
- package/src/utils/jsonReviver.ts +20 -0
- package/src/utils/storyblokLink.ts +4 -0
- package/src/utils/updateForm.ts +40 -0
- package/src/utils/uploadFile.ts +25 -0
- package/src/utils/useGlobalProperties.ts +11 -0
- package/src/utils/useViewportDetector.ts +35 -0
- package/dist/cja-phoenix.cjs.js +0 -44
- package/dist/cja-phoenix.d.ts +0 -3
- package/dist/cja-phoenix.umd.js +0 -45
- package/dist/components/composite/CheckoutCrossSell.vue.d.ts +0 -36
- package/dist/components/composite/CheckoutLayout.vue.d.ts +0 -20
- package/dist/components/composite/CheckoutMilestones.vue.d.ts +0 -13
- package/dist/components/composite/CjaFooter.vue.d.ts +0 -29
- package/dist/components/composite/CjaMenuBar.vue.d.ts +0 -53
- package/dist/components/composite/FunnelLayout.vue.d.ts +0 -38
- package/dist/components/composite/FunnelSubmit.vue.d.ts +0 -25
- package/dist/components/composite/FunnelSummary.vue.d.ts +0 -76
- package/dist/components/composite/FunnelTitle.vue.d.ts +0 -24
- package/dist/components/composite/InfoShowcase.vue.d.ts +0 -28
- package/dist/components/composite/JourneyMacroSteps.vue.d.ts +0 -13
- package/dist/components/forms/CheckboxInput.vue.d.ts +0 -38
- package/dist/components/forms/CurrencyInput.vue.d.ts +0 -92
- package/dist/components/forms/FileInput.vue.d.ts +0 -118
- package/dist/components/forms/NumberInput.vue.d.ts +0 -73
- package/dist/components/forms/PhoneInput.vue.d.ts +0 -104
- package/dist/components/forms/RadioInputList.vue.d.ts +0 -96
- package/dist/components/forms/SelectInput.vue.d.ts +0 -121
- package/dist/components/forms/SelectionTiles.vue.d.ts +0 -64
- package/dist/components/forms/TextInput.vue.d.ts +0 -127
- package/dist/components/forms/TileCheckboxInput.vue.d.ts +0 -34
- package/dist/components/forms/ToggleInput.vue.d.ts +0 -70
- package/dist/components/forms/structure/InputContainer.vue.d.ts +0 -17
- package/dist/components/forms/structure/InputError.vue.d.ts +0 -12
- package/dist/components/forms/structure/InputTitle.vue.d.ts +0 -30
- package/dist/components/structural/CjaButton.vue.d.ts +0 -66
- package/dist/components/structural/CollapseContainer.vue.d.ts +0 -40
- package/dist/components/structural/FixedContainer.vue.d.ts +0 -69
- package/dist/components/structural/GridContainer.vue.d.ts +0 -21
- package/dist/components/structural/GridItem.vue.d.ts +0 -29
- package/dist/components/structural/InfoMessage.vue.d.ts +0 -39
- package/dist/components/structural/LoadingSpinner.vue.d.ts +0 -16
- package/dist/components/structural/Modal.vue.d.ts +0 -50
- package/dist/components/structural/Scaffold.vue.d.ts +0 -3
- package/dist/components/structural/Scaffold.vue.d.ts.map +0 -1
- package/dist/index.d.ts +0 -14
- package/dist/src/components/composite/CheckoutCrossSell.vue.d.ts +0 -5
- package/dist/src/components/composite/CheckoutCrossSell.vue.d.ts.map +0 -1
- package/dist/src/components/composite/CheckoutLayout.vue.d.ts +0 -5
- package/dist/src/components/composite/CheckoutLayout.vue.d.ts.map +0 -1
- package/dist/src/components/composite/CheckoutMilestones.vue.d.ts +0 -5
- package/dist/src/components/composite/CheckoutMilestones.vue.d.ts.map +0 -1
- package/dist/src/components/composite/CjaFooter.vue.d.ts +0 -5
- package/dist/src/components/composite/CjaFooter.vue.d.ts.map +0 -1
- package/dist/src/components/composite/CjaMenuBar.vue.d.ts +0 -5
- package/dist/src/components/composite/CjaMenuBar.vue.d.ts.map +0 -1
- package/dist/src/components/composite/FunnelLayout.vue.d.ts +0 -5
- package/dist/src/components/composite/FunnelLayout.vue.d.ts.map +0 -1
- package/dist/src/components/composite/FunnelSubmit.vue.d.ts +0 -5
- package/dist/src/components/composite/FunnelSubmit.vue.d.ts.map +0 -1
- package/dist/src/components/composite/FunnelSummary.vue.d.ts +0 -5
- package/dist/src/components/composite/FunnelSummary.vue.d.ts.map +0 -1
- package/dist/src/components/composite/FunnelTitle.vue.d.ts +0 -5
- package/dist/src/components/composite/FunnelTitle.vue.d.ts.map +0 -1
- package/dist/src/components/composite/InfoShowcase.vue.d.ts +0 -5
- package/dist/src/components/composite/InfoShowcase.vue.d.ts.map +0 -1
- package/dist/src/components/composite/JourneyMacroSteps.vue.d.ts +0 -5
- package/dist/src/components/composite/JourneyMacroSteps.vue.d.ts.map +0 -1
- package/dist/src/components/composite/ProductDetails.vue.d.ts +0 -5
- package/dist/src/components/composite/ProductDetails.vue.d.ts.map +0 -1
- package/dist/src/components/composite/ResultsLayout.vue.d.ts +0 -5
- package/dist/src/components/composite/ResultsLayout.vue.d.ts.map +0 -1
- package/dist/src/components/forms/CheckboxInput.vue.d.ts +0 -5
- package/dist/src/components/forms/CheckboxInput.vue.d.ts.map +0 -1
- package/dist/src/components/forms/CurrencyInput.vue.d.ts +0 -5
- package/dist/src/components/forms/CurrencyInput.vue.d.ts.map +0 -1
- package/dist/src/components/forms/FileInput.vue.d.ts +0 -5
- package/dist/src/components/forms/FileInput.vue.d.ts.map +0 -1
- package/dist/src/components/forms/NumberInput.vue.d.ts +0 -5
- package/dist/src/components/forms/NumberInput.vue.d.ts.map +0 -1
- package/dist/src/components/forms/PhoneInput.vue.d.ts +0 -5
- package/dist/src/components/forms/PhoneInput.vue.d.ts.map +0 -1
- package/dist/src/components/forms/RadioInputList.vue.d.ts +0 -5
- package/dist/src/components/forms/RadioInputList.vue.d.ts.map +0 -1
- package/dist/src/components/forms/SelectInput.vue.d.ts +0 -5
- package/dist/src/components/forms/SelectInput.vue.d.ts.map +0 -1
- package/dist/src/components/forms/SelectionTiles.vue.d.ts +0 -5
- package/dist/src/components/forms/SelectionTiles.vue.d.ts.map +0 -1
- package/dist/src/components/forms/TextInput.vue.d.ts +0 -5
- package/dist/src/components/forms/TextInput.vue.d.ts.map +0 -1
- package/dist/src/components/forms/TileCheckboxInput.vue.d.ts +0 -5
- package/dist/src/components/forms/TileCheckboxInput.vue.d.ts.map +0 -1
- package/dist/src/components/forms/ToggleInput.vue.d.ts +0 -5
- package/dist/src/components/forms/ToggleInput.vue.d.ts.map +0 -1
- package/dist/src/components/forms/structure/InputContainer.vue.d.ts +0 -5
- package/dist/src/components/forms/structure/InputContainer.vue.d.ts.map +0 -1
- package/dist/src/components/forms/structure/InputError.vue.d.ts +0 -5
- package/dist/src/components/forms/structure/InputError.vue.d.ts.map +0 -1
- package/dist/src/components/forms/structure/InputTitle.vue.d.ts +0 -5
- package/dist/src/components/forms/structure/InputTitle.vue.d.ts.map +0 -1
- package/dist/src/components/structural/CjaButton.vue.d.ts +0 -5
- package/dist/src/components/structural/CjaButton.vue.d.ts.map +0 -1
- package/dist/src/components/structural/CollapseContainer.vue.d.ts +0 -5
- package/dist/src/components/structural/CollapseContainer.vue.d.ts.map +0 -1
- package/dist/src/components/structural/ContentTabs.vue.d.ts +0 -5
- package/dist/src/components/structural/ContentTabs.vue.d.ts.map +0 -1
- package/dist/src/components/structural/FixedContainer.vue.d.ts +0 -5
- package/dist/src/components/structural/FixedContainer.vue.d.ts.map +0 -1
- package/dist/src/components/structural/GridContainer.vue.d.ts +0 -5
- package/dist/src/components/structural/GridContainer.vue.d.ts.map +0 -1
- package/dist/src/components/structural/GridItem.vue.d.ts +0 -5
- package/dist/src/components/structural/GridItem.vue.d.ts.map +0 -1
- package/dist/src/components/structural/InfoMessage.vue.d.ts +0 -5
- package/dist/src/components/structural/InfoMessage.vue.d.ts.map +0 -1
- package/dist/src/components/structural/LoadingSpinner.vue.d.ts +0 -5
- package/dist/src/components/structural/LoadingSpinner.vue.d.ts.map +0 -1
- package/dist/src/components/structural/Modal.vue.d.ts +0 -5
- package/dist/src/components/structural/Modal.vue.d.ts.map +0 -1
- package/dist/styles.css +0 -1
- /package/dist/{components → types/components}/composite/ProductDetails.vue.d.ts +0 -0
- /package/dist/{components → types/components}/composite/ResultsLayout.vue.d.ts +0 -0
- /package/dist/{components → types/components}/index.d.ts +0 -0
- /package/dist/{constants → types/constants}/MyConstants.d.ts +0 -0
- /package/dist/{constants → types/constants}/index.d.ts +0 -0
- /package/dist/types/{CheckoutMilestone.d.ts → types/CheckoutMilestone.d.ts} +0 -0
- /package/dist/types/{Footer.d.ts → types/Footer.d.ts} +0 -0
- /package/dist/types/{Menu.d.ts → types/Menu.d.ts} +0 -0
- /package/dist/types/{RadioOption.d.ts → types/RadioOption.d.ts} +0 -0
- /package/dist/types/{SelectOption.d.ts → types/SelectOption.d.ts} +0 -0
- /package/dist/types/{StoreDataValue.d.ts → types/StoreDataValue.d.ts} +0 -0
- /package/dist/types/{Storyblok.d.ts → types/Storyblok.d.ts} +0 -0
- /package/dist/types/{TileOption.d.ts → types/TileOption.d.ts} +0 -0
- /package/dist/{utils → types/utils}/cjaRouter.d.ts +0 -0
- /package/dist/{utils → types/utils}/cjaStore.d.ts +0 -0
- /package/dist/{utils → types/utils}/findScrollAncestor.d.ts +0 -0
- /package/dist/{utils → types/utils}/generateRoutes.d.ts +0 -0
- /package/dist/{utils → types/utils}/getFromUrl.d.ts +0 -0
- /package/dist/{utils → types/utils}/getMessages.d.ts +0 -0
- /package/dist/{utils → types/utils}/gtm.d.ts +0 -0
- /package/dist/{utils → types/utils}/index.d.ts +0 -0
- /package/dist/{utils → types/utils}/jsonReviver.d.ts +0 -0
- /package/dist/{utils → types/utils}/storyblokLink.d.ts +0 -0
- /package/dist/{utils → types/utils}/updateForm.d.ts +0 -0
- /package/dist/{utils → types/utils}/uploadFile.d.ts +0 -0
- /package/dist/{utils → types/utils}/useGlobalProperties.d.ts +0 -0
- /package/dist/{utils → types/utils}/useViewportDetector.d.ts +0 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import CjaButton from "../components/structural/CjaButton.vue";
|
|
3
|
+
import TextInput from "../components/forms/TextInput.vue";
|
|
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 = "";
|
|
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
|
+
<div class="form-container">
|
|
62
|
+
<TextInput v-model="inputValue" :size="state.size" />
|
|
63
|
+
<CjaButton
|
|
64
|
+
:type="state.type"
|
|
65
|
+
:color="state.color"
|
|
66
|
+
:size="state.size"
|
|
67
|
+
:icon="state.iconAny || state.icon"
|
|
68
|
+
:iconPosition="state.iconPosition"
|
|
69
|
+
:loading="state.loading"
|
|
70
|
+
:disabled="state.disabled"
|
|
71
|
+
>{{ state.content }}</CjaButton
|
|
72
|
+
>
|
|
73
|
+
</div>
|
|
74
|
+
</template>
|
|
75
|
+
|
|
76
|
+
<template #controls="{ state }">
|
|
77
|
+
<HstText type="text" v-model="state.content" title="Content" />
|
|
78
|
+
<HstSelect v-model="state.type" :options="options.type" title="Type" />
|
|
79
|
+
<HstSelect
|
|
80
|
+
v-model="state.color"
|
|
81
|
+
:options="options.color"
|
|
82
|
+
title="Color"
|
|
83
|
+
/>
|
|
84
|
+
<HstSelect v-model="state.size" :options="options.size" title="Size" />
|
|
85
|
+
<HstText type="text" v-model="state.iconAny" title="Icon Any" />
|
|
86
|
+
<HstSelect v-model="state.icon" :options="options.icon" title="Icon" />
|
|
87
|
+
<HstSelect
|
|
88
|
+
v-model="state.iconPosition"
|
|
89
|
+
:options="options.iconPosition"
|
|
90
|
+
title="Icon Position"
|
|
91
|
+
/>
|
|
92
|
+
<HstCheckbox v-model="state.loading" title="Loading" />
|
|
93
|
+
<HstCheckbox v-model="state.disabled" title="Disabled" />
|
|
94
|
+
</template>
|
|
95
|
+
</Variant>
|
|
96
|
+
<Variant title="Icon Button" :init-state="initStateIcon">
|
|
97
|
+
<template #default="{ state }">
|
|
98
|
+
<div class="form-container">
|
|
99
|
+
<TextInput v-model="inputValue" :size="state.size" />
|
|
100
|
+
<CjaButton
|
|
101
|
+
:type="state.type"
|
|
102
|
+
:color="state.color"
|
|
103
|
+
:size="state.size"
|
|
104
|
+
:icon="state.iconAny || state.icon"
|
|
105
|
+
:iconPosition="state.iconPosition"
|
|
106
|
+
:loading="state.loading"
|
|
107
|
+
:disabled="state.disabled"
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
110
|
+
</template>
|
|
111
|
+
|
|
112
|
+
<template #controls="{ state }">
|
|
113
|
+
<HstSelect v-model="state.type" :options="options.type" title="Type" />
|
|
114
|
+
<HstSelect
|
|
115
|
+
v-model="state.color"
|
|
116
|
+
:options="options.color"
|
|
117
|
+
title="Color"
|
|
118
|
+
/>
|
|
119
|
+
<HstSelect v-model="state.size" :options="options.size" title="Size" />
|
|
120
|
+
<HstText type="text" v-model="state.iconAny" title="Icon Any" />
|
|
121
|
+
<HstSelect v-model="state.icon" :options="options.icon" title="Icon" />
|
|
122
|
+
<HstSelect
|
|
123
|
+
v-model="state.iconPosition"
|
|
124
|
+
:options="options.iconPosition"
|
|
125
|
+
title="Icon Position"
|
|
126
|
+
/>
|
|
127
|
+
<HstCheckbox v-model="state.loading" title="Loading" />
|
|
128
|
+
<HstCheckbox v-model="state.disabled" title="Disabled" />
|
|
129
|
+
</template>
|
|
130
|
+
</Variant>
|
|
131
|
+
</Story>
|
|
132
|
+
</template>
|
|
133
|
+
|
|
134
|
+
<style lang="scss" scoped>
|
|
135
|
+
.form-container {
|
|
136
|
+
display: grid;
|
|
137
|
+
grid-template-columns: 200px max-content;
|
|
138
|
+
gap: 24px;
|
|
139
|
+
}
|
|
140
|
+
</style>
|
|
141
|
+
|
|
142
|
+
<docs lang="md">
|
|
143
|
+
## Props
|
|
144
|
+
|
|
145
|
+
#### type
|
|
146
|
+
|
|
147
|
+
Defines fill and border type
|
|
148
|
+
|
|
149
|
+
- **primary** has background fill
|
|
150
|
+
- **secondary** is bordered without fill
|
|
151
|
+
- **tertiary** does not have background or border
|
|
152
|
+
|
|
153
|
+
#### color
|
|
154
|
+
|
|
155
|
+
Defines button color profile
|
|
156
|
+
|
|
157
|
+
- <b style="color: #076b9c">blue</b>
|
|
158
|
+
- <b style="color: #f58423">orange</b>
|
|
159
|
+
- <b style="color: #fff">white</b>
|
|
160
|
+
|
|
161
|
+
#### size
|
|
162
|
+
|
|
163
|
+
Defines button size, changing padding and font-size
|
|
164
|
+
|
|
165
|
+
- **sm**
|
|
166
|
+
- **md**
|
|
167
|
+
- **lg**
|
|
168
|
+
|
|
169
|
+
#### icon
|
|
170
|
+
|
|
171
|
+
An iconia class icon, inserted as a class into a span
|
|
172
|
+
|
|
173
|
+
#### iconPosition
|
|
174
|
+
|
|
175
|
+
Defines icon position relative to button text
|
|
176
|
+
|
|
177
|
+
- **left**
|
|
178
|
+
- **right**
|
|
179
|
+
|
|
180
|
+
#### loading
|
|
181
|
+
|
|
182
|
+
Displays a spinner when boolean is true, prevents display of button text and icon
|
|
183
|
+
|
|
184
|
+
## Defaults
|
|
185
|
+
|
|
186
|
+
When implementing a **CjaButton** component with no props, the following props are pre-defined as default:
|
|
187
|
+
|
|
188
|
+
- **type**: primary
|
|
189
|
+
- **color**: <b style="color: #076b9c">blue</b>
|
|
190
|
+
- **size**: md
|
|
191
|
+
- **iconPosition**: right
|
|
192
|
+
</docs>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import ContentTabs from "../components/structural/ContentTabs.vue";
|
|
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>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
import Modal from "../components/structural/Modal.vue";
|
|
4
|
+
import CjaButton from "../components/structural/CjaButton.vue";
|
|
5
|
+
|
|
6
|
+
const modal = ref();
|
|
7
|
+
|
|
8
|
+
const initState = () => ({
|
|
9
|
+
mdMaxWidth: "min(calc(100% - 48px), 768px)",
|
|
10
|
+
lgMaxWidth: "min(calc(100% - 48px), 1024px)",
|
|
11
|
+
xlMaxWidth: "1024px",
|
|
12
|
+
modalHeader: true,
|
|
13
|
+
modalBody: true,
|
|
14
|
+
modalFooter: false,
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<Story title="Modal">
|
|
20
|
+
<Variant title="Default" :init-state="initState">
|
|
21
|
+
<template #default="{ state }">
|
|
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>
|
|
33
|
+
<template #body v-if="state.modalBody">
|
|
34
|
+
<div class="modal-body">
|
|
35
|
+
<h2>Modal Body Slot</h2>
|
|
36
|
+
<p>
|
|
37
|
+
The modal body slot can host whatever component you need to use
|
|
38
|
+
inside
|
|
39
|
+
</p>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
<template #footer v-if="state.modalFooter">
|
|
43
|
+
<div class="modal-footer">Modal Footer Slot</div>
|
|
44
|
+
</template>
|
|
45
|
+
</Modal>
|
|
46
|
+
|
|
47
|
+
<CjaButton @click="modal.openModal()">Open modal</CjaButton>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<template #controls="{ state }">
|
|
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" />
|
|
55
|
+
<HstCheckbox v-model="state.modalBody" title="Modal Body" />
|
|
56
|
+
<HstCheckbox v-model="state.modalFooter" title="Modal Footer" />
|
|
57
|
+
</template>
|
|
58
|
+
</Variant>
|
|
59
|
+
</Story>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<style lang="scss" scoped>
|
|
63
|
+
h2 {
|
|
64
|
+
margin-top: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
p {
|
|
68
|
+
margin: 0;
|
|
69
|
+
}
|
|
70
|
+
</style>
|
|
71
|
+
|
|
72
|
+
<docs lang="md">
|
|
73
|
+
### Props
|
|
74
|
+
|
|
75
|
+
#### maxWidth
|
|
76
|
+
|
|
77
|
+
Defines a maxWidth CSS string for the **md**, **lg** and **xl** viewports.
|
|
78
|
+
|
|
79
|
+
### Slots
|
|
80
|
+
|
|
81
|
+
#### #header
|
|
82
|
+
|
|
83
|
+
Displays content inside the header slot space and adds a horizontal rule below it to the modal.
|
|
84
|
+
|
|
85
|
+
#### #body
|
|
86
|
+
|
|
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.
|
|
88
|
+
|
|
89
|
+
#### #footer
|
|
90
|
+
|
|
91
|
+
Displays content below the modal body, separated by a horizontal ruler. Exempt from the scrollable container.
|
|
92
|
+
|
|
93
|
+
### Emits
|
|
94
|
+
|
|
95
|
+
#### @close
|
|
96
|
+
|
|
97
|
+
Triggered when the modal is closed, through the close button or clicking outside the modal window.
|
|
98
|
+
|
|
99
|
+
### Exposed
|
|
100
|
+
|
|
101
|
+
#### active
|
|
102
|
+
|
|
103
|
+
Exposes the modal's current **active** status, allows you to detect if the modal is opened or closed.
|
|
104
|
+
|
|
105
|
+
#### openModal()
|
|
106
|
+
|
|
107
|
+
Exposes the **openModal** method, used to display the modal, typically wrapped in a local function to perform additional changes before opening the modal.
|
|
108
|
+
|
|
109
|
+
#### closeModal()
|
|
110
|
+
|
|
111
|
+
Exposes the **closeModal** method, used to hide the modal, emits a **@close** event.
|
|
112
|
+
|
|
113
|
+
#### toggleModal()
|
|
114
|
+
|
|
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
|
+
```
|
|
127
|
+
</docs>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import RadioInputList from "../components/forms/RadioInputList.vue";
|
|
3
|
+
|
|
4
|
+
const initState = () => ({
|
|
5
|
+
title: "Radio Input List Title",
|
|
6
|
+
options: [
|
|
7
|
+
{
|
|
8
|
+
value: true,
|
|
9
|
+
label: "Yes",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
value: false,
|
|
13
|
+
label: "No",
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
size: "md",
|
|
17
|
+
layout: "vertical",
|
|
18
|
+
listLayout: "vertical",
|
|
19
|
+
modelValue: true,
|
|
20
|
+
name: "storyRadio",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const options = {
|
|
24
|
+
size: ["sm", "md", "lg"],
|
|
25
|
+
layout: ["vertical", "horizontal"],
|
|
26
|
+
listLayout: ["vertical", "horizontal"],
|
|
27
|
+
};
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<Story title="Radio List">
|
|
32
|
+
<Variant title="Default" :init-state="initState">
|
|
33
|
+
<template #default="{ state }">
|
|
34
|
+
<RadioInputList
|
|
35
|
+
:title="state.title"
|
|
36
|
+
:size="state.size"
|
|
37
|
+
:layout="state.layout"
|
|
38
|
+
:list-layout="state.listLayout"
|
|
39
|
+
:model-value="state.modelValue"
|
|
40
|
+
:options="state.options"
|
|
41
|
+
:name="state.name"
|
|
42
|
+
/>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<template #controls="{ state }">
|
|
46
|
+
<HstText v-model="state.title" title="Title" />
|
|
47
|
+
<HstSelect v-model="state.size" :options="options.size" title="Size" />
|
|
48
|
+
<HstSelect
|
|
49
|
+
v-model="state.layout"
|
|
50
|
+
:options="options.layout"
|
|
51
|
+
title="Input Layout"
|
|
52
|
+
/>
|
|
53
|
+
<HstSelect
|
|
54
|
+
v-model="state.listLayout"
|
|
55
|
+
:options="options.listLayout"
|
|
56
|
+
title="List Layout"
|
|
57
|
+
/>
|
|
58
|
+
</template>
|
|
59
|
+
</Variant>
|
|
60
|
+
</Story>
|
|
61
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StoryLink } from "./Storyblok";
|
|
2
|
+
|
|
3
|
+
interface FooterLink {
|
|
4
|
+
text: string;
|
|
5
|
+
link: StoryLink;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface FooterCategory {
|
|
9
|
+
text: string;
|
|
10
|
+
link?: StoryLink;
|
|
11
|
+
subLinks?: FooterLink[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface SocialLink {
|
|
15
|
+
socialNetwork: string;
|
|
16
|
+
link: StoryLink;
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StoryLink } from "./Storyblok";
|
|
2
|
+
|
|
3
|
+
export interface MacroStep {
|
|
4
|
+
label: string;
|
|
5
|
+
icon: string;
|
|
6
|
+
status: "past" | "current" | "future";
|
|
7
|
+
navigationUrl?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface MenuLink {
|
|
11
|
+
text: string;
|
|
12
|
+
link: StoryLink;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface MenuCategory {
|
|
16
|
+
text: string;
|
|
17
|
+
link?: StoryLink;
|
|
18
|
+
subLinks?: MenuLink[];
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "vue-router";
|
|
2
|
+
|
|
3
|
+
declare module "vue-router" {
|
|
4
|
+
interface Router {
|
|
5
|
+
replaceRoutes: (newRoutesName: string) => void;
|
|
6
|
+
nextStep: () => void;
|
|
7
|
+
previousStep: () => void;
|
|
8
|
+
skipStep: (skipNr: number) => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface RouteMeta {
|
|
12
|
+
step: number;
|
|
13
|
+
displayStep: number;
|
|
14
|
+
displayTotalSteps: number;
|
|
15
|
+
fields: string[];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RadioOption } from "./RadioOption";
|
|
2
|
+
import { SelectOption } from "./SelectOption";
|
|
3
|
+
|
|
4
|
+
export interface StoreDataValue {
|
|
5
|
+
value: any;
|
|
6
|
+
label?: string;
|
|
7
|
+
options?: SelectOption[] | RadioOption[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface StoreData {
|
|
11
|
+
[key: string]: StoreDataValue;
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MacroStep, MenuLink, MenuCategory } from "./Menu";
|
|
2
|
+
import { FooterCategory, SocialLink } from "./Footer";
|
|
3
|
+
import { SelectOption } from "./SelectOption";
|
|
4
|
+
import { TileOption } from "./TileOption";
|
|
5
|
+
import { CheckoutMilestone } from "./CheckoutMilestone";
|
|
6
|
+
import { StoreData, StoreDataValue } from "./StoreDataValue";
|
|
7
|
+
|
|
8
|
+
export type {
|
|
9
|
+
MacroStep,
|
|
10
|
+
MenuCategory,
|
|
11
|
+
MenuLink,
|
|
12
|
+
SelectOption,
|
|
13
|
+
TileOption,
|
|
14
|
+
CheckoutMilestone,
|
|
15
|
+
StoreData,
|
|
16
|
+
StoreDataValue,
|
|
17
|
+
FooterCategory,
|
|
18
|
+
SocialLink,
|
|
19
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export const getCjaRouter = (
|
|
2
|
+
router: any,
|
|
3
|
+
options: {
|
|
4
|
+
sessionRoutesToken: string;
|
|
5
|
+
routeGetter: any;
|
|
6
|
+
}
|
|
7
|
+
) => {
|
|
8
|
+
router.replaceRoutes = (newRoutesName: string) => {
|
|
9
|
+
if (
|
|
10
|
+
window.sessionStorage.getItem(options.sessionRoutesToken) != newRoutesName
|
|
11
|
+
) {
|
|
12
|
+
const newRoutes = options.routeGetter(newRoutesName);
|
|
13
|
+
|
|
14
|
+
router.getRoutes().forEach((route) => {
|
|
15
|
+
if (route.name) {
|
|
16
|
+
router.removeRoute(route.name);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
newRoutes.forEach((route) => {
|
|
21
|
+
router.addRoute(route);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
window.sessionStorage.setItem(options.sessionRoutesToken, newRoutesName);
|
|
25
|
+
if (router.currentRoute.value.name) {
|
|
26
|
+
router.replace({ name: router.currentRoute.value.name });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
router.nextStep = () => {
|
|
32
|
+
const nextStep = router
|
|
33
|
+
.getRoutes()
|
|
34
|
+
.find(
|
|
35
|
+
(route) => route.meta.step == router.currentRoute.value.meta.step + 1
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
if (nextStep) {
|
|
39
|
+
router.push(nextStep.path);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
router.previousStep = () => {
|
|
44
|
+
const previousStep = router
|
|
45
|
+
.getRoutes()
|
|
46
|
+
.find(
|
|
47
|
+
(route) => route.meta.step == router.currentRoute.value.meta.step - 1
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
if (previousStep) {
|
|
51
|
+
router.push(previousStep.path);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
router.skipStep = (skipNr) => {
|
|
56
|
+
const targetStep = router
|
|
57
|
+
.getRoutes()
|
|
58
|
+
.find(
|
|
59
|
+
(route) =>
|
|
60
|
+
route.meta.step == router.currentRoute.value.meta.step + 1 + skipNr
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
if (targetStep) {
|
|
64
|
+
router.push(targetStep.path);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
router.beforeEach((to, from) => {
|
|
69
|
+
to.meta.animation =
|
|
70
|
+
from.meta?.step < to.meta?.step ? "slide-right" : "slide-left";
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return router;
|
|
74
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { StoreData } from "../types/StoreDataValue";
|
|
2
|
+
|
|
3
|
+
interface State {
|
|
4
|
+
journeyId: undefined | string;
|
|
5
|
+
data: StoreData;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const getCjaStore = (options: {
|
|
10
|
+
data: StoreData;
|
|
11
|
+
state?: any;
|
|
12
|
+
actions?: any;
|
|
13
|
+
}) => ({
|
|
14
|
+
state: (): State => ({
|
|
15
|
+
journeyId: undefined,
|
|
16
|
+
data: { ...options.data } as StoreData,
|
|
17
|
+
...options.state,
|
|
18
|
+
}),
|
|
19
|
+
actions: {
|
|
20
|
+
changeJourneyID(journeyId: string): void {
|
|
21
|
+
this.journeyId = journeyId;
|
|
22
|
+
},
|
|
23
|
+
changeData(
|
|
24
|
+
payload: { key: string; value: any },
|
|
25
|
+
target: string = "data"
|
|
26
|
+
): void {
|
|
27
|
+
const field = this[target][payload.key];
|
|
28
|
+
|
|
29
|
+
if (field) {
|
|
30
|
+
field.value = payload.value;
|
|
31
|
+
|
|
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;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
...options.actions,
|
|
42
|
+
},
|
|
43
|
+
});
|