@redvars/peacock 3.2.6 → 3.2.8
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/dist/PeacockComponent-DMrFEGDh.js +80 -0
- package/dist/PeacockComponent-DMrFEGDh.js.map +1 -0
- package/dist/assets/components.css +2 -0
- package/dist/assets/components.css.map +1 -0
- package/dist/assets/styles.css +2 -0
- package/dist/assets/styles.css.map +1 -0
- package/dist/breadcrumb-item-DkhwoMAH.js +6879 -0
- package/dist/breadcrumb-item-DkhwoMAH.js.map +1 -0
- package/dist/button-BtpAXuLN.js +1180 -0
- package/dist/button-BtpAXuLN.js.map +1 -0
- package/dist/button-group.js +7 -6
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +5 -0
- package/dist/button.js.map +1 -0
- package/dist/{class-map-BmCohX9p.js → class-map-CbncA34D.js} +2 -3
- package/dist/class-map-CbncA34D.js.map +1 -0
- package/dist/code-highlighter.js +9 -8
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +4 -4
- package/dist/custom-elements.json +296 -154
- package/dist/index.js +87 -35
- package/dist/index.js.map +1 -1
- package/dist/number-counter.js +7 -6
- package/dist/number-counter.js.map +1 -1
- package/dist/peacock-loader.js +1006 -535
- package/dist/peacock-loader.js.map +1 -1
- package/dist/src/CssLoader.d.ts +5 -0
- package/dist/src/PeacockComponent.d.ts +1 -0
- package/dist/src/avatar/avatar.d.ts +1 -1
- package/dist/src/button/button/button.d.ts +1 -1
- package/dist/{state-CV1fRmOT.js → state-CEVpI7Vv.js} +2 -2
- package/dist/{state-CV1fRmOT.js.map → state-CEVpI7Vv.js.map} +1 -1
- package/dist/{style-map-CdmclYgz.js → style-map-mOmZwsJT.js} +2 -3
- package/dist/style-map-mOmZwsJT.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{unsafe-html-BS8X6Gto.js → unsafe-html-Ca00SXpn.js} +2 -3
- package/dist/unsafe-html-Ca00SXpn.js.map +1 -0
- package/package.json +11 -5
- package/readme.md +2 -1
- package/scss/components.scss +3 -0
- package/scss/styles.scss +4 -0
- package/src/CssLoader.ts +66 -0
- package/src/PeacockComponent.ts +3 -0
- package/src/avatar/avatar.ts +1 -1
- package/src/button/button/button.ts +4 -2
- package/src/button/button-group/button-group.ts +2 -0
- package/src/code-highlighter/code-highlighter.ts +2 -0
- package/src/number-counter/number-counter.ts +2 -0
- package/src/peacock-loader.ts +14 -9
- package/dist/BaseButton.js +0 -209
- package/dist/BaseButton.js.map +0 -1
- package/dist/BaseInput.js +0 -27
- package/dist/BaseInput.js.map +0 -1
- package/dist/accordion-item.js +0 -191
- package/dist/accordion-item.js.map +0 -1
- package/dist/accordion.js +0 -142
- package/dist/accordion.js.map +0 -1
- package/dist/avatar.js +0 -106
- package/dist/avatar.js.map +0 -1
- package/dist/badge.js +0 -84
- package/dist/badge.js.map +0 -1
- package/dist/base-progress.js +0 -33
- package/dist/base-progress.js.map +0 -1
- package/dist/breadcrumb-item.js +0 -160
- package/dist/breadcrumb-item.js.map +0 -1
- package/dist/breadcrumb.js +0 -84
- package/dist/breadcrumb.js.map +0 -1
- package/dist/checkbox.js +0 -530
- package/dist/checkbox.js.map +0 -1
- package/dist/chip.js +0 -303
- package/dist/chip.js.map +0 -1
- package/dist/class-map-BmCohX9p.js.map +0 -1
- package/dist/clock.js +0 -83
- package/dist/clock.js.map +0 -1
- package/dist/container.js +0 -135
- package/dist/container.js.map +0 -1
- package/dist/directive-Cuw6h7YA.js +0 -9
- package/dist/directive-Cuw6h7YA.js.map +0 -1
- package/dist/divider.js +0 -126
- package/dist/divider.js.map +0 -1
- package/dist/elevation.js +0 -79
- package/dist/elevation.js.map +0 -1
- package/dist/empty-state.js +0 -171
- package/dist/empty-state.js.map +0 -1
- package/dist/field.js +0 -416
- package/dist/field.js.map +0 -1
- package/dist/focus-ring.js +0 -107
- package/dist/focus-ring.js.map +0 -1
- package/dist/icon.js +0 -183
- package/dist/icon.js.map +0 -1
- package/dist/link.js +0 -91
- package/dist/link.js.map +0 -1
- package/dist/lit-element-CA46RFZ_.js +0 -28
- package/dist/lit-element-CA46RFZ_.js.map +0 -1
- package/dist/menu-item.js +0 -232
- package/dist/menu-item.js.map +0 -1
- package/dist/menu-list.js +0 -108
- package/dist/menu-list.js.map +0 -1
- package/dist/menu.js +0 -117
- package/dist/menu.js.map +0 -1
- package/dist/property-DNVWDdPC.js +0 -45
- package/dist/property-DNVWDdPC.js.map +0 -1
- package/dist/query-QBcUV-L_.js +0 -15
- package/dist/query-QBcUV-L_.js.map +0 -1
- package/dist/ripple.js +0 -128
- package/dist/ripple.js.map +0 -1
- package/dist/skeleton.js +0 -113
- package/dist/skeleton.js.map +0 -1
- package/dist/spinner.js +0 -93
- package/dist/spinner.js.map +0 -1
- package/dist/spread-axRTFMoH.js +0 -32
- package/dist/spread-axRTFMoH.js.map +0 -1
- package/dist/style-map-CdmclYgz.js.map +0 -1
- package/dist/switch-CC-S5fbc.js +0 -2738
- package/dist/switch-CC-S5fbc.js.map +0 -1
- package/dist/tag.js +0 -323
- package/dist/tag.js.map +0 -1
- package/dist/tooltip.js +0 -1857
- package/dist/tooltip.js.map +0 -1
- package/dist/unsafe-html-BS8X6Gto.js.map +0 -1
- package/dist/utils.js +0 -277
- package/dist/utils.js.map +0 -1
- /package/{dist/assets/styles → scss}/tokens.css +0 -0
package/src/CssLoader.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const sheetCache = new Map<string, CSSStyleSheet>();
|
|
2
|
+
|
|
3
|
+
async function loadCSS(
|
|
4
|
+
url: string,
|
|
5
|
+
options: any = {}
|
|
6
|
+
): Promise<CSSStyleSheet> {
|
|
7
|
+
const {
|
|
8
|
+
priority = "high",
|
|
9
|
+
cache = "force-cache",
|
|
10
|
+
media = "all",
|
|
11
|
+
} = options;
|
|
12
|
+
|
|
13
|
+
// Return cached sheet immediately
|
|
14
|
+
if (sheetCache.has(url)) {
|
|
15
|
+
const cached = sheetCache.get(url)!;
|
|
16
|
+
if (!document.adoptedStyleSheets.includes(cached)) {
|
|
17
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, cached];
|
|
18
|
+
}
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const response = await fetch(url, {
|
|
23
|
+
cache,
|
|
24
|
+
priority,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
if (!response.ok) {
|
|
28
|
+
throw new Error(`Failed to load CSS [${response.status}]: ${url}`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const css = await response.text();
|
|
32
|
+
const sheet = new CSSStyleSheet({ media });
|
|
33
|
+
|
|
34
|
+
sheet.replaceSync(css);
|
|
35
|
+
sheetCache.set(url, sheet);
|
|
36
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
|
|
37
|
+
|
|
38
|
+
return sheet;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function loadMultipleCSS(
|
|
42
|
+
urls: string[],
|
|
43
|
+
options: any = {}
|
|
44
|
+
): Promise<CSSStyleSheet[]> {
|
|
45
|
+
return Promise.all(urls.map((url) => loadCSS(url, options)));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function unloadCSS(url: string): boolean {
|
|
49
|
+
const sheet = sheetCache.get(url);
|
|
50
|
+
if (!sheet) return false;
|
|
51
|
+
|
|
52
|
+
document.adoptedStyleSheets = document.adoptedStyleSheets.filter(
|
|
53
|
+
(s) => s !== sheet
|
|
54
|
+
);
|
|
55
|
+
sheetCache.delete(url);
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function clearAllCSS(): void {
|
|
60
|
+
document.adoptedStyleSheets = document.adoptedStyleSheets.filter(
|
|
61
|
+
(s) => ![...sheetCache.values()].includes(s)
|
|
62
|
+
);
|
|
63
|
+
sheetCache.clear();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { loadCSS, loadMultipleCSS, unloadCSS, clearAllCSS };
|
package/src/avatar/avatar.ts
CHANGED
|
@@ -17,7 +17,7 @@ import styles from './avatar.scss';
|
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* ```html
|
|
20
|
-
* <base-avatar name="Shivaji Varma" src="https://peacock.redvars.com/assets/img/avatar.webp" style='--avatar-size: 4rem'></base-avatar>
|
|
20
|
+
* <base-avatar name="Shivaji Varma" src="https://peacock.redvars.com/assets/img/avatar.xs.webp" style='--avatar-size: 4rem'></base-avatar>
|
|
21
21
|
* ```
|
|
22
22
|
*
|
|
23
23
|
* @tags display
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { html
|
|
1
|
+
import { html } from 'lit';
|
|
2
2
|
import { property, state } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import PeacockComponent from 'src/PeacockComponent.js';
|
|
4
5
|
import styles from './button.scss';
|
|
5
6
|
import colorStyles from './button-colors.scss';
|
|
6
7
|
import sizeStyles from './button-sizes.scss';
|
|
@@ -42,7 +43,7 @@ import { BaseButton } from '../BaseButton.js';
|
|
|
42
43
|
* @cssprop --neo-button-container-color: Color of the neo button container.
|
|
43
44
|
* @cssprop --neo-button-label-text-color: Text color of the neo button label.
|
|
44
45
|
*
|
|
45
|
-
* @fires {
|
|
46
|
+
* @fires {MouseEvent} click - Dispatched when the button is clicked.
|
|
46
47
|
*
|
|
47
48
|
* @example
|
|
48
49
|
* ```html
|
|
@@ -50,6 +51,7 @@ import { BaseButton } from '../BaseButton.js';
|
|
|
50
51
|
* ```
|
|
51
52
|
* @tags display
|
|
52
53
|
*/
|
|
54
|
+
@PeacockComponent
|
|
53
55
|
export class Button extends BaseButton {
|
|
54
56
|
static override styles = [styles, colorStyles, sizeStyles];
|
|
55
57
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { html, LitElement } from 'lit';
|
|
2
2
|
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import PeacockComponent from 'src/PeacockComponent.js';
|
|
4
5
|
import styles from './button-group.scss';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -20,6 +21,7 @@ import styles from './button-group.scss';
|
|
|
20
21
|
*
|
|
21
22
|
* @tags controls
|
|
22
23
|
*/
|
|
24
|
+
@PeacockComponent
|
|
23
25
|
export class ButtonGroup extends LitElement {
|
|
24
26
|
// Lit prefers CSS-in-JS for better performance and scoping.
|
|
25
27
|
// If you prefer keeping the SCSS file, you'll need a build tool (like Vite or Webpack)
|
|
@@ -12,6 +12,7 @@ import * as prettierPluginEstree from 'prettier/plugins/estree';
|
|
|
12
12
|
|
|
13
13
|
import { BundledLanguage, codeToHtml, ShikiTransformer } from 'shiki';
|
|
14
14
|
|
|
15
|
+
import PeacockComponent from 'src/PeacockComponent.js';
|
|
15
16
|
import { copyToClipboard } from '../utils/copy-to-clipboard.js';
|
|
16
17
|
import styles from './code-highlighter.scss';
|
|
17
18
|
|
|
@@ -42,6 +43,7 @@ const locale = {
|
|
|
42
43
|
* ```
|
|
43
44
|
* @tags display
|
|
44
45
|
*/
|
|
46
|
+
@PeacockComponent
|
|
45
47
|
export class CodeHighlighter extends LitElement {
|
|
46
48
|
static styles = [styles];
|
|
47
49
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { html, LitElement, nothing } from 'lit';
|
|
2
2
|
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
4
|
+
import PeacockComponent from 'src/PeacockComponent.js';
|
|
4
5
|
import styles from './number-counter.scss';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -22,6 +23,7 @@ import styles from './number-counter.scss';
|
|
|
22
23
|
* ```
|
|
23
24
|
* @tags display
|
|
24
25
|
*/
|
|
26
|
+
@PeacockComponent
|
|
25
27
|
export class NumberCounter extends LitElement {
|
|
26
28
|
static styles = [styles];
|
|
27
29
|
|
package/src/peacock-loader.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// Eager loaded
|
|
2
|
-
import cssComponentsStyleSheet from '../assets/styles/tokens.css';
|
|
3
2
|
|
|
4
3
|
import { Elevation } from './elevation/elevation.js';
|
|
5
4
|
import { FocusRing } from './focus-ring/focus-ring.js';
|
|
@@ -42,8 +41,13 @@ import { EmptyState } from './empty-state/empty-state.js';
|
|
|
42
41
|
import { Container } from './container/container.js';
|
|
43
42
|
|
|
44
43
|
import { LoaderConfig, LoaderUtils } from './LoaderUtils.js';
|
|
45
|
-
import
|
|
46
|
-
|
|
44
|
+
import { loadCSS } from './CssLoader.js';
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
const distDirectory = `${import.meta.url}/..`;
|
|
48
|
+
await loadCSS(`${distDirectory }/assets/styles.css`);
|
|
49
|
+
|
|
50
|
+
/*
|
|
47
51
|
import tooltipStyles from './popover/tooltip.css-component.scss';
|
|
48
52
|
|
|
49
53
|
function buildSheet(styleSheet: any) {
|
|
@@ -54,13 +58,14 @@ function buildSheet(styleSheet: any) {
|
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
const styleSheets = [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
// buildSheet(cssComponentsStyleSheet),
|
|
62
|
+
// buildSheet(linkStyles),
|
|
63
|
+
// buildSheet(textStylesheet),
|
|
60
64
|
buildSheet(tooltipStyles),
|
|
61
65
|
];
|
|
62
66
|
|
|
63
67
|
document.adoptedStyleSheets = styleSheets;
|
|
68
|
+
*/
|
|
64
69
|
|
|
65
70
|
const loaderConfig: LoaderConfig = {
|
|
66
71
|
components: {
|
|
@@ -93,7 +98,7 @@ const loaderConfig: LoaderConfig = {
|
|
|
93
98
|
CustomElementClass: Elevation,
|
|
94
99
|
},
|
|
95
100
|
'base-clock': {
|
|
96
|
-
importPath:
|
|
101
|
+
importPath: `${distDirectory}/clock.js`,
|
|
97
102
|
},
|
|
98
103
|
'base-ripple': {
|
|
99
104
|
CustomElementClass: Ripple,
|
|
@@ -144,10 +149,10 @@ const loaderConfig: LoaderConfig = {
|
|
|
144
149
|
CustomElementClass: Tooltip,
|
|
145
150
|
},
|
|
146
151
|
'number-counter': {
|
|
147
|
-
importPath:
|
|
152
|
+
importPath: `${distDirectory}/number-counter.js`,
|
|
148
153
|
},
|
|
149
154
|
'code-highlighter': {
|
|
150
|
-
importPath:
|
|
155
|
+
importPath: `${distDirectory}/code-highlighter.js`,
|
|
151
156
|
},
|
|
152
157
|
'base-breadcrumb': {
|
|
153
158
|
CustomElementClass: Breadcrumb,
|
package/dist/BaseButton.js
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import { _ as __decorate, n, a as __classPrivateFieldGet } from './property-DNVWDdPC.js';
|
|
2
|
-
import { a as i, A, b } from './lit-element-CA46RFZ_.js';
|
|
3
|
-
import { r } from './state-CV1fRmOT.js';
|
|
4
|
-
import { e } from './query-QBcUV-L_.js';
|
|
5
|
-
import { isActivationClick, dispatchActivationClick } from './utils.js';
|
|
6
|
-
|
|
7
|
-
var _BaseButton_id;
|
|
8
|
-
class BaseButton extends i {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
_BaseButton_id.set(this, crypto.randomUUID());
|
|
12
|
-
this.htmlType = 'button';
|
|
13
|
-
/**
|
|
14
|
-
* The visual style of the button.
|
|
15
|
-
*
|
|
16
|
-
* Possible variant values:
|
|
17
|
-
* `"filled"` is a filled button.
|
|
18
|
-
* `"outlined"` is an outlined button.
|
|
19
|
-
* `"text"` is a transparent button.
|
|
20
|
-
* `"tonal"` is a light color button.
|
|
21
|
-
* `"elevated"` is elevated button
|
|
22
|
-
*/
|
|
23
|
-
this.variant = 'filled';
|
|
24
|
-
/**
|
|
25
|
-
* Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.
|
|
26
|
-
*/
|
|
27
|
-
this.color = 'primary';
|
|
28
|
-
/**
|
|
29
|
-
* Button size.
|
|
30
|
-
* Possible values are `"sm"`, `"md"`, `"lg"`. Defaults to `"md"`.
|
|
31
|
-
*/
|
|
32
|
-
this.size = 'sm';
|
|
33
|
-
/**
|
|
34
|
-
* If true, the user cannot interact with the button. Defaults to `false`.
|
|
35
|
-
*/
|
|
36
|
-
this.disabled = false;
|
|
37
|
-
this.skeleton = false;
|
|
38
|
-
/**
|
|
39
|
-
* If true, the user cannot interact with the button and the button is visually styled as disabled. But the button is still focusable. Defaults to `false`.
|
|
40
|
-
*/
|
|
41
|
-
this.softDisabled = false;
|
|
42
|
-
/**
|
|
43
|
-
* If button is disabled, the reason why it is disabled.
|
|
44
|
-
*/
|
|
45
|
-
this.disabledReason = '';
|
|
46
|
-
/**
|
|
47
|
-
* Sets or retrieves the window or frame at which to target content.
|
|
48
|
-
*/
|
|
49
|
-
this.target = '_self';
|
|
50
|
-
this.selected = false;
|
|
51
|
-
/**
|
|
52
|
-
* Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.
|
|
53
|
-
*/
|
|
54
|
-
this.throttleDelay = 200;
|
|
55
|
-
/**
|
|
56
|
-
* States
|
|
57
|
-
*/
|
|
58
|
-
this.isPressed = false;
|
|
59
|
-
this.__handlePress = (event) => {
|
|
60
|
-
if (this.disabled || this.skeleton || this.softDisabled)
|
|
61
|
-
return;
|
|
62
|
-
if (event instanceof KeyboardEvent &&
|
|
63
|
-
event.type === 'keydown' &&
|
|
64
|
-
(event.key === 'Enter' || event.key === ' ')) {
|
|
65
|
-
this.isPressed = true;
|
|
66
|
-
}
|
|
67
|
-
else if (event.type === 'mousedown') {
|
|
68
|
-
this.isPressed = true;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
this.isPressed = false;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
this.__dispatchClickWithThrottle = event => {
|
|
75
|
-
this.__dispatchClick(event);
|
|
76
|
-
};
|
|
77
|
-
this.__dispatchClick = (event) => {
|
|
78
|
-
// If the button is soft-disabled or a disabled link, we need to explicitly
|
|
79
|
-
// prevent the click from propagating to other event listeners as well as
|
|
80
|
-
// prevent the default action.
|
|
81
|
-
if (this.softDisabled || (this.disabled && this.href) || this.skeleton) {
|
|
82
|
-
event.stopImmediatePropagation();
|
|
83
|
-
event.preventDefault();
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (!isActivationClick(event) || !this.buttonElement) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
this.focus();
|
|
90
|
-
dispatchActivationClick(this.buttonElement);
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
focus() {
|
|
94
|
-
this.buttonElement?.focus();
|
|
95
|
-
}
|
|
96
|
-
blur() {
|
|
97
|
-
this.buttonElement?.blur();
|
|
98
|
-
}
|
|
99
|
-
connectedCallback() {
|
|
100
|
-
super.connectedCallback();
|
|
101
|
-
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
102
|
-
window.addEventListener('mouseup', this.__handlePress);
|
|
103
|
-
}
|
|
104
|
-
disconnectedCallback() {
|
|
105
|
-
window.removeEventListener('mouseup', this.__handlePress);
|
|
106
|
-
this.removeEventListener('click', this.__dispatchClickWithThrottle);
|
|
107
|
-
super.disconnectedCallback();
|
|
108
|
-
}
|
|
109
|
-
__isLink() {
|
|
110
|
-
return !!this.href;
|
|
111
|
-
}
|
|
112
|
-
__convertTypeToVariantAndColor() {
|
|
113
|
-
if (this.type === 'primary') {
|
|
114
|
-
this.color = 'primary';
|
|
115
|
-
this.variant = 'filled';
|
|
116
|
-
}
|
|
117
|
-
else if (this.type === 'secondary') {
|
|
118
|
-
this.color = 'dark';
|
|
119
|
-
this.variant = 'outlined';
|
|
120
|
-
}
|
|
121
|
-
else if (this.type === 'tertiary') {
|
|
122
|
-
this.color = 'primary';
|
|
123
|
-
this.variant = 'text';
|
|
124
|
-
}
|
|
125
|
-
else if (this.type === 'danger') {
|
|
126
|
-
this.color = 'danger';
|
|
127
|
-
this.variant = 'filled';
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
__getDisabledReasonID() {
|
|
131
|
-
return this.disabled && this.disabledReason
|
|
132
|
-
? `disabled-reason-${__classPrivateFieldGet(this, _BaseButton_id, "f")}`
|
|
133
|
-
: A;
|
|
134
|
-
}
|
|
135
|
-
__renderDisabledReason() {
|
|
136
|
-
const disabledReasonID = this.__getDisabledReasonID();
|
|
137
|
-
if (disabledReasonID)
|
|
138
|
-
return b `<div
|
|
139
|
-
id="disabled-reason-${__classPrivateFieldGet(this, _BaseButton_id, "f")}"
|
|
140
|
-
role="tooltip"
|
|
141
|
-
aria-label=${this.disabledReason}
|
|
142
|
-
class="screen-reader-only"
|
|
143
|
-
>
|
|
144
|
-
{this.disabledReason}
|
|
145
|
-
</div>`;
|
|
146
|
-
return A;
|
|
147
|
-
}
|
|
148
|
-
__renderTooltip() {
|
|
149
|
-
if (this.tooltip) {
|
|
150
|
-
return b `<base-tooltip for="button">${this.tooltip}</base-tooltip>`;
|
|
151
|
-
}
|
|
152
|
-
return A;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
_BaseButton_id = new WeakMap();
|
|
156
|
-
__decorate([
|
|
157
|
-
n({ type: String })
|
|
158
|
-
], BaseButton.prototype, "htmlType", void 0);
|
|
159
|
-
__decorate([
|
|
160
|
-
n({ type: String })
|
|
161
|
-
], BaseButton.prototype, "type", void 0);
|
|
162
|
-
__decorate([
|
|
163
|
-
n()
|
|
164
|
-
], BaseButton.prototype, "variant", void 0);
|
|
165
|
-
__decorate([
|
|
166
|
-
n({ reflect: true })
|
|
167
|
-
], BaseButton.prototype, "color", void 0);
|
|
168
|
-
__decorate([
|
|
169
|
-
n()
|
|
170
|
-
], BaseButton.prototype, "size", void 0);
|
|
171
|
-
__decorate([
|
|
172
|
-
n({ type: Boolean, reflect: true })
|
|
173
|
-
], BaseButton.prototype, "disabled", void 0);
|
|
174
|
-
__decorate([
|
|
175
|
-
n()
|
|
176
|
-
], BaseButton.prototype, "skeleton", void 0);
|
|
177
|
-
__decorate([
|
|
178
|
-
n({ reflect: true, attribute: 'soft-disabled' })
|
|
179
|
-
], BaseButton.prototype, "softDisabled", void 0);
|
|
180
|
-
__decorate([
|
|
181
|
-
n({ attribute: 'disabled-reason' })
|
|
182
|
-
], BaseButton.prototype, "disabledReason", void 0);
|
|
183
|
-
__decorate([
|
|
184
|
-
n({ reflect: true })
|
|
185
|
-
], BaseButton.prototype, "href", void 0);
|
|
186
|
-
__decorate([
|
|
187
|
-
n({ reflect: true })
|
|
188
|
-
], BaseButton.prototype, "configAria", void 0);
|
|
189
|
-
__decorate([
|
|
190
|
-
n()
|
|
191
|
-
], BaseButton.prototype, "target", void 0);
|
|
192
|
-
__decorate([
|
|
193
|
-
n()
|
|
194
|
-
], BaseButton.prototype, "selected", void 0);
|
|
195
|
-
__decorate([
|
|
196
|
-
n()
|
|
197
|
-
], BaseButton.prototype, "throttleDelay", void 0);
|
|
198
|
-
__decorate([
|
|
199
|
-
n()
|
|
200
|
-
], BaseButton.prototype, "tooltip", void 0);
|
|
201
|
-
__decorate([
|
|
202
|
-
r()
|
|
203
|
-
], BaseButton.prototype, "isPressed", void 0);
|
|
204
|
-
__decorate([
|
|
205
|
-
e('.button')
|
|
206
|
-
], BaseButton.prototype, "buttonElement", void 0);
|
|
207
|
-
|
|
208
|
-
export { BaseButton };
|
|
209
|
-
//# sourceMappingURL=BaseButton.js.map
|
package/dist/BaseButton.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseButton.js","sources":["../../src/button/BaseButton.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { dispatchActivationClick, isActivationClick } from '../utils.js';\n\nexport class BaseButton extends LitElement {\n #id = crypto.randomUUID();\n\n @property({ type: String }) htmlType: 'button' | 'submit' | 'reset' =\n 'button';\n\n /**\n * Type is preset of color and variant. Type will be only applied.\n *\n */\n @property({ type: String }) type?: 'primary' | 'secondary' | 'tertiary';\n\n /**\n * The visual style of the button.\n *\n * Possible variant values:\n * `\"filled\"` is a filled button.\n * `\"outlined\"` is an outlined button.\n * `\"text\"` is a transparent button.\n * `\"tonal\"` is a light color button.\n * `\"elevated\"` is elevated button\n */\n @property() variant:\n | 'elevated'\n | 'filled'\n | 'tonal'\n | 'outlined'\n | 'text'\n | 'neo' = 'filled';\n\n /**\n * Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.\n */\n @property({ reflect: true }) color:\n | 'primary'\n | 'success'\n | 'danger'\n | 'warning'\n | 'light'\n | 'dark' = 'primary';\n\n /**\n * Button size.\n * Possible values are `\"sm\"`, `\"md\"`, `\"lg\"`. Defaults to `\"md\"`.\n */\n @property() size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';\n\n /**\n * If true, the user cannot interact with the button. Defaults to `false`.\n */\n @property({ type: Boolean, reflect: true })\n disabled: boolean = false;\n\n @property() skeleton: boolean = false;\n\n /**\n * If true, the user cannot interact with the button and the button is visually styled as disabled. But the button is still focusable. Defaults to `false`.\n */\n @property({ reflect: true, attribute: 'soft-disabled' })\n softDisabled: boolean = false;\n\n /**\n * If button is disabled, the reason why it is disabled.\n */\n @property({ attribute: 'disabled-reason' })\n disabledReason: string = '';\n\n /**\n * Hyperlink to navigate to on click.\n */\n @property({ reflect: true }) href?: string;\n\n @property({ reflect: true })\n configAria?: { [key: string]: any };\n\n /**\n * Sets or retrieves the window or frame at which to target content.\n */\n @property() target: string = '_self';\n\n @property() selected: boolean = false;\n\n /**\n * Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.\n */\n @property() throttleDelay = 200;\n\n @property() tooltip?: string;\n\n /**\n * States\n */\n @state()\n isPressed = false;\n\n @query('.button') readonly buttonElement!: HTMLElement | null;\n\n override focus() {\n this.buttonElement?.focus();\n }\n\n override blur() {\n this.buttonElement?.blur();\n }\n\n override connectedCallback() {\n super.connectedCallback();\n this.addEventListener('click', this.__dispatchClickWithThrottle);\n window.addEventListener('mouseup', this.__handlePress);\n }\n\n override disconnectedCallback() {\n window.removeEventListener('mouseup', this.__handlePress);\n this.removeEventListener('click', this.__dispatchClickWithThrottle);\n super.disconnectedCallback();\n }\n\n __handlePress = (event: KeyboardEvent | MouseEvent) => {\n if (this.disabled || this.skeleton || this.softDisabled) return;\n if (\n event instanceof KeyboardEvent &&\n event.type === 'keydown' &&\n (event.key === 'Enter' || event.key === ' ')\n ) {\n this.isPressed = true;\n } else if (event.type === 'mousedown') {\n this.isPressed = true;\n } else {\n this.isPressed = false;\n }\n };\n\n __isLink() {\n return !!this.href;\n }\n\n __dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =\n event => {\n this.__dispatchClick(event);\n };\n\n __dispatchClick = (event: MouseEvent | KeyboardEvent) => {\n // If the button is soft-disabled or a disabled link, we need to explicitly\n // prevent the click from propagating to other event listeners as well as\n // prevent the default action.\n if (this.softDisabled || (this.disabled && this.href) || this.skeleton) {\n event.stopImmediatePropagation();\n event.preventDefault();\n return;\n }\n\n if (!isActivationClick(event) || !this.buttonElement) {\n return;\n }\n\n this.focus();\n dispatchActivationClick(this.buttonElement);\n };\n\n __convertTypeToVariantAndColor() {\n if (this.type === 'primary') {\n this.color = 'primary';\n this.variant = 'filled';\n } else if (this.type === 'secondary') {\n this.color = 'dark';\n this.variant = 'outlined';\n } else if (this.type === 'tertiary') {\n this.color = 'primary';\n this.variant = 'text';\n } else if (this.type === 'danger') {\n this.color = 'danger';\n this.variant = 'filled';\n }\n }\n\n __getDisabledReasonID() {\n return this.disabled && this.disabledReason\n ? `disabled-reason-${this.#id}`\n : nothing;\n }\n\n __renderDisabledReason() {\n const disabledReasonID = this.__getDisabledReasonID();\n if (disabledReasonID)\n return html`<div\n id=\"disabled-reason-${this.#id}\"\n role=\"tooltip\"\n aria-label=${this.disabledReason}\n class=\"screen-reader-only\"\n >\n {this.disabledReason}\n </div>`;\n return nothing;\n }\n\n __renderTooltip() {\n if (this.tooltip) {\n return html`<base-tooltip for=\"button\">${this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AA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AAKC,UAAA,CAAA;AAA5B,IAAAA,CAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AAAgB,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAG3C,UAAA,CAAA;AADC,IAAAA,CAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AACS,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAKxB,UAAA,CAAA;AAAX,IAAAA,CAAQ;AAA4B,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAEzB,UAAA,CAAA;AAAX,IAAAA,CAAQ;AAA6B,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAK1B,UAAA,CAAA;AAAX,IAAAA,CAAQ;AAAuB,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAEpB,UAAA,CAAA;AAAX,IAAAA,CAAQ;AAAoB,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAM7B,UAAA,CAAA;AADC,IAAAC,CAAK;AACY,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAES,UAAA,CAAA;IAA1BC,CAAK,CAAC,SAAS;AAA8C,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;;;;"}
|
package/dist/BaseInput.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { _ as __decorate, n } from './property-DNVWDdPC.js';
|
|
2
|
-
import { a as i } from './lit-element-CA46RFZ_.js';
|
|
3
|
-
|
|
4
|
-
class BaseInput extends i {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.disabled = false;
|
|
8
|
-
this.readonly = false;
|
|
9
|
-
this.required = false;
|
|
10
|
-
this.skeleton = false;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
__decorate([
|
|
14
|
-
n({ type: Boolean, reflect: true })
|
|
15
|
-
], BaseInput.prototype, "disabled", void 0);
|
|
16
|
-
__decorate([
|
|
17
|
-
n({ type: Boolean, reflect: true })
|
|
18
|
-
], BaseInput.prototype, "readonly", void 0);
|
|
19
|
-
__decorate([
|
|
20
|
-
n({ type: Boolean, reflect: true })
|
|
21
|
-
], BaseInput.prototype, "required", void 0);
|
|
22
|
-
__decorate([
|
|
23
|
-
n({ type: Boolean, reflect: true })
|
|
24
|
-
], BaseInput.prototype, "skeleton", void 0);
|
|
25
|
-
|
|
26
|
-
export { BaseInput as default };
|
|
27
|
-
//# sourceMappingURL=BaseInput.js.map
|
package/dist/BaseInput.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInput.js","sources":["../../src/input/BaseInput.ts"],"sourcesContent":["import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nexport default abstract class BaseInput extends LitElement {\n value?: any;\n\n @property({ type: Boolean, reflect: true })\n disabled: boolean = false;\n\n @property({ type: Boolean, reflect: true })\n readonly: boolean = false;\n\n @property({ type: Boolean, reflect: true })\n required: boolean = false;\n\n @property({ type: Boolean, reflect: true })\n skeleton = false;\n}\n"],"names":["LitElement","property"],"mappings":";;;AAGc,MAAgB,SAAU,SAAQA,CAAU,CAAA;AAA1D,IAAA,WAAA,GAAA;;QAIE,IAAA,CAAA,QAAQ,GAAY,KAAK;QAGzB,IAAA,CAAA,QAAQ,GAAY,KAAK;QAGzB,IAAA,CAAA,QAAQ,GAAY,KAAK;QAGzB,IAAA,CAAA,QAAQ,GAAG,KAAK;IAClB;AAAC;AAVC,UAAA,CAAA;IADCC,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAChB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAG1B,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAChB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAG1B,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAChB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAG1B,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AACzB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;;;;"}
|
package/dist/accordion-item.js
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { _ as __decorate, n, a as __classPrivateFieldGet } from './property-DNVWDdPC.js';
|
|
2
|
-
import { i, a as i$1, b } from './lit-element-CA46RFZ_.js';
|
|
3
|
-
import { e } from './query-QBcUV-L_.js';
|
|
4
|
-
import { e as e$1 } from './class-map-BmCohX9p.js';
|
|
5
|
-
import './directive-Cuw6h7YA.js';
|
|
6
|
-
|
|
7
|
-
var css_248z = i`* {
|
|
8
|
-
box-sizing: border-box;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.screen-reader-only {
|
|
12
|
-
display: none !important;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
:host {
|
|
16
|
-
display: block;
|
|
17
|
-
--accordion-item-title-align: start;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.accordion-item .accordion-heading {
|
|
21
|
-
cursor: pointer;
|
|
22
|
-
width: 100%;
|
|
23
|
-
border-radius: 0;
|
|
24
|
-
border: 0;
|
|
25
|
-
padding: 0 var(--spacing-200);
|
|
26
|
-
background: var(--accordion-item-heading-background, transparent);
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-direction: row-reverse;
|
|
29
|
-
align-items: center;
|
|
30
|
-
justify-content: flex-start;
|
|
31
|
-
gap: 0.5rem;
|
|
32
|
-
font-family: var(--typography-title-medium-font-family) !important;
|
|
33
|
-
font-size: var(--typography-title-medium-font-size) !important;
|
|
34
|
-
font-weight: var(--typography-title-medium-font-weight) !important;
|
|
35
|
-
line-height: var(--typography-title-medium-line-height) !important;
|
|
36
|
-
letter-spacing: var(--typography-title-medium-letter-spacing) !important;
|
|
37
|
-
}
|
|
38
|
-
.accordion-item .accordion-heading .accordion-title {
|
|
39
|
-
width: 100%;
|
|
40
|
-
text-align: var(--accordion-item-title-align);
|
|
41
|
-
}
|
|
42
|
-
.accordion-item .accordion-heading:focus-visible {
|
|
43
|
-
outline: 2px solid var(--color-black);
|
|
44
|
-
}
|
|
45
|
-
.accordion-item .accordion-heading .accordion-icon {
|
|
46
|
-
--icon-size: 1.5rem;
|
|
47
|
-
--icon-color: currentColor;
|
|
48
|
-
transition: transform var(--duration-short2) var(--easing-standard);
|
|
49
|
-
}
|
|
50
|
-
.accordion-item .item-section {
|
|
51
|
-
height: 0;
|
|
52
|
-
opacity: 0;
|
|
53
|
-
pointer-events: none;
|
|
54
|
-
text-align: start;
|
|
55
|
-
transition: all var(--duration-short2) var(--easing-standard);
|
|
56
|
-
}
|
|
57
|
-
.accordion-item:not(.disabled) .accordion-heading:hover {
|
|
58
|
-
--accordion-item-heading-background: var(--color-inverse-primary);
|
|
59
|
-
}
|
|
60
|
-
.accordion-item.disabled .accordion-heading {
|
|
61
|
-
cursor: not-allowed;
|
|
62
|
-
color: var(--color-on-surface);
|
|
63
|
-
opacity: 0.38;
|
|
64
|
-
}
|
|
65
|
-
.accordion-item.open .item-section {
|
|
66
|
-
height: 100%;
|
|
67
|
-
pointer-events: auto;
|
|
68
|
-
opacity: 1;
|
|
69
|
-
padding: var(--spacing-100) var(--spacing-800) var(--spacing-300) var(--spacing-200);
|
|
70
|
-
}
|
|
71
|
-
.accordion-item.open .accordion-icon {
|
|
72
|
-
transform: rotate(180deg);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/*
|
|
76
|
-
* Sizes
|
|
77
|
-
*/
|
|
78
|
-
.accordion-item .accordion-heading {
|
|
79
|
-
height: 2.5rem;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
:host-context([size=sm]) .accordion-item .accordion-heading {
|
|
83
|
-
height: 2rem;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
:host-context([size=lg]) .accordion-item .accordion-heading {
|
|
87
|
-
height: 3rem;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
:host-context(p-accordion[align=start]) .accordion-item .accordion-heading {
|
|
91
|
-
flex-direction: row;
|
|
92
|
-
}`;
|
|
93
|
-
|
|
94
|
-
var _AccordionItem_id;
|
|
95
|
-
/**
|
|
96
|
-
* @label Accordion Item
|
|
97
|
-
* @tag accordion-item
|
|
98
|
-
* @rawTag accordion
|
|
99
|
-
* @summary An accordion item is single item in an accordion list. It contains a header and a content section that can be expanded or collapsed by the user.
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* ```html
|
|
103
|
-
* <base-accordion-item>
|
|
104
|
-
* Testing
|
|
105
|
-
* </accordion-item>
|
|
106
|
-
* ```
|
|
107
|
-
* @tags display
|
|
108
|
-
*/
|
|
109
|
-
class AccordionItem extends i$1 {
|
|
110
|
-
constructor() {
|
|
111
|
-
super(...arguments);
|
|
112
|
-
_AccordionItem_id.set(this, crypto.randomUUID());
|
|
113
|
-
/**
|
|
114
|
-
* The menu item value.
|
|
115
|
-
*/
|
|
116
|
-
this.heading = '';
|
|
117
|
-
/**
|
|
118
|
-
* If true, the user cannot interact with the button. Defaults to `false`.
|
|
119
|
-
*/
|
|
120
|
-
this.disabled = false;
|
|
121
|
-
/**
|
|
122
|
-
* Menu item selection state.
|
|
123
|
-
*/
|
|
124
|
-
this.open = false;
|
|
125
|
-
}
|
|
126
|
-
focus() {
|
|
127
|
-
this.buttonElement?.focus();
|
|
128
|
-
}
|
|
129
|
-
blur() {
|
|
130
|
-
this.buttonElement?.blur();
|
|
131
|
-
}
|
|
132
|
-
__handleToggle() {
|
|
133
|
-
if (this.disabled)
|
|
134
|
-
return;
|
|
135
|
-
this.open = !this.open;
|
|
136
|
-
this.dispatchEvent(new CustomEvent('accordion-item--toggle', {
|
|
137
|
-
bubbles: true,
|
|
138
|
-
composed: true,
|
|
139
|
-
detail: { open: this.open, id: __classPrivateFieldGet(this, _AccordionItem_id, "f") },
|
|
140
|
-
}));
|
|
141
|
-
}
|
|
142
|
-
render() {
|
|
143
|
-
return b `<div
|
|
144
|
-
class=${e$1({
|
|
145
|
-
'accordion-item': true,
|
|
146
|
-
open: this.open,
|
|
147
|
-
disabled: this.disabled,
|
|
148
|
-
})}
|
|
149
|
-
>
|
|
150
|
-
<button
|
|
151
|
-
id=${`accordion-heading-${__classPrivateFieldGet(this, _AccordionItem_id, "f")}`}
|
|
152
|
-
tabindex="0"
|
|
153
|
-
aria-controls=${`accordion-control-${__classPrivateFieldGet(this, _AccordionItem_id, "f")}`}
|
|
154
|
-
class="accordion-heading"
|
|
155
|
-
aria-disabled=${this.disabled}
|
|
156
|
-
@click=${this.__handleToggle}
|
|
157
|
-
aria-expanded=${this.open}
|
|
158
|
-
>
|
|
159
|
-
<base-icon class="accordion-icon" name="keyboard_arrow_down"></base-icon>
|
|
160
|
-
<div part="title" class="accordion-title">
|
|
161
|
-
<slot name="heading">${this.heading}</slot>
|
|
162
|
-
</div>
|
|
163
|
-
</button>
|
|
164
|
-
<div
|
|
165
|
-
class="item-section slot-main"
|
|
166
|
-
id=${`accordion-control-${__classPrivateFieldGet(this, _AccordionItem_id, "f")}`}
|
|
167
|
-
aria-labelledby=${`accordion-heading-${__classPrivateFieldGet(this, _AccordionItem_id, "f")}`}
|
|
168
|
-
role="region"
|
|
169
|
-
>
|
|
170
|
-
<slot></slot>
|
|
171
|
-
</div>
|
|
172
|
-
</div>`;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
_AccordionItem_id = new WeakMap();
|
|
176
|
-
AccordionItem.styles = [css_248z];
|
|
177
|
-
__decorate([
|
|
178
|
-
n({ type: String, reflect: true })
|
|
179
|
-
], AccordionItem.prototype, "heading", void 0);
|
|
180
|
-
__decorate([
|
|
181
|
-
n({ type: Boolean, reflect: true })
|
|
182
|
-
], AccordionItem.prototype, "disabled", void 0);
|
|
183
|
-
__decorate([
|
|
184
|
-
n({ type: Boolean, reflect: true })
|
|
185
|
-
], AccordionItem.prototype, "open", void 0);
|
|
186
|
-
__decorate([
|
|
187
|
-
e('.accordion-heading')
|
|
188
|
-
], AccordionItem.prototype, "buttonElement", void 0);
|
|
189
|
-
|
|
190
|
-
export { AccordionItem };
|
|
191
|
-
//# sourceMappingURL=accordion-item.js.map
|