@esri/solutions-components 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/deduct-calculator.cjs.entry.js +1 -1
- package/dist/cjs/pci-calculator.cjs.entry.js +1 -1
- package/dist/cjs/{pciUtils-6a806ba4.js → pciUtils-423cfc68.js} +25 -7
- package/dist/collection/demos/deduct-calculator.html +2 -5
- package/dist/collection/demos/new-public-notification.html +6 -4
- package/dist/collection/utils/pciUtils.js +25 -7
- package/dist/collection/utils/pciUtils.ts +30 -7
- package/dist/components/ExpandToggle.js +110 -0
- package/dist/components/Heading.js +22 -0
- package/dist/components/_commonjsHelpers.js +22 -0
- package/dist/components/action-bar.js +276 -0
- package/dist/components/action-group.js +149 -0
- package/dist/components/action-menu.js +356 -0
- package/dist/components/action.js +214 -0
- package/dist/components/add-record-modal.d.ts +11 -0
- package/dist/components/add-record-modal.js +171 -0
- package/dist/components/array.js +15 -0
- package/dist/components/block.js +272 -0
- package/dist/components/buffer-tools.d.ts +11 -0
- package/dist/components/buffer-tools.js +11 -0
- package/dist/components/buffer-tools2.js +262 -0
- package/dist/components/button.js +263 -0
- package/dist/components/calcite-accordion-item.js +244 -0
- package/dist/components/calcite-accordion.js +180 -0
- package/dist/components/calcite-action-bar.js +11 -0
- package/dist/components/calcite-action-group.js +11 -0
- package/dist/components/calcite-action-menu.js +11 -0
- package/dist/components/calcite-action-pad.js +197 -0
- package/dist/components/calcite-action.js +11 -0
- package/dist/components/calcite-alert.js +297 -0
- package/dist/components/calcite-avatar.js +182 -0
- package/dist/components/calcite-block-section.js +155 -0
- package/dist/components/calcite-block.js +11 -0
- package/dist/components/calcite-button.js +11 -0
- package/dist/components/calcite-card.js +187 -0
- package/dist/components/calcite-checkbox.js +11 -0
- package/dist/components/calcite-chip.js +11 -0
- package/dist/components/calcite-color-picker-hex-input.js +11 -0
- package/dist/components/calcite-color-picker-swatch.js +11 -0
- package/dist/components/calcite-color-picker.js +1036 -0
- package/dist/components/calcite-combobox-item-group.js +75 -0
- package/dist/components/calcite-combobox-item.js +11 -0
- package/dist/components/calcite-combobox.js +11 -0
- package/dist/components/calcite-date-picker-day.js +11 -0
- package/dist/components/calcite-date-picker-month-header.js +11 -0
- package/dist/components/calcite-date-picker-month.js +11 -0
- package/dist/components/calcite-date-picker.js +11 -0
- package/dist/components/calcite-dropdown-group.js +11 -0
- package/dist/components/calcite-dropdown-item.js +11 -0
- package/dist/components/calcite-dropdown.js +11 -0
- package/dist/components/calcite-fab.js +144 -0
- package/dist/components/calcite-filter.js +195 -0
- package/dist/components/calcite-flow-item.js +243 -0
- package/dist/components/calcite-flow.js +147 -0
- package/dist/components/calcite-graph.js +11 -0
- package/dist/components/calcite-handle.js +11 -0
- package/dist/components/calcite-icon.js +11 -0
- package/dist/components/calcite-inline-editable.js +294 -0
- package/dist/components/calcite-input-date-picker.js +713 -0
- package/dist/components/calcite-input-message.js +11 -0
- package/dist/components/calcite-input-number.js +637 -0
- package/dist/components/calcite-input-text.js +400 -0
- package/dist/components/calcite-input-time-picker.js +434 -0
- package/dist/components/calcite-input.js +11 -0
- package/dist/components/calcite-label.js +11 -0
- package/dist/components/calcite-link.js +11 -0
- package/dist/components/calcite-list-item-group.js +65 -0
- package/dist/components/calcite-list-item.js +11 -0
- package/dist/components/calcite-list.js +11 -0
- package/dist/components/calcite-loader.js +11 -0
- package/dist/components/calcite-modal.js +11 -0
- package/dist/components/calcite-notice.js +11 -0
- package/dist/components/calcite-option-group.js +64 -0
- package/dist/components/calcite-option.js +11 -0
- package/dist/components/calcite-pagination.js +258 -0
- package/dist/components/calcite-panel.js +11 -0
- package/dist/components/calcite-pick-list-group.js +74 -0
- package/dist/components/calcite-pick-list-item.js +11 -0
- package/dist/components/calcite-pick-list.js +11 -0
- package/dist/components/calcite-popover-manager.js +94 -0
- package/dist/components/calcite-popover.js +11 -0
- package/dist/components/calcite-progress.js +11 -0
- package/dist/components/calcite-radio-button-group.js +132 -0
- package/dist/components/calcite-radio-button.js +310 -0
- package/dist/components/calcite-radio-group-item.js +11 -0
- package/dist/components/calcite-radio-group.js +11 -0
- package/dist/components/calcite-rating.js +201 -0
- package/dist/components/calcite-scrim.js +11 -0
- package/dist/components/calcite-select.js +11 -0
- package/dist/components/calcite-shell-center-row.js +100 -0
- package/dist/components/calcite-shell-panel.js +11 -0
- package/dist/components/calcite-shell.js +11 -0
- package/dist/components/calcite-slider.js +11 -0
- package/dist/components/calcite-sortable-list.js +202 -0
- package/dist/components/calcite-split-button.js +11 -0
- package/dist/components/calcite-stepper-item.js +271 -0
- package/dist/components/calcite-stepper.js +256 -0
- package/dist/components/calcite-switch.js +11 -0
- package/dist/components/calcite-tab-nav.js +11 -0
- package/dist/components/calcite-tab-title.js +11 -0
- package/dist/components/calcite-tab.js +11 -0
- package/dist/components/calcite-tabs.js +11 -0
- package/dist/components/calcite-tile-select-group.js +65 -0
- package/dist/components/calcite-tile-select.js +266 -0
- package/dist/components/calcite-tile.js +11 -0
- package/dist/components/calcite-time-picker.js +11 -0
- package/dist/components/calcite-tip-group.js +41 -0
- package/dist/components/calcite-tip-manager.js +223 -0
- package/dist/components/calcite-tip.js +162 -0
- package/dist/components/calcite-tooltip-manager.js +57 -0
- package/dist/components/calcite-tooltip.js +11 -0
- package/dist/components/calcite-tree-item.js +11 -0
- package/dist/components/calcite-tree.js +11 -0
- package/dist/components/calcite-value-list-item.js +11 -0
- package/dist/components/calcite-value-list.js +11 -0
- package/dist/components/card-manager.d.ts +11 -0
- package/dist/components/card-manager.js +143 -0
- package/dist/components/check-list.d.ts +11 -0
- package/dist/components/check-list.js +11 -0
- package/dist/components/check-list2.js +131 -0
- package/dist/components/checkbox.js +165 -0
- package/dist/components/chip.js +170 -0
- package/dist/components/color-picker-hex-input.js +363 -0
- package/dist/components/color-picker-swatch.js +2034 -0
- package/dist/components/combobox-item.js +182 -0
- package/dist/components/combobox.js +912 -0
- package/dist/components/comment-card.d.ts +11 -0
- package/dist/components/comment-card.js +90 -0
- package/dist/components/conditionalSlot.js +50 -0
- package/dist/components/config-buffer-tools.d.ts +11 -0
- package/dist/components/config-buffer-tools.js +187 -0
- package/dist/components/config-draw-tools.d.ts +11 -0
- package/dist/components/config-draw-tools.js +121 -0
- package/dist/components/config-layer-picker.d.ts +11 -0
- package/dist/components/config-layer-picker.js +163 -0
- package/dist/components/config-pdf-download.d.ts +11 -0
- package/dist/components/config-pdf-download.js +154 -0
- package/dist/components/crowdsource-manager.d.ts +11 -0
- package/dist/components/crowdsource-manager.js +90 -0
- package/dist/components/crowdsource-reporter.d.ts +11 -0
- package/dist/components/crowdsource-reporter.js +90 -0
- package/dist/components/csvUtils.js +74 -0
- package/dist/components/date-picker-day.js +111 -0
- package/dist/components/date-picker-month-header.js +224 -0
- package/dist/components/date-picker-month.js +344 -0
- package/dist/components/date-picker.js +575 -0
- package/dist/components/date.js +180 -0
- package/dist/components/debounce.js +487 -0
- package/dist/components/deduct-calculator.d.ts +11 -0
- package/dist/components/deduct-calculator.js +11 -0
- package/dist/components/deduct-calculator2.js +1002 -0
- package/dist/components/dom.js +231 -0
- package/dist/components/dropdown-group.js +96 -0
- package/dist/components/dropdown-item.js +232 -0
- package/dist/components/dropdown.js +505 -0
- package/dist/components/edit-record-modal.d.ts +11 -0
- package/dist/components/edit-record-modal.js +11 -0
- package/dist/components/edit-record-modal2.js +161 -0
- package/dist/components/filter.js +763 -0
- package/dist/components/floating-ui.js +1768 -0
- package/dist/components/form.js +228 -0
- package/dist/components/graph.js +254 -0
- package/dist/components/guid.js +24 -0
- package/dist/components/handle.js +119 -0
- package/dist/components/icon.js +202 -0
- package/dist/components/index.d.ts +61 -0
- package/dist/components/index.js +196 -0
- package/dist/components/index2.js +199 -0
- package/dist/components/info-card.d.ts +11 -0
- package/dist/components/info-card.js +11 -0
- package/dist/components/info-card2.js +97 -0
- package/dist/components/input-message.js +101 -0
- package/dist/components/input.js +740 -0
- package/dist/components/interactive.js +51 -0
- package/dist/components/interfaces.js +19 -0
- package/dist/components/interfaces2.js +21 -0
- package/dist/components/interfaces3.js +80 -0
- package/dist/components/json-editor.d.ts +11 -0
- package/dist/components/json-editor.js +11 -0
- package/dist/components/json-editor2.js +441 -0
- package/dist/components/key.js +16 -0
- package/dist/components/label.js +106 -0
- package/dist/components/label2.js +131 -0
- package/dist/components/labelFormats.js +210 -0
- package/dist/components/layer-table.d.ts +11 -0
- package/dist/components/layer-table.js +453 -0
- package/dist/components/link.js +123 -0
- package/dist/components/list-item.d.ts +11 -0
- package/dist/components/list-item.js +90 -0
- package/dist/components/list-item2.js +149 -0
- package/dist/components/list.js +83 -0
- package/dist/components/loadModules.js +28 -0
- package/dist/components/loader.js +116 -0
- package/dist/components/locale.js +412 -0
- package/dist/components/locale2.js +413 -0
- package/dist/components/map-card.d.ts +11 -0
- package/dist/components/map-card.js +354 -0
- package/dist/components/map-draw-tools.d.ts +11 -0
- package/dist/components/map-draw-tools.js +11 -0
- package/dist/components/map-draw-tools2.js +228 -0
- package/dist/components/map-layer-picker.d.ts +11 -0
- package/dist/components/map-layer-picker.js +11 -0
- package/dist/components/map-layer-picker2.js +188 -0
- package/dist/components/map-search.d.ts +11 -0
- package/dist/components/map-search.js +155 -0
- package/dist/components/map-select-tools.d.ts +11 -0
- package/dist/components/map-select-tools.js +11 -0
- package/dist/components/map-select-tools2.js +588 -0
- package/dist/components/mapViewUtils.js +129 -0
- package/dist/components/math.js +24 -0
- package/dist/components/media-card.d.ts +11 -0
- package/dist/components/media-card.js +11 -0
- package/dist/components/media-card2.js +177 -0
- package/dist/components/modal.js +495 -0
- package/dist/components/nonChromiumPlatformUtils.js +503 -0
- package/dist/components/notice.js +192 -0
- package/dist/components/observers.js +56 -0
- package/dist/components/openCloseComponent.js +56 -0
- package/dist/components/option.js +109 -0
- package/dist/components/panel.js +459 -0
- package/dist/components/pci-calculator.d.ts +11 -0
- package/dist/components/pci-calculator.js +193 -0
- package/dist/components/pdf-download.d.ts +11 -0
- package/dist/components/pdf-download.js +11 -0
- package/dist/components/pdf-download2.js +189 -0
- package/dist/components/pick-list-item.js +255 -0
- package/dist/components/pick-list.js +170 -0
- package/dist/components/popover.js +500 -0
- package/dist/components/progress.js +60 -0
- package/dist/components/public-notification.d.ts +11 -0
- package/dist/components/public-notification.js +825 -0
- package/dist/components/publicNotificationStore.js +38 -0
- package/dist/components/queryUtils.js +187 -0
- package/dist/components/radio-group-item.js +101 -0
- package/dist/components/radio-group.js +235 -0
- package/dist/components/refine-selection-tools.d.ts +11 -0
- package/dist/components/refine-selection-tools.js +11 -0
- package/dist/components/refine-selection-tools2.js +492 -0
- package/dist/components/refine-selection.d.ts +11 -0
- package/dist/components/refine-selection.js +11 -0
- package/dist/components/refine-selection2.js +376 -0
- package/dist/components/resources.js +24 -0
- package/dist/components/resources2.js +21 -0
- package/dist/components/resources3.js +38 -0
- package/dist/components/scrim.js +83 -0
- package/dist/components/select.js +259 -0
- package/dist/components/shared-list-render.js +319 -0
- package/dist/components/shell-panel.js +281 -0
- package/dist/components/shell.js +121 -0
- package/dist/components/slider.js +896 -0
- package/dist/components/solution-configuration.d.ts +11 -0
- package/dist/components/solution-configuration.js +2233 -0
- package/dist/components/solution-contents.d.ts +11 -0
- package/dist/components/solution-contents.js +11 -0
- package/dist/components/solution-contents2.js +128 -0
- package/dist/components/solution-item-details.d.ts +11 -0
- package/dist/components/solution-item-details.js +11 -0
- package/dist/components/solution-item-details2.js +234 -0
- package/dist/components/solution-item-icon.d.ts +11 -0
- package/dist/components/solution-item-icon.js +11 -0
- package/dist/components/solution-item-icon2.js +342 -0
- package/dist/components/solution-item-sharing.d.ts +11 -0
- package/dist/components/solution-item-sharing.js +11 -0
- package/dist/components/solution-item-sharing2.js +167 -0
- package/dist/components/solution-item.d.ts +11 -0
- package/dist/components/solution-item.js +11 -0
- package/dist/components/solution-item2.js +315 -0
- package/dist/components/solution-organization-variables.d.ts +11 -0
- package/dist/components/solution-organization-variables.js +11 -0
- package/dist/components/solution-organization-variables2.js +132 -0
- package/dist/components/solution-resource-item.d.ts +11 -0
- package/dist/components/solution-resource-item.js +11 -0
- package/dist/components/solution-resource-item2.js +356 -0
- package/dist/components/solution-spatial-ref.d.ts +11 -0
- package/dist/components/solution-spatial-ref.js +11 -0
- package/dist/components/solution-spatial-ref2.js +21446 -0
- package/dist/components/solution-store.js +4092 -0
- package/dist/components/solution-template-data.d.ts +11 -0
- package/dist/components/solution-template-data.js +11 -0
- package/dist/components/solution-template-data2.js +233 -0
- package/dist/components/solution-variables.d.ts +11 -0
- package/dist/components/solution-variables.js +11 -0
- package/dist/components/solution-variables2.js +150 -0
- package/dist/components/sortable.esm.js +3026 -0
- package/dist/components/split-button.js +165 -0
- package/dist/components/store-manager.d.ts +11 -0
- package/dist/components/store-manager.js +83 -0
- package/dist/components/switch.js +139 -0
- package/dist/components/tab-nav.js +241 -0
- package/dist/components/tab-title.js +276 -0
- package/dist/components/tab.js +154 -0
- package/dist/components/tabs.js +188 -0
- package/dist/components/tile.js +129 -0
- package/dist/components/time-picker.js +943 -0
- package/dist/components/tooltip.js +399 -0
- package/dist/components/tree-item.js +294 -0
- package/dist/components/tree.js +327 -0
- package/dist/components/utils.js +119 -0
- package/dist/components/utils2.js +51 -0
- package/dist/components/value-list-item.js +204 -0
- package/dist/components/value-list.js +333 -0
- package/dist/esm/deduct-calculator.entry.js +1 -1
- package/dist/esm/pci-calculator.entry.js +1 -1
- package/dist/esm/{pciUtils-e3007a1c.js → pciUtils-ecda46e5.js} +25 -7
- package/dist/solutions-components/demos/deduct-calculator.html +2 -5
- package/dist/solutions-components/demos/new-public-notification.html +6 -4
- package/dist/solutions-components/{p-ff80ffbb.entry.js → p-0512635b.entry.js} +1 -1
- package/dist/solutions-components/{p-5ec407c2.entry.js → p-0c088725.entry.js} +1 -1
- package/dist/solutions-components/p-cc815aca.js +21 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/pciUtils.ts +30 -7
- package/dist/types/utils/pciUtils.d.ts +2 -1
- package/package.json +4 -3
- package/dist/solutions-components/p-647bbd18.js +0 -21
@@ -0,0 +1,363 @@
|
|
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
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
7
|
+
import { n as normalizeHex, i as isValidHex, a as isLonghandHex, r as rgbToHex, b as hexChar } from './utils.js';
|
8
|
+
import { c as color, d as defineCustomElement$4 } from './color-picker-swatch.js';
|
9
|
+
import { f as focusElement } from './dom.js';
|
10
|
+
import { d as defineCustomElement$3 } from './icon.js';
|
11
|
+
import { d as defineCustomElement$2 } from './input.js';
|
12
|
+
import { d as defineCustomElement$1 } from './progress.js';
|
13
|
+
|
14
|
+
/*!
|
15
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
16
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
17
|
+
* v1.0.0-beta.97
|
18
|
+
*/
|
19
|
+
const CSS$1 = {
|
20
|
+
container: "container",
|
21
|
+
controlSection: "control-section",
|
22
|
+
hexOptions: "color-hex-options",
|
23
|
+
section: "section",
|
24
|
+
header: "header",
|
25
|
+
control: "control",
|
26
|
+
splitSection: "section--split",
|
27
|
+
colorModeContainer: "color-mode-container",
|
28
|
+
colorMode: "color-mode",
|
29
|
+
channels: "channels",
|
30
|
+
channel: "channel",
|
31
|
+
savedColors: "saved-colors",
|
32
|
+
savedColorsSection: "saved-colors-section",
|
33
|
+
saveColor: "save-color",
|
34
|
+
deleteColor: "delete-color",
|
35
|
+
savedColorsButtons: "saved-colors-buttons",
|
36
|
+
headerHex: "header--hex",
|
37
|
+
colorFieldAndSlider: "color-field-and-slider",
|
38
|
+
colorFieldAndSliderInteractive: "color-field-and-slider--interactive",
|
39
|
+
colorFieldAndSliderWrap: "color-field-and-slider-wrap",
|
40
|
+
scope: "scope",
|
41
|
+
hueScope: "scope--hue",
|
42
|
+
colorFieldScope: "scope--color-field",
|
43
|
+
savedColor: "saved-color"
|
44
|
+
};
|
45
|
+
const DEFAULT_COLOR$1 = color("#007AC2");
|
46
|
+
const DEFAULT_STORAGE_KEY_PREFIX = "calcite-color-";
|
47
|
+
const RGB_LIMITS = {
|
48
|
+
r: 255,
|
49
|
+
g: 255,
|
50
|
+
b: 255
|
51
|
+
};
|
52
|
+
const HSV_LIMITS = {
|
53
|
+
h: 360,
|
54
|
+
s: 100,
|
55
|
+
v: 100
|
56
|
+
};
|
57
|
+
const TEXT = {
|
58
|
+
b: "B",
|
59
|
+
blue: "Blue",
|
60
|
+
deleteColor: "Delete color",
|
61
|
+
g: "G",
|
62
|
+
green: "Green",
|
63
|
+
h: "H",
|
64
|
+
hsv: "HSV",
|
65
|
+
hex: "Hex",
|
66
|
+
hue: "Hue",
|
67
|
+
noColor: "No color",
|
68
|
+
r: "R",
|
69
|
+
red: "Red",
|
70
|
+
rgb: "RGB",
|
71
|
+
s: "S",
|
72
|
+
saturation: "Saturation",
|
73
|
+
saveColor: "Save color",
|
74
|
+
saved: "Saved",
|
75
|
+
v: "V",
|
76
|
+
value: "Value"
|
77
|
+
};
|
78
|
+
const DIMENSIONS = {
|
79
|
+
s: {
|
80
|
+
slider: {
|
81
|
+
height: 10,
|
82
|
+
width: 160
|
83
|
+
},
|
84
|
+
colorField: {
|
85
|
+
height: 80,
|
86
|
+
width: 160
|
87
|
+
},
|
88
|
+
thumb: {
|
89
|
+
radius: 8
|
90
|
+
}
|
91
|
+
},
|
92
|
+
m: {
|
93
|
+
slider: {
|
94
|
+
height: 14,
|
95
|
+
width: 272
|
96
|
+
},
|
97
|
+
colorField: {
|
98
|
+
height: 150,
|
99
|
+
width: 272
|
100
|
+
},
|
101
|
+
thumb: {
|
102
|
+
radius: 10
|
103
|
+
}
|
104
|
+
},
|
105
|
+
l: {
|
106
|
+
slider: {
|
107
|
+
height: 16,
|
108
|
+
width: 464
|
109
|
+
},
|
110
|
+
colorField: {
|
111
|
+
height: 200,
|
112
|
+
width: 464
|
113
|
+
},
|
114
|
+
thumb: {
|
115
|
+
radius: 12
|
116
|
+
}
|
117
|
+
}
|
118
|
+
};
|
119
|
+
|
120
|
+
/*!
|
121
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
122
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
123
|
+
* v1.0.0-beta.97
|
124
|
+
*/
|
125
|
+
const CSS = {
|
126
|
+
container: "container",
|
127
|
+
preview: "preview",
|
128
|
+
input: "input"
|
129
|
+
};
|
130
|
+
|
131
|
+
const colorPickerHexInputCss = "@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:block}.container{display:inline-grid;inline-size:100%;align-items:center;grid-template-columns:1fr auto}.preview{grid-column:2/3;pointer-events:none;margin-block:0px;margin-inline:0.25rem;display:flex;align-items:center}.preview,.input{grid-row:1}.input{grid-column:1/3;inline-size:100%;text-transform:uppercase}";
|
132
|
+
|
133
|
+
const DEFAULT_COLOR = color();
|
134
|
+
const ColorPickerHexInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
135
|
+
constructor() {
|
136
|
+
super();
|
137
|
+
this.__registerHost();
|
138
|
+
this.__attachShadow();
|
139
|
+
this.calciteColorPickerHexInputChange = createEvent(this, "calciteColorPickerHexInputChange", 6);
|
140
|
+
//--------------------------------------------------------------------------
|
141
|
+
//
|
142
|
+
// Public Properties
|
143
|
+
//
|
144
|
+
//--------------------------------------------------------------------------
|
145
|
+
/**
|
146
|
+
* When `false`, an empty color (`null`) will be allowed as a `value`. Otherwise, a color value is enforced on the component.
|
147
|
+
*
|
148
|
+
* When `true`, a color value is enforced, and clearing the input or blurring will restore the last valid `value`. When `false`, an empty color (`null`) will be allowed as a `value`.
|
149
|
+
*/
|
150
|
+
this.allowEmpty = false;
|
151
|
+
/**
|
152
|
+
* Accessible name for the Hex input.
|
153
|
+
*
|
154
|
+
* @default "Hex"
|
155
|
+
*/
|
156
|
+
this.intlHex = TEXT.hex;
|
157
|
+
/**
|
158
|
+
* Accessible name for the Hex input when there is no color selected.
|
159
|
+
*
|
160
|
+
* @default "No color"
|
161
|
+
*/
|
162
|
+
this.intlNoColor = TEXT.noColor;
|
163
|
+
/** Specifies the size of the component. */
|
164
|
+
this.scale = "m";
|
165
|
+
/**
|
166
|
+
* The Hex value.
|
167
|
+
*/
|
168
|
+
this.value = normalizeHex(DEFAULT_COLOR.hex());
|
169
|
+
this.onCalciteInternalInputBlur = () => {
|
170
|
+
const node = this.inputNode;
|
171
|
+
const inputValue = node.value;
|
172
|
+
const hex = `#${inputValue}`;
|
173
|
+
const willClearValue = this.allowEmpty && !inputValue;
|
174
|
+
if (willClearValue || (isValidHex(hex) && isLonghandHex(hex))) {
|
175
|
+
return;
|
176
|
+
}
|
177
|
+
// manipulating DOM directly since rerender doesn't update input value
|
178
|
+
node.value =
|
179
|
+
this.allowEmpty && !this.internalColor
|
180
|
+
? ""
|
181
|
+
: this.formatForInternalInput(rgbToHex(this.internalColor.object()));
|
182
|
+
};
|
183
|
+
this.onInputChange = () => {
|
184
|
+
this.internalSetValue(this.inputNode.value, this.value);
|
185
|
+
};
|
186
|
+
/**
|
187
|
+
* The last valid/selected color. Used as a fallback if an invalid hex code is entered.
|
188
|
+
*/
|
189
|
+
this.internalColor = DEFAULT_COLOR;
|
190
|
+
this.previousNonNullValue = this.value;
|
191
|
+
this.storeInputRef = (node) => {
|
192
|
+
this.inputNode = node;
|
193
|
+
};
|
194
|
+
}
|
195
|
+
//--------------------------------------------------------------------------
|
196
|
+
//
|
197
|
+
// Lifecycle
|
198
|
+
//
|
199
|
+
//--------------------------------------------------------------------------
|
200
|
+
connectedCallback() {
|
201
|
+
const { allowEmpty, value } = this;
|
202
|
+
if (value) {
|
203
|
+
const normalized = normalizeHex(value);
|
204
|
+
if (isValidHex(normalized)) {
|
205
|
+
this.internalSetValue(normalized, normalized, false);
|
206
|
+
}
|
207
|
+
return;
|
208
|
+
}
|
209
|
+
if (allowEmpty) {
|
210
|
+
this.internalSetValue(null, null, false);
|
211
|
+
}
|
212
|
+
}
|
213
|
+
handleValueChange(value, oldValue) {
|
214
|
+
this.internalSetValue(value, oldValue, false);
|
215
|
+
}
|
216
|
+
// using @Listen as a workaround for VDOM listener not firing
|
217
|
+
onInputKeyDown(event) {
|
218
|
+
const { altKey, ctrlKey, metaKey, shiftKey } = event;
|
219
|
+
const { internalColor, value } = this;
|
220
|
+
const { key } = event;
|
221
|
+
if (key === "Tab" || key === "Enter") {
|
222
|
+
this.onInputChange();
|
223
|
+
return;
|
224
|
+
}
|
225
|
+
const isNudgeKey = key === "ArrowDown" || key === "ArrowUp";
|
226
|
+
const oldValue = this.value;
|
227
|
+
if (isNudgeKey) {
|
228
|
+
if (!value) {
|
229
|
+
this.internalSetValue(this.previousNonNullValue, oldValue);
|
230
|
+
event.preventDefault();
|
231
|
+
return;
|
232
|
+
}
|
233
|
+
const direction = key === "ArrowUp" ? 1 : -1;
|
234
|
+
const bump = shiftKey ? 10 : 1;
|
235
|
+
this.internalSetValue(normalizeHex(this.nudgeRGBChannels(internalColor, bump * direction).hex()), oldValue);
|
236
|
+
event.preventDefault();
|
237
|
+
return;
|
238
|
+
}
|
239
|
+
const withModifiers = altKey || ctrlKey || metaKey;
|
240
|
+
const singleChar = key.length === 1;
|
241
|
+
const validHexChar = hexChar.test(key);
|
242
|
+
if (singleChar && !withModifiers && !validHexChar) {
|
243
|
+
event.preventDefault();
|
244
|
+
}
|
245
|
+
}
|
246
|
+
onPaste(event) {
|
247
|
+
const hex = event.clipboardData.getData("text");
|
248
|
+
if (isValidHex(hex)) {
|
249
|
+
event.preventDefault();
|
250
|
+
this.inputNode.value = hex.slice(1);
|
251
|
+
}
|
252
|
+
}
|
253
|
+
//--------------------------------------------------------------------------
|
254
|
+
//
|
255
|
+
// Lifecycle
|
256
|
+
//
|
257
|
+
//--------------------------------------------------------------------------
|
258
|
+
render() {
|
259
|
+
const { intlHex, value } = this;
|
260
|
+
const hexInputValue = this.formatForInternalInput(value);
|
261
|
+
return (h("div", { class: CSS.container }, h("calcite-input", { class: CSS.input, label: intlHex, maxLength: 6, numberingSystem: this.numberingSystem, onCalciteInputChange: this.onInputChange, onCalciteInternalInputBlur: this.onCalciteInternalInputBlur, onKeyDown: this.handleKeyDown, onPaste: this.onPaste, prefixText: "#", ref: this.storeInputRef, scale: this.scale, value: hexInputValue }), hexInputValue ? (h("calcite-color-picker-swatch", { active: true, class: CSS.preview, color: `#${hexInputValue}`, scale: this.scale })) : null));
|
262
|
+
}
|
263
|
+
//--------------------------------------------------------------------------
|
264
|
+
//
|
265
|
+
// Public Methods
|
266
|
+
//
|
267
|
+
//--------------------------------------------------------------------------
|
268
|
+
/** Sets focus on the component. */
|
269
|
+
async setFocus() {
|
270
|
+
focusElement(this.inputNode);
|
271
|
+
}
|
272
|
+
//--------------------------------------------------------------------------
|
273
|
+
//
|
274
|
+
// Private Methods
|
275
|
+
//
|
276
|
+
//--------------------------------------------------------------------------
|
277
|
+
internalSetValue(value, oldValue, emit = true) {
|
278
|
+
if (value) {
|
279
|
+
const normalized = normalizeHex(value);
|
280
|
+
if (isValidHex(normalized)) {
|
281
|
+
const { internalColor } = this;
|
282
|
+
const changed = !internalColor || normalized !== normalizeHex(internalColor.hex());
|
283
|
+
this.internalColor = color(normalized);
|
284
|
+
this.previousNonNullValue = normalized;
|
285
|
+
this.value = normalized;
|
286
|
+
if (changed && emit) {
|
287
|
+
this.calciteColorPickerHexInputChange.emit();
|
288
|
+
}
|
289
|
+
return;
|
290
|
+
}
|
291
|
+
}
|
292
|
+
else if (this.allowEmpty) {
|
293
|
+
this.internalColor = null;
|
294
|
+
this.value = null;
|
295
|
+
if (emit) {
|
296
|
+
this.calciteColorPickerHexInputChange.emit();
|
297
|
+
}
|
298
|
+
return;
|
299
|
+
}
|
300
|
+
this.value = oldValue;
|
301
|
+
}
|
302
|
+
formatForInternalInput(hex) {
|
303
|
+
return hex ? hex.replace("#", "") : "";
|
304
|
+
}
|
305
|
+
nudgeRGBChannels(color$1, amount) {
|
306
|
+
return color.rgb(color$1.array().map((channel) => channel + amount));
|
307
|
+
}
|
308
|
+
handleKeyDown(event) {
|
309
|
+
if (event.key === "Enter") {
|
310
|
+
event.preventDefault();
|
311
|
+
}
|
312
|
+
}
|
313
|
+
get el() { return this; }
|
314
|
+
static get watchers() { return {
|
315
|
+
"value": ["handleValueChange"]
|
316
|
+
}; }
|
317
|
+
static get style() { return colorPickerHexInputCss; }
|
318
|
+
}, [1, "calcite-color-picker-hex-input", {
|
319
|
+
"allowEmpty": [4, "allow-empty"],
|
320
|
+
"intlHex": [1, "intl-hex"],
|
321
|
+
"intlNoColor": [1, "intl-no-color"],
|
322
|
+
"scale": [513],
|
323
|
+
"value": [1537],
|
324
|
+
"numberingSystem": [1, "numbering-system"],
|
325
|
+
"internalColor": [32],
|
326
|
+
"setFocus": [64]
|
327
|
+
}, [[2, "keydown", "onInputKeyDown"]]]);
|
328
|
+
function defineCustomElement() {
|
329
|
+
if (typeof customElements === "undefined") {
|
330
|
+
return;
|
331
|
+
}
|
332
|
+
const components = ["calcite-color-picker-hex-input", "calcite-color-picker-swatch", "calcite-icon", "calcite-input", "calcite-progress"];
|
333
|
+
components.forEach(tagName => { switch (tagName) {
|
334
|
+
case "calcite-color-picker-hex-input":
|
335
|
+
if (!customElements.get(tagName)) {
|
336
|
+
customElements.define(tagName, ColorPickerHexInput);
|
337
|
+
}
|
338
|
+
break;
|
339
|
+
case "calcite-color-picker-swatch":
|
340
|
+
if (!customElements.get(tagName)) {
|
341
|
+
defineCustomElement$4();
|
342
|
+
}
|
343
|
+
break;
|
344
|
+
case "calcite-icon":
|
345
|
+
if (!customElements.get(tagName)) {
|
346
|
+
defineCustomElement$3();
|
347
|
+
}
|
348
|
+
break;
|
349
|
+
case "calcite-input":
|
350
|
+
if (!customElements.get(tagName)) {
|
351
|
+
defineCustomElement$2();
|
352
|
+
}
|
353
|
+
break;
|
354
|
+
case "calcite-progress":
|
355
|
+
if (!customElements.get(tagName)) {
|
356
|
+
defineCustomElement$1();
|
357
|
+
}
|
358
|
+
break;
|
359
|
+
} });
|
360
|
+
}
|
361
|
+
defineCustomElement();
|
362
|
+
|
363
|
+
export { CSS$1 as C, DEFAULT_COLOR$1 as D, HSV_LIMITS as H, RGB_LIMITS as R, TEXT as T, DIMENSIONS as a, DEFAULT_STORAGE_KEY_PREFIX as b, ColorPickerHexInput as c, defineCustomElement as d };
|