@spaced-out/ui-design-system 0.1.103 → 0.1.104

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,13 @@
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.104](https://github.com/spaced-out/ui-design-system/compare/v0.1.103...v0.1.104) (2024-07-04)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * 🪛 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))
11
+
5
12
  ### [0.1.103](https://github.com/spaced-out/ui-design-system/compare/v0.1.102...v0.1.103) (2024-07-03)
6
13
 
7
14
 
@@ -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
- const Shimmer = /*#__PURE__*/React.forwardRef((_ref, ref) => {
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
- } = _ref;
56
+ } = _ref2;
41
57
  if (!show) {
42
58
  return /*#__PURE__*/React.createElement(React.Fragment, null, children);
43
59
  }
@@ -54,10 +70,10 @@ const Shimmer = /*#__PURE__*/React.forwardRef((_ref, ref) => {
54
70
  });
55
71
  });
56
72
  exports.Shimmer = Shimmer;
57
- const KPIShimmer = _ref2 => {
73
+ const KPIShimmer = _ref3 => {
58
74
  let {
59
75
  textWidth = 150
60
- } = _ref2;
76
+ } = _ref3;
61
77
  return /*#__PURE__*/React.createElement("div", {
62
78
  className: _ShimmerModule.default.kpiBox
63
79
  }, /*#__PURE__*/React.createElement("div", {
@@ -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
  (
@@ -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
- .text {
32
- margin: spaceNone spaceXSmall;
29
+ &.text {
30
+ margin-right: spaceXXSmall;
31
+ width: initial;
32
+ padding-left: var(--width);
33
+ }
33
34
  }
34
35
 
35
36
  .kpiBox {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.1.103",
3
+ "version": "0.1.104",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {