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,156 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<InputContainer v-bind="{ layout }">
|
|
3
|
+
<InputTitle v-bind="{ title, tooltip, size, disabled }" v-if="title" />
|
|
4
|
+
<ul
|
|
5
|
+
class="radio-button-list"
|
|
6
|
+
:class="[
|
|
7
|
+
`layout-${listLayout}`,
|
|
8
|
+
{
|
|
9
|
+
error: errorMessage,
|
|
10
|
+
},
|
|
11
|
+
]"
|
|
12
|
+
v-if="options"
|
|
13
|
+
>
|
|
14
|
+
<li class="radio-button-container" v-for="option in options">
|
|
15
|
+
<label>
|
|
16
|
+
<input
|
|
17
|
+
type="radio"
|
|
18
|
+
:name="name"
|
|
19
|
+
:checked="modelValue == option.value"
|
|
20
|
+
@change="handleChange($event, option.value)"
|
|
21
|
+
/>
|
|
22
|
+
<div class="radio-icon"></div>
|
|
23
|
+
<div
|
|
24
|
+
class="text-container"
|
|
25
|
+
:class="[`size-${size}`]"
|
|
26
|
+
v-html="option.label"
|
|
27
|
+
></div>
|
|
28
|
+
</label>
|
|
29
|
+
</li>
|
|
30
|
+
</ul>
|
|
31
|
+
|
|
32
|
+
<InputError :error="errorMessage" v-if="errorMessage && errorDisplay" />
|
|
33
|
+
</InputContainer>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script lang="ts" setup>
|
|
37
|
+
import { InputHTMLAttributes } from "vue";
|
|
38
|
+
import InputError from "./structure/InputError.vue";
|
|
39
|
+
import InputContainer from "./structure/InputContainer.vue";
|
|
40
|
+
import InputTitle from "./structure/InputTitle.vue";
|
|
41
|
+
import { RadioOption } from "../../types/RadioOption";
|
|
42
|
+
import { useField } from "vee-validate";
|
|
43
|
+
|
|
44
|
+
const props = withDefaults(
|
|
45
|
+
defineProps<{
|
|
46
|
+
title?: string;
|
|
47
|
+
tooltip?: string;
|
|
48
|
+
layout?: "vertical" | "horizontal";
|
|
49
|
+
listLayout?: "vertical" | "horizontal";
|
|
50
|
+
size?: "sm" | "md" | "lg";
|
|
51
|
+
validation?: any;
|
|
52
|
+
errorDisplay?: boolean;
|
|
53
|
+
disabled?: InputHTMLAttributes["disabled"];
|
|
54
|
+
modelValue: InputHTMLAttributes["value"];
|
|
55
|
+
options: RadioOption[] | undefined;
|
|
56
|
+
name: InputHTMLAttributes["name"];
|
|
57
|
+
}>(),
|
|
58
|
+
{
|
|
59
|
+
layout: "vertical",
|
|
60
|
+
listLayout: "vertical",
|
|
61
|
+
size: "md",
|
|
62
|
+
errorDisplay: true,
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const { errorMessage, meta, validate } = useField("input", props.validation, {
|
|
67
|
+
initialValue: props.modelValue,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const handleChange = (event: any, value: InputHTMLAttributes["value"]) => {
|
|
71
|
+
if (event.target.checked) {
|
|
72
|
+
emit("update:modelValue", value);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
defineExpose({ errorMessage, meta, validate });
|
|
77
|
+
|
|
78
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<style lang="scss" scoped>
|
|
82
|
+
@import "../../assets/forms.scss";
|
|
83
|
+
|
|
84
|
+
.radio-button-list {
|
|
85
|
+
padding: 0;
|
|
86
|
+
margin: 0;
|
|
87
|
+
list-style: none;
|
|
88
|
+
display: flex;
|
|
89
|
+
gap: 8px;
|
|
90
|
+
|
|
91
|
+
&.layout-vertical {
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&.layout-horizontal {
|
|
96
|
+
gap: 8px 16px;
|
|
97
|
+
|
|
98
|
+
.radio-button-container label .text-container {
|
|
99
|
+
&.size-md {
|
|
100
|
+
line-height: 44px;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&.error {
|
|
106
|
+
.radio-button-container label .radio-icon {
|
|
107
|
+
border-color: $input-border-error-color;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.radio-button-container {
|
|
112
|
+
label {
|
|
113
|
+
display: flex;
|
|
114
|
+
flex-direction: row;
|
|
115
|
+
align-items: center;
|
|
116
|
+
flex-wrap: nowrap;
|
|
117
|
+
gap: 8px;
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
margin: 0;
|
|
120
|
+
font-weight: 400;
|
|
121
|
+
|
|
122
|
+
input {
|
|
123
|
+
display: none;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.radio-icon {
|
|
127
|
+
width: 20px;
|
|
128
|
+
height: 20px;
|
|
129
|
+
flex-shrink: 0;
|
|
130
|
+
border: 1px solid #64748b;
|
|
131
|
+
border-radius: 50%;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
input:checked + .radio-icon {
|
|
135
|
+
border: 6px solid #076b9c;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.text-container {
|
|
139
|
+
@include input-title;
|
|
140
|
+
|
|
141
|
+
user-select: none;
|
|
142
|
+
|
|
143
|
+
a {
|
|
144
|
+
color: inherit;
|
|
145
|
+
font-weight: 700;
|
|
146
|
+
text-decoration: underline;
|
|
147
|
+
|
|
148
|
+
&:hover {
|
|
149
|
+
text-decoration: none;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
</style>
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<InputContainer v-bind="{ layout }">
|
|
3
|
+
<InputTitle v-bind="{ title, tooltip, size, disabled }" v-if="title" />
|
|
4
|
+
|
|
5
|
+
<div
|
|
6
|
+
ref="inputEl"
|
|
7
|
+
class="input-container-select"
|
|
8
|
+
:class="{ error: errorMessage }"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
class="select-toggle"
|
|
12
|
+
:class="[
|
|
13
|
+
`size-${size}`,
|
|
14
|
+
collapsePosition,
|
|
15
|
+
{ open: open, disabled: disabled },
|
|
16
|
+
]"
|
|
17
|
+
@click="toggleCollapse()"
|
|
18
|
+
>
|
|
19
|
+
<span class="select-display" :class="{ placeholder: !displayValue }">{{
|
|
20
|
+
displayValue || placeholder
|
|
21
|
+
}}</span>
|
|
22
|
+
<em class="m-cgg-icon--chevron-down"></em>
|
|
23
|
+
</div>
|
|
24
|
+
<Teleport to="body">
|
|
25
|
+
<Transition
|
|
26
|
+
name="slide-fade"
|
|
27
|
+
@enter="calcPosition"
|
|
28
|
+
@after-leave="collapsePosition = null"
|
|
29
|
+
>
|
|
30
|
+
<div
|
|
31
|
+
v-if="open"
|
|
32
|
+
class="select-collapse"
|
|
33
|
+
:class="collapsePosition"
|
|
34
|
+
ref="collapseEl"
|
|
35
|
+
>
|
|
36
|
+
<div v-if="searchFilter" class="search-filter-container">
|
|
37
|
+
<input v-model="search" :placeholder="searchFilter.placeholder" />
|
|
38
|
+
</div>
|
|
39
|
+
<ul>
|
|
40
|
+
<li
|
|
41
|
+
v-for="option in searchFilter ? filteredOptions : options"
|
|
42
|
+
@click="selectValue(option.value)"
|
|
43
|
+
:class="{
|
|
44
|
+
active: multiSelect && modelValue?.includes(option.value),
|
|
45
|
+
}"
|
|
46
|
+
>
|
|
47
|
+
<span
|
|
48
|
+
v-if="multiSelect"
|
|
49
|
+
class="checkbox-icon m-cgg-icon--check2"
|
|
50
|
+
></span>
|
|
51
|
+
{{ option.label }}
|
|
52
|
+
</li>
|
|
53
|
+
<li v-if="searchFilter && filteredOptions?.length == 0">
|
|
54
|
+
{{ searchFilter.noResults }}
|
|
55
|
+
</li>
|
|
56
|
+
</ul>
|
|
57
|
+
</div>
|
|
58
|
+
</Transition>
|
|
59
|
+
</Teleport>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<InputError :error="errorMessage" v-if="errorMessage && errorDisplay" />
|
|
63
|
+
</InputContainer>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<script lang="ts" setup>
|
|
67
|
+
import { useField } from "vee-validate";
|
|
68
|
+
import {
|
|
69
|
+
ref,
|
|
70
|
+
computed,
|
|
71
|
+
onMounted,
|
|
72
|
+
onUnmounted,
|
|
73
|
+
InputHTMLAttributes,
|
|
74
|
+
} from "vue";
|
|
75
|
+
import InputTitle from "./structure/InputTitle.vue";
|
|
76
|
+
import { SelectHTMLAttributes } from "vue";
|
|
77
|
+
import { SelectOption } from "../../types/SelectOption";
|
|
78
|
+
import InputError from "./structure/InputError.vue";
|
|
79
|
+
import InputContainer from "./structure/InputContainer.vue";
|
|
80
|
+
import { findScrollAncestor } from "../../utils";
|
|
81
|
+
|
|
82
|
+
const props = withDefaults(
|
|
83
|
+
defineProps<{
|
|
84
|
+
title?: string;
|
|
85
|
+
tooltip?: string;
|
|
86
|
+
placeholder?: InputHTMLAttributes["placeholder"];
|
|
87
|
+
layout?: "vertical" | "horizontal";
|
|
88
|
+
size?: "sm" | "md" | "lg";
|
|
89
|
+
error?: string;
|
|
90
|
+
validation?: any;
|
|
91
|
+
errorDisplay?: boolean;
|
|
92
|
+
id?: InputHTMLAttributes["id"];
|
|
93
|
+
disabled?: InputHTMLAttributes["disabled"];
|
|
94
|
+
modelValue: SelectHTMLAttributes["value"];
|
|
95
|
+
options: SelectOption[] | undefined;
|
|
96
|
+
multiSelect?: boolean;
|
|
97
|
+
searchFilter?: {
|
|
98
|
+
placeholder: string;
|
|
99
|
+
noResults: string;
|
|
100
|
+
};
|
|
101
|
+
}>(),
|
|
102
|
+
{
|
|
103
|
+
layout: "vertical",
|
|
104
|
+
size: "md",
|
|
105
|
+
placeholder: "Selecionar",
|
|
106
|
+
disabled: false,
|
|
107
|
+
errorDisplay: true,
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const open = ref(false);
|
|
112
|
+
const search = ref("");
|
|
113
|
+
const inputEl = ref();
|
|
114
|
+
const collapseEl = ref();
|
|
115
|
+
const collapsePosition = ref();
|
|
116
|
+
const filteredOptions = computed(() =>
|
|
117
|
+
search.value && props.options
|
|
118
|
+
? props.options.filter((opt) =>
|
|
119
|
+
opt.label.toLowerCase().includes(search.value.toLowerCase())
|
|
120
|
+
)
|
|
121
|
+
: props.options
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const {
|
|
125
|
+
value: inputValue,
|
|
126
|
+
errorMessage,
|
|
127
|
+
meta,
|
|
128
|
+
validate,
|
|
129
|
+
} = useField("input", props.validation, { initialValue: props.modelValue });
|
|
130
|
+
|
|
131
|
+
defineExpose({ errorMessage, meta, validate });
|
|
132
|
+
|
|
133
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
134
|
+
|
|
135
|
+
const displayValue = computed(() =>
|
|
136
|
+
inputValue.value && props.options
|
|
137
|
+
? props.multiSelect
|
|
138
|
+
? props.options
|
|
139
|
+
.filter((o) => inputValue.value.includes(o.value))
|
|
140
|
+
?.map((o) => o.label)
|
|
141
|
+
.join(", ")
|
|
142
|
+
: props.options.find((o) => o.value == inputValue.value)?.label
|
|
143
|
+
: ""
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
const sizeReset = () => {
|
|
147
|
+
const displayEl = inputEl.value.querySelector(
|
|
148
|
+
".select-toggle .select-display"
|
|
149
|
+
) as HTMLElement;
|
|
150
|
+
|
|
151
|
+
displayEl.style.whiteSpace = "";
|
|
152
|
+
displayEl.style.width = "";
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
156
|
+
window.requestAnimationFrame(() => {
|
|
157
|
+
const displayEl = entries[0].target.querySelector(
|
|
158
|
+
".select-toggle .select-display"
|
|
159
|
+
) as HTMLElement;
|
|
160
|
+
|
|
161
|
+
displayEl.style.width = `${displayEl.getBoundingClientRect().width}px`;
|
|
162
|
+
displayEl.style.whiteSpace = "nowrap";
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
onMounted(() => {
|
|
167
|
+
resizeObserver.observe(inputEl.value);
|
|
168
|
+
|
|
169
|
+
window.addEventListener("resize", sizeReset);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
onUnmounted(() => {
|
|
173
|
+
window.removeEventListener("resize", sizeReset);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
const closeSelectOutside = (event: Event) => {
|
|
177
|
+
if (
|
|
178
|
+
!inputEl.value.contains(event.target) &&
|
|
179
|
+
!collapseEl.value.contains(event.target)
|
|
180
|
+
) {
|
|
181
|
+
toggleCollapse();
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const toggleCollapse = () => {
|
|
186
|
+
if (!props.disabled) {
|
|
187
|
+
open.value = !open.value;
|
|
188
|
+
|
|
189
|
+
if (!open.value) {
|
|
190
|
+
setTimeout(() => {
|
|
191
|
+
search.value = "";
|
|
192
|
+
}, 300);
|
|
193
|
+
window.removeEventListener("click", closeSelectOutside);
|
|
194
|
+
window.removeEventListener("scroll", closeSelectOutside);
|
|
195
|
+
findScrollAncestor(inputEl.value).removeEventListener(
|
|
196
|
+
"scroll",
|
|
197
|
+
closeSelectOutside
|
|
198
|
+
);
|
|
199
|
+
} else {
|
|
200
|
+
window.addEventListener("click", closeSelectOutside);
|
|
201
|
+
window.addEventListener("scroll", closeSelectOutside);
|
|
202
|
+
findScrollAncestor(inputEl.value).addEventListener(
|
|
203
|
+
"scroll",
|
|
204
|
+
closeSelectOutside
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const calcPosition = (el: any) => {
|
|
211
|
+
const elRect = el.getBoundingClientRect();
|
|
212
|
+
const inputRect = inputEl.value.getBoundingClientRect();
|
|
213
|
+
const position =
|
|
214
|
+
inputRect.y + inputRect.height + elRect.height > window.innerHeight
|
|
215
|
+
? "top"
|
|
216
|
+
: "bottom";
|
|
217
|
+
el.style.top =
|
|
218
|
+
position == "top"
|
|
219
|
+
? `${inputRect.y - elRect.height + 1}px`
|
|
220
|
+
: `${inputRect.y + inputRect.height - 1}px`;
|
|
221
|
+
el.style.left = `${inputRect.left}px`;
|
|
222
|
+
el.style.width = `${inputRect.width}px`;
|
|
223
|
+
collapsePosition.value = `position-${position}`;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const selectValue = (value: string) => {
|
|
227
|
+
if (props.multiSelect) {
|
|
228
|
+
const payload = inputValue.value ? [...inputValue.value] : [];
|
|
229
|
+
|
|
230
|
+
if (payload.includes(value)) {
|
|
231
|
+
payload.splice(payload.indexOf(value), 1);
|
|
232
|
+
} else {
|
|
233
|
+
payload.push(value);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
emit("update:modelValue", payload);
|
|
237
|
+
} else {
|
|
238
|
+
toggleCollapse();
|
|
239
|
+
emit("update:modelValue", value);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
</script>
|
|
243
|
+
|
|
244
|
+
<style lang="scss" scoped>
|
|
245
|
+
@import "../../assets/forms.scss";
|
|
246
|
+
|
|
247
|
+
.input-container-select {
|
|
248
|
+
&.error {
|
|
249
|
+
.select-toggle {
|
|
250
|
+
@include input-error;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.select-toggle {
|
|
255
|
+
@include input-template;
|
|
256
|
+
|
|
257
|
+
display: flex;
|
|
258
|
+
justify-content: space-between;
|
|
259
|
+
gap: 10px;
|
|
260
|
+
cursor: pointer;
|
|
261
|
+
|
|
262
|
+
.select-display {
|
|
263
|
+
flex-grow: 1;
|
|
264
|
+
text-overflow: ellipsis;
|
|
265
|
+
overflow: hidden;
|
|
266
|
+
|
|
267
|
+
&.placeholder {
|
|
268
|
+
color: $input-placeholder-color;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
&.open {
|
|
273
|
+
&.position-bottom {
|
|
274
|
+
border-radius: 5px 5px 0 0;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
&.position-top {
|
|
278
|
+
border-radius: 0 0 5px 5px;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
em {
|
|
282
|
+
transform: rotate(180deg);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
&.disabled {
|
|
287
|
+
color: #dedede;
|
|
288
|
+
cursor: auto;
|
|
289
|
+
pointer-events: none;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
em {
|
|
293
|
+
font-size: 12px;
|
|
294
|
+
line-height: 18px;
|
|
295
|
+
transition: all 0.3s ease-in-out;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.select-collapse {
|
|
301
|
+
position: fixed;
|
|
302
|
+
z-index: 10000;
|
|
303
|
+
max-height: 400px;
|
|
304
|
+
overflow-y: auto;
|
|
305
|
+
background-color: #fff;
|
|
306
|
+
border: 1px solid #dedede;
|
|
307
|
+
transition: all 0.3s ease-in-out;
|
|
308
|
+
|
|
309
|
+
&.position-top {
|
|
310
|
+
border-top-left-radius: 5px;
|
|
311
|
+
border-top-right-radius: 5px;
|
|
312
|
+
box-shadow: 0px -4px 10px rgba(0, 0, 0, 0.15);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
&.position-bottom {
|
|
316
|
+
border-bottom-left-radius: 5px;
|
|
317
|
+
border-bottom-right-radius: 5px;
|
|
318
|
+
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.15);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.search-filter-container {
|
|
322
|
+
padding: 5px 10px;
|
|
323
|
+
|
|
324
|
+
input {
|
|
325
|
+
outline: none;
|
|
326
|
+
padding: 10px 8px;
|
|
327
|
+
font-size: 15px;
|
|
328
|
+
line-height: 18px;
|
|
329
|
+
width: 100%;
|
|
330
|
+
border: 1px solid #dedede;
|
|
331
|
+
border-radius: 5px;
|
|
332
|
+
|
|
333
|
+
&:active,
|
|
334
|
+
&:focus {
|
|
335
|
+
border: 1px solid #5fbbff;
|
|
336
|
+
outline: none;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
&.slide-fade-enter-from,
|
|
342
|
+
&.slide-fade-leave-to {
|
|
343
|
+
opacity: 0;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
&.slide-fade-enter-to,
|
|
347
|
+
&.slide-fade-leave-from {
|
|
348
|
+
opacity: 1;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
ul {
|
|
352
|
+
padding: 0;
|
|
353
|
+
margin: 0;
|
|
354
|
+
|
|
355
|
+
li {
|
|
356
|
+
display: flex;
|
|
357
|
+
align-items: center;
|
|
358
|
+
transition: all 0.3s ease-in-out;
|
|
359
|
+
font-size: 14px;
|
|
360
|
+
line-height: 17px;
|
|
361
|
+
padding: 8px 10px;
|
|
362
|
+
cursor: pointer;
|
|
363
|
+
user-select: none;
|
|
364
|
+
overflow-x: hidden;
|
|
365
|
+
|
|
366
|
+
&:hover {
|
|
367
|
+
background-color: #f1f7ee;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.checkbox-icon {
|
|
371
|
+
height: 20px;
|
|
372
|
+
width: 20px;
|
|
373
|
+
border: 2px solid #dedede;
|
|
374
|
+
border-radius: 3px;
|
|
375
|
+
transition: all 0.3s ease-in-out;
|
|
376
|
+
display: inline-flex;
|
|
377
|
+
place-items: center;
|
|
378
|
+
margin-right: 10px;
|
|
379
|
+
|
|
380
|
+
&:before {
|
|
381
|
+
color: #77aa43;
|
|
382
|
+
opacity: 0;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
&.active .checkbox-icon:before {
|
|
387
|
+
opacity: 1;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
</style>
|