@atlaskit/skeleton 0.1.0
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/CHANGELOG.md +7 -0
- package/LICENSE.md +13 -0
- package/README.md +9 -0
- package/dist/cjs/index.js +13 -0
- package/dist/cjs/ui/index.js +54 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/ui/index.js +48 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/ui/index.js +47 -0
- package/dist/esm/version.json +5 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/ui/index.d.ts +32 -0
- package/package.json +89 -0
- package/report.api.md +56 -0
- package/tmp/api-report-tmp.d.ts +25 -0
package/CHANGELOG.md
ADDED
package/LICENSE.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2022 Atlassian Pty Ltd
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Skeleton
|
|
2
|
+
|
|
3
|
+
A skeleton acts as a placeholder for content, usually while the content loads.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
`import Skeleton from '@atlaskit/skeleton';`
|
|
8
|
+
|
|
9
|
+
Detailed docs and example usage can be found [here](https://atlaskit.atlassian.com/packages/design-system/skeleton).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _ui.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _ui = _interopRequireDefault(require("./ui"));
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _react = require("@emotion/react");
|
|
11
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
|
+
var shimmer = (0, _constants.skeletonShimmer)();
|
|
15
|
+
var shimmerKeyframes = (0, _react.keyframes)(shimmer.keyframes);
|
|
16
|
+
var skeletonStyles = (0, _react.css)(_objectSpread({}, shimmer.css));
|
|
17
|
+
var activeShimmerStyles = (0, _react.css)({
|
|
18
|
+
animationName: "".concat(shimmerKeyframes)
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* __Skeleton__
|
|
23
|
+
*
|
|
24
|
+
* A skeleton acts as a placeholder for content, usually while the content loads.
|
|
25
|
+
*
|
|
26
|
+
* - [Examples](https://atlassian.design/components/skeleton/examples)
|
|
27
|
+
* - [Code](https://atlassian.design/components/skeleton/code)
|
|
28
|
+
*/
|
|
29
|
+
var Skeleton = function Skeleton(_ref) {
|
|
30
|
+
var width = _ref.width,
|
|
31
|
+
height = _ref.height,
|
|
32
|
+
_ref$borderRadius = _ref.borderRadius,
|
|
33
|
+
borderRadius = _ref$borderRadius === void 0 ? '100px' : _ref$borderRadius,
|
|
34
|
+
_ref$isShimmering = _ref.isShimmering,
|
|
35
|
+
isShimmering = _ref$isShimmering === void 0 ? false : _ref$isShimmering,
|
|
36
|
+
groupName = _ref.groupName,
|
|
37
|
+
testId = _ref.testId;
|
|
38
|
+
var groupDataAttribute = groupName && "data-".concat(groupName);
|
|
39
|
+
return (
|
|
40
|
+
// eslint-disable-next-line @repo/internal/react/use-primitives
|
|
41
|
+
(0, _react.jsx)("div", (0, _extends2.default)({
|
|
42
|
+
"data-testid": testId,
|
|
43
|
+
css: [skeletonStyles, isShimmering && activeShimmerStyles,
|
|
44
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
45
|
+
{
|
|
46
|
+
width: width,
|
|
47
|
+
height: height,
|
|
48
|
+
borderRadius: borderRadius
|
|
49
|
+
}]
|
|
50
|
+
}, groupDataAttribute && (0, _defineProperty2.default)({}, groupDataAttribute, 'true')))
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
var _default = Skeleton;
|
|
54
|
+
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ui';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { css, jsx, keyframes } from '@emotion/react';
|
|
4
|
+
import { skeletonShimmer } from '@atlaskit/theme/constants';
|
|
5
|
+
const shimmer = skeletonShimmer();
|
|
6
|
+
const shimmerKeyframes = keyframes(shimmer.keyframes);
|
|
7
|
+
const skeletonStyles = css({
|
|
8
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
9
|
+
...shimmer.css
|
|
10
|
+
});
|
|
11
|
+
const activeShimmerStyles = css({
|
|
12
|
+
animationName: `${shimmerKeyframes}`
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* __Skeleton__
|
|
17
|
+
*
|
|
18
|
+
* A skeleton acts as a placeholder for content, usually while the content loads.
|
|
19
|
+
*
|
|
20
|
+
* - [Examples](https://atlassian.design/components/skeleton/examples)
|
|
21
|
+
* - [Code](https://atlassian.design/components/skeleton/code)
|
|
22
|
+
*/
|
|
23
|
+
const Skeleton = ({
|
|
24
|
+
width,
|
|
25
|
+
height,
|
|
26
|
+
borderRadius = '100px',
|
|
27
|
+
isShimmering = false,
|
|
28
|
+
groupName,
|
|
29
|
+
testId
|
|
30
|
+
}) => {
|
|
31
|
+
const groupDataAttribute = groupName && `data-${groupName}`;
|
|
32
|
+
return (
|
|
33
|
+
// eslint-disable-next-line @repo/internal/react/use-primitives
|
|
34
|
+
jsx("div", _extends({
|
|
35
|
+
"data-testid": testId,
|
|
36
|
+
css: [skeletonStyles, isShimmering && activeShimmerStyles,
|
|
37
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
38
|
+
{
|
|
39
|
+
width,
|
|
40
|
+
height,
|
|
41
|
+
borderRadius
|
|
42
|
+
}]
|
|
43
|
+
}, groupDataAttribute && {
|
|
44
|
+
[groupDataAttribute]: 'true'
|
|
45
|
+
}))
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
export default Skeleton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ui';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
/** @jsx jsx */
|
|
6
|
+
import { css, jsx, keyframes } from '@emotion/react';
|
|
7
|
+
import { skeletonShimmer } from '@atlaskit/theme/constants';
|
|
8
|
+
var shimmer = skeletonShimmer();
|
|
9
|
+
var shimmerKeyframes = keyframes(shimmer.keyframes);
|
|
10
|
+
var skeletonStyles = css(_objectSpread({}, shimmer.css));
|
|
11
|
+
var activeShimmerStyles = css({
|
|
12
|
+
animationName: "".concat(shimmerKeyframes)
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* __Skeleton__
|
|
17
|
+
*
|
|
18
|
+
* A skeleton acts as a placeholder for content, usually while the content loads.
|
|
19
|
+
*
|
|
20
|
+
* - [Examples](https://atlassian.design/components/skeleton/examples)
|
|
21
|
+
* - [Code](https://atlassian.design/components/skeleton/code)
|
|
22
|
+
*/
|
|
23
|
+
var Skeleton = function Skeleton(_ref) {
|
|
24
|
+
var width = _ref.width,
|
|
25
|
+
height = _ref.height,
|
|
26
|
+
_ref$borderRadius = _ref.borderRadius,
|
|
27
|
+
borderRadius = _ref$borderRadius === void 0 ? '100px' : _ref$borderRadius,
|
|
28
|
+
_ref$isShimmering = _ref.isShimmering,
|
|
29
|
+
isShimmering = _ref$isShimmering === void 0 ? false : _ref$isShimmering,
|
|
30
|
+
groupName = _ref.groupName,
|
|
31
|
+
testId = _ref.testId;
|
|
32
|
+
var groupDataAttribute = groupName && "data-".concat(groupName);
|
|
33
|
+
return (
|
|
34
|
+
// eslint-disable-next-line @repo/internal/react/use-primitives
|
|
35
|
+
jsx("div", _extends({
|
|
36
|
+
"data-testid": testId,
|
|
37
|
+
css: [skeletonStyles, isShimmering && activeShimmerStyles,
|
|
38
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
39
|
+
{
|
|
40
|
+
width: width,
|
|
41
|
+
height: height,
|
|
42
|
+
borderRadius: borderRadius
|
|
43
|
+
}]
|
|
44
|
+
}, groupDataAttribute && _defineProperty({}, groupDataAttribute, 'true')))
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
export default Skeleton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ui';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
declare type SkeletonProps = {
|
|
4
|
+
width: string | number;
|
|
5
|
+
height: string | number;
|
|
6
|
+
/**
|
|
7
|
+
* Defaults to 100px to allow for any reasonable size skeleton having rounded corners.
|
|
8
|
+
*/
|
|
9
|
+
borderRadius?: string | number;
|
|
10
|
+
/**
|
|
11
|
+
* Enables the shimmering animation.
|
|
12
|
+
*/
|
|
13
|
+
isShimmering?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Applied as a data-attribute. Use this to target groups of skeletons with the same name (e.g. for applying custom styles)
|
|
16
|
+
* ```
|
|
17
|
+
* groupName="my-skeleton" -> <div data-my-skeleton>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
groupName?: string;
|
|
21
|
+
testId?: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* __Skeleton__
|
|
25
|
+
*
|
|
26
|
+
* A skeleton acts as a placeholder for content, usually while the content loads.
|
|
27
|
+
*
|
|
28
|
+
* - [Examples](https://atlassian.design/components/skeleton/examples)
|
|
29
|
+
* - [Code](https://atlassian.design/components/skeleton/code)
|
|
30
|
+
*/
|
|
31
|
+
declare const Skeleton: ({ width, height, borderRadius, isShimmering, groupName, testId, }: SkeletonProps) => jsx.JSX.Element;
|
|
32
|
+
export default Skeleton;
|
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/skeleton",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A skeleton acts as a placeholder for content, usually while the content loads.",
|
|
5
|
+
"author": "Atlassian Pty Ltd",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"registry": "https://registry.npmjs.org/"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://atlassian.design/components/skeleton",
|
|
11
|
+
"atlassian": {
|
|
12
|
+
"team": "Design System Team",
|
|
13
|
+
"inPublicMirror": false,
|
|
14
|
+
"releaseModel": "continuous",
|
|
15
|
+
"website": {
|
|
16
|
+
"name": "Skeleton",
|
|
17
|
+
"category": "Components",
|
|
18
|
+
"status": {
|
|
19
|
+
"type": "alpha"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
24
|
+
"main": "dist/cjs/index.js",
|
|
25
|
+
"module": "dist/esm/index.js",
|
|
26
|
+
"module:es2019": "dist/es2019/index.js",
|
|
27
|
+
"types": "dist/types/index.d.ts",
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"atlaskit:src": "src/index.tsx",
|
|
30
|
+
"af:exports": {
|
|
31
|
+
".": "./src/index.tsx"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@atlaskit/theme": "^12.2.0",
|
|
35
|
+
"@babel/runtime": "^7.0.0",
|
|
36
|
+
"@emotion/react": "^11.7.1"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"react": "^16.8.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@atlaskit/docs": "*",
|
|
43
|
+
"@atlaskit/ds-explorations": "^2.0.5",
|
|
44
|
+
"@atlaskit/primitives": "^0.2.1",
|
|
45
|
+
"@atlaskit/ssr": "*",
|
|
46
|
+
"@atlaskit/visual-regression": "*",
|
|
47
|
+
"@atlaskit/webdriver-runner": "*",
|
|
48
|
+
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
49
|
+
"@testing-library/react": "^12.1.5",
|
|
50
|
+
"react-dom": "^16.8.0",
|
|
51
|
+
"typescript": "4.5.5",
|
|
52
|
+
"wait-for-expect": "^1.2.0"
|
|
53
|
+
},
|
|
54
|
+
"techstack": {
|
|
55
|
+
"@atlassian/frontend": {
|
|
56
|
+
"code-structure": [
|
|
57
|
+
"tangerine-next"
|
|
58
|
+
],
|
|
59
|
+
"import-structure": [
|
|
60
|
+
"atlassian-conventions"
|
|
61
|
+
],
|
|
62
|
+
"circular-dependencies": [
|
|
63
|
+
"file-and-folder-level"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"@repo/internal": {
|
|
67
|
+
"dom-events": "use-bind-event-listener",
|
|
68
|
+
"analytics": [
|
|
69
|
+
"analytics-next"
|
|
70
|
+
],
|
|
71
|
+
"theming": [
|
|
72
|
+
"react-context",
|
|
73
|
+
"tokens"
|
|
74
|
+
],
|
|
75
|
+
"ui-components": [
|
|
76
|
+
"primitives",
|
|
77
|
+
"lite-mode"
|
|
78
|
+
],
|
|
79
|
+
"deprecation": [
|
|
80
|
+
"no-deprecated-imports"
|
|
81
|
+
],
|
|
82
|
+
"styling": [
|
|
83
|
+
"static",
|
|
84
|
+
"emotion"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
89
|
+
}
|
package/report.api.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!-- API Report Version: 2.3 -->
|
|
2
|
+
|
|
3
|
+
## API Report File for "@atlaskit/skeleton"
|
|
4
|
+
|
|
5
|
+
> Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
|
|
6
|
+
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
|
+
|
|
8
|
+
### Table of contents
|
|
9
|
+
|
|
10
|
+
- [Main Entry Types](#main-entry-types)
|
|
11
|
+
- [Peer Dependencies](#peer-dependencies)
|
|
12
|
+
|
|
13
|
+
### Main Entry Types
|
|
14
|
+
|
|
15
|
+
<!--SECTION START: Main Entry Types-->
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { jsx } from '@emotion/react';
|
|
19
|
+
|
|
20
|
+
// @public
|
|
21
|
+
const Skeleton: ({
|
|
22
|
+
width,
|
|
23
|
+
height,
|
|
24
|
+
borderRadius,
|
|
25
|
+
isShimmering,
|
|
26
|
+
groupName,
|
|
27
|
+
testId,
|
|
28
|
+
}: SkeletonProps) => jsx.JSX.Element;
|
|
29
|
+
export default Skeleton;
|
|
30
|
+
|
|
31
|
+
// @public (undocumented)
|
|
32
|
+
type SkeletonProps = {
|
|
33
|
+
width: number | string;
|
|
34
|
+
height: number | string;
|
|
35
|
+
borderRadius?: number | string;
|
|
36
|
+
isShimmering?: boolean;
|
|
37
|
+
groupName?: string;
|
|
38
|
+
testId?: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// (No @packageDocumentation comment for this package)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
<!--SECTION END: Main Entry Types-->
|
|
45
|
+
|
|
46
|
+
### Peer Dependencies
|
|
47
|
+
|
|
48
|
+
<!--SECTION START: Peer Dependencies-->
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"react": "^16.8.0"
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
<!--SECTION END: Peer Dependencies-->
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/skeleton"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { jsx } from '@emotion/react';
|
|
8
|
+
|
|
9
|
+
// @public
|
|
10
|
+
const Skeleton: ({ width, height, borderRadius, isShimmering, groupName, testId, }: SkeletonProps) => jsx.JSX.Element;
|
|
11
|
+
export default Skeleton;
|
|
12
|
+
|
|
13
|
+
// @public (undocumented)
|
|
14
|
+
type SkeletonProps = {
|
|
15
|
+
width: number | string;
|
|
16
|
+
height: number | string;
|
|
17
|
+
borderRadius?: number | string;
|
|
18
|
+
isShimmering?: boolean;
|
|
19
|
+
groupName?: string;
|
|
20
|
+
testId?: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// (No @packageDocumentation comment for this package)
|
|
24
|
+
|
|
25
|
+
```
|