Skip to content

Commit

Permalink
Merge branch 'master' into benelan/delay-tab-story
Browse files Browse the repository at this point in the history
  • Loading branch information
benelan authored Feb 8, 2023
2 parents 2bd557b + df132ba commit 472441f
Show file tree
Hide file tree
Showing 26 changed files with 268 additions and 104 deletions.
4 changes: 1 addition & 3 deletions .versionrc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"commitAll": true,
"noVerify": true,
"releaseCommitMessageFormat": "{{currentTag}}",
"skip": {
"changelog": true
},
"scripts": {
"precommit": "ts-node --esm ./support/prepReleaseCommit.ts && npm run lint:md && git add readme.md CHANGELOG.md"
"precommit": "ts-node --esm ./support/prepReleaseCommit.ts"
},
"header": "# Changelog\n\nThis document maintains a list of released versions and changes introduced by them.\nThis project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)\n\n"
}
6 changes: 1 addition & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
This document maintains a list of released versions and changes introduced by them.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)

<!--@unreleased-section-start-->

## Unreleased
## [v1.0.4](https://github.com/Esri/calcite-components/compare/v1.0.3...v1.0.4) (2023-02-07)

### Bug Fixes

Expand All @@ -25,8 +23,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

- **popover:** fix heading padding for m and l scales ([#6341](https://github.com/Esri/calcite-components/issues/6341)) ([6153db9](https://github.com/Esri/calcite-components/commit/6153db98e50152980052f08ec0eeb1a60941cadf)), closes [#5803](https://github.com/Esri/calcite-components/issues/5803)

<!--@unreleased-section-end-->

## [v1.0.3](https://github.com/Esri/calcite-components/compare/v1.0.0-beta.99...v1.0.3) (2023-01-24)

### ⚠ BREAKING CHANGES
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@esri/calcite-components",
"version": "1.1.0-next.2",
"version": "1.0.4",
"description": "Web Components for Esri's Calcite Design System.",
"main": "dist/index.cjs.js",
"module": "dist/index.js",
Expand Down Expand Up @@ -83,7 +83,7 @@
"@babel/preset-react": "7.18.6",
"@esri/calcite-base": "^1.2.0",
"@esri/calcite-colors": "6.1.0",
"@esri/calcite-ui-icons": "3.21.0",
"@esri/calcite-ui-icons": "3.21.2",
"@esri/eslint-plugin-calcite-components": "0.2.2",
"@stencil/eslint-plugin": "0.4.0",
"@stencil/postcss": "2.1.0",
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ Calcite Components, part of Esri's Calcite Design System, is a rich library of f
The most common approach for loading Calcite Components is to use the version hosted on the CDN. The components can be loaded via `<script>` and `<link>` tags in the head of your HTML document:

```html
<script type="module" src="https://unpkg.com/@esri/[email protected].3/dist/calcite/calcite.esm.js"></script>
<script type="module" src="https://unpkg.com/@esri/[email protected].4/dist/calcite/calcite.esm.js"></script>
<link
rel="stylesheet"
type="text/css"
href="https://unpkg.com/@esri/[email protected].3/dist/calcite/calcite.css"
href="https://unpkg.com/@esri/[email protected].4/dist/calcite/calcite.css"
/>
```

Expand Down
2 changes: 1 addition & 1 deletion src/components/checkbox/checkbox.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("calcite-checkbox", () => {
it("is labelable", async () =>
labelable("calcite-checkbox", { propertyToToggle: "checked", shadowFocusTargetSelector: ".toggle" }));

it("is form-associated", async () => formAssociated("calcite-checkbox", { testValue: true }));
it("is form-associated", async () => formAssociated("calcite-checkbox", { testValue: true, inputType: "checkbox" }));

it("can be disabled", () => disabled("calcite-checkbox"));

Expand Down
4 changes: 4 additions & 0 deletions src/components/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ export class Checkbox
//
//--------------------------------------------------------------------------

syncHiddenFormInput(input: HTMLInputElement): void {
input.type = "checkbox";
}

getPath = (): string =>
this.indeterminate ? this.indeterminatePath : this.checked ? this.checkedPath : "";

Expand Down
1 change: 0 additions & 1 deletion src/components/date-picker/date-picker.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { E2EPage, newE2EPage } from "@stencil/core/testing";
import { html } from "../../../support/formatting";
import { defaults, hidden, renders, t9n } from "../../tests/commonTests";
import { skipAnimations } from "../../tests/utils";
import { dateFromISO } from "../../utils/date";
import { formatTimePart } from "../../utils/time";

describe("calcite-date-picker", () => {
Expand Down
16 changes: 13 additions & 3 deletions src/components/input-number/input-number.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
renders,
t9n
} from "../../tests/commonTests";
import { getElementXY } from "../../tests/utils";
import { getElementXY, selectText } from "../../tests/utils";
import { letterKeys, numberKeys } from "../../utils/key";
import { locales, numberStringFormatter } from "../../utils/locale";

Expand Down Expand Up @@ -724,6 +724,15 @@ describe("calcite-input-number", () => {
expect(await element.getProperty("value")).toBe(programmaticSetValue);
expect(calciteInputNumberInput).toHaveReceivedEventTimes(10);
expect(calciteInputNumberChange).toHaveReceivedEventTimes(2);

await element.callMethod("setFocus");
await selectText(element);
await page.keyboard.press("Backspace");
await page.keyboard.press("Tab");

expect(await element.getProperty("value")).toBe("");
expect(calciteInputNumberInput).toHaveReceivedEventTimes(11);
expect(calciteInputNumberChange).toHaveReceivedEventTimes(3);
}

it("emits events", () => assertChangeEvents());
Expand Down Expand Up @@ -1467,9 +1476,10 @@ describe("calcite-input-number", () => {
});

it("is form-associated", () =>
formAssociated("<calcite-input-number></calcite-input-number>", {
formAssociated("calcite-input-number", {
testValue: 5,
submitsOnEnter: true
submitsOnEnter: true,
inputType: "number"
}));

it("supports translation", () => t9n("calcite-input-number"));
Expand Down
28 changes: 17 additions & 11 deletions src/components/input-number/input-number.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ export class InputNumber

private maxString?: string;

private previousEmittedValue: string;
private previousEmittedNumberValue: string;

private previousValue: string;

Expand Down Expand Up @@ -559,10 +559,10 @@ export class InputNumber
};

private emitChangeIfUserModified = (): void => {
if (this.previousValueOrigin === "user" && this.value !== this.previousEmittedValue) {
if (this.previousValueOrigin === "user" && this.value !== this.previousEmittedNumberValue) {
this.calciteInputNumberChange.emit();
this.setPreviousEmittedNumberValue(this.value);
}
this.previousEmittedValue = this.value;
};

private inputNumberBlurHandler = () => {
Expand Down Expand Up @@ -780,14 +780,16 @@ export class InputNumber
this.childNumberEl.value = newInputValue;
};

private setPreviousEmittedNumberValue = (newPreviousEmittedValue: string): void => {
this.previousEmittedValue = isValidNumber(newPreviousEmittedValue)
? newPreviousEmittedValue
: "";
private setPreviousEmittedNumberValue = (value: string): void => {
this.previousEmittedNumberValue = this.normalizeValue(value);
};

private setPreviousNumberValue = (newPreviousValue: string): void => {
this.previousValue = isValidNumber(newPreviousValue) ? newPreviousValue : "";
private normalizeValue(value: string): string {
return isValidNumber(value) ? value : "";
}

private setPreviousNumberValue = (value: string): void => {
this.previousValue = this.normalizeValue(value);
};

private setNumberValue = ({
Expand Down Expand Up @@ -826,13 +828,17 @@ export class InputNumber
const newLocalizedValue = numberStringFormatter.localize(newValue);
this.localizedValue = newLocalizedValue;

this.setPreviousNumberValue(previousValue || this.value);
this.setPreviousNumberValue(previousValue ?? this.value);
this.previousValueOrigin = origin;
this.userChangedValue = origin === "user" && this.value !== newValue;
// don't sanitize the start of negative/decimal numbers, but
// don't set value to an invalid number
this.value = ["-", "."].includes(newValue) ? "" : newValue;
origin === "direct" && this.setInputNumberValue(newLocalizedValue);

if (origin === "direct") {
this.setInputNumberValue(newLocalizedValue);
this.setPreviousEmittedNumberValue(newLocalizedValue);
}

if (nativeEvent) {
const calciteInputNumberInputEvent = this.calciteInputNumberInput.emit();
Expand Down
10 changes: 10 additions & 0 deletions src/components/input-text/input-text.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
renders,
t9n
} from "../../tests/commonTests";
import { selectText } from "../../tests/utils";

describe("calcite-input-text", () => {
it("is labelable", async () => labelable("calcite-input-text"));
Expand Down Expand Up @@ -159,6 +160,15 @@ describe("calcite-input-text", () => {
expect(await element.getProperty("value")).toBe(programmaticSetValue);
expect(calciteInputTextInput).toHaveReceivedEventTimes(10);
expect(calciteInputTextChange).toHaveReceivedEventTimes(2);

await element.callMethod("setFocus");
await selectText(element);
await page.keyboard.press("Backspace");
await page.keyboard.press("Tab");

expect(await element.getProperty("value")).toBe("");
expect(calciteInputTextInput).toHaveReceivedEventTimes(11);
expect(calciteInputTextChange).toHaveReceivedEventTimes(3);
});

it("renders clear button when clearable is requested and value is populated at load", async () => {
Expand Down
13 changes: 7 additions & 6 deletions src/components/input-text/input-text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,8 @@ export class InputText
private emitChangeIfUserModified = (): void => {
if (this.previousValueOrigin === "user" && this.value !== this.previousEmittedValue) {
this.calciteInputTextChange.emit();
this.setPreviousEmittedValue(this.value);
}
this.previousEmittedValue = this.value;
};

private inputTextBlurHandler = () => {
Expand Down Expand Up @@ -532,12 +532,12 @@ export class InputText
this.childEl.value = newInputValue;
};

private setPreviousEmittedValue = (newPreviousEmittedValue: string): void => {
this.previousEmittedValue = newPreviousEmittedValue;
private setPreviousEmittedValue = (value: string): void => {
this.previousEmittedValue = value;
};

private setPreviousValue = (newPreviousValue: string): void => {
this.previousValue = newPreviousValue;
private setPreviousValue = (value: string): void => {
this.previousValue = value;
};

private setValue = ({
Expand All @@ -553,13 +553,14 @@ export class InputText
previousValue?: string;
value: string;
}): void => {
this.setPreviousValue(previousValue || this.value);
this.setPreviousValue(previousValue ?? this.value);
this.previousValueOrigin = origin;
this.userChangedValue = origin === "user" && value !== this.value;
this.value = value;

if (origin === "direct") {
this.setInputValue(value);
this.setPreviousEmittedValue(value);
}

if (nativeEvent) {
Expand Down
Loading

0 comments on commit 472441f

Please sign in to comment.