@cypress-design/vue-alert 0.5.2 → 0.5.4
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/.turbo/turbo-build.log +4 -4
- package/Alert.vue +32 -16
- package/CHANGELOG.md +18 -0
- package/ReadMe.md +62 -15
- package/dist/Alert.vue.d.ts +32 -15
- package/dist/Alert.vue.d.ts.map +1 -1
- package/dist/index.es.mjs +150 -113
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/tsconfig.build.json +1 -1
- package/tsconfig.json +0 -8
- package/vue-shim.d.ts +0 -5
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
$ yarn build:module && yarn build:types
|
|
2
2
|
$ yarn vite build
|
|
3
3
|
$ /home/runner/work/cypress-design/cypress-design/node_modules/.bin/vite build
|
|
4
|
-
[36mvite v4.
|
|
4
|
+
[36mvite v4.3.5 [32mbuilding for production...[36m[39m
|
|
5
5
|
transforming...
|
|
6
6
|
[32m✓[39m 5 modules transformed.
|
|
7
7
|
rendering chunks...
|
|
8
8
|
computing gzip size...
|
|
9
|
-
[2mdist/[22m[36mindex.es.mjs [39m[1m[
|
|
10
|
-
[2mdist/[22m[36mindex.umd.js [39m[1m[
|
|
11
|
-
[32m
|
|
9
|
+
[2mdist/[22m[36mindex.es.mjs [39m[1m[2m10.97 kB[22m[1m[22m[2m │ gzip: 2.89 kB[22m[2m │ map: 295.13 kB[22m
|
|
10
|
+
[2mdist/[22m[36mindex.umd.js [39m[1m[2m9.03 kB[22m[1m[22m[2m │ gzip: 2.72 kB[22m[2m │ map: 294.33 kB[22m
|
|
11
|
+
[32m✓ built in 13.67s[39m
|
|
12
12
|
$ yarn vue-tsc --project ./tsconfig.build.json
|
|
13
13
|
$ /home/runner/work/cypress-design/cypress-design/node_modules/.bin/vue-tsc --project ./tsconfig.build.json
|
package/Alert.vue
CHANGED
|
@@ -11,10 +11,10 @@ import { DetailsAnimation } from '@cypress-design/details-animation'
|
|
|
11
11
|
import {
|
|
12
12
|
AlertSize,
|
|
13
13
|
alertSizesClasses,
|
|
14
|
-
|
|
14
|
+
AlertVariant,
|
|
15
15
|
defaultAlertSize,
|
|
16
16
|
defaultAlertTitle,
|
|
17
|
-
|
|
17
|
+
defaultAlertVariant,
|
|
18
18
|
alertClasses,
|
|
19
19
|
} from '@cypress-design/constants-alert'
|
|
20
20
|
|
|
@@ -34,7 +34,12 @@ const props = withDefaults(
|
|
|
34
34
|
/**
|
|
35
35
|
* Color scheme
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
variant?: AlertVariant
|
|
38
|
+
/**
|
|
39
|
+
* Color scheme
|
|
40
|
+
* @deprecated use `variant` instead
|
|
41
|
+
*/
|
|
42
|
+
type?: AlertVariant
|
|
38
43
|
/**
|
|
39
44
|
* If details are provided,text used in the toggle button
|
|
40
45
|
*/
|
|
@@ -61,24 +66,29 @@ const props = withDefaults(
|
|
|
61
66
|
size?: AlertSize
|
|
62
67
|
}>(),
|
|
63
68
|
{
|
|
64
|
-
|
|
69
|
+
variant: undefined,
|
|
70
|
+
type: defaultAlertVariant,
|
|
65
71
|
detailsTitle: defaultAlertTitle,
|
|
66
72
|
size: defaultAlertSize,
|
|
67
73
|
}
|
|
68
74
|
)
|
|
69
75
|
|
|
76
|
+
const variant = computed(() => {
|
|
77
|
+
return props.variant ?? props.type
|
|
78
|
+
})
|
|
79
|
+
|
|
70
80
|
const detailsRef = ref(null)
|
|
71
81
|
const contentRef = ref(null)
|
|
72
82
|
|
|
73
|
-
const
|
|
74
|
-
return alertClasses[
|
|
83
|
+
const variantClasses = computed(() => {
|
|
84
|
+
return alertClasses[variant.value] ?? {}
|
|
75
85
|
})
|
|
76
86
|
|
|
77
87
|
let timeout: number | undefined
|
|
78
88
|
|
|
79
89
|
onMounted(() => {
|
|
80
90
|
if (props.duration) {
|
|
81
|
-
timeout = setTimeout(dismiss, props.duration)
|
|
91
|
+
timeout = setTimeout(dismiss, props.duration)
|
|
82
92
|
}
|
|
83
93
|
})
|
|
84
94
|
|
|
@@ -105,13 +115,13 @@ function dismiss() {
|
|
|
105
115
|
|
|
106
116
|
const computedIconProps = computed(() => {
|
|
107
117
|
return {
|
|
108
|
-
strokeColor:
|
|
118
|
+
strokeColor: variantClasses.value.iconColor,
|
|
109
119
|
class: 'my-[4px] mr-[8px]',
|
|
110
120
|
}
|
|
111
121
|
})
|
|
112
122
|
|
|
113
123
|
const icon: ComputedRef<FunctionalComponent | null> = computed(() => {
|
|
114
|
-
switch (
|
|
124
|
+
switch (variant.value) {
|
|
115
125
|
case 'info':
|
|
116
126
|
return null
|
|
117
127
|
case 'success':
|
|
@@ -134,9 +144,9 @@ const sizeClasses = computed(() => {
|
|
|
134
144
|
<div
|
|
135
145
|
v-if="!dismissed"
|
|
136
146
|
class="overflow-hidden text-left"
|
|
137
|
-
:class="
|
|
147
|
+
:class="[variantClasses.wrapperClass, { rounded: !props.notRounded }]"
|
|
138
148
|
>
|
|
139
|
-
<div class="flex" :class="[
|
|
149
|
+
<div class="flex" :class="[variantClasses.headerClass, sizeClasses]">
|
|
140
150
|
<!--
|
|
141
151
|
@slot replace the default left icon here
|
|
142
152
|
@binding strokeColor - a windicolor that to be passed to `strokeColor`
|
|
@@ -159,10 +169,10 @@ const sizeClasses = computed(() => {
|
|
|
159
169
|
@click="dismiss"
|
|
160
170
|
aria-label="Dismiss"
|
|
161
171
|
>
|
|
162
|
-
<IconActionDeleteLarge :stroke-color="
|
|
172
|
+
<IconActionDeleteLarge :stroke-color="variantClasses.iconCloseColor" />
|
|
163
173
|
</button>
|
|
164
174
|
</div>
|
|
165
|
-
<div v-if="slots.body" class="p-[16px]" :class="
|
|
175
|
+
<div v-if="slots.body" class="p-[16px]" :class="variantClasses.bodyClass">
|
|
166
176
|
<!-- @slot body/details of the alert -->
|
|
167
177
|
<slot name="body" />
|
|
168
178
|
</div>
|
|
@@ -170,14 +180,14 @@ const sizeClasses = computed(() => {
|
|
|
170
180
|
v-if="slots.details"
|
|
171
181
|
class="p-[16px] border-t border-t-1"
|
|
172
182
|
ref="detailsRef"
|
|
173
|
-
:class="[
|
|
183
|
+
:class="[variantClasses.bodyClass, variantClasses.borderClass]"
|
|
174
184
|
>
|
|
175
185
|
<summary
|
|
176
186
|
class="flex font-medium cursor-pointer details-none"
|
|
177
|
-
:class="
|
|
187
|
+
:class="variantClasses.detailsHeaderClass"
|
|
178
188
|
>
|
|
179
189
|
<IconChevronDownSmall
|
|
180
|
-
:strokeColor="
|
|
190
|
+
:strokeColor="variantClasses.iconChevronColor"
|
|
181
191
|
class="icon my-[4px] mr-[8px] transition transform -rotate-90 open:rotate-0"
|
|
182
192
|
/>
|
|
183
193
|
{{ props.detailsTitle }}
|
|
@@ -189,5 +199,11 @@ const sizeClasses = computed(() => {
|
|
|
189
199
|
</div>
|
|
190
200
|
</div>
|
|
191
201
|
</details>
|
|
202
|
+
<template v-if="$slots.footer">
|
|
203
|
+
<div :class="variantClasses.bodyClass">
|
|
204
|
+
<!--@slot A box to add buttons or additional content -->
|
|
205
|
+
<slot name="footer" />
|
|
206
|
+
</div>
|
|
207
|
+
</template>
|
|
192
208
|
</div>
|
|
193
209
|
</template>
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @cypress-design/vue-alert
|
|
2
2
|
|
|
3
|
+
## 0.5.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#219](https://github.com/cypress-io/cypress-design/pull/219) [`0a4ce3b`](https://github.com/cypress-io/cypress-design/commit/0a4ce3bb55b9ab0510f7fb9ba207d5fdc3cb723f) Thanks [@elevatebart](https://github.com/elevatebart)! - refactor some typings so eslint passes without warning
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`0a4ce3b`](https://github.com/cypress-io/cypress-design/commit/0a4ce3bb55b9ab0510f7fb9ba207d5fdc3cb723f)]:
|
|
10
|
+
- @cypress-design/vue-icon@0.22.3
|
|
11
|
+
|
|
12
|
+
## 0.5.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#217](https://github.com/cypress-io/cypress-design/pull/217) [`0e24977`](https://github.com/cypress-io/cypress-design/commit/0e24977b5c2196b50409c4b1f7fe6fbe6639eb64) Thanks [@elevatebart](https://github.com/elevatebart)! - add alerts new variant and demos
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`0e24977`](https://github.com/cypress-io/cypress-design/commit/0e24977b5c2196b50409c4b1f7fe6fbe6639eb64)]:
|
|
19
|
+
- @cypress-design/constants-alert@0.1.1
|
|
20
|
+
|
|
3
21
|
## 0.5.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/ReadMe.md
CHANGED
|
@@ -20,25 +20,24 @@ import Alert from '@cypress-design/vue-alert'
|
|
|
20
20
|
|
|
21
21
|
The simplest is to use with plain text. By default, type is `info`.
|
|
22
22
|
|
|
23
|
-
```
|
|
24
|
-
<
|
|
25
|
-
import Alert from '@cypress-design/vue-alert'
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<template>
|
|
29
|
-
<Alert type="error">Great Scott!!</Alert>
|
|
30
|
-
</template>
|
|
23
|
+
```jsx live
|
|
24
|
+
<Alert variant="error">Great Scott!!</Alert>
|
|
31
25
|
```
|
|
32
26
|
|
|
33
27
|
One can also have rich text in both the title and the body.
|
|
34
28
|
|
|
35
29
|
```jsx live
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
</
|
|
30
|
+
<div class="bg-white p-4">
|
|
31
|
+
<Alert>
|
|
32
|
+
This is an <code>info</code> message
|
|
33
|
+
<template #body>
|
|
34
|
+
<p>This is the body of <b>the alert.</b></p>
|
|
35
|
+
</template>
|
|
36
|
+
<template #details>
|
|
37
|
+
<p>This is the details of the alert.</p>
|
|
38
|
+
</template>
|
|
39
|
+
</Alert>
|
|
40
|
+
</div>
|
|
42
41
|
```
|
|
43
42
|
|
|
44
43
|
If you want the alert to be dismissible, you can add the `dismissible` prop. Don't forget to add the `@dismiss` prop to handle the dismiss event.
|
|
@@ -58,7 +57,55 @@ const dismissed = false
|
|
|
58
57
|
You can also remove the rounded corners and the icon of the alert by adding the `notRounded` and the `noIcon` props.
|
|
59
58
|
|
|
60
59
|
```jsx live
|
|
61
|
-
<Alert
|
|
60
|
+
<Alert variant="warning" notRounded noIcon>
|
|
62
61
|
Look at my corners
|
|
63
62
|
</Alert>
|
|
64
63
|
```
|
|
64
|
+
|
|
65
|
+
```vue live
|
|
66
|
+
<script setup>
|
|
67
|
+
import { ref } from 'vue'
|
|
68
|
+
import Button from '@cypress-design/vue-button'
|
|
69
|
+
const dismissed = ref(false)
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<template>
|
|
73
|
+
<Alert variant="clear" dismissible @dismiss="dismissed = true">
|
|
74
|
+
<svg
|
|
75
|
+
width="16"
|
|
76
|
+
height="16"
|
|
77
|
+
viewBox="0 0 16 16"
|
|
78
|
+
fill="none"
|
|
79
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
80
|
+
class="mr-2 inline"
|
|
81
|
+
>
|
|
82
|
+
<path
|
|
83
|
+
d="M8 0L0.552002 2.656L1.688 12.504L8 16L14.312 12.504L15.448 2.656L8 0Z"
|
|
84
|
+
fill="#DD0031"
|
|
85
|
+
/>
|
|
86
|
+
<path
|
|
87
|
+
d="M8 0L8.00001 1.776V1.768L8 16L14.312 12.504L15.448 2.656L8 0Z"
|
|
88
|
+
fill="#C3002F"
|
|
89
|
+
/>
|
|
90
|
+
<path
|
|
91
|
+
d="M8.00001 1.768L3.34401 12.208H5.08001L6.01601 9.872H9.96801L10.904 12.208H12.64L8.00001 1.768ZM9.36001 8.432H6.64001L8.00001 5.16L9.36001 8.432Z"
|
|
92
|
+
fill="white"
|
|
93
|
+
/>
|
|
94
|
+
</svg>
|
|
95
|
+
Angular component testing is available for this project
|
|
96
|
+
<template #body>
|
|
97
|
+
You can now use Cypress to develop and test individual components without
|
|
98
|
+
running your whole application. Generate the config in just a few clicks.
|
|
99
|
+
</template>
|
|
100
|
+
<template #footer>
|
|
101
|
+
<div class="p-4 flex flex-wrap overflow-x-hidden gap-4">
|
|
102
|
+
<Button variant="outline-indigo" size="32">Quick setup</Button>
|
|
103
|
+
<Button variant="link" size="32">Read our guides</Button>
|
|
104
|
+
<div class="md:flex-grow md:grow" />
|
|
105
|
+
<Button variant="link" size="32">Give feedback</Button>
|
|
106
|
+
</div>
|
|
107
|
+
</template>
|
|
108
|
+
</Alert>
|
|
109
|
+
<p v-if="dismissed">Alert dismissed</p>
|
|
110
|
+
</template>
|
|
111
|
+
```
|
package/dist/Alert.vue.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AlertVariant } from '@cypress-design/constants-alert';
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
3
|
/**
|
|
4
4
|
* Color scheme
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
variant?: AlertVariant | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Color scheme
|
|
9
|
+
* @deprecated use `variant` instead
|
|
10
|
+
*/
|
|
11
|
+
type?: AlertVariant | undefined;
|
|
7
12
|
/**
|
|
8
13
|
* If details are provided,text used in the toggle button
|
|
9
14
|
*/
|
|
@@ -29,7 +34,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
29
34
|
*/
|
|
30
35
|
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
31
36
|
}>, {
|
|
32
|
-
|
|
37
|
+
variant: undefined;
|
|
38
|
+
type: AlertVariant;
|
|
33
39
|
detailsTitle: string;
|
|
34
40
|
size: "xs" | "sm" | "md" | "lg";
|
|
35
41
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
@@ -38,7 +44,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
38
44
|
/**
|
|
39
45
|
* Color scheme
|
|
40
46
|
*/
|
|
41
|
-
|
|
47
|
+
variant?: AlertVariant | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Color scheme
|
|
50
|
+
* @deprecated use `variant` instead
|
|
51
|
+
*/
|
|
52
|
+
type?: AlertVariant | undefined;
|
|
42
53
|
/**
|
|
43
54
|
* If details are provided,text used in the toggle button
|
|
44
55
|
*/
|
|
@@ -64,23 +75,26 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
64
75
|
*/
|
|
65
76
|
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
66
77
|
}>, {
|
|
67
|
-
|
|
78
|
+
variant: undefined;
|
|
79
|
+
type: AlertVariant;
|
|
68
80
|
detailsTitle: string;
|
|
69
81
|
size: "xs" | "sm" | "md" | "lg";
|
|
70
82
|
}>>> & {
|
|
71
83
|
onDismiss?: (() => any) | undefined;
|
|
72
84
|
}, {
|
|
73
|
-
|
|
85
|
+
variant: AlertVariant;
|
|
86
|
+
type: AlertVariant;
|
|
74
87
|
detailsTitle: string;
|
|
75
|
-
size:
|
|
76
|
-
}>, {
|
|
77
|
-
icon
|
|
88
|
+
size: "xs" | "sm" | "md" | "lg";
|
|
89
|
+
}, {}>, {
|
|
90
|
+
icon?(_: {
|
|
78
91
|
strokeColor: import("@cypress-design/vue-icon").WindiColor | undefined;
|
|
79
92
|
class: string;
|
|
80
|
-
})
|
|
81
|
-
default
|
|
82
|
-
body
|
|
83
|
-
details
|
|
93
|
+
}): any;
|
|
94
|
+
default?(_: {}): any;
|
|
95
|
+
body?(_: {}): any;
|
|
96
|
+
details?(_: {}): any;
|
|
97
|
+
footer?(_: {}): any;
|
|
84
98
|
}>;
|
|
85
99
|
export default _default;
|
|
86
100
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -93,13 +107,16 @@ type __VLS_TypePropsToRuntimeProps<T> = {
|
|
|
93
107
|
};
|
|
94
108
|
};
|
|
95
109
|
type __VLS_WithDefaults<P, D> = {
|
|
96
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
|
|
110
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
97
111
|
default: D[K];
|
|
98
|
-
} : P[K];
|
|
112
|
+
}> : P[K];
|
|
99
113
|
};
|
|
100
114
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
101
115
|
new (): {
|
|
102
116
|
$slots: S;
|
|
103
117
|
};
|
|
104
118
|
};
|
|
119
|
+
type __VLS_Prettify<T> = {
|
|
120
|
+
[K in keyof T]: T[K];
|
|
121
|
+
} & {};
|
|
105
122
|
//# sourceMappingURL=Alert.vue.d.ts.map
|
package/dist/Alert.vue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.vue.d.ts","sourceRoot":"","sources":["../Alert.vue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Alert.vue.d.ts","sourceRoot":"","sources":["../Alert.vue.ts"],"names":[],"mappings":"AAWA,OAAO,EAGL,YAAY,EAKb,MAAM,iCAAiC,CAAA;;IAmIpC;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;;;IA/BH;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;AAiQP,wBAA8G;AAE9G,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QACxE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AAWN,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC;AACJ,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|