@cypress-design/vue-alert 0.2.0 → 0.4.0
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 +13 -0
- package/Alert.rootstory.tsx +4 -4
- package/Alert.vue +8 -8
- package/AlertVue.cy.tsx +1 -0
- package/CHANGELOG.md +23 -0
- package/ReadMe.md +24 -23
- package/dist/constants.d.ts +7 -7
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.es.mjs +70 -51
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/vue/Alert.vue.d.ts +54 -175
- package/dist/vue/Alert.vue.d.ts.map +1 -1
- package/package.json +31 -28
- package/tsconfig.build.json +2 -1
- package/tsconfig.json +3 -0
- package/Alert.stories.mdx +0 -76
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
$ yarn build:module && yarn build:types
|
|
2
|
+
$ yarn vite build
|
|
3
|
+
$ /home/runner/work/cypress-design/cypress-design/node_modules/.bin/vite build
|
|
4
|
+
[36mvite v4.2.1 [32mbuilding for production...[36m[39m
|
|
5
|
+
transforming...
|
|
6
|
+
[32m✓[39m 5 modules transformed.
|
|
7
|
+
rendering chunks...
|
|
8
|
+
computing gzip size...
|
|
9
|
+
[2mdist/[22m[36mindex.es.mjs [39m[1m[2m9.84 kB[22m[1m[22m[2m │ gzip: 2.77 kB[22m[2m │ map: 269.19 kB[22m
|
|
10
|
+
[2mdist/[22m[36mindex.umd.js [39m[1m[2m8.26 kB[22m[1m[22m[2m │ gzip: 2.62 kB[22m[2m │ map: 268.58 kB[22m
|
|
11
|
+
[32m✓[39m built in 7.79s
|
|
12
|
+
$ yarn vue-tsc --project ./tsconfig.build.json
|
|
13
|
+
$ /home/runner/work/cypress-design/cypress-design/node_modules/.bin/vue-tsc --project ./tsconfig.build.json
|
package/Alert.rootstory.tsx
CHANGED
|
@@ -6,14 +6,14 @@ import Alert from './Alert.vue'
|
|
|
6
6
|
export default () => {
|
|
7
7
|
const displayTimedAlert = ref(false)
|
|
8
8
|
return (
|
|
9
|
-
<div class="flex flex-col p-4 gap-16px">
|
|
9
|
+
<div class="flex flex-col p-4 gap-[16px]">
|
|
10
10
|
<Alert type="error" detailsTitle="Stack trace" data-cy="alert-1">
|
|
11
11
|
{{
|
|
12
12
|
default: () => 'Spec not found',
|
|
13
13
|
body: () => (
|
|
14
14
|
<>
|
|
15
15
|
There is no spec matching the following location:
|
|
16
|
-
<code class="bg-red-100 m-8px rounded px-2px">
|
|
16
|
+
<code class="bg-red-100 m-[8px] rounded px-[2px]">
|
|
17
17
|
path/to/spec.cy.js
|
|
18
18
|
</code>
|
|
19
19
|
<br />
|
|
@@ -23,7 +23,7 @@ export default () => {
|
|
|
23
23
|
</>
|
|
24
24
|
),
|
|
25
25
|
details: () => (
|
|
26
|
-
<pre class="bg-white rounded border border-red-500 px-16px py-8px overflow-x-auto">
|
|
26
|
+
<pre class="bg-white rounded border border-red-500 px-[16px] py-[8px] overflow-x-auto">
|
|
27
27
|
{dedent`Uncaught Error: Error occurred in defineConfig()
|
|
28
28
|
Trace: add called with 2 and 3
|
|
29
29
|
at sum (/home/dev/Documents/stacktrace.js:2:13)
|
|
@@ -62,7 +62,7 @@ export default () => {
|
|
|
62
62
|
}}
|
|
63
63
|
</Alert>
|
|
64
64
|
<button
|
|
65
|
-
class="border rounded p-8px"
|
|
65
|
+
class="border rounded p-[8px]"
|
|
66
66
|
onClick={() => (displayTimedAlert.value = true)}
|
|
67
67
|
>
|
|
68
68
|
open alert for 5 seconds
|
package/Alert.vue
CHANGED
|
@@ -71,7 +71,7 @@ const detailsRef = ref(null)
|
|
|
71
71
|
const contentRef = ref(null)
|
|
72
72
|
|
|
73
73
|
const typeClasses = computed(() => {
|
|
74
|
-
return alertClasses[props.type]
|
|
74
|
+
return alertClasses[props.type] ?? {}
|
|
75
75
|
})
|
|
76
76
|
|
|
77
77
|
let timeout: number | undefined
|
|
@@ -105,8 +105,8 @@ function dismiss() {
|
|
|
105
105
|
|
|
106
106
|
const computedIconProps = computed(() => {
|
|
107
107
|
return {
|
|
108
|
-
strokeColor:
|
|
109
|
-
class: 'my-4px mr-8px',
|
|
108
|
+
strokeColor: typeClasses.value.iconColor,
|
|
109
|
+
class: 'my-[4px] mr-[8px]',
|
|
110
110
|
}
|
|
111
111
|
})
|
|
112
112
|
|
|
@@ -126,7 +126,7 @@ const icon: ComputedRef<FunctionalComponent | null> = computed(() => {
|
|
|
126
126
|
})
|
|
127
127
|
|
|
128
128
|
const sizeClasses = computed(() => {
|
|
129
|
-
return alertSizesClasses[props.size]
|
|
129
|
+
return alertSizesClasses[props.size] ?? {}
|
|
130
130
|
})
|
|
131
131
|
</script>
|
|
132
132
|
|
|
@@ -151,20 +151,20 @@ const sizeClasses = computed(() => {
|
|
|
151
151
|
</div>
|
|
152
152
|
<button
|
|
153
153
|
v-if="dismissible"
|
|
154
|
-
class="m-4px ml-8px h-16px"
|
|
154
|
+
class="m-[4px] ml-[8px] h-[16px]"
|
|
155
155
|
@click="dismiss"
|
|
156
156
|
aria-label="Dismiss"
|
|
157
157
|
>
|
|
158
158
|
<IconActionDeleteLarge :stroke-color="typeClasses.iconCloseColor" />
|
|
159
159
|
</button>
|
|
160
160
|
</div>
|
|
161
|
-
<div v-if="slots.body" class="p-16px" :class="typeClasses.bodyClass">
|
|
161
|
+
<div v-if="slots.body" class="p-[16px]" :class="typeClasses.bodyClass">
|
|
162
162
|
<!-- @slot body/details of the alert -->
|
|
163
163
|
<slot name="body" />
|
|
164
164
|
</div>
|
|
165
165
|
<details
|
|
166
166
|
v-if="slots.details"
|
|
167
|
-
class="p-16px border-t-1"
|
|
167
|
+
class="p-[16px] border-t border-t-1"
|
|
168
168
|
ref="detailsRef"
|
|
169
169
|
:class="[typeClasses.bodyClass, typeClasses.borderClass]"
|
|
170
170
|
>
|
|
@@ -174,7 +174,7 @@ const sizeClasses = computed(() => {
|
|
|
174
174
|
>
|
|
175
175
|
<IconChevronDownSmall
|
|
176
176
|
:strokeColor="typeClasses.iconChevronColor"
|
|
177
|
-
class="icon my-4px mr-8px transition transform -rotate-90 open:rotate-0"
|
|
177
|
+
class="icon my-[4px] mr-[8px] transition transform -rotate-90 open:rotate-0"
|
|
178
178
|
/>
|
|
179
179
|
{{ props.detailsTitle }}
|
|
180
180
|
</summary>
|
package/AlertVue.cy.tsx
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @cypress-design/vue-alert
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#178](https://github.com/cypress-io/cypress-design/pull/178) [`d0de778`](https://github.com/cypress-io/cypress-design/commit/d0de77843adb87d8f4804219c6dca8f45b15c650) Thanks [@elevatebart](https://github.com/elevatebart)! - deliver new docs and improved components
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`18399c7`](https://github.com/cypress-io/cypress-design/commit/18399c72a52288c67af0935384430d4e4cd24251), [`d0de778`](https://github.com/cypress-io/cypress-design/commit/d0de77843adb87d8f4804219c6dca8f45b15c650)]:
|
|
12
|
+
- @cypress-design/vue-icon@0.20.0
|
|
13
|
+
- @cypress-design/details-animation@0.1.0
|
|
14
|
+
|
|
15
|
+
## 0.3.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#151](https://github.com/cypress-io/cypress-design/pull/151) [`8b0e735`](https://github.com/cypress-io/cypress-design/commit/8b0e7356eb64a6b3583d3486dda8ecbb11c34cca) Thanks [@elevatebart](https://github.com/elevatebart)! - refactor: use clases compatible with both windi and tailwind
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`106b61a`](https://github.com/cypress-io/cypress-design/commit/106b61a97888f956a4c9d235fde5efb4243e1445), [`7b4f416`](https://github.com/cypress-io/cypress-design/commit/7b4f4162a0d150aa8cab7ec239faebb58c39464d)]:
|
|
24
|
+
- @cypress-design/vue-icon@0.18.0
|
|
25
|
+
|
|
3
26
|
## 0.2.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/ReadMe.md
CHANGED
|
@@ -9,7 +9,7 @@ Examples:
|
|
|
9
9
|
- To attract attention to a specific note on the page.
|
|
10
10
|
- To inform the user of a change in the system.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Install
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
npm install @cypress-design/vue-alert
|
|
@@ -25,10 +25,11 @@ yarn add @cypress-design/vue-alert
|
|
|
25
25
|
|
|
26
26
|
The simplest is to use with plain text. By default, type is `info`.
|
|
27
27
|
|
|
28
|
-
```vue
|
|
28
|
+
```vue live
|
|
29
29
|
<script setup>
|
|
30
30
|
import Alert from '@cypress-design/vue-alert'
|
|
31
31
|
</script>
|
|
32
|
+
|
|
32
33
|
<template>
|
|
33
34
|
<Alert type="error">Great Scott!!</Alert>
|
|
34
35
|
</template>
|
|
@@ -36,33 +37,33 @@ import Alert from '@cypress-design/vue-alert'
|
|
|
36
37
|
|
|
37
38
|
One can also have rich text in both the title and the body.
|
|
38
39
|
|
|
39
|
-
```
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
</Alert>
|
|
47
|
-
</template>
|
|
40
|
+
```jsx live
|
|
41
|
+
<Alert>
|
|
42
|
+
This is an <code>info</code> message
|
|
43
|
+
<template #body>
|
|
44
|
+
<p>This is the body of the alert.</p>
|
|
45
|
+
</template>
|
|
46
|
+
</Alert>
|
|
48
47
|
```
|
|
49
48
|
|
|
50
49
|
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.
|
|
51
50
|
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
```jsx live
|
|
52
|
+
const dismissed = false
|
|
53
|
+
|
|
54
|
+
<Alert
|
|
55
|
+
dismissible
|
|
56
|
+
@dismiss="dismissed = true"
|
|
57
|
+
>
|
|
58
|
+
This is an info message
|
|
59
|
+
</Alert>
|
|
60
|
+
<p v-if="dismissed">Alert dismissed</p>
|
|
60
61
|
```
|
|
61
62
|
|
|
62
63
|
You can also remove the rounded corners and the icon of the alert by adding the `notRounded` and the `noIcon` props.
|
|
63
64
|
|
|
64
|
-
```
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
</
|
|
65
|
+
```jsx live
|
|
66
|
+
<Alert type="warning" notRounded noIcon>
|
|
67
|
+
Look at my corners
|
|
68
|
+
</Alert>
|
|
68
69
|
```
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { WindiColor } from '@cypress-design/icon-registry';
|
|
2
|
-
export
|
|
2
|
+
export type AlertType = 'info' | 'success' | 'error' | 'warning' | 'neutral';
|
|
3
3
|
export declare const alertSizesClasses: {
|
|
4
|
-
readonly xs: "py-4px px-8px leading-22px text-14px";
|
|
5
|
-
readonly sm: "py-8px px-12px leading-22px text-14px";
|
|
6
|
-
readonly md: "py-12px px-16px leading-24px text-16px";
|
|
7
|
-
readonly lg: "p-16px leading-24px text-16px";
|
|
4
|
+
readonly xs: "py-[4px] px-[8px] leading-[22px] text-[14px]";
|
|
5
|
+
readonly sm: "py-[8px] px-[12px] leading-[22px] text-[14px]";
|
|
6
|
+
readonly md: "py-[12px] px-[16px] leading-[24px] text-[16px]";
|
|
7
|
+
readonly lg: "p-[16px] leading-[24px] text-[16px]";
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type AlertSize = keyof typeof alertSizesClasses;
|
|
10
10
|
export declare const defaultAlertSize: AlertSize;
|
|
11
|
-
export
|
|
11
|
+
export type AlertClasses = {
|
|
12
12
|
headerClass: string;
|
|
13
13
|
bodyClass: string;
|
|
14
14
|
borderClass: string;
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAE/D,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAE/D,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;AAC5E,eAAO,MAAM,iBAAiB;;;;;CAKpB,CAAA;AAEV,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,iBAAiB,CAAA;AACtD,eAAO,MAAM,gBAAgB,EAAE,SAAgB,CAAA;AAE/C,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,cAAc,EAAE,UAAU,CAAA;IAC1B,SAAS,CAAC,EAAE,UAAU,CAAA;IACtB,gBAAgB,EAAE,UAAU,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,YAAY,CA6DxD,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,SAAkB,CAAA;AAEjD,eAAO,MAAM,iBAAiB,uBAAuB,CAAA"}
|
package/dist/index.es.mjs
CHANGED
|
@@ -1,57 +1,61 @@
|
|
|
1
|
-
import { h as
|
|
1
|
+
import { h as i, defineComponent as M, ref as z, useSlots as R, computed as f, onMounted as j, onUnmounted as T, openBlock as C, createElementBlock as x, normalizeClass as p, createElementVNode as m, unref as r, renderSlot as k, normalizeProps as A, guardReactiveProps as I, createBlock as B, resolveDynamicComponent as E, mergeProps as H, createCommentVNode as g, createVNode as S, createTextVNode as _, toDisplayString as N } from "vue";
|
|
2
2
|
import * as y from "@cypress-design/icon-registry";
|
|
3
|
-
import { ICON_COLOR_PROP_NAMES as
|
|
4
|
-
import { DetailsAnimation as
|
|
3
|
+
import { ICON_COLOR_PROP_NAMES as O } from "@cypress-design/icon-registry";
|
|
4
|
+
import { DetailsAnimation as P } from "@cypress-design/details-animation";
|
|
5
5
|
const v = ({
|
|
6
6
|
body: s,
|
|
7
7
|
compiledClasses: o,
|
|
8
8
|
size: e,
|
|
9
9
|
class: t,
|
|
10
10
|
interactiveColorsOnGroup: h,
|
|
11
|
-
...
|
|
11
|
+
...d
|
|
12
12
|
}) => {
|
|
13
|
-
const c = Object.keys(
|
|
13
|
+
const c = Object.keys(d).reduce(
|
|
14
|
+
(a, n) => (!O.includes(n) && n !== "name" && (a[n] = d[n]), a),
|
|
15
|
+
{}
|
|
16
|
+
), l = {
|
|
14
17
|
width: e,
|
|
15
18
|
height: e,
|
|
16
19
|
viewBox: `0 0 ${e} ${e}`,
|
|
17
20
|
fill: "none",
|
|
18
21
|
innerHTML: s,
|
|
19
22
|
...c
|
|
23
|
+
// add all standard attributes back to the svg tag
|
|
20
24
|
};
|
|
21
25
|
return o.length && (l.class = o.join(" ")), l;
|
|
22
26
|
}, Z = (s) => {
|
|
23
27
|
const { sizeWithDefault: o, compiledClasses: e } = y.getComponentAttributes({ ...s, availableSizes: ["16", "24"] }), t = {
|
|
24
|
-
16: '<path
|
|
25
|
-
24: '<path
|
|
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
|
+
24: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 20 20 4M4 4l16 16" class="icon-dark"/>'
|
|
26
30
|
}[o];
|
|
27
31
|
if (!t)
|
|
28
32
|
throw Error(`Icon "action-delete-large" is not available in size ${o}`);
|
|
29
|
-
return
|
|
33
|
+
return i("svg", v({
|
|
30
34
|
...s,
|
|
31
35
|
size: o,
|
|
32
36
|
body: t,
|
|
33
37
|
compiledClasses: e
|
|
34
38
|
}));
|
|
35
|
-
},
|
|
39
|
+
}, V = (s) => {
|
|
36
40
|
const { sizeWithDefault: o, compiledClasses: e } = y.getComponentAttributes({ ...s, availableSizes: ["16"] }), t = {
|
|
37
|
-
16: '<path d="M12.95 12.95a7 7 0 1 1-9.9-9.9 7 7 0 0 1 9.9 9.9Z"
|
|
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"/>'
|
|
38
42
|
}[o];
|
|
39
43
|
if (!t)
|
|
40
44
|
throw Error(`Icon "checkmark-outline" is not available in size ${o}`);
|
|
41
|
-
return
|
|
45
|
+
return i("svg", v({
|
|
42
46
|
...s,
|
|
43
47
|
size: o,
|
|
44
48
|
body: t,
|
|
45
49
|
compiledClasses: e
|
|
46
50
|
}));
|
|
47
|
-
},
|
|
51
|
+
}, W = (s) => {
|
|
48
52
|
const { sizeWithDefault: o, compiledClasses: e } = y.getComponentAttributes({ ...s, availableSizes: ["8", "16"] }), t = {
|
|
49
|
-
8: '<path
|
|
50
|
-
16: '<path
|
|
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
|
+
16: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m4 6 4 4 4-4" class="icon-dark"/>'
|
|
51
55
|
}[o];
|
|
52
56
|
if (!t)
|
|
53
57
|
throw Error(`Icon "chevron-down-small" is not available in size ${o}`);
|
|
54
|
-
return
|
|
58
|
+
return i("svg", v({
|
|
55
59
|
...s,
|
|
56
60
|
size: o,
|
|
57
61
|
body: t,
|
|
@@ -59,29 +63,32 @@ const v = ({
|
|
|
59
63
|
}));
|
|
60
64
|
}, $ = (s) => {
|
|
61
65
|
const { sizeWithDefault: o, compiledClasses: e } = y.getComponentAttributes({ ...s, availableSizes: ["16"] }), t = {
|
|
62
|
-
16: '<path fill
|
|
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"/>'
|
|
63
67
|
}[o];
|
|
64
68
|
if (!t)
|
|
65
69
|
throw Error(`Icon "warning-circle" is not available in size ${o}`);
|
|
66
|
-
return
|
|
70
|
+
return i("svg", v({
|
|
67
71
|
...s,
|
|
68
72
|
size: o,
|
|
69
73
|
body: t,
|
|
70
74
|
compiledClasses: e
|
|
71
75
|
}));
|
|
72
|
-
},
|
|
73
|
-
xs: "py-4px px-8px leading-22px text-14px",
|
|
74
|
-
sm: "py-8px px-12px leading-22px text-14px",
|
|
75
|
-
md: "py-12px px-16px leading-24px text-16px",
|
|
76
|
-
lg: "p-16px leading-24px text-16px"
|
|
77
|
-
}, G = "lg",
|
|
76
|
+
}, L = {
|
|
77
|
+
xs: "py-[4px] px-[8px] leading-[22px] text-[14px]",
|
|
78
|
+
sm: "py-[8px] px-[12px] leading-[22px] text-[14px]",
|
|
79
|
+
md: "py-[12px] px-[16px] leading-[24px] text-[16px]",
|
|
80
|
+
lg: "p-[16px] leading-[24px] text-[16px]"
|
|
81
|
+
}, G = "lg", U = {
|
|
78
82
|
neutral: {
|
|
79
83
|
headerClass: "text-gray-800 bg-gray-100",
|
|
80
84
|
bodyClass: "bg-gray-50 text-gray-500",
|
|
81
85
|
borderClass: "border-gray-100",
|
|
82
86
|
detailsHeaderClass: "text-gray-600",
|
|
87
|
+
/* <tw-keep strokeColor="gray-600"/> */
|
|
83
88
|
iconCloseColor: "gray-600",
|
|
89
|
+
/* <tw-keep strokeColor="gray-500"/> */
|
|
84
90
|
iconColor: "gray-500",
|
|
91
|
+
/* <tw-keep strokeColor="gray-300"/> */
|
|
85
92
|
iconChevronColor: "gray-300"
|
|
86
93
|
},
|
|
87
94
|
info: {
|
|
@@ -89,8 +96,11 @@ const v = ({
|
|
|
89
96
|
bodyClass: "bg-indigo-50 text-indigo-500",
|
|
90
97
|
borderClass: "border-indigo-100",
|
|
91
98
|
detailsHeaderClass: "text-indigo-600",
|
|
99
|
+
/* <tw-keep strokeColor="indigo-500"/> */
|
|
92
100
|
iconCloseColor: "indigo-500",
|
|
101
|
+
/* <tw-keep strokeColor="indigo-500"/> */
|
|
93
102
|
iconColor: "indigo-500",
|
|
103
|
+
/* <tw-keep strokeColor="indigo-300"/> */
|
|
94
104
|
iconChevronColor: "indigo-300"
|
|
95
105
|
},
|
|
96
106
|
warning: {
|
|
@@ -98,8 +108,11 @@ const v = ({
|
|
|
98
108
|
bodyClass: "bg-orange-50 text-orange-500",
|
|
99
109
|
borderClass: "border-orange-100",
|
|
100
110
|
detailsHeaderClass: "text-orange-600",
|
|
111
|
+
/* <tw-keep strokeColor="orange-500"/> */
|
|
101
112
|
iconCloseColor: "orange-500",
|
|
113
|
+
/* <tw-keep strokeColor="orange-400"/> */
|
|
102
114
|
iconColor: "orange-400",
|
|
115
|
+
/* <tw-keep strokeColor="orange-300"/> */
|
|
103
116
|
iconChevronColor: "orange-300"
|
|
104
117
|
},
|
|
105
118
|
error: {
|
|
@@ -107,8 +120,11 @@ const v = ({
|
|
|
107
120
|
bodyClass: "bg-red-50 text-red-500",
|
|
108
121
|
borderClass: "border-red-100",
|
|
109
122
|
detailsHeaderClass: "text-red-600",
|
|
123
|
+
/* <tw-keep strokeColor="red-500"/> */
|
|
110
124
|
iconCloseColor: "red-500",
|
|
125
|
+
/* <tw-keep strokeColor="red-400"/> */
|
|
111
126
|
iconColor: "red-400",
|
|
127
|
+
/* <tw-keep strokeColor="red-300"/> */
|
|
112
128
|
iconChevronColor: "red-300"
|
|
113
129
|
},
|
|
114
130
|
success: {
|
|
@@ -116,14 +132,17 @@ const v = ({
|
|
|
116
132
|
bodyClass: "bg-jade-50 text-jade-600",
|
|
117
133
|
borderClass: "border-jade-100",
|
|
118
134
|
detailsHeaderClass: "text-jade-600",
|
|
135
|
+
/* <tw-keep strokeColor="jade-600"/> */
|
|
119
136
|
iconCloseColor: "jade-600",
|
|
137
|
+
/* <tw-keep strokeColor="jade-500"/> */
|
|
120
138
|
iconColor: "jade-500",
|
|
139
|
+
/* <tw-keep strokeColor="jade-300"/> */
|
|
121
140
|
iconChevronColor: "jade-300"
|
|
122
141
|
}
|
|
123
|
-
},
|
|
142
|
+
}, q = "info", F = "Additional details", J = { class: "flex-1 font-medium" }, ee = /* @__PURE__ */ M({
|
|
124
143
|
__name: "Alert",
|
|
125
144
|
props: {
|
|
126
|
-
type: { default:
|
|
145
|
+
type: { default: q },
|
|
127
146
|
detailsTitle: { default: F },
|
|
128
147
|
dismissible: { type: Boolean },
|
|
129
148
|
noIcon: { type: Boolean },
|
|
@@ -133,43 +152,43 @@ const v = ({
|
|
|
133
152
|
},
|
|
134
153
|
emits: ["dismiss"],
|
|
135
154
|
setup(s, { emit: o }) {
|
|
136
|
-
const e = s, t = z(!1), h =
|
|
137
|
-
let
|
|
155
|
+
const e = s, t = z(!1), h = R(), d = z(null), c = z(null), l = f(() => U[e.type] ?? {});
|
|
156
|
+
let a;
|
|
138
157
|
j(() => {
|
|
139
|
-
e.duration && (
|
|
158
|
+
e.duration && (a = setTimeout(n, e.duration));
|
|
140
159
|
}), j(() => {
|
|
141
|
-
|
|
142
|
-
}),
|
|
143
|
-
|
|
160
|
+
d.value && c.value && new P(d.value, c.value);
|
|
161
|
+
}), T(() => {
|
|
162
|
+
a && clearTimeout(a);
|
|
144
163
|
});
|
|
145
|
-
function
|
|
146
|
-
t.value = !0, o("dismiss"),
|
|
164
|
+
function n() {
|
|
165
|
+
t.value = !0, o("dismiss"), a && (clearTimeout(a), a = void 0);
|
|
147
166
|
}
|
|
148
167
|
const u = f(() => ({
|
|
149
|
-
strokeColor:
|
|
150
|
-
class: "my-4px mr-8px"
|
|
168
|
+
strokeColor: l.value.iconColor,
|
|
169
|
+
class: "my-[4px] mr-[8px]"
|
|
151
170
|
})), w = f(() => {
|
|
152
171
|
switch (e.type) {
|
|
153
172
|
case "info":
|
|
154
173
|
return null;
|
|
155
174
|
case "success":
|
|
156
|
-
return () =>
|
|
175
|
+
return () => i(V, u.value);
|
|
157
176
|
case "warning":
|
|
158
|
-
return () =>
|
|
177
|
+
return () => i($, u.value);
|
|
159
178
|
case "error":
|
|
160
|
-
return () =>
|
|
179
|
+
return () => i($, u.value);
|
|
161
180
|
default:
|
|
162
181
|
return null;
|
|
163
182
|
}
|
|
164
|
-
}),
|
|
183
|
+
}), D = f(() => L[e.size] ?? {});
|
|
165
184
|
return (b, K) => t.value ? g("", !0) : (C(), x("div", {
|
|
166
185
|
key: 0,
|
|
167
186
|
class: p(["overflow-hidden text-left", e.notRounded ? void 0 : "rounded"])
|
|
168
187
|
}, [
|
|
169
188
|
m("div", {
|
|
170
|
-
class: p(["flex", [r(l).headerClass, r(
|
|
189
|
+
class: p(["flex", [r(l).headerClass, r(D)]])
|
|
171
190
|
}, [
|
|
172
|
-
k(b.$slots, "icon", A(
|
|
191
|
+
k(b.$slots, "icon", A(I(r(u))), () => [
|
|
173
192
|
!e.noIcon && r(w) ? (C(), B(E(r(w)), A(H({ key: 0 }, r(u))), null, 16)) : g("", !0)
|
|
174
193
|
]),
|
|
175
194
|
m("div", J, [
|
|
@@ -177,8 +196,8 @@ const v = ({
|
|
|
177
196
|
]),
|
|
178
197
|
s.dismissible ? (C(), x("button", {
|
|
179
198
|
key: 0,
|
|
180
|
-
class: "m-4px ml-8px h-16px",
|
|
181
|
-
onClick:
|
|
199
|
+
class: "m-[4px] ml-[8px] h-[16px]",
|
|
200
|
+
onClick: n,
|
|
182
201
|
"aria-label": "Dismiss"
|
|
183
202
|
}, [
|
|
184
203
|
S(r(Z), {
|
|
@@ -188,24 +207,24 @@ const v = ({
|
|
|
188
207
|
], 2),
|
|
189
208
|
r(h).body ? (C(), x("div", {
|
|
190
209
|
key: 0,
|
|
191
|
-
class: p(["p-16px", r(l).bodyClass])
|
|
210
|
+
class: p(["p-[16px]", r(l).bodyClass])
|
|
192
211
|
}, [
|
|
193
212
|
k(b.$slots, "body")
|
|
194
213
|
], 2)) : g("", !0),
|
|
195
214
|
r(h).details ? (C(), x("details", {
|
|
196
215
|
key: 1,
|
|
197
|
-
class: p(["p-16px border-t-1", [r(l).bodyClass, r(l).borderClass]]),
|
|
216
|
+
class: p(["p-[16px] border-t border-t-1", [r(l).bodyClass, r(l).borderClass]]),
|
|
198
217
|
ref_key: "detailsRef",
|
|
199
|
-
ref:
|
|
218
|
+
ref: d
|
|
200
219
|
}, [
|
|
201
220
|
m("summary", {
|
|
202
221
|
class: p(["flex font-medium cursor-pointer details-none", r(l).detailsHeaderClass])
|
|
203
222
|
}, [
|
|
204
|
-
S(r(
|
|
223
|
+
S(r(W), {
|
|
205
224
|
strokeColor: r(l).iconChevronColor,
|
|
206
|
-
class: "icon my-4px mr-8px transition transform -rotate-90 open:rotate-0"
|
|
225
|
+
class: "icon my-[4px] mr-[8px] transition transform -rotate-90 open:rotate-0"
|
|
207
226
|
}, null, 8, ["strokeColor"]),
|
|
208
|
-
|
|
227
|
+
_(" " + N(e.detailsTitle), 1)
|
|
209
228
|
], 2),
|
|
210
229
|
m("div", {
|
|
211
230
|
ref_key: "contentRef",
|
|
@@ -222,6 +241,6 @@ const v = ({
|
|
|
222
241
|
export {
|
|
223
242
|
ee as default
|
|
224
243
|
};
|
|
225
|
-
|
|
226
|
-
/* <windicss-keep class="my-4px mr-8px overflow-hidden text-left rounded flex flex-1 font-medium m-4px ml-8px h-16px p-16px 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 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"> */
|
|
227
244
|
//# sourceMappingURL=index.es.mjs.map
|
|
245
|
+
|
|
246
|
+
/* <windicss-keep class="my-[4px] mr-[8px] overflow-hidden text-left rounded 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 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"> */
|