@esri/calcite-components 1.0.0-next.400 → 1.0.0-next.401
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/calcite/assets/date-picker/nls/bs.json +1 -1
- package/dist/calcite/assets/date-picker/nls/ca.json +1 -1
- package/dist/calcite/assets/date-picker/nls/cs.json +1 -1
- package/dist/calcite/assets/date-picker/nls/da.json +1 -1
- package/dist/calcite/assets/date-picker/nls/de.json +1 -1
- package/dist/calcite/assets/date-picker/nls/el.json +1 -1
- package/dist/calcite/assets/date-picker/nls/en-AU.json +1 -1
- package/dist/calcite/assets/date-picker/nls/es.json +1 -1
- package/dist/calcite/assets/date-picker/nls/et.json +1 -1
- package/dist/calcite/assets/date-picker/nls/fi.json +1 -1
- package/dist/calcite/assets/date-picker/nls/fr.json +1 -1
- package/dist/calcite/assets/date-picker/nls/hr.json +1 -1
- package/dist/calcite/assets/date-picker/nls/hu.json +1 -1
- package/dist/calcite/assets/date-picker/nls/it.json +1 -1
- package/dist/calcite/assets/date-picker/nls/lt.json +1 -1
- package/dist/calcite/assets/date-picker/nls/lv.json +1 -1
- package/dist/calcite/assets/date-picker/nls/mk.json +1 -1
- package/dist/calcite/assets/date-picker/nls/nb.json +1 -1
- package/dist/calcite/assets/date-picker/nls/nl.json +1 -1
- package/dist/calcite/assets/date-picker/nls/pl.json +1 -1
- package/dist/calcite/assets/date-picker/nls/ro.json +1 -1
- package/dist/calcite/assets/date-picker/nls/ru.json +1 -1
- package/dist/calcite/assets/date-picker/nls/sl.json +1 -1
- package/dist/calcite/assets/date-picker/nls/sr.json +1 -1
- package/dist/calcite/assets/date-picker/nls/sv.json +1 -1
- package/dist/calcite/assets/date-picker/nls/tr.json +1 -1
- package/dist/calcite/assets/date-picker/nls/uk.json +1 -1
- package/dist/calcite/assets/date-picker/nls/vi.json +1 -1
- package/dist/calcite/calcite.esm.js +1 -1
- package/dist/calcite/p-26aea1cb.system.js +1 -1
- package/dist/calcite/p-496d3b56.system.entry.js +5 -0
- package/dist/calcite/p-674bdae8.system.entry.js +5 -0
- package/dist/calcite/p-779c6e3b.system.entry.js +5 -0
- package/dist/calcite/p-a5f8f3a1.entry.js +5 -0
- package/dist/calcite/p-ac33eb33.entry.js +5 -0
- package/dist/calcite/p-b9bfd3f8.entry.js +5 -0
- package/dist/cjs/calcite-accordion_2.cjs.entry.js +13 -4
- package/dist/cjs/calcite-block_2.cjs.entry.js +15 -7
- package/dist/cjs/calcite-tree_2.cjs.entry.js +4 -2
- package/dist/collection/components/accordion-item/accordion-item.js +13 -3
- package/dist/collection/components/block/block.js +7 -2
- package/dist/collection/components/block-section/block-section.js +12 -7
- package/dist/collection/components/date-picker/assets/date-picker/nls/bs.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/ca.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/cs.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/da.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/de.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/el.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/en-AU.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/es.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/et.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/fi.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/fr.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/hr.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/hu.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/it.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/lt.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/lv.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/mk.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/nb.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/nl.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/pl.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/ro.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/ru.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/sl.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/sr.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/sv.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/tr.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/uk.json +1 -1
- package/dist/collection/components/date-picker/assets/date-picker/nls/vi.json +1 -1
- package/dist/collection/components/tree/tree.js +4 -2
- package/dist/components/calcite-accordion-item.js +13 -3
- package/dist/components/calcite-block-section.js +10 -5
- package/dist/components/calcite-block.js +7 -2
- package/dist/components/calcite-tree.js +4 -2
- package/dist/custom-elements/index.js +30 -11
- package/dist/esm/calcite-accordion_2.entry.js +13 -4
- package/dist/esm/calcite-block_2.entry.js +15 -7
- package/dist/esm/calcite-tree_2.entry.js +4 -2
- package/dist/esm-es5/calcite-accordion_2.entry.js +1 -1
- package/dist/esm-es5/calcite-block_2.entry.js +1 -1
- package/dist/esm-es5/calcite-tree_2.entry.js +1 -1
- package/dist/extras/docs-json.json +1 -1
- package/dist/types/components/accordion-item/accordion-item.d.ts +1 -0
- package/dist/types/components/block/block.d.ts +1 -0
- package/dist/types/components/block-section/block-section.d.ts +1 -0
- package/hydrate/index.js +30 -11
- package/package.json +2 -2
- package/dist/calcite/p-0db51b2f.entry.js +0 -5
- package/dist/calcite/p-13cbacc6.system.entry.js +0 -5
- package/dist/calcite/p-6eb1302b.entry.js +0 -5
- package/dist/calcite/p-7415264e.system.entry.js +0 -5
- package/dist/calcite/p-9aaeb1df.entry.js +0 -5
- package/dist/calcite/p-e5e29b32.system.entry.js +0 -5
|
@@ -10,7 +10,7 @@ const index = require('./index-6b5d2de5.js');
|
|
|
10
10
|
const dom = require('./dom-f3df220d.js');
|
|
11
11
|
const Heading = require('./Heading-ef16f5df.js');
|
|
12
12
|
const conditionalSlot = require('./conditionalSlot-92505fba.js');
|
|
13
|
-
require('./guid-b270f0db.js');
|
|
13
|
+
const guid = require('./guid-b270f0db.js');
|
|
14
14
|
require('./observers-79bfb8bc.js');
|
|
15
15
|
|
|
16
16
|
const CSS$1 = {
|
|
@@ -90,6 +90,7 @@ let Block = class {
|
|
|
90
90
|
* When true, the block's content will be displayed.
|
|
91
91
|
*/
|
|
92
92
|
this.open = false;
|
|
93
|
+
this.guid = guid.guid();
|
|
93
94
|
// --------------------------------------------------------------------------
|
|
94
95
|
//
|
|
95
96
|
// Private Methods
|
|
@@ -145,10 +146,13 @@ let Block = class {
|
|
|
145
146
|
const hasControl = !!dom.getSlotted(el, SLOTS.control);
|
|
146
147
|
const hasMenuActions = !!dom.getSlotted(el, SLOTS.headerMenuActions);
|
|
147
148
|
const collapseIcon = open ? ICONS$1.opened : ICONS$1.closed;
|
|
148
|
-
const
|
|
149
|
+
const { guid } = this;
|
|
150
|
+
const regionId = `${guid}-region`;
|
|
151
|
+
const buttonId = `${guid}-button`;
|
|
152
|
+
const headerNode = (index.h("div", { class: CSS$1.headerContainer }, this.dragHandle ? index.h("calcite-handle", null) : null, collapsible ? (index.h("button", { "aria-controls": regionId, "aria-expanded": collapsible ? open.toString() : null, "aria-label": toggleLabel, class: CSS$1.toggle, id: buttonId, onClick: this.onHeaderClick, title: toggleLabel }, headerContent, !hasControl && !hasMenuActions ? (index.h("calcite-icon", { "aria-hidden": "true", class: CSS$1.toggleIcon, icon: collapseIcon, scale: "s" })) : null)) : (headerContent), loading ? (index.h("calcite-loader", { inline: true, "is-active": true, label: intlLoading })) : hasControl ? (index.h("div", { class: CSS$1.controlContainer }, index.h("slot", { name: SLOTS.control }))) : null, hasMenuActions ? (index.h("calcite-action-menu", { label: this.intlOptions || TEXT$1.options }, index.h("slot", { name: SLOTS.headerMenuActions }))) : null));
|
|
149
153
|
return (index.h(index.Host, { tabIndex: disabled ? -1 : null }, index.h("article", { "aria-busy": loading.toString(), class: {
|
|
150
154
|
[CSS$1.article]: true
|
|
151
|
-
} }, headerNode, index.h("
|
|
155
|
+
} }, headerNode, index.h("section", { "aria-expanded": this.open.toString(), "aria-labelledby": buttonId, class: CSS$1.content, hidden: !open, id: regionId }, this.renderScrim()))));
|
|
152
156
|
}
|
|
153
157
|
get el() { return index.getElement(this); }
|
|
154
158
|
};
|
|
@@ -194,6 +198,7 @@ let BlockSection = class {
|
|
|
194
198
|
* If the value is "button", a clickable header is displayed.
|
|
195
199
|
*/
|
|
196
200
|
this.toggleDisplay = "button";
|
|
201
|
+
this.guid = guid.guid();
|
|
197
202
|
// --------------------------------------------------------------------------
|
|
198
203
|
//
|
|
199
204
|
// Private Methods
|
|
@@ -236,14 +241,17 @@ let BlockSection = class {
|
|
|
236
241
|
? ICONS.menuClosedLeft
|
|
237
242
|
: ICONS.menuClosedRight;
|
|
238
243
|
const toggleLabel = open ? intlCollapse || TEXT.collapse : intlExpand || TEXT.expand;
|
|
239
|
-
const
|
|
244
|
+
const { guid } = this;
|
|
245
|
+
const regionId = `${guid}-region`;
|
|
246
|
+
const buttonId = `${guid}-button`;
|
|
247
|
+
const headerNode = toggleDisplay === "switch" ? (index.h("div", { "aria-controls": regionId, "aria-label": toggleLabel, class: {
|
|
240
248
|
[CSS.toggle]: true,
|
|
241
249
|
[CSS.toggleSwitch]: true
|
|
242
|
-
}, onClick: this.toggleSection, onKeyDown: this.handleHeaderKeyDown, tabIndex: 0, title: toggleLabel }, index.h("div", { class: CSS.toggleSwitchContent }, index.h("span", { class: CSS.toggleSwitchText }, text)), index.h("calcite-switch", { checked: open, label: toggleLabel, scale: "s", tabIndex: -1 }), this.renderStatusIcon())) : (index.h("button", { "aria-label": toggleLabel, class: {
|
|
250
|
+
}, id: buttonId, onClick: this.toggleSection, onKeyDown: this.handleHeaderKeyDown, tabIndex: 0, title: toggleLabel }, index.h("div", { class: CSS.toggleSwitchContent }, index.h("span", { class: CSS.toggleSwitchText }, text)), index.h("calcite-switch", { checked: open, label: toggleLabel, scale: "s", tabIndex: -1 }), this.renderStatusIcon())) : (index.h("button", { "aria-controls": regionId, "aria-label": toggleLabel, class: {
|
|
243
251
|
[CSS.sectionHeader]: true,
|
|
244
252
|
[CSS.toggle]: true
|
|
245
|
-
}, name: toggleLabel, onClick: this.toggleSection }, index.h("calcite-icon", { icon: arrowIcon, scale: "s" }), index.h("span", { class: CSS.sectionHeaderText }, text), this.renderStatusIcon()));
|
|
246
|
-
return (index.h("section", { "aria-expanded": open.toString()
|
|
253
|
+
}, id: buttonId, name: toggleLabel, onClick: this.toggleSection }, index.h("calcite-icon", { icon: arrowIcon, scale: "s" }), index.h("span", { class: CSS.sectionHeaderText }, text), this.renderStatusIcon()));
|
|
254
|
+
return (index.h(index.Host, null, headerNode, index.h("section", { "aria-expanded": open.toString(), "aria-labelledby": buttonId, class: CSS.content, hidden: !open, id: regionId }, index.h("slot", null))));
|
|
247
255
|
}
|
|
248
256
|
get el() { return index.getElement(this); }
|
|
249
257
|
};
|
|
@@ -59,8 +59,10 @@ let Tree = class {
|
|
|
59
59
|
this.child = !!parent;
|
|
60
60
|
}
|
|
61
61
|
render() {
|
|
62
|
-
return (index.h(index.Host, { "aria-multiselectable":
|
|
63
|
-
|
|
62
|
+
return (index.h(index.Host, { "aria-multiselectable": this.child
|
|
63
|
+
? undefined
|
|
64
|
+
: (this.selectionMode === TreeSelectionMode.Multi ||
|
|
65
|
+
this.selectionMode === TreeSelectionMode.MultiChildren).toString(), role: !this.child ? "tree" : undefined, tabIndex: this.getRootTabIndex() }, index.h("slot", null)));
|
|
64
66
|
}
|
|
65
67
|
//--------------------------------------------------------------------------
|
|
66
68
|
//
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { Component, Element, Event, h, Host, Listen, Prop } from "@stencil/core";
|
|
6
6
|
import { getElementDir, getElementProp } from "../../utils/dom";
|
|
7
7
|
import { CSS_UTILITY } from "../../utils/resources";
|
|
8
|
+
import { guid } from "../../utils/guid";
|
|
8
9
|
/**
|
|
9
10
|
* @slot - A slot for adding custom content, including nested `calcite-accordion-item`s.
|
|
10
11
|
*/
|
|
@@ -17,6 +18,12 @@ export class AccordionItem {
|
|
|
17
18
|
//--------------------------------------------------------------------------
|
|
18
19
|
/** Indicates whether the item is active. */
|
|
19
20
|
this.active = false;
|
|
21
|
+
//--------------------------------------------------------------------------
|
|
22
|
+
//
|
|
23
|
+
// Private State/Props
|
|
24
|
+
//
|
|
25
|
+
//--------------------------------------------------------------------------
|
|
26
|
+
this.guid = guid();
|
|
20
27
|
/** what icon position does the parent accordion specify */
|
|
21
28
|
this.iconPosition = "end";
|
|
22
29
|
/** handle clicks on item header */
|
|
@@ -43,12 +50,15 @@ export class AccordionItem {
|
|
|
43
50
|
render() {
|
|
44
51
|
const dir = getElementDir(this.el);
|
|
45
52
|
const iconEl = h("calcite-icon", { class: "accordion-item-icon", icon: this.icon, scale: "s" });
|
|
46
|
-
|
|
53
|
+
const { guid } = this;
|
|
54
|
+
const regionId = `${guid}-region`;
|
|
55
|
+
const buttonId = `${guid}-button`;
|
|
56
|
+
return (h(Host, { tabindex: "0" },
|
|
47
57
|
h("div", { class: {
|
|
48
58
|
[`icon-position--${this.iconPosition}`]: true,
|
|
49
59
|
[`icon-type--${this.iconType}`]: true
|
|
50
60
|
} },
|
|
51
|
-
h("div", { class: { "accordion-item-header": true, [CSS_UTILITY.rtl]: dir === "rtl" }, onClick: this.itemHeaderClickHandler },
|
|
61
|
+
h("div", { "aria-controls": regionId, class: { "accordion-item-header": true, [CSS_UTILITY.rtl]: dir === "rtl" }, id: buttonId, onClick: this.itemHeaderClickHandler, role: "button" },
|
|
52
62
|
this.icon ? iconEl : null,
|
|
53
63
|
h("div", { class: "accordion-item-header-text" },
|
|
54
64
|
h("span", { class: "accordion-item-title" }, this.itemTitle),
|
|
@@ -60,7 +70,7 @@ export class AccordionItem {
|
|
|
60
70
|
: this.active
|
|
61
71
|
? "minus"
|
|
62
72
|
: "plus", scale: "s" })),
|
|
63
|
-
h("div", { class: "accordion-item-content" },
|
|
73
|
+
h("div", { "aria-expanded": this.active.toString(), "aria-labelledby": buttonId, class: "accordion-item-content", id: regionId, role: "region" },
|
|
64
74
|
h("slot", null)))));
|
|
65
75
|
}
|
|
66
76
|
//--------------------------------------------------------------------------
|
|
@@ -7,6 +7,7 @@ import { CSS, HEADING_LEVEL, ICONS, SLOTS, TEXT } from "./resources";
|
|
|
7
7
|
import { getSlotted } from "../../utils/dom";
|
|
8
8
|
import { Heading } from "../functional/Heading";
|
|
9
9
|
import { connectConditionalSlotComponent, disconnectConditionalSlotComponent } from "../../utils/conditionalSlot";
|
|
10
|
+
import { guid } from "../../utils/guid";
|
|
10
11
|
/**
|
|
11
12
|
* @slot - A slot for adding content to the block.
|
|
12
13
|
* @slot icon - A slot for adding a leading header icon.
|
|
@@ -48,6 +49,7 @@ export class Block {
|
|
|
48
49
|
* When true, the block's content will be displayed.
|
|
49
50
|
*/
|
|
50
51
|
this.open = false;
|
|
52
|
+
this.guid = guid();
|
|
51
53
|
// --------------------------------------------------------------------------
|
|
52
54
|
//
|
|
53
55
|
// Private Methods
|
|
@@ -107,9 +109,12 @@ export class Block {
|
|
|
107
109
|
const hasControl = !!getSlotted(el, SLOTS.control);
|
|
108
110
|
const hasMenuActions = !!getSlotted(el, SLOTS.headerMenuActions);
|
|
109
111
|
const collapseIcon = open ? ICONS.opened : ICONS.closed;
|
|
112
|
+
const { guid } = this;
|
|
113
|
+
const regionId = `${guid}-region`;
|
|
114
|
+
const buttonId = `${guid}-button`;
|
|
110
115
|
const headerNode = (h("div", { class: CSS.headerContainer },
|
|
111
116
|
this.dragHandle ? h("calcite-handle", null) : null,
|
|
112
|
-
collapsible ? (h("button", { "aria-expanded": collapsible ? open.toString() : null, "aria-label": toggleLabel, class: CSS.toggle, onClick: this.onHeaderClick, title: toggleLabel },
|
|
117
|
+
collapsible ? (h("button", { "aria-controls": regionId, "aria-expanded": collapsible ? open.toString() : null, "aria-label": toggleLabel, class: CSS.toggle, id: buttonId, onClick: this.onHeaderClick, title: toggleLabel },
|
|
113
118
|
headerContent,
|
|
114
119
|
!hasControl && !hasMenuActions ? (h("calcite-icon", { "aria-hidden": "true", class: CSS.toggleIcon, icon: collapseIcon, scale: "s" })) : null)) : (headerContent),
|
|
115
120
|
loading ? (h("calcite-loader", { inline: true, "is-active": true, label: intlLoading })) : hasControl ? (h("div", { class: CSS.controlContainer },
|
|
@@ -121,7 +126,7 @@ export class Block {
|
|
|
121
126
|
[CSS.article]: true
|
|
122
127
|
} },
|
|
123
128
|
headerNode,
|
|
124
|
-
h("
|
|
129
|
+
h("section", { "aria-expanded": this.open.toString(), "aria-labelledby": buttonId, class: CSS.content, hidden: !open, id: regionId }, this.renderScrim()))));
|
|
125
130
|
}
|
|
126
131
|
static get is() { return "calcite-block"; }
|
|
127
132
|
static get encapsulation() { return "shadow"; }
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
|
4
4
|
*/
|
|
5
|
-
import { Component, Element, Event, Prop, h } from "@stencil/core";
|
|
5
|
+
import { Component, Element, Event, Prop, h, Host } from "@stencil/core";
|
|
6
6
|
import { getElementDir } from "../../utils/dom";
|
|
7
7
|
import { CSS, ICONS, TEXT } from "./resources";
|
|
8
|
+
import { guid } from "../../utils/guid";
|
|
8
9
|
/**
|
|
9
10
|
* @slot - A slot for adding content to the block section.
|
|
10
11
|
*/
|
|
@@ -20,6 +21,7 @@ export class BlockSection {
|
|
|
20
21
|
* If the value is "button", a clickable header is displayed.
|
|
21
22
|
*/
|
|
22
23
|
this.toggleDisplay = "button";
|
|
24
|
+
this.guid = guid();
|
|
23
25
|
// --------------------------------------------------------------------------
|
|
24
26
|
//
|
|
25
27
|
// Private Methods
|
|
@@ -62,23 +64,26 @@ export class BlockSection {
|
|
|
62
64
|
? ICONS.menuClosedLeft
|
|
63
65
|
: ICONS.menuClosedRight;
|
|
64
66
|
const toggleLabel = open ? intlCollapse || TEXT.collapse : intlExpand || TEXT.expand;
|
|
65
|
-
const
|
|
67
|
+
const { guid } = this;
|
|
68
|
+
const regionId = `${guid}-region`;
|
|
69
|
+
const buttonId = `${guid}-button`;
|
|
70
|
+
const headerNode = toggleDisplay === "switch" ? (h("div", { "aria-controls": regionId, "aria-label": toggleLabel, class: {
|
|
66
71
|
[CSS.toggle]: true,
|
|
67
72
|
[CSS.toggleSwitch]: true
|
|
68
|
-
}, onClick: this.toggleSection, onKeyDown: this.handleHeaderKeyDown, tabIndex: 0, title: toggleLabel },
|
|
73
|
+
}, id: buttonId, onClick: this.toggleSection, onKeyDown: this.handleHeaderKeyDown, tabIndex: 0, title: toggleLabel },
|
|
69
74
|
h("div", { class: CSS.toggleSwitchContent },
|
|
70
75
|
h("span", { class: CSS.toggleSwitchText }, text)),
|
|
71
76
|
h("calcite-switch", { checked: open, label: toggleLabel, scale: "s", tabIndex: -1 }),
|
|
72
|
-
this.renderStatusIcon())) : (h("button", { "aria-label": toggleLabel, class: {
|
|
77
|
+
this.renderStatusIcon())) : (h("button", { "aria-controls": regionId, "aria-label": toggleLabel, class: {
|
|
73
78
|
[CSS.sectionHeader]: true,
|
|
74
79
|
[CSS.toggle]: true
|
|
75
|
-
}, name: toggleLabel, onClick: this.toggleSection },
|
|
80
|
+
}, id: buttonId, name: toggleLabel, onClick: this.toggleSection },
|
|
76
81
|
h("calcite-icon", { icon: arrowIcon, scale: "s" }),
|
|
77
82
|
h("span", { class: CSS.sectionHeaderText }, text),
|
|
78
83
|
this.renderStatusIcon()));
|
|
79
|
-
return (h(
|
|
84
|
+
return (h(Host, null,
|
|
80
85
|
headerNode,
|
|
81
|
-
h("
|
|
86
|
+
h("section", { "aria-expanded": open.toString(), "aria-labelledby": buttonId, class: CSS.content, hidden: !open, id: regionId },
|
|
82
87
|
h("slot", null))));
|
|
83
88
|
}
|
|
84
89
|
static get is() { return "calcite-block-section"; }
|
|
@@ -42,8 +42,10 @@ export class Tree {
|
|
|
42
42
|
this.child = !!parent;
|
|
43
43
|
}
|
|
44
44
|
render() {
|
|
45
|
-
return (h(Host, { "aria-multiselectable":
|
|
46
|
-
|
|
45
|
+
return (h(Host, { "aria-multiselectable": this.child
|
|
46
|
+
? undefined
|
|
47
|
+
: (this.selectionMode === TreeSelectionMode.Multi ||
|
|
48
|
+
this.selectionMode === TreeSelectionMode.MultiChildren).toString(), role: !this.child ? "tree" : undefined, tabIndex: this.getRootTabIndex() },
|
|
47
49
|
h("slot", null)));
|
|
48
50
|
}
|
|
49
51
|
//--------------------------------------------------------------------------
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { HTMLElement, createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
|
|
6
6
|
import { g as getElementProp, a as getElementDir, C as CSS_UTILITY } from './dom.js';
|
|
7
|
+
import { g as guid } from './guid.js';
|
|
7
8
|
import { d as defineCustomElement$2 } from './icon.js';
|
|
8
9
|
|
|
9
10
|
const accordionItemCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{-webkit-animation-name:in;animation-name:in}.calcite-animate__in-down{-webkit-animation-name:in-down;animation-name:in-down}.calcite-animate__in-up{-webkit-animation-name:in-up;animation-name:in-up}.calcite-animate__in-scale{-webkit-animation-name:in-scale;animation-name:in-scale}:root{--calcite-popper-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}.icon-position--end,.icon-position--start{--calcite-accordion-item-icon-rotation:calc(90deg * -1);--calcite-accordion-item-active-icon-rotation:0deg;--calcite-accordion-item-icon-rotation-rtl:90deg;--calcite-accordion-item-active-icon-rotation-rtl:0deg}.icon-position--start{--calcite-accordion-item-flex-direction:row-reverse;--calcite-accordion-item-icon-spacing-start:0;--calcite-accordion-item-icon-spacing-end:var(--calcite-accordion-icon-margin)}.icon-position--end{--calcite-accordion-item-flex-direction:row;--calcite-accordion-item-icon-spacing-start:var(--calcite-accordion-icon-margin);--calcite-accordion-item-icon-spacing-end:0}.icon-position--end:not(.icon-type--plus-minus){--calcite-accordion-item-icon-rotation:0deg;--calcite-accordion-item-active-icon-rotation:180deg;--calcite-accordion-item-icon-rotation-rtl:0deg;--calcite-accordion-item-active-icon-rotation-rtl:calc(180deg * -1)}:host{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;color:var(--calcite-ui-text-3);-webkit-text-decoration-line:none;text-decoration-line:none;outline:2px solid transparent;outline-offset:2px;background-color:var(--calcite-accordion-item-background, var(--calcite-ui-foreground-1))}:host .accordion-item-header{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}:host(:focus) .accordion-item-header{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}:host([active]){color:var(--calcite-ui-text-1)}:host([active]) .accordion-item-content{display:block;color:var(--calcite-ui-text-1)}:host([active]) .accordion-item-header{border-bottom-color:transparent}:host .accordion-item-header{display:-ms-flexbox;display:flex;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-direction:var(--calcite-accordion-item-flex-direction);flex-direction:var(--calcite-accordion-item-flex-direction)}:host .accordion-item-icon{position:relative;margin:0px;display:-ms-inline-flexbox;display:inline-flex;color:var(--calcite-ui-text-3);-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-margin-end:var(--calcite-accordion-item-icon-spacing-start);margin-inline-end:var(--calcite-accordion-item-icon-spacing-start);-webkit-margin-start:var(--calcite-accordion-item-icon-spacing-end);margin-inline-start:var(--calcite-accordion-item-icon-spacing-end)}:host .accordion-item-content,:host .accordion-item-header{padding:var(--calcite-accordion-item-padding);border-bottom:1px solid var(--calcite-accordion-item-border, var(--calcite-ui-border-2))}:host .accordion-item-header *{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}:host .accordion-item-content{display:none;padding-top:0px;color:var(--calcite-ui-text-3);text-align:initial}:host .accordion-item-expand-icon{color:var(--calcite-ui-text-3);-webkit-margin-start:var(--calcite-accordion-item-icon-spacing-start);margin-inline-start:var(--calcite-accordion-item-icon-spacing-start);-webkit-margin-end:var(--calcite-accordion-item-icon-spacing-end);margin-inline-end:var(--calcite-accordion-item-icon-spacing-end);-webkit-transform:rotate(var(--calcite-accordion-item-icon-rotation));transform:rotate(var(--calcite-accordion-item-icon-rotation))}.calcite--rtl .accordion-item-expand-icon{-webkit-transform:rotate(var(--calcite-accordion-item-icon-rotation-rtl));transform:rotate(var(--calcite-accordion-item-icon-rotation-rtl))}:host([active]) .accordion-item-expand-icon{color:var(--calcite-ui-text-1);-webkit-transform:rotate(var(--calcite-accordion-item-active-icon-rotation));transform:rotate(var(--calcite-accordion-item-active-icon-rotation))}:host([active]) .calcite--rtl .accordion-item-expand-icon{-webkit-transform:rotate(var(--calcite-accordion-item-active-icon-rotation-rtl));transform:rotate(var(--calcite-accordion-item-active-icon-rotation-rtl))}:host .accordion-item-header-text{margin-top:0px;margin-bottom:0px;-ms-flex-positive:1;flex-grow:1;-ms-flex-direction:column;flex-direction:column;padding-top:0px;padding-bottom:0px;text-align:initial;-webkit-margin-end:auto;margin-inline-end:auto}:host .accordion-item-title,:host .accordion-item-subtitle{display:-ms-flexbox;display:flex;width:100%}:host .accordion-item-title{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2)}:host .accordion-item-subtitle{margin-top:0.25rem;color:var(--calcite-ui-text-3)}:host(:focus) .accordion-item-title,:host(:hover) .accordion-item-title{color:var(--calcite-ui-text-1)}:host(:focus) .accordion-item-icon,:host(:hover) .accordion-item-icon{color:var(--calcite-ui-text-1)}:host(:focus) .accordion-item-expand-icon,:host(:hover) .accordion-item-expand-icon{color:var(--calcite-ui-text-1)}:host(:focus) .accordion-item-subtitle,:host(:hover) .accordion-item-subtitle{color:var(--calcite-ui-text-2)}:host(:focus) .accordion-item-title,:host(:active) .accordion-item-title,:host([active]) .accordion-item-title{color:var(--calcite-ui-text-1)}:host(:focus) .accordion-item-icon,:host(:active) .accordion-item-icon,:host([active]) .accordion-item-icon{color:var(--calcite-ui-text-1)}:host(:focus) .accordion-item-expand-icon,:host(:active) .accordion-item-expand-icon,:host([active]) .accordion-item-expand-icon{color:var(--calcite-ui-text-1)}:host(:focus) .accordion-item-subtitle,:host(:active) .accordion-item-subtitle,:host([active]) .accordion-item-subtitle{color:var(--calcite-ui-text-2)}";
|
|
@@ -24,6 +25,12 @@ let AccordionItem = class extends HTMLElement {
|
|
|
24
25
|
//--------------------------------------------------------------------------
|
|
25
26
|
/** Indicates whether the item is active. */
|
|
26
27
|
this.active = false;
|
|
28
|
+
//--------------------------------------------------------------------------
|
|
29
|
+
//
|
|
30
|
+
// Private State/Props
|
|
31
|
+
//
|
|
32
|
+
//--------------------------------------------------------------------------
|
|
33
|
+
this.guid = guid();
|
|
27
34
|
/** what icon position does the parent accordion specify */
|
|
28
35
|
this.iconPosition = "end";
|
|
29
36
|
/** handle clicks on item header */
|
|
@@ -50,16 +57,19 @@ let AccordionItem = class extends HTMLElement {
|
|
|
50
57
|
render() {
|
|
51
58
|
const dir = getElementDir(this.el);
|
|
52
59
|
const iconEl = h("calcite-icon", { class: "accordion-item-icon", icon: this.icon, scale: "s" });
|
|
53
|
-
|
|
60
|
+
const { guid } = this;
|
|
61
|
+
const regionId = `${guid}-region`;
|
|
62
|
+
const buttonId = `${guid}-button`;
|
|
63
|
+
return (h(Host, { tabindex: "0" }, h("div", { class: {
|
|
54
64
|
[`icon-position--${this.iconPosition}`]: true,
|
|
55
65
|
[`icon-type--${this.iconType}`]: true
|
|
56
|
-
} }, h("div", { class: { "accordion-item-header": true, [CSS_UTILITY.rtl]: dir === "rtl" }, onClick: this.itemHeaderClickHandler }, this.icon ? iconEl : null, h("div", { class: "accordion-item-header-text" }, h("span", { class: "accordion-item-title" }, this.itemTitle), this.itemSubtitle ? (h("span", { class: "accordion-item-subtitle" }, this.itemSubtitle)) : null), h("calcite-icon", { class: "accordion-item-expand-icon", icon: this.iconType === "chevron"
|
|
66
|
+
} }, h("div", { "aria-controls": regionId, class: { "accordion-item-header": true, [CSS_UTILITY.rtl]: dir === "rtl" }, id: buttonId, onClick: this.itemHeaderClickHandler, role: "button" }, this.icon ? iconEl : null, h("div", { class: "accordion-item-header-text" }, h("span", { class: "accordion-item-title" }, this.itemTitle), this.itemSubtitle ? (h("span", { class: "accordion-item-subtitle" }, this.itemSubtitle)) : null), h("calcite-icon", { class: "accordion-item-expand-icon", icon: this.iconType === "chevron"
|
|
57
67
|
? "chevronDown"
|
|
58
68
|
: this.iconType === "caret"
|
|
59
69
|
? "caretDown"
|
|
60
70
|
: this.active
|
|
61
71
|
? "minus"
|
|
62
|
-
: "plus", scale: "s" })), h("div", { class: "accordion-item-content" }, h("slot", null)))));
|
|
72
|
+
: "plus", scale: "s" })), h("div", { "aria-expanded": this.active.toString(), "aria-labelledby": buttonId, class: "accordion-item-content", id: regionId, role: "region" }, h("slot", null)))));
|
|
63
73
|
}
|
|
64
74
|
//--------------------------------------------------------------------------
|
|
65
75
|
//
|