@cypress-design/vue-accordion 0.4.2 → 0.4.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.
@@ -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
- vite v4.2.2 building for production...
4
+ vite v4.3.9 building for production...
5
5
  transforming...
6
6
  ✓ 5 modules transformed.
7
7
  rendering chunks...
8
8
  computing gzip size...
9
- dist/index.es.mjs 4.96 kB │ gzip: 1.84 kB │ map: 262.63 kB
10
- dist/index.umd.js 4.68 kB │ gzip: 1.81 kB │ map: 262.39 kB
11
- ✓ built in 5.32s
9
+ dist/index.es.mjs 5.00 kB │ gzip: 1.86 kB │ map: 292.50 kB
10
+ dist/index.umd.js 4.69 kB │ gzip: 1.82 kB │ map: 292.24 kB
11
+ ✓ built in 4.56s
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
@@ -15,12 +15,13 @@ export default (options: AccordionStoryOptions = {}) => {
15
15
  } = options
16
16
 
17
17
  return (
18
- <div className="m-[16px]">
18
+ <div class="m-[16px]">
19
19
  <Accordion
20
20
  title={title}
21
21
  separator={separator}
22
22
  description={description}
23
23
  icon={icon}
24
+ // @ts-expect-error volar is a little too strict for tsx html attributes. Only do this for tests
24
25
  open={open}
25
26
  fullWidthContent={fullWidthContent}
26
27
  headingClassName={headingClassName}
package/Accordion.vue CHANGED
@@ -14,7 +14,7 @@
14
14
  :class="CssClasses.separator"
15
15
  role="separator"
16
16
  />
17
- <span class="flex-grow pr-[16px]">
17
+ <span class="flex-grow grow pr-[16px]">
18
18
  <span
19
19
  :class="[
20
20
  titleClassName ? titleClassName : CssClasses.summaryTitleColor,
@@ -51,9 +51,6 @@
51
51
  </template>
52
52
 
53
53
  <script lang="ts" setup>
54
- import { CssClasses } from '@cypress-design/constants-accordion'
55
- import { DetailsAnimation } from '@cypress-design/details-animation'
56
- import { IconChevronDownSmall } from '@cypress-design/vue-icon'
57
54
  import {
58
55
  FunctionalComponent,
59
56
  SVGAttributes,
@@ -61,6 +58,9 @@ import {
61
58
  ref,
62
59
  useSlots,
63
60
  } from 'vue'
61
+ import { CssClasses } from '@cypress-design/constants-accordion'
62
+ import { DetailsAnimation } from '@cypress-design/details-animation'
63
+ import { IconChevronDownSmall } from '@cypress-design/vue-icon'
64
64
 
65
65
  const slots = useSlots()
66
66
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @cypress-design/vue-accordion
2
2
 
3
+ ## 0.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#245](https://github.com/cypress-io/cypress-design/pull/245) [`d52d023`](https://github.com/cypress-io/cypress-design/commit/d52d02301bb851d514661a8c258d0c4ae5baf171) Thanks [@elevatebart](https://github.com/elevatebart)! - use tailwind to rollup classes in the final package
8
+
9
+ - Updated dependencies [[`d52d023`](https://github.com/cypress-io/cypress-design/commit/d52d02301bb851d514661a8c258d0c4ae5baf171)]:
10
+ - @cypress-design/vue-icon@0.23.1
11
+
12
+ ## 0.4.3
13
+
14
+ ### Patch Changes
15
+
16
+ - [`4917933`](https://github.com/cypress-io/cypress-design/commit/4917933c82078090c7c29e94a090737e0427821d) Thanks [@elevatebart](https://github.com/elevatebart)! - make accordion compatible with tw
17
+
3
18
  ## 0.4.2
4
19
 
5
20
  ### Patch Changes
@@ -12,7 +12,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
12
12
  /**
13
13
  * Icon to be displayed on the left of the the heading. Overridden by the iconEl slot, if one is provided.
14
14
  */
15
- icon?: FunctionalComponent<SVGAttributes, {}> | undefined;
15
+ icon?: FunctionalComponent<SVGAttributes, {}, any> | undefined;
16
16
  /**
17
17
  * Should we add a vertical separator between the icon and the text.
18
18
  */
@@ -48,7 +48,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
48
48
  /**
49
49
  * Icon to be displayed on the left of the the heading. Overridden by the iconEl slot, if one is provided.
50
50
  */
51
- icon?: FunctionalComponent<SVGAttributes, {}> | undefined;
51
+ icon?: FunctionalComponent<SVGAttributes, {}, any> | undefined;
52
52
  /**
53
53
  * Should we add a vertical separator between the icon and the text.
54
54
  */
@@ -71,9 +71,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
71
71
  * removes the content wrapper from the content.
72
72
  */
73
73
  fullWidthContent?: boolean | undefined;
74
- }>>>, {}>, {
75
- iconEl: (_: {}) => any;
76
- default: (_: {}) => any;
74
+ }>>>, {}, {}>, {
75
+ iconEl?(_: {}): any;
76
+ default?(_: {}): any;
77
77
  }>;
78
78
  export default _default;
79
79
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -1 +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,I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AI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
package/dist/index.es.mjs CHANGED
@@ -1,8 +1,8 @@
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
- import { DetailsAnimation as D } from "@cypress-design/details-animation";
3
- import * as z from "@cypress-design/icon-registry";
4
- import { ICON_COLOR_PROP_NAMES as B } from "@cypress-design/icon-registry";
5
- const n = {
1
+ import { h, defineComponent as g, useSlots as v, ref as C, onMounted as x, openBlock as d, createElementBlock as u, createElementVNode as c, normalizeClass as n, unref as o, renderSlot as y, createBlock as b, createCommentVNode as f, toDisplayString as k, createVNode as w } from "vue";
2
+ import { DetailsAnimation as N } from "@cypress-design/details-animation";
3
+ import * as $ from "@cypress-design/icon-registry";
4
+ import { ICON_COLOR_PROP_NAMES as D } from "@cypress-design/icon-registry";
5
+ const s = {
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,119 +15,124 @@ const n = {
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
- }, E = ({
19
- body: e,
20
- compiledClasses: t,
21
- size: r,
22
- class: l,
23
- interactiveColorsOnGroup: m,
24
- ...d
18
+ }, O = ({
19
+ body: m,
20
+ compiledClasses: a,
21
+ size: l,
22
+ ...r
25
23
  }) => {
26
- const i = Object.keys(d).reduce(
27
- (k, u) => (!B.includes(u) && u !== "name" && (k[u] = d[u]), k),
24
+ const t = Object.keys(r).reduce(
25
+ (e, p) => (!D.includes(
26
+ p
27
+ ) && p !== "name" && (e[p] = r[p]), e),
28
28
  {}
29
- ), y = {
30
- width: r,
31
- height: r,
32
- viewBox: `0 0 ${r} ${r}`,
29
+ ), i = {
30
+ width: l,
31
+ height: l,
32
+ viewBox: `0 0 ${l} ${l}`,
33
33
  fill: "none",
34
- innerHTML: e,
35
- ...i
34
+ innerHTML: m,
35
+ class: void 0,
36
+ ...t
36
37
  // add all standard attributes back to the svg tag
37
38
  };
38
- return t.length && (y.class = t.join(" ")), y;
39
- }, O = (e) => {
40
- const { sizeWithDefault: t, compiledClasses: r } = z.getComponentAttributes({ ...e, availableSizes: ["8", "16"] }), l = {
39
+ return a.length && (i.class = a.join(" ")), i;
40
+ }, z = (m) => {
41
+ const { interactiveColorsOnGroup: a, name: l, ...r } = m, { sizeWithDefault: t, compiledClasses: i } = $.getComponentAttributes({
42
+ ...r,
43
+ availableSizes: ["8", "16"],
44
+ interactiveColorsOnGroup: a
45
+ }), e = {
41
46
  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
47
  16: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m4 6 4 4 4-4" class="icon-dark"/>'
43
48
  }[t];
44
- if (!l)
49
+ if (!e)
45
50
  throw Error(`Icon "chevron-down-small" is not available in size ${t}`);
46
- return g("svg", E({
47
- ...e,
51
+ return h("svg", O({
52
+ ...r,
48
53
  size: t,
49
- body: l,
50
- compiledClasses: r
54
+ body: e,
55
+ compiledClasses: i
51
56
  }));
52
- }, S = { class: "flex-grow pr-[16px]" }, A = /* @__PURE__ */ v({
57
+ }, B = { class: "flex-grow grow pr-[16px]" }, T = /* @__PURE__ */ g({
53
58
  __name: "Accordion",
54
59
  props: {
55
- title: null,
56
- description: null,
57
- icon: null,
60
+ title: {},
61
+ description: {},
62
+ icon: { type: [Function, Object] },
58
63
  separator: { type: Boolean },
59
- titleClassName: null,
60
- descriptionClassName: null,
61
- headingClassName: null,
64
+ titleClassName: {},
65
+ descriptionClassName: {},
66
+ headingClassName: {},
62
67
  fullWidthContent: { type: Boolean }
63
68
  },
64
- setup(e) {
65
- const t = e, r = b(), l = x(null), m = x(null);
66
- w(function() {
67
- m.value && l.value && new D(m.value, l.value);
69
+ setup(m) {
70
+ const a = m, l = v(), r = C(null), t = C(null);
71
+ x(function() {
72
+ t.value && r.value && new N(t.value, r.value);
68
73
  });
69
- const d = t.icon;
70
- return (i, y) => (c(), p("details", {
74
+ const i = a.icon;
75
+ return (e, p) => (d(), u("details", {
71
76
  ref_key: "$details",
72
- ref: m
77
+ ref: t
73
78
  }, [
74
- a("summary", {
75
- class: s([o(n).summary, e.headingClassName ?? o(n).summaryColor])
79
+ c("summary", {
80
+ class: n([o(s).summary, e.headingClassName ?? o(s).summaryColor])
76
81
  }, [
77
- a("span", {
78
- class: s(o(n).summaryDiv)
82
+ c("span", {
83
+ class: n(o(s).summaryDiv)
79
84
  }, [
80
- a("span", {
81
- class: s(o(n).icon)
85
+ c("span", {
86
+ class: n(o(s).icon)
82
87
  }, [
83
- f(i.$slots, "iconEl", {}, () => [
84
- t.icon ? (c(), N(o(d), { key: 0 })) : C("", !0)
88
+ y(e.$slots, "iconEl", {}, () => [
89
+ a.icon ? (d(), b(o(i), { key: 0 })) : f("", !0)
85
90
  ])
86
91
  ], 2),
87
- (t.icon || o(r).iconEl) && e.separator ? (c(), p("span", {
92
+ (a.icon || o(l).iconEl) && e.separator ? (d(), u("span", {
88
93
  key: 0,
89
- class: s(o(n).separator),
94
+ class: n(o(s).separator),
90
95
  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
96
+ }, null, 2)) : f("", !0),
97
+ c("span", B, [
98
+ c("span", {
99
+ class: n([
100
+ e.titleClassName ? e.titleClassName : o(s).summaryTitleColor,
101
+ o(s).summaryTitle
97
102
  ])
98
- }, h(e.title), 3),
99
- e.description ? (c(), p("span", {
103
+ }, k(e.title), 3),
104
+ e.description ? (d(), u("span", {
100
105
  key: 0,
101
- class: s([
102
- o(n).summaryDescription,
103
- e.descriptionClassName ?? o(n).summaryDescriptionColor
106
+ class: n([
107
+ o(s).summaryDescription,
108
+ e.descriptionClassName ?? o(s).summaryDescriptionColor
104
109
  ])
105
- }, h(e.description), 3)) : C("", !0)
110
+ }, k(e.description), 3)) : f("", !0)
106
111
  ]),
107
- $(o(O), {
112
+ w(o(z), {
108
113
  strokeColor: "gray-300",
109
- class: s(["open:icon-dark-gray-500", o(n).chevron])
114
+ class: n(["open:icon-dark-gray-500", o(s).chevron])
110
115
  }, null, 8, ["class"])
111
116
  ], 2)
112
117
  ], 2),
113
- a("div", {
118
+ c("div", {
114
119
  ref_key: "$content",
115
- ref: l,
116
- class: s(o(n).contentWrapper)
120
+ ref: r,
121
+ class: n(o(s).contentWrapper)
117
122
  }, [
118
- e.fullWidthContent ? f(i.$slots, "default", { key: 0 }) : (c(), p("div", {
123
+ e.fullWidthContent ? y(e.$slots, "default", { key: 0 }) : (d(), u("div", {
119
124
  key: 1,
120
- class: s(o(n).content)
125
+ class: n(o(s).content)
121
126
  }, [
122
- f(i.$slots, "default")
127
+ y(e.$slots, "default")
123
128
  ], 2))
124
129
  ], 2)
125
130
  ], 512));
126
131
  }
127
132
  });
128
133
  export {
129
- A as default
134
+ T as default
130
135
  };
131
136
  //# sourceMappingURL=index.es.mjs.map
132
137
 
133
- /* <wind-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]"> */
138
+ /* <wind-keep class="flex-grow grow pr-[16px] 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]"> */