@cypress-design/vue-accordion 1.1.0 → 1.3.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.
@@ -4,6 +4,6 @@ transforming...
4
4
  ✓ 4 modules transformed.
5
5
  rendering chunks...
6
6
  computing gzip size...
7
- dist/index.es.mjs 4.16 kB │ gzip: 1.52 kB │ map: 6.63 kB
8
- dist/index.umd.js 3.71 kB │ gzip: 1.43 kB │ map: 6.49 kB
9
- ✓ built in 3.16s
7
+ dist/index.es.mjs 4.65 kB │ gzip: 1.71 kB │ map: 8.86 kB
8
+ dist/index.umd.js 4.00 kB │ gzip: 1.57 kB │ map: 8.68 kB
9
+ ✓ built in 3.35s
@@ -16,6 +16,7 @@ export default (options: AccordionStoryOptions = {}) => {
16
16
  descriptionClassName,
17
17
  onClickSummary,
18
18
  onToggle,
19
+ summaryAttributes,
19
20
  } = options
20
21
 
21
22
  return (
@@ -32,6 +33,7 @@ export default (options: AccordionStoryOptions = {}) => {
32
33
  descriptionClassName={descriptionClassName}
33
34
  onClickSummary={onClickSummary}
34
35
  onToggle={onToggle}
36
+ summaryAttributes={summaryAttributes}
35
37
  >
36
38
  {{
37
39
  default: () => (
package/Accordion.vue CHANGED
@@ -1,6 +1,7 @@
1
1
  <template>
2
- <details ref="$details" :open="openState">
2
+ <details ref="$details" :open="initialOpen">
3
3
  <summary
4
+ v-bind="summaryAttributes"
4
5
  ref="$summary"
5
6
  :class="[CssClasses.summary, headingClassName ?? CssClasses.summaryColor]"
6
7
  >
@@ -52,7 +53,15 @@
52
53
  </template>
53
54
 
54
55
  <script lang="ts" setup>
55
- import { Component, onMounted, ref, toRaw, useSlots } from 'vue'
56
+ import {
57
+ Component,
58
+ type HTMLAttributes,
59
+ onMounted,
60
+ ref,
61
+ toRaw,
62
+ useSlots,
63
+ watch,
64
+ } from 'vue'
56
65
  import { CssClasses } from '@cypress-design/constants-accordion'
57
66
  import { DetailsAnimation } from '@cypress-design/details-animation'
58
67
  import { IconChevronDownSmall } from '@cypress-design/vue-icon'
@@ -106,16 +115,51 @@ const props = defineProps<{
106
115
  * @param open - The new open state of the accordion.
107
116
  */
108
117
  onToggle?: (open: boolean) => void
118
+ /**
119
+ * Attributes added to the `<summary>` element, such as `data-cy` or `aria-*`.
120
+ * A `class` here is added to the summary's own classes.
121
+ * Use `onClickSummary` to handle header clicks.
122
+ */
123
+ summaryAttributes?: Omit<HTMLAttributes, 'innerHTML' | 'onClick'> & {
124
+ [key: `data-${string}`]: string | number | boolean | undefined
125
+ }
109
126
  }>()
110
127
 
111
128
  const $content = ref(null)
112
129
  const $details = ref<HTMLDetailsElement | null>(null)
113
130
  const $summary = ref<HTMLElement | null>(null)
114
131
  const openState = ref(props.open ?? false)
132
+ // Bound once. Re-binding `open` to openState would let Vue patch the element
133
+ // between our capture listener and DetailsAnimation's click listener, so the
134
+ // animation would see the new state and undo it (a real click could never
135
+ // close the accordion). After mount, DetailsAnimation and the watcher below
136
+ // own the element's `open`.
137
+ const initialOpen = props.open ?? false
138
+ let detailsAnimation: DetailsAnimation | undefined
139
+
140
+ // Follow the `open` prop when it changes after mount
141
+ watch(
142
+ () => props.open,
143
+ (open) => {
144
+ openState.value = open ?? false
145
+ if (!$details.value) return
146
+ // Cancel an in-flight open/close animation first, or its finish handler
147
+ // would set `open` back the other way.
148
+ if (detailsAnimation?.animation) {
149
+ detailsAnimation.animation.cancel()
150
+ detailsAnimation.animation = null
151
+ if ($content.value) {
152
+ const content = $content.value as HTMLElement
153
+ content.style.height = content.style.overflow = ''
154
+ }
155
+ }
156
+ $details.value.open = openState.value
157
+ },
158
+ )
115
159
 
116
160
  onMounted(function () {
117
161
  if ($details.value && $content.value) {
118
- new DetailsAnimation($details.value, $content.value)
162
+ detailsAnimation = new DetailsAnimation($details.value, $content.value)
119
163
  }
120
164
 
121
165
  if ($details.value) {
@@ -136,7 +180,8 @@ function handleSummaryClick(event: MouseEvent) {
136
180
  const result = props.onClickSummary(event)
137
181
  if (result === false) {
138
182
  event.preventDefault()
139
- event.stopPropagation()
183
+ // Also stop DetailsAnimation's listener on the same element.
184
+ event.stopImmediatePropagation()
140
185
  return
141
186
  }
142
187
  }
@@ -148,9 +193,13 @@ function handleSummaryClick(event: MouseEvent) {
148
193
  }
149
194
 
150
195
  function handleToggle() {
151
- openState.value = $details.value?.open ?? false
196
+ const open = $details.value?.open ?? false
197
+ // A summary click already updated openState and called onToggle.
198
+ // Only report toggles that did not come from a click.
199
+ if (open === openState.value) return
200
+ openState.value = open
152
201
  if (props.onToggle) {
153
- props.onToggle(openState.value)
202
+ props.onToggle(open)
154
203
  }
155
204
  }
156
205
  </script>
@@ -1,4 +1,5 @@
1
1
  /// <reference types="cypress" />
2
+ import { ref } from 'vue'
2
3
  import { mount } from 'cypress/vue'
3
4
  import assertions from '../assertions'
4
5
  import AccordionStory from './Accordion.rootstory'
@@ -22,6 +23,26 @@ describe('<Accordion/>', () => {
22
23
  ),
23
24
  }
24
25
 
26
+ it('follows the open prop when it changes after mount', () => {
27
+ const open = ref(false)
28
+ mount(() => (
29
+ <div>
30
+ <button id="toggle" onClick={() => (open.value = !open.value)}>
31
+ Toggle
32
+ </button>
33
+ <Accordion title="hi" open={open.value}>
34
+ Content
35
+ </Accordion>
36
+ </div>
37
+ ))
38
+
39
+ cy.get('details').should('not.have.attr', 'open')
40
+ cy.get('#toggle').click()
41
+ cy.get('details').should('have.attr', 'open')
42
+ cy.get('#toggle').click()
43
+ cy.get('details').should('not.have.attr', 'open')
44
+ })
45
+
25
46
  it('can be passed an icon as a prop', () => {
26
47
  mount(Accordion as any, {
27
48
  props: {
@@ -51,4 +72,39 @@ describe('<Accordion/>', () => {
51
72
 
52
73
  cy.get('summary').find('svg').should('have.length', 2)
53
74
  })
75
+
76
+ it('adds a class from summaryAttributes to the summary classes', () => {
77
+ mount(() => (
78
+ <Accordion
79
+ title="hi"
80
+ headingClassName="bg-gray-50"
81
+ summaryAttributes={{ class: 'extra-class' }}
82
+ >
83
+ Content
84
+ </Accordion>
85
+ ))
86
+
87
+ cy.get('summary')
88
+ .should('have.class', 'extra-class')
89
+ .and('have.class', 'bg-gray-50')
90
+ .and('have.class', 'card')
91
+ })
92
+
93
+ // Checked by the type-check, not at runtime: these values would replace
94
+ // the summary's content or bypass onClickSummary.
95
+ it('keeps content and click props out of summaryAttributes', () => {
96
+ type SummaryAttributes = InstanceType<
97
+ typeof Accordion
98
+ >['$props']['summaryAttributes']
99
+ // @ts-expect-error header clicks go through onClickSummary
100
+ const withClick: SummaryAttributes = { onClick: () => {} }
101
+ // @ts-expect-error the summary always renders its own content
102
+ const withHtml: SummaryAttributes = { innerHTML: 'x' }
103
+ const valid: SummaryAttributes = {
104
+ 'data-cy': 'collapsible-header',
105
+ 'aria-label': 'Toggle details',
106
+ class: 'extra-class',
107
+ }
108
+ expect([withClick, withHtml, valid]).to.have.length(3)
109
+ })
54
110
  })
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @cypress-design/vue-accordion
2
2
 
3
+ ## 1.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#823](https://github.com/cypress-io/cypress-design/pull/823) [`8998673`](https://github.com/cypress-io/cypress-design/commit/8998673767fc3400e501c2c430d183ba389c6aa9) Thanks [@jennifer-shehane](https://github.com/jennifer-shehane)! - Add a `summaryAttributes` prop to Accordion that passes attributes such as `data-cy` or `aria-*` to the `<summary>` header element.
8
+
9
+ ## 1.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#730](https://github.com/cypress-io/cypress-design/pull/730) [`218898a`](https://github.com/cypress-io/cypress-design/commit/218898a2137faf409b7bed8190ffae646264e26f) Thanks [@emilmilanov](https://github.com/emilmilanov)! - Vue Accordion fixes:
14
+
15
+ - A real mouse click can close the accordion again. Vue re-rendered `open` between the click handlers, so the open/close animation undid every close.
16
+ - The accordion now follows the `open` prop when it changes after mount, matching React. A change mid-animation cancels the animation instead of being undone by it.
17
+ - `onToggle` fires once per open or close instead of twice.
18
+ - Returning `false` from `onClickSummary` now also stops the open/close animation.
19
+
3
20
  ## 1.1.0
4
21
 
5
22
  ### Minor Changes
@@ -1,4 +1,4 @@
1
- import { Component } from 'vue';
1
+ import { Component, type HTMLAttributes } from 'vue';
2
2
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToOption<{
3
3
  /**
4
4
  * Main indigo title.
@@ -46,6 +46,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
46
46
  * @param open - The new open state of the accordion.
47
47
  */
48
48
  onToggle?: ((open: boolean) => void) | undefined;
49
+ /**
50
+ * Attributes added to the `<summary>` element, such as `data-cy` or `aria-*`.
51
+ * A `class` here is added to the summary's own classes.
52
+ * Use `onClickSummary` to handle header clicks.
53
+ */
54
+ summaryAttributes?: (Omit<HTMLAttributes, "innerHTML" | "onClick"> & {
55
+ [key: `data-${string}`]: string | number | boolean | undefined;
56
+ }) | undefined;
49
57
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
50
58
  /**
51
59
  * Main indigo title.
@@ -93,6 +101,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
93
101
  * @param open - The new open state of the accordion.
94
102
  */
95
103
  onToggle?: ((open: boolean) => void) | undefined;
104
+ /**
105
+ * Attributes added to the `<summary>` element, such as `data-cy` or `aria-*`.
106
+ * A `class` here is added to the summary's own classes.
107
+ * Use `onClickSummary` to handle header clicks.
108
+ */
109
+ summaryAttributes?: (Omit<HTMLAttributes, "innerHTML" | "onClick"> & {
110
+ [key: `data-${string}`]: string | number | boolean | undefined;
111
+ }) | undefined;
96
112
  }>>>, {}, {}>, {
97
113
  iconEl?(_: {}): any;
98
114
  default?(_: {}): any;
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.vue.d.ts","sourceRoot":"","sources":["../Accordion.vue"],"names":[],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G,GAAG,EAAE,CAAC;CAC9D;AACD,eAAO,MAAM,oBAAoB,IAAK,CAAC;AAMvC,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACpC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC;AAEN,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
package/dist/index.es.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { defineComponent as D, useSlots as N, ref as m, onMounted as T, toRaw as b, createElementBlock as p, openBlock as i, createElementVNode as l, normalizeClass as t, unref as o, createCommentVNode as d, createVNode as w, renderSlot as y, createBlock as S, toDisplayString as f } from "vue";
2
- import { DetailsAnimation as $ } from "@cypress-design/details-animation";
3
- import { IconChevronDownSmall as B } from "@cypress-design/vue-icon";
4
- const n = {
1
+ import { defineComponent as D, useSlots as N, ref as c, watch as T, onMounted as S, toRaw as $, createElementBlock as f, openBlock as p, unref as o, createElementVNode as m, mergeProps as B, normalizeClass as r, createCommentVNode as y, createVNode as E, renderSlot as g, createBlock as W, toDisplayString as v } from "vue";
2
+ import { DetailsAnimation as A } from "@cypress-design/details-animation";
3
+ import { IconChevronDownSmall as I } from "@cypress-design/vue-icon";
4
+ const t = {
5
5
  summary: "details-none card open:rounded-b-none",
6
6
  summaryDiv: "flex flex-row py-[12px] px-[24px] flex-nowrap items-center min-h-[63px]",
7
7
  summaryColor: "bg-white",
@@ -14,7 +14,7 @@ const n = {
14
14
  chevron: "flex-shrink-0 transition transform rotate-0 open:rotate-180",
15
15
  contentWrapper: "border border-gray-100 rounded-b-md border-t-0",
16
16
  content: "px-[24px] py-[16px]"
17
- }, E = ["open"], W = { class: "flex-grow grow pr-[16px]" }, I = /* @__PURE__ */ D({
17
+ }, V = ["open"], F = { class: "flex-grow grow pr-[16px]" }, M = /* @__PURE__ */ D({
18
18
  __name: "Accordion",
19
19
  props: {
20
20
  title: {},
@@ -27,90 +27,104 @@ const n = {
27
27
  fullWidthContent: { type: Boolean },
28
28
  open: { type: Boolean },
29
29
  onClickSummary: { type: Function },
30
- onToggle: { type: Function }
30
+ onToggle: { type: Function },
31
+ summaryAttributes: {}
31
32
  },
32
- setup(g) {
33
- const C = N(), a = g, c = m(null), r = m(null), u = m(null), s = m(a.open ?? !1);
34
- T(function() {
35
- r.value && c.value && new $(r.value, c.value), r.value && r.value.addEventListener("toggle", h), u.value && u.value.addEventListener("click", k, {
33
+ setup(C) {
34
+ const k = N(), n = C, u = c(null), a = c(null), d = c(null), s = c(n.open ?? !1), h = n.open ?? !1;
35
+ let i;
36
+ T(
37
+ () => n.open,
38
+ (e) => {
39
+ if (s.value = e ?? !1, !!a.value) {
40
+ if (i != null && i.animation && (i.animation.cancel(), i.animation = null, u.value)) {
41
+ const l = u.value;
42
+ l.style.height = l.style.overflow = "";
43
+ }
44
+ a.value.open = s.value;
45
+ }
46
+ }
47
+ ), S(function() {
48
+ a.value && u.value && (i = new A(a.value, u.value)), a.value && a.value.addEventListener("toggle", w), d.value && d.value.addEventListener("click", b, {
36
49
  capture: !0
37
50
  });
38
51
  });
39
- const v = b(a.icon);
40
- function k(e) {
41
- if (a.onClickSummary && a.onClickSummary(e) === !1) {
42
- e.preventDefault(), e.stopPropagation();
52
+ const x = $(n.icon);
53
+ function b(e) {
54
+ if (n.onClickSummary && n.onClickSummary(e) === !1) {
55
+ e.preventDefault(), e.stopImmediatePropagation();
43
56
  return;
44
57
  }
45
- s.value = !s.value, a.onToggle && a.onToggle(s.value);
58
+ s.value = !s.value, n.onToggle && n.onToggle(s.value);
46
59
  }
47
- function h() {
48
- var e;
49
- s.value = ((e = r.value) == null ? void 0 : e.open) ?? !1, a.onToggle && a.onToggle(s.value);
60
+ function w() {
61
+ var l;
62
+ const e = ((l = a.value) == null ? void 0 : l.open) ?? !1;
63
+ e !== s.value && (s.value = e, n.onToggle && n.onToggle(e));
50
64
  }
51
- return (e, x) => (i(), p("details", {
65
+ return (e, l) => (p(), f("details", {
52
66
  ref_key: "$details",
53
- ref: r,
54
- open: s.value
67
+ ref: a,
68
+ open: o(h)
55
69
  }, [
56
- l("summary", {
70
+ m("summary", B(e.summaryAttributes, {
57
71
  ref_key: "$summary",
58
- ref: u,
59
- class: t([o(n).summary, e.headingClassName ?? o(n).summaryColor])
60
- }, [
61
- l("span", {
62
- class: t(o(n).summaryDiv)
72
+ ref: d,
73
+ class: [o(t).summary, e.headingClassName ?? o(t).summaryColor]
74
+ }), [
75
+ m("span", {
76
+ class: r(o(t).summaryDiv)
63
77
  }, [
64
- l("span", {
65
- class: t(o(n).icon)
78
+ m("span", {
79
+ class: r(o(t).icon)
66
80
  }, [
67
- y(e.$slots, "iconEl", {}, () => [
68
- a.icon ? (i(), S(o(v), { key: 0 })) : d("", !0)
81
+ g(e.$slots, "iconEl", {}, () => [
82
+ n.icon ? (p(), W(o(x), { key: 0 })) : y("", !0)
69
83
  ])
70
84
  ], 2),
71
- (a.icon || o(C).iconEl) && e.separator ? (i(), p("span", {
85
+ (n.icon || o(k).iconEl) && e.separator ? (p(), f("span", {
72
86
  key: 0,
73
- class: t(o(n).separator),
87
+ class: r(o(t).separator),
74
88
  role: "separator"
75
- }, null, 2)) : d("", !0),
76
- l("span", W, [
77
- l("span", {
78
- class: t([
79
- e.titleClassName ? e.titleClassName : o(n).summaryTitleColor,
80
- o(n).summaryTitle
89
+ }, null, 2)) : y("", !0),
90
+ m("span", F, [
91
+ m("span", {
92
+ class: r([
93
+ e.titleClassName ? e.titleClassName : o(t).summaryTitleColor,
94
+ o(t).summaryTitle
81
95
  ])
82
- }, f(e.title), 3),
83
- e.description ? (i(), p("span", {
96
+ }, v(e.title), 3),
97
+ e.description ? (p(), f("span", {
84
98
  key: 0,
85
- class: t([
86
- o(n).summaryDescription,
87
- e.descriptionClassName ?? o(n).summaryDescriptionColor
99
+ class: r([
100
+ o(t).summaryDescription,
101
+ e.descriptionClassName ?? o(t).summaryDescriptionColor
88
102
  ])
89
- }, f(e.description), 3)) : d("", !0)
103
+ }, v(e.description), 3)) : y("", !0)
90
104
  ]),
91
- w(o(B), {
105
+ E(o(I), {
92
106
  strokeColor: "gray-300",
93
- class: t(["open:icon-dark-gray-500", o(n).chevron])
107
+ class: r(["open:icon-dark-gray-500", o(t).chevron])
94
108
  }, null, 8, ["class"])
95
109
  ], 2)
96
- ], 2),
97
- l("div", {
110
+ ], 16),
111
+ m("div", {
98
112
  ref_key: "$content",
99
- ref: c,
100
- class: t(o(n).contentWrapper)
113
+ ref: u,
114
+ class: r(o(t).contentWrapper)
101
115
  }, [
102
- e.fullWidthContent ? y(e.$slots, "default", { key: 0 }) : (i(), p("div", {
116
+ e.fullWidthContent ? g(e.$slots, "default", { key: 0 }) : (p(), f("div", {
103
117
  key: 1,
104
- class: t(o(n).content)
118
+ class: r(o(t).content)
105
119
  }, [
106
- y(e.$slots, "default")
120
+ g(e.$slots, "default")
107
121
  ], 2))
108
122
  ], 2)
109
- ], 8, E));
123
+ ], 8, V));
110
124
  }
111
125
  });
112
126
  export {
113
- I as default
127
+ M as default
114
128
  };
115
129
  //# sourceMappingURL=index.es.mjs.map
116
130
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.mjs","sources":["../../constants/dist/index.es.mjs","../Accordion.vue"],"sourcesContent":["const CssClasses = {\n summary: 'details-none card open:rounded-b-none',\n summaryDiv: 'flex flex-row py-[12px] px-[24px] flex-nowrap items-center min-h-[63px]',\n summaryColor: 'bg-white',\n summaryTitle: 'text-[18px] leading-[28px] font-medium',\n summaryTitleColor: 'text-indigo-500 block',\n summaryDescription: 'text-[14px] leading-[20px] font-normal block',\n summaryDescriptionColor: 'text-gray-700',\n icon: 'mr-[24px] flex-shrink-0',\n separator: 'w-[1px] h-[40px] bg-gray-100 mr-[16px]',\n chevron: 'flex-shrink-0 transition transform rotate-0 open:rotate-180',\n contentWrapper: 'border border-gray-100 rounded-b-md border-t-0',\n content: 'px-[24px] py-[16px]',\n};\n\nexport { CssClasses };\n//# sourceMappingURL=index.es.mjs.map\n","<template>\n <details ref=\"$details\" :open=\"openState\">\n <summary\n ref=\"$summary\"\n :class=\"[CssClasses.summary, headingClassName ?? CssClasses.summaryColor]\"\n >\n <span :class=\"CssClasses.summaryDiv\">\n <span :class=\"CssClasses.icon\">\n <slot name=\"iconEl\">\n <Icon v-if=\"props.icon\" />\n </slot>\n </span>\n <span\n v-if=\"(props.icon || slots.iconEl) && separator\"\n :class=\"CssClasses.separator\"\n role=\"separator\"\n />\n <span class=\"flex-grow grow pr-[16px]\">\n <span\n :class=\"[\n titleClassName ? titleClassName : CssClasses.summaryTitleColor,\n CssClasses.summaryTitle,\n ]\"\n >\n {{ title }}\n </span>\n <span\n v-if=\"description\"\n :class=\"[\n CssClasses.summaryDescription,\n descriptionClassName ?? CssClasses.summaryDescriptionColor,\n ]\"\n >\n {{ description }}\n </span>\n </span>\n <IconChevronDownSmall\n strokeColor=\"gray-300\"\n class=\"open:icon-dark-gray-500\"\n :class=\"CssClasses.chevron\"\n />\n </span>\n </summary>\n <div ref=\"$content\" :class=\"CssClasses.contentWrapper\">\n <!-- @slot expandable body of the collapsible accordion -->\n <slot v-if=\"fullWidthContent\" />\n <div v-else :class=\"CssClasses.content\">\n <slot />\n </div>\n </div>\n </details>\n</template>\n\n<script lang=\"ts\" setup>\nimport { Component, onMounted, ref, toRaw, useSlots } from 'vue'\nimport { CssClasses } from '@cypress-design/constants-accordion'\nimport { DetailsAnimation } from '@cypress-design/details-animation'\nimport { IconChevronDownSmall } from '@cypress-design/vue-icon'\n\nconst slots = useSlots()\n\nconst props = defineProps<{\n /**\n * Main indigo title.\n * [NOTE] Its color and font can be customized using `titleClassName`.\n */\n title: string\n /**\n * Second line in the heading.\n */\n description?: string\n /**\n * Icon to be displayed on the left of the the heading. Overridden by the iconEl slot, if one is provided.\n */\n icon?: Component\n /**\n * Should we add a vertical separator between the icon and the text.\n */\n separator?: boolean\n /**\n * Change the font and color of the heading title\n */\n titleClassName?: string\n /**\n * Change the font and color of the heading description\n */\n descriptionClassName?: string\n /**\n * Additional classes to add to the header of the accordion\n * > [NOTE] useful to change the background color of the header\n */\n headingClassName?: string\n /**\n * When using content that needs ti be edge to edge,\n * removes the content wrapper from the content.\n */\n fullWidthContent?: boolean\n open?: boolean\n /**\n * Provides access to the onClick event of the summary element.\n * Allows for custom handling or cancellation of the default behavior.\n */\n onClickSummary?: (event: MouseEvent) => boolean | undefined\n /**\n * Callback triggered when the accordion toggles open or closed.\n * @param open - The new open state of the accordion.\n */\n onToggle?: (open: boolean) => void\n}>()\n\nconst $content = ref(null)\nconst $details = ref<HTMLDetailsElement | null>(null)\nconst $summary = ref<HTMLElement | null>(null)\nconst openState = ref(props.open ?? false)\n\nonMounted(function () {\n if ($details.value && $content.value) {\n new DetailsAnimation($details.value, $content.value)\n }\n\n if ($details.value) {\n $details.value.addEventListener('toggle', handleToggle)\n }\n\n if ($summary.value) {\n $summary.value.addEventListener('click', handleSummaryClick, {\n capture: true,\n })\n }\n})\n\nconst Icon = toRaw(props.icon)\n\nfunction handleSummaryClick(event: MouseEvent) {\n if (props.onClickSummary) {\n const result = props.onClickSummary(event)\n if (result === false) {\n event.preventDefault()\n event.stopPropagation()\n return\n }\n }\n\n openState.value = !openState.value\n if (props.onToggle) {\n props.onToggle(openState.value)\n }\n}\n\nfunction handleToggle() {\n openState.value = $details.value?.open ?? false\n if (props.onToggle) {\n props.onToggle(openState.value)\n }\n}\n</script>\n"],"names":["CssClasses","slots","useSlots","props","__props","$content","ref","$details","$summary","openState","onMounted","DetailsAnimation","handleToggle","handleSummaryClick","Icon","toRaw","event","_a"],"mappings":";;;AAAA,MAAMA,IAAa;AAAA,EACf,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,MAAM;AAAA,EACN,WAAW;AAAA,EACX,SAAS;AAAA,EACT,gBAAgB;AAAA,EAChB,SAAS;AACb;;;;;;;;;;;;;;;;AC8CA,UAAMC,IAAQC,EAAA,GAERC,IAAQC,GAiDRC,IAAWC,EAAI,IAAI,GACnBC,IAAWD,EAA+B,IAAI,GAC9CE,IAAWF,EAAwB,IAAI,GACvCG,IAAYH,EAAIH,EAAM,QAAQ,EAAK;AAEzC,IAAAO,EAAU,WAAY;AACpB,MAAIH,EAAS,SAASF,EAAS,SAC7B,IAAIM,EAAiBJ,EAAS,OAAOF,EAAS,KAAK,GAGjDE,EAAS,SACXA,EAAS,MAAM,iBAAiB,UAAUK,CAAY,GAGpDJ,EAAS,SACXA,EAAS,MAAM,iBAAiB,SAASK,GAAoB;AAAA,QAC3D,SAAS;AAAA,MAAA,CACV;AAAA,IAEL,CAAC;AAED,UAAMC,IAAOC,EAAMZ,EAAM,IAAI;AAE7B,aAASU,EAAmBG,GAAmB;AAC7C,UAAIb,EAAM,kBACOA,EAAM,eAAea,CAAK,MAC1B,IAAO;AACpB,QAAAA,EAAM,eAAA,GACNA,EAAM,gBAAA;AACN;AAAA,MACF;AAGF,MAAAP,EAAU,QAAQ,CAACA,EAAU,OACzBN,EAAM,YACRA,EAAM,SAASM,EAAU,KAAK;AAAA,IAElC;AAEA,aAASG,IAAe;;AACtB,MAAAH,EAAU,UAAQQ,IAAAV,EAAS,UAAT,gBAAAU,EAAgB,SAAQ,IACtCd,EAAM,YACRA,EAAM,SAASM,EAAU,KAAK;AAAA,IAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.es.mjs","sources":["../../constants/dist/index.es.mjs","../Accordion.vue"],"sourcesContent":["const CssClasses = {\n summary: 'details-none card open:rounded-b-none',\n summaryDiv: 'flex flex-row py-[12px] px-[24px] flex-nowrap items-center min-h-[63px]',\n summaryColor: 'bg-white',\n summaryTitle: 'text-[18px] leading-[28px] font-medium',\n summaryTitleColor: 'text-indigo-500 block',\n summaryDescription: 'text-[14px] leading-[20px] font-normal block',\n summaryDescriptionColor: 'text-gray-700',\n icon: 'mr-[24px] flex-shrink-0',\n separator: 'w-[1px] h-[40px] bg-gray-100 mr-[16px]',\n chevron: 'flex-shrink-0 transition transform rotate-0 open:rotate-180',\n contentWrapper: 'border border-gray-100 rounded-b-md border-t-0',\n content: 'px-[24px] py-[16px]',\n};\n\nexport { CssClasses };\n//# sourceMappingURL=index.es.mjs.map\n","<template>\n <details ref=\"$details\" :open=\"initialOpen\">\n <summary\n v-bind=\"summaryAttributes\"\n ref=\"$summary\"\n :class=\"[CssClasses.summary, headingClassName ?? CssClasses.summaryColor]\"\n >\n <span :class=\"CssClasses.summaryDiv\">\n <span :class=\"CssClasses.icon\">\n <slot name=\"iconEl\">\n <Icon v-if=\"props.icon\" />\n </slot>\n </span>\n <span\n v-if=\"(props.icon || slots.iconEl) && separator\"\n :class=\"CssClasses.separator\"\n role=\"separator\"\n />\n <span class=\"flex-grow grow pr-[16px]\">\n <span\n :class=\"[\n titleClassName ? titleClassName : CssClasses.summaryTitleColor,\n CssClasses.summaryTitle,\n ]\"\n >\n {{ title }}\n </span>\n <span\n v-if=\"description\"\n :class=\"[\n CssClasses.summaryDescription,\n descriptionClassName ?? CssClasses.summaryDescriptionColor,\n ]\"\n >\n {{ description }}\n </span>\n </span>\n <IconChevronDownSmall\n strokeColor=\"gray-300\"\n class=\"open:icon-dark-gray-500\"\n :class=\"CssClasses.chevron\"\n />\n </span>\n </summary>\n <div ref=\"$content\" :class=\"CssClasses.contentWrapper\">\n <!-- @slot expandable body of the collapsible accordion -->\n <slot v-if=\"fullWidthContent\" />\n <div v-else :class=\"CssClasses.content\">\n <slot />\n </div>\n </div>\n </details>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n Component,\n type HTMLAttributes,\n onMounted,\n ref,\n toRaw,\n useSlots,\n watch,\n} from 'vue'\nimport { CssClasses } from '@cypress-design/constants-accordion'\nimport { DetailsAnimation } from '@cypress-design/details-animation'\nimport { IconChevronDownSmall } from '@cypress-design/vue-icon'\n\nconst slots = useSlots()\n\nconst props = defineProps<{\n /**\n * Main indigo title.\n * [NOTE] Its color and font can be customized using `titleClassName`.\n */\n title: string\n /**\n * Second line in the heading.\n */\n description?: string\n /**\n * Icon to be displayed on the left of the the heading. Overridden by the iconEl slot, if one is provided.\n */\n icon?: Component\n /**\n * Should we add a vertical separator between the icon and the text.\n */\n separator?: boolean\n /**\n * Change the font and color of the heading title\n */\n titleClassName?: string\n /**\n * Change the font and color of the heading description\n */\n descriptionClassName?: string\n /**\n * Additional classes to add to the header of the accordion\n * > [NOTE] useful to change the background color of the header\n */\n headingClassName?: string\n /**\n * When using content that needs ti be edge to edge,\n * removes the content wrapper from the content.\n */\n fullWidthContent?: boolean\n open?: boolean\n /**\n * Provides access to the onClick event of the summary element.\n * Allows for custom handling or cancellation of the default behavior.\n */\n onClickSummary?: (event: MouseEvent) => boolean | undefined\n /**\n * Callback triggered when the accordion toggles open or closed.\n * @param open - The new open state of the accordion.\n */\n onToggle?: (open: boolean) => void\n /**\n * Attributes added to the `<summary>` element, such as `data-cy` or `aria-*`.\n * A `class` here is added to the summary's own classes.\n * Use `onClickSummary` to handle header clicks.\n */\n summaryAttributes?: Omit<HTMLAttributes, 'innerHTML' | 'onClick'> & {\n [key: `data-${string}`]: string | number | boolean | undefined\n }\n}>()\n\nconst $content = ref(null)\nconst $details = ref<HTMLDetailsElement | null>(null)\nconst $summary = ref<HTMLElement | null>(null)\nconst openState = ref(props.open ?? false)\n// Bound once. Re-binding `open` to openState would let Vue patch the element\n// between our capture listener and DetailsAnimation's click listener, so the\n// animation would see the new state and undo it (a real click could never\n// close the accordion). After mount, DetailsAnimation and the watcher below\n// own the element's `open`.\nconst initialOpen = props.open ?? false\nlet detailsAnimation: DetailsAnimation | undefined\n\n// Follow the `open` prop when it changes after mount\nwatch(\n () => props.open,\n (open) => {\n openState.value = open ?? false\n if (!$details.value) return\n // Cancel an in-flight open/close animation first, or its finish handler\n // would set `open` back the other way.\n if (detailsAnimation?.animation) {\n detailsAnimation.animation.cancel()\n detailsAnimation.animation = null\n if ($content.value) {\n const content = $content.value as HTMLElement\n content.style.height = content.style.overflow = ''\n }\n }\n $details.value.open = openState.value\n },\n)\n\nonMounted(function () {\n if ($details.value && $content.value) {\n detailsAnimation = new DetailsAnimation($details.value, $content.value)\n }\n\n if ($details.value) {\n $details.value.addEventListener('toggle', handleToggle)\n }\n\n if ($summary.value) {\n $summary.value.addEventListener('click', handleSummaryClick, {\n capture: true,\n })\n }\n})\n\nconst Icon = toRaw(props.icon)\n\nfunction handleSummaryClick(event: MouseEvent) {\n if (props.onClickSummary) {\n const result = props.onClickSummary(event)\n if (result === false) {\n event.preventDefault()\n // Also stop DetailsAnimation's listener on the same element.\n event.stopImmediatePropagation()\n return\n }\n }\n\n openState.value = !openState.value\n if (props.onToggle) {\n props.onToggle(openState.value)\n }\n}\n\nfunction handleToggle() {\n const open = $details.value?.open ?? false\n // A summary click already updated openState and called onToggle.\n // Only report toggles that did not come from a click.\n if (open === openState.value) return\n openState.value = open\n if (props.onToggle) {\n props.onToggle(open)\n }\n}\n</script>\n"],"names":["CssClasses","slots","useSlots","props","__props","$content","ref","$details","$summary","openState","initialOpen","detailsAnimation","watch","open","content","onMounted","DetailsAnimation","handleToggle","handleSummaryClick","Icon","toRaw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A,EAAM,eAAekB,CAAK,MAC1B,IAAO;AACpB,QAAAA,EAAM,eAAA,GAENA,EAAM,yBAAA;AACN;AAAA,MACF;AAGF,MAAAZ,EAAU,QAAQ,CAACA,EAAU,OACzBN,EAAM,YACRA,EAAM,SAASM,EAAU,KAAK;AAAA,IAElC;AAEA,aAASQ,IAAe;;AACtB,YAAMJ,MAAOS,IAAAf,EAAS,UAAT,gBAAAe,EAAgB,SAAQ;AAGrC,MAAIT,MAASJ,EAAU,UACvBA,EAAU,QAAQI,GACdV,EAAM,YACRA,EAAM,SAASU,CAAI;AAAA,IAEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(e,a){typeof exports=="object"&&typeof module<"u"?module.exports=a(require("vue"),require("@cypress-design/details-animation"),require("@cypress-design/vue-icon")):typeof define=="function"&&define.amd?define(["vue","@cypress-design/details-animation","@cypress-design/vue-icon"],a):(e=typeof globalThis<"u"?globalThis:e||self,e.Accordion=a(e.Vue,e.CyDetailsAnimation,e.Icon))})(this,function(e,a,c){"use strict";const o={summary:"details-none card open:rounded-b-none",summaryDiv:"flex flex-row py-[12px] px-[24px] flex-nowrap items-center min-h-[63px]",summaryColor:"bg-white",summaryTitle:"text-[18px] leading-[28px] font-medium",summaryTitleColor:"text-indigo-500 block",summaryDescription:"text-[14px] leading-[20px] font-normal block",summaryDescriptionColor:"text-gray-700",icon:"mr-[24px] flex-shrink-0",separator:"w-[1px] h-[40px] bg-gray-100 mr-[16px]",chevron:"flex-shrink-0 transition transform rotate-0 open:rotate-180",contentWrapper:"border border-gray-100 rounded-b-md border-t-0",content:"px-[24px] py-[16px]"},m=["open"],p={class:"flex-grow grow pr-[16px]"};return e.defineComponent({__name:"Accordion",props:{title:{},description:{},icon:{},separator:{type:Boolean},titleClassName:{},descriptionClassName:{},headingClassName:{},fullWidthContent:{type:Boolean},open:{type:Boolean},onClickSummary:{type:Function},onToggle:{type:Function}},setup(d){const f=e.useSlots(),r=d,l=e.ref(null),t=e.ref(null),i=e.ref(null),s=e.ref(r.open??!1);e.onMounted(function(){t.value&&l.value&&new a.DetailsAnimation(t.value,l.value),t.value&&t.value.addEventListener("toggle",C),i.value&&i.value.addEventListener("click",u,{capture:!0})});const y=e.toRaw(r.icon);function u(n){if(r.onClickSummary&&r.onClickSummary(n)===!1){n.preventDefault(),n.stopPropagation();return}s.value=!s.value,r.onToggle&&r.onToggle(s.value)}function C(){var n;s.value=((n=t.value)==null?void 0:n.open)??!1,r.onToggle&&r.onToggle(s.value)}return(n,g)=>(e.openBlock(),e.createElementBlock("details",{ref_key:"$details",ref:t,open:s.value},[e.createElementVNode("summary",{ref_key:"$summary",ref:i,class:e.normalizeClass([e.unref(o).summary,n.headingClassName??e.unref(o).summaryColor])},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(o).summaryDiv)},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(o).icon)},[e.renderSlot(n.$slots,"iconEl",{},()=>[r.icon?(e.openBlock(),e.createBlock(e.unref(y),{key:0})):e.createCommentVNode("",!0)])],2),(r.icon||e.unref(f).iconEl)&&n.separator?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(o).separator),role:"separator"},null,2)):e.createCommentVNode("",!0),e.createElementVNode("span",p,[e.createElementVNode("span",{class:e.normalizeClass([n.titleClassName?n.titleClassName:e.unref(o).summaryTitleColor,e.unref(o).summaryTitle])},e.toDisplayString(n.title),3),n.description?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass([e.unref(o).summaryDescription,n.descriptionClassName??e.unref(o).summaryDescriptionColor])},e.toDisplayString(n.description),3)):e.createCommentVNode("",!0)]),e.createVNode(e.unref(c.IconChevronDownSmall),{strokeColor:"gray-300",class:e.normalizeClass(["open:icon-dark-gray-500",e.unref(o).chevron])},null,8,["class"])],2)],2),e.createElementVNode("div",{ref_key:"$content",ref:l,class:e.normalizeClass(e.unref(o).contentWrapper)},[n.fullWidthContent?e.renderSlot(n.$slots,"default",{key:0}):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(o).content)},[e.renderSlot(n.$slots,"default")],2))],2)],8,m))}})});
1
+ (function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("vue"),require("@cypress-design/details-animation"),require("@cypress-design/vue-icon")):typeof define=="function"&&define.amd?define(["vue","@cypress-design/details-animation","@cypress-design/vue-icon"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.Accordion=i(e.Vue,e.CyDetailsAnimation,e.Icon))})(this,function(e,i,p){"use strict";const o={summary:"details-none card open:rounded-b-none",summaryDiv:"flex flex-row py-[12px] px-[24px] flex-nowrap items-center min-h-[63px]",summaryColor:"bg-white",summaryTitle:"text-[18px] leading-[28px] font-medium",summaryTitleColor:"text-indigo-500 block",summaryDescription:"text-[14px] leading-[20px] font-normal block",summaryDescriptionColor:"text-gray-700",icon:"mr-[24px] flex-shrink-0",separator:"w-[1px] h-[40px] bg-gray-100 mr-[16px]",chevron:"flex-shrink-0 transition transform rotate-0 open:rotate-180",contentWrapper:"border border-gray-100 rounded-b-md border-t-0",content:"px-[24px] py-[16px]"},f=["open"],d={class:"flex-grow grow pr-[16px]"};return e.defineComponent({__name:"Accordion",props:{title:{},description:{},icon:{},separator:{type:Boolean},titleClassName:{},descriptionClassName:{},headingClassName:{},fullWidthContent:{type:Boolean},open:{type:Boolean},onClickSummary:{type:Function},onToggle:{type:Function},summaryAttributes:{}},setup(u){const y=e.useSlots(),t=u,c=e.ref(null),r=e.ref(null),m=e.ref(null),a=e.ref(t.open??!1),C=t.open??!1;let l;e.watch(()=>t.open,n=>{if(a.value=n??!1,!!r.value){if(l!=null&&l.animation&&(l.animation.cancel(),l.animation=null,c.value)){const s=c.value;s.style.height=s.style.overflow=""}r.value.open=a.value}}),e.onMounted(function(){r.value&&c.value&&(l=new i.DetailsAnimation(r.value,c.value)),r.value&&r.value.addEventListener("toggle",h),m.value&&m.value.addEventListener("click",k,{capture:!0})});const g=e.toRaw(t.icon);function k(n){if(t.onClickSummary&&t.onClickSummary(n)===!1){n.preventDefault(),n.stopImmediatePropagation();return}a.value=!a.value,t.onToggle&&t.onToggle(a.value)}function h(){var s;const n=((s=r.value)==null?void 0:s.open)??!1;n!==a.value&&(a.value=n,t.onToggle&&t.onToggle(n))}return(n,s)=>(e.openBlock(),e.createElementBlock("details",{ref_key:"$details",ref:r,open:e.unref(C)},[e.createElementVNode("summary",e.mergeProps(n.summaryAttributes,{ref_key:"$summary",ref:m,class:[e.unref(o).summary,n.headingClassName??e.unref(o).summaryColor]}),[e.createElementVNode("span",{class:e.normalizeClass(e.unref(o).summaryDiv)},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(o).icon)},[e.renderSlot(n.$slots,"iconEl",{},()=>[t.icon?(e.openBlock(),e.createBlock(e.unref(g),{key:0})):e.createCommentVNode("",!0)])],2),(t.icon||e.unref(y).iconEl)&&n.separator?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(o).separator),role:"separator"},null,2)):e.createCommentVNode("",!0),e.createElementVNode("span",d,[e.createElementVNode("span",{class:e.normalizeClass([n.titleClassName?n.titleClassName:e.unref(o).summaryTitleColor,e.unref(o).summaryTitle])},e.toDisplayString(n.title),3),n.description?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass([e.unref(o).summaryDescription,n.descriptionClassName??e.unref(o).summaryDescriptionColor])},e.toDisplayString(n.description),3)):e.createCommentVNode("",!0)]),e.createVNode(e.unref(p.IconChevronDownSmall),{strokeColor:"gray-300",class:e.normalizeClass(["open:icon-dark-gray-500",e.unref(o).chevron])},null,8,["class"])],2)],16),e.createElementVNode("div",{ref_key:"$content",ref:c,class:e.normalizeClass(e.unref(o).contentWrapper)},[n.fullWidthContent?e.renderSlot(n.$slots,"default",{key:0}):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(o).content)},[e.renderSlot(n.$slots,"default")],2))],2)],8,f))}})});
2
2
  //# sourceMappingURL=index.umd.js.map
3
3
 
4
4
  /* <wind-keep class="flex-grow grow pr-[16px] open:icon-dark-gray-500 icon-dark-gray-300"> */
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../../constants/dist/index.es.mjs","../Accordion.vue"],"sourcesContent":["const CssClasses = {\n summary: 'details-none card open:rounded-b-none',\n summaryDiv: 'flex flex-row py-[12px] px-[24px] flex-nowrap items-center min-h-[63px]',\n summaryColor: 'bg-white',\n summaryTitle: 'text-[18px] leading-[28px] font-medium',\n summaryTitleColor: 'text-indigo-500 block',\n summaryDescription: 'text-[14px] leading-[20px] font-normal block',\n summaryDescriptionColor: 'text-gray-700',\n icon: 'mr-[24px] flex-shrink-0',\n separator: 'w-[1px] h-[40px] bg-gray-100 mr-[16px]',\n chevron: 'flex-shrink-0 transition transform rotate-0 open:rotate-180',\n contentWrapper: 'border border-gray-100 rounded-b-md border-t-0',\n content: 'px-[24px] py-[16px]',\n};\n\nexport { CssClasses };\n//# sourceMappingURL=index.es.mjs.map\n","<template>\n <details ref=\"$details\" :open=\"openState\">\n <summary\n ref=\"$summary\"\n :class=\"[CssClasses.summary, headingClassName ?? CssClasses.summaryColor]\"\n >\n <span :class=\"CssClasses.summaryDiv\">\n <span :class=\"CssClasses.icon\">\n <slot name=\"iconEl\">\n <Icon v-if=\"props.icon\" />\n </slot>\n </span>\n <span\n v-if=\"(props.icon || slots.iconEl) && separator\"\n :class=\"CssClasses.separator\"\n role=\"separator\"\n />\n <span class=\"flex-grow grow pr-[16px]\">\n <span\n :class=\"[\n titleClassName ? titleClassName : CssClasses.summaryTitleColor,\n CssClasses.summaryTitle,\n ]\"\n >\n {{ title }}\n </span>\n <span\n v-if=\"description\"\n :class=\"[\n CssClasses.summaryDescription,\n descriptionClassName ?? CssClasses.summaryDescriptionColor,\n ]\"\n >\n {{ description }}\n </span>\n </span>\n <IconChevronDownSmall\n strokeColor=\"gray-300\"\n class=\"open:icon-dark-gray-500\"\n :class=\"CssClasses.chevron\"\n />\n </span>\n </summary>\n <div ref=\"$content\" :class=\"CssClasses.contentWrapper\">\n <!-- @slot expandable body of the collapsible accordion -->\n <slot v-if=\"fullWidthContent\" />\n <div v-else :class=\"CssClasses.content\">\n <slot />\n </div>\n </div>\n </details>\n</template>\n\n<script lang=\"ts\" setup>\nimport { Component, onMounted, ref, toRaw, useSlots } from 'vue'\nimport { CssClasses } from '@cypress-design/constants-accordion'\nimport { DetailsAnimation } from '@cypress-design/details-animation'\nimport { IconChevronDownSmall } from '@cypress-design/vue-icon'\n\nconst slots = useSlots()\n\nconst props = defineProps<{\n /**\n * Main indigo title.\n * [NOTE] Its color and font can be customized using `titleClassName`.\n */\n title: string\n /**\n * Second line in the heading.\n */\n description?: string\n /**\n * Icon to be displayed on the left of the the heading. Overridden by the iconEl slot, if one is provided.\n */\n icon?: Component\n /**\n * Should we add a vertical separator between the icon and the text.\n */\n separator?: boolean\n /**\n * Change the font and color of the heading title\n */\n titleClassName?: string\n /**\n * Change the font and color of the heading description\n */\n descriptionClassName?: string\n /**\n * Additional classes to add to the header of the accordion\n * > [NOTE] useful to change the background color of the header\n */\n headingClassName?: string\n /**\n * When using content that needs ti be edge to edge,\n * removes the content wrapper from the content.\n */\n fullWidthContent?: boolean\n open?: boolean\n /**\n * Provides access to the onClick event of the summary element.\n * Allows for custom handling or cancellation of the default behavior.\n */\n onClickSummary?: (event: MouseEvent) => boolean | undefined\n /**\n * Callback triggered when the accordion toggles open or closed.\n * @param open - The new open state of the accordion.\n */\n onToggle?: (open: boolean) => void\n}>()\n\nconst $content = ref(null)\nconst $details = ref<HTMLDetailsElement | null>(null)\nconst $summary = ref<HTMLElement | null>(null)\nconst openState = ref(props.open ?? false)\n\nonMounted(function () {\n if ($details.value && $content.value) {\n new DetailsAnimation($details.value, $content.value)\n }\n\n if ($details.value) {\n $details.value.addEventListener('toggle', handleToggle)\n }\n\n if ($summary.value) {\n $summary.value.addEventListener('click', handleSummaryClick, {\n capture: true,\n })\n }\n})\n\nconst Icon = toRaw(props.icon)\n\nfunction handleSummaryClick(event: MouseEvent) {\n if (props.onClickSummary) {\n const result = props.onClickSummary(event)\n if (result === false) {\n event.preventDefault()\n event.stopPropagation()\n return\n }\n }\n\n openState.value = !openState.value\n if (props.onToggle) {\n props.onToggle(openState.value)\n }\n}\n\nfunction handleToggle() {\n openState.value = $details.value?.open ?? false\n if (props.onToggle) {\n props.onToggle(openState.value)\n }\n}\n</script>\n"],"names":["CssClasses","slots","useSlots","props","__props","$content","ref","$details","$summary","openState","onMounted","DetailsAnimation","handleToggle","handleSummaryClick","Icon","toRaw","event","_a"],"mappings":"saAAA,MAAMA,EAAa,CACf,QAAS,wCACT,WAAY,0EACZ,aAAc,WACd,aAAc,yCACd,kBAAmB,wBACnB,mBAAoB,+CACpB,wBAAyB,gBACzB,KAAM,0BACN,UAAW,yCACX,QAAS,8DACT,eAAgB,iDAChB,QAAS,qBACb,mVC8CA,MAAMC,EAAQC,EAAAA,SAAA,EAERC,EAAQC,EAiDRC,EAAWC,EAAAA,IAAI,IAAI,EACnBC,EAAWD,EAAAA,IAA+B,IAAI,EAC9CE,EAAWF,EAAAA,IAAwB,IAAI,EACvCG,EAAYH,EAAAA,IAAIH,EAAM,MAAQ,EAAK,EAEzCO,EAAAA,UAAU,UAAY,CAChBH,EAAS,OAASF,EAAS,OAC7B,IAAIM,EAAAA,iBAAiBJ,EAAS,MAAOF,EAAS,KAAK,EAGjDE,EAAS,OACXA,EAAS,MAAM,iBAAiB,SAAUK,CAAY,EAGpDJ,EAAS,OACXA,EAAS,MAAM,iBAAiB,QAASK,EAAoB,CAC3D,QAAS,EAAA,CACV,CAEL,CAAC,EAED,MAAMC,EAAOC,EAAAA,MAAMZ,EAAM,IAAI,EAE7B,SAASU,EAAmBG,EAAmB,CAC7C,GAAIb,EAAM,gBACOA,EAAM,eAAea,CAAK,IAC1B,GAAO,CACpBA,EAAM,eAAA,EACNA,EAAM,gBAAA,EACN,MACF,CAGFP,EAAU,MAAQ,CAACA,EAAU,MACzBN,EAAM,UACRA,EAAM,SAASM,EAAU,KAAK,CAElC,CAEA,SAASG,GAAe,OACtBH,EAAU,QAAQQ,EAAAV,EAAS,QAAT,YAAAU,EAAgB,OAAQ,GACtCd,EAAM,UACRA,EAAM,SAASM,EAAU,KAAK,CAElC"}
1
+ {"version":3,"file":"index.umd.js","sources":["../../constants/dist/index.es.mjs","../Accordion.vue"],"sourcesContent":["const CssClasses = {\n summary: 'details-none card open:rounded-b-none',\n summaryDiv: 'flex flex-row py-[12px] px-[24px] flex-nowrap items-center min-h-[63px]',\n summaryColor: 'bg-white',\n summaryTitle: 'text-[18px] leading-[28px] font-medium',\n summaryTitleColor: 'text-indigo-500 block',\n summaryDescription: 'text-[14px] leading-[20px] font-normal block',\n summaryDescriptionColor: 'text-gray-700',\n icon: 'mr-[24px] flex-shrink-0',\n separator: 'w-[1px] h-[40px] bg-gray-100 mr-[16px]',\n chevron: 'flex-shrink-0 transition transform rotate-0 open:rotate-180',\n contentWrapper: 'border border-gray-100 rounded-b-md border-t-0',\n content: 'px-[24px] py-[16px]',\n};\n\nexport { CssClasses };\n//# sourceMappingURL=index.es.mjs.map\n","<template>\n <details ref=\"$details\" :open=\"initialOpen\">\n <summary\n v-bind=\"summaryAttributes\"\n ref=\"$summary\"\n :class=\"[CssClasses.summary, headingClassName ?? CssClasses.summaryColor]\"\n >\n <span :class=\"CssClasses.summaryDiv\">\n <span :class=\"CssClasses.icon\">\n <slot name=\"iconEl\">\n <Icon v-if=\"props.icon\" />\n </slot>\n </span>\n <span\n v-if=\"(props.icon || slots.iconEl) && separator\"\n :class=\"CssClasses.separator\"\n role=\"separator\"\n />\n <span class=\"flex-grow grow pr-[16px]\">\n <span\n :class=\"[\n titleClassName ? titleClassName : CssClasses.summaryTitleColor,\n CssClasses.summaryTitle,\n ]\"\n >\n {{ title }}\n </span>\n <span\n v-if=\"description\"\n :class=\"[\n CssClasses.summaryDescription,\n descriptionClassName ?? CssClasses.summaryDescriptionColor,\n ]\"\n >\n {{ description }}\n </span>\n </span>\n <IconChevronDownSmall\n strokeColor=\"gray-300\"\n class=\"open:icon-dark-gray-500\"\n :class=\"CssClasses.chevron\"\n />\n </span>\n </summary>\n <div ref=\"$content\" :class=\"CssClasses.contentWrapper\">\n <!-- @slot expandable body of the collapsible accordion -->\n <slot v-if=\"fullWidthContent\" />\n <div v-else :class=\"CssClasses.content\">\n <slot />\n </div>\n </div>\n </details>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n Component,\n type HTMLAttributes,\n onMounted,\n ref,\n toRaw,\n useSlots,\n watch,\n} from 'vue'\nimport { CssClasses } from '@cypress-design/constants-accordion'\nimport { DetailsAnimation } from '@cypress-design/details-animation'\nimport { IconChevronDownSmall } from '@cypress-design/vue-icon'\n\nconst slots = useSlots()\n\nconst props = defineProps<{\n /**\n * Main indigo title.\n * [NOTE] Its color and font can be customized using `titleClassName`.\n */\n title: string\n /**\n * Second line in the heading.\n */\n description?: string\n /**\n * Icon to be displayed on the left of the the heading. Overridden by the iconEl slot, if one is provided.\n */\n icon?: Component\n /**\n * Should we add a vertical separator between the icon and the text.\n */\n separator?: boolean\n /**\n * Change the font and color of the heading title\n */\n titleClassName?: string\n /**\n * Change the font and color of the heading description\n */\n descriptionClassName?: string\n /**\n * Additional classes to add to the header of the accordion\n * > [NOTE] useful to change the background color of the header\n */\n headingClassName?: string\n /**\n * When using content that needs ti be edge to edge,\n * removes the content wrapper from the content.\n */\n fullWidthContent?: boolean\n open?: boolean\n /**\n * Provides access to the onClick event of the summary element.\n * Allows for custom handling or cancellation of the default behavior.\n */\n onClickSummary?: (event: MouseEvent) => boolean | undefined\n /**\n * Callback triggered when the accordion toggles open or closed.\n * @param open - The new open state of the accordion.\n */\n onToggle?: (open: boolean) => void\n /**\n * Attributes added to the `<summary>` element, such as `data-cy` or `aria-*`.\n * A `class` here is added to the summary's own classes.\n * Use `onClickSummary` to handle header clicks.\n */\n summaryAttributes?: Omit<HTMLAttributes, 'innerHTML' | 'onClick'> & {\n [key: `data-${string}`]: string | number | boolean | undefined\n }\n}>()\n\nconst $content = ref(null)\nconst $details = ref<HTMLDetailsElement | null>(null)\nconst $summary = ref<HTMLElement | null>(null)\nconst openState = ref(props.open ?? false)\n// Bound once. Re-binding `open` to openState would let Vue patch the element\n// between our capture listener and DetailsAnimation's click listener, so the\n// animation would see the new state and undo it (a real click could never\n// close the accordion). After mount, DetailsAnimation and the watcher below\n// own the element's `open`.\nconst initialOpen = props.open ?? false\nlet detailsAnimation: DetailsAnimation | undefined\n\n// Follow the `open` prop when it changes after mount\nwatch(\n () => props.open,\n (open) => {\n openState.value = open ?? false\n if (!$details.value) return\n // Cancel an in-flight open/close animation first, or its finish handler\n // would set `open` back the other way.\n if (detailsAnimation?.animation) {\n detailsAnimation.animation.cancel()\n detailsAnimation.animation = null\n if ($content.value) {\n const content = $content.value as HTMLElement\n content.style.height = content.style.overflow = ''\n }\n }\n $details.value.open = openState.value\n },\n)\n\nonMounted(function () {\n if ($details.value && $content.value) {\n detailsAnimation = new DetailsAnimation($details.value, $content.value)\n }\n\n if ($details.value) {\n $details.value.addEventListener('toggle', handleToggle)\n }\n\n if ($summary.value) {\n $summary.value.addEventListener('click', handleSummaryClick, {\n capture: true,\n })\n }\n})\n\nconst Icon = toRaw(props.icon)\n\nfunction handleSummaryClick(event: MouseEvent) {\n if (props.onClickSummary) {\n const result = props.onClickSummary(event)\n if (result === false) {\n event.preventDefault()\n // Also stop DetailsAnimation's listener on the same element.\n event.stopImmediatePropagation()\n return\n }\n }\n\n openState.value = !openState.value\n if (props.onToggle) {\n props.onToggle(openState.value)\n }\n}\n\nfunction handleToggle() {\n const open = $details.value?.open ?? false\n // A summary click already updated openState and called onToggle.\n // Only report toggles that did not come from a click.\n if (open === openState.value) return\n openState.value = open\n if (props.onToggle) {\n props.onToggle(open)\n }\n}\n</script>\n"],"names":["CssClasses","slots","useSlots","props","__props","$content","ref","$details","$summary","openState","initialOpen","detailsAnimation","watch","open","content","onMounted","DetailsAnimation","handleToggle","handleSummaryClick","Icon","toRaw","event","_a"],"mappings":"saAAA,MAAMA,EAAa,CACf,QAAS,wCACT,WAAY,0EACZ,aAAc,WACd,aAAc,yCACd,kBAAmB,wBACnB,mBAAoB,+CACpB,wBAAyB,gBACzB,KAAM,0BACN,UAAW,yCACX,QAAS,8DACT,eAAgB,iDAChB,QAAS,qBACb,wWCuDA,MAAMC,EAAQC,EAAAA,SAAA,EAERC,EAAQC,EAyDRC,EAAWC,EAAAA,IAAI,IAAI,EACnBC,EAAWD,EAAAA,IAA+B,IAAI,EAC9CE,EAAWF,EAAAA,IAAwB,IAAI,EACvCG,EAAYH,EAAAA,IAAIH,EAAM,MAAQ,EAAK,EAMnCO,EAAcP,EAAM,MAAQ,GAClC,IAAIQ,EAGJC,EAAAA,MACE,IAAMT,EAAM,KACXU,GAAS,CAER,GADAJ,EAAU,MAAQI,GAAQ,GACtB,EAACN,EAAS,MAGd,IAAII,GAAAA,MAAAA,EAAkB,YACpBA,EAAiB,UAAU,OAAA,EAC3BA,EAAiB,UAAY,KACzBN,EAAS,OAAO,CAClB,MAAMS,EAAUT,EAAS,MACzBS,EAAQ,MAAM,OAASA,EAAQ,MAAM,SAAW,EAClD,CAEFP,EAAS,MAAM,KAAOE,EAAU,MAClC,CAAA,EAGFM,EAAAA,UAAU,UAAY,CAChBR,EAAS,OAASF,EAAS,QAC7BM,EAAmB,IAAIK,EAAAA,iBAAiBT,EAAS,MAAOF,EAAS,KAAK,GAGpEE,EAAS,OACXA,EAAS,MAAM,iBAAiB,SAAUU,CAAY,EAGpDT,EAAS,OACXA,EAAS,MAAM,iBAAiB,QAASU,EAAoB,CAC3D,QAAS,EAAA,CACV,CAEL,CAAC,EAED,MAAMC,EAAOC,EAAAA,MAAMjB,EAAM,IAAI,EAE7B,SAASe,EAAmBG,EAAmB,CAC7C,GAAIlB,EAAM,gBACOA,EAAM,eAAekB,CAAK,IAC1B,GAAO,CACpBA,EAAM,eAAA,EAENA,EAAM,yBAAA,EACN,MACF,CAGFZ,EAAU,MAAQ,CAACA,EAAU,MACzBN,EAAM,UACRA,EAAM,SAASM,EAAU,KAAK,CAElC,CAEA,SAASQ,GAAe,OACtB,MAAMJ,IAAOS,EAAAf,EAAS,QAAT,YAAAe,EAAgB,OAAQ,GAGjCT,IAASJ,EAAU,QACvBA,EAAU,MAAQI,EACdV,EAAM,UACRA,EAAM,SAASU,CAAI,EAEvB"}
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "@cypress-design/vue-accordion",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/cypress-io/cypress-design.git",
7
+ "directory": "components/Accordion/vue"
8
+ },
4
9
  "files": [
5
10
  "*"
6
11
  ],