@esri/solutions-components 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/arcgis-pdf-creator/PDFCreator.js +6 -3
- package/dist/assets/arcgis-pdf-creator/PDFCreator_jsPDF.js +1 -1
- package/dist/assets/arcgis-pdf-creator/PDFCreator_pdf_lib.js +1 -1
- package/dist/assets/arcgis-pdf-creator/PDFLabels.js +54 -3
- package/dist/assets/arcgis-pdf-creator/grid.js +1 -1
- package/dist/assets/data/images/grid.png +0 -0
- package/dist/assets/data/images/horizontal.png +0 -0
- package/dist/assets/data/images/vertical.png +0 -0
- package/dist/assets/t9n/crowdsource-manager/resources.json +7 -1
- package/dist/assets/t9n/crowdsource-manager/resources_en.json +7 -1
- package/dist/cjs/buffer-tools_6.cjs.entry.js +85 -85
- package/dist/cjs/{calcite-block_2.cjs.entry.js → calcite-action-bar_4.cjs.entry.js} +307 -18
- package/dist/cjs/{calcite-action.cjs.entry.js → calcite-action_2.cjs.entry.js} +84 -1
- package/dist/cjs/{calcite-combobox_3.cjs.entry.js → calcite-chip_4.cjs.entry.js} +187 -61
- package/dist/cjs/{calcite-dropdown-group_4.cjs.entry.js → calcite-dropdown_5.cjs.entry.js} +467 -1
- package/dist/cjs/calcite-input-message_5.cjs.entry.js +283 -283
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
- package/dist/cjs/{calcite-action-bar_2.cjs.entry.js → calcite-tooltip.cjs.entry.js} +2 -208
- package/dist/cjs/crowdsource-manager.cjs.entry.js +88 -14
- package/dist/cjs/{downloadUtils-b85476e8.js → downloadUtils-9359e9ff.js} +1218 -1127
- package/dist/cjs/{index.es-3ba50626.js → index.es-9c0d0ed6.js} +10682 -10682
- package/dist/cjs/{interfaces-17c631bf.js → interfaces-cac36920.js} +6 -0
- package/dist/cjs/layer-table_2.cjs.entry.js +512 -0
- package/dist/cjs/loader.cjs.js +30 -30
- package/dist/cjs/{mapViewUtils-df63bfa4.js → mapViewUtils-090f4d4d.js} +24 -24
- package/dist/cjs/public-notification.cjs.entry.js +69 -49
- package/dist/cjs/solution-configuration.cjs.entry.js +2 -2
- package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
- package/dist/cjs/{solution-store-b86759b2.js → solution-store-d28c332e.js} +1 -1
- package/dist/cjs/solutions-components.cjs.js +31 -31
- package/dist/collection/assets/arcgis-pdf-creator/PDFCreator.js +6 -3
- package/dist/collection/assets/arcgis-pdf-creator/PDFCreator_jsPDF.js +1 -1
- package/dist/collection/assets/arcgis-pdf-creator/PDFCreator_pdf_lib.js +1 -1
- package/dist/collection/assets/arcgis-pdf-creator/PDFLabels.js +54 -3
- package/dist/collection/assets/arcgis-pdf-creator/grid.js +1 -1
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.css +122 -0
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +130 -14
- package/dist/collection/components/layer-table/layer-table.css +2 -70
- package/dist/collection/components/layer-table/layer-table.js +66 -106
- package/dist/collection/components/map-card/map-card.css +4 -7
- package/dist/collection/components/map-card/map-card.js +44 -10
- package/dist/collection/components/map-draw-tools/map-draw-tools.js +1 -1
- package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
- package/dist/collection/components/public-notification/public-notification.js +45 -27
- package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +1 -1
- package/dist/collection/demos/crowdsource-manager.html +14 -41
- package/dist/collection/utils/csvDownload.js +41 -0
- package/dist/collection/utils/csvDownload.ts +42 -0
- package/dist/collection/utils/csvUtils.js +6 -23
- package/dist/collection/utils/csvUtils.ts +8 -27
- package/dist/collection/utils/downloadUtils.js +30 -14
- package/dist/collection/utils/downloadUtils.ts +36 -14
- package/dist/collection/utils/interfaces.js +6 -0
- package/dist/collection/utils/interfaces.ts +6 -0
- package/dist/collection/utils/pdfUtils.js +9 -6
- package/dist/collection/utils/pdfUtils.ts +13 -8
- package/dist/collection/utils/test/csvUtils.spec.tsx +56 -0
- package/dist/collection/utils/test/downloadUtils.spec.tsx +133 -0
- package/dist/components/crowdsource-manager.js +293 -17
- package/dist/components/downloadUtils.js +133 -42
- package/dist/components/interfaces3.js +7 -1
- package/dist/components/layer-table.js +1 -443
- package/dist/components/layer-table2.js +429 -0
- package/dist/components/map-card.js +1 -339
- package/dist/{esm/map-card.entry.js → components/map-card2.js} +118 -22
- package/dist/components/map-draw-tools2.js +16 -16
- package/dist/components/map-layer-picker2.js +1 -1
- package/dist/components/map-select-tools2.js +38 -38
- package/dist/components/public-notification.js +102 -82
- package/dist/components/queryUtils.js +10 -10
- package/dist/components/refine-selection-tools2.js +3 -3
- package/dist/components/refine-selection2.js +1 -1
- package/dist/components/solution-resource-item2.js +1 -1
- package/dist/components/solution-store.js +1 -1
- package/dist/esm/buffer-tools_6.entry.js +76 -76
- package/dist/esm/{calcite-block_2.entry.js → calcite-action-bar_4.entry.js} +307 -20
- package/dist/esm/{calcite-action.entry.js → calcite-action_2.entry.js} +84 -2
- package/dist/esm/{calcite-combobox_3.entry.js → calcite-chip_4.entry.js} +181 -56
- package/dist/esm/{calcite-dropdown-group_4.entry.js → calcite-dropdown_5.entry.js} +468 -3
- package/dist/esm/calcite-input-message_5.entry.js +275 -275
- package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
- package/dist/esm/{calcite-action-bar_2.entry.js → calcite-tooltip.entry.js} +4 -209
- package/dist/esm/crowdsource-manager.entry.js +88 -14
- package/dist/esm/{downloadUtils-f278742f.js → downloadUtils-a8f139c5.js} +1214 -1123
- package/dist/esm/{index.es-6f3a1143.js → index.es-a75412ff.js} +10596 -10596
- package/dist/esm/{interfaces-d0d83efa.js → interfaces-cd4054e5.js} +7 -1
- package/dist/esm/layer-table_2.entry.js +507 -0
- package/dist/esm/loader.js +26 -26
- package/dist/esm/{mapViewUtils-bd1809f0.js → mapViewUtils-8ffcd36d.js} +12 -12
- package/dist/esm/public-notification.entry.js +65 -45
- package/dist/esm/solution-configuration.entry.js +2 -2
- package/dist/esm/solution-contents_3.entry.js +2 -2
- package/dist/esm/{solution-store-477288ac.js → solution-store-1b67f2c8.js} +1 -1
- package/dist/esm/solutions-components.js +26 -26
- package/dist/solutions-components/demos/crowdsource-manager.html +14 -41
- package/dist/solutions-components/{p-dd11eeb2.js → p-1395b0ef.js} +1 -1
- package/dist/solutions-components/{p-cbac29fb.entry.js → p-1affd711.entry.js} +18 -18
- package/dist/solutions-components/p-30de8da1.entry.js +17 -0
- package/dist/solutions-components/{p-91cad71e.entry.js → p-439c878d.entry.js} +3 -9
- package/dist/solutions-components/{p-03e2c6fd.js → p-765a27f3.js} +60 -60
- package/dist/solutions-components/p-813a04c3.entry.js +6 -0
- package/dist/solutions-components/{p-9e8a371f.entry.js → p-874b39a7.entry.js} +3 -3
- package/dist/solutions-components/p-8cece97f.js +21 -0
- package/dist/solutions-components/{p-dd0241fb.entry.js → p-97aa7211.entry.js} +1 -1
- package/dist/solutions-components/{p-0e459cc7.entry.js → p-a955a3e6.entry.js} +10 -4
- package/dist/solutions-components/{p-40c12650.js → p-bb64bd47.js} +453 -437
- package/dist/solutions-components/{p-70e1d4d8.entry.js → p-c392dd95.entry.js} +17 -17
- package/dist/solutions-components/p-ca386a72.entry.js +6 -0
- package/dist/solutions-components/p-d47d74a6.entry.js +23 -0
- package/dist/solutions-components/p-db846ee2.entry.js +11 -0
- package/dist/solutions-components/{p-88e5a76d.js → p-dc53c9c1.js} +36 -36
- package/dist/solutions-components/p-e1c93241.entry.js +6 -0
- package/dist/solutions-components/{p-4cbaf0f1.entry.js → p-e6d235d6.entry.js} +1 -1
- package/dist/solutions-components/solutions-components.esm.js +6 -6
- package/dist/solutions-components/utils/csvDownload.ts +42 -0
- package/dist/solutions-components/utils/csvUtils.ts +8 -27
- package/dist/solutions-components/utils/downloadUtils.ts +36 -14
- package/dist/solutions-components/utils/interfaces.ts +6 -0
- package/dist/solutions-components/utils/pdfUtils.ts +13 -8
- package/dist/solutions-components/utils/test/csvUtils.spec.tsx +56 -0
- package/dist/solutions-components/utils/test/downloadUtils.spec.tsx +133 -0
- package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +39 -0
- package/dist/types/components/layer-table/layer-table.d.ts +35 -48
- package/dist/types/components/map-card/map-card.d.ts +10 -6
- package/dist/types/components/public-notification/public-notification.d.ts +18 -6
- package/dist/types/components.d.ts +1621 -1601
- package/dist/types/preact.d.ts +2 -1
- package/dist/types/utils/csvDownload.d.ts +24 -0
- package/dist/types/utils/csvUtils.d.ts +2 -1
- package/dist/types/utils/downloadUtils.d.ts +25 -0
- package/dist/types/utils/interfaces.d.ts +5 -0
- package/dist/types/utils/pdfUtils.d.ts +2 -1
- package/package.json +4 -4
- package/dist/cjs/calcite-chip.cjs.entry.js +0 -142
- package/dist/cjs/calcite-dropdown.cjs.entry.js +0 -481
- package/dist/cjs/calcite-handle.cjs.entry.js +0 -99
- package/dist/cjs/calcite-loader.cjs.entry.js +0 -95
- package/dist/cjs/layer-table.cjs.entry.js +0 -317
- package/dist/cjs/map-card.cjs.entry.js +0 -252
- package/dist/esm/calcite-chip.entry.js +0 -138
- package/dist/esm/calcite-dropdown.entry.js +0 -477
- package/dist/esm/calcite-handle.entry.js +0 -95
- package/dist/esm/calcite-loader.entry.js +0 -91
- package/dist/esm/layer-table.entry.js +0 -313
- package/dist/solutions-components/p-045d3988.entry.js +0 -12
- package/dist/solutions-components/p-11132485.entry.js +0 -11
- package/dist/solutions-components/p-15b43c29.entry.js +0 -11
- package/dist/solutions-components/p-5034aabc.entry.js +0 -11
- package/dist/solutions-components/p-6f012424.entry.js +0 -6
- package/dist/solutions-components/p-7fd10eb3.entry.js +0 -11
- package/dist/solutions-components/p-a57ef371.entry.js +0 -6
- package/dist/solutions-components/p-bc39f296.entry.js +0 -6
- package/dist/solutions-components/p-c93d8e80.entry.js +0 -6
- package/dist/solutions-components/p-dbc9a5a8.js +0 -21
- package/dist/solutions-components/p-f5c70be2.entry.js +0 -6
- package/dist/solutions-components/p-f6b17cc6.entry.js +0 -11
@@ -1,481 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Copyright 2022 Esri
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
-
*/
|
6
|
-
'use strict';
|
7
|
-
|
8
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
9
|
-
|
10
|
-
const index = require('./index-c6979cbb.js');
|
11
|
-
const dom = require('./dom-4a580af6.js');
|
12
|
-
const floatingUi = require('./floating-ui-7e3d7775.js');
|
13
|
-
const observers = require('./observers-5311faf8.js');
|
14
|
-
const interactive = require('./interactive-0a68ab99.js');
|
15
|
-
const openCloseComponent = require('./openCloseComponent-bf986132.js');
|
16
|
-
const guid = require('./guid-84ac4d91.js');
|
17
|
-
const key = require('./key-55aca5c0.js');
|
18
|
-
require('./resources-b56bce71.js');
|
19
|
-
require('./debounce-69c3bada.js');
|
20
|
-
|
21
|
-
/*!
|
22
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
23
|
-
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
24
|
-
* v1.0.0-beta.97
|
25
|
-
*/
|
26
|
-
const SLOTS = {
|
27
|
-
dropdownTrigger: "dropdown-trigger"
|
28
|
-
};
|
29
|
-
|
30
|
-
const dropdownCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host{display:inline-flex;flex:0 1 auto}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host .calcite-dropdown-wrapper{display:block;position:absolute;z-index:900;visibility:hidden;pointer-events:none;inline-size:0;block-size:0;overflow:hidden}.calcite-dropdown-wrapper .calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}.calcite-dropdown-wrapper[data-placement^=bottom] .calcite-floating-ui-anim{transform:translateY(-5px)}.calcite-dropdown-wrapper[data-placement^=top] .calcite-floating-ui-anim{transform:translateY(5px)}.calcite-dropdown-wrapper[data-placement^=left] .calcite-floating-ui-anim{transform:translateX(5px)}.calcite-dropdown-wrapper[data-placement^=right] .calcite-floating-ui-anim{transform:translateX(-5px)}.calcite-dropdown-wrapper[data-placement] .calcite-floating-ui-anim--active{opacity:1;visibility:visible;transform:translate(0)}:host([open]) .calcite-dropdown-wrapper{pointer-events:initial;visibility:visible;inline-size:unset;block-size:unset;overflow:unset}:host .calcite-dropdown-content{max-block-size:45vh;inline-size:auto;overflow-y:auto;overflow-x:hidden;background-color:var(--calcite-ui-foreground-1);inline-size:var(--calcite-dropdown-width)}.calcite-dropdown-trigger-container{position:relative;display:flex;flex:1 1 auto}@media (forced-colors: active){:host([open]) .calcite-dropdown-wrapper{border:1px solid canvasText}}:host([width=s]){--calcite-dropdown-width:12rem}:host([width=m]){--calcite-dropdown-width:14rem}:host([width=l]){--calcite-dropdown-width:16rem}";
|
31
|
-
|
32
|
-
const Dropdown = class {
|
33
|
-
constructor(hostRef) {
|
34
|
-
index.registerInstance(this, hostRef);
|
35
|
-
this.calciteDropdownSelect = index.createEvent(this, "calciteDropdownSelect", 6);
|
36
|
-
this.calciteDropdownBeforeClose = index.createEvent(this, "calciteDropdownBeforeClose", 6);
|
37
|
-
this.calciteDropdownClose = index.createEvent(this, "calciteDropdownClose", 6);
|
38
|
-
this.calciteDropdownBeforeOpen = index.createEvent(this, "calciteDropdownBeforeOpen", 6);
|
39
|
-
this.calciteDropdownOpen = index.createEvent(this, "calciteDropdownOpen", 6);
|
40
|
-
//--------------------------------------------------------------------------
|
41
|
-
//
|
42
|
-
// Public Properties
|
43
|
-
//
|
44
|
-
//--------------------------------------------------------------------------
|
45
|
-
/**
|
46
|
-
* Opens or closes the dropdown
|
47
|
-
*
|
48
|
-
* @deprecated use open instead.
|
49
|
-
*/
|
50
|
-
this.active = false;
|
51
|
-
/** When true, opens the dropdown */
|
52
|
-
this.open = false;
|
53
|
-
/**
|
54
|
-
allow the dropdown to remain open after a selection is made
|
55
|
-
if the selection-mode of the selected item's containing group is "none", the dropdown will always close
|
56
|
-
*/
|
57
|
-
this.disableCloseOnSelect = false;
|
58
|
-
/** is the dropdown disabled */
|
59
|
-
this.disabled = false;
|
60
|
-
/**
|
61
|
-
specify the maximum number of calcite-dropdown-items to display before showing the scroller, must be greater than 0 -
|
62
|
-
this value does not include groupTitles passed to calcite-dropdown-group
|
63
|
-
*/
|
64
|
-
this.maxItems = 0;
|
65
|
-
/**
|
66
|
-
* Determines the type of positioning to use for the overlaid content.
|
67
|
-
*
|
68
|
-
* Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
|
69
|
-
*
|
70
|
-
* `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
|
71
|
-
*
|
72
|
-
*/
|
73
|
-
this.overlayPositioning = "absolute";
|
74
|
-
/**
|
75
|
-
* Determines where the dropdown will be positioned relative to the button.
|
76
|
-
*
|
77
|
-
* @default "bottom-start"
|
78
|
-
*/
|
79
|
-
this.placement = floatingUi.defaultMenuPlacement;
|
80
|
-
/** specify the scale of dropdown, defaults to m */
|
81
|
-
this.scale = "m";
|
82
|
-
/**
|
83
|
-
* **read-only** The currently selected items
|
84
|
-
*
|
85
|
-
* @readonly
|
86
|
-
*/
|
87
|
-
this.selectedItems = [];
|
88
|
-
/** specify whether the dropdown is opened by hover or click of a trigger element */
|
89
|
-
this.type = "click";
|
90
|
-
this.items = [];
|
91
|
-
this.groups = [];
|
92
|
-
this.mutationObserver = observers.createObserver("mutation", () => this.updateItems());
|
93
|
-
this.resizeObserver = observers.createObserver("resize", (entries) => this.resizeObserverCallback(entries));
|
94
|
-
this.openTransitionProp = "visibility";
|
95
|
-
this.guid = `calcite-dropdown-${guid.guid()}`;
|
96
|
-
this.defaultAssignedElements = [];
|
97
|
-
//--------------------------------------------------------------------------
|
98
|
-
//
|
99
|
-
// Private Methods
|
100
|
-
//
|
101
|
-
//--------------------------------------------------------------------------
|
102
|
-
this.slotChangeHandler = (event) => {
|
103
|
-
this.defaultAssignedElements = event.target.assignedElements({
|
104
|
-
flatten: true
|
105
|
-
});
|
106
|
-
this.updateItems();
|
107
|
-
};
|
108
|
-
this.setFilteredPlacements = () => {
|
109
|
-
const { el, flipPlacements } = this;
|
110
|
-
this.filteredFlipPlacements = flipPlacements
|
111
|
-
? floatingUi.filterComputedPlacements(flipPlacements, el)
|
112
|
-
: null;
|
113
|
-
};
|
114
|
-
this.updateTriggers = (event) => {
|
115
|
-
this.triggers = event.target.assignedElements({
|
116
|
-
flatten: true
|
117
|
-
});
|
118
|
-
this.reposition(true);
|
119
|
-
};
|
120
|
-
this.updateItems = () => {
|
121
|
-
this.items = this.groups
|
122
|
-
.map((group) => Array.from(group === null || group === void 0 ? void 0 : group.querySelectorAll("calcite-dropdown-item")))
|
123
|
-
.reduce((previousValue, currentValue) => [...previousValue, ...currentValue], []);
|
124
|
-
this.updateSelectedItems();
|
125
|
-
this.reposition(true);
|
126
|
-
};
|
127
|
-
this.updateGroups = (event) => {
|
128
|
-
const groups = event.target
|
129
|
-
.assignedElements({ flatten: true })
|
130
|
-
.filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-dropdown-group"));
|
131
|
-
this.groups = groups;
|
132
|
-
this.updateItems();
|
133
|
-
};
|
134
|
-
this.resizeObserverCallback = (entries) => {
|
135
|
-
entries.forEach((entry) => {
|
136
|
-
const { target } = entry;
|
137
|
-
if (target === this.referenceEl) {
|
138
|
-
this.setDropdownWidth();
|
139
|
-
}
|
140
|
-
else if (target === this.scrollerEl) {
|
141
|
-
this.setMaxScrollerHeight();
|
142
|
-
}
|
143
|
-
});
|
144
|
-
};
|
145
|
-
this.setDropdownWidth = () => {
|
146
|
-
const { referenceEl, scrollerEl } = this;
|
147
|
-
const referenceElWidth = referenceEl === null || referenceEl === void 0 ? void 0 : referenceEl.clientWidth;
|
148
|
-
if (!referenceElWidth || !scrollerEl) {
|
149
|
-
return;
|
150
|
-
}
|
151
|
-
scrollerEl.style.minWidth = `${referenceElWidth}px`;
|
152
|
-
};
|
153
|
-
this.setMaxScrollerHeight = () => {
|
154
|
-
const { scrollerEl } = this;
|
155
|
-
if (!scrollerEl) {
|
156
|
-
return;
|
157
|
-
}
|
158
|
-
this.reposition(true);
|
159
|
-
const maxScrollerHeight = this.getMaxScrollerHeight();
|
160
|
-
scrollerEl.style.maxHeight = maxScrollerHeight > 0 ? `${maxScrollerHeight}px` : "";
|
161
|
-
this.reposition(true);
|
162
|
-
};
|
163
|
-
this.setScrollerAndTransitionEl = (el) => {
|
164
|
-
this.resizeObserver.observe(el);
|
165
|
-
this.scrollerEl = el;
|
166
|
-
this.transitionEl = el;
|
167
|
-
openCloseComponent.connectOpenCloseComponent(this);
|
168
|
-
};
|
169
|
-
this.setReferenceEl = (el) => {
|
170
|
-
this.referenceEl = el;
|
171
|
-
floatingUi.connectFloatingUI(this, this.referenceEl, this.floatingEl);
|
172
|
-
this.resizeObserver.observe(el);
|
173
|
-
};
|
174
|
-
this.setFloatingEl = (el) => {
|
175
|
-
this.floatingEl = el;
|
176
|
-
floatingUi.connectFloatingUI(this, this.referenceEl, this.floatingEl);
|
177
|
-
};
|
178
|
-
this.keyDownHandler = (event) => {
|
179
|
-
const target = event.target;
|
180
|
-
if (target !== this.referenceEl) {
|
181
|
-
return;
|
182
|
-
}
|
183
|
-
const { defaultPrevented, key: key$1 } = event;
|
184
|
-
if (defaultPrevented) {
|
185
|
-
return;
|
186
|
-
}
|
187
|
-
if (this.open) {
|
188
|
-
if (key$1 === "Escape") {
|
189
|
-
this.closeCalciteDropdown();
|
190
|
-
event.preventDefault();
|
191
|
-
return;
|
192
|
-
}
|
193
|
-
else if (event.shiftKey && key$1 === "Tab") {
|
194
|
-
this.closeCalciteDropdown();
|
195
|
-
event.preventDefault();
|
196
|
-
return;
|
197
|
-
}
|
198
|
-
}
|
199
|
-
if (key.isActivationKey(key$1)) {
|
200
|
-
this.openCalciteDropdown();
|
201
|
-
event.preventDefault();
|
202
|
-
}
|
203
|
-
else if (key$1 === "Escape") {
|
204
|
-
this.closeCalciteDropdown();
|
205
|
-
event.preventDefault();
|
206
|
-
}
|
207
|
-
};
|
208
|
-
this.focusOnFirstActiveOrFirstItem = () => {
|
209
|
-
this.getFocusableElement(this.items.find((item) => item.selected) || this.items[0]);
|
210
|
-
};
|
211
|
-
this.toggleOpenEnd = () => {
|
212
|
-
this.focusOnFirstActiveOrFirstItem();
|
213
|
-
this.el.removeEventListener("calciteDropdownOpen", this.toggleOpenEnd);
|
214
|
-
};
|
215
|
-
this.openCalciteDropdown = () => {
|
216
|
-
this.open = !this.open;
|
217
|
-
if (this.open) {
|
218
|
-
this.el.addEventListener("calciteDropdownOpen", this.toggleOpenEnd);
|
219
|
-
}
|
220
|
-
};
|
221
|
-
}
|
222
|
-
activeHandler(value) {
|
223
|
-
this.open = value;
|
224
|
-
}
|
225
|
-
openHandler(value) {
|
226
|
-
if (!this.disabled) {
|
227
|
-
if (value) {
|
228
|
-
this.reposition(true);
|
229
|
-
}
|
230
|
-
else {
|
231
|
-
floatingUi.updateAfterClose(this.floatingEl);
|
232
|
-
}
|
233
|
-
this.active = value;
|
234
|
-
return;
|
235
|
-
}
|
236
|
-
if (!value) {
|
237
|
-
floatingUi.updateAfterClose(this.floatingEl);
|
238
|
-
}
|
239
|
-
this.open = false;
|
240
|
-
}
|
241
|
-
handleDisabledChange(value) {
|
242
|
-
if (!value) {
|
243
|
-
this.open = false;
|
244
|
-
}
|
245
|
-
}
|
246
|
-
flipPlacementsHandler() {
|
247
|
-
this.setFilteredPlacements();
|
248
|
-
this.reposition(true);
|
249
|
-
}
|
250
|
-
maxItemsHandler() {
|
251
|
-
this.setMaxScrollerHeight();
|
252
|
-
}
|
253
|
-
overlayPositioningHandler() {
|
254
|
-
this.reposition(true);
|
255
|
-
}
|
256
|
-
placementHandler() {
|
257
|
-
this.reposition(true);
|
258
|
-
}
|
259
|
-
//--------------------------------------------------------------------------
|
260
|
-
//
|
261
|
-
// Lifecycle
|
262
|
-
//
|
263
|
-
//--------------------------------------------------------------------------
|
264
|
-
connectedCallback() {
|
265
|
-
var _a;
|
266
|
-
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
|
267
|
-
this.setFilteredPlacements();
|
268
|
-
this.reposition(true);
|
269
|
-
if (this.open) {
|
270
|
-
this.openHandler(this.open);
|
271
|
-
}
|
272
|
-
if (this.active) {
|
273
|
-
this.activeHandler(this.active);
|
274
|
-
}
|
275
|
-
openCloseComponent.connectOpenCloseComponent(this);
|
276
|
-
}
|
277
|
-
componentDidLoad() {
|
278
|
-
this.reposition(true);
|
279
|
-
}
|
280
|
-
componentDidRender() {
|
281
|
-
interactive.updateHostInteraction(this);
|
282
|
-
}
|
283
|
-
disconnectedCallback() {
|
284
|
-
var _a, _b;
|
285
|
-
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
286
|
-
floatingUi.disconnectFloatingUI(this, this.referenceEl, this.floatingEl);
|
287
|
-
(_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
288
|
-
openCloseComponent.disconnectOpenCloseComponent(this);
|
289
|
-
}
|
290
|
-
render() {
|
291
|
-
const { open, guid } = this;
|
292
|
-
return (index.h(index.Host, null, index.h("div", { class: "calcite-dropdown-trigger-container", id: `${guid}-menubutton`, onClick: this.openCalciteDropdown, onKeyDown: this.keyDownHandler, ref: this.setReferenceEl }, index.h("slot", { "aria-controls": `${guid}-menu`, "aria-expanded": dom.toAriaBoolean(open), "aria-haspopup": "menu", name: SLOTS.dropdownTrigger, onSlotchange: this.updateTriggers })), index.h("div", { "aria-hidden": dom.toAriaBoolean(!open), class: "calcite-dropdown-wrapper", ref: this.setFloatingEl }, index.h("div", { "aria-labelledby": `${guid}-menubutton`, class: {
|
293
|
-
["calcite-dropdown-content"]: true,
|
294
|
-
[floatingUi.FloatingCSS.animation]: true,
|
295
|
-
[floatingUi.FloatingCSS.animationActive]: open
|
296
|
-
}, id: `${guid}-menu`, ref: this.setScrollerAndTransitionEl, role: "menu" }, index.h("slot", { onSlotchange: this.updateGroups })))));
|
297
|
-
}
|
298
|
-
//--------------------------------------------------------------------------
|
299
|
-
//
|
300
|
-
// Public Methods
|
301
|
-
//
|
302
|
-
//--------------------------------------------------------------------------
|
303
|
-
/**
|
304
|
-
* Updates the position of the component.
|
305
|
-
*
|
306
|
-
* @param delayed
|
307
|
-
*/
|
308
|
-
async reposition(delayed = false) {
|
309
|
-
const { floatingEl, referenceEl, placement, overlayPositioning, filteredFlipPlacements } = this;
|
310
|
-
return floatingUi.reposition(this, {
|
311
|
-
floatingEl,
|
312
|
-
referenceEl,
|
313
|
-
overlayPositioning,
|
314
|
-
placement,
|
315
|
-
flipPlacements: filteredFlipPlacements,
|
316
|
-
type: "menu"
|
317
|
-
}, delayed);
|
318
|
-
}
|
319
|
-
closeCalciteDropdownOnClick(event) {
|
320
|
-
if (!dom.isPrimaryPointerButton(event) || !this.open || event.composedPath().includes(this.el)) {
|
321
|
-
return;
|
322
|
-
}
|
323
|
-
this.closeCalciteDropdown(false);
|
324
|
-
}
|
325
|
-
closeCalciteDropdownOnEvent(event) {
|
326
|
-
this.closeCalciteDropdown();
|
327
|
-
event.stopPropagation();
|
328
|
-
}
|
329
|
-
closeCalciteDropdownOnOpenEvent(event) {
|
330
|
-
if (event.composedPath().includes(this.el)) {
|
331
|
-
return;
|
332
|
-
}
|
333
|
-
this.open = false;
|
334
|
-
}
|
335
|
-
mouseEnterHandler() {
|
336
|
-
if (this.type === "hover") {
|
337
|
-
this.openCalciteDropdown();
|
338
|
-
}
|
339
|
-
}
|
340
|
-
mouseLeaveHandler() {
|
341
|
-
if (this.type === "hover") {
|
342
|
-
this.closeCalciteDropdown();
|
343
|
-
}
|
344
|
-
}
|
345
|
-
calciteInternalDropdownItemKeyEvent(event) {
|
346
|
-
const { keyboardEvent } = event.detail;
|
347
|
-
// handle edge
|
348
|
-
const target = keyboardEvent.target;
|
349
|
-
const itemToFocus = target.nodeName !== "A" ? target : target.parentNode;
|
350
|
-
const isFirstItem = this.itemIndex(itemToFocus) === 0;
|
351
|
-
const isLastItem = this.itemIndex(itemToFocus) === this.items.length - 1;
|
352
|
-
switch (keyboardEvent.key) {
|
353
|
-
case "Tab":
|
354
|
-
if (isLastItem && !keyboardEvent.shiftKey) {
|
355
|
-
this.closeCalciteDropdown();
|
356
|
-
}
|
357
|
-
else if (isFirstItem && keyboardEvent.shiftKey) {
|
358
|
-
this.closeCalciteDropdown();
|
359
|
-
}
|
360
|
-
else if (keyboardEvent.shiftKey) {
|
361
|
-
this.focusPrevItem(itemToFocus);
|
362
|
-
}
|
363
|
-
else {
|
364
|
-
this.focusNextItem(itemToFocus);
|
365
|
-
}
|
366
|
-
break;
|
367
|
-
case "ArrowDown":
|
368
|
-
this.focusNextItem(itemToFocus);
|
369
|
-
break;
|
370
|
-
case "ArrowUp":
|
371
|
-
this.focusPrevItem(itemToFocus);
|
372
|
-
break;
|
373
|
-
case "Home":
|
374
|
-
this.focusFirstItem();
|
375
|
-
break;
|
376
|
-
case "End":
|
377
|
-
this.focusLastItem();
|
378
|
-
break;
|
379
|
-
}
|
380
|
-
event.stopPropagation();
|
381
|
-
}
|
382
|
-
handleItemSelect(event) {
|
383
|
-
this.updateSelectedItems();
|
384
|
-
event.stopPropagation();
|
385
|
-
this.calciteDropdownSelect.emit({
|
386
|
-
item: event.detail.requestedDropdownItem
|
387
|
-
});
|
388
|
-
if (!this.disableCloseOnSelect ||
|
389
|
-
event.detail.requestedDropdownGroup.selectionMode === "none") {
|
390
|
-
this.closeCalciteDropdown();
|
391
|
-
}
|
392
|
-
event.stopPropagation();
|
393
|
-
}
|
394
|
-
onBeforeOpen() {
|
395
|
-
this.calciteDropdownBeforeOpen.emit();
|
396
|
-
}
|
397
|
-
onOpen() {
|
398
|
-
this.calciteDropdownOpen.emit();
|
399
|
-
}
|
400
|
-
onBeforeClose() {
|
401
|
-
this.calciteDropdownBeforeClose.emit();
|
402
|
-
}
|
403
|
-
onClose() {
|
404
|
-
this.calciteDropdownClose.emit();
|
405
|
-
}
|
406
|
-
updateSelectedItems() {
|
407
|
-
this.selectedItems = this.items.filter((item) => item.selected);
|
408
|
-
}
|
409
|
-
getMaxScrollerHeight() {
|
410
|
-
const { maxItems, items } = this;
|
411
|
-
let itemsToProcess = 0;
|
412
|
-
let maxScrollerHeight = 0;
|
413
|
-
let groupHeaderHeight;
|
414
|
-
this.groups.forEach((group) => {
|
415
|
-
if (maxItems > 0 && itemsToProcess < maxItems) {
|
416
|
-
Array.from(group.children).forEach((item, index) => {
|
417
|
-
if (index === 0) {
|
418
|
-
if (isNaN(groupHeaderHeight)) {
|
419
|
-
groupHeaderHeight = item.offsetTop;
|
420
|
-
}
|
421
|
-
maxScrollerHeight += groupHeaderHeight;
|
422
|
-
}
|
423
|
-
if (itemsToProcess < maxItems) {
|
424
|
-
maxScrollerHeight += item.offsetHeight;
|
425
|
-
itemsToProcess += 1;
|
426
|
-
}
|
427
|
-
});
|
428
|
-
}
|
429
|
-
});
|
430
|
-
return items.length > maxItems ? maxScrollerHeight : 0;
|
431
|
-
}
|
432
|
-
closeCalciteDropdown(focusTrigger = true) {
|
433
|
-
this.open = false;
|
434
|
-
if (focusTrigger) {
|
435
|
-
dom.focusElement(this.triggers[0]);
|
436
|
-
}
|
437
|
-
}
|
438
|
-
focusFirstItem() {
|
439
|
-
const firstItem = this.items[0];
|
440
|
-
this.getFocusableElement(firstItem);
|
441
|
-
}
|
442
|
-
focusLastItem() {
|
443
|
-
const lastItem = this.items[this.items.length - 1];
|
444
|
-
this.getFocusableElement(lastItem);
|
445
|
-
}
|
446
|
-
focusNextItem(el) {
|
447
|
-
const index = this.itemIndex(el);
|
448
|
-
const nextItem = this.items[index + 1] || this.items[0];
|
449
|
-
this.getFocusableElement(nextItem);
|
450
|
-
}
|
451
|
-
focusPrevItem(el) {
|
452
|
-
const index = this.itemIndex(el);
|
453
|
-
const prevItem = this.items[index - 1] || this.items[this.items.length - 1];
|
454
|
-
this.getFocusableElement(prevItem);
|
455
|
-
}
|
456
|
-
itemIndex(el) {
|
457
|
-
return this.items.indexOf(el);
|
458
|
-
}
|
459
|
-
getFocusableElement(item) {
|
460
|
-
if (!item) {
|
461
|
-
return;
|
462
|
-
}
|
463
|
-
const target = item.attributes.isLink
|
464
|
-
? item.shadowRoot.querySelector("a")
|
465
|
-
: item;
|
466
|
-
dom.focusElement(target);
|
467
|
-
}
|
468
|
-
get el() { return index.getElement(this); }
|
469
|
-
static get watchers() { return {
|
470
|
-
"active": ["activeHandler"],
|
471
|
-
"open": ["openHandler"],
|
472
|
-
"disabled": ["handleDisabledChange"],
|
473
|
-
"flipPlacements": ["flipPlacementsHandler"],
|
474
|
-
"maxItems": ["maxItemsHandler"],
|
475
|
-
"overlayPositioning": ["overlayPositioningHandler"],
|
476
|
-
"placement": ["placementHandler"]
|
477
|
-
}; }
|
478
|
-
};
|
479
|
-
Dropdown.style = dropdownCss;
|
480
|
-
|
481
|
-
exports.calcite_dropdown = Dropdown;
|
@@ -1,99 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Copyright 2022 Esri
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
-
*/
|
6
|
-
'use strict';
|
7
|
-
|
8
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
9
|
-
|
10
|
-
const index = require('./index-c6979cbb.js');
|
11
|
-
const dom = require('./dom-4a580af6.js');
|
12
|
-
require('./resources-b56bce71.js');
|
13
|
-
require('./guid-84ac4d91.js');
|
14
|
-
|
15
|
-
/*!
|
16
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
17
|
-
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
18
|
-
* v1.0.0-beta.97
|
19
|
-
*/
|
20
|
-
const CSS = {
|
21
|
-
handle: "handle",
|
22
|
-
handleActivated: "handle--activated"
|
23
|
-
};
|
24
|
-
const ICONS = {
|
25
|
-
drag: "drag"
|
26
|
-
};
|
27
|
-
|
28
|
-
const handleCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{display:flex}.handle{display:flex;cursor:move;align-items:center;justify-content:center;align-self:stretch;border-style:none;background-color:transparent;outline-color:transparent;color:var(--calcite-ui-border-input);padding-block:0.75rem;padding-inline:0.25rem;line-height:0}.handle:hover{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}.handle:focus{color:var(--calcite-ui-text-1);outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}.handle--activated{background-color:var(--calcite-ui-foreground-3);color:var(--calcite-ui-text-1)}.handle calcite-icon{color:inherit}";
|
29
|
-
|
30
|
-
const Handle = class {
|
31
|
-
constructor(hostRef) {
|
32
|
-
index.registerInstance(this, hostRef);
|
33
|
-
this.calciteHandleNudge = index.createEvent(this, "calciteHandleNudge", 6);
|
34
|
-
// --------------------------------------------------------------------------
|
35
|
-
//
|
36
|
-
// Properties
|
37
|
-
//
|
38
|
-
// --------------------------------------------------------------------------
|
39
|
-
/**
|
40
|
-
* @internal
|
41
|
-
*/
|
42
|
-
this.activated = false;
|
43
|
-
/**
|
44
|
-
* Value for the button title attribute
|
45
|
-
*/
|
46
|
-
this.textTitle = "handle";
|
47
|
-
// --------------------------------------------------------------------------
|
48
|
-
//
|
49
|
-
// Private Methods
|
50
|
-
//
|
51
|
-
// --------------------------------------------------------------------------
|
52
|
-
this.handleKeyDown = (event) => {
|
53
|
-
switch (event.key) {
|
54
|
-
case " ":
|
55
|
-
this.activated = !this.activated;
|
56
|
-
event.preventDefault();
|
57
|
-
break;
|
58
|
-
case "ArrowUp":
|
59
|
-
case "ArrowDown":
|
60
|
-
if (!this.activated) {
|
61
|
-
return;
|
62
|
-
}
|
63
|
-
event.preventDefault();
|
64
|
-
const direction = event.key.toLowerCase().replace("arrow", "");
|
65
|
-
this.calciteHandleNudge.emit({ handle: this.el, direction });
|
66
|
-
break;
|
67
|
-
}
|
68
|
-
};
|
69
|
-
this.handleBlur = () => {
|
70
|
-
this.activated = false;
|
71
|
-
};
|
72
|
-
}
|
73
|
-
// --------------------------------------------------------------------------
|
74
|
-
//
|
75
|
-
// Methods
|
76
|
-
//
|
77
|
-
// --------------------------------------------------------------------------
|
78
|
-
/** Sets focus on the component. */
|
79
|
-
async setFocus() {
|
80
|
-
var _a;
|
81
|
-
(_a = this.handleButton) === null || _a === void 0 ? void 0 : _a.focus();
|
82
|
-
}
|
83
|
-
// --------------------------------------------------------------------------
|
84
|
-
//
|
85
|
-
// Render Methods
|
86
|
-
//
|
87
|
-
// --------------------------------------------------------------------------
|
88
|
-
render() {
|
89
|
-
return (
|
90
|
-
// Needs to be a span because of https://github.com/SortableJS/Sortable/issues/1486
|
91
|
-
index.h("span", { "aria-pressed": dom.toAriaBoolean(this.activated), class: { [CSS.handle]: true, [CSS.handleActivated]: this.activated }, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, ref: (el) => {
|
92
|
-
this.handleButton = el;
|
93
|
-
}, role: "button", tabindex: "0", title: this.textTitle }, index.h("calcite-icon", { icon: ICONS.drag, scale: "s" })));
|
94
|
-
}
|
95
|
-
get el() { return index.getElement(this); }
|
96
|
-
};
|
97
|
-
Handle.style = handleCss;
|
98
|
-
|
99
|
-
exports.calcite_handle = Handle;
|
@@ -1,95 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Copyright 2022 Esri
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
-
*/
|
6
|
-
'use strict';
|
7
|
-
|
8
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
9
|
-
|
10
|
-
const index = require('./index-c6979cbb.js');
|
11
|
-
const guid = require('./guid-84ac4d91.js');
|
12
|
-
|
13
|
-
const loaderCss = "@charset \"UTF-8\";@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{position:relative;margin-inline:auto;display:none;align-items:center;justify-content:center;opacity:1;min-block-size:var(--calcite-loader-size);font-size:var(--calcite-loader-font-size);stroke:var(--calcite-ui-brand);stroke-width:3;fill:none;transform:scale(1, 1);animation:loader-color-shift calc(var(--calcite-internal-animation-timing-slow) * 2) alternate-reverse infinite linear;padding-block:var(--calcite-loader-padding, 4rem)}:host([scale=s]){--calcite-loader-font-size:var(--calcite-font-size--2);--calcite-loader-size:2rem;--calcite-loader-size-inline:0.75rem}:host([scale=m]){--calcite-loader-font-size:var(--calcite-font-size-0);--calcite-loader-size:4rem;--calcite-loader-size-inline:1rem}:host([scale=l]){--calcite-loader-font-size:var(--calcite-font-size-2);--calcite-loader-size:6rem;--calcite-loader-size-inline:1.5rem}:host([no-padding]){padding-block:0px}:host{display:none}:host([active]){display:flex}.loader__text{display:block;text-align:center;font-size:var(--calcite-font-size--2);line-height:1rem;color:var(--calcite-ui-text-1);-webkit-margin-before:calc(var(--calcite-loader-size) + 1.5rem);margin-block-start:calc(var(--calcite-loader-size) + 1.5rem)}.loader__percentage{position:absolute;display:block;text-align:center;color:var(--calcite-ui-text-1);font-size:var(--calcite-loader-font-size);inline-size:var(--calcite-loader-size);inset-inline-start:50%;-webkit-margin-start:calc(var(--calcite-loader-size) / 2 * -1);margin-inline-start:calc(var(--calcite-loader-size) / 2 * -1);line-height:0.25;transform:scale(1, 1)}.loader__svgs{position:absolute;overflow:visible;opacity:1;inline-size:var(--calcite-loader-size);block-size:var(--calcite-loader-size);inset-inline-start:50%;-webkit-margin-start:calc(var(--calcite-loader-size) / 2 * -1);margin-inline-start:calc(var(--calcite-loader-size) / 2 * -1);transform:scale(1, 1)}.loader__svg{position:absolute;inset-block-start:0px;transform-origin:center;overflow:visible;inset-inline-start:0;inline-size:var(--calcite-loader-size);block-size:var(--calcite-loader-size);animation-iteration-count:infinite;animation-timing-function:linear;animation-name:loader-clockwise}@supports (display: grid){.loader__svg--1{animation-name:loader-offset-1}.loader__svg--2{animation-name:loader-offset-2}.loader__svg--3{animation-name:loader-offset-3}}:host([type=determinate]){animation:none;stroke:var(--calcite-ui-border-3)}:host([type=determinate]) .loader__svg--3{animation:none;stroke:var(--calcite-ui-brand);stroke-dasharray:150.79632;transform:rotate(-90deg);transition:all var(--calcite-internal-animation-timing-fast) linear}:host([inline]){position:relative;margin:0px;animation:none;stroke:currentColor;stroke-width:2;padding-block:0px;block-size:var(--calcite-loader-size-inline);min-block-size:var(--calcite-loader-size-inline);inline-size:var(--calcite-loader-size-inline);-webkit-margin-end:calc(var(--calcite-loader-size-inline) * 0.5);margin-inline-end:calc(var(--calcite-loader-size-inline) * 0.5);vertical-align:calc(var(--calcite-loader-size-inline) * -1 * 0.2)}:host([active][inline]){display:inline-block}:host([inline]) .loader__svgs{inset-block-start:0px;margin:0px;inset-inline-start:0;inline-size:var(--calcite-loader-size-inline);block-size:var(--calcite-loader-size-inline)}:host([inline]) .loader__svg{inline-size:var(--calcite-loader-size-inline);block-size:var(--calcite-loader-size-inline)}:host([complete]){opacity:0;transform:scale(0.75, 0.75);transform-origin:center;transition:opacity var(--calcite-internal-animation-timing-medium) linear 1000ms, transform var(--calcite-internal-animation-timing-medium) linear 1000ms}:host([complete]) .loader__svgs{opacity:0;transform:scale(0.75, 0.75);transform-origin:center;transition:opacity calc(180ms * var(--calcite-internal-duration-factor)) linear 800ms, transform calc(180ms * var(--calcite-internal-duration-factor)) linear 800ms}:host([complete]) .loader__percentage{color:var(--calcite-ui-brand);transform:scale(1.05, 1.05);transform-origin:center;transition:color var(--calcite-internal-animation-timing-medium) linear, transform var(--calcite-internal-animation-timing-medium) linear}.loader__svg--1{stroke-dasharray:27.9252444444% 139.6262222222%;animation-duration:calc(var(--calcite-internal-animation-timing-slow) * 2.4)}@keyframes loader-offset-1{0%{stroke-dasharray:27.9252444444% 251.3272%;stroke-dashoffset:0}50%{stroke-dasharray:139.6262222222% 139.6262222222%;stroke-dashoffset:-83.7757333333%}100%{stroke-dasharray:27.9252444444% 251.3272%;stroke-dashoffset:-279.2524444444%}}.loader__svg--2{stroke-dasharray:55.8504888889% 139.6262222222%;animation-duration:calc(var(--calcite-internal-animation-timing-slow) * 3.2)}@keyframes loader-offset-2{0%{stroke-dasharray:55.8504888889% 223.4019555556%;stroke-dashoffset:0}50%{stroke-dasharray:139.6262222222% 139.6262222222%;stroke-dashoffset:-97.7383555556%}100%{stroke-dasharray:55.8504888889% 223.4019555556%;stroke-dashoffset:-279.2524444444%}}.loader__svg--3{stroke-dasharray:13.9626222222% 139.6262222222%;animation-duration:calc(var(--calcite-internal-animation-timing-slow) * 3.867)}@keyframes loader-offset-3{0%{stroke-dasharray:13.9626222222% 265.2898222222%;stroke-dashoffset:0}50%{stroke-dasharray:139.6262222222% 139.6262222222%;stroke-dashoffset:-76.7944222222%}100%{stroke-dasharray:13.9626222222% 265.2898222222%;stroke-dashoffset:-279.2524444444%}}@keyframes loader-color-shift{0%{stroke:var(--calcite-ui-brand)}33%{stroke:var(--calcite-ui-brand-press)}66%{stroke:var(--calcite-ui-brand-hover)}100%{stroke:var(--calcite-ui-brand)}}@keyframes loader-clockwise{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
|
14
|
-
|
15
|
-
const Loader = class {
|
16
|
-
constructor(hostRef) {
|
17
|
-
index.registerInstance(this, hostRef);
|
18
|
-
//--------------------------------------------------------------------------
|
19
|
-
//
|
20
|
-
// Properties
|
21
|
-
//
|
22
|
-
//--------------------------------------------------------------------------
|
23
|
-
/** When `true`, the component is active. */
|
24
|
-
this.active = false;
|
25
|
-
/** When `true`, displays smaller and appears to the left of the text. */
|
26
|
-
this.inline = false;
|
27
|
-
/** Specifies the size of the component. */
|
28
|
-
this.scale = "m";
|
29
|
-
/** The component's value. Valid only for `"determinate"` indicators. Percent complete of 100. */
|
30
|
-
this.value = 0;
|
31
|
-
/** Text that displays under the component's indicator. */
|
32
|
-
this.text = "";
|
33
|
-
/**
|
34
|
-
* Disables spacing around the component.
|
35
|
-
*
|
36
|
-
* @deprecated Use `--calcite-loader-padding` CSS variable instead.
|
37
|
-
*/
|
38
|
-
this.noPadding = false;
|
39
|
-
}
|
40
|
-
//--------------------------------------------------------------------------
|
41
|
-
//
|
42
|
-
// Lifecycle
|
43
|
-
//
|
44
|
-
//--------------------------------------------------------------------------
|
45
|
-
render() {
|
46
|
-
const { el, inline, label, scale, text, type, value } = this;
|
47
|
-
const id = el.id || guid.guid();
|
48
|
-
const radiusRatio = 0.45;
|
49
|
-
const size = inline ? this.getInlineSize(scale) : this.getSize(scale);
|
50
|
-
const radius = size * radiusRatio;
|
51
|
-
const viewbox = `0 0 ${size} ${size}`;
|
52
|
-
const isDeterminate = type === "determinate";
|
53
|
-
const circumference = 2 * radius * Math.PI;
|
54
|
-
const progress = (value / 100) * circumference;
|
55
|
-
const remaining = circumference - progress;
|
56
|
-
const valueNow = Math.floor(value);
|
57
|
-
const hostAttributes = {
|
58
|
-
"aria-valuenow": valueNow,
|
59
|
-
"aria-valuemin": 0,
|
60
|
-
"aria-valuemax": 100,
|
61
|
-
complete: valueNow === 100
|
62
|
-
};
|
63
|
-
const svgAttributes = { r: radius, cx: size / 2, cy: size / 2 };
|
64
|
-
const determinateStyle = { "stroke-dasharray": `${progress} ${remaining}` };
|
65
|
-
return (index.h(index.Host, Object.assign({ "aria-label": label, id: id, role: "progressbar" }, (isDeterminate ? hostAttributes : {})), index.h("div", { class: "loader__svgs" }, index.h("svg", { class: "loader__svg loader__svg--1", viewBox: viewbox }, index.h("circle", Object.assign({}, svgAttributes))), index.h("svg", { class: "loader__svg loader__svg--2", viewBox: viewbox }, index.h("circle", Object.assign({}, svgAttributes))), index.h("svg", Object.assign({ class: "loader__svg loader__svg--3", viewBox: viewbox }, (isDeterminate ? { style: determinateStyle } : {})), index.h("circle", Object.assign({}, svgAttributes)))), text && index.h("div", { class: "loader__text" }, text), isDeterminate && index.h("div", { class: "loader__percentage" }, value)));
|
66
|
-
}
|
67
|
-
//--------------------------------------------------------------------------
|
68
|
-
//
|
69
|
-
// Private Methods
|
70
|
-
//
|
71
|
-
//--------------------------------------------------------------------------
|
72
|
-
/**
|
73
|
-
* Return the proper sizes based on the scale property
|
74
|
-
*
|
75
|
-
* @param scale
|
76
|
-
*/
|
77
|
-
getSize(scale) {
|
78
|
-
return {
|
79
|
-
s: 32,
|
80
|
-
m: 56,
|
81
|
-
l: 80
|
82
|
-
}[scale];
|
83
|
-
}
|
84
|
-
getInlineSize(scale) {
|
85
|
-
return {
|
86
|
-
s: 12,
|
87
|
-
m: 16,
|
88
|
-
l: 20
|
89
|
-
}[scale];
|
90
|
-
}
|
91
|
-
get el() { return index.getElement(this); }
|
92
|
-
};
|
93
|
-
Loader.style = loaderCss;
|
94
|
-
|
95
|
-
exports.calcite_loader = Loader;
|