@descope-ui/descope-collapsible-container 0.0.1

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 ADDED
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
+
5
+ ## 0.0.1 (2025-04-16)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `e2e-utils` updated to version `0.0.1`
10
+ * `test-drivers` updated to version `0.0.1`
11
+ * `@descope-ui/common` updated to version `0.0.10`
12
+ * `@descope-ui/theme-globals` updated to version `0.0.10`
13
+ * `@descope-ui/descope-text` updated to version `0.0.10`
14
+ * `@descope-ui/descope-icon` updated to version `0.0.5`
@@ -0,0 +1,114 @@
1
+ import { test, expect } from '@playwright/test';
2
+ import { getStoryUrl, loopConfig, loopPresets } from 'e2e-utils';
3
+
4
+ const componentAttributes = {
5
+ 'st-background-color': ['red'],
6
+ isBackgroundImage: ['true', 'false'],
7
+ 'icon-position': ['left', 'right'],
8
+ 'fill-title': ['true', 'false'],
9
+ border: ['true', 'false'],
10
+ text: ['short text', 'long long long long long long long long long long long long long long text'],
11
+ defaultState: ['collapsed', 'expanded'],
12
+ shadow: ['', 'sm', 'md', 'lg', 'xl', '2xl'],
13
+ 'border-radius': ['', 'sm', 'md', 'lg', 'xl', '2xl', '3xl'],
14
+ 'st-host-width': ['100px'],
15
+ 'text-variant': ['h1', 'h2', 'h3', 'subtitle1', 'subtitle2', 'body1', 'body2'],
16
+ 'text-mode': ['none', 'primary', 'secondary', 'success', 'error'],
17
+ 'vertical-padding': ['sm', 'md', 'lg'],
18
+ 'horizontal-padding': ['sm', 'md', 'lg'],
19
+ };
20
+
21
+ const presets = {
22
+ 'direction rtl': {
23
+ 'text-direction': 'rtl',
24
+ text: 'test-',
25
+ },
26
+ 'expanded with custom width': {
27
+ 'st-host-width': '100px',
28
+ defaultState: 'expanded',
29
+ 'st-background-color': 'red',
30
+ },
31
+ 'expanded with border': {
32
+ defaultState: 'expanded',
33
+ border: 'true',
34
+ },
35
+ 'not collapsed when not collapsible': {
36
+ defaultState: 'collapsed',
37
+ isCollapsible: 'false',
38
+ },
39
+ 'text align right': {
40
+ 'text-align': 'right',
41
+ text: 'long long long long long long long long long long long long text',
42
+ 'st-host-width': '100px',
43
+ },
44
+ 'text align center': {
45
+ 'text-align': 'center',
46
+ text: 'long long long long long long long long long long long long text',
47
+ 'st-host-width': '100px',
48
+ },
49
+ 'text align left': {
50
+ 'text-align': 'left',
51
+ text: 'long long long long long long long long long long long long text',
52
+ 'st-host-width': '100px',
53
+ },
54
+ 'expanded with shadow': {
55
+ defaultState: 'expanded',
56
+ shadow: 'sm',
57
+ },
58
+ 'expanded with radius': {
59
+ defaultState: 'expanded',
60
+ 'border-radius': 'lg',
61
+ border: 'true',
62
+ },
63
+ 'expanded with vertical padding': {
64
+ defaultState: 'expanded',
65
+ 'vertical-padding': 'sm',
66
+ border: 'true',
67
+ },
68
+ 'expanded with horizontal padding': {
69
+ defaultState: 'expanded',
70
+ 'horizontal-padding': 'sm',
71
+ border: 'true',
72
+ },
73
+ 'expanded with text direction': {
74
+ defaultState: 'expanded',
75
+ 'text-direction': 'rtl',
76
+ text: 'test-'
77
+ },
78
+ 'expanded with gap': {
79
+ defaultState: 'expanded',
80
+ gap: '20px',
81
+ },
82
+ };
83
+
84
+ const storyName = 'descope-collapsible-container';
85
+ const componentName = 'descope-collapsible-container';
86
+
87
+ test.describe('theme', () => {
88
+ loopConfig(componentAttributes, (attr, value) => {
89
+ test.describe(`${attr}: ${value}`, () => {
90
+ test.beforeEach(async ({ page }) => {
91
+ await page.goto(getStoryUrl(storyName, {
92
+ 'st-background-color': 'lightblue',
93
+ [attr]: value
94
+ }), { waitUntil: 'load' });
95
+ });
96
+ test('style', async ({ page }) => {
97
+ await page.waitForSelector(componentName);
98
+ const componentParent = page.locator('body');
99
+ expect(await componentParent.screenshot({ animations: 'disabled' })).toMatchSnapshot();
100
+ });
101
+ });
102
+ });
103
+
104
+ loopPresets(presets, (preset, name) => {
105
+ test(name, async ({ page }) => {
106
+ await page.goto(getStoryUrl(storyName, preset), { waitUntil: 'load' });
107
+ await page.waitForSelector(componentName);
108
+ const componentParent = page.locator('body');
109
+ expect(
110
+ await componentParent.screenshot({ animations: 'disabled' })
111
+ ).toMatchSnapshot();
112
+ });
113
+ });
114
+ });
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@descope-ui/descope-collapsible-container",
3
+ "version": "0.0.1",
4
+ "exports": {
5
+ ".": {
6
+ "import": "./src/component/index.js"
7
+ },
8
+ "./theme": {
9
+ "import": "./src/theme.js"
10
+ },
11
+ "./class": {
12
+ "import": "./src/component/CollapsibleContainerClass.js"
13
+ }
14
+ },
15
+ "devDependencies": {
16
+ "@playwright/test": "1.38.1",
17
+ "e2e-utils": "0.0.1",
18
+ "test-drivers": "0.0.1"
19
+ },
20
+ "dependencies": {
21
+ "@descope-ui/common": "0.0.10",
22
+ "@descope-ui/theme-globals": "0.0.10",
23
+ "@descope-ui/descope-text": "0.0.10",
24
+ "@descope-ui/descope-icon": "0.0.5"
25
+ },
26
+ "publishConfig": {
27
+ "link-workspace-packages": false
28
+ },
29
+ "scripts": {
30
+ "test": "echo 'No tests defined' && exit 0",
31
+ "test:e2e": "echo 'No e2e tests defined' && exit 0"
32
+ }
33
+ }
package/project.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@descope-ui/descope-collapsible-container",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "packages/web-components/components/descope-collapsible-container/src",
5
+ "projectType": "library",
6
+ "targets": {
7
+ "version": {
8
+ "executor": "@jscutlery/semver:version",
9
+ "options": {
10
+ "trackDeps": true,
11
+ "push": false,
12
+ "preset": "conventional"
13
+ }
14
+ }
15
+ },
16
+ "tags": []
17
+ }
@@ -0,0 +1,219 @@
1
+ import { createStyleMixin, draggableMixin, componentNameValidationMixin } from '@descope-ui/common/components-mixins';
2
+ import { createBaseClass } from '@descope-ui/common/base-classes';
3
+ import { compose } from '@descope-ui/common/utils';
4
+ import {
5
+ forwardAttrs,
6
+ getComponentName,
7
+ injectStyle
8
+ } from '@descope-ui/common/components-helpers';
9
+ import chevronIcon from './chevron.svg';
10
+ import { TextClass } from '@descope-ui/descope-text/class';
11
+
12
+ export const componentName = getComponentName('collapsible-container');
13
+
14
+ class RawCollapsibleContainer extends createBaseClass({ componentName, baseSelector: 'slot' }) {
15
+ static get observedAttributes() {
16
+ return ['collapsed', 'collapsible', 'text'];
17
+ }
18
+
19
+ constructor() {
20
+ super();
21
+
22
+ this.attachShadow({ mode: 'open' }).innerHTML = `
23
+ <div class="wrapper">
24
+ <descope-text st-host-direction="ltr">
25
+ <div class="header">
26
+ <descope-icon st-align-items="center" st-fill="currentcolor" src=${chevronIcon}></descope-icon>
27
+ <span></span>
28
+ </div>
29
+ </descope-text>
30
+ <div class="content">
31
+ <slot></slot>
32
+ </div>
33
+ </div>
34
+ `;
35
+
36
+ injectStyle(
37
+ `
38
+ div.content {
39
+ transition-property: max-height;
40
+ overflow: auto;
41
+ transition-property: max-height;
42
+ height: auto;
43
+ }
44
+ slot {
45
+ box-sizing: border-box;
46
+ width: 100%;
47
+ display: flex;
48
+ }
49
+ slot:focus-visible {
50
+ outline: none;
51
+ }
52
+ :host {
53
+ display: inline-block;
54
+ }
55
+ .header {
56
+ user-select: none;
57
+ display: flex;
58
+ align-items: baseline;
59
+ }
60
+ descope-icon {
61
+ transition-property: transform;
62
+ flex-shrink: 0;
63
+ height: var(${TextClass.cssVarList.textLineHeight});
64
+ min-height: 24px;
65
+ }
66
+ .rotate {
67
+ transform: rotate(-180deg);
68
+ }
69
+ descope-text {
70
+ width: 100%;
71
+ display: flex;
72
+ }
73
+ span {
74
+ align-self: center;
75
+ word-break: break-word;
76
+ }
77
+ span:empty {
78
+ display: none;
79
+ }
80
+ .wrapper {
81
+ overflow: hidden;
82
+ display: inline-flex;
83
+ width: 100%;
84
+ flex-direction: column;
85
+ }
86
+ `,
87
+ this
88
+ );
89
+
90
+ this.header = this.shadowRoot.querySelector('.header');
91
+ this.content = this.shadowRoot.querySelector('div.content');
92
+ this.icon = this.header.querySelector('descope-icon')
93
+ this.headerText = this.header.querySelector('span');
94
+ this.textComponent = this.shadowRoot.querySelector('descope-text');
95
+ }
96
+
97
+ get isCollapsible() {
98
+ return this.getAttribute('collapsible') === 'true'
99
+ }
100
+
101
+ calcContentHeight() {
102
+ return this.content.offsetHeight || this.content.scrollHeight;
103
+ }
104
+
105
+ get isCollapsed() {
106
+ return this.getAttribute('collapsed') === 'true';
107
+ }
108
+
109
+ toggle() {
110
+ this.setAttribute('collapsed', this.isCollapsed ? 'false' : 'true');
111
+ }
112
+
113
+ collapse(animated = false) {
114
+ const final = () => {
115
+ this.content.style.maxHeight = '0px'
116
+ }
117
+ this.icon.classList.add('rotate');
118
+ if (!animated) return final();
119
+
120
+ this.content.style.maxHeight = this.calcContentHeight() + 'px';
121
+ setTimeout(final);
122
+ }
123
+
124
+ expand(animated = false) {
125
+ const final = () => {
126
+ this.content.style.maxHeight = '';
127
+ }
128
+ this.icon.classList.remove('rotate');
129
+ if (!animated) return final();
130
+
131
+ this.content.addEventListener('transitionend', final, { once: true });
132
+ this.content.style.maxHeight = this.calcContentHeight() + 'px';
133
+ }
134
+
135
+ #isComponentMounted = false;
136
+
137
+ init() {
138
+ super.init?.();
139
+ // we want to animate the collapse/expand only after the first time the component is connected
140
+ // so when setting a default value for the collapsed attribute, it will not animate
141
+ this.#isComponentMounted = true;
142
+
143
+ this.header.addEventListener('click', () => {
144
+ if (!this.isCollapsible) return;
145
+ this.toggle()
146
+ });
147
+ forwardAttrs(this, this.textComponent, {
148
+ includeAttrs: ['text-align', 'text-variant', 'text-mode'],
149
+ mapAttrs: { 'text-mode': 'mode', 'text-variant': 'variant' }
150
+ });
151
+ }
152
+
153
+ updateHeaderText() {
154
+ const text = this.getAttribute('text') || '';
155
+ this.headerText.innerText = text;
156
+ }
157
+
158
+ attributeChangedCallback(name, oldValue, newValue) {
159
+ if (name === 'text') {
160
+ this.updateHeaderText();
161
+ return
162
+ }
163
+ const collapsed = this.isCollapsed && this.isCollapsible;
164
+ if (collapsed) {
165
+ this.collapse(this.#isComponentMounted);
166
+ } else {
167
+ this.expand(this.#isComponentMounted);
168
+ }
169
+ }
170
+ }
171
+
172
+ const selectors = {
173
+ host: () => ':host',
174
+ icon: () => 'descope-icon',
175
+ header: () => '.header',
176
+ text: () => 'span',
177
+ wrapper: () => '.wrapper',
178
+ content: () => 'div.content',
179
+ }
180
+
181
+ export const CollapsibleContainerClass = compose(
182
+ createStyleMixin({
183
+ mappings: {
184
+ hostWidth: { selector: selectors.host, property: 'width' },
185
+ hostDirection: { selector: selectors.host, property: 'direction' },
186
+ verticalPadding: [{ selector: selectors.wrapper, property: 'padding-top' }, { selector: selectors.wrapper, property: 'padding-bottom' }],
187
+ horizontalPadding: [{ selector: selectors.wrapper, property: 'padding-left' }, { selector: selectors.wrapper, property: 'padding-right' }],
188
+
189
+ flexDirection: {},
190
+ justifyContent: {},
191
+ alignItems: {},
192
+ gap: [{}, { property: 'margin-top' }],
193
+
194
+ backgroundColor: { selector: selectors.wrapper },
195
+ backgroundImage: { selector: selectors.wrapper },
196
+ backgroundPositionX: { selector: selectors.wrapper },
197
+ backgroundPositionY: { selector: selectors.wrapper },
198
+ backgroundSize: { selector: selectors.wrapper },
199
+ backgroundRepeat: { selector: selectors.wrapper },
200
+
201
+ borderRadius: { selector: selectors.wrapper },
202
+ borderColor: { selector: selectors.wrapper },
203
+ borderStyle: { selector: selectors.wrapper },
204
+ borderWidth: { selector: selectors.wrapper },
205
+
206
+ boxShadow: { selector: selectors.wrapper },
207
+
208
+ headerIconOrder: { selector: selectors.icon, property: 'order' },
209
+ headerJustifyContent: { selector: selectors.header, property: 'justify-content' },
210
+ headerCursor: { selector: selectors.header, property: 'cursor' },
211
+ headerGap: { selector: selectors.header, property: 'gap' },
212
+ textDirection: { selector: selectors.text, property: 'direction' },
213
+ iconAnimationDuration: { selector: selectors.icon, property: 'transition-duration' },
214
+ contentAnimationDuration: { selector: selectors.content, property: 'transition-duration' },
215
+ },
216
+ }),
217
+ draggableMixin,
218
+ componentNameValidationMixin
219
+ )(RawCollapsibleContainer);
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="black" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M17.2193 9.27283C17.6584 8.87912 18.3334 8.91587 18.7272 9.35492C19.1209 9.79397 19.0841 10.4691 18.6451 10.8628C18.6451 10.8628 13.0457 16.0022 12.64 16.366C12.2343 16.7298 11.7608 16.7298 11.3552 16.366L5.35492 10.8628C4.91587 10.4691 4.87912 9.79397 5.27283 9.35492C5.66655 8.91587 6.34164 8.87912 6.78069 9.27283L12 14.1368L17.2193 9.27283Z"/>
3
+ </svg>
@@ -0,0 +1,7 @@
1
+ import '@descope-ui/descope-text'
2
+ import '@descope-ui/descope-icon'
3
+ import { componentName, CollapsibleContainerClass } from './CollapsibleContainerClass';
4
+
5
+ customElements.define(componentName, CollapsibleContainerClass);
6
+
7
+ export { CollapsibleContainerClass, componentName };
package/src/theme.js ADDED
@@ -0,0 +1,118 @@
1
+ import { CollapsibleContainerClass, componentName } from './component/CollapsibleContainerClass';
2
+ import globals from '@descope-ui/theme-globals';
3
+ import { getThemeRefs, createHelperVars } from '@descope-ui/common/theme-helpers';
4
+
5
+
6
+ const globalRefs = getThemeRefs(globals);
7
+
8
+ const compVars = CollapsibleContainerClass.cssVarList;
9
+
10
+ const [helperTheme, helperRefs, helperVars] = createHelperVars(
11
+ {
12
+ shadowColor: '#00000020', // if we want to support transparency vars, we should use different color format
13
+ },
14
+ componentName
15
+ );
16
+
17
+ const { shadowColor } = helperRefs;
18
+
19
+ const collapsibleContainer = {
20
+ ...helperTheme,
21
+
22
+ [compVars.itemsGrow]: '0',
23
+ [compVars.hostWidth]: '100%',
24
+ [compVars.boxShadow]: 'none',
25
+
26
+ [compVars.backgroundColor]: globalRefs.colors.surface.main,
27
+
28
+ [compVars.backgroundImage]: '', // we need to set a value to avoid inner containers from inheriting the parent's background image
29
+ [compVars.backgroundPositionX]: 'center',
30
+ [compVars.backgroundPositionY]: 'center',
31
+ [compVars.backgroundSize]: 'cover',
32
+ [compVars.backgroundRepeat]: 'no-repeat',
33
+
34
+ [compVars.color]: globalRefs.colors.surface.contrast,
35
+ [compVars.borderRadius]: '0px',
36
+ [compVars.hostDirection]: globalRefs.direction,
37
+
38
+ [compVars.flexDirection]: 'column',
39
+ [compVars.alignItems]: 'flex-start',
40
+ [compVars.justifyContent]: 'flex-start',
41
+
42
+ [compVars.headerGap]: globalRefs.spacing.md,
43
+
44
+ [compVars.iconAnimationDuration]: '0.1s',
45
+ [compVars.contentAnimationDuration]: '0.1s',
46
+
47
+ verticalPadding: {
48
+ sm: { [compVars.verticalPadding]: '5px' },
49
+ md: { [compVars.verticalPadding]: '10px' },
50
+ lg: { [compVars.verticalPadding]: '20px' },
51
+ },
52
+
53
+ horizontalPadding: {
54
+ sm: { [compVars.horizontalPadding]: '5px' },
55
+ md: { [compVars.horizontalPadding]: '10px' },
56
+ lg: { [compVars.horizontalPadding]: '20px' },
57
+ },
58
+
59
+ spaceBetween: {
60
+ sm: { [compVars.gap]: '10px' },
61
+ md: { [compVars.gap]: '20px' },
62
+ lg: { [compVars.gap]: '30px' },
63
+ },
64
+
65
+ shadow: {
66
+ sm: {
67
+ [compVars.boxShadow]: `${globalRefs.shadow.wide.sm} ${shadowColor}, ${globalRefs.shadow.narrow.sm} ${shadowColor}`,
68
+ },
69
+ md: {
70
+ [compVars.boxShadow]: `${globalRefs.shadow.wide.md} ${shadowColor}, ${globalRefs.shadow.narrow.md} ${shadowColor}`,
71
+ },
72
+ lg: {
73
+ [compVars.boxShadow]: `${globalRefs.shadow.wide.lg} ${shadowColor}, ${globalRefs.shadow.narrow.lg} ${shadowColor}`,
74
+ },
75
+ xl: {
76
+ [compVars.boxShadow]: `${globalRefs.shadow.wide.xl} ${shadowColor}, ${globalRefs.shadow.narrow.xl} ${shadowColor}`,
77
+ },
78
+ '2xl': {
79
+ [helperVars.shadowColor]: '#00000050', // mimic daisyUI shadow settings
80
+ [compVars.boxShadow]: `${globalRefs.shadow.wide['2xl']} ${shadowColor}`,
81
+ },
82
+ },
83
+
84
+ borderRadius: {
85
+ sm: { [compVars.borderRadius]: globalRefs.radius.sm },
86
+ md: { [compVars.borderRadius]: globalRefs.radius.md },
87
+ lg: { [compVars.borderRadius]: globalRefs.radius.lg },
88
+ xl: { [compVars.borderRadius]: globalRefs.radius.xl },
89
+ '2xl': { [compVars.borderRadius]: globalRefs.radius['2xl'] },
90
+ '3xl': { [compVars.borderRadius]: globalRefs.radius['3xl'] },
91
+ },
92
+
93
+ iconPosition: {
94
+ 'left': { [compVars.headerIconOrder]: '0' },
95
+ 'right': { [compVars.headerIconOrder]: '1' },
96
+ },
97
+
98
+ _fillTitle: {
99
+ [compVars.headerJustifyContent]: 'space-between',
100
+ },
101
+
102
+ _border: {
103
+ [compVars.borderColor]: globalRefs.colors.surface.light,
104
+ [compVars.borderWidth]: globalRefs.border.xs,
105
+ [compVars.borderStyle]: 'solid',
106
+ },
107
+
108
+ _collapsible: {
109
+ [compVars.headerCursor]: 'pointer',
110
+ }
111
+ };
112
+
113
+ export default collapsibleContainer;
114
+
115
+ export const vars = {
116
+ ...compVars,
117
+ ...helperVars,
118
+ };
@@ -0,0 +1,130 @@
1
+ import {
2
+ borderRadiusControl,
3
+ boxShadowControl,
4
+ customWidthControl,
5
+ modeControl,
6
+ textAlignControl,
7
+ typographyVariantControl
8
+ } from '@descope-ui/common/sb-controls';
9
+ import { componentName } from '../src/component';
10
+ import bgImageUrl from './game.png';
11
+
12
+ const Template = ({
13
+ 'vertical-alignment': verticalAlignment,
14
+ 'horizontal-alignment': horizontalAlignment,
15
+ 'vertical-padding': verticalPadding,
16
+ 'horizontal-padding': horizontalPadding,
17
+ 'flex-direction': flexDirection,
18
+ direction,
19
+ 'space-between': spaceBetween,
20
+ shadow,
21
+ 'border-radius': borderRadius,
22
+ 'st-host-width': customWidth,
23
+ 'st-background-color': backgroundColor,
24
+ 'st-items-grow': itemsGrow,
25
+ isBackgroundImage,
26
+ 'icon-position': iconPosition,
27
+ 'fill-title': fillTitle,
28
+ border,
29
+ text,
30
+ defaultState,
31
+ isCollapsible,
32
+ gap,
33
+ 'text-align': textAlign,
34
+ 'text-direction': textDirection,
35
+ 'text-variant': textVariant,
36
+ 'text-mode': textMode,
37
+ }) => `
38
+ <descope-collapsible-container
39
+ vertical-padding="${verticalPadding || ''}"
40
+ horizontal-padding="${horizontalPadding || ''}"
41
+ space-between="${spaceBetween || ''}"
42
+ shadow="${shadow || ''}"
43
+ border-radius="${borderRadius || ''}"
44
+ st-host-width="${customWidth || ''}"
45
+ st-background-color="${backgroundColor || ''}"
46
+ st-background-image="${isBackgroundImage ? `url(${bgImageUrl})` : ''}"
47
+ icon-position="${iconPosition || ''}"
48
+ fill-title="${fillTitle || ''}"
49
+ border="${border || ''}"
50
+ ${defaultState === 'collapsed' ? 'collapsed="true"' : ''}
51
+ ${isCollapsible ? 'collapsible="true"' : ''}
52
+ text="${text || ''}"
53
+ st-gap="${gap || ''}"
54
+ text-align="${textAlign || ''}"
55
+ st-text-direction="${textDirection || ''}"
56
+ text-variant="${textVariant || ''}"
57
+ text-mode="${textMode || ''}"
58
+ >
59
+ <descope-button variant="contained" size="md" mode="primary">Button</descope-button>
60
+ <descope-button variant="contained" size="md" mode="secondary">Button</descope-button>
61
+ <descope-button variant="contained" size="md" mode="secondary">Button</descope-button>
62
+ <descope-button variant="contained" size="md" mode="secondary">Button</descope-button>
63
+ <descope-button variant="contained" size="md" mode="secondary">Button</descope-button>
64
+ <descope-button variant="contained" size="md" mode="secondary">Button</descope-button>
65
+ <descope-button variant="contained" size="md" mode="secondary">Button</descope-button>
66
+ </descope-collapsible-container>
67
+ `;
68
+
69
+ export default {
70
+ component: componentName,
71
+ title: 'descope-collapsible-container',
72
+ argTypes: {
73
+ ...boxShadowControl,
74
+ ...borderRadiusControl,
75
+ ...customWidthControl,
76
+ ...textAlignControl,
77
+ 'text-variant': {
78
+ name: 'Text Variant',
79
+ options: typographyVariantControl.variant.options,
80
+ control: { type: 'select' },
81
+ },
82
+ 'text-mode': {
83
+ name: 'Text Mode',
84
+ options: modeControl.mode.options,
85
+ control: { type: 'select' },
86
+ },
87
+ 'vertical-padding': {
88
+ name: 'Vertical Padding',
89
+ options: ['sm', 'md', 'lg'],
90
+ control: { type: 'select' },
91
+ },
92
+ 'horizontal-padding': {
93
+ name: 'Horizontal Padding',
94
+ options: ['sm', 'md', 'lg'],
95
+ control: { type: 'select' },
96
+ },
97
+ 'icon-position': {
98
+ name: 'Icon Position',
99
+ options: ['left', 'right'],
100
+ control: { type: 'select' },
101
+ },
102
+ defaultState: {
103
+ name: 'Default State',
104
+ options: ['collapsed', 'expanded'],
105
+ control: { type: 'select' },
106
+ },
107
+ 'text-direction': {
108
+ name: 'Text Direction',
109
+ options: ['ltr', 'rtl'],
110
+ control: { type: 'select' },
111
+ },
112
+ },
113
+ };
114
+
115
+ export const Default = Template.bind({});
116
+
117
+ Default.args = {
118
+ 'st-background-color': '',
119
+ isBackgroundImage: false,
120
+ 'icon-position': 'left',
121
+ 'fill-title': false,
122
+ border: false,
123
+ text: 'Text',
124
+ defaultState: 'collapsed',
125
+ isCollapsible: true,
126
+ gap: '0px',
127
+ 'text-align': ''
128
+ };
129
+
130
+
Binary file
@@ -0,0 +1,11 @@
1
+ import { Locator } from '@playwright/test';
2
+ import { createComponentTestDriver } from 'test-drivers';
3
+
4
+ const createCollapsibleContainerTestDriver = (locator: Locator) => {
5
+
6
+ return {
7
+ ...createComponentTestDriver(locator),
8
+ };
9
+ };
10
+
11
+ export default createCollapsibleContainerTestDriver;