cja-phoenix 0.3.6 → 0.3.7

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 (47) hide show
  1. package/README.md +2 -2
  2. package/dist/cja-phoenix.es.js +2412 -2423
  3. package/dist/types/components/composite/CheckoutCrossSell.vue.d.ts +24 -31
  4. package/dist/types/components/composite/CheckoutLayout.vue.d.ts +14 -11
  5. package/dist/types/components/composite/CheckoutMilestones.vue.d.ts +13 -10
  6. package/dist/types/components/composite/CjaMenuBar.vue.d.ts +32 -25
  7. package/dist/types/components/composite/FunnelLayout.vue.d.ts +20 -23
  8. package/dist/types/components/composite/FunnelSubmit.vue.d.ts +16 -15
  9. package/dist/types/components/composite/FunnelSummary.vue.d.ts +55 -54
  10. package/dist/types/components/composite/FunnelTitle.vue.d.ts +17 -22
  11. package/dist/types/components/composite/InfoShowcase.vue.d.ts +21 -24
  12. package/dist/types/components/composite/JourneyMacroSteps.vue.d.ts +13 -10
  13. package/dist/types/components/forms/CheckboxInput.vue.d.ts +32 -33
  14. package/dist/types/components/forms/CurrencyInput.vue.d.ts +53 -80
  15. package/dist/types/components/forms/FileInput.vue.d.ts +67 -92
  16. package/dist/types/components/forms/NumberInput.vue.d.ts +47 -62
  17. package/dist/types/components/forms/PhoneInput.vue.d.ts +57 -92
  18. package/dist/types/components/forms/RadioInput.vue.d.ts +38 -53
  19. package/dist/types/components/forms/SelectInput.vue.d.ts +67 -108
  20. package/dist/types/components/forms/SelectionTiles.vue.d.ts +41 -54
  21. package/dist/types/components/forms/TextInput.vue.d.ts +61 -104
  22. package/dist/types/components/forms/TileCheckboxInput.vue.d.ts +20 -31
  23. package/dist/types/components/forms/ToggleInput.vue.d.ts +44 -63
  24. package/dist/types/components/forms/structure/InputContainer.vue.d.ts +14 -9
  25. package/dist/types/components/forms/structure/InputError.vue.d.ts +13 -10
  26. package/dist/types/components/forms/structure/InputTitle.vue.d.ts +17 -22
  27. package/dist/types/components/structural/CjaButton.vue.d.ts +42 -47
  28. package/dist/types/components/structural/CollapseContainer.vue.d.ts +33 -22
  29. package/dist/types/components/structural/ContentTabs.vue.d.ts +17 -20
  30. package/dist/types/components/structural/FixedContainer.vue.d.ts +55 -56
  31. package/dist/types/components/structural/GridContainer.vue.d.ts +26 -11
  32. package/dist/types/components/structural/GridItem.vue.d.ts +18 -21
  33. package/dist/types/components/structural/InfoMessage.vue.d.ts +20 -29
  34. package/dist/types/components/structural/LoadingSpinner.vue.d.ts +16 -15
  35. package/dist/types/components/structural/Modal.vue.d.ts +15 -10
  36. package/package.json +3 -6
  37. package/src/utils/cjaStore.ts +7 -15
  38. package/dist/types/histoire.setup.d.ts +0 -2
  39. package/dist/types/stories/CjaButton.story.vue.d.ts +0 -2
  40. package/dist/types/stories/ContentTabs.story.vue.d.ts +0 -2
  41. package/dist/types/stories/Modal.story.vue.d.ts +0 -2
  42. package/src/histoire.setup.ts +0 -2
  43. package/src/stories/CjaButton.story.vue +0 -192
  44. package/src/stories/ContentTabs.story.vue +0 -59
  45. package/src/stories/Modal.story.vue +0 -88
  46. /package/src/utils/{GetI18nMessages.ts → getI18nMessages.ts} +0 -0
  47. /package/src/utils/{JsonReviver.ts → jsonReviver.ts} +0 -0
@@ -1,27 +1,24 @@
1
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
2
- sizeSm: {
3
- type: import("vue").PropType<1 | 2 | 3 | 4>;
4
- };
5
- sizeMd: {
6
- type: import("vue").PropType<1 | 2 | 3 | 4>;
7
- };
8
- sizeLg: {
9
- type: import("vue").PropType<1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12>;
10
- };
11
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
12
- sizeSm: {
13
- type: import("vue").PropType<1 | 2 | 3 | 4>;
14
- };
15
- sizeMd: {
16
- type: import("vue").PropType<1 | 2 | 3 | 4>;
17
- };
18
- sizeLg: {
19
- type: import("vue").PropType<1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12>;
20
- };
21
- }>>, {}, {}>, {
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
2
+ sizeSm?: 1 | 2 | 3 | 4 | undefined;
3
+ sizeMd?: 1 | 2 | 3 | 4 | undefined;
4
+ sizeLg?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | undefined;
5
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
6
+ sizeSm?: 1 | 2 | 3 | 4 | undefined;
7
+ sizeMd?: 1 | 2 | 3 | 4 | undefined;
8
+ sizeLg?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | undefined;
9
+ }>>>, {}, {}>, {
22
10
  default?(_: {}): any;
23
11
  }>;
24
12
  export default _default;
13
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
14
+ type __VLS_TypePropsToRuntimeProps<T> = {
15
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
16
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
17
+ } : {
18
+ type: import('vue').PropType<T[K]>;
19
+ required: true;
20
+ };
21
+ };
25
22
  type __VLS_WithTemplateSlots<T, S> = T & {
26
23
  new (): {
27
24
  $slots: S;
@@ -1,37 +1,28 @@
1
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
2
- title: {
3
- type: import("vue").PropType<string>;
4
- };
5
- description: {
6
- type: import("vue").PropType<string>;
7
- };
8
- toggle: {
9
- type: import("vue").PropType<boolean>;
10
- };
11
- color: {
12
- type: import("vue").PropType<"blue" | "green">;
13
- required: true;
14
- };
15
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "btn:close"[], "btn:close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
16
- title: {
17
- type: import("vue").PropType<string>;
18
- };
19
- description: {
20
- type: import("vue").PropType<string>;
21
- };
22
- toggle: {
23
- type: import("vue").PropType<boolean>;
24
- };
25
- color: {
26
- type: import("vue").PropType<"blue" | "green">;
27
- required: true;
28
- };
29
- }>> & {
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
2
+ title?: string | undefined;
3
+ description?: string | undefined;
4
+ toggle?: boolean | undefined;
5
+ color: "blue" | "green";
6
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "btn:close"[], "btn:close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
7
+ title?: string | undefined;
8
+ description?: string | undefined;
9
+ toggle?: boolean | undefined;
10
+ color: "blue" | "green";
11
+ }>>> & {
30
12
  "onBtn:close"?: ((...args: any[]) => any) | undefined;
31
13
  }, {}, {}>, {
32
14
  icon?(_: {}): any;
33
15
  }>;
34
16
  export default _default;
17
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
18
+ type __VLS_TypePropsToRuntimeProps<T> = {
19
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
20
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
21
+ } : {
22
+ type: import('vue').PropType<T[K]>;
23
+ required: true;
24
+ };
25
+ };
35
26
  type __VLS_WithTemplateSlots<T, S> = T & {
36
27
  new (): {
37
28
  $slots: S;
@@ -1,16 +1,17 @@
1
- declare const _default: import("vue").DefineComponent<{
2
- size: {
3
- type: import("vue").PropType<number>;
4
- };
5
- border: {
6
- type: import("vue").PropType<number>;
7
- };
8
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
9
- size: {
10
- type: import("vue").PropType<number>;
11
- };
12
- border: {
13
- type: import("vue").PropType<number>;
14
- };
15
- }>>, {}, {}>;
1
+ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
2
+ size?: number | undefined;
3
+ border?: number | undefined;
4
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
5
+ size?: number | undefined;
6
+ border?: number | undefined;
7
+ }>>>, {}, {}>;
16
8
  export default _default;
9
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
10
+ type __VLS_TypePropsToRuntimeProps<T> = {
11
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
12
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
13
+ } : {
14
+ type: import('vue').PropType<T[K]>;
15
+ required: true;
16
+ };
17
+ };
@@ -1,23 +1,28 @@
1
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
2
- title: {
3
- type: import("vue").PropType<string>;
4
- };
5
- }, {
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
2
+ title?: string | undefined;
3
+ }>, {
6
4
  active: import("vue").Ref<boolean>;
7
5
  openModal: () => void;
8
6
  closeModal: () => void;
9
7
  toggleModal: () => void;
10
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "close"[], "close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
11
- title: {
12
- type: import("vue").PropType<string>;
13
- };
14
- }>> & {
8
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "close"[], "close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
9
+ title?: string | undefined;
10
+ }>>> & {
15
11
  onClose?: ((...args: any[]) => any) | undefined;
16
12
  }, {}, {}>, {
17
13
  body?(_: {}): any;
18
14
  footer?(_: {}): any;
19
15
  }>;
20
16
  export default _default;
17
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
18
+ type __VLS_TypePropsToRuntimeProps<T> = {
19
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
20
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
21
+ } : {
22
+ type: import('vue').PropType<T[K]>;
23
+ required: true;
24
+ };
25
+ };
21
26
  type __VLS_WithTemplateSlots<T, S> = T & {
22
27
  new (): {
23
28
  $slots: S;
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "cja-phoenix",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "scripts": {
5
5
  "build:dev": "rimraf dist && vue-tsc && vite build -m development",
6
6
  "build:link": "rimraf dist && vue-tsc && vite build -m development && npm link",
7
7
  "build:prod": "rimraf dist && vue-tsc && vite build -m production",
8
8
  "publish:lib": "npm run build:prod && npm publish",
9
- "docs:dev": "vitepress dev docs",
10
9
  "story:dev": "histoire dev",
11
10
  "story:build": "histoire build",
12
11
  "story:preview": "histoire preview"
@@ -23,9 +22,9 @@
23
22
  },
24
23
  "devDependencies": {
25
24
  "@gtm-support/vue-gtm": "^2.0.0",
26
- "@histoire/plugin-vue": "^0.16.1",
27
25
  "@types/node": "^17.0.14",
28
26
  "@vitejs/plugin-vue": "^2.0.0",
27
+ "@histoire/plugin-vue": "^0.16.1",
29
28
  "histoire": "^0.16.2",
30
29
  "intl-tel-input": "^17.0.19",
31
30
  "maska": "^2.1.7",
@@ -35,7 +34,6 @@
35
34
  "typescript": "^4.4.4",
36
35
  "vee-validate": "^4.7.2",
37
36
  "vite": "^3.0.0",
38
- "vitepress": "^0.21.6",
39
37
  "vue": "^3.3.4",
40
38
  "vue-currency-input": "^3.0.5",
41
39
  "vue-i18n": "^9.2.2",
@@ -46,8 +44,7 @@
46
44
  },
47
45
  "files": [
48
46
  "src",
49
- "dist",
50
- "public"
47
+ "dist"
51
48
  ],
52
49
  "types": "./dist/types/index.d.ts",
53
50
  "module": "./dist/cja-phoenix.es.js",
@@ -27,22 +27,14 @@ export const getCjaStore = (options: {
27
27
  const field = this[target][payload.key];
28
28
 
29
29
  if (field) {
30
- if (field.hasOwnProperty("options")) {
31
- if (typeof payload.value == "string" && payload.value.includes(",")) {
32
- field.value = payload.value.split(",");
33
- } else {
34
- field.value = payload.value;
35
- }
30
+ field.value = payload.value;
36
31
 
37
- if (field.options) {
38
- field.label = Array.isArray(field.value)
39
- ? field.value.map(
40
- (v) => field.options.find((k) => k.value == v)?.label
41
- )
42
- : field.options.find((k) => k.value == field.value)?.label;
43
- }
44
- } else {
45
- field.value = payload.value;
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;
46
38
  }
47
39
  }
48
40
  },
@@ -1,2 +0,0 @@
1
- import "./assets/main.scss";
2
- import "./assets/iconia/style.scss";
@@ -1,2 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
2
- export default _default;
@@ -1,2 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
2
- export default _default;
@@ -1,2 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
2
- export default _default;
@@ -1,2 +0,0 @@
1
- import "./assets/main.scss";
2
- import "./assets/iconia/style.scss";
@@ -1,192 +0,0 @@
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>
@@ -1,59 +0,0 @@
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>
@@ -1,88 +0,0 @@
1
- <script setup lang="ts">
2
- import { ref, reactive } 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
- title: "Modal Title",
10
- modalBody: true,
11
- modalFooter: false,
12
- });
13
- </script>
14
-
15
- <template>
16
- <Story 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>
35
-
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>
45
- </Story>
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>
File without changes