@cypress-design/vue-accordion 0.2.1 → 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.
@@ -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
+ vite v4.2.2 building for production...
5
+ transforming...
6
+ ✓ 5 modules transformed.
7
+ rendering chunks...
8
+ computing gzip size...
9
+ dist/index.es.mjs 4.56 kB │ gzip: 1.80 kB │ map: 262.64 kB
10
+ dist/index.umd.js 4.29 kB │ gzip: 1.77 kB │ map: 262.39 kB
11
+ ✓ built in 5.16s
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/Accordion.vue CHANGED
@@ -51,7 +51,7 @@
51
51
  </template>
52
52
 
53
53
  <script lang="ts" setup>
54
- import { CssClasses } from '../constants'
54
+ import { CssClasses } from '@cypress-design/constants-accordion'
55
55
  import { DetailsAnimation } from '@cypress-design/details-animation'
56
56
  import { IconChevronDownSmall } from '@cypress-design/vue-icon'
57
57
  import {
@@ -23,7 +23,7 @@ describe('<Accordion/>', () => {
23
23
  }
24
24
 
25
25
  it('can be passed an icon as a prop', () => {
26
- mount(Accordion, {
26
+ mount(Accordion as any, {
27
27
  props: {
28
28
  title: 'hi',
29
29
  icon: IconActionQuestionMarkCircle,
@@ -32,7 +32,7 @@ describe('<Accordion/>', () => {
32
32
  })
33
33
 
34
34
  it('can be passed an icon as an element', () => {
35
- mount(Accordion, {
35
+ mount(Accordion as any, {
36
36
  slots,
37
37
  props: {
38
38
  title: 'hi',
@@ -41,7 +41,7 @@ describe('<Accordion/>', () => {
41
41
  })
42
42
 
43
43
  it('when passed both icon and iconEl, iconEl overrides icon', () => {
44
- mount(Accordion, {
44
+ mount(Accordion as any, {
45
45
  icon: IconActionQuestionMarkCircle,
46
46
  slots,
47
47
  props: {
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @cypress-design/vue-accordion
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#196](https://github.com/cypress-io/cypress-design/pull/196) [`fc6d9e4`](https://github.com/cypress-io/cypress-design/commit/fc6d9e4fedcc01fa8e01b868b0fa66d8895c37d0) Thanks [@elevatebart](https://github.com/elevatebart)! - refactor: avoid constants relative imports
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`fc6d9e4`](https://github.com/cypress-io/cypress-design/commit/fc6d9e4fedcc01fa8e01b868b0fa66d8895c37d0)]:
12
+ - @cypress-design/vue-icon@0.21.0
13
+
14
+ ## 0.3.0
15
+
16
+ ### Minor Changes
17
+
18
+ - [#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
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [[`18399c7`](https://github.com/cypress-io/cypress-design/commit/18399c72a52288c67af0935384430d4e4cd24251), [`d0de778`](https://github.com/cypress-io/cypress-design/commit/d0de77843adb87d8f4804219c6dca8f45b15c650)]:
23
+ - @cypress-design/vue-icon@0.20.0
24
+ - @cypress-design/details-animation@0.1.0
25
+
3
26
  ## 0.2.1
4
27
 
5
28
  ### Patch Changes
package/ReadMe.md CHANGED
@@ -1,10 +1,6 @@
1
1
  # Accordion
2
2
 
3
- ## Summary
4
-
5
- Collapsible component with a header and a body.
6
-
7
- ## install
3
+ ## Install
8
4
 
9
5
  ```bash
10
6
  npm install @cypress-design/vue-accordion
@@ -22,16 +18,22 @@ yarn add @cypress-design/vue-accordion
22
18
  import Accordion from '@cypress-design/vue-accordion'
23
19
  ```
24
20
 
25
- ```vue
26
- <Accordion
27
- :icon="IconActionQuestionMarkCircle"
28
- title="Accordion Title"
29
- description="Vestibulum id ligula porta felis euismod semper. Nulla... "
30
- separator
31
- open
32
- fullWidthContent
33
- >
34
- Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odio dolore omnis
35
- nemo minus, sapiente magni ...
36
- </Accordion>
21
+ ```vue live
22
+ <script lang="ts" setup>
23
+ import { IconActionQuestionMarkCircle } from '@cypress-design/vue-icon'
24
+ </script>
25
+
26
+ <template>
27
+ <Accordion
28
+ :icon="IconActionQuestionMarkCircle"
29
+ title="Accordion Title"
30
+ description="Vestibulum id ligula porta felis euismod semper. Nulla... "
31
+ separator
32
+ open
33
+ fullWidthContent
34
+ >
35
+ Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odio dolore omnis
36
+ nemo minus, sapiente magni ...
37
+ </Accordion>
38
+ </template>
37
39
  ```
@@ -0,0 +1,93 @@
1
+ import { FunctionalComponent, SVGAttributes } from 'vue';
2
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
3
+ /**
4
+ * Main indigo title.
5
+ * [NOTE] Its color and font can be customized using `titleClassName`.
6
+ */
7
+ title: string;
8
+ /**
9
+ * Second line in the heading.
10
+ */
11
+ description?: string | undefined;
12
+ /**
13
+ * Icon to be displayed on the left of the the heading. Overridden by the iconEl slot, if one is provided.
14
+ */
15
+ icon?: FunctionalComponent<SVGAttributes, {}> | undefined;
16
+ /**
17
+ * Should we add a vertical separator between the icon and the text.
18
+ */
19
+ separator?: boolean | undefined;
20
+ /**
21
+ * Change the font and color of the heading title
22
+ */
23
+ titleClassName?: string | undefined;
24
+ /**
25
+ * Change the font and color of the heading description
26
+ */
27
+ descriptionClassName?: string | undefined;
28
+ /**
29
+ * Additional classes to add to the header of the accordion
30
+ * > [NOTE] useful to change the background color of the header
31
+ */
32
+ headingClassName?: string | undefined;
33
+ /**
34
+ * When using content that needs ti be edge to edge,
35
+ * removes the content wrapper from the content.
36
+ */
37
+ fullWidthContent?: boolean | undefined;
38
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
39
+ /**
40
+ * Main indigo title.
41
+ * [NOTE] Its color and font can be customized using `titleClassName`.
42
+ */
43
+ title: string;
44
+ /**
45
+ * Second line in the heading.
46
+ */
47
+ description?: string | undefined;
48
+ /**
49
+ * Icon to be displayed on the left of the the heading. Overridden by the iconEl slot, if one is provided.
50
+ */
51
+ icon?: FunctionalComponent<SVGAttributes, {}> | undefined;
52
+ /**
53
+ * Should we add a vertical separator between the icon and the text.
54
+ */
55
+ separator?: boolean | undefined;
56
+ /**
57
+ * Change the font and color of the heading title
58
+ */
59
+ titleClassName?: string | undefined;
60
+ /**
61
+ * Change the font and color of the heading description
62
+ */
63
+ descriptionClassName?: string | undefined;
64
+ /**
65
+ * Additional classes to add to the header of the accordion
66
+ * > [NOTE] useful to change the background color of the header
67
+ */
68
+ headingClassName?: string | undefined;
69
+ /**
70
+ * When using content that needs ti be edge to edge,
71
+ * removes the content wrapper from the content.
72
+ */
73
+ fullWidthContent?: boolean | undefined;
74
+ }>>>, {}>, {
75
+ iconEl: (_: {}) => any;
76
+ default: (_: {}) => any;
77
+ }>;
78
+ export default _default;
79
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
80
+ type __VLS_TypePropsToRuntimeProps<T> = {
81
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
82
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
83
+ } : {
84
+ type: import('vue').PropType<T[K]>;
85
+ required: true;
86
+ };
87
+ };
88
+ type __VLS_WithTemplateSlots<T, S> = T & {
89
+ new (): {
90
+ $slots: S;
91
+ };
92
+ };
93
+ //# sourceMappingURL=Accordion.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordion.vue.d.ts","sourceRoot":"","sources":["../Accordion.vue.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,mBAAmB,EACnB,aAAa,EAId,MAAM,KAAK,CAAA;;IAwDV;;;OAGG;WACI,MAAM;IACb;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;;IAjCH;;;OAGG;WACI,MAAM;IACb;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;;uBA2K0B,GAAG;wBACF,GAAG;;AAnQnC,wBAuRc;AACd,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,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAAE,MAAM,EAAE,CAAC,CAAA;KAAE,CAAA;CAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA"}
package/dist/index.es.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { h as g, defineComponent as v, useSlots as b, ref as x, onMounted as w, openBlock as d, createElementBlock as y, createElementVNode as i, normalizeClass as s, unref as o, renderSlot as C, createBlock as N, createCommentVNode as k, toDisplayString as h, createVNode as $ } from "vue";
1
+ import { h as g, defineComponent as v, useSlots as b, ref as x, onMounted as w, openBlock as c, createElementBlock as p, createElementVNode as a, normalizeClass as s, unref as o, renderSlot as f, createBlock as N, createCommentVNode as C, toDisplayString as h, createVNode as $ } from "vue";
2
2
  import { DetailsAnimation as D } from "@cypress-design/details-animation";
3
3
  import * as z from "@cypress-design/icon-registry";
4
4
  import { ICON_COLOR_PROP_NAMES as B } from "@cypress-design/icon-registry";
@@ -20,22 +20,26 @@ const n = {
20
20
  compiledClasses: t,
21
21
  size: r,
22
22
  class: l,
23
- interactiveColorsOnGroup: u,
24
- ...p
23
+ interactiveColorsOnGroup: m,
24
+ ...d
25
25
  }) => {
26
- const c = Object.keys(p).reduce((m, a) => (!B.includes(a) && a !== "name" && (m[a] = p[a]), m), {}), f = {
26
+ const i = Object.keys(d).reduce(
27
+ (k, u) => (!B.includes(u) && u !== "name" && (k[u] = d[u]), k),
28
+ {}
29
+ ), y = {
27
30
  width: r,
28
31
  height: r,
29
32
  viewBox: `0 0 ${r} ${r}`,
30
33
  fill: "none",
31
34
  innerHTML: e,
32
- ...c
35
+ ...i
36
+ // add all standard attributes back to the svg tag
33
37
  };
34
- return t.length && (f.class = t.join(" ")), f;
38
+ return t.length && (y.class = t.join(" ")), y;
35
39
  }, O = (e) => {
36
40
  const { sizeWithDefault: t, compiledClasses: r } = z.getComponentAttributes({ ...e, availableSizes: ["8", "16"] }), l = {
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
- 16: '<path d="m4 6 4 4 4-4" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'
41
+ 8: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 2.5 3 3 3-3" class="icon-dark"/>',
42
+ 16: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m4 6 4 4 4-4" class="icon-dark"/>'
39
43
  }[t];
40
44
  if (!l)
41
45
  throw Error(`Icon "chevron-down-small" is not available in size ${t}`);
@@ -58,75 +62,72 @@ const n = {
58
62
  fullWidthContent: { type: Boolean }
59
63
  },
60
64
  setup(e) {
61
- const t = e, r = b(), l = x(null), u = x(null);
65
+ const t = e, r = b(), l = x(null), m = x(null);
62
66
  w(function() {
63
- u.value && l.value && new D(u.value, l.value);
67
+ m.value && l.value && new D(m.value, l.value);
64
68
  });
65
- const p = t.icon;
66
- return (c, f) => {
67
- var m, a;
68
- return d(), y("details", {
69
- ref_key: "$details",
70
- ref: u
69
+ const d = t.icon;
70
+ return (i, y) => (c(), p("details", {
71
+ ref_key: "$details",
72
+ ref: m
73
+ }, [
74
+ a("summary", {
75
+ class: s([o(n).summary, e.headingClassName ?? o(n).summaryColor])
71
76
  }, [
72
- i("summary", {
73
- class: s([o(n).summary, (m = e.headingClassName) != null ? m : o(n).summaryColor])
77
+ a("span", {
78
+ class: s(o(n).summaryDiv)
74
79
  }, [
75
- i("span", {
76
- class: s(o(n).summaryDiv)
80
+ a("span", {
81
+ class: s(o(n).icon)
77
82
  }, [
78
- i("span", {
79
- class: s(o(n).icon)
80
- }, [
81
- C(c.$slots, "iconEl", {}, () => [
82
- t.icon ? (d(), N(o(p), { key: 0 })) : k("", !0)
83
+ f(i.$slots, "iconEl", {}, () => [
84
+ t.icon ? (c(), N(o(d), { key: 0 })) : C("", !0)
85
+ ])
86
+ ], 2),
87
+ (t.icon || o(r).iconEl) && e.separator ? (c(), p("span", {
88
+ key: 0,
89
+ class: s(o(n).separator),
90
+ role: "separator"
91
+ }, null, 2)) : C("", !0),
92
+ a("span", S, [
93
+ a("span", {
94
+ class: s([
95
+ e.titleClassName ? e.titleClassName : o(n).summaryTitleColor,
96
+ o(n).summaryTitle
83
97
  ])
84
- ], 2),
85
- (t.icon || o(r).iconEl) && e.separator ? (d(), y("span", {
98
+ }, h(e.title), 3),
99
+ e.description ? (c(), p("span", {
86
100
  key: 0,
87
- class: s(o(n).separator),
88
- role: "separator"
89
- }, null, 2)) : k("", !0),
90
- i("span", S, [
91
- i("span", {
92
- class: s([
93
- e.titleClassName ? e.titleClassName : o(n).summaryTitleColor,
94
- o(n).summaryTitle
95
- ])
96
- }, h(e.title), 3),
97
- e.description ? (d(), y("span", {
98
- key: 0,
99
- class: s([
100
- o(n).summaryDescription,
101
- (a = e.descriptionClassName) != null ? a : o(n).summaryDescriptionColor
102
- ])
103
- }, h(e.description), 3)) : k("", !0)
104
- ]),
105
- $(o(O), {
106
- strokeColor: "gray-300",
107
- class: s(["open:icon-dark-gray-500", o(n).chevron])
108
- }, null, 8, ["class"])
109
- ], 2)
110
- ], 2),
111
- i("div", {
112
- ref_key: "$content",
113
- ref: l,
114
- class: s(o(n).contentWrapper)
115
- }, [
116
- e.fullWidthContent ? C(c.$slots, "default", { key: 0 }) : (d(), y("div", {
117
- key: 1,
118
- class: s(o(n).content)
119
- }, [
120
- C(c.$slots, "default")
121
- ], 2))
101
+ class: s([
102
+ o(n).summaryDescription,
103
+ e.descriptionClassName ?? o(n).summaryDescriptionColor
104
+ ])
105
+ }, h(e.description), 3)) : C("", !0)
106
+ ]),
107
+ $(o(O), {
108
+ strokeColor: "gray-300",
109
+ class: s(["open:icon-dark-gray-500", o(n).chevron])
110
+ }, null, 8, ["class"])
122
111
  ], 2)
123
- ], 512);
124
- };
112
+ ], 2),
113
+ a("div", {
114
+ ref_key: "$content",
115
+ ref: l,
116
+ class: s(o(n).contentWrapper)
117
+ }, [
118
+ e.fullWidthContent ? f(i.$slots, "default", { key: 0 }) : (c(), p("div", {
119
+ key: 1,
120
+ class: s(o(n).content)
121
+ }, [
122
+ f(i.$slots, "default")
123
+ ], 2))
124
+ ], 2)
125
+ ], 512));
125
126
  }
126
127
  });
127
128
  export {
128
129
  A as default
129
130
  };
130
-
131
- /* <windicss-keep class="flex-grow pr-[16px] open:icon-dark-gray-500 icon-dark-gray-300 details-none card open:rounded-b-none flex flex-row py-[12px] px-[24px] flex-nowrap items-center min-h-[63px] bg-white text-[18px] leading-[28px] font-medium text-indigo-500 block text-[14px] leading-[20px] font-normal text-gray-700 mr-[24px] flex-shrink-0 w-[1px] h-[40px] bg-gray-100 mr-[16px] transition transform rotate-0 open:rotate-180 border border-gray-100 rounded-b-md border-t-0 py-[16px]"> */
132
131
  //# sourceMappingURL=index.es.mjs.map
132
+
133
+ /* <windicss-keep class="flex-grow pr-[16px] open:icon-dark-gray-500 icon-dark-gray-300"> */