Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@atlaskit/width-detector

atlassian77.3kApache-2.05.0.5TypeScript support: included

Wrapper for components that need to respond to width changes

atlaskit, react, ui

readme

Width-detector

This is a utility component that informs the child function of the available width.

Installation

yarn add @atlaskit/width-detector

Usage

You can see examples learn more about the usage of this component.

Notes

The default export WidthDetector will be deprecated in the next major release of width-detector. Follow our upgrade guide and examples to migrate to WidthObserver.

Migration guide can be found here.

Acknowledgements

This size detection method used by this component is inspired by Federico Zivolo's awesome react-resize-aware project, which Atlassian has contributed a PR back to.

changelog

@atlaskit/width-detector

5.0.5

Patch Changes

  • 23bcc5bbc9cee - Internal changes to how border radius is applied.

5.0.4

Patch Changes

  • #193214 c661806a65543 - Internal changes to how border radius and border width values are applied. No visual change.

5.0.3

Patch Changes

5.0.2

Patch Changes

  • #148201 8e811f1840de7 - Either actively or pre-emptively fixes a bug with keyframe animations in CJS and ESM distribution targets for packages using Compiled CSS-in-JS. This may not affect this package, but the change was made so a future migration does not accidentally break it.

5.0.1

Patch Changes

5.0.0

Major Changes

4.4.0

Minor Changes

4.3.2

Patch Changes

4.3.1

Patch Changes

  • #166026 962b5e77810fb - Adds side-effect config to support Compiled css extraction in third-party apps

4.3.0

Minor Changes

  • #127511 db30e29344013 - Widening range of react and react-dom peer dependencies from ^16.8.0 || ^17.0.0 || ~18.2.0 to the wider range of ^16.8.0 || ^17.0.0 || ^18.0.0` (where applicable).

    This change has been done to enable usage of `react@18.3as well as to have a consistent peer dependency range forreactandreact-domfor/platform` packages.

4.2.0

Minor Changes

4.1.10

Patch Changes

4.1.9

Patch Changes

  • #81900 4de6e56a074b - Explicitly coerce value in useInView to improve compatibility with TypeScript 5

4.1.8

Patch Changes

4.1.7

Patch Changes

  • #59147 f12e489f23b0 - Re-build and deploy packages to NPM to resolve React/Compiled not found error (HOT-106483).

4.1.6

Patch Changes

  • #57118 b9bd80957181 - Upgrade Emotion v10 (@emotion/core) to Emotion v11 (@emotion/react). No behaviour change expected.

4.1.5

Patch Changes

4.1.4

Patch Changes

4.1.3

Patch Changes

4.1.2

Patch Changes

4.1.1

Patch Changes

4.1.0

Minor Changes

4.0.3

Patch Changes

4.0.2

Patch Changes

4.0.1

Patch Changes

4.0.0

Major Changes

  • #19618 e78e261ac6f - [ux] ED-14487: Removed IE11/Edge18 support in @atlaskit/width-detector. No longer exporting IframeWidthObserverFallbackWrapper and IframeWrapperConsumer.

    • Fixed example pages
    • Updated docs/comments
    • Removed tests

3.0.8

Patch Changes

3.0.7

Patch Changes

3.0.6

Patch Changes

3.0.5

Patch Changes

3.0.4

Patch Changes

  • #5497 5f58283e1f - Export types using Typescript's new "export type" syntax to satisfy Typescript's --isolatedModules compiler option. This requires version 3.8 of Typescript, read more about how we handle Typescript versions here: https://atlaskit.atlassian.com/get-started Also add typescript to devDependencies to denote version that the package was built with.

3.0.3

Patch Changes

  • #3885 6c525a8229 - Upgraded to TypeScript 3.9.6 and tslib to 2.0.0

    Since tslib is a dependency for all our packages we recommend that products also follow this tslib upgrade to prevent duplicates of tslib being bundled.

3.0.2

Patch Changes

3.0.1

Patch Changes

  • #3823 6262f382de - Use the 'lodash' package instead of single-function 'lodash.*' packages

3.0.0

Major Changes

2.2.0

Minor Changes

2.1.1

Patch Changes

  • #2093 359575566a - [NO-ISSUE] Move the WidthDetector deprecated warning to the constructor avoid unnecessary logs everywhere.- Updated dependencies

2.1.0

Minor Changes

  • [minor]67bc25bc3f:

    Move WidthObserver from editor-common to width-detector

    WidthObserver is a more performant version of WidthDetector and should be used going forward.

    import { WidthObserver } from '@atlaskit/width-detector';
    
    <WidthObserver setWidth={(width) => console.log(`width has changed to ${width}`)} />;

Patch Changes

  • [patch]109004a98e:

    Deletes internal package @atlaskit/type-helpers and removes all usages. @atlaskit/type-helpers has been superseded by native typescript helper utilities.- Updated dependencies 168b5f90e5:

2.0.10

Patch Changes

2.0.9

Patch Changes

  • [patch]35d2229b2a:

    Adding missing license to packages and update to Copyright 2019 Atlassian Pty Ltd.

2.0.8

Patch Changes

  • [patch]a2d0043716:

    Updated version of analytics-next to fix potential incompatibilities with TS 3.6

2.0.7

Patch Changes

  • [patch]5b65eefdec:

    Removes duplicate export from the main entrypoint file

2.0.6

Patch Changes

  • [patch]097b696613:

    Components now depend on TS 3.6 internally, in order to fix an issue with TS resolving non-relative imports as relative imports

2.0.5

Patch Changes

2.0.4

Patch Changes

  • [patch]de35ce8c67:

    Updates component maintainers

2.0.3

Patch Changes

  • [patch]bbff8a7d87:

    Fixes bug, missing version.json file

2.0.2

Patch Changes

  • [patch]18dfac7332:

    In this PR, we are:

    • Re-introducing dist build folders
    • Adding back cjs
    • Replacing es5 by cjs and es2015 by esm
    • Creating folders at the root for entry-points
    • Removing the generation of the entry-points at the root Please see this ticket or this page for further details

2.0.1

Patch Changes

  • [patch]29a1f158c1:

    Use default react import in typescript files.

2.0.0

  • [major]7c17b35107:

    • Updates react and react-dom peer dependencies to react@^16.8.0 and react-dom@^16.8.0. To use this package, please ensure you use at least this version of react and react-dom.

1.0.0

  • [major]87f0209201:

    • This major release indicates that this package is no longer under dev preview but is ready for use

0.3.5

0.3.4

  • [patch]83b920afd3:

    • Fix bug when content changes size between mount and object onload

0.3.3

  • [patch]3f28e6443c:

    • @atlaskit/analytics-next-types is deprecated. Now you can use types for @atlaskit/analytics-next supplied from itself.

0.3.2

  • [patch]d13fad66df:

    • Enable esModuleInterop for typescript, this allows correct use of default exports

0.3.1

  • [patch]1bcaa1b991:

    • Add npmignore for index.ts to prevent some jest tests from resolving that instead of index.js

0.3.0

  • [minor]9d5cc39394:

    • Dropped ES5 distributables from the typescript packages

0.2.2

  • [patch]5b226754b8:

    • ED-5939: Replace SizeDetector with WidthDetector in all editor components

0.2.1

0.2.0

  • [minor]6cc3a8fea4:

    • Initial version of the WidthDetector component, modeled on the SizeDetector component.