@cypress-design/vue-accordion 0.1.5 → 0.1.6
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/Accordion.vue +14 -14
- package/CHANGELOG.md +6 -0
- package/dist/index.es.mjs +39 -39
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/Accordion.vue
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<details ref="details">
|
|
2
|
+
<details ref="$details">
|
|
3
3
|
<summary
|
|
4
4
|
:class="[CssClasses.summary, headingClassName ?? CssClasses.summaryColor]"
|
|
5
5
|
>
|
|
6
|
-
<
|
|
6
|
+
<span :class="CssClasses.summaryDiv">
|
|
7
7
|
<span :class="CssClasses.icon">
|
|
8
8
|
<slot name="iconEl">
|
|
9
9
|
<Icon />
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
v-if="(props.icon || slots.iconEl) && separator"
|
|
14
14
|
:class="CssClasses.separator"
|
|
15
15
|
/>
|
|
16
|
-
<
|
|
17
|
-
<
|
|
16
|
+
<span class="flex-grow pr-16px">
|
|
17
|
+
<span
|
|
18
18
|
:class="[
|
|
19
19
|
titleClassName ? titleClassName : CssClasses.summaryTitleColor,
|
|
20
20
|
CssClasses.summaryTitle,
|
|
21
21
|
]"
|
|
22
22
|
>
|
|
23
23
|
{{ title }}
|
|
24
|
-
</
|
|
25
|
-
<
|
|
24
|
+
</span>
|
|
25
|
+
<span
|
|
26
26
|
v-if="description"
|
|
27
27
|
:class="[
|
|
28
28
|
CssClasses.summaryDescription,
|
|
@@ -30,16 +30,16 @@
|
|
|
30
30
|
]"
|
|
31
31
|
>
|
|
32
32
|
{{ description }}
|
|
33
|
-
</
|
|
34
|
-
</
|
|
33
|
+
</span>
|
|
34
|
+
</span>
|
|
35
35
|
<IconChevronDownSmall
|
|
36
36
|
strokeColor="gray-300"
|
|
37
37
|
class="open:icon-dark-gray-500"
|
|
38
38
|
:class="CssClasses.chevron"
|
|
39
39
|
/>
|
|
40
|
-
</
|
|
40
|
+
</span>
|
|
41
41
|
</summary>
|
|
42
|
-
<div ref="content" :class="CssClasses.contentWrapper">
|
|
42
|
+
<div ref="$content" :class="CssClasses.contentWrapper">
|
|
43
43
|
<!-- @slot expandable body of the collapsible accordion -->
|
|
44
44
|
<slot v-if="fullWidthContent" />
|
|
45
45
|
<div v-else :class="CssClasses.content">
|
|
@@ -101,12 +101,12 @@ const props = defineProps<{
|
|
|
101
101
|
fullWidthContent?: boolean
|
|
102
102
|
}>()
|
|
103
103
|
|
|
104
|
-
const content = ref(null)
|
|
105
|
-
const details = ref(null)
|
|
104
|
+
const $content = ref(null)
|
|
105
|
+
const $details = ref(null)
|
|
106
106
|
|
|
107
107
|
onMounted(function () {
|
|
108
|
-
if (details.value && content.value) {
|
|
109
|
-
new DetailsAnimation(details.value, content.value)
|
|
108
|
+
if ($details.value && $content.value) {
|
|
109
|
+
new DetailsAnimation($details.value, $content.value)
|
|
110
110
|
}
|
|
111
111
|
})
|
|
112
112
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @cypress-design/vue-accordion
|
|
2
2
|
|
|
3
|
+
## 0.1.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`34a646b`](https://github.com/cypress-io/cypress-design/commit/34a646bbb5ae613d3ede0f63ac62c8a6bf31dd82) Thanks [@elevatebart](https://github.com/elevatebart)! - replace div with spans inside summary for html5 validation
|
|
8
|
+
|
|
3
9
|
## 0.1.5
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.es.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { h as
|
|
2
|
-
import { DetailsAnimation as
|
|
3
|
-
import * as
|
|
4
|
-
import { ICON_COLOR_PROP_NAMES as
|
|
5
|
-
const
|
|
1
|
+
import { h as v, defineComponent as b, useSlots as w, ref as x, onMounted as N, openBlock as p, createElementBlock as y, createElementVNode as i, normalizeClass as s, unref as o, renderSlot as C, createVNode as h, createCommentVNode as k, toDisplayString as g } from "vue";
|
|
2
|
+
import { DetailsAnimation as $ } from "@cypress-design/details-animation";
|
|
3
|
+
import * as D from "@cypress-design/icon-registry";
|
|
4
|
+
import { ICON_COLOR_PROP_NAMES as z } from "@cypress-design/icon-registry";
|
|
5
|
+
const n = {
|
|
6
6
|
summary: "details-none card open:rounded-b-none",
|
|
7
7
|
summaryDiv: "flex flex-row py-12px px-24px flex-nowrap items-center min-h-63px",
|
|
8
8
|
summaryColor: "bg-white",
|
|
@@ -15,15 +15,15 @@ const t = {
|
|
|
15
15
|
chevron: "flex-shrink-0 transition transform rotate-0 open:rotate-180",
|
|
16
16
|
contentWrapper: "border border-gray-100 rounded-b-md border-t-0",
|
|
17
17
|
content: "px-24px py-16px"
|
|
18
|
-
},
|
|
18
|
+
}, E = ({
|
|
19
19
|
body: e,
|
|
20
|
-
compiledClasses:
|
|
20
|
+
compiledClasses: t,
|
|
21
21
|
size: r,
|
|
22
22
|
class: l,
|
|
23
23
|
interactiveColorsOnGroup: d,
|
|
24
24
|
...u
|
|
25
25
|
}) => {
|
|
26
|
-
const c = Object.keys(u).reduce((m, a) => (
|
|
26
|
+
const c = Object.keys(u).reduce((m, a) => (!z.includes(a) && a !== "name" && (m[a] = u[a]), m), {}), f = {
|
|
27
27
|
width: r,
|
|
28
28
|
height: r,
|
|
29
29
|
viewBox: `0 0 ${r} ${r}`,
|
|
@@ -31,17 +31,17 @@ const t = {
|
|
|
31
31
|
innerHTML: e,
|
|
32
32
|
...c
|
|
33
33
|
};
|
|
34
|
-
return
|
|
35
|
-
},
|
|
36
|
-
const { sizeWithDefault:
|
|
34
|
+
return t.length && (f.class = t.join(" ")), f;
|
|
35
|
+
}, O = (e) => {
|
|
36
|
+
const { sizeWithDefault: t, compiledClasses: r } = D.getComponentAttributes({ ...e, availableSizes: ["8", "16"] }), l = {
|
|
37
37
|
8: '<path d="m1 2.5 3 3 3-3" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',
|
|
38
38
|
16: '<path d="m4 6 4 4 4-4" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'
|
|
39
|
-
}[
|
|
39
|
+
}[t];
|
|
40
40
|
if (!l)
|
|
41
|
-
throw Error(`Icon "chevron-down-small" is not available in size ${
|
|
42
|
-
return
|
|
41
|
+
throw Error(`Icon "chevron-down-small" is not available in size ${t}`);
|
|
42
|
+
return v("svg", E({
|
|
43
43
|
...e,
|
|
44
|
-
size:
|
|
44
|
+
size: t,
|
|
45
45
|
body: l,
|
|
46
46
|
compiledClasses: r
|
|
47
47
|
}));
|
|
@@ -58,63 +58,63 @@ const t = {
|
|
|
58
58
|
fullWidthContent: { type: Boolean }
|
|
59
59
|
},
|
|
60
60
|
setup(e) {
|
|
61
|
-
const
|
|
61
|
+
const t = e, r = w(), l = x(null), d = x(null);
|
|
62
62
|
N(function() {
|
|
63
|
-
d.value && l.value && new
|
|
63
|
+
d.value && l.value && new $(d.value, l.value);
|
|
64
64
|
});
|
|
65
|
-
const u =
|
|
65
|
+
const u = t.icon;
|
|
66
66
|
return (c, f) => {
|
|
67
67
|
var m, a;
|
|
68
68
|
return p(), y("details", {
|
|
69
|
-
ref_key: "details",
|
|
69
|
+
ref_key: "$details",
|
|
70
70
|
ref: d
|
|
71
71
|
}, [
|
|
72
72
|
i("summary", {
|
|
73
|
-
class: s([o(
|
|
73
|
+
class: s([o(n).summary, (m = e.headingClassName) != null ? m : o(n).summaryColor])
|
|
74
74
|
}, [
|
|
75
|
-
i("
|
|
76
|
-
class: s(o(
|
|
75
|
+
i("span", {
|
|
76
|
+
class: s(o(n).summaryDiv)
|
|
77
77
|
}, [
|
|
78
78
|
i("span", {
|
|
79
|
-
class: s(o(
|
|
79
|
+
class: s(o(n).icon)
|
|
80
80
|
}, [
|
|
81
81
|
C(c.$slots, "iconEl", {}, () => [
|
|
82
82
|
h(o(u))
|
|
83
83
|
])
|
|
84
84
|
], 2),
|
|
85
|
-
(
|
|
85
|
+
(t.icon || o(r).iconEl) && e.separator ? (p(), y("hr", {
|
|
86
86
|
key: 0,
|
|
87
|
-
class: s(o(
|
|
87
|
+
class: s(o(n).separator)
|
|
88
88
|
}, null, 2)) : k("", !0),
|
|
89
|
-
i("
|
|
90
|
-
i("
|
|
89
|
+
i("span", B, [
|
|
90
|
+
i("span", {
|
|
91
91
|
class: s([
|
|
92
|
-
e.titleClassName ? e.titleClassName : o(
|
|
93
|
-
o(
|
|
92
|
+
e.titleClassName ? e.titleClassName : o(n).summaryTitleColor,
|
|
93
|
+
o(n).summaryTitle
|
|
94
94
|
])
|
|
95
|
-
},
|
|
96
|
-
e.description ? (p(), y("
|
|
95
|
+
}, g(e.title), 3),
|
|
96
|
+
e.description ? (p(), y("span", {
|
|
97
97
|
key: 0,
|
|
98
98
|
class: s([
|
|
99
|
-
o(
|
|
100
|
-
(a = e.descriptionClassName) != null ? a : o(
|
|
99
|
+
o(n).summaryDescription,
|
|
100
|
+
(a = e.descriptionClassName) != null ? a : o(n).summaryDescriptionColor
|
|
101
101
|
])
|
|
102
|
-
},
|
|
102
|
+
}, g(e.description), 3)) : k("", !0)
|
|
103
103
|
]),
|
|
104
|
-
h(o(
|
|
104
|
+
h(o(O), {
|
|
105
105
|
strokeColor: "gray-300",
|
|
106
|
-
class: s(["open:icon-dark-gray-500", o(
|
|
106
|
+
class: s(["open:icon-dark-gray-500", o(n).chevron])
|
|
107
107
|
}, null, 8, ["class"])
|
|
108
108
|
], 2)
|
|
109
109
|
], 2),
|
|
110
110
|
i("div", {
|
|
111
|
-
ref_key: "content",
|
|
111
|
+
ref_key: "$content",
|
|
112
112
|
ref: l,
|
|
113
|
-
class: s(o(
|
|
113
|
+
class: s(o(n).contentWrapper)
|
|
114
114
|
}, [
|
|
115
115
|
e.fullWidthContent ? C(c.$slots, "default", { key: 0 }) : (p(), y("div", {
|
|
116
116
|
key: 1,
|
|
117
|
-
class: s(o(
|
|
117
|
+
class: s(o(n).content)
|
|
118
118
|
}, [
|
|
119
119
|
C(c.$slots, "default")
|
|
120
120
|
], 2))
|