@gitlab/ui 42.1.0 → 42.2.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [42.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v42.1.0...v42.2.0) (2022-06-16)
2
+
3
+
4
+ ### Features
5
+
6
+ * **GlAccordionItem:** expose visible state as v-model ([617c438](https://gitlab.com/gitlab-org/gitlab-ui/commit/617c4386955bf5218bb9199a1ad7c93e13745bef))
7
+
1
8
  # [42.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v42.0.1...v42.1.0) (2022-06-16)
2
9
 
3
10
 
@@ -15,6 +15,10 @@ var script = {
15
15
  },
16
16
  inject: ['accordionSetId', 'defaultHeaderLevel'],
17
17
  inheritAttrs: false,
18
+ model: {
19
+ prop: 'visible',
20
+ event: 'input'
21
+ },
18
22
  props: {
19
23
  /*
20
24
  Used to set the title of accordion link
@@ -82,6 +86,16 @@ var script = {
82
86
  return this.isVisible && this.titleVisible ? this.titleVisible : this.title;
83
87
  }
84
88
 
89
+ },
90
+ watch: {
91
+ isVisible: {
92
+ immediate: true,
93
+
94
+ handler(isVisible) {
95
+ this.$emit('input', isVisible);
96
+ }
97
+
98
+ }
85
99
  }
86
100
  };
87
101
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "42.1.0",
3
+ "version": "42.2.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -83,7 +83,7 @@
83
83
  "@babel/preset-env": "^7.10.2",
84
84
  "@gitlab/eslint-plugin": "12.3.0",
85
85
  "@gitlab/stylelint-config": "4.1.0",
86
- "@gitlab/svgs": "2.20.0",
86
+ "@gitlab/svgs": "2.21.0",
87
87
  "@rollup/plugin-commonjs": "^11.1.0",
88
88
  "@rollup/plugin-node-resolve": "^7.1.3",
89
89
  "@rollup/plugin-replace": "^2.3.2",
@@ -103,4 +103,19 @@ describe('GlAccordionItem', () => {
103
103
  expect(findButton().props('icon')).toBe('chevron-down');
104
104
  expect(findCollapse().props('visible')).toBe(true);
105
105
  });
106
+
107
+ it('emits the initial visible state', () => {
108
+ createComponent({ visible: true });
109
+
110
+ expect(wrapper.emitted('input')).toEqual([[true]]);
111
+ });
112
+
113
+ it('emits the visible state when toggled', async () => {
114
+ createComponent({ visible: true });
115
+
116
+ await waitForAnimationFrame();
117
+ await findButton().trigger('click');
118
+
119
+ expect(wrapper.emitted('input')).toEqual([[true], [false]]);
120
+ });
106
121
  });
@@ -15,6 +15,10 @@ export default {
15
15
  },
16
16
  inject: ['accordionSetId', 'defaultHeaderLevel'],
17
17
  inheritAttrs: false,
18
+ model: {
19
+ prop: 'visible',
20
+ event: 'input',
21
+ },
18
22
  props: {
19
23
  /*
20
24
  Used to set the title of accordion link
@@ -72,6 +76,14 @@ When set, it will ensure the accordion item is initially visible
72
76
  return this.isVisible && this.titleVisible ? this.titleVisible : this.title;
73
77
  },
74
78
  },
79
+ watch: {
80
+ isVisible: {
81
+ immediate: true,
82
+ handler(isVisible) {
83
+ this.$emit('input', isVisible);
84
+ },
85
+ },
86
+ },
75
87
  };
76
88
  </script>
77
89