@spaced-out/ui-design-system 0.1.103 → 0.1.105
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
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.1.105](https://github.com/spaced-out/ui-design-system/compare/v0.1.104...v0.1.105) (2024-07-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* 🔘 added optional props for KPI Shimmer ([#235](https://github.com/spaced-out/ui-design-system/issues/235)) ([5cbdba8](https://github.com/spaced-out/ui-design-system/commit/5cbdba80a2e80985c8f68360b293d1a1e73159d4))
|
|
11
|
+
|
|
12
|
+
### [0.1.104](https://github.com/spaced-out/ui-design-system/compare/v0.1.103...v0.1.104) (2024-07-04)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* 🪛 text wrap fix for text based shimmer ([#234](https://github.com/spaced-out/ui-design-system/issues/234)) ([50d4e6c](https://github.com/spaced-out/ui-design-system/commit/50d4e6c424b0675d1e761553cd8f2f652dd0f48e))
|
|
18
|
+
|
|
5
19
|
### [0.1.103](https://github.com/spaced-out/ui-design-system/compare/v0.1.102...v0.1.103) (2024-07-03)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.Shimmer = exports.SHIMMER_TYPE_TO_BORDER_RADIUS_MAP = exports.SHIMMER_TYPES = exports.KPIShimmer = void 0;
|
|
6
|
+
exports.ShimmerWrapper = exports.Shimmer = exports.SHIMMER_TYPE_TO_BORDER_RADIUS_MAP = exports.SHIMMER_TYPES = exports.KPIShimmer = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _border = require("../../styles/variables/_border");
|
|
9
9
|
var _size = require("../../styles/variables/_size");
|
|
@@ -28,7 +28,23 @@ const SHIMMER_TYPE_TO_BORDER_RADIUS_MAP = Object.freeze({
|
|
|
28
28
|
rectangular: _border.borderRadiusNone
|
|
29
29
|
});
|
|
30
30
|
exports.SHIMMER_TYPE_TO_BORDER_RADIUS_MAP = SHIMMER_TYPE_TO_BORDER_RADIUS_MAP;
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Note(Nishant): ShimmerWrapper is a wrapper component for Shimmer component. This should only be used for Text based Shimmers
|
|
33
|
+
* This solves a very annoying problem with out text components where the display prop is set to flex.
|
|
34
|
+
* Genesis assumes that every element is flexible for simplicity and for text text shimmers to work in use cases
|
|
35
|
+
* where text wraps across multiple lines, we need to wrap the shimmer in a span element.
|
|
36
|
+
* to avoid the misuse where consumers use there own / other block level components, we have this wrapper.
|
|
37
|
+
* This would ensure the layout remains same even when you toggle the shimmer to show your actual content
|
|
38
|
+
* @param {React.Node} children - The children to be rendered
|
|
39
|
+
*/
|
|
40
|
+
const ShimmerWrapper = _ref => {
|
|
41
|
+
let {
|
|
42
|
+
children
|
|
43
|
+
} = _ref;
|
|
44
|
+
return /*#__PURE__*/React.createElement("span", null, children);
|
|
45
|
+
};
|
|
46
|
+
exports.ShimmerWrapper = ShimmerWrapper;
|
|
47
|
+
const Shimmer = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
32
48
|
let {
|
|
33
49
|
classNames,
|
|
34
50
|
show = true,
|
|
@@ -37,7 +53,7 @@ const Shimmer = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
37
53
|
width = _size.size40,
|
|
38
54
|
height = _size.sizeFluid,
|
|
39
55
|
borderRadius
|
|
40
|
-
} =
|
|
56
|
+
} = _ref2;
|
|
41
57
|
if (!show) {
|
|
42
58
|
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
43
59
|
}
|
|
@@ -54,13 +70,18 @@ const Shimmer = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
54
70
|
});
|
|
55
71
|
});
|
|
56
72
|
exports.Shimmer = Shimmer;
|
|
57
|
-
const KPIShimmer =
|
|
73
|
+
const KPIShimmer = _ref3 => {
|
|
58
74
|
let {
|
|
59
|
-
textWidth = 150
|
|
60
|
-
|
|
75
|
+
textWidth = 150,
|
|
76
|
+
hasBottomContent = true,
|
|
77
|
+
hasIcon = true,
|
|
78
|
+
hasTopContent = true,
|
|
79
|
+
hasMiddleContent = true,
|
|
80
|
+
classNames
|
|
81
|
+
} = _ref3;
|
|
61
82
|
return /*#__PURE__*/React.createElement("div", {
|
|
62
|
-
className: _ShimmerModule.default.kpiBox
|
|
63
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
83
|
+
className: (0, _classify.default)(_ShimmerModule.default.kpiBox, classNames?.wrapper)
|
|
84
|
+
}, hasIcon && /*#__PURE__*/React.createElement("div", {
|
|
64
85
|
className: _ShimmerModule.default.section
|
|
65
86
|
}, /*#__PURE__*/React.createElement(Shimmer, {
|
|
66
87
|
type: "rounded",
|
|
@@ -68,15 +89,15 @@ const KPIShimmer = _ref2 => {
|
|
|
68
89
|
height: 60
|
|
69
90
|
})), /*#__PURE__*/React.createElement("div", {
|
|
70
91
|
className: _ShimmerModule.default.section
|
|
71
|
-
}, /*#__PURE__*/React.createElement(Shimmer, {
|
|
92
|
+
}, hasTopContent && /*#__PURE__*/React.createElement(Shimmer, {
|
|
72
93
|
type: "text",
|
|
73
94
|
width: textWidth,
|
|
74
95
|
height: 15
|
|
75
|
-
}), /*#__PURE__*/React.createElement(Shimmer, {
|
|
96
|
+
}), hasMiddleContent && /*#__PURE__*/React.createElement(Shimmer, {
|
|
76
97
|
type: "text",
|
|
77
98
|
width: textWidth,
|
|
78
99
|
height: 25
|
|
79
|
-
}), /*#__PURE__*/React.createElement(Shimmer, {
|
|
100
|
+
}), hasBottomContent && /*#__PURE__*/React.createElement(Shimmer, {
|
|
80
101
|
type: "text",
|
|
81
102
|
width: textWidth,
|
|
82
103
|
height: 15
|
|
@@ -43,6 +43,23 @@ export type ShimmerProps = {
|
|
|
43
43
|
children?: React.Node,
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
export type ShimmerWrapperProps = {
|
|
47
|
+
children?: React.Node,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Note(Nishant): ShimmerWrapper is a wrapper component for Shimmer component. This should only be used for Text based Shimmers
|
|
52
|
+
* This solves a very annoying problem with out text components where the display prop is set to flex.
|
|
53
|
+
* Genesis assumes that every element is flexible for simplicity and for text text shimmers to work in use cases
|
|
54
|
+
* where text wraps across multiple lines, we need to wrap the shimmer in a span element.
|
|
55
|
+
* to avoid the misuse where consumers use there own / other block level components, we have this wrapper.
|
|
56
|
+
* This would ensure the layout remains same even when you toggle the shimmer to show your actual content
|
|
57
|
+
* @param {React.Node} children - The children to be rendered
|
|
58
|
+
*/
|
|
59
|
+
export const ShimmerWrapper = ({
|
|
60
|
+
children,
|
|
61
|
+
}: ShimmerWrapperProps): React$Element<'span'> => <span>{children}</span>;
|
|
62
|
+
|
|
46
63
|
export const Shimmer: React$AbstractComponent<ShimmerProps, HTMLSpanElement> =
|
|
47
64
|
React.forwardRef<ShimmerProps, HTMLSpanElement>(
|
|
48
65
|
(
|
|
@@ -79,19 +96,42 @@ export const Shimmer: React$AbstractComponent<ShimmerProps, HTMLSpanElement> =
|
|
|
79
96
|
},
|
|
80
97
|
);
|
|
81
98
|
|
|
99
|
+
type KPIShimmerClassNames = $ReadOnly<{wrapper?: string}>;
|
|
100
|
+
|
|
82
101
|
export type KPIShimmerProps = {
|
|
83
102
|
textWidth?: number | string,
|
|
103
|
+
hasTopContent?: boolean,
|
|
104
|
+
hasMiddleContent?: boolean,
|
|
105
|
+
hasBottomContent?: boolean,
|
|
106
|
+
hasIcon?: boolean,
|
|
107
|
+
classNames?: KPIShimmerClassNames,
|
|
84
108
|
};
|
|
85
109
|
|
|
86
|
-
export const KPIShimmer = ({
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
110
|
+
export const KPIShimmer = ({
|
|
111
|
+
textWidth = 150,
|
|
112
|
+
hasBottomContent = true,
|
|
113
|
+
hasIcon = true,
|
|
114
|
+
hasTopContent = true,
|
|
115
|
+
hasMiddleContent = true,
|
|
116
|
+
classNames,
|
|
117
|
+
}: KPIShimmerProps): React.Node => (
|
|
118
|
+
<div className={classify(css.kpiBox, classNames?.wrapper)}>
|
|
119
|
+
{hasIcon && (
|
|
120
|
+
<div className={css.section}>
|
|
121
|
+
<Shimmer type="rounded" width={60} height={60}></Shimmer>
|
|
122
|
+
</div>
|
|
123
|
+
)}
|
|
124
|
+
|
|
91
125
|
<div className={css.section}>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
126
|
+
{hasTopContent && (
|
|
127
|
+
<Shimmer type="text" width={textWidth} height={15}></Shimmer>
|
|
128
|
+
)}
|
|
129
|
+
{hasMiddleContent && (
|
|
130
|
+
<Shimmer type="text" width={textWidth} height={25}></Shimmer>
|
|
131
|
+
)}
|
|
132
|
+
{hasBottomContent && (
|
|
133
|
+
<Shimmer type="text" width={textWidth} height={15}></Shimmer>
|
|
134
|
+
)}
|
|
95
135
|
</div>
|
|
96
136
|
</div>
|
|
97
137
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
@value (colorFillPrimary, colorNeutralLightest, colorNeutralLight, colorBackgroundTertiary) from '../../styles/variables/_color.css';
|
|
2
|
-
@value (spaceXSmall, spaceNone, spaceLarge, spaceMedium, spaceSmall) from '../../styles/variables/_space.css';
|
|
2
|
+
@value (spaceXSmall,spaceXXSmall, spaceNone, spaceLarge, spaceMedium, spaceSmall) from '../../styles/variables/_space.css';
|
|
3
3
|
@value (sizeFluid, size40, size252) from '../../styles/variables/_size.css';
|
|
4
4
|
@value (borderRadiusXSmall, borderRadiusMedium) from '../../styles/variables/_border.css';
|
|
5
5
|
@value (opacity20, opacity40, opacity60) from '../../styles/variables/_opacity.css';
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
--width: size40;
|
|
14
14
|
--border-radius: borderRadiusXSmall;
|
|
15
15
|
--height: sizeFluid;
|
|
16
|
-
display: flex;
|
|
17
16
|
height: var(--height);
|
|
18
17
|
width: var(--width);
|
|
19
18
|
border-radius: var(--border-radius);
|
|
@@ -26,10 +25,12 @@
|
|
|
26
25
|
background-size: backgroundSizeInitial sizeFluid;
|
|
27
26
|
animation: shimmer motionDuration infinite linear;
|
|
28
27
|
vertical-align: middle;
|
|
29
|
-
}
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
&.text {
|
|
30
|
+
margin-right: spaceXXSmall;
|
|
31
|
+
width: initial;
|
|
32
|
+
padding-left: var(--width);
|
|
33
|
+
}
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
.kpiBox {
|