@spaced-out/ui-design-system 0.1.84 → 0.1.86

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.86](https://github.com/spaced-out/ui-design-system/compare/v0.1.85...v0.1.86) (2024-04-19)
6
+
7
+
8
+ ### Features
9
+
10
+ * [GDS-362] adding responsive grid ([#190](https://github.com/spaced-out/ui-design-system/issues/190)) ([313c5c8](https://github.com/spaced-out/ui-design-system/commit/313c5c8b58502eae3bd95324f7cbdaad1b1f4d58))
11
+
12
+ ### [0.1.85](https://github.com/spaced-out/ui-design-system/compare/v0.1.84...v0.1.85) (2024-04-18)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * floating dom issue tooltip ([#188](https://github.com/spaced-out/ui-design-system/issues/188)) ([8ad85e2](https://github.com/spaced-out/ui-design-system/commit/8ad85e2d683a8bba4ae6ec013e110e4ebdccec81))
18
+
5
19
  ### [0.1.84](https://github.com/spaced-out/ui-design-system/compare/v0.1.83...v0.1.84) (2024-04-10)
6
20
 
7
21
 
@@ -14,16 +14,18 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
14
14
  const GRID_SYSTEM_MAP = {
15
15
  small: 24,
16
16
  medium: 12,
17
- large: 6
17
+ large: 6,
18
+ autoFill: 'auto-fill'
18
19
  };
19
20
  const Row = _ref => {
20
21
  let {
21
22
  className,
22
23
  children,
23
24
  span = 1,
24
- gridType = 'medium'
25
+ gridType = 'medium',
26
+ repeatTracks = '1fr'
25
27
  } = _ref;
26
- const GRID_COLUMN_COUNT = GRID_SYSTEM_MAP[gridType];
28
+ const gridRepeatCount = GRID_SYSTEM_MAP[gridType];
27
29
  let columnSpanCount = 0;
28
30
  let lastChildColCount = 0;
29
31
  const childrenWithProps = React.Children.map(children, child => {
@@ -42,21 +44,30 @@ const Row = _ref => {
42
44
  }
43
45
  lastChildColCount = columnSpanCount;
44
46
  columnSpanCount = lastChildColCount + offset + span;
45
- if (columnSpanCount <= GRID_COLUMN_COUNT) {
47
+ let gridColumnStart = 0,
48
+ gridColumnEnd = 0;
49
+ if (gridType === 'autoFill') {
50
+ gridColumnStart = 'auto';
46
51
  return /*#__PURE__*/React.cloneElement(child, {
47
- gridColumnStart: lastChildColCount + offset + 1,
52
+ gridColumnStart,
53
+ gridColumnEnd: `span ${span}`
54
+ });
55
+ } else if (typeof gridRepeatCount === 'number' && columnSpanCount <= gridRepeatCount) {
56
+ gridColumnStart = lastChildColCount + offset + 1;
57
+ return /*#__PURE__*/React.cloneElement(child, {
58
+ gridColumnStart,
48
59
  gridColumnEnd: `span ${span}`
49
60
  });
50
61
  } else {
51
- console.error(`number of column exceed ${GRID_COLUMN_COUNT}`);
62
+ console.error(`number of column exceed ${gridRepeatCount}`);
52
63
  }
53
64
  }
54
65
  });
55
66
  return /*#__PURE__*/React.createElement("div", {
56
67
  "data-testid": "Grid",
57
- className: (0, _classify.classify)(_GridModule.default.gridRow, _GridModule.default[`gridRowSpan${span}`], className),
68
+ className: (0, _classify.classify)(_GridModule.default.gridRow, className),
58
69
  style: {
59
- gridTemplateColumns: `repeat(${GRID_COLUMN_COUNT}, 1fr)`
70
+ gridTemplateColumns: `repeat(${gridRepeatCount}, ${repeatTracks})`
60
71
  }
61
72
  }, childrenWithProps);
62
73
  };
@@ -11,13 +11,15 @@ export type RowProps = {
11
11
  children?: React.Node,
12
12
  span?: number,
13
13
  offset?: number,
14
- gridType?: 'small' | 'medium' | 'large',
14
+ gridType?: 'small' | 'medium' | 'large' | 'autoFill',
15
+ repeatTracks?: string,
15
16
  };
16
17
 
17
18
  const GRID_SYSTEM_MAP = {
18
19
  small: 24,
19
20
  medium: 12,
20
21
  large: 6,
22
+ autoFill: 'auto-fill',
21
23
  };
22
24
 
23
25
  export const Row = ({
@@ -25,8 +27,9 @@ export const Row = ({
25
27
  children,
26
28
  span = 1,
27
29
  gridType = 'medium',
30
+ repeatTracks = '1fr',
28
31
  }: RowProps): React.Node => {
29
- const GRID_COLUMN_COUNT = GRID_SYSTEM_MAP[gridType];
32
+ const gridRepeatCount = GRID_SYSTEM_MAP[gridType];
30
33
  let columnSpanCount = 0;
31
34
  let lastChildColCount = 0;
32
35
  const childrenWithProps = React.Children.map(children, (child) => {
@@ -42,13 +45,25 @@ export const Row = ({
42
45
  }
43
46
  lastChildColCount = columnSpanCount;
44
47
  columnSpanCount = lastChildColCount + offset + span;
45
- if (columnSpanCount <= GRID_COLUMN_COUNT) {
48
+ let gridColumnStart = 0,
49
+ gridColumnEnd = 0;
50
+ if (gridType === 'autoFill') {
51
+ gridColumnStart = 'auto';
46
52
  return React.cloneElement(child, {
47
- gridColumnStart: lastChildColCount + offset + 1,
53
+ gridColumnStart,
54
+ gridColumnEnd: `span ${span}`,
55
+ });
56
+ } else if (
57
+ typeof gridRepeatCount === 'number' &&
58
+ columnSpanCount <= gridRepeatCount
59
+ ) {
60
+ gridColumnStart = lastChildColCount + offset + 1;
61
+ return React.cloneElement(child, {
62
+ gridColumnStart,
48
63
  gridColumnEnd: `span ${span}`,
49
64
  });
50
65
  } else {
51
- console.error(`number of column exceed ${GRID_COLUMN_COUNT}`);
66
+ console.error(`number of column exceed ${gridRepeatCount}`);
52
67
  }
53
68
  }
54
69
  });
@@ -56,8 +71,10 @@ export const Row = ({
56
71
  return (
57
72
  <div
58
73
  data-testid="Grid"
59
- className={classify(css.gridRow, css[`gridRowSpan${span}`], className)}
60
- style={{gridTemplateColumns: `repeat(${GRID_COLUMN_COUNT}, 1fr)`}}
74
+ className={classify(css.gridRow, className)}
75
+ style={{
76
+ gridTemplateColumns: `repeat(${gridRepeatCount}, ${repeatTracks})`,
77
+ }}
61
78
  >
62
79
  {childrenWithProps}
63
80
  </div>
@@ -12,7 +12,6 @@
12
12
  .gridRow {
13
13
  display: grid !important;
14
14
  width: sizeFluid;
15
- min-width: size960;
16
15
  height: sizeFluid;
17
16
  gap: spaceMedium;
18
17
  padding: spaceNone spaceLarge;
@@ -20,7 +19,7 @@
20
19
  grid-auto-columns: 1fr;
21
20
  grid-column-gap: spaceMedium;
22
21
  grid-row-gap: spaceMedium;
23
- grid-auto-rows: sizeFluid;
22
+ grid-auto-rows: auto;
24
23
  box-sizing: border-box;
25
24
  }
26
25
 
@@ -88,7 +88,7 @@ const Tooltip = _ref => {
88
88
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.cloneElement(children, getReferenceProps({
89
89
  ref,
90
90
  ...children.props
91
- })), /*#__PURE__*/React.createElement(_react2.FloatingPortal, null, isOpen && /*#__PURE__*/React.createElement(React.Fragment, null, !hidden && /*#__PURE__*/React.createElement("div", _extends({
91
+ })), isOpen && /*#__PURE__*/React.createElement(_react2.FloatingPortal, null, /*#__PURE__*/React.createElement(React.Fragment, null, !hidden && /*#__PURE__*/React.createElement("div", _extends({
92
92
  ref: refs.setFloating,
93
93
  className: (0, _classify.classify)(_TooltipModule.default.tooltip, classNames?.tooltip),
94
94
  style: {
@@ -158,8 +158,9 @@ export const Tooltip = ({
158
158
  ...children.props,
159
159
  }),
160
160
  )}
161
- <FloatingPortal>
162
- {isOpen && (
161
+
162
+ {isOpen && (
163
+ <FloatingPortal>
163
164
  <>
164
165
  {!hidden && (
165
166
  <div
@@ -198,8 +199,8 @@ export const Tooltip = ({
198
199
  </div>
199
200
  )}
200
201
  </>
201
- )}
202
- </FloatingPortal>
202
+ </FloatingPortal>
203
+ )}
203
204
  </>
204
205
  );
205
206
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.1.84",
3
+ "version": "0.1.86",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {