@esri/calcite-components 1.0.0-next.308 → 1.0.0-next.311
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/calcite/assets/calcite-icon/cloudy16.json +1 -0
- package/dist/calcite/assets/calcite-icon/cloudy24.json +1 -0
- package/dist/calcite/assets/calcite-icon/cloudy32.json +1 -0
- package/dist/calcite/assets/calcite-icon/displaySelectionLock16.json +1 -0
- package/dist/calcite/assets/calcite-icon/displaySelectionLock24.json +1 -0
- package/dist/calcite/assets/calcite-icon/displaySelectionLock32.json +1 -0
- package/dist/calcite/assets/calcite-icon/displaySelectionUnlock16.json +1 -0
- package/dist/calcite/assets/calcite-icon/displaySelectionUnlock24.json +1 -0
- package/dist/calcite/assets/calcite-icon/displaySelectionUnlock32.json +1 -0
- package/dist/calcite/assets/calcite-icon/driveTimeThreshold16.json +1 -0
- package/dist/calcite/assets/calcite-icon/driveTimeThreshold24.json +1 -0
- package/dist/calcite/assets/calcite-icon/driveTimeThreshold32.json +1 -0
- package/dist/calcite/assets/calcite-icon/fog16.json +1 -0
- package/dist/calcite/assets/calcite-icon/fog24.json +1 -0
- package/dist/calcite/assets/calcite-icon/fog32.json +1 -0
- package/dist/calcite/assets/calcite-icon/heavyRain16.json +1 -0
- package/dist/calcite/assets/calcite-icon/heavyRain24.json +1 -0
- package/dist/calcite/assets/calcite-icon/heavyRain32.json +1 -0
- package/dist/calcite/assets/calcite-icon/heavySnow16.json +1 -0
- package/dist/calcite/assets/calcite-icon/heavySnow24.json +1 -0
- package/dist/calcite/assets/calcite-icon/heavySnow32.json +1 -0
- package/dist/calcite/assets/calcite-icon/lightRain16.json +1 -0
- package/dist/calcite/assets/calcite-icon/lightRain24.json +1 -0
- package/dist/calcite/assets/calcite-icon/lightRain32.json +1 -0
- package/dist/calcite/assets/calcite-icon/lightSnow16.json +1 -0
- package/dist/calcite/assets/calcite-icon/lightSnow24.json +1 -0
- package/dist/calcite/assets/calcite-icon/lightSnow32.json +1 -0
- package/dist/calcite/assets/calcite-icon/partlyCloud16.json +1 -0
- package/dist/calcite/assets/calcite-icon/partlyCloud24.json +1 -0
- package/dist/calcite/assets/calcite-icon/partlyCloud32.json +1 -0
- package/dist/calcite/assets/calcite-icon/rain16.json +1 -0
- package/dist/calcite/assets/calcite-icon/rain24.json +1 -0
- package/dist/calcite/assets/calcite-icon/rain32.json +1 -0
- package/dist/calcite/assets/calcite-icon/rainSnow16.json +1 -0
- package/dist/calcite/assets/calcite-icon/rainSnow24.json +1 -0
- package/dist/calcite/assets/calcite-icon/rainSnow32.json +1 -0
- package/dist/calcite/assets/calcite-icon/rainThunder16.json +1 -0
- package/dist/calcite/assets/calcite-icon/rainThunder24.json +1 -0
- package/dist/calcite/assets/calcite-icon/rainThunder32.json +1 -0
- package/dist/calcite/assets/calcite-icon/ringsThreshold16.json +1 -0
- package/dist/calcite/assets/calcite-icon/ringsThreshold24.json +1 -0
- package/dist/calcite/assets/calcite-icon/ringsThreshold32.json +1 -0
- package/dist/calcite/assets/calcite-icon/selectVisible16.json +1 -0
- package/dist/calcite/assets/calcite-icon/selectVisible24.json +1 -0
- package/dist/calcite/assets/calcite-icon/selectVisible32.json +1 -0
- package/dist/calcite/assets/calcite-icon/snow16.json +1 -0
- package/dist/calcite/assets/calcite-icon/snow24.json +1 -0
- package/dist/calcite/assets/calcite-icon/snow32.json +1 -0
- package/dist/calcite/assets/calcite-icon/snowThunder16.json +1 -0
- package/dist/calcite/assets/calcite-icon/snowThunder24.json +1 -0
- package/dist/calcite/assets/calcite-icon/snowThunder32.json +1 -0
- package/dist/calcite/calcite.esm.js +1 -1
- package/dist/calcite/p-0f014648.entry.js +5 -0
- package/dist/calcite/p-0fa1ba75.entry.js +5 -0
- package/dist/calcite/{p-a8dc2982.system.entry.js → p-25caf637.system.entry.js} +1 -1
- package/dist/calcite/p-362cb320.entry.js +5 -0
- package/dist/calcite/p-688f06b9.entry.js +5 -0
- package/dist/calcite/p-8e252799.system.js +1 -1
- package/dist/calcite/p-a19e423a.entry.js +5 -0
- package/dist/calcite/p-a46c3870.system.entry.js +5 -0
- package/dist/calcite/{p-243d95ab.system.entry.js → p-a5e8f022.system.entry.js} +2 -2
- package/dist/calcite/p-ca6025ab.system.entry.js +5 -0
- package/dist/calcite/p-f1e111f4.system.entry.js +5 -0
- package/dist/cjs/calcite-alert.cjs.entry.js +22 -5
- package/dist/cjs/calcite-color-picker_3.cjs.entry.js +19 -11
- package/dist/cjs/calcite-input.cjs.entry.js +11 -10
- package/dist/cjs/calcite-shell_3.cjs.entry.js +156 -5
- package/dist/cjs/calcite-split-button.cjs.entry.js +3 -1
- package/dist/cjs/calcite.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/calcite-alert/calcite-alert.js +23 -4
- package/dist/collection/components/calcite-icon/assets/calcite-icon/cloudy16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/cloudy24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/cloudy32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/displaySelectionLock16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/displaySelectionLock24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/displaySelectionLock32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/displaySelectionUnlock16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/displaySelectionUnlock24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/displaySelectionUnlock32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/driveTimeThreshold16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/driveTimeThreshold24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/driveTimeThreshold32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/fog16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/fog24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/fog32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/heavyRain16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/heavyRain24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/heavyRain32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/heavySnow16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/heavySnow24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/heavySnow32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/lightRain16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/lightRain24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/lightRain32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/lightSnow16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/lightSnow24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/lightSnow32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/partlyCloud16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/partlyCloud24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/partlyCloud32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/rain16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/rain24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/rain32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/rainSnow16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/rainSnow24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/rainSnow32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/rainThunder16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/rainThunder24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/rainThunder32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/ringsThreshold16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/ringsThreshold24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/ringsThreshold32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/selectVisible16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/selectVisible24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/selectVisible32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/snow16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/snow24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/snow32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/snowThunder16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/snowThunder24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/snowThunder32.json +1 -0
- package/dist/collection/components/calcite-input/calcite-input.css +2 -0
- package/dist/collection/components/calcite-input/calcite-input.js +10 -9
- package/dist/collection/components/calcite-shell-panel/calcite-shell-panel.css +43 -0
- package/dist/collection/components/calcite-shell-panel/calcite-shell-panel.js +194 -5
- package/dist/collection/components/calcite-shell-panel/resources.js +5 -1
- package/dist/collection/components/calcite-split-button/calcite-split-button.js +26 -1
- package/dist/components/calcite-alert.js +22 -5
- package/dist/components/calcite-color-picker-swatch2.js +19 -11
- package/dist/components/calcite-input2.js +11 -10
- package/dist/components/calcite-shell-panel.js +161 -7
- package/dist/components/calcite-split-button.js +4 -1
- package/dist/custom-elements/index.js +305 -127
- package/dist/esm/calcite-alert.entry.js +22 -5
- package/dist/esm/calcite-color-picker_3.entry.js +19 -11
- package/dist/esm/calcite-input.entry.js +11 -10
- package/dist/esm/calcite-shell_3.entry.js +157 -6
- package/dist/esm/calcite-split-button.entry.js +3 -1
- package/dist/esm/calcite.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm-es5/calcite-alert.entry.js +2 -2
- package/dist/esm-es5/calcite-color-picker_3.entry.js +1 -1
- package/dist/esm-es5/calcite-input.entry.js +1 -1
- package/dist/esm-es5/calcite-shell_3.entry.js +1 -1
- package/dist/esm-es5/calcite-split-button.entry.js +1 -1
- package/dist/esm-es5/calcite.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/extras/docs-json.json +62 -1
- package/dist/types/components/calcite-alert/calcite-alert.d.ts +3 -0
- package/dist/types/components/calcite-shell-panel/calcite-shell-panel.d.ts +31 -0
- package/dist/types/components/calcite-shell-panel/resources.d.ts +4 -0
- package/dist/types/components/calcite-split-button/calcite-split-button.d.ts +3 -0
- package/dist/types/components.d.ts +26 -0
- package/hydrate/index.js +309 -127
- package/package.json +10 -10
- package/readme.md +2 -2
- package/dist/calcite/p-047e1000.system.entry.js +0 -5
- package/dist/calcite/p-08d707c4.entry.js +0 -5
- package/dist/calcite/p-5c0c29bc.entry.js +0 -5
- package/dist/calcite/p-5f817b79.entry.js +0 -5
- package/dist/calcite/p-75955cef.entry.js +0 -5
- package/dist/calcite/p-7cbc72b6.system.entry.js +0 -5
- package/dist/calcite/p-aa47308a.entry.js +0 -5
- package/dist/calcite/p-b1a96c72.system.entry.js +0 -5
|
@@ -199,12 +199,13 @@ export class CalciteInput {
|
|
|
199
199
|
const inputMin = this.minString ? parseFloat(this.minString) : null;
|
|
200
200
|
const valueNudgeDelayInMs = 100;
|
|
201
201
|
this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
|
|
202
|
-
let
|
|
202
|
+
let firstValueNudge = true;
|
|
203
203
|
this.nudgeNumberValueIntervalId = setInterval(() => {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
204
|
+
if (firstValueNudge) {
|
|
205
|
+
firstValueNudge = false;
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
|
|
208
209
|
}, valueNudgeDelayInMs);
|
|
209
210
|
};
|
|
210
211
|
this.numberButtonMouseUpAndMouseOutHandler = () => {
|
|
@@ -422,7 +423,7 @@ export class CalciteInput {
|
|
|
422
423
|
numberButtonsHorizontalDown));
|
|
423
424
|
const prefixText = h("div", { class: CSS.prefix }, this.prefixText);
|
|
424
425
|
const suffixText = h("div", { class: CSS.suffix }, this.suffixText);
|
|
425
|
-
const localeNumberInput = this.type === "number" ? (h("input", { "aria-label": getLabelText(this), autofocus: this.autofocus ? true : null, defaultValue: this.defaultValue, disabled: this.disabled ? true : null, enterKeyHint: this.el.enterKeyHint, inputMode: this.el.inputMode, key: "localized-input", maxLength: this.maxLength, minLength: this.minLength, name: undefined, onBlur: this.inputBlurHandler, onFocus: this.inputFocusHandler, onInput: this.inputNumberInputHandler, onKeyDown: this.inputNumberKeyDownHandler, onKeyUp: this.inputKeyUpHandler, placeholder: this.placeholder || "", readOnly: this.readOnly, ref: this.setChildNumberElRef,
|
|
426
|
+
const localeNumberInput = this.type === "number" ? (h("input", { "aria-label": getLabelText(this), autofocus: this.autofocus ? true : null, defaultValue: this.defaultValue, disabled: this.disabled ? true : null, enterKeyHint: this.el.enterKeyHint, inputMode: this.el.inputMode, key: "localized-input", maxLength: this.maxLength, minLength: this.minLength, name: undefined, onBlur: this.inputBlurHandler, onFocus: this.inputFocusHandler, onInput: this.inputNumberInputHandler, onKeyDown: this.inputNumberKeyDownHandler, onKeyUp: this.inputKeyUpHandler, placeholder: this.placeholder || "", readOnly: this.readOnly, ref: this.setChildNumberElRef, type: "text", value: this.localizedValue })) : null;
|
|
426
427
|
const childEl = this.type !== "number"
|
|
427
428
|
? [
|
|
428
429
|
h(this.childElType, { "aria-label": getLabelText(this), autofocus: this.autofocus ? true : null, class: {
|
|
@@ -435,7 +436,7 @@ export class CalciteInput {
|
|
|
435
436
|
: null;
|
|
436
437
|
return (h(Host, { onClick: this.inputFocusHandler, onKeyDown: this.keyDownHandler },
|
|
437
438
|
h("div", { class: { [CSS.inputWrapper]: true, [CSS_UTILITY.rtl]: dir === "rtl" }, dir: dir },
|
|
438
|
-
this.type === "number" && this.numberButtonType === "horizontal"
|
|
439
|
+
this.type === "number" && this.numberButtonType === "horizontal" && !this.readOnly
|
|
439
440
|
? numberButtonsHorizontalDown
|
|
440
441
|
: null,
|
|
441
442
|
this.prefixText ? prefixText : null,
|
|
@@ -447,11 +448,11 @@ export class CalciteInput {
|
|
|
447
448
|
this.loading ? loader : null),
|
|
448
449
|
h("div", { class: CSS.actionWrapper },
|
|
449
450
|
h("slot", { name: SLOTS.action })),
|
|
450
|
-
this.type === "number" && this.numberButtonType === "vertical"
|
|
451
|
+
this.type === "number" && this.numberButtonType === "vertical" && !this.readOnly
|
|
451
452
|
? numberButtonsVertical
|
|
452
453
|
: null,
|
|
453
454
|
this.suffixText ? suffixText : null,
|
|
454
|
-
this.type === "number" && this.numberButtonType === "horizontal"
|
|
455
|
+
this.type === "number" && this.numberButtonType === "horizontal" && !this.readOnly
|
|
455
456
|
? numberButtonsHorizontalUp
|
|
456
457
|
: null,
|
|
457
458
|
h(HiddenFormInputSlot, { component: this }))));
|
|
@@ -106,6 +106,49 @@
|
|
|
106
106
|
box-sizing: border-box;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
:host(:hover) .separator:not(:hover):not(:focus),
|
|
110
|
+
:host(:focus-within) .separator:not(:hover):not(:focus) {
|
|
111
|
+
opacity: 1;
|
|
112
|
+
background-color: var(--calcite-ui-border-3);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.separator {
|
|
116
|
+
position: absolute;
|
|
117
|
+
background-color: transparent;
|
|
118
|
+
bottom: 0;
|
|
119
|
+
display: flex;
|
|
120
|
+
height: 100%;
|
|
121
|
+
opacity: 0;
|
|
122
|
+
pointer-events: auto;
|
|
123
|
+
top: 0;
|
|
124
|
+
transition-property: all;
|
|
125
|
+
transition-duration: 150ms;
|
|
126
|
+
transition-timing-function: ease-in-out;
|
|
127
|
+
transition-delay: 0s;
|
|
128
|
+
width: 0.125rem;
|
|
129
|
+
z-index: 10;
|
|
130
|
+
cursor: col-resize;
|
|
131
|
+
outline: none;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.separator:hover {
|
|
135
|
+
opacity: 1;
|
|
136
|
+
background-color: var(--calcite-ui-border-2);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.separator:focus {
|
|
140
|
+
background-color: var(--calcite-ui-brand);
|
|
141
|
+
opacity: 1;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
:host([position=start]) .separator {
|
|
145
|
+
inset-inline-end: -2px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
:host([position=end]) .separator {
|
|
149
|
+
inset-inline-start: -2px;
|
|
150
|
+
}
|
|
151
|
+
|
|
109
152
|
::slotted(calcite-panel),
|
|
110
153
|
::slotted(calcite-flow) {
|
|
111
154
|
flex: 1 1 auto;
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
|
4
4
|
*/
|
|
5
|
-
import { Component, Element, Event, Prop, Watch, h } from "@stencil/core";
|
|
6
|
-
import { CSS, SLOTS } from "./resources";
|
|
5
|
+
import { Component, Element, Event, Prop, Watch, h, State, forceUpdate } from "@stencil/core";
|
|
6
|
+
import { CSS, SLOTS, TEXT } from "./resources";
|
|
7
7
|
import { getSlotted } from "../../utils/dom";
|
|
8
|
+
import { clamp } from "../../utils/math";
|
|
8
9
|
/**
|
|
9
10
|
* @slot - A slot for adding content to the shell panel.
|
|
10
11
|
* @slot action-bar - A slot for adding a `calcite-action-bar` to the panel.
|
|
@@ -32,10 +33,121 @@ export class CalciteShellPanel {
|
|
|
32
33
|
* This sets width of the content area.
|
|
33
34
|
*/
|
|
34
35
|
this.widthScale = "m";
|
|
36
|
+
/**
|
|
37
|
+
* Accessible label for resize separator.
|
|
38
|
+
* @default "Resize"
|
|
39
|
+
*/
|
|
40
|
+
this.intlResize = TEXT.resize;
|
|
41
|
+
/**
|
|
42
|
+
* This property makes the content area resizable if the calcite-shell-panel is not 'detached'.
|
|
43
|
+
*/
|
|
44
|
+
this.resizable = false;
|
|
45
|
+
this.contentWidth = null;
|
|
46
|
+
this.initialContentWidth = null;
|
|
47
|
+
this.initialClientX = null;
|
|
48
|
+
this.contentWidthMax = null;
|
|
49
|
+
this.contentWidthMin = null;
|
|
50
|
+
this.step = 1;
|
|
51
|
+
this.stepMultiplier = 10;
|
|
52
|
+
this.storeContentEl = (contentEl) => {
|
|
53
|
+
this.contentEl = contentEl;
|
|
54
|
+
};
|
|
55
|
+
this.getKeyAdjustedWidth = (event) => {
|
|
56
|
+
const { key } = event;
|
|
57
|
+
const { step, stepMultiplier, contentWidthMin, contentWidthMax, initialContentWidth, position } = this;
|
|
58
|
+
const multipliedStep = step * stepMultiplier;
|
|
59
|
+
const MOVEMENT_KEYS = [
|
|
60
|
+
"ArrowUp",
|
|
61
|
+
"ArrowDown",
|
|
62
|
+
"ArrowLeft",
|
|
63
|
+
"ArrowRight",
|
|
64
|
+
"Home",
|
|
65
|
+
"End",
|
|
66
|
+
"PageUp",
|
|
67
|
+
"PageDown"
|
|
68
|
+
];
|
|
69
|
+
if (MOVEMENT_KEYS.indexOf(key) > -1) {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
}
|
|
72
|
+
const increaseKeys = key === "ArrowUp" || (position === "end" ? key === "ArrowLeft" : key === "ArrowRight");
|
|
73
|
+
if (increaseKeys) {
|
|
74
|
+
const stepValue = event.shiftKey ? multipliedStep : step;
|
|
75
|
+
return initialContentWidth + stepValue;
|
|
76
|
+
}
|
|
77
|
+
const decreaseKeys = key === "ArrowDown" || (position === "end" ? key === "ArrowRight" : key === "ArrowLeft");
|
|
78
|
+
if (decreaseKeys) {
|
|
79
|
+
const stepValue = event.shiftKey ? multipliedStep : step;
|
|
80
|
+
return initialContentWidth - stepValue;
|
|
81
|
+
}
|
|
82
|
+
if (typeof contentWidthMin === "number" && key === "Home") {
|
|
83
|
+
return contentWidthMin;
|
|
84
|
+
}
|
|
85
|
+
if (typeof contentWidthMax === "number" && key === "End") {
|
|
86
|
+
return contentWidthMax;
|
|
87
|
+
}
|
|
88
|
+
if (key === "PageDown") {
|
|
89
|
+
return initialContentWidth - multipliedStep;
|
|
90
|
+
}
|
|
91
|
+
if (key === "PageUp") {
|
|
92
|
+
return initialContentWidth + multipliedStep;
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
};
|
|
96
|
+
this.separatorKeyDown = (event) => {
|
|
97
|
+
this.setInitialContentWidth();
|
|
98
|
+
const width = this.getKeyAdjustedWidth(event);
|
|
99
|
+
if (typeof width === "number") {
|
|
100
|
+
this.setContentWidth(width);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
this.separatorPointerMove = (event) => {
|
|
104
|
+
event.preventDefault();
|
|
105
|
+
const { initialContentWidth, position, initialClientX } = this;
|
|
106
|
+
const offset = event.clientX - initialClientX;
|
|
107
|
+
this.setContentWidth(position === "end" ? initialContentWidth - offset : initialContentWidth + offset);
|
|
108
|
+
};
|
|
109
|
+
this.separatorPointerUp = (event) => {
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
document.removeEventListener("pointerup", this.separatorPointerUp);
|
|
112
|
+
document.removeEventListener("pointermove", this.separatorPointerMove);
|
|
113
|
+
};
|
|
114
|
+
this.setInitialContentWidth = () => {
|
|
115
|
+
var _a;
|
|
116
|
+
this.initialContentWidth = (_a = this.contentEl) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width;
|
|
117
|
+
};
|
|
118
|
+
this.separatorPointerDown = (event) => {
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
const { separatorEl } = this;
|
|
121
|
+
separatorEl && document.activeElement !== separatorEl && separatorEl.focus();
|
|
122
|
+
this.setInitialContentWidth();
|
|
123
|
+
this.initialClientX = event.clientX;
|
|
124
|
+
document.addEventListener("pointerup", this.separatorPointerUp);
|
|
125
|
+
document.addEventListener("pointermove", this.separatorPointerMove);
|
|
126
|
+
};
|
|
127
|
+
this.connectSeparator = (separatorEl) => {
|
|
128
|
+
this.disconnectSeparator();
|
|
129
|
+
this.separatorEl = separatorEl;
|
|
130
|
+
separatorEl.addEventListener("pointerdown", this.separatorPointerDown);
|
|
131
|
+
};
|
|
132
|
+
this.disconnectSeparator = () => {
|
|
133
|
+
var _a;
|
|
134
|
+
(_a = this.separatorEl) === null || _a === void 0 ? void 0 : _a.removeEventListener("pointerdown", this.separatorPointerDown);
|
|
135
|
+
};
|
|
35
136
|
}
|
|
36
137
|
watchHandler() {
|
|
37
138
|
this.calciteShellPanelToggle.emit();
|
|
38
139
|
}
|
|
140
|
+
//--------------------------------------------------------------------------
|
|
141
|
+
//
|
|
142
|
+
// Lifecycle
|
|
143
|
+
//
|
|
144
|
+
//--------------------------------------------------------------------------
|
|
145
|
+
disconnectedCallback() {
|
|
146
|
+
this.disconnectSeparator();
|
|
147
|
+
}
|
|
148
|
+
componentDidLoad() {
|
|
149
|
+
this.updateAriaValues();
|
|
150
|
+
}
|
|
39
151
|
// --------------------------------------------------------------------------
|
|
40
152
|
//
|
|
41
153
|
// Render Methods
|
|
@@ -48,18 +160,53 @@ export class CalciteShellPanel {
|
|
|
48
160
|
h("slot", { name: SLOTS.header }))) : null;
|
|
49
161
|
}
|
|
50
162
|
render() {
|
|
51
|
-
const { collapsed, detached, position } = this;
|
|
52
|
-
const
|
|
163
|
+
const { collapsed, detached, position, initialContentWidth, contentWidth, contentWidthMax, contentWidthMin, intlResize, resizable } = this;
|
|
164
|
+
const allowResizing = !detached && resizable;
|
|
165
|
+
const contentNode = (h("div", { class: { [CSS.content]: true, [CSS.contentDetached]: detached }, hidden: collapsed, ref: this.storeContentEl, style: allowResizing && contentWidth ? { width: `${contentWidth}px` } : null },
|
|
53
166
|
this.renderHeader(),
|
|
54
167
|
h("div", { class: CSS.contentBody },
|
|
55
168
|
h("slot", null))));
|
|
169
|
+
const separatorNode = allowResizing ? (h("div", { "aria-label": intlResize, "aria-orientation": "horizontal", "aria-valuemax": contentWidthMax, "aria-valuemin": contentWidthMin, "aria-valuenow": contentWidth !== null && contentWidth !== void 0 ? contentWidth : initialContentWidth, class: CSS.separator, onKeyDown: this.separatorKeyDown, ref: this.connectSeparator, role: "separator", tabIndex: 0, "touch-action": "none" })) : null;
|
|
56
170
|
const actionBarNode = h("slot", { name: SLOTS.actionBar });
|
|
57
|
-
const mainNodes = [actionBarNode, contentNode];
|
|
171
|
+
const mainNodes = [actionBarNode, contentNode, separatorNode];
|
|
58
172
|
if (position === "end") {
|
|
59
173
|
mainNodes.reverse();
|
|
60
174
|
}
|
|
61
175
|
return h("div", { class: { [CSS.container]: true } }, mainNodes);
|
|
62
176
|
}
|
|
177
|
+
// --------------------------------------------------------------------------
|
|
178
|
+
//
|
|
179
|
+
// private Methods
|
|
180
|
+
//
|
|
181
|
+
// --------------------------------------------------------------------------
|
|
182
|
+
setContentWidth(width) {
|
|
183
|
+
const { contentWidthMax, contentWidthMin } = this;
|
|
184
|
+
const roundedWidth = Math.round(width);
|
|
185
|
+
this.contentWidth =
|
|
186
|
+
typeof contentWidthMax === "number" && typeof contentWidthMin === "number"
|
|
187
|
+
? clamp(roundedWidth, contentWidthMin, contentWidthMax)
|
|
188
|
+
: roundedWidth;
|
|
189
|
+
}
|
|
190
|
+
updateAriaValues() {
|
|
191
|
+
const { contentEl } = this;
|
|
192
|
+
const computedStyle = contentEl && getComputedStyle(contentEl);
|
|
193
|
+
if (!computedStyle) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const max = parseInt(computedStyle.getPropertyValue("max-width"), 10);
|
|
197
|
+
const min = parseInt(computedStyle.getPropertyValue("min-width"), 10);
|
|
198
|
+
const valueNow = parseInt(computedStyle.getPropertyValue("width"), 10);
|
|
199
|
+
if (typeof valueNow === "number" && !isNaN(valueNow)) {
|
|
200
|
+
this.initialContentWidth = valueNow;
|
|
201
|
+
}
|
|
202
|
+
if (typeof max === "number" && !isNaN(max)) {
|
|
203
|
+
this.contentWidthMax = max;
|
|
204
|
+
}
|
|
205
|
+
if (typeof min === "number" && !isNaN(min)) {
|
|
206
|
+
this.contentWidthMin = min;
|
|
207
|
+
}
|
|
208
|
+
forceUpdate(this);
|
|
209
|
+
}
|
|
63
210
|
static get is() { return "calcite-shell-panel"; }
|
|
64
211
|
static get encapsulation() { return "shadow"; }
|
|
65
212
|
static get originalStyleUrls() { return {
|
|
@@ -172,8 +319,50 @@ export class CalciteShellPanel {
|
|
|
172
319
|
},
|
|
173
320
|
"attribute": "position",
|
|
174
321
|
"reflect": true
|
|
322
|
+
},
|
|
323
|
+
"intlResize": {
|
|
324
|
+
"type": "string",
|
|
325
|
+
"mutable": false,
|
|
326
|
+
"complexType": {
|
|
327
|
+
"original": "string",
|
|
328
|
+
"resolved": "string",
|
|
329
|
+
"references": {}
|
|
330
|
+
},
|
|
331
|
+
"required": false,
|
|
332
|
+
"optional": false,
|
|
333
|
+
"docs": {
|
|
334
|
+
"tags": [{
|
|
335
|
+
"name": "default",
|
|
336
|
+
"text": "\"Resize\""
|
|
337
|
+
}],
|
|
338
|
+
"text": "Accessible label for resize separator."
|
|
339
|
+
},
|
|
340
|
+
"attribute": "intl-resize",
|
|
341
|
+
"reflect": false,
|
|
342
|
+
"defaultValue": "TEXT.resize"
|
|
343
|
+
},
|
|
344
|
+
"resizable": {
|
|
345
|
+
"type": "boolean",
|
|
346
|
+
"mutable": false,
|
|
347
|
+
"complexType": {
|
|
348
|
+
"original": "boolean",
|
|
349
|
+
"resolved": "boolean",
|
|
350
|
+
"references": {}
|
|
351
|
+
},
|
|
352
|
+
"required": false,
|
|
353
|
+
"optional": false,
|
|
354
|
+
"docs": {
|
|
355
|
+
"tags": [],
|
|
356
|
+
"text": "This property makes the content area resizable if the calcite-shell-panel is not 'detached'."
|
|
357
|
+
},
|
|
358
|
+
"attribute": "resizable",
|
|
359
|
+
"reflect": true,
|
|
360
|
+
"defaultValue": "false"
|
|
175
361
|
}
|
|
176
362
|
}; }
|
|
363
|
+
static get states() { return {
|
|
364
|
+
"contentWidth": {}
|
|
365
|
+
}; }
|
|
177
366
|
static get events() { return [{
|
|
178
367
|
"method": "calciteShellPanelToggle",
|
|
179
368
|
"name": "calciteShellPanelToggle",
|
|
@@ -7,9 +7,13 @@ export const CSS = {
|
|
|
7
7
|
content: "content",
|
|
8
8
|
contentHeader: "content__header",
|
|
9
9
|
contentBody: "content__body",
|
|
10
|
-
contentDetached: "content--detached"
|
|
10
|
+
contentDetached: "content--detached",
|
|
11
|
+
separator: "separator"
|
|
11
12
|
};
|
|
12
13
|
export const SLOTS = {
|
|
13
14
|
actionBar: "action-bar",
|
|
14
15
|
header: "header"
|
|
15
16
|
};
|
|
17
|
+
export const TEXT = {
|
|
18
|
+
resize: "Resize"
|
|
19
|
+
};
|
|
@@ -26,6 +26,8 @@ export class CalciteSplitButton {
|
|
|
26
26
|
/** optionally add a calcite-loader component to the control,
|
|
27
27
|
disabling interaction. with the primary button */
|
|
28
28
|
this.loading = false;
|
|
29
|
+
/** Describes the type of positioning to use for the dropdown. If your element is in a fixed container, use the 'fixed' value. */
|
|
30
|
+
this.overlayPositioning = "absolute";
|
|
29
31
|
/** specify the scale of the control, defaults to m */
|
|
30
32
|
this.scale = "m";
|
|
31
33
|
/** specify the width of the button, defaults to auto */
|
|
@@ -46,7 +48,7 @@ export class CalciteSplitButton {
|
|
|
46
48
|
h("calcite-button", { appearance: this.appearance, color: this.color, dir: dir, disabled: this.disabled, "icon-end": this.primaryIconEnd ? this.primaryIconEnd : null, "icon-start": this.primaryIconStart ? this.primaryIconStart : null, iconFlipRtl: this.primaryIconFlipRtl ? this.primaryIconFlipRtl : null, label: this.primaryLabel, loading: this.loading, onClick: this.calciteSplitButtonPrimaryClickHandler, scale: this.scale, splitChild: "primary", width: buttonWidth }, this.primaryText),
|
|
47
49
|
h("div", { class: CSS.dividerContainer },
|
|
48
50
|
h("div", { class: CSS.divider })),
|
|
49
|
-
h("calcite-dropdown", { active: this.active, dir: dir, onClick: this.calciteSplitButtonSecondaryClickHandler, placement: "bottom-trailing", scale: this.scale, width: this.scale },
|
|
51
|
+
h("calcite-dropdown", { active: this.active, dir: dir, onClick: this.calciteSplitButtonSecondaryClickHandler, overlayPositioning: this.overlayPositioning, placement: "bottom-trailing", scale: this.scale, width: this.scale },
|
|
50
52
|
h("calcite-button", { appearance: this.appearance, color: this.color, dir: dir, disabled: this.disabled, "icon-start": this.dropdownIcon, label: this.dropdownLabel, scale: this.scale, slot: "dropdown-trigger", splitChild: "secondary" }),
|
|
51
53
|
h("slot", null))));
|
|
52
54
|
}
|
|
@@ -211,6 +213,29 @@ export class CalciteSplitButton {
|
|
|
211
213
|
"reflect": true,
|
|
212
214
|
"defaultValue": "false"
|
|
213
215
|
},
|
|
216
|
+
"overlayPositioning": {
|
|
217
|
+
"type": "string",
|
|
218
|
+
"mutable": false,
|
|
219
|
+
"complexType": {
|
|
220
|
+
"original": "OverlayPositioning",
|
|
221
|
+
"resolved": "\"absolute\" | \"fixed\"",
|
|
222
|
+
"references": {
|
|
223
|
+
"OverlayPositioning": {
|
|
224
|
+
"location": "import",
|
|
225
|
+
"path": "../../utils/popper"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
"required": false,
|
|
230
|
+
"optional": false,
|
|
231
|
+
"docs": {
|
|
232
|
+
"tags": [],
|
|
233
|
+
"text": "Describes the type of positioning to use for the dropdown. If your element is in a fixed container, use the 'fixed' value."
|
|
234
|
+
},
|
|
235
|
+
"attribute": "overlay-positioning",
|
|
236
|
+
"reflect": false,
|
|
237
|
+
"defaultValue": "\"absolute\""
|
|
238
|
+
},
|
|
214
239
|
"primaryIconEnd": {
|
|
215
240
|
"type": "string",
|
|
216
241
|
"mutable": false,
|
|
@@ -63,8 +63,13 @@ let CalciteAlert$1 = class extends HTMLElement {
|
|
|
63
63
|
this.queueLength = 0;
|
|
64
64
|
/** is the alert queued */
|
|
65
65
|
this.queued = false;
|
|
66
|
+
this.autoDismissTimeout = null;
|
|
67
|
+
this.trackTimer = new Date();
|
|
66
68
|
/** close and emit the closed alert and the queue */
|
|
67
69
|
this.closeAlert = () => {
|
|
70
|
+
if (this.autoDismissTimeout) {
|
|
71
|
+
this.autoDismissTimeout = null;
|
|
72
|
+
}
|
|
68
73
|
this.queued = false;
|
|
69
74
|
this.active = false;
|
|
70
75
|
this.queue = this.queue.filter((e) => e !== this.el);
|
|
@@ -88,6 +93,12 @@ let CalciteAlert$1 = class extends HTMLElement {
|
|
|
88
93
|
updateRequestedIcon() {
|
|
89
94
|
this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
|
|
90
95
|
}
|
|
96
|
+
updateDuration(newDuration, prevDuration) {
|
|
97
|
+
if (this.autoDismiss && prevDuration !== newDuration && this.autoDismissTimeout) {
|
|
98
|
+
window.clearTimeout(this.autoDismissTimeout);
|
|
99
|
+
this.autoDismissTimeout = window.setTimeout(() => this.closeAlert(), DURATIONS[this.autoDismissDuration] - (new Date().valueOf() - this.trackTimer.valueOf()));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
91
102
|
//--------------------------------------------------------------------------
|
|
92
103
|
//
|
|
93
104
|
// Lifecycle
|
|
@@ -104,20 +115,25 @@ let CalciteAlert$1 = class extends HTMLElement {
|
|
|
104
115
|
componentDidLoad() {
|
|
105
116
|
this.alertLinkEl = this.el.querySelectorAll("calcite-link")[0];
|
|
106
117
|
}
|
|
118
|
+
disconnectedCallback() {
|
|
119
|
+
if (this.autoDismissTimeout) {
|
|
120
|
+
window.clearTimeout(this.autoDismissTimeout);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
107
123
|
render() {
|
|
108
124
|
const dir = getElementDir(this.el);
|
|
109
125
|
const closeButton = (h("button", { "aria-label": this.intlClose, class: "alert-close", onClick: this.closeAlert, ref: (el) => (this.closeButton = el), type: "button" }, h("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : "s" })));
|
|
110
126
|
const queueText = `+${this.queueLength > 2 ? this.queueLength - 1 : 1}`;
|
|
111
127
|
const queueCount = (h("div", { class: `${this.queueLength > 1 ? "active " : ""}alert-queue-count` }, h("calcite-chip", { scale: this.scale, value: queueText }, queueText)));
|
|
112
128
|
const { active, autoDismiss, label, queued, requestedIcon } = this;
|
|
113
|
-
const
|
|
129
|
+
const progressBar = h("div", { class: "alert-dismiss-progress" });
|
|
114
130
|
const role = autoDismiss ? "alert" : "alertdialog";
|
|
115
131
|
const hidden = !active;
|
|
116
132
|
return (h(Host, { "aria-hidden": hidden.toString(), "aria-label": label, "calcite-hydrated-hidden": hidden, role: role }, h("div", { class: {
|
|
117
133
|
container: true,
|
|
118
134
|
queued,
|
|
119
135
|
[CSS_UTILITY.rtl]: dir === "rtl"
|
|
120
|
-
} }, requestedIcon ? (h("div", { class: "alert-icon" }, h("calcite-icon", { icon: requestedIcon, scale: this.scale === "l" ? "m" : "s" }))) : null, h("div", { class: "alert-content" }, h("slot", { name: SLOTS.title }), h("slot", { name: SLOTS.message }), h("slot", { name: SLOTS.link })), queueCount, !autoDismiss ? closeButton : null, active && !queued && autoDismiss ?
|
|
136
|
+
} }, requestedIcon ? (h("div", { class: "alert-icon" }, h("calcite-icon", { icon: requestedIcon, scale: this.scale === "l" ? "m" : "s" }))) : null, h("div", { class: "alert-content" }, h("slot", { name: SLOTS.title }), h("slot", { name: SLOTS.message }), h("slot", { name: SLOTS.link })), queueCount, !autoDismiss ? closeButton : null, active && !queued && autoDismiss ? progressBar : null)));
|
|
121
137
|
}
|
|
122
138
|
// when an alert is opened or closed, update queue and determine active alert
|
|
123
139
|
alertSync(event) {
|
|
@@ -163,8 +179,8 @@ let CalciteAlert$1 = class extends HTMLElement {
|
|
|
163
179
|
var _a;
|
|
164
180
|
if (((_a = this.queue) === null || _a === void 0 ? void 0 : _a[0]) === this.el) {
|
|
165
181
|
this.openAlert();
|
|
166
|
-
|
|
167
|
-
|
|
182
|
+
if (this.autoDismiss && !this.autoDismissTimeout) {
|
|
183
|
+
this.trackTimer = new Date();
|
|
168
184
|
this.autoDismissTimeout = window.setTimeout(() => this.closeAlert(), DURATIONS[this.autoDismissDuration]);
|
|
169
185
|
}
|
|
170
186
|
}
|
|
@@ -185,7 +201,8 @@ let CalciteAlert$1 = class extends HTMLElement {
|
|
|
185
201
|
static get watchers() { return {
|
|
186
202
|
"active": ["watchActive"],
|
|
187
203
|
"icon": ["updateRequestedIcon"],
|
|
188
|
-
"color": ["updateRequestedIcon"]
|
|
204
|
+
"color": ["updateRequestedIcon"],
|
|
205
|
+
"autoDismissDuration": ["updateDuration"]
|
|
189
206
|
}; }
|
|
190
207
|
static get style() { return calciteAlertCss; }
|
|
191
208
|
};
|
|
@@ -215,12 +215,13 @@ var colorString = createCommonjsModule(function (module) {
|
|
|
215
215
|
/* MIT license */
|
|
216
216
|
|
|
217
217
|
|
|
218
|
+
var hasOwnProperty = Object.hasOwnProperty;
|
|
218
219
|
|
|
219
220
|
var reverseNames = {};
|
|
220
221
|
|
|
221
222
|
// create a list of reverse color names
|
|
222
223
|
for (var name in colorName$1) {
|
|
223
|
-
if (colorName$1
|
|
224
|
+
if (hasOwnProperty.call(colorName$1, name)) {
|
|
224
225
|
reverseNames[colorName$1[name]] = name;
|
|
225
226
|
}
|
|
226
227
|
}
|
|
@@ -263,9 +264,9 @@ cs.get.rgb = function (string) {
|
|
|
263
264
|
|
|
264
265
|
var abbr = /^#([a-f0-9]{3,4})$/i;
|
|
265
266
|
var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
|
|
266
|
-
var rgba = /^rgba?\(\s*([+-]?\d+)\s
|
|
267
|
-
var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s
|
|
268
|
-
var keyword =
|
|
267
|
+
var rgba = /^rgba?\(\s*([+-]?\d+)\s*,?\s*([+-]?\d+)\s*,?\s*([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
|
|
268
|
+
var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
|
|
269
|
+
var keyword = /^(\w+)$/;
|
|
269
270
|
|
|
270
271
|
var rgb = [0, 0, 0, 1];
|
|
271
272
|
var match;
|
|
@@ -302,7 +303,11 @@ cs.get.rgb = function (string) {
|
|
|
302
303
|
}
|
|
303
304
|
|
|
304
305
|
if (match[4]) {
|
|
305
|
-
|
|
306
|
+
if (match[5]) {
|
|
307
|
+
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
308
|
+
} else {
|
|
309
|
+
rgb[3] = parseFloat(match[4]);
|
|
310
|
+
}
|
|
306
311
|
}
|
|
307
312
|
} else if (match = string.match(per)) {
|
|
308
313
|
for (i = 0; i < 3; i++) {
|
|
@@ -310,19 +315,22 @@ cs.get.rgb = function (string) {
|
|
|
310
315
|
}
|
|
311
316
|
|
|
312
317
|
if (match[4]) {
|
|
313
|
-
|
|
318
|
+
if (match[5]) {
|
|
319
|
+
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
320
|
+
} else {
|
|
321
|
+
rgb[3] = parseFloat(match[4]);
|
|
322
|
+
}
|
|
314
323
|
}
|
|
315
324
|
} else if (match = string.match(keyword)) {
|
|
316
325
|
if (match[1] === 'transparent') {
|
|
317
326
|
return [0, 0, 0, 0];
|
|
318
327
|
}
|
|
319
328
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
if (!rgb) {
|
|
329
|
+
if (!hasOwnProperty.call(colorName$1, match[1])) {
|
|
323
330
|
return null;
|
|
324
331
|
}
|
|
325
332
|
|
|
333
|
+
rgb = colorName$1[match[1]];
|
|
326
334
|
rgb[3] = 1;
|
|
327
335
|
|
|
328
336
|
return rgb;
|
|
@@ -348,7 +356,7 @@ cs.get.hsl = function (string) {
|
|
|
348
356
|
|
|
349
357
|
if (match) {
|
|
350
358
|
var alpha = parseFloat(match[4]);
|
|
351
|
-
var h = (parseFloat(match[1]) + 360) % 360;
|
|
359
|
+
var h = ((parseFloat(match[1]) % 360) + 360) % 360;
|
|
352
360
|
var s = clamp(parseFloat(match[2]), 0, 100);
|
|
353
361
|
var l = clamp(parseFloat(match[3]), 0, 100);
|
|
354
362
|
var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
@@ -443,7 +451,7 @@ function clamp(num, min, max) {
|
|
|
443
451
|
}
|
|
444
452
|
|
|
445
453
|
function hexDouble(num) {
|
|
446
|
-
var str = num.toString(16).toUpperCase();
|
|
454
|
+
var str = Math.round(num).toString(16).toUpperCase();
|
|
447
455
|
return (str.length < 2) ? '0' + str : str;
|
|
448
456
|
}
|
|
449
457
|
});
|