Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into release-please--bra…
Browse files Browse the repository at this point in the history
…nches--master

* origin/master:
  build(t9n): generate json file containing t9n values (#7214)
  chore: release next
  fix(combobox, dropdown, input-date-picker, input-time-picker, popover, tooltip): Prevent repositioning from affecting other floating components (#7178)
  build: update browserslist db (#7192)
  build: ignore node_modules and build outputs when watching for changes during stencil tests (#7209)
  • Loading branch information
benelan committed Jun 26, 2023
2 parents b01ff4e + 11d93b2 commit be44c41
Show file tree
Hide file tree
Showing 8 changed files with 245 additions and 156 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions packages/calcite-components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Bug Fixes

- **combobox, dropdown, input-date-picker, input-time-picker, popover, tooltip:** Prevent repositioning from affecting other floating components ([#7178](https://github.com/Esri/calcite-components/issues/7178)) ([1b02dae](https://github.com/Esri/calcite-components/commit/1b02dae4ef4e9594ece0a72bb8bc69fd2f7cf84a)), closes [#7158](https://github.com/Esri/calcite-components/issues/7158)

- **alert:** Sets autoCloseDuration to "medium" by default ([#7157](https://github.com/Esri/calcite-components/issues/7157)) ([1b9a8ed](https://github.com/Esri/calcite-components/commit/1b9a8edc1b7fab87899bd59c74ad036b5f53140c))
- **alert:** Update alert queue when an alert is removed from the DOM ([#7189](https://github.com/Esri/calcite-components/issues/7189)) ([edd59eb](https://github.com/Esri/calcite-components/commit/edd59eb0bff21aa41fc7e537a2df2dbd2143a15a))
- Ensure mouse events are blocked for disabled components in Firefox ([#7107](https://github.com/Esri/calcite-components/issues/7107)) ([271d985](https://github.com/Esri/calcite-components/commit/271d9855eef4aa94cb7131381c98ab03eea57e4e))
Expand Down
3 changes: 2 additions & 1 deletion packages/calcite-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"scripts": {
"build": "npm run util:prep-build-reqs && stencil build",
"postbuild": "npm run util:patch && git restore src/components/*/readme.md",
"postbuild": "npm run util:patch && npm run util:generate-t9n-docs-json && git restore src/components/*/readme.md",
"build:watch": "npm run util:prep-build-reqs && stencil build --no-docs --watch",
"build:watch-dev": "npm run util:prep-build-reqs && stencil build --no-docs --dev --watch",
"build-storybook": "npm run util:build-docs && build-storybook --output-dir ./docs --quiet",
Expand All @@ -43,6 +43,7 @@
"util:clean-tested-build": "npm ci && npm test && npm run build",
"util:copy-assets": "npm run util:copy-icons",
"util:copy-icons": "cpy \"../../node_modules/@esri/calcite-ui-icons/js/*.json\" \"./src/components/icon/assets/icon/\" --flat",
"util:generate-t9n-docs-json": "ts-node --esm support/generateT9nDocsJSON.ts",
"util:generate-t9n-types": "ts-node --esm support/generateT9nTypes.ts",
"util:hydration-styles": "ts-node --esm support/hydrationStyles.ts",
"util:patch": "npm run util:patch-esm-resolution && npm run util:patch-tree-shaking",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ export class InputTimePicker

private getExtendedLocaleConfig(
locale: string
): Parameters<typeof dayjs["updateLocale"]>[1] | undefined {
): Parameters<(typeof dayjs)["updateLocale"]>[1] | undefined {
if (locale === "ar") {
return {
meridiem: (hour) => (hour > 12 ? "م" : "ص"),
Expand Down
33 changes: 28 additions & 5 deletions packages/calcite-components/src/utils/floating-ui.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import { waitForAnimationFrame } from "../tests/utils";
import {
import * as floatingUI from "./floating-ui";
import { FloatingUIComponent } from "./floating-ui";

const {
cleanupMap,
connectFloatingUI,
defaultOffsetDistance,
disconnectFloatingUI,
effectivePlacements,
filterComputedPlacements,
FloatingUIComponent,
getEffectivePlacement,
placements,
positionFloatingUI,
reposition,
repositionDebounceTimeout
} from "./floating-ui";
} = floatingUI;

import * as floatingUIDOM from "@floating-ui/dom";

Expand Down Expand Up @@ -56,15 +58,19 @@ describe("repositioning", () => {
let referenceEl: HTMLButtonElement;
let positionOptions: Parameters<typeof positionFloatingUI>[1];

beforeEach(() => {
fakeFloatingUiComponent = {
function createFakeFloatingUiComponent(): FloatingUIComponent {
return {
open: false,
reposition: async () => {
/* noop */
},
overlayPositioning: "absolute",
placement: "auto"
};
}

beforeEach(() => {
fakeFloatingUiComponent = createFakeFloatingUiComponent();

floatingEl = document.createElement("div");
referenceEl = document.createElement("button");
Expand Down Expand Up @@ -155,6 +161,23 @@ describe("repositioning", () => {
expect(floatingEl.style.position).toBe("fixed");
});
});

it("debounces positioning per instance", async () => {
const positionSpy = jest.spyOn(floatingUI, "positionFloatingUI");
fakeFloatingUiComponent.open = true;

const anotherFakeFloatingUiComponent = createFakeFloatingUiComponent();
anotherFakeFloatingUiComponent.open = true;

floatingUI.reposition(fakeFloatingUiComponent, positionOptions, true);
expect(positionSpy).toHaveBeenCalledTimes(1);

floatingUI.reposition(anotherFakeFloatingUiComponent, positionOptions, true);
expect(positionSpy).toHaveBeenCalledTimes(2);

await new Promise<void>((resolve) => setTimeout(resolve, repositionDebounceTimeout));
expect(positionSpy).toHaveBeenCalledTimes(2);
});
});

it("should have correct value for defaultOffsetDistance", () => {
Expand Down
Loading

0 comments on commit be44c41

Please sign in to comment.