cja-phoenix 0.0.1 → 0.0.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.
Files changed (42) hide show
  1. package/README.md +1 -0
  2. package/dist/cja-phoenix.es.js +3134 -63
  3. package/dist/fonts/ProximaNova-Black.woff +0 -0
  4. package/dist/fonts/ProximaNova-Black.woff2 +0 -0
  5. package/dist/fonts/ProximaNova-Bold.woff +0 -0
  6. package/dist/fonts/ProximaNova-Bold.woff2 +0 -0
  7. package/dist/fonts/ProximaNova-Extrabld.woff +0 -0
  8. package/dist/fonts/ProximaNova-Extrabld.woff2 +0 -0
  9. package/dist/fonts/ProximaNova-Regular.woff +0 -0
  10. package/dist/fonts/ProximaNova-Regular.woff2 +0 -0
  11. package/dist/fonts/ProximaNovaT-Thin.woff +0 -0
  12. package/dist/fonts/ProximaNovaT-Thin.woff2 +0 -0
  13. package/dist/iconia/fonts/CGG-icomoon.eot +0 -0
  14. package/dist/iconia/fonts/CGG-icomoon.svg +507 -0
  15. package/dist/iconia/fonts/CGG-icomoon.ttf +0 -0
  16. package/dist/iconia/fonts/CGG-icomoon.woff +0 -0
  17. package/dist/iconia/selection.json +1 -0
  18. package/dist/iconia/style.css +1529 -0
  19. package/dist/style.css +1 -1
  20. package/dist/types/components/CheckboxInput.vue.d.ts +14 -0
  21. package/dist/types/components/CjaButton.vue.d.ts +9 -0
  22. package/dist/types/components/ComponentA.vue.d.ts +4 -4
  23. package/dist/types/components/ComponentB.vue.d.ts +1 -1
  24. package/dist/types/components/Modal.vue.d.ts +32 -0
  25. package/dist/types/components/PhoneInput.vue.d.ts +62 -0
  26. package/dist/types/components/TextInput.vue.d.ts +58 -0
  27. package/dist/types/components/index.d.ts +8 -3
  28. package/dist/types/stories/Modal.story.vue.d.ts +2 -0
  29. package/package.json +18 -6
  30. package/src/assets/fonts.scss +44 -0
  31. package/src/assets/forms.scss +375 -0
  32. package/src/assets/main.scss +9 -12
  33. package/src/components/CheckboxInput.vue +27 -0
  34. package/src/components/CjaButton.vue +65 -0
  35. package/src/components/Modal.vue +191 -0
  36. package/src/components/PhoneInput.vue +91 -0
  37. package/src/components/TextInput.vue +72 -0
  38. package/src/components/index.ts +14 -4
  39. package/src/env.d.ts +5 -4
  40. package/src/index.ts +3 -0
  41. package/src/stories/Modal.story.vue +18 -0
  42. package/src/assets/fonts/myfont.woff +0 -0
@@ -0,0 +1,91 @@
1
+ <template>
2
+ <div class="form-group">
3
+ <div class="input-title" v-if="title">{{ title }}</div>
4
+
5
+ <div class="input-container" :class="{ error: errorMessage }">
6
+ <input
7
+ ref="inputEl"
8
+ :id="id"
9
+ v-maska="'#########'"
10
+ :placeholder="placeholder && placeholder"
11
+ type="tel"
12
+ :value="value"
13
+ :autocomplete="autocomplete"
14
+ @input="
15
+ emit('update:modelValue', (<HTMLInputElement>$event.target).value)
16
+ "
17
+ />
18
+ </div>
19
+
20
+ <div v-if="errorMessage && errorDisplay" class="input-error">
21
+ {{ errorMessage }}
22
+ </div>
23
+ </div>
24
+ </template>
25
+
26
+ <script lang="ts" setup>
27
+ import { useField } from "vee-validate";
28
+ import intlTelInput from "intl-tel-input";
29
+ import { ref, onMounted, watch } from "vue";
30
+
31
+ const inputEl = ref();
32
+ const props = defineProps({
33
+ placeholder: {
34
+ type: String,
35
+ default: "",
36
+ },
37
+ title: {
38
+ type: String,
39
+ required: true,
40
+ },
41
+ modelValue: {
42
+ type: String,
43
+ default: "",
44
+ },
45
+ phoneCountryCode: {
46
+ type: String,
47
+ default: "",
48
+ },
49
+ errorDisplay: {
50
+ type: Boolean,
51
+ default: true,
52
+ },
53
+ validation: Object,
54
+ autocomplete: String,
55
+ id: String,
56
+ });
57
+
58
+ const { value, errorMessage, meta, validate, setValue } = useField(
59
+ "input",
60
+ props.validation,
61
+ { initialValue: props.modelValue }
62
+ );
63
+
64
+ watch(
65
+ () => props.modelValue,
66
+ (newVal) => {
67
+ setValue(newVal);
68
+ }
69
+ );
70
+
71
+ defineExpose({ errorMessage, meta, validate });
72
+
73
+ const emit = defineEmits(["update:modelValue", "update:phoneCountryCode"]);
74
+
75
+ onMounted(() => {
76
+ inputEl.value.addEventListener("countrychange", () =>
77
+ emit(
78
+ "update:phoneCountryCode",
79
+ window.intlTelInputGlobals
80
+ .getInstance(inputEl.value)
81
+ .getSelectedCountryData().dialCode
82
+ )
83
+ );
84
+
85
+ intlTelInput(inputEl.value, {
86
+ initialCountry: "pt",
87
+ preferredCountries: ["pt"],
88
+ separateDialCode: true,
89
+ });
90
+ });
91
+ </script>
@@ -0,0 +1,72 @@
1
+ <template>
2
+ <div class="form-group">
3
+ <div class="input-title" v-if="title">{{ title }}</div>
4
+
5
+ <div
6
+ class="input-container"
7
+ :class="{
8
+ error: errorMessage,
9
+ }"
10
+ >
11
+ <input
12
+ v-maska="mask"
13
+ :id="id"
14
+ :inputmode="inputmode"
15
+ :placeholder="placeholder && placeholder"
16
+ :type="type"
17
+ :value="value"
18
+ @input="
19
+ emit('update:modelValue', (<HTMLInputElement>$event.target).value)
20
+ "
21
+ :autocomplete="autocomplete"
22
+ />
23
+ </div>
24
+
25
+ <div v-if="errorMessage && errorDisplay" class="input-error">
26
+ {{ errorMessage }}
27
+ </div>
28
+ </div>
29
+ </template>
30
+
31
+ <script lang="ts" setup>
32
+ import { useField } from "vee-validate";
33
+ import { HTMLAttributes, InputHTMLAttributes, watch } from "vue";
34
+
35
+ const props = withDefaults(
36
+ defineProps<{
37
+ mask?: string;
38
+ placeholder?: InputHTMLAttributes["placeholder"];
39
+ icon?: string;
40
+ title?: string;
41
+ inputmode?: HTMLAttributes["inputmode"];
42
+ type?: InputHTMLAttributes["type"];
43
+ error?: string;
44
+ modelValue: InputHTMLAttributes["value"];
45
+ autocomplete?: InputHTMLAttributes["autocomplete"];
46
+ id?: InputHTMLAttributes["id"];
47
+ validation?: any;
48
+ errorDisplay?: boolean;
49
+ }>(),
50
+ {
51
+ type: "text",
52
+ errorDisplay: true,
53
+ }
54
+ );
55
+
56
+ const { value, errorMessage, meta, validate, setValue } = useField(
57
+ "input",
58
+ props.validation,
59
+ { initialValue: props.modelValue }
60
+ );
61
+
62
+ watch(
63
+ () => props.modelValue,
64
+ (newVal) => {
65
+ setValue(newVal);
66
+ }
67
+ );
68
+
69
+ defineExpose({ errorMessage, meta, validate });
70
+
71
+ const emit = defineEmits(["update:modelValue"]);
72
+ </script>
@@ -1,7 +1,17 @@
1
- import ComponentA from './ComponentA.vue'
2
- import ComponentB from './ComponentB.vue'
1
+ import ComponentA from "./ComponentA.vue";
2
+ import ComponentB from "./ComponentB.vue";
3
+ import Modal from "./Modal.vue";
4
+ import CjaButton from "./CjaButton.vue";
5
+ import TextInput from "./TextInput.vue";
6
+ import PhoneInput from "./PhoneInput.vue";
7
+ import CheckboxInput from "./CheckboxInput.vue";
3
8
 
4
9
  export {
5
10
  ComponentA,
6
- ComponentB
7
- }
11
+ ComponentB,
12
+ Modal,
13
+ CjaButton,
14
+ TextInput,
15
+ PhoneInput,
16
+ CheckboxInput,
17
+ };
package/src/env.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  /// <reference types="vite/client" />
2
+ /// <reference types="@histoire/plugin-vue/components" />
2
3
 
3
- declare module '*.vue' {
4
- import { DefineComponent } from 'vue'
4
+ declare module "*.vue" {
5
+ import { DefineComponent } from "vue";
5
6
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
6
- const component: DefineComponent<{}, {}, any>
7
- export default component
7
+ const component: DefineComponent<{}, {}, any>;
8
+ export default component;
8
9
  }
package/src/index.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  import { App } from "vue";
2
2
  import * as components from "./components";
3
+ import Maska from "maska";
3
4
 
4
5
  function install(app: App) {
5
6
  for (const key in components) {
6
7
  // @ts-expect-error
7
8
  app.component(key, components[key]);
8
9
  }
10
+
11
+ app.use(Maska);
9
12
  }
10
13
 
11
14
  import "./assets/main.scss";
@@ -0,0 +1,18 @@
1
+ <script setup lang="ts">
2
+ import { ref, reactive } from "vue";
3
+ import Modal from "../components/Modal.vue";
4
+
5
+ const modal = ref();
6
+
7
+ const state = reactive({
8
+ title: "",
9
+ });
10
+ </script>
11
+
12
+ <template>
13
+ <Story title="Modal">
14
+ <modal ref="modal" :title="state.title"></modal>
15
+
16
+ <button @click="modal.openModal()" type="button">Open modal</button>
17
+ </Story>
18
+ </template>
Binary file