@doodl/slate 1.22.1 → 1.22.4

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,24 @@
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
+ ### [1.22.4](https://bitbucket.org/doodlltd/slate/compare/v1.22.3...v1.22.4) (2022-04-07)
6
+
7
+ ### [1.22.3](https://bitbucket.org/doodlltd/slate/compare/v1.22.2...v1.22.3) (2022-02-13)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * Flag default breakpoints as SCSS defaults ([f380ddc](https://bitbucket.org/doodlltd/slate/commit/f380ddce65ef6287b040e2a2a796ebf0eecbc29d))
13
+
14
+ ### [1.22.2](https://bitbucket.org/doodlltd/slate/compare/v1.22.1...v1.22.2) (2021-12-22)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * Assign property inheritance to variable properties if the value is a property map ([71a9287](https://bitbucket.org/doodlltd/slate/commit/71a9287b2846bbccb4ffd19e185d26542dbdca3c))
20
+ * Ensure $key is not required to assign a variable property ([02c419f](https://bitbucket.org/doodlltd/slate/commit/02c419f0ce5c58fc329b13c1520c23813179d7d4))
21
+ * Nested map-get doesn't work on older Sass compilers ([1b9c98b](https://bitbucket.org/doodlltd/slate/commit/1b9c98be844a6bc096aa7d9a1f9c4560d0ebd3ec))
22
+
5
23
  ### [1.22.1](https://bitbucket.org/doodlltd/slate/compare/v1.22.0...v1.22.1) (2021-12-22)
6
24
 
7
25
  ## [1.22.0](https://bitbucket.org/doodlltd/slate/compare/v1.21.5...v1.22.0) (2021-12-16)
@@ -10,11 +10,11 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
10
10
 
11
11
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12
12
 
13
- import React from 'react';
13
+ import React, { forwardRef } from 'react';
14
14
  import classNames from "classnames";
15
15
  import styles from '../../../../scss/css-modules/grid.module.scss';
16
16
 
17
- var GridItem = function GridItem(props) {
17
+ var GridItem = function GridItem(props, ref) {
18
18
  var children = props.children,
19
19
  className = props.className,
20
20
  _props$component = props.component,
@@ -28,8 +28,9 @@ var GridItem = function GridItem(props) {
28
28
  });
29
29
  var gridItemClasses = classNames.apply(void 0, _toConsumableArray(gridSizes).concat([className]));
30
30
  return /*#__PURE__*/React.createElement(Component, {
31
+ ref: ref,
31
32
  className: gridItemClasses
32
33
  }, children);
33
34
  };
34
35
 
35
- export default GridItem;
36
+ export default /*#__PURE__*/forwardRef(GridItem);
@@ -12,14 +12,15 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
12
12
 
13
13
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
14
14
 
15
- import React from 'react';
15
+ import React, { forwardRef } from 'react';
16
16
  import classNames from 'classnames';
17
17
  import styles from '../../../../scss/css-modules/grid.module.scss';
18
18
 
19
- var Grid = function Grid(props) {
19
+ var Grid = function Grid(props, ref) {
20
20
  var _ref;
21
21
 
22
22
  var children = props.children,
23
+ className = props.className,
23
24
  _props$component = props.component,
24
25
  Component = _props$component === void 0 ? 'div' : _props$component,
25
26
  _props$center = props.center,
@@ -34,10 +35,11 @@ var Grid = function Grid(props) {
34
35
  var gridSizes = sizes.split(" ").map(function (size) {
35
36
  return styles["".concat(slateGridClassName, "-width-").concat(size)];
36
37
  });
37
- var gridClasses = classNames.apply(void 0, [styles[slateGridClassName]].concat(_toConsumableArray(gridSizes), [(_ref = {}, _defineProperty(_ref, styles['center'], center), _defineProperty(_ref, styles['verticalCenter'], verticalCenter), _ref), gridClassName]));
38
+ var gridClasses = classNames.apply(void 0, [styles[slateGridClassName]].concat(_toConsumableArray(gridSizes), [(_ref = {}, _defineProperty(_ref, styles.center, center), _defineProperty(_ref, styles.verticalCenter, verticalCenter), _ref), className, gridClassName]));
38
39
  return /*#__PURE__*/React.createElement(Component, {
40
+ ref: ref,
39
41
  className: gridClasses
40
42
  }, children);
41
43
  };
42
44
 
43
- export default Grid;
45
+ export default /*#__PURE__*/forwardRef(Grid);
@@ -1,27 +1,27 @@
1
- var _excluded = ["children", "component", "className", "gridClassName"];
1
+ var _excluded = ["children", "component", "className"];
2
2
 
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
 
5
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
6
 
7
- import React from 'react';
7
+ import React, { forwardRef } from 'react';
8
8
  import classNames from "classnames";
9
9
  import Grid from ".";
10
10
  import styles from '../../../../scss/css-modules/grid.module.scss';
11
11
 
12
- var PaddedGrid = function PaddedGrid(props) {
12
+ var PaddedGrid = function PaddedGrid(props, ref) {
13
13
  var children = props.children,
14
14
  _props$component = props.component,
15
15
  Component = _props$component === void 0 ? 'div' : _props$component,
16
16
  className = props.className,
17
- gridClassName = props.gridClassName,
18
17
  gridProps = _objectWithoutProperties(props, _excluded);
19
18
 
20
19
  var slatePaddedGridClassName = styles.slatePaddedGridClassName;
21
20
  var paddedGridClasses = classNames(styles[slatePaddedGridClassName], className);
22
21
  return /*#__PURE__*/React.createElement(Component, {
22
+ ref: ref,
23
23
  className: paddedGridClasses
24
24
  }, /*#__PURE__*/React.createElement(Grid, gridProps, children));
25
25
  };
26
26
 
27
- export default PaddedGrid;
27
+ export default /*#__PURE__*/forwardRef(PaddedGrid);
@@ -1,13 +1,13 @@
1
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
2
 
3
- import React from 'react';
3
+ import React, { forwardRef } from 'react';
4
4
  import classNames from 'classnames';
5
5
  import styles from '../../../../scss/css-modules/section.module.scss';
6
-
7
- var Section = function Section(props) {
6
+ var Section = /*#__PURE__*/forwardRef(function (props, ref) {
8
7
  var _classNames;
9
8
 
10
- var children = props.children,
9
+ var id = props.id,
10
+ children = props.children,
11
11
  _props$component = props.component,
12
12
  Component = _props$component === void 0 ? 'section' : _props$component,
13
13
  className = props.className,
@@ -21,8 +21,9 @@ var Section = function Section(props) {
21
21
  removeRightPadding = _props$removeRightPad === void 0 ? false : _props$removeRightPad;
22
22
  var classes = classNames(styles.section, (_classNames = {}, _defineProperty(_classNames, styles['remove-bottom-padding'], removeBottomPadding), _defineProperty(_classNames, styles['remove-top-padding'], removeTopPadding), _defineProperty(_classNames, styles['remove-left-padding'], removeLeftPadding), _defineProperty(_classNames, styles['remove-right-padding'], removeRightPadding), _classNames), className);
23
23
  return /*#__PURE__*/React.createElement(Component, {
24
- className: classes
24
+ id: id,
25
+ className: classes,
26
+ ref: ref
25
27
  }, children);
26
- };
27
-
28
+ });
28
29
  export default Section;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doodl/slate",
3
- "version": "1.22.1",
3
+ "version": "1.22.4",
4
4
  "description": "",
5
5
  "main": "./js/dist/index.js",
6
6
  "module": "./js/dist/index.js",
@@ -77,7 +77,7 @@
77
77
 
78
78
  @function extract-value($string) {
79
79
 
80
- @if type-of($string) == "map" {
80
+ @if is-property-map($string) {
81
81
  @return map-get($string,default);
82
82
  }
83
83
 
@@ -91,7 +91,7 @@
91
91
 
92
92
  @function extract-property($string) {
93
93
 
94
- @if type-of($string) == "map" {
94
+ @if is-property-map($string) {
95
95
  @return map-get($string,property);
96
96
  }
97
97
 
@@ -112,6 +112,14 @@
112
112
  @return $string;
113
113
  }
114
114
 
115
+ @function is-property-map($value) {
116
+ @if type-of($value) == "map" and map-has-key($value,default) and map-has-key($value,property) {
117
+ @return true;
118
+ }
119
+
120
+ @return false;
121
+ }
122
+
115
123
  @function build-colour-map($key, $colour) {
116
124
  @return (
117
125
  100: (property: --#{$key}--100, default: scale-color($colour,$lightness: -40%)),
@@ -129,11 +137,11 @@
129
137
  }
130
138
 
131
139
  @function colour-property-from-map($map,$tint: 500) {
132
- @return var(#{map-get($map,$tint,property)},#{map-get($map,$tint,default)});
140
+ @return var(#{map-get(map-get($map,$tint),property)},#{map-get(map-get($map,$tint),default)});
133
141
  }
134
142
 
135
143
  @mixin define-global-property-alias($key, $property) {
136
- @if is-property($property) or type-of($property) == "map" {
144
+ @if is-property($property) or is-property-map($property) {
137
145
  $_property: extract-property($property);
138
146
  @at-root {
139
147
  :root {
@@ -149,7 +157,7 @@
149
157
  }
150
158
  }
151
159
 
152
- @mixin assign-variable-property($property, $value, $key, $keyPrefix: "",$keySuffix: "") {
160
+ @mixin assign-variable-property($property, $value, $key: 0, $keyPrefix: "",$keySuffix: "") {
153
161
 
154
162
  $_value: #{extract-value($value)};
155
163
 
@@ -163,7 +171,7 @@
163
171
  @if variable-exists(slate-autogenerate-global-property-aliases) {
164
172
  @include define-global-property-alias(#{$keyPrefix}#{$key}#{$keySuffix},$value);
165
173
  }
166
- } @else if is-property($value) {
174
+ } @else if is-property($value) or is-property-map($value) {
167
175
  // Assign the CSS custom property so that the value is inherited
168
176
  $_customProperty: #{extract-property($value)};
169
177
  #{$property}: var(#{$_customProperty}, $_value);
package/scss/_mixins.scss CHANGED
@@ -104,7 +104,7 @@
104
104
  $_colour: $colour;
105
105
  } @else {
106
106
  $_bg: "";
107
- @if type-of($background) == "map" {
107
+ @if is-property-map($background) {
108
108
  $_bg: map-get($background,default);
109
109
  } @else {
110
110
  $_bg: guarantee-colour-value($background);
@@ -154,7 +154,7 @@
154
154
  @if $background--hover != 0 {
155
155
  $_background-colour--hover: $background--hover;
156
156
  } @else {
157
- @if type-of($_background-colour) == "map" {
157
+ @if is-property-map($_background-colour) {
158
158
  // Use the default value to determine a lightness
159
159
  $_bg-lightness: lightness(map-get($_background-colour,default));
160
160
  @if $_bg-lightness < 20 {
@@ -10,14 +10,14 @@ $slate-breakpoints: (
10
10
  medium: $slate-breakpoints-medium,
11
11
  large: $slate-breakpoints-large,
12
12
  x-large: $slate-breakpoints-x-large
13
- );
13
+ ) !default;
14
14
 
15
15
  $slate-media-queries: (
16
16
  small: screen and (min-width: $slate-breakpoints-small),
17
17
  medium: screen and (min-width: $slate-breakpoints-medium),
18
18
  large: screen and (min-width: $slate-breakpoints-large),
19
19
  x-large: screen and (min-width: $slate-breakpoints-x-large)
20
- );
20
+ ) !default;
21
21
 
22
22
  :export {
23
23
  small: $slate-breakpoints-small;