@cypress-design/vue-alert 0.5.2 → 0.5.3
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 +31 -15
- package/CHANGELOG.md +9 -0
- package/ReadMe.md +62 -15
- package/dist/Alert.vue.d.ts +31 -14
- package/dist/Alert.vue.d.ts.map +1 -1
- package/dist/index.es.mjs +93 -73
- 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/.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[2m8.
|
|
11
|
-
[32m
|
|
9
|
+
[2mdist/[22m[36mindex.es.mjs [39m[1m[2m10.56 kB[22m[1m[22m[2m │ gzip: 2.87 kB[22m[2m │ map: 270.36 kB[22m
|
|
10
|
+
[2mdist/[22m[36mindex.umd.js [39m[1m[2m8.82 kB[22m[1m[22m[2m │ gzip: 2.72 kB[22m[2m │ map: 269.68 kB[22m
|
|
11
|
+
[32m✓ built in 9.30s[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,17 +66,22 @@ 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
|
|
@@ -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,14 @@
|
|
|
1
1
|
# @cypress-design/vue-alert
|
|
2
2
|
|
|
3
|
+
## 0.5.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`0e24977`](https://github.com/cypress-io/cypress-design/commit/0e24977b5c2196b50409c4b1f7fe6fbe6639eb64)]:
|
|
10
|
+
- @cypress-design/constants-alert@0.1.1
|
|
11
|
+
|
|
3
12
|
## 0.5.2
|
|
4
13
|
|
|
5
14
|
### 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:
|
|
88
|
+
size: "xs" | "sm" | "md" | "lg";
|
|
76
89
|
}>, {
|
|
77
|
-
icon
|
|
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;;IAkIpC;;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"}
|
package/dist/index.es.mjs
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import { h as
|
|
2
|
-
import * as
|
|
3
|
-
import { ICON_COLOR_PROP_NAMES as
|
|
4
|
-
import { DetailsAnimation as
|
|
5
|
-
const
|
|
1
|
+
import { h as n, defineComponent as R, ref as z, useSlots as H, computed as b, onMounted as A, onUnmounted as I, openBlock as c, createElementBlock as f, normalizeClass as u, unref as r, createElementVNode as y, renderSlot as v, normalizeProps as $, guardReactiveProps as T, createBlock as B, resolveDynamicComponent as E, mergeProps as N, createCommentVNode as C, createVNode as S, createTextVNode as O, toDisplayString as P } from "vue";
|
|
2
|
+
import * as x from "@cypress-design/icon-registry";
|
|
3
|
+
import { ICON_COLOR_PROP_NAMES as V } from "@cypress-design/icon-registry";
|
|
4
|
+
import { DetailsAnimation as Z } from "@cypress-design/details-animation";
|
|
5
|
+
const k = ({
|
|
6
6
|
body: s,
|
|
7
7
|
compiledClasses: o,
|
|
8
8
|
size: e,
|
|
9
9
|
class: t,
|
|
10
10
|
interactiveColorsOnGroup: h,
|
|
11
|
-
...
|
|
11
|
+
...p
|
|
12
12
|
}) => {
|
|
13
|
-
const
|
|
14
|
-
(
|
|
13
|
+
const m = Object.keys(p).reduce(
|
|
14
|
+
(l, a) => (!V.includes(a) && a !== "name" && (l[a] = p[a]), l),
|
|
15
15
|
{}
|
|
16
|
-
),
|
|
16
|
+
), i = {
|
|
17
17
|
width: e,
|
|
18
18
|
height: e,
|
|
19
19
|
viewBox: `0 0 ${e} ${e}`,
|
|
20
20
|
fill: "none",
|
|
21
21
|
innerHTML: s,
|
|
22
|
-
...
|
|
22
|
+
...m
|
|
23
23
|
// add all standard attributes back to the svg tag
|
|
24
24
|
};
|
|
25
|
-
return o.length && (
|
|
26
|
-
},
|
|
27
|
-
const { sizeWithDefault: o, compiledClasses: e } =
|
|
25
|
+
return o.length && (i.class = o.join(" ")), i;
|
|
26
|
+
}, _ = (s) => {
|
|
27
|
+
const { sizeWithDefault: o, compiledClasses: e } = x.getComponentAttributes({ ...s, availableSizes: ["16", "24"] }), t = {
|
|
28
28
|
16: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 13 13 3M3 3l10 10" class="icon-dark"/>',
|
|
29
29
|
24: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 20 20 4M4 4l16 16" class="icon-dark"/>'
|
|
30
30
|
}[o];
|
|
31
31
|
if (!t)
|
|
32
32
|
throw Error(`Icon "action-delete-large" is not available in size ${o}`);
|
|
33
|
-
return
|
|
33
|
+
return n("svg", k({
|
|
34
34
|
...s,
|
|
35
35
|
size: o,
|
|
36
36
|
body: t,
|
|
37
37
|
compiledClasses: e
|
|
38
38
|
}));
|
|
39
|
-
},
|
|
40
|
-
const { sizeWithDefault: o, compiledClasses: e } =
|
|
39
|
+
}, W = (s) => {
|
|
40
|
+
const { sizeWithDefault: o, compiledClasses: e } = x.getComponentAttributes({ ...s, availableSizes: ["16"] }), t = {
|
|
41
41
|
16: '<path stroke="currentColor" stroke-width="2" d="M12.95 12.95a7 7 0 1 1-9.9-9.9 7 7 0 0 1 9.9 9.9Z" class="icon-dark"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m6 8 1.5 2L10 6" class="icon-dark"/>'
|
|
42
42
|
}[o];
|
|
43
43
|
if (!t)
|
|
44
44
|
throw Error(`Icon "checkmark-outline" is not available in size ${o}`);
|
|
45
|
-
return
|
|
45
|
+
return n("svg", k({
|
|
46
46
|
...s,
|
|
47
47
|
size: o,
|
|
48
48
|
body: t,
|
|
49
49
|
compiledClasses: e
|
|
50
50
|
}));
|
|
51
|
-
},
|
|
52
|
-
const { sizeWithDefault: o, compiledClasses: e } =
|
|
51
|
+
}, L = (s) => {
|
|
52
|
+
const { sizeWithDefault: o, compiledClasses: e } = x.getComponentAttributes({ ...s, availableSizes: ["8", "16"] }), t = {
|
|
53
53
|
8: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 2.5 3 3 3-3" class="icon-dark"/>',
|
|
54
54
|
16: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m4 6 4 4 4-4" class="icon-dark"/>'
|
|
55
55
|
}[o];
|
|
56
56
|
if (!t)
|
|
57
57
|
throw Error(`Icon "chevron-down-small" is not available in size ${o}`);
|
|
58
|
-
return
|
|
58
|
+
return n("svg", k({
|
|
59
59
|
...s,
|
|
60
60
|
size: o,
|
|
61
61
|
body: t,
|
|
62
62
|
compiledClasses: e
|
|
63
63
|
}));
|
|
64
|
-
},
|
|
65
|
-
const { sizeWithDefault: o, compiledClasses: e } =
|
|
64
|
+
}, D = (s) => {
|
|
65
|
+
const { sizeWithDefault: o, compiledClasses: e } = x.getComponentAttributes({ ...s, availableSizes: ["16"] }), t = {
|
|
66
66
|
16: '<path fill="currentColor" fill-rule="evenodd" d="M2 8a6 6 0 1 1 12 0A6 6 0 0 1 2 8Zm6-8a8 8 0 1 0 0 16A8 8 0 0 0 8 0Zm1 5a1 1 0 0 0-2 0v3a1 1 0 0 0 2 0V5Zm-1 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" class="icon-dark" clip-rule="evenodd"/>'
|
|
67
67
|
}[o];
|
|
68
68
|
if (!t)
|
|
69
69
|
throw Error(`Icon "warning-circle" is not available in size ${o}`);
|
|
70
|
-
return
|
|
70
|
+
return n("svg", k({
|
|
71
71
|
...s,
|
|
72
72
|
size: o,
|
|
73
73
|
body: t,
|
|
74
74
|
compiledClasses: e
|
|
75
75
|
}));
|
|
76
|
-
},
|
|
76
|
+
}, G = {
|
|
77
77
|
xs: "py-[4px] px-[8px] leading-[22px] text-[14px]",
|
|
78
78
|
sm: "py-[8px] px-[12px] leading-[22px] text-[14px]",
|
|
79
79
|
md: "py-[12px] px-[16px] leading-[24px] text-[16px]",
|
|
80
80
|
lg: "p-[16px] leading-[24px] text-[16px]"
|
|
81
|
-
},
|
|
81
|
+
}, U = "lg", q = {
|
|
82
82
|
neutral: {
|
|
83
83
|
headerClass: "text-gray-800 bg-gray-100",
|
|
84
84
|
bodyClass: "bg-gray-50 text-gray-500",
|
|
@@ -138,109 +138,129 @@ const v = ({
|
|
|
138
138
|
iconColor: "jade-500",
|
|
139
139
|
/* <tw-keep strokeColor="jade-300"/> */
|
|
140
140
|
iconChevronColor: "jade-300"
|
|
141
|
+
},
|
|
142
|
+
clear: {
|
|
143
|
+
wrapperClass: "border-gray-50 bg-white border text-gray-700",
|
|
144
|
+
headerClass: "",
|
|
145
|
+
bodyClass: "border-gray-50 border-t",
|
|
146
|
+
borderClass: "border-gray-50",
|
|
147
|
+
detailsHeaderClass: "text-gray-700",
|
|
148
|
+
/* <tw-keep strokeColor="gray-600"/> */
|
|
149
|
+
iconCloseColor: "gray-600",
|
|
150
|
+
/* <tw-keep strokeColor="gray-500"/> */
|
|
151
|
+
iconColor: "gray-500",
|
|
152
|
+
/* <tw-keep strokeColor="gray-300"/> */
|
|
153
|
+
iconChevronColor: "gray-300"
|
|
141
154
|
}
|
|
142
|
-
},
|
|
155
|
+
}, F = "info", J = "Additional details", K = { class: "flex-1 font-medium" }, oe = /* @__PURE__ */ R({
|
|
143
156
|
__name: "Alert",
|
|
144
157
|
props: {
|
|
145
|
-
|
|
146
|
-
|
|
158
|
+
variant: { default: void 0 },
|
|
159
|
+
type: { default: F },
|
|
160
|
+
detailsTitle: { default: J },
|
|
147
161
|
dismissible: { type: Boolean },
|
|
148
162
|
noIcon: { type: Boolean },
|
|
149
163
|
notRounded: { type: Boolean },
|
|
150
164
|
duration: null,
|
|
151
|
-
size: { default:
|
|
165
|
+
size: { default: U }
|
|
152
166
|
},
|
|
153
167
|
emits: ["dismiss"],
|
|
154
168
|
setup(s, { emit: o }) {
|
|
155
|
-
const e = s, t = z(!1), h =
|
|
169
|
+
const e = s, t = z(!1), h = H(), p = b(() => e.variant ?? e.type), m = z(null), i = z(null), l = b(() => q[p.value] ?? {});
|
|
156
170
|
let a;
|
|
157
|
-
|
|
158
|
-
e.duration && (a = setTimeout(
|
|
159
|
-
}),
|
|
160
|
-
|
|
161
|
-
}),
|
|
171
|
+
A(() => {
|
|
172
|
+
e.duration && (a = setTimeout(w, e.duration));
|
|
173
|
+
}), A(() => {
|
|
174
|
+
m.value && i.value && new Z(m.value, i.value);
|
|
175
|
+
}), I(() => {
|
|
162
176
|
a && clearTimeout(a);
|
|
163
177
|
});
|
|
164
|
-
function
|
|
178
|
+
function w() {
|
|
165
179
|
t.value = !0, o("dismiss"), a && (clearTimeout(a), a = void 0);
|
|
166
180
|
}
|
|
167
|
-
const
|
|
181
|
+
const g = b(() => ({
|
|
168
182
|
strokeColor: l.value.iconColor,
|
|
169
183
|
class: "my-[4px] mr-[8px]"
|
|
170
|
-
})),
|
|
171
|
-
switch (
|
|
184
|
+
})), j = b(() => {
|
|
185
|
+
switch (p.value) {
|
|
172
186
|
case "info":
|
|
173
187
|
return null;
|
|
174
188
|
case "success":
|
|
175
|
-
return () =>
|
|
189
|
+
return () => n(W, g.value);
|
|
176
190
|
case "warning":
|
|
177
|
-
return () =>
|
|
191
|
+
return () => n(D, g.value);
|
|
178
192
|
case "error":
|
|
179
|
-
return () =>
|
|
193
|
+
return () => n(D, g.value);
|
|
180
194
|
default:
|
|
181
195
|
return null;
|
|
182
196
|
}
|
|
183
|
-
}),
|
|
184
|
-
return (
|
|
197
|
+
}), M = b(() => G[e.size] ?? {});
|
|
198
|
+
return (d, Q) => t.value ? C("", !0) : (c(), f("div", {
|
|
185
199
|
key: 0,
|
|
186
|
-
class:
|
|
200
|
+
class: u(["overflow-hidden text-left", [r(l).wrapperClass, { rounded: !e.notRounded }]])
|
|
187
201
|
}, [
|
|
188
|
-
|
|
189
|
-
class:
|
|
202
|
+
y("div", {
|
|
203
|
+
class: u(["flex", [r(l).headerClass, r(M)]])
|
|
190
204
|
}, [
|
|
191
|
-
|
|
192
|
-
!e.noIcon && r(
|
|
205
|
+
v(d.$slots, "icon", $(T(r(g))), () => [
|
|
206
|
+
!e.noIcon && r(j) ? (c(), B(E(r(j)), $(N({ key: 0 }, r(g))), null, 16)) : C("", !0)
|
|
193
207
|
]),
|
|
194
|
-
|
|
195
|
-
|
|
208
|
+
y("div", K, [
|
|
209
|
+
v(d.$slots, "default")
|
|
196
210
|
]),
|
|
197
|
-
s.dismissible ? (
|
|
211
|
+
s.dismissible ? (c(), f("button", {
|
|
198
212
|
key: 0,
|
|
199
213
|
class: "m-[4px] ml-[8px] h-[16px]",
|
|
200
|
-
onClick:
|
|
214
|
+
onClick: w,
|
|
201
215
|
"aria-label": "Dismiss"
|
|
202
216
|
}, [
|
|
203
|
-
S(r(
|
|
217
|
+
S(r(_), {
|
|
204
218
|
"stroke-color": r(l).iconCloseColor
|
|
205
219
|
}, null, 8, ["stroke-color"])
|
|
206
|
-
])) :
|
|
220
|
+
])) : C("", !0)
|
|
207
221
|
], 2),
|
|
208
|
-
r(h).body ? (
|
|
222
|
+
r(h).body ? (c(), f("div", {
|
|
209
223
|
key: 0,
|
|
210
|
-
class:
|
|
224
|
+
class: u(["p-[16px]", r(l).bodyClass])
|
|
211
225
|
}, [
|
|
212
|
-
|
|
213
|
-
], 2)) :
|
|
214
|
-
r(h).details ? (
|
|
226
|
+
v(d.$slots, "body")
|
|
227
|
+
], 2)) : C("", !0),
|
|
228
|
+
r(h).details ? (c(), f("details", {
|
|
215
229
|
key: 1,
|
|
216
|
-
class:
|
|
230
|
+
class: u(["p-[16px] border-t border-t-1", [r(l).bodyClass, r(l).borderClass]]),
|
|
217
231
|
ref_key: "detailsRef",
|
|
218
|
-
ref:
|
|
232
|
+
ref: m
|
|
219
233
|
}, [
|
|
220
|
-
|
|
221
|
-
class:
|
|
234
|
+
y("summary", {
|
|
235
|
+
class: u(["flex font-medium cursor-pointer details-none", r(l).detailsHeaderClass])
|
|
222
236
|
}, [
|
|
223
|
-
S(r(
|
|
237
|
+
S(r(L), {
|
|
224
238
|
strokeColor: r(l).iconChevronColor,
|
|
225
239
|
class: "icon my-[4px] mr-[8px] transition transform -rotate-90 open:rotate-0"
|
|
226
240
|
}, null, 8, ["strokeColor"]),
|
|
227
|
-
|
|
241
|
+
O(" " + P(e.detailsTitle), 1)
|
|
228
242
|
], 2),
|
|
229
|
-
|
|
243
|
+
y("div", {
|
|
230
244
|
ref_key: "contentRef",
|
|
231
|
-
ref:
|
|
245
|
+
ref: i
|
|
232
246
|
}, [
|
|
233
|
-
|
|
234
|
-
|
|
247
|
+
y("div", null, [
|
|
248
|
+
v(d.$slots, "details")
|
|
235
249
|
])
|
|
236
250
|
], 512)
|
|
237
|
-
], 2)) :
|
|
251
|
+
], 2)) : C("", !0),
|
|
252
|
+
d.$slots.footer ? (c(), f("div", {
|
|
253
|
+
key: 2,
|
|
254
|
+
class: u(r(l).bodyClass)
|
|
255
|
+
}, [
|
|
256
|
+
v(d.$slots, "footer")
|
|
257
|
+
], 2)) : C("", !0)
|
|
238
258
|
], 2));
|
|
239
259
|
}
|
|
240
260
|
});
|
|
241
261
|
export {
|
|
242
|
-
|
|
262
|
+
oe as default
|
|
243
263
|
};
|
|
244
264
|
//# sourceMappingURL=index.es.mjs.map
|
|
245
265
|
|
|
246
|
-
/* <wind-keep class="my-[4px] mr-[8px] overflow-hidden text-left
|
|
266
|
+
/* <wind-keep class="my-[4px] mr-[8px] overflow-hidden text-left flex flex-1 font-medium m-[4px] ml-[8px] h-[16px] p-[16px] border-t border-t-1 cursor-pointer details-none transition transform -rotate-90 open:rotate-0 py-[4px] px-[8px] leading-[22px] text-[14px] py-[8px] px-[12px] py-[12px] px-[16px] leading-[24px] text-[16px] text-gray-800 bg-gray-100 bg-gray-50 text-gray-500 border-gray-100 text-gray-600 text-indigo-700 bg-indigo-100 bg-indigo-50 text-indigo-500 border-indigo-100 text-indigo-600 text-orange-700 bg-orange-100 bg-orange-50 text-orange-500 border-orange-100 text-orange-600 text-red-700 bg-red-100 bg-red-50 text-red-500 border-red-100 text-red-600 text-jade-700 bg-jade-100 bg-jade-50 text-jade-600 border-jade-100 border-gray-50 bg-white border text-gray-700 icon-dark-gray-600 icon-dark-gray-500 icon-dark-gray-300 icon-dark-indigo-500 icon-dark-indigo-300 icon-dark-orange-500 icon-dark-orange-400 icon-dark-orange-300 icon-dark-red-500 icon-dark-red-400 icon-dark-red-300 icon-dark-jade-600 icon-dark-jade-500 icon-dark-jade-300"> */
|