@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.
Files changed (156) hide show
  1. package/dist/assets/arcgis-pdf-creator/PDFCreator.js +6 -3
  2. package/dist/assets/arcgis-pdf-creator/PDFCreator_jsPDF.js +1 -1
  3. package/dist/assets/arcgis-pdf-creator/PDFCreator_pdf_lib.js +1 -1
  4. package/dist/assets/arcgis-pdf-creator/PDFLabels.js +54 -3
  5. package/dist/assets/arcgis-pdf-creator/grid.js +1 -1
  6. package/dist/assets/data/images/grid.png +0 -0
  7. package/dist/assets/data/images/horizontal.png +0 -0
  8. package/dist/assets/data/images/vertical.png +0 -0
  9. package/dist/assets/t9n/crowdsource-manager/resources.json +7 -1
  10. package/dist/assets/t9n/crowdsource-manager/resources_en.json +7 -1
  11. package/dist/cjs/buffer-tools_6.cjs.entry.js +85 -85
  12. package/dist/cjs/{calcite-block_2.cjs.entry.js → calcite-action-bar_4.cjs.entry.js} +307 -18
  13. package/dist/cjs/{calcite-action.cjs.entry.js → calcite-action_2.cjs.entry.js} +84 -1
  14. package/dist/cjs/{calcite-combobox_3.cjs.entry.js → calcite-chip_4.cjs.entry.js} +187 -61
  15. package/dist/cjs/{calcite-dropdown-group_4.cjs.entry.js → calcite-dropdown_5.cjs.entry.js} +467 -1
  16. package/dist/cjs/calcite-input-message_5.cjs.entry.js +283 -283
  17. package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
  18. package/dist/cjs/{calcite-action-bar_2.cjs.entry.js → calcite-tooltip.cjs.entry.js} +2 -208
  19. package/dist/cjs/crowdsource-manager.cjs.entry.js +88 -14
  20. package/dist/cjs/{downloadUtils-b85476e8.js → downloadUtils-9359e9ff.js} +1218 -1127
  21. package/dist/cjs/{index.es-3ba50626.js → index.es-9c0d0ed6.js} +10682 -10682
  22. package/dist/cjs/{interfaces-17c631bf.js → interfaces-cac36920.js} +6 -0
  23. package/dist/cjs/layer-table_2.cjs.entry.js +512 -0
  24. package/dist/cjs/loader.cjs.js +30 -30
  25. package/dist/cjs/{mapViewUtils-df63bfa4.js → mapViewUtils-090f4d4d.js} +24 -24
  26. package/dist/cjs/public-notification.cjs.entry.js +69 -49
  27. package/dist/cjs/solution-configuration.cjs.entry.js +2 -2
  28. package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
  29. package/dist/cjs/{solution-store-b86759b2.js → solution-store-d28c332e.js} +1 -1
  30. package/dist/cjs/solutions-components.cjs.js +31 -31
  31. package/dist/collection/assets/arcgis-pdf-creator/PDFCreator.js +6 -3
  32. package/dist/collection/assets/arcgis-pdf-creator/PDFCreator_jsPDF.js +1 -1
  33. package/dist/collection/assets/arcgis-pdf-creator/PDFCreator_pdf_lib.js +1 -1
  34. package/dist/collection/assets/arcgis-pdf-creator/PDFLabels.js +54 -3
  35. package/dist/collection/assets/arcgis-pdf-creator/grid.js +1 -1
  36. package/dist/collection/components/crowdsource-manager/crowdsource-manager.css +122 -0
  37. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +130 -14
  38. package/dist/collection/components/layer-table/layer-table.css +2 -70
  39. package/dist/collection/components/layer-table/layer-table.js +66 -106
  40. package/dist/collection/components/map-card/map-card.css +4 -7
  41. package/dist/collection/components/map-card/map-card.js +44 -10
  42. package/dist/collection/components/map-draw-tools/map-draw-tools.js +1 -1
  43. package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
  44. package/dist/collection/components/public-notification/public-notification.js +45 -27
  45. package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +1 -1
  46. package/dist/collection/demos/crowdsource-manager.html +14 -41
  47. package/dist/collection/utils/csvDownload.js +41 -0
  48. package/dist/collection/utils/csvDownload.ts +42 -0
  49. package/dist/collection/utils/csvUtils.js +6 -23
  50. package/dist/collection/utils/csvUtils.ts +8 -27
  51. package/dist/collection/utils/downloadUtils.js +30 -14
  52. package/dist/collection/utils/downloadUtils.ts +36 -14
  53. package/dist/collection/utils/interfaces.js +6 -0
  54. package/dist/collection/utils/interfaces.ts +6 -0
  55. package/dist/collection/utils/pdfUtils.js +9 -6
  56. package/dist/collection/utils/pdfUtils.ts +13 -8
  57. package/dist/collection/utils/test/csvUtils.spec.tsx +56 -0
  58. package/dist/collection/utils/test/downloadUtils.spec.tsx +133 -0
  59. package/dist/components/crowdsource-manager.js +293 -17
  60. package/dist/components/downloadUtils.js +133 -42
  61. package/dist/components/interfaces3.js +7 -1
  62. package/dist/components/layer-table.js +1 -443
  63. package/dist/components/layer-table2.js +429 -0
  64. package/dist/components/map-card.js +1 -339
  65. package/dist/{esm/map-card.entry.js → components/map-card2.js} +118 -22
  66. package/dist/components/map-draw-tools2.js +16 -16
  67. package/dist/components/map-layer-picker2.js +1 -1
  68. package/dist/components/map-select-tools2.js +38 -38
  69. package/dist/components/public-notification.js +102 -82
  70. package/dist/components/queryUtils.js +10 -10
  71. package/dist/components/refine-selection-tools2.js +3 -3
  72. package/dist/components/refine-selection2.js +1 -1
  73. package/dist/components/solution-resource-item2.js +1 -1
  74. package/dist/components/solution-store.js +1 -1
  75. package/dist/esm/buffer-tools_6.entry.js +76 -76
  76. package/dist/esm/{calcite-block_2.entry.js → calcite-action-bar_4.entry.js} +307 -20
  77. package/dist/esm/{calcite-action.entry.js → calcite-action_2.entry.js} +84 -2
  78. package/dist/esm/{calcite-combobox_3.entry.js → calcite-chip_4.entry.js} +181 -56
  79. package/dist/esm/{calcite-dropdown-group_4.entry.js → calcite-dropdown_5.entry.js} +468 -3
  80. package/dist/esm/calcite-input-message_5.entry.js +275 -275
  81. package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
  82. package/dist/esm/{calcite-action-bar_2.entry.js → calcite-tooltip.entry.js} +4 -209
  83. package/dist/esm/crowdsource-manager.entry.js +88 -14
  84. package/dist/esm/{downloadUtils-f278742f.js → downloadUtils-a8f139c5.js} +1214 -1123
  85. package/dist/esm/{index.es-6f3a1143.js → index.es-a75412ff.js} +10596 -10596
  86. package/dist/esm/{interfaces-d0d83efa.js → interfaces-cd4054e5.js} +7 -1
  87. package/dist/esm/layer-table_2.entry.js +507 -0
  88. package/dist/esm/loader.js +26 -26
  89. package/dist/esm/{mapViewUtils-bd1809f0.js → mapViewUtils-8ffcd36d.js} +12 -12
  90. package/dist/esm/public-notification.entry.js +65 -45
  91. package/dist/esm/solution-configuration.entry.js +2 -2
  92. package/dist/esm/solution-contents_3.entry.js +2 -2
  93. package/dist/esm/{solution-store-477288ac.js → solution-store-1b67f2c8.js} +1 -1
  94. package/dist/esm/solutions-components.js +26 -26
  95. package/dist/solutions-components/demos/crowdsource-manager.html +14 -41
  96. package/dist/solutions-components/{p-dd11eeb2.js → p-1395b0ef.js} +1 -1
  97. package/dist/solutions-components/{p-cbac29fb.entry.js → p-1affd711.entry.js} +18 -18
  98. package/dist/solutions-components/p-30de8da1.entry.js +17 -0
  99. package/dist/solutions-components/{p-91cad71e.entry.js → p-439c878d.entry.js} +3 -9
  100. package/dist/solutions-components/{p-03e2c6fd.js → p-765a27f3.js} +60 -60
  101. package/dist/solutions-components/p-813a04c3.entry.js +6 -0
  102. package/dist/solutions-components/{p-9e8a371f.entry.js → p-874b39a7.entry.js} +3 -3
  103. package/dist/solutions-components/p-8cece97f.js +21 -0
  104. package/dist/solutions-components/{p-dd0241fb.entry.js → p-97aa7211.entry.js} +1 -1
  105. package/dist/solutions-components/{p-0e459cc7.entry.js → p-a955a3e6.entry.js} +10 -4
  106. package/dist/solutions-components/{p-40c12650.js → p-bb64bd47.js} +453 -437
  107. package/dist/solutions-components/{p-70e1d4d8.entry.js → p-c392dd95.entry.js} +17 -17
  108. package/dist/solutions-components/p-ca386a72.entry.js +6 -0
  109. package/dist/solutions-components/p-d47d74a6.entry.js +23 -0
  110. package/dist/solutions-components/p-db846ee2.entry.js +11 -0
  111. package/dist/solutions-components/{p-88e5a76d.js → p-dc53c9c1.js} +36 -36
  112. package/dist/solutions-components/p-e1c93241.entry.js +6 -0
  113. package/dist/solutions-components/{p-4cbaf0f1.entry.js → p-e6d235d6.entry.js} +1 -1
  114. package/dist/solutions-components/solutions-components.esm.js +6 -6
  115. package/dist/solutions-components/utils/csvDownload.ts +42 -0
  116. package/dist/solutions-components/utils/csvUtils.ts +8 -27
  117. package/dist/solutions-components/utils/downloadUtils.ts +36 -14
  118. package/dist/solutions-components/utils/interfaces.ts +6 -0
  119. package/dist/solutions-components/utils/pdfUtils.ts +13 -8
  120. package/dist/solutions-components/utils/test/csvUtils.spec.tsx +56 -0
  121. package/dist/solutions-components/utils/test/downloadUtils.spec.tsx +133 -0
  122. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +39 -0
  123. package/dist/types/components/layer-table/layer-table.d.ts +35 -48
  124. package/dist/types/components/map-card/map-card.d.ts +10 -6
  125. package/dist/types/components/public-notification/public-notification.d.ts +18 -6
  126. package/dist/types/components.d.ts +1621 -1601
  127. package/dist/types/preact.d.ts +2 -1
  128. package/dist/types/utils/csvDownload.d.ts +24 -0
  129. package/dist/types/utils/csvUtils.d.ts +2 -1
  130. package/dist/types/utils/downloadUtils.d.ts +25 -0
  131. package/dist/types/utils/interfaces.d.ts +5 -0
  132. package/dist/types/utils/pdfUtils.d.ts +2 -1
  133. package/package.json +4 -4
  134. package/dist/cjs/calcite-chip.cjs.entry.js +0 -142
  135. package/dist/cjs/calcite-dropdown.cjs.entry.js +0 -481
  136. package/dist/cjs/calcite-handle.cjs.entry.js +0 -99
  137. package/dist/cjs/calcite-loader.cjs.entry.js +0 -95
  138. package/dist/cjs/layer-table.cjs.entry.js +0 -317
  139. package/dist/cjs/map-card.cjs.entry.js +0 -252
  140. package/dist/esm/calcite-chip.entry.js +0 -138
  141. package/dist/esm/calcite-dropdown.entry.js +0 -477
  142. package/dist/esm/calcite-handle.entry.js +0 -95
  143. package/dist/esm/calcite-loader.entry.js +0 -91
  144. package/dist/esm/layer-table.entry.js +0 -313
  145. package/dist/solutions-components/p-045d3988.entry.js +0 -12
  146. package/dist/solutions-components/p-11132485.entry.js +0 -11
  147. package/dist/solutions-components/p-15b43c29.entry.js +0 -11
  148. package/dist/solutions-components/p-5034aabc.entry.js +0 -11
  149. package/dist/solutions-components/p-6f012424.entry.js +0 -6
  150. package/dist/solutions-components/p-7fd10eb3.entry.js +0 -11
  151. package/dist/solutions-components/p-a57ef371.entry.js +0 -6
  152. package/dist/solutions-components/p-bc39f296.entry.js +0 -6
  153. package/dist/solutions-components/p-c93d8e80.entry.js +0 -6
  154. package/dist/solutions-components/p-dbc9a5a8.js +0 -21
  155. package/dist/solutions-components/p-f5c70be2.entry.js +0 -6
  156. package/dist/solutions-components/p-f6b17cc6.entry.js +0 -11
@@ -438,8 +438,9 @@ declare module "preact/src/jsx" {
438
438
 
439
439
  "list-item": JSX.SolutionsListItem & JSXInternal.HTMLAttributes<HTMLSolutionsListItemElement>
440
440
 
441
- "map-card": Omit<JSX.SolutionsMapCard, "onExpandMap"> & JSXInternal.HTMLAttributes<HTMLSolutionsMapCardElement> & {
441
+ "map-card": Omit<JSX.SolutionsMapCard, "onExpandMap" | "onMapChanged"> & JSXInternal.HTMLAttributes<HTMLSolutionsMapCardElement> & {
442
442
  "onexpandMap"?: (event: CustomEvent<any>) => void;
443
+ "onmapChanged"?: (event: CustomEvent<any>) => void;
443
444
  }
444
445
 
445
446
  "map-draw-tools": Omit<JSX.SolutionsMapDrawTools, "onSketchGraphicsChange"> & JSXInternal.HTMLAttributes<HTMLSolutionsMapDrawToolsElement> & {
@@ -0,0 +1,24 @@
1
+ /** @license
2
+ * Copyright 2022 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Download the CSV file
18
+ *
19
+ * @param title Title (without file extension) to use for file; defaults to "export"
20
+ * @param outputLines Lines of output to write to file
21
+ *
22
+ * @see {@link https://medium.com/@danny.pule/export-json-to-csv-file-using-javascript-a0b7bc5b00d2}
23
+ */
24
+ export declare function downloadCSVFile(title: string, outputLines: string[]): void;
@@ -16,6 +16,7 @@
16
16
  /**
17
17
  * Export a csv of the attributes from the features that match the provided ids
18
18
  *
19
+ * @param title Title to use for file
19
20
  * @param labels Labels to write
20
21
  */
21
- export declare function exportCSV(labels: string[][]): void;
22
+ export declare function exportCSV(title: string, labels: string[][]): void;
@@ -40,3 +40,28 @@ export declare function downloadCSV(selectionSetNames: string[], layer: __esri.F
40
40
  * @returns Promise resolving when function is done
41
41
  */
42
42
  export declare function downloadPDF(selectionSetNames: string[], layer: __esri.FeatureLayer, ids: number[], removeDuplicates: boolean, labelPageDescription: ILabel): Promise<void>;
43
+ /**
44
+ * Converts a set of fieldInfos into template lines.
45
+ *
46
+ * @param fieldInfos Layer's fieldInfos structure
47
+ * @param bypassFieldVisiblity Indicates if the configured fieldInfo visibility property should be ignored
48
+ * @return Label spec with lines separated by `lineSeparatorChar`
49
+ */
50
+ export declare function _convertPopupFieldsToLabelSpec(fieldInfos: __esri.FieldInfo[], bypassFieldVisiblity?: boolean): string;
51
+ /**
52
+ * Converts the text of a custom popup into a multiline label specification; conversion splits text into
53
+ * lines on <br>s, and removes HTML tags. It does not handle Arcade and related records.
54
+ *
55
+ * @param popupInfo Layer's popupInfo structure containing description, fieldInfos, and expressionInfos, e.g.,
56
+ * "<div style='text-align: left;'>{NAME}<br />{STREET}<br />{CITY}, {STATE} {ZIP} <br /></div>"
57
+ * @return Label spec with lines separated by `lineSeparatorChar`
58
+ */
59
+ export declare function _convertPopupTextToLabelSpec(popupInfo: string): string;
60
+ /**
61
+ * Creates a title from a list of selection set names.
62
+ *
63
+ * @param selectionSetNames Names to use in title
64
+ * @return Title composed of the selectionSetNames separated by commas; if there are no
65
+ * selection set names supplied, "download" is returned
66
+ */
67
+ export declare function _createTitle(selectionSetNames: string[]): string;
@@ -15,6 +15,11 @@
15
15
  */
16
16
  /// <reference types="arcgis-js-api" />
17
17
  import { IDeployFileCopyPath, IItemTemplate } from '@esri/solution-common';
18
+ export declare enum ELayoutMode {
19
+ GRID = "GRID",
20
+ HORIZONTAL = "HORIZONTAL",
21
+ VERTICAL = "VERTICAL"
22
+ }
18
23
  /**
19
24
  * Resource update types
20
25
  */
@@ -18,7 +18,8 @@ export { ILabel } from "../assets/arcgis-pdf-creator/PDFLabels";
18
18
  /**
19
19
  * Exports a PDF of labels.
20
20
  *
21
+ * @param title Title to use for file
21
22
  * @param labels Labels to write
22
23
  * @param labelPageDescription Page format to use for labels
23
24
  */
24
- export declare function exportPDF(labels: string[][], labelPageDescription: PDFLabels.ILabel): void;
25
+ export declare function exportPDF(title: string, labels: string[][], labelPageDescription: PDFLabels.ILabel): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solutions-components",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Web Components for Esri's Solutions Applications",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "@stencil/sass": "^2.0.0",
37
37
  "@stencil/store": "^2.0.1",
38
38
  "@types/arcgis-js-api": "^4.25.0-next.20221031",
39
- "@types/jest": "^27.0.3",
39
+ "@types/jest": "^27.5.2",
40
40
  "@types/node": "^16.11.11",
41
41
  "@types/puppeteer": "^5.4.2",
42
42
  "@typescript-eslint/eslint-plugin": "^5.4.0",
@@ -53,8 +53,8 @@
53
53
  "esri-loader": "3.4.0",
54
54
  "form-request-submit-polyfill": "^2.0.0",
55
55
  "gh-release": "^6.0.3",
56
- "jest": "^26.6.3",
57
- "jest-cli": "^26.6.3",
56
+ "jest": "^27.5.1",
57
+ "jest-cli": "^27.5.1",
58
58
  "pify": "^5.0.0",
59
59
  "prettier": "2.4.1",
60
60
  "puppeteer": "^13.5.1",
@@ -1,142 +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 guid = require('./guid-84ac4d91.js');
13
- const conditionalSlot = require('./conditionalSlot-baada7a3.js');
14
- require('./resources-b56bce71.js');
15
- require('./observers-5311faf8.js');
16
-
17
- /*!
18
- * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
19
- * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
20
- * v1.0.0-beta.97
21
- */
22
- const CSS = {
23
- title: "title",
24
- close: "close",
25
- imageContainer: "image-container",
26
- chipIcon: "chip-icon",
27
- closeIcon: "close-icon"
28
- };
29
- const TEXT = {
30
- close: "Close"
31
- };
32
- const SLOTS = {
33
- image: "image"
34
- };
35
- const ICONS = {
36
- close: "x"
37
- };
38
-
39
- const chipCss = "@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([scale=s]){block-size:1.5rem;font-size:var(--calcite-font-size--2);--calcite-chip-spacing-unit-l:0.5rem;--calcite-chip-spacing-unit-s:0.25rem}:host([scale=s]) .image-container{block-size:1.25rem;inline-size:1.25rem}:host([scale=m]){block-size:2rem;font-size:var(--calcite-font-size--1);--calcite-chip-spacing-unit-l:0.75rem;--calcite-chip-spacing-unit-s:6px}:host([scale=m]) .image-container{block-size:1.5rem;inline-size:1.5rem;-webkit-padding-start:0.25rem;padding-inline-start:0.25rem}:host([scale=l]){block-size:2.75rem;font-size:var(--calcite-font-size-0);--calcite-chip-spacing-unit-l:1rem;--calcite-chip-spacing-unit-s:0.5rem}:host([scale=l]) .image-container{block-size:2rem;inline-size:2rem;-webkit-padding-start:0.25rem;padding-inline-start:0.25rem}:host{box-sizing:border-box;display:inline-flex;cursor:default;align-items:center;border-radius:9999px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-1);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}.container{display:inline-flex;block-size:100%;max-inline-size:100%;align-items:center}.title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host span{padding-block:0;padding-inline:var(--calcite-chip-spacing-unit-l)}:host([closable]) span{padding-inline:var(--calcite-chip-spacing-unit-l) var(--calcite-chip-spacing-unit-s)}:host([icon]:not([closable])) span{padding-block:0;padding-inline:var(--calcite-chip-spacing-unit-l)}:host button{margin:0px;display:inline-flex;max-block-size:100%;min-block-size:100%;cursor:pointer;align-items:center;align-self:stretch;border-style:none;background-color:transparent;color:var(--calcite-ui-text-1);outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;-webkit-appearance:none;border-start-start-radius:0;border-start-end-radius:50px;border-end-end-radius:50px;border-end-start-radius:0;padding-block:0;padding-inline:var(--calcite-chip-spacing-unit-s);color:inherit;--calcite-chip-transparent-hover:var(--calcite-button-transparent-hover);--calcite-chip-transparent-press:var(--calcite-button-transparent-press)}:host button:hover{background-color:var(--calcite-chip-transparent-hover)}:host button:focus{background-color:var(--calcite-chip-transparent-hover);outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}:host button:active{background-color:var(--calcite-chip-transparent-press)}.image-container{display:inline-flex;overflow:hidden;border-radius:50%}:host slot[name=image]::slotted(*){display:flex;block-size:100%;inline-size:100%;overflow:hidden;border-radius:50%}.chip-icon{position:relative;margin-block:0px;display:inline-flex;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-margin-end:0;margin-inline-end:0;-webkit-margin-start:var(--calcite-chip-spacing-unit-l);margin-inline-start:var(--calcite-chip-spacing-unit-l);border-start-start-radius:0;border-start-end-radius:50px;border-end-end-radius:50px;border-end-start-radius:0}:host([color=blue]){border-color:transparent;background-color:var(--calcite-ui-info);color:var(--calcite-ui-text-inverse)}:host([color=red]){border-color:transparent;background-color:var(--calcite-ui-danger);color:var(--calcite-ui-text-inverse)}:host([color=yellow]){border-color:transparent;background-color:var(--calcite-ui-warning);color:#151515}:host([color=green]){border-color:transparent;background-color:var(--calcite-ui-success);color:#151515}:host([color=grey]){border-color:transparent;background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}:host([color=grey]) button,:host([color=grey]) .close-icon{color:var(--calcite-ui-text-3)}:host([color=grey]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-3))}:host([appearance=clear]),:host([appearance=transparent]){background-color:transparent;color:var(--calcite-ui-text-1)}:host([color=blue][appearance=clear]),:host([color=blue][appearance=transparent]){border-color:var(--calcite-ui-info)}:host([color=blue][appearance=clear]) .chip-icon,:host([color=blue][appearance=transparent]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-info))}:host([color=red][appearance=clear]),:host([color=red][appearance=transparent]){border-color:var(--calcite-ui-danger)}:host([color=red][appearance=clear]) .chip-icon,:host([color=red][appearance=transparent]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-danger))}:host([color=yellow][appearance=clear]),:host([color=yellow][appearance=transparent]){border-color:var(--calcite-ui-warning)}:host([color=yellow][appearance=clear]) .chip-icon,:host([color=yellow][appearance=transparent]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-warning))}:host([color=green][appearance=clear]),:host([color=green][appearance=transparent]){border-color:var(--calcite-ui-success)}:host([color=green][appearance=clear]) .chip-icon,:host([color=green][appearance=transparent]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-success))}:host([color=grey][appearance=clear]),:host([color=grey][appearance=transparent]){border-color:var(--calcite-ui-border-1)}:host([color=grey][appearance=clear]) .chip-icon,:host([color=grey][appearance=transparent]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-3))}:host([closed]){display:none}";
40
-
41
- const Chip = class {
42
- constructor(hostRef) {
43
- index.registerInstance(this, hostRef);
44
- this.calciteChipDismiss = index.createEvent(this, "calciteChipDismiss", 6);
45
- //--------------------------------------------------------------------------
46
- //
47
- // Public Properties
48
- //
49
- //--------------------------------------------------------------------------
50
- /** Specifies the appearance style of the component. */
51
- this.appearance = "solid";
52
- /** Specifies the color for the component. */
53
- this.color = "grey";
54
- /**
55
- * When `true`, a close button is added to the component.
56
- *
57
- * @deprecated use `closable` instead.
58
- */
59
- this.dismissible = false;
60
- /** When `true`, a close button is added to the component. */
61
- this.closable = false;
62
- /**
63
- * Accessible name for the component's close button.
64
- *
65
- * @default "Close"
66
- */
67
- this.dismissLabel = TEXT.close;
68
- /** When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). */
69
- this.iconFlipRtl = false;
70
- /** Specifies the size of the component. */
71
- this.scale = "m";
72
- /** When `true`, hides the component. */
73
- this.closed = false;
74
- // --------------------------------------------------------------------------
75
- //
76
- // Private Methods
77
- //
78
- // --------------------------------------------------------------------------
79
- this.closeClickHandler = (event) => {
80
- event.preventDefault();
81
- this.calciteChipDismiss.emit(this.el);
82
- this.closed = true;
83
- };
84
- this.guid = guid.guid();
85
- }
86
- handleDismissible(value) {
87
- this.closable = value;
88
- }
89
- handleClosable(value) {
90
- this.dismissible = value;
91
- }
92
- // --------------------------------------------------------------------------
93
- //
94
- // Lifecycle
95
- //
96
- // --------------------------------------------------------------------------
97
- connectedCallback() {
98
- conditionalSlot.connectConditionalSlotComponent(this);
99
- if (this.dismissible) {
100
- this.handleDismissible(this.dismissible);
101
- }
102
- if (this.closable) {
103
- this.handleClosable(this.closable);
104
- }
105
- }
106
- disconnectedCallback() {
107
- conditionalSlot.disconnectConditionalSlotComponent(this);
108
- }
109
- //--------------------------------------------------------------------------
110
- //
111
- // Public Methods
112
- //
113
- //--------------------------------------------------------------------------
114
- /** Sets focus on the component. */
115
- async setFocus() {
116
- var _a;
117
- (_a = this.closeButton) === null || _a === void 0 ? void 0 : _a.focus();
118
- }
119
- //--------------------------------------------------------------------------
120
- //
121
- // Render Methods
122
- //
123
- //--------------------------------------------------------------------------
124
- renderChipImage() {
125
- const { el } = this;
126
- const hasChipImage = dom.getSlotted(el, SLOTS.image);
127
- return hasChipImage ? (index.h("div", { class: CSS.imageContainer, key: "image" }, index.h("slot", { name: SLOTS.image }))) : null;
128
- }
129
- render() {
130
- const iconEl = (index.h("calcite-icon", { class: CSS.chipIcon, flipRtl: this.iconFlipRtl, icon: this.icon, scale: "s" }));
131
- const closeButton = (index.h("button", { "aria-describedby": this.guid, "aria-label": this.dismissLabel, class: CSS.close, onClick: this.closeClickHandler, ref: (el) => (this.closeButton = el) }, index.h("calcite-icon", { class: CSS.closeIcon, icon: ICONS.close, scale: "s" })));
132
- return (index.h("div", { class: "container" }, this.renderChipImage(), this.icon ? iconEl : null, index.h("span", { class: CSS.title, id: this.guid }, index.h("slot", null)), this.closable ? closeButton : null));
133
- }
134
- get el() { return index.getElement(this); }
135
- static get watchers() { return {
136
- "dismissible": ["handleDismissible"],
137
- "closable": ["handleClosable"]
138
- }; }
139
- };
140
- Chip.style = chipCss;
141
-
142
- exports.calcite_chip = Chip;