bromcom-ui-next 0.1.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/LICENSE +21 -0
- package/dist/bromcom-ui/bromcom-ui.css +1 -0
- package/dist/bromcom-ui/bromcom-ui.esm.js +2 -0
- package/dist/bromcom-ui/bromcom-ui.esm.js.map +1 -0
- package/dist/bromcom-ui/global/global.js +40 -0
- package/dist/bromcom-ui/index.esm.js +2 -0
- package/dist/bromcom-ui/index.esm.js.map +1 -0
- package/dist/bromcom-ui/p-27c997d8.js +3 -0
- package/dist/bromcom-ui/p-27c997d8.js.map +1 -0
- package/dist/bromcom-ui/p-341d46a8.entry.js +2 -0
- package/dist/bromcom-ui/p-341d46a8.entry.js.map +1 -0
- package/dist/bromcom-ui/p-40643b53.js +2 -0
- package/dist/bromcom-ui/p-40643b53.js.map +1 -0
- package/dist/bromcom-ui/p-5fcf77f9.js +2 -0
- package/dist/bromcom-ui/p-5fcf77f9.js.map +1 -0
- package/dist/bromcom-ui/p-997f314c.entry.js +2 -0
- package/dist/bromcom-ui/p-997f314c.entry.js.map +1 -0
- package/dist/bromcom-ui/p-b36f4f44.js +7 -0
- package/dist/bromcom-ui/p-b36f4f44.js.map +1 -0
- package/dist/bromcom-ui/p-dcb9df00.entry.js +2 -0
- package/dist/bromcom-ui/p-dcb9df00.entry.js.map +1 -0
- package/dist/bromcom-ui/p-f0c61f8c.entry.js +2 -0
- package/dist/bromcom-ui/p-f0c61f8c.entry.js.map +1 -0
- package/dist/cjs/app-globals-e8faea0d.js +43 -0
- package/dist/cjs/app-globals-e8faea0d.js.map +1 -0
- package/dist/cjs/bcm-accordion_4.cjs.entry.js +623 -0
- package/dist/cjs/bcm-accordion_4.cjs.entry.js.map +1 -0
- package/dist/cjs/bcm-alert.cjs.entry.js +99 -0
- package/dist/cjs/bcm-alert.cjs.entry.js.map +1 -0
- package/dist/cjs/bcm-avatar.cjs.entry.js +89 -0
- package/dist/cjs/bcm-avatar.cjs.entry.js.map +1 -0
- package/dist/cjs/bcm-text.cjs.entry.js +119 -0
- package/dist/cjs/bcm-text.cjs.entry.js.map +1 -0
- package/dist/cjs/bromcom-ui.cjs.js +27 -0
- package/dist/cjs/bromcom-ui.cjs.js.map +1 -0
- package/dist/cjs/index-310db2a6.js +2584 -0
- package/dist/cjs/index-310db2a6.js.map +1 -0
- package/dist/cjs/index-638f2d15.js +1441 -0
- package/dist/cjs/index-638f2d15.js.map +1 -0
- package/dist/cjs/index-a4eea4bb.js +84 -0
- package/dist/cjs/index-a4eea4bb.js.map +1 -0
- package/dist/cjs/index.cjs.js +4 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +17 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/collection/collection-manifest.json +18 -0
- package/dist/collection/components/accordion/accordion.component.js +399 -0
- package/dist/collection/components/accordion/accordion.component.js.map +1 -0
- package/dist/collection/components/accordion/accordion.css +1 -0
- package/dist/collection/components/accordion/types.js +2 -0
- package/dist/collection/components/accordion/types.js.map +1 -0
- package/dist/collection/components/accordion-group/accordion-group.component.js +269 -0
- package/dist/collection/components/accordion-group/accordion-group.component.js.map +1 -0
- package/dist/collection/components/accordion-group/accordion-group.css +1 -0
- package/dist/collection/components/accordion-group/types.js +2 -0
- package/dist/collection/components/accordion-group/types.js.map +1 -0
- package/dist/collection/components/alert/alert.component.js +241 -0
- package/dist/collection/components/alert/alert.component.js.map +1 -0
- package/dist/collection/components/alert/alert.css +1 -0
- package/dist/collection/components/alert/types.js +2 -0
- package/dist/collection/components/alert/types.js.map +1 -0
- package/dist/collection/components/avatar/avatar.component.js +290 -0
- package/dist/collection/components/avatar/avatar.component.js.map +1 -0
- package/dist/collection/components/avatar/avatar.css +1 -0
- package/dist/collection/components/avatar/types.js +2 -0
- package/dist/collection/components/avatar/types.js.map +1 -0
- package/dist/collection/components/button/button.component.js +628 -0
- package/dist/collection/components/button/button.component.js.map +1 -0
- package/dist/collection/components/button/button.css +1 -0
- package/dist/collection/components/button/types.js +142 -0
- package/dist/collection/components/button/types.js.map +1 -0
- package/dist/collection/components/chip/chip.component.js +308 -0
- package/dist/collection/components/chip/chip.component.js.map +1 -0
- package/dist/collection/components/chip/chip.css +1 -0
- package/dist/collection/components/chip/types.js +7 -0
- package/dist/collection/components/chip/types.js.map +1 -0
- package/dist/collection/components/text/text.component.js +176 -0
- package/dist/collection/components/text/text.component.js.map +1 -0
- package/dist/collection/components/text/text.css +1 -0
- package/dist/collection/components/text/text.types.js +2 -0
- package/dist/collection/components/text/text.types.js.map +1 -0
- package/dist/collection/components/text/text.utils.js +18 -0
- package/dist/collection/components/text/text.utils.js.map +1 -0
- package/dist/collection/global/global.js +40 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/styles/theme-variables.js +355 -0
- package/dist/collection/styles/theme-variables.js.map +1 -0
- package/dist/components/bcm-accordion-group.d.ts +11 -0
- package/dist/components/bcm-accordion-group.js +113 -0
- package/dist/components/bcm-accordion-group.js.map +1 -0
- package/dist/components/bcm-accordion.d.ts +11 -0
- package/dist/components/bcm-accordion.js +152 -0
- package/dist/components/bcm-accordion.js.map +1 -0
- package/dist/components/bcm-alert.d.ts +11 -0
- package/dist/components/bcm-alert.js +120 -0
- package/dist/components/bcm-alert.js.map +1 -0
- package/dist/components/bcm-avatar.d.ts +11 -0
- package/dist/components/bcm-avatar.js +115 -0
- package/dist/components/bcm-avatar.js.map +1 -0
- package/dist/components/bcm-button.d.ts +11 -0
- package/dist/components/bcm-button.js +334 -0
- package/dist/components/bcm-button.js.map +1 -0
- package/dist/components/bcm-chip.d.ts +11 -0
- package/dist/components/bcm-chip.js +152 -0
- package/dist/components/bcm-chip.js.map +1 -0
- package/dist/components/bcm-text.d.ts +11 -0
- package/dist/components/bcm-text.js +138 -0
- package/dist/components/bcm-text.js.map +1 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/index.js +38 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/p-0adcc84f.js +1222 -0
- package/dist/components/p-0adcc84f.js.map +1 -0
- package/dist/components/p-5fcf77f9.js +2582 -0
- package/dist/components/p-5fcf77f9.js.map +1 -0
- package/dist/components/p-b36f4f44.js +82 -0
- package/dist/components/p-b36f4f44.js.map +1 -0
- package/dist/esm/app-globals-f781c325.js +41 -0
- package/dist/esm/app-globals-f781c325.js.map +1 -0
- package/dist/esm/bcm-accordion_4.entry.js +616 -0
- package/dist/esm/bcm-accordion_4.entry.js.map +1 -0
- package/dist/esm/bcm-alert.entry.js +95 -0
- package/dist/esm/bcm-alert.entry.js.map +1 -0
- package/dist/esm/bcm-avatar.entry.js +85 -0
- package/dist/esm/bcm-avatar.entry.js.map +1 -0
- package/dist/esm/bcm-text.entry.js +115 -0
- package/dist/esm/bcm-text.entry.js.map +1 -0
- package/dist/esm/bromcom-ui.js +22 -0
- package/dist/esm/bromcom-ui.js.map +1 -0
- package/dist/esm/index-ce2fac11.js +1412 -0
- package/dist/esm/index-ce2fac11.js.map +1 -0
- package/dist/esm/index-f0e9d579.js +82 -0
- package/dist/esm/index-f0e9d579.js.map +1 -0
- package/dist/esm/index-f3b17e60.js +2582 -0
- package/dist/esm/index-f3b17e60.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +13 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/accordion/accordion.component.d.ts +137 -0
- package/dist/types/components/accordion/types.d.ts +16 -0
- package/dist/types/components/accordion-group/accordion-group.component.d.ts +95 -0
- package/dist/types/components/accordion-group/types.d.ts +13 -0
- package/dist/types/components/alert/alert.component.d.ts +28 -0
- package/dist/types/components/alert/types.d.ts +3 -0
- package/dist/types/components/avatar/avatar.component.d.ts +24 -0
- package/dist/types/components/avatar/types.d.ts +3 -0
- package/dist/types/components/button/button.component.d.ts +52 -0
- package/dist/types/components/button/types.d.ts +15 -0
- package/dist/types/components/chip/chip.component.d.ts +48 -0
- package/dist/types/components/chip/types.d.ts +9 -0
- package/dist/types/components/text/text.component.d.ts +12 -0
- package/dist/types/components/text/text.types.d.ts +3 -0
- package/dist/types/components/text/text.utils.d.ts +2 -0
- package/dist/types/components.d.ts +1116 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/stencil-public-runtime.d.ts +1680 -0
- package/dist/types/styles/theme-variables.d.ts +384 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +49 -0
- package/readme.md +170 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-638f2d15.js');
|
|
6
|
+
const appGlobals = require('./app-globals-e8faea0d.js');
|
|
7
|
+
|
|
8
|
+
const defineCustomElements = async (win, options) => {
|
|
9
|
+
if (typeof window === 'undefined') return undefined;
|
|
10
|
+
await appGlobals.globalScripts();
|
|
11
|
+
return index.bootstrapLazy([["bcm-accordion_4.cjs",[[1,"bcm-accordion",{"expanded":[1540],"headerTitle":[1,"header-title"],"group":[516],"hintText":[1,"hint-text"],"hasFooterContent":[32],"toggle":[64],"expand":[64],"collapse":[64]}],[1,"bcm-accordion-group",{"multi":[4],"accordionItems":[32],"expandAll":[64],"collapseAll":[64],"getExpandedItems":[64]},[[2,"bcmAccordionChange","handleAccordionChange"]]],[1,"bcm-button",{"kind":[1],"size":[1],"status":[1],"variant":[1],"icon":[1],"iconPosition":[1,"icon-position"],"iconOnly":[4,"icon-only"],"fullWidth":[516,"full-width"],"type":[1],"loading":[4],"disabled":[4],"text":[1],"active":[4],"form":[1],"value":[1],"name":[1],"label":[1],"expanded":[1],"controls":[1]}],[1,"bcm-chip",{"size":[1],"kind":[1],"status":[1],"dismissible":[4],"disabled":[4],"color":[1]}]]],["bcm-alert.cjs",[[1,"bcm-alert",{"status":[1],"size":[1],"kind":[1],"dismissible":[4],"showStatusIcon":[4,"show-status-icon"]}]]],["bcm-avatar.cjs",[[1,"bcm-avatar",{"image":[1],"alt":[1],"shape":[1],"size":[1],"color":[1],"icon":[1],"status":[1],"blink":[4],"name":[1],"isFallback":[32]}]]],["bcm-text.cjs",[[1,"bcm-text",{"text":[1],"variant":[1],"size":[1]}]]]], options);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.setNonce = index.setNonce;
|
|
15
|
+
exports.defineCustomElements = defineCustomElements;
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=loader.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"loader.cjs.js","mappings":";;;;;;;AAGY,MAAC,oBAAoB,GAAG,OAAO,GAAG,EAAE,OAAO,KAAK;AAC5D,EAAE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,OAAO,SAAS,CAAC;AACtD,EAAE,MAAMA,wBAAa,EAAE,CAAC;AACxB,EAAE,OAAOC,mBAAa,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;AAC9D;;;;;","names":["globalScripts","bootstrapLazy"],"sources":["@lazy-external-entrypoint?app-data=conditional"],"sourcesContent":["export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\nexport const defineCustomElements = async (win, options) => {\n if (typeof window === 'undefined') return undefined;\n await globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n};\n"],"version":3}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entries": [
|
|
3
|
+
"components/accordion/accordion.component.js",
|
|
4
|
+
"components/accordion-group/accordion-group.component.js",
|
|
5
|
+
"components/alert/alert.component.js",
|
|
6
|
+
"components/avatar/avatar.component.js",
|
|
7
|
+
"components/button/button.component.js",
|
|
8
|
+
"components/chip/chip.component.js",
|
|
9
|
+
"components/text/text.component.js"
|
|
10
|
+
],
|
|
11
|
+
"compiler": {
|
|
12
|
+
"name": "@stencil/core",
|
|
13
|
+
"version": "4.25.1",
|
|
14
|
+
"typescriptVersion": "5.5.4"
|
|
15
|
+
},
|
|
16
|
+
"collections": [],
|
|
17
|
+
"bundles": []
|
|
18
|
+
}
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
/**
|
|
4
|
+
* @component BcmAccordion
|
|
5
|
+
* @description A collapsible accordion component that provides expandable/collapsible content sections with keyboard navigation
|
|
6
|
+
* and accessibility features. Offers customizable header, content, and footer areas through slots.
|
|
7
|
+
*
|
|
8
|
+
* @example Basic usage
|
|
9
|
+
* <bcm-accordion>
|
|
10
|
+
* <div slot="title">Accordion Title</div>
|
|
11
|
+
* <div>Content goes here</div>
|
|
12
|
+
* </bcm-accordion>
|
|
13
|
+
*
|
|
14
|
+
* @example With all slots and hint text
|
|
15
|
+
* <bcm-accordion hint-text="Additional information">
|
|
16
|
+
* <div slot="title">Title</div>
|
|
17
|
+
* <div slot="actions">
|
|
18
|
+
* <button>Action</button>
|
|
19
|
+
* </div>
|
|
20
|
+
* <div>Main content</div>
|
|
21
|
+
* <div slot="footer">Footer content</div>
|
|
22
|
+
* </bcm-accordion>
|
|
23
|
+
*
|
|
24
|
+
* @example Event handling
|
|
25
|
+
* // Listen to accordion state changes
|
|
26
|
+
* const accordion = document.querySelector('bcm-accordion');
|
|
27
|
+
* accordion.addEventListener('bcmAccordionChange', (event) => {
|
|
28
|
+
* const { expanded, source } = event.detail;
|
|
29
|
+
* console.log('Accordion expanded:', expanded);
|
|
30
|
+
* console.log('Changed accordion:', source);
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Programmatically control accordion
|
|
34
|
+
* await accordion.toggle(); // Toggle state
|
|
35
|
+
* await accordion.expand(); // Expand accordion
|
|
36
|
+
* await accordion.collapse(); // Collapse accordion
|
|
37
|
+
*
|
|
38
|
+
* @prop {boolean} expanded - Controls the expanded state of the accordion (default: false)
|
|
39
|
+
* @prop {boolean} group - Indicates if the accordion is part of an accordion group (default: false)
|
|
40
|
+
* @prop {string} hintText - Optional hint text to display in the footer when no footer content is provided
|
|
41
|
+
*
|
|
42
|
+
* @slot title - Primary title content for the accordion header (required)
|
|
43
|
+
* @slot actions - Additional actions to be displayed in the header (optional)
|
|
44
|
+
* @slot default - Main content area of the accordion
|
|
45
|
+
* @slot footer - Optional footer content (overrides hint-text if provided)
|
|
46
|
+
*
|
|
47
|
+
* @event {EventEmitter<AccordionChangeEventType>} bcmAccordionChange - Emitted when the accordion's expanded state changes
|
|
48
|
+
* @eventProperty {boolean} expanded - Current expanded state
|
|
49
|
+
* @eventProperty {HTMLBcmAccordionElement} source - Reference to the accordion element that changed
|
|
50
|
+
*
|
|
51
|
+
* @csspart container - The root container element
|
|
52
|
+
* @csspart header - The header section with title and actions
|
|
53
|
+
* @csspart content - The collapsible content section
|
|
54
|
+
* @csspart footer - The footer section with hint text or footer slot
|
|
55
|
+
* @csspart section - Container for header content sections
|
|
56
|
+
* @csspart icon - The expand/collapse chevron icon
|
|
57
|
+
*
|
|
58
|
+
* @css {string} --bcm-accordion-radius - Border radius of the accordion header (default: 4px)
|
|
59
|
+
* @css {string} --bcm-accordion-bg - Background color of the accordion header
|
|
60
|
+
* @css {string} --bcm-accordion-text - Text color of the accordion
|
|
61
|
+
* @css {string} --bcm-accordion-footer-bg - Background color of the footer section
|
|
62
|
+
*
|
|
63
|
+
* @methods
|
|
64
|
+
* toggle() - Toggles the accordion's expanded state
|
|
65
|
+
* expand() - Expands the accordion if collapsed
|
|
66
|
+
* collapse() - Collapses the accordion if expanded
|
|
67
|
+
*/
|
|
68
|
+
export class BcmAccordion {
|
|
69
|
+
constructor() {
|
|
70
|
+
/**
|
|
71
|
+
* Controls whether the accordion is expanded or collapsed.
|
|
72
|
+
* @prop
|
|
73
|
+
* @defaultValue false
|
|
74
|
+
*/
|
|
75
|
+
this.expanded = false;
|
|
76
|
+
/**
|
|
77
|
+
* Indicates if the accordion is part of a group.
|
|
78
|
+
* Used for group behavior coordination.
|
|
79
|
+
* @prop
|
|
80
|
+
* @defaultValue false
|
|
81
|
+
*/
|
|
82
|
+
this.group = false;
|
|
83
|
+
/**
|
|
84
|
+
* Tracks whether footer content is present.
|
|
85
|
+
* @state
|
|
86
|
+
*/
|
|
87
|
+
this.hasFooterContent = false;
|
|
88
|
+
/**
|
|
89
|
+
* Handles changes to the footer slot content.
|
|
90
|
+
* @private
|
|
91
|
+
* @param e - Slot change event
|
|
92
|
+
*/
|
|
93
|
+
this.handleFooterSlotChange = (e) => {
|
|
94
|
+
const slot = e.target;
|
|
95
|
+
const assignedNodes = slot.assignedNodes();
|
|
96
|
+
this.hasFooterContent = assignedNodes.length > 0;
|
|
97
|
+
};
|
|
98
|
+
this.accordionClass = tv({
|
|
99
|
+
slots: {
|
|
100
|
+
container: 'accordion-container flex flex-col bcm-ui-element w-full cursor-pointer',
|
|
101
|
+
header: 'accordion-header flex flex-row justify-between gap-2 p-4 w-full flex-nowrap rounded-[--bcm-accordion-radius] bg-[--bcm-accordion-bg] text-[--bcm-accordion-text] font-semibold text-size-6',
|
|
102
|
+
content: 'accordion-content overflow-hidden transition-all duration-300 ease-in-out bg-color-basic-base',
|
|
103
|
+
footer: 'accordion-footer flex flex-row w-full flex-nowrap bg-[--bcm-accordion-footer-bg] text-[--bcm-accordion-text] px-4 py-2 gap-2 text-size-4 font-normal',
|
|
104
|
+
icon: 'accordion-icon cursor-pointer transform transition-transform duration-300',
|
|
105
|
+
rightSection: 'accordion-right-section flex flex-row gap-2.5 items-center',
|
|
106
|
+
},
|
|
107
|
+
variants: {
|
|
108
|
+
hasFooterContent: {
|
|
109
|
+
false: { footer: 'hidden' },
|
|
110
|
+
true: { footer: 'flex' },
|
|
111
|
+
},
|
|
112
|
+
expanded: {
|
|
113
|
+
true: { icon: 'rotate-180' },
|
|
114
|
+
false: {
|
|
115
|
+
icon: 'rotate-0',
|
|
116
|
+
content: '',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
}, {
|
|
121
|
+
twMerge: false,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Toggles the accordion's expanded state.
|
|
126
|
+
* @method
|
|
127
|
+
* @returns Promise<void>
|
|
128
|
+
*/
|
|
129
|
+
async toggle() {
|
|
130
|
+
this.expanded = !this.expanded;
|
|
131
|
+
this.updateAccordion();
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Expands the accordion if it's not already expanded.
|
|
135
|
+
* @method
|
|
136
|
+
* @returns Promise<void>
|
|
137
|
+
*/
|
|
138
|
+
async expand() {
|
|
139
|
+
if (!this.expanded) {
|
|
140
|
+
this.expanded = true;
|
|
141
|
+
this.updateAccordion();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Collapses the accordion if it's currently expanded.
|
|
146
|
+
* @method
|
|
147
|
+
* @returns Promise<void>
|
|
148
|
+
*/
|
|
149
|
+
async collapse() {
|
|
150
|
+
if (this.expanded) {
|
|
151
|
+
this.expanded = false;
|
|
152
|
+
this.updateAccordion();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Updates the accordion's content height and emits change event.
|
|
157
|
+
* @private
|
|
158
|
+
*/
|
|
159
|
+
updateAccordion() {
|
|
160
|
+
if (this.contentEl) {
|
|
161
|
+
this.contentEl.style.maxHeight = this.expanded ? `${this.contentEl.scrollHeight}px` : '0px';
|
|
162
|
+
}
|
|
163
|
+
this.bcmAccordionChange.emit({ expanded: this.expanded, source: this.host });
|
|
164
|
+
}
|
|
165
|
+
render() {
|
|
166
|
+
const { container, header, content, footer, icon, rightSection } = this.accordionClass({
|
|
167
|
+
hasFooterContent: this.hasFooterContent || !!this.hintText,
|
|
168
|
+
expanded: this.expanded,
|
|
169
|
+
});
|
|
170
|
+
return (h("div", { key: 'baabe245a91069be586c8cd7ae7c680044721f30', class: container() }, h("header", { key: 'ea2bbd19cbda4f37546229af19ff4fe466b01c89', class: header(), role: "button", tabindex: "0", "aria-expanded": this.expanded.toString(), "aria-controls": "accordion-content", onKeyDown: e => {
|
|
171
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
172
|
+
e.preventDefault();
|
|
173
|
+
this.toggle();
|
|
174
|
+
}
|
|
175
|
+
}, onClick: () => this.toggle() }, h("slot", { key: '6c9da162b412373185a516fb7cf06a7fb6455da6', name: "title" }, this.headerTitle), h("div", { key: '8116d820b3d9f3e373ed6ba07a588fa70db138ec', class: rightSection() }, h("slot", { key: 'b0b265147afd2514f4468e2c5940c008c2dbb37b', name: "actions" }), h("bcm-icon", { key: '6ef20624568ddd875adaa27d970a264548604b23', name: "fa-regular fa-chevron-down", class: icon() }))), h("div", { key: 'bf4f4756850428828360881cf191decf50986577', class: content(), style: { maxHeight: this.expanded ? 'auto' : '0px' }, ref: el => (this.contentEl = el) }, h("div", { key: 'e048a317ff8c4cadb48a1d34b188f272e516fabb', class: "px-4 py-2" }, h("slot", { key: 'ae33481fe6fc4e739e8faf7764498f81033cd398' })), h("footer", { key: 'd5a79e93058d1382c7ac31db5216563ad526d89b', class: footer() }, h("slot", { key: '987bbb480b47d7ef973127c64a592bfda7ca51e2', name: "footer", onSlotchange: this.handleFooterSlotChange }, this.hintText)))));
|
|
176
|
+
}
|
|
177
|
+
static get is() { return "bcm-accordion"; }
|
|
178
|
+
static get encapsulation() { return "shadow"; }
|
|
179
|
+
static get originalStyleUrls() {
|
|
180
|
+
return {
|
|
181
|
+
"$": ["accordion.css"]
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
static get styleUrls() {
|
|
185
|
+
return {
|
|
186
|
+
"$": ["accordion.css"]
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
static get properties() {
|
|
190
|
+
return {
|
|
191
|
+
"expanded": {
|
|
192
|
+
"type": "boolean",
|
|
193
|
+
"mutable": true,
|
|
194
|
+
"complexType": {
|
|
195
|
+
"original": "boolean",
|
|
196
|
+
"resolved": "boolean",
|
|
197
|
+
"references": {}
|
|
198
|
+
},
|
|
199
|
+
"required": false,
|
|
200
|
+
"optional": false,
|
|
201
|
+
"docs": {
|
|
202
|
+
"tags": [{
|
|
203
|
+
"name": "prop",
|
|
204
|
+
"text": undefined
|
|
205
|
+
}, {
|
|
206
|
+
"name": "defaultValue",
|
|
207
|
+
"text": "false"
|
|
208
|
+
}],
|
|
209
|
+
"text": "Controls whether the accordion is expanded or collapsed."
|
|
210
|
+
},
|
|
211
|
+
"getter": false,
|
|
212
|
+
"setter": false,
|
|
213
|
+
"attribute": "expanded",
|
|
214
|
+
"reflect": true,
|
|
215
|
+
"defaultValue": "false"
|
|
216
|
+
},
|
|
217
|
+
"headerTitle": {
|
|
218
|
+
"type": "string",
|
|
219
|
+
"mutable": false,
|
|
220
|
+
"complexType": {
|
|
221
|
+
"original": "string",
|
|
222
|
+
"resolved": "string",
|
|
223
|
+
"references": {}
|
|
224
|
+
},
|
|
225
|
+
"required": false,
|
|
226
|
+
"optional": true,
|
|
227
|
+
"docs": {
|
|
228
|
+
"tags": [{
|
|
229
|
+
"name": "prop",
|
|
230
|
+
"text": undefined
|
|
231
|
+
}, {
|
|
232
|
+
"name": "defaultValue",
|
|
233
|
+
"text": "undefined"
|
|
234
|
+
}],
|
|
235
|
+
"text": "Optional title text to display in the header."
|
|
236
|
+
},
|
|
237
|
+
"getter": false,
|
|
238
|
+
"setter": false,
|
|
239
|
+
"attribute": "header-title",
|
|
240
|
+
"reflect": false
|
|
241
|
+
},
|
|
242
|
+
"group": {
|
|
243
|
+
"type": "boolean",
|
|
244
|
+
"mutable": false,
|
|
245
|
+
"complexType": {
|
|
246
|
+
"original": "boolean",
|
|
247
|
+
"resolved": "boolean",
|
|
248
|
+
"references": {}
|
|
249
|
+
},
|
|
250
|
+
"required": false,
|
|
251
|
+
"optional": false,
|
|
252
|
+
"docs": {
|
|
253
|
+
"tags": [{
|
|
254
|
+
"name": "prop",
|
|
255
|
+
"text": undefined
|
|
256
|
+
}, {
|
|
257
|
+
"name": "defaultValue",
|
|
258
|
+
"text": "false"
|
|
259
|
+
}],
|
|
260
|
+
"text": "Indicates if the accordion is part of a group.\nUsed for group behavior coordination."
|
|
261
|
+
},
|
|
262
|
+
"getter": false,
|
|
263
|
+
"setter": false,
|
|
264
|
+
"attribute": "group",
|
|
265
|
+
"reflect": true,
|
|
266
|
+
"defaultValue": "false"
|
|
267
|
+
},
|
|
268
|
+
"hintText": {
|
|
269
|
+
"type": "string",
|
|
270
|
+
"mutable": false,
|
|
271
|
+
"complexType": {
|
|
272
|
+
"original": "string",
|
|
273
|
+
"resolved": "string",
|
|
274
|
+
"references": {}
|
|
275
|
+
},
|
|
276
|
+
"required": false,
|
|
277
|
+
"optional": true,
|
|
278
|
+
"docs": {
|
|
279
|
+
"tags": [{
|
|
280
|
+
"name": "prop",
|
|
281
|
+
"text": undefined
|
|
282
|
+
}],
|
|
283
|
+
"text": "Optional text to display in the footer when no footer slot content is provided."
|
|
284
|
+
},
|
|
285
|
+
"getter": false,
|
|
286
|
+
"setter": false,
|
|
287
|
+
"attribute": "hint-text",
|
|
288
|
+
"reflect": false
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
static get states() {
|
|
293
|
+
return {
|
|
294
|
+
"hasFooterContent": {}
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
static get events() {
|
|
298
|
+
return [{
|
|
299
|
+
"method": "bcmAccordionChange",
|
|
300
|
+
"name": "bcmAccordionChange",
|
|
301
|
+
"bubbles": false,
|
|
302
|
+
"cancelable": true,
|
|
303
|
+
"composed": false,
|
|
304
|
+
"docs": {
|
|
305
|
+
"tags": [{
|
|
306
|
+
"name": "event",
|
|
307
|
+
"text": undefined
|
|
308
|
+
}],
|
|
309
|
+
"text": "Emitted when the accordion's expanded state changes."
|
|
310
|
+
},
|
|
311
|
+
"complexType": {
|
|
312
|
+
"original": "AccordionChangeEventType",
|
|
313
|
+
"resolved": "BaseAccordionChangeEventType & { source: HTMLBcmAccordionElement; }",
|
|
314
|
+
"references": {
|
|
315
|
+
"AccordionChangeEventType": {
|
|
316
|
+
"location": "import",
|
|
317
|
+
"path": "./types",
|
|
318
|
+
"id": "src/components/accordion/types.ts::AccordionChangeEventType"
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}];
|
|
323
|
+
}
|
|
324
|
+
static get methods() {
|
|
325
|
+
return {
|
|
326
|
+
"toggle": {
|
|
327
|
+
"complexType": {
|
|
328
|
+
"signature": "() => Promise<void>",
|
|
329
|
+
"parameters": [],
|
|
330
|
+
"references": {
|
|
331
|
+
"Promise": {
|
|
332
|
+
"location": "global",
|
|
333
|
+
"id": "global::Promise"
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
"return": "Promise<void>"
|
|
337
|
+
},
|
|
338
|
+
"docs": {
|
|
339
|
+
"text": "Toggles the accordion's expanded state.",
|
|
340
|
+
"tags": [{
|
|
341
|
+
"name": "method",
|
|
342
|
+
"text": undefined
|
|
343
|
+
}, {
|
|
344
|
+
"name": "returns",
|
|
345
|
+
"text": "Promise<void>"
|
|
346
|
+
}]
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
"expand": {
|
|
350
|
+
"complexType": {
|
|
351
|
+
"signature": "() => Promise<void>",
|
|
352
|
+
"parameters": [],
|
|
353
|
+
"references": {
|
|
354
|
+
"Promise": {
|
|
355
|
+
"location": "global",
|
|
356
|
+
"id": "global::Promise"
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
"return": "Promise<void>"
|
|
360
|
+
},
|
|
361
|
+
"docs": {
|
|
362
|
+
"text": "Expands the accordion if it's not already expanded.",
|
|
363
|
+
"tags": [{
|
|
364
|
+
"name": "method",
|
|
365
|
+
"text": undefined
|
|
366
|
+
}, {
|
|
367
|
+
"name": "returns",
|
|
368
|
+
"text": "Promise<void>"
|
|
369
|
+
}]
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
"collapse": {
|
|
373
|
+
"complexType": {
|
|
374
|
+
"signature": "() => Promise<void>",
|
|
375
|
+
"parameters": [],
|
|
376
|
+
"references": {
|
|
377
|
+
"Promise": {
|
|
378
|
+
"location": "global",
|
|
379
|
+
"id": "global::Promise"
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
"return": "Promise<void>"
|
|
383
|
+
},
|
|
384
|
+
"docs": {
|
|
385
|
+
"text": "Collapses the accordion if it's currently expanded.",
|
|
386
|
+
"tags": [{
|
|
387
|
+
"name": "method",
|
|
388
|
+
"text": undefined
|
|
389
|
+
}, {
|
|
390
|
+
"name": "returns",
|
|
391
|
+
"text": "Promise<void>"
|
|
392
|
+
}]
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
static get elementRef() { return "host"; }
|
|
398
|
+
}
|
|
399
|
+
//# sourceMappingURL=accordion.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.component.js","sourceRoot":"","sources":["../../../src/components/accordion/accordion.component.tsx"],"names":[],"mappings":"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","sourcesContent":["import { Component, ComponentInterface, EventEmitter, h, Method, Prop, Event, State, Element } from '@stencil/core';\nimport { tv } from 'tailwind-variants';\nimport { AccordionChangeEventType } from './types';\n\n/**\n * @component BcmAccordion\n * @description A collapsible accordion component that provides expandable/collapsible content sections with keyboard navigation\n * and accessibility features. Offers customizable header, content, and footer areas through slots.\n *\n * @example Basic usage\n * <bcm-accordion>\n * <div slot=\"title\">Accordion Title</div>\n * <div>Content goes here</div>\n * </bcm-accordion>\n *\n * @example With all slots and hint text\n * <bcm-accordion hint-text=\"Additional information\">\n * <div slot=\"title\">Title</div>\n * <div slot=\"actions\">\n * <button>Action</button>\n * </div>\n * <div>Main content</div>\n * <div slot=\"footer\">Footer content</div>\n * </bcm-accordion>\n *\n * @example Event handling\n * // Listen to accordion state changes\n * const accordion = document.querySelector('bcm-accordion');\n * accordion.addEventListener('bcmAccordionChange', (event) => {\n * const { expanded, source } = event.detail;\n * console.log('Accordion expanded:', expanded);\n * console.log('Changed accordion:', source);\n * });\n *\n * // Programmatically control accordion\n * await accordion.toggle(); // Toggle state\n * await accordion.expand(); // Expand accordion\n * await accordion.collapse(); // Collapse accordion\n *\n * @prop {boolean} expanded - Controls the expanded state of the accordion (default: false)\n * @prop {boolean} group - Indicates if the accordion is part of an accordion group (default: false)\n * @prop {string} hintText - Optional hint text to display in the footer when no footer content is provided\n *\n * @slot title - Primary title content for the accordion header (required)\n * @slot actions - Additional actions to be displayed in the header (optional)\n * @slot default - Main content area of the accordion\n * @slot footer - Optional footer content (overrides hint-text if provided)\n *\n * @event {EventEmitter<AccordionChangeEventType>} bcmAccordionChange - Emitted when the accordion's expanded state changes\n * @eventProperty {boolean} expanded - Current expanded state\n * @eventProperty {HTMLBcmAccordionElement} source - Reference to the accordion element that changed\n *\n * @csspart container - The root container element\n * @csspart header - The header section with title and actions\n * @csspart content - The collapsible content section\n * @csspart footer - The footer section with hint text or footer slot\n * @csspart section - Container for header content sections\n * @csspart icon - The expand/collapse chevron icon\n *\n * @css {string} --bcm-accordion-radius - Border radius of the accordion header (default: 4px)\n * @css {string} --bcm-accordion-bg - Background color of the accordion header\n * @css {string} --bcm-accordion-text - Text color of the accordion\n * @css {string} --bcm-accordion-footer-bg - Background color of the footer section\n *\n * @methods\n * toggle() - Toggles the accordion's expanded state\n * expand() - Expands the accordion if collapsed\n * collapse() - Collapses the accordion if expanded\n */\n@Component({\n tag: 'bcm-accordion',\n styleUrl: 'accordion.css',\n shadow: true,\n})\nexport class BcmAccordion implements ComponentInterface {\n /** Reference to the host element */\n @Element() host: HTMLElement;\n\n /**\n * Controls whether the accordion is expanded or collapsed.\n * @prop\n * @defaultValue false\n */\n @Prop({ reflect: true, mutable: true })\n expanded: boolean = false;\n\n /**\n * Optional title text to display in the header.\n * @prop\n * @defaultValue undefined\n */\n @Prop()\n headerTitle?: string;\n\n /**\n * Indicates if the accordion is part of a group.\n * Used for group behavior coordination.\n * @prop\n * @defaultValue false\n */\n\n @Prop({ reflect: true })\n group: boolean = false;\n\n /**\n * Optional text to display in the footer when no footer slot content is provided.\n * @prop\n */\n @Prop({ attribute: 'hint-text' })\n hintText?: string;\n\n /**\n * Tracks whether footer content is present.\n * @state\n */\n @State()\n hasFooterContent: boolean = false;\n\n /**\n * Emitted when the accordion's expanded state changes.\n * @event\n */\n @Event({\n composed: false,\n bubbles: false,\n cancelable: true,\n eventName: 'bcmAccordionChange',\n })\n bcmAccordionChange: EventEmitter<AccordionChangeEventType>;\n\n private contentEl?: HTMLElement;\n\n /**\n * Toggles the accordion's expanded state.\n * @method\n * @returns Promise<void>\n */\n @Method()\n async toggle(): Promise<void> {\n this.expanded = !this.expanded;\n this.updateAccordion();\n }\n\n /**\n * Expands the accordion if it's not already expanded.\n * @method\n * @returns Promise<void>\n */\n @Method()\n async expand(): Promise<void> {\n if (!this.expanded) {\n this.expanded = true;\n this.updateAccordion();\n }\n }\n\n /**\n * Collapses the accordion if it's currently expanded.\n * @method\n * @returns Promise<void>\n */\n @Method()\n async collapse(): Promise<void> {\n if (this.expanded) {\n this.expanded = false;\n this.updateAccordion();\n }\n }\n\n /**\n * Updates the accordion's content height and emits change event.\n * @private\n */\n private updateAccordion(): void {\n if (this.contentEl) {\n this.contentEl.style.maxHeight = this.expanded ? `${this.contentEl.scrollHeight}px` : '0px';\n }\n this.bcmAccordionChange.emit({ expanded: this.expanded, source: this.host as HTMLBcmAccordionElement });\n }\n\n /**\n * Handles changes to the footer slot content.\n * @private\n * @param e - Slot change event\n */\n private handleFooterSlotChange = (e: Event) => {\n const slot = e.target as HTMLSlotElement;\n const assignedNodes = slot.assignedNodes();\n this.hasFooterContent = assignedNodes.length > 0;\n };\n\n private accordionClass = tv(\n {\n slots: {\n container: 'accordion-container flex flex-col bcm-ui-element w-full cursor-pointer',\n header:\n 'accordion-header flex flex-row justify-between gap-2 p-4 w-full flex-nowrap rounded-[--bcm-accordion-radius] bg-[--bcm-accordion-bg] text-[--bcm-accordion-text] font-semibold text-size-6',\n content: 'accordion-content overflow-hidden transition-all duration-300 ease-in-out bg-color-basic-base',\n footer: 'accordion-footer flex flex-row w-full flex-nowrap bg-[--bcm-accordion-footer-bg] text-[--bcm-accordion-text] px-4 py-2 gap-2 text-size-4 font-normal',\n icon: 'accordion-icon cursor-pointer transform transition-transform duration-300',\n rightSection: 'accordion-right-section flex flex-row gap-2.5 items-center',\n },\n variants: {\n hasFooterContent: {\n false: { footer: 'hidden' },\n true: { footer: 'flex' },\n },\n expanded: {\n true: { icon: 'rotate-180' },\n false: {\n icon: 'rotate-0',\n content: '',\n },\n },\n },\n },\n {\n twMerge: false,\n },\n );\n\n render() {\n const { container, header, content, footer, icon, rightSection } = this.accordionClass({\n hasFooterContent: this.hasFooterContent || !!this.hintText,\n expanded: this.expanded,\n });\n\n return (\n <div class={container()}>\n {/* Header */}\n <header\n class={header()}\n role=\"button\"\n tabindex=\"0\"\n aria-expanded={this.expanded.toString()}\n aria-controls=\"accordion-content\"\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.toggle();\n }\n }}\n onClick={() => this.toggle()}\n >\n <slot name=\"title\">{this.headerTitle}</slot>\n {/* Actions */}\n <div class={rightSection()}>\n <slot name=\"actions\"></slot>\n <bcm-icon name=\"fa-regular fa-chevron-down\" class={icon()}></bcm-icon>\n </div>\n </header>\n {/* Content */}\n <div class={content()} style={{ maxHeight: this.expanded ? 'auto' : '0px' }} ref={el => (this.contentEl = el as HTMLElement)}>\n <div class=\"px-4 py-2\">\n <slot></slot>\n </div>\n <footer class={footer()}>\n <slot name=\"footer\" onSlotchange={this.handleFooterSlotChange}>\n {this.hintText}\n </slot>\n </footer>\n </div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: ;border:0 solid oklch(.928 .006 264.531);box-sizing:border-box}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:oklch(.707 .022 261.325);opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.block{display:block}.flex{display:flex}.border{border-width:1px}:host{--bcm-accordion-bg:var(--bcm-ui-color-background-basic-panel);--bcm-accordion-content-bg:var(--bcm-ui-color-background-basic-base);--bcm-accordion-text:var(--bcm-ui-color-text-header);--bcm-accordion-border:var(--bcm-ui-color-border-default);--bcm-accordion-radius:6px;--bcm-accordion-footer-bg:var(--bcm-ui-color-background-default-default);display:block;width:100%}:host(:not([group])) .accordion-container{border:1px solid var(--bcm-accordion-border);border-radius:var(--bcm-accordion-radius)}:host([group]) .accordion-container{border-bottom:1px solid var(--bcm-accordion-border);border-radius:0}:host([group]:last-of-type) .accordion-container{border-bottom:none}:host([group]:first-of-type) .accordion-container{border-top-left-radius:var(--bcm-accordion-radius);border-top-right-radius:var(--bcm-accordion-radius)}:host([group]:last-of-type) .accordion-footer{border-bottom-left-radius:var(--bcm-accordion-radius);border-bottom-right-radius:var(--bcm-accordion-radius)}:host(:not([group])) .accordion-footer{border-bottom-left-radius:var(--bcm-accordion-radius);border-bottom-right-radius:var(--bcm-accordion-radius)}::slotted([slot=title]){align-items:center;display:flex;flex-direction:row;gap:10px}::slotted([slot=actions]){align-items:center;display:flex;flex-direction:row;gap:12px}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.bcm-ui-element{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.collapse{visibility:collapse}.static{position:static}.hidden{display:none}.w-full{width:100%}.rotate-0{--tw-rotate:0deg}.rotate-0,.rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate:180deg}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-nowrap{flex-wrap:nowrap}.items-center{align-items:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.overflow-hidden{overflow:hidden}.rounded-\[--bcm-accordion-radius\]{border-radius:var(--bcm-accordion-radius)}.bg-\[--bcm-accordion-bg\]{background-color:var(--bcm-accordion-bg)}.bg-\[--bcm-accordion-footer-bg\]{background-color:var(--bcm-accordion-footer-bg)}.p-4{padding:1rem}.px-4{padding-left:1rem;padding-right:1rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.text-size-4{font-size:var(--bcm-ui-font-size-4,14px);line-height:var(--bcm-ui-line-height-4,20px)}.text-size-6{font-size:var(--bcm-ui-font-size-6,18px);line-height:var(--bcm-ui-line-height-6,24px)}.font-normal{font-weight:400}.font-semibold{font-weight:600}.text-\[--bcm-accordion-text\]{color:var(--bcm-accordion-text)}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/accordion/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Base type for accordion-related change events\n * @description Contains the common expanded state property\n */\nexport type BaseAccordionChangeEventType = {\n /** Current expanded state */\n expanded: boolean;\n};\n\n/**\n * Type for individual accordion change events\n * @extends BaseAccordionChangeEventType\n */\nexport type AccordionChangeEventType = BaseAccordionChangeEventType & {\n /** The accordion element that triggered the change */\n source: HTMLBcmAccordionElement;\n};\n"]}
|