cja-phoenix 0.0.13 → 0.0.15

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 (33) hide show
  1. package/dist/cja-phoenix.es.js +2897 -2664
  2. package/dist/style.css +1 -1
  3. package/dist/types/components/forms/FileInput.vue.d.ts +49 -0
  4. package/dist/types/components/forms/InputTitle.vue.d.ts +17 -0
  5. package/dist/types/components/forms/InputToggle.vue.d.ts +42 -0
  6. package/dist/types/components/forms/PhoneInput.vue.d.ts +56 -53
  7. package/dist/types/components/forms/SelectInput.vue.d.ts +21 -11
  8. package/dist/types/components/forms/TextInput.vue.d.ts +28 -17
  9. package/dist/types/components/index.d.ts +5 -1
  10. package/dist/types/components/structural/CollapseContainer.vue.d.ts +29 -0
  11. package/dist/types/components/structural/ContentTabs.vue.d.ts +25 -0
  12. package/dist/types/types/Tab.d.ts +4 -0
  13. package/package.json +5 -5
  14. package/src/assets/forms.scss +10 -9
  15. package/src/assets/iconia/fonts/CGG-icomoon.eot +0 -0
  16. package/src/assets/iconia/fonts/CGG-icomoon.svg +1 -1
  17. package/src/assets/iconia/fonts/CGG-icomoon.ttf +0 -0
  18. package/src/assets/iconia/fonts/CGG-icomoon.woff +0 -0
  19. package/src/assets/iconia/selection.json +1 -1
  20. package/src/assets/iconia/style.css +5 -5
  21. package/src/assets/iconia/style.scss +5 -5
  22. package/src/components/composite/ProductDetails.vue +27 -38
  23. package/src/components/forms/FileInput.vue +227 -0
  24. package/src/components/forms/InputTitle.vue +42 -0
  25. package/src/components/forms/InputToggle.vue +80 -0
  26. package/src/components/forms/PhoneInput.vue +29 -28
  27. package/src/components/forms/SelectInput.vue +27 -24
  28. package/src/components/forms/TextInput.vue +19 -11
  29. package/src/components/index.ts +9 -0
  30. package/src/components/structural/CollapseContainer.vue +115 -0
  31. package/src/components/structural/ContentTabs.vue +104 -0
  32. package/src/index.ts +0 -2
  33. package/src/types/Tab.ts +4 -0
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <div class="form-group">
3
- <div class="input-title" v-if="title">{{ title }}</div>
2
+ <div class="form-group" :class="[layout]">
3
+ <InputTitle v-bind="{ title, tooltip }" v-if="title" />
4
4
 
5
5
  <div
6
6
  class="input-container"
@@ -9,7 +9,8 @@
9
9
  }"
10
10
  >
11
11
  <input
12
- v-maska="mask"
12
+ v-maska
13
+ :data-maska="mask"
13
14
  :id="id"
14
15
  :inputmode="inputmode"
15
16
  :placeholder="placeholder && placeholder"
@@ -42,24 +43,31 @@ import {
42
43
  onMounted,
43
44
  ref,
44
45
  } from "vue";
46
+ import { vMaska } from "maska";
47
+ import InputTitle from "./InputTitle.vue";
45
48
 
46
49
  const props = withDefaults(
47
50
  defineProps<{
48
- mask?: string;
49
- placeholder?: InputHTMLAttributes["placeholder"];
50
- icon?: string;
51
51
  title?: string;
52
- inputmode?: HTMLAttributes["inputmode"];
53
- type?: InputHTMLAttributes["type"];
52
+ tooltip?: string;
53
+ placeholder?: InputHTMLAttributes["placeholder"];
54
+ layout?: "vertical" | "horizontal";
54
55
  error?: string;
55
- modelValue: InputHTMLAttributes["value"];
56
- autocomplete?: InputHTMLAttributes["autocomplete"];
57
- id?: InputHTMLAttributes["id"];
58
56
  validation?: any;
59
57
  errorDisplay?: boolean;
58
+ modelValue: InputHTMLAttributes["value"];
59
+ id?: InputHTMLAttributes["id"];
60
+ disabled?: InputHTMLAttributes["disabled"];
61
+ mask?: string;
62
+ icon?: string;
63
+ inputmode?: InputHTMLAttributes["inputmode"];
64
+ type?: InputHTMLAttributes["type"];
65
+ autocomplete?: InputHTMLAttributes["autocomplete"];
60
66
  suffix?: string;
67
+ prefix?: string;
61
68
  }>(),
62
69
  {
70
+ layout: "vertical",
63
71
  type: "text",
64
72
  errorDisplay: true,
65
73
  }
@@ -1,11 +1,16 @@
1
1
  import Modal from "./structural/Modal.vue";
2
2
  import CjaButton from "./structural/CjaButton.vue";
3
3
  import LoadingSpinner from "./structural/LoadingSpinner.vue";
4
+ import ContentTabs from "./structural/ContentTabs.vue";
4
5
  import Scaffold from "./structural/Scaffold.vue";
6
+
5
7
  import TextInput from "./forms/TextInput.vue";
6
8
  import PhoneInput from "./forms/PhoneInput.vue";
7
9
  import CheckboxInput from "./forms/CheckboxInput.vue";
8
10
  import SelectInput from "./forms/SelectInput.vue";
11
+ import FileInput from "./forms/FileInput.vue";
12
+ import InputToggle from "./forms/InputToggle.vue";
13
+ import CollapseContainer from "./structural/CollapseContainer.vue";
9
14
 
10
15
  import ProductDetails from "./composite/ProductDetails.vue";
11
16
 
@@ -19,4 +24,8 @@ export {
19
24
  LoadingSpinner,
20
25
  Scaffold,
21
26
  ProductDetails,
27
+ InputToggle,
28
+ FileInput,
29
+ ContentTabs,
30
+ CollapseContainer,
22
31
  };
@@ -0,0 +1,115 @@
1
+ <template>
2
+ <div class="collapse-container">
3
+ <div
4
+ class="collapse-header"
5
+ @click="active = !active"
6
+ :class="{ active: active }"
7
+ >
8
+ <div class="header-wrapper">
9
+ <slot name="header"></slot>
10
+ </div>
11
+ <span class="m-cgg-icon--chevron-down"></span>
12
+ </div>
13
+ <Transition
14
+ name="slide"
15
+ @before-enter="setHeightZero"
16
+ @enter="setHeightSize"
17
+ @leave="setHeightZero"
18
+ >
19
+ <div
20
+ v-show="active"
21
+ ref="contentContainer"
22
+ class="content-container"
23
+ :class="{ active: active }"
24
+ >
25
+ <div ref="contentWrapper" class="content-wrapper">
26
+ <slot name="content"></slot>
27
+ </div>
28
+ </div>
29
+ </Transition>
30
+ </div>
31
+ </template>
32
+
33
+ <script lang="ts" setup>
34
+ import { onMounted, onUnmounted, ref } from "vue";
35
+
36
+ const props = defineProps<{
37
+ defaultActive?: boolean;
38
+ scrollToContent?: {
39
+ element: HTMLElement;
40
+ };
41
+ }>();
42
+
43
+ const active = ref(props.defaultActive);
44
+ const contentContainer = ref();
45
+ const contentWrapper = ref();
46
+
47
+ const setHeightSize = () => {
48
+ requestAnimationFrame(() => {
49
+ if (contentContainer.value && contentWrapper.value) {
50
+ contentContainer.value.style.height = `${contentWrapper.value.clientHeight}px`;
51
+
52
+ if (active.value && props.scrollToContent) {
53
+ setTimeout(() => {
54
+ props.scrollToContent?.element.scrollTo({
55
+ top: contentWrapper.value.offsetTop,
56
+ left: 0,
57
+ behavior: "smooth",
58
+ });
59
+ }, 250);
60
+ }
61
+
62
+ setTimeout(() => {
63
+ contentContainer.value.style.height = "";
64
+ contentContainer.value.style.overflow = "visible";
65
+ }, 200);
66
+ }
67
+ });
68
+ };
69
+
70
+ const setHeightZero = () => {
71
+ contentContainer.value.style.height = `${contentWrapper.value.clientHeight}px`;
72
+
73
+ requestAnimationFrame(() => {
74
+ contentContainer.value.style.height = "0";
75
+ contentContainer.value.style.overflow = "";
76
+ });
77
+ };
78
+
79
+ onMounted(() => {
80
+ if (props.defaultActive) {
81
+ setHeightSize();
82
+ }
83
+
84
+ window.addEventListener("resize", setHeightSize);
85
+ });
86
+
87
+ onUnmounted(() => {
88
+ window.removeEventListener("resize", setHeightSize);
89
+ });
90
+ </script>
91
+
92
+ <style lang="scss" scoped>
93
+ .collapse-header {
94
+ display: flex;
95
+ flex-direction: row;
96
+ align-items: center;
97
+ justify-content: space-between;
98
+ cursor: pointer;
99
+ user-select: none;
100
+
101
+ > span {
102
+ transition: all 0.2s linear;
103
+ }
104
+
105
+ &.active > span {
106
+ transform: rotate(180deg);
107
+ }
108
+ }
109
+
110
+ .content-container {
111
+ box-sizing: border-box;
112
+ overflow: hidden;
113
+ transition: all 0.2s linear;
114
+ }
115
+ </style>
@@ -0,0 +1,104 @@
1
+ <template>
2
+ <div class="content-tabs">
3
+ <div class="control-container">
4
+ <button
5
+ v-for="tab in tabs"
6
+ :key="tab.control"
7
+ :class="{ active: activeTab == tab.control }"
8
+ @click="
9
+ activeTab = tab.control;
10
+ $emit('tab:changed');
11
+ "
12
+ >
13
+ {{ tab.label }}
14
+ </button>
15
+ </div>
16
+ <div class="content-container">
17
+ <TransitionGroup name="fade">
18
+ <div
19
+ v-for="tab in tabs"
20
+ :key="tab.control"
21
+ v-show="activeTab == tab.control"
22
+ :class="`tab-${tab.control}`"
23
+ >
24
+ <slot :name="tab.control"></slot>
25
+ </div>
26
+ </TransitionGroup>
27
+ </div>
28
+ </div>
29
+ </template>
30
+
31
+ <script lang="ts" setup>
32
+ import { ref } from "vue";
33
+ import { Tab } from "../../types/Tab";
34
+
35
+ const props = defineProps<{
36
+ default: string;
37
+ tabs: Tab[];
38
+ }>();
39
+ const activeTab = ref(props.default);
40
+
41
+ const emit = defineEmits(["tab:changed"]);
42
+ </script>
43
+
44
+ <style lang="scss" scoped>
45
+ .content-tabs {
46
+ .control-container {
47
+ display: flex;
48
+ flex-direction: row;
49
+ flex-wrap: nowrap;
50
+ margin-bottom: 30px;
51
+
52
+ button {
53
+ flex-grow: 1;
54
+ flex-shrink: 0;
55
+ outline: none;
56
+ background: none;
57
+ font-weight: 700;
58
+ padding: 0 0 6px;
59
+ font-size: 16px;
60
+ line-height: 19px;
61
+ text-align: center;
62
+ border: none;
63
+ color: #979290;
64
+ cursor: pointer;
65
+ border-bottom: 1px solid #979290;
66
+
67
+ &.active {
68
+ color: #076b9c;
69
+ border-bottom: 3px solid #076b9c;
70
+ }
71
+
72
+ &:focus {
73
+ outline: none;
74
+ }
75
+ }
76
+ }
77
+
78
+ .content-container {
79
+ position: relative;
80
+
81
+ .fade-leave-active {
82
+ position: absolute;
83
+ left: 0;
84
+ top: 0;
85
+ width: 100%;
86
+ transition: all 0.3s ease-in-out;
87
+ }
88
+
89
+ .fade-enter-active {
90
+ transition: all 0.3s ease-in-out 0.3s;
91
+ }
92
+
93
+ .fade-enter-from,
94
+ .fade-leave-to {
95
+ opacity: 0;
96
+ }
97
+
98
+ .fade-enter-to,
99
+ .fade-leave-from {
100
+ opacity: 1;
101
+ }
102
+ }
103
+ }
104
+ </style>
package/src/index.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { App } from "vue";
2
2
  import * as components from "./components";
3
- import Maska from "maska";
4
3
  import VueTippy from "vue-tippy";
5
4
 
6
5
  function install(app: App) {
@@ -9,7 +8,6 @@ function install(app: App) {
9
8
  app.component(key, components[key]);
10
9
  }
11
10
 
12
- app.use(Maska);
13
11
  app.use(VueTippy, {
14
12
  defaultProps: { theme: "light-border", allowHTML: true },
15
13
  });
@@ -0,0 +1,4 @@
1
+ export interface Tab {
2
+ label: string;
3
+ control: string;
4
+ }