@spark-web/text 1.0.7 → 1.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/README.md CHANGED
@@ -151,6 +151,8 @@ tones “neutral” and “muted” will be inverted.
151
151
  | transform? | CSSProperties['textTransform'] | | Transforms the text casing. |
152
152
  | weight? | keyof [BrighteTheme][brighte-theme]['typography']['fontweight'] | | The weight of the text. |
153
153
 
154
+ Extra props are also passed into the underlying [`Box`](/package/box) component.
155
+
154
156
  [brighte-theme]:
155
157
  https://github.com/brighte-labs/spark-web/blob/e503bea4f7668d187ec7a78f99c5ed374417588b/packages/theme/src/makeTheme.ts#L158
156
158
  [data-attribute-map]:
@@ -6,9 +6,10 @@ var react = require('react');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var css = require('@emotion/css');
8
8
  var theme = require('@spark-web/theme');
9
+ var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
10
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
9
11
  var box = require('@spark-web/box');
10
12
  var ts = require('@spark-web/utils/ts');
11
- var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
12
13
 
13
14
  var TextContext = /*#__PURE__*/react.createContext(undefined);
14
15
  function useTextContext() {
@@ -179,6 +180,7 @@ function createTextStyles(_ref2) {
179
180
  }, leadingTrim);
180
181
  }
181
182
 
183
+ var _excluded = ["as", "children", "data", "id", "align", "baseline", "inline", "overflowStrategy", "size", "tabularNumbers", "tone", "transform", "weight"];
182
184
  var Text = ts.forwardRefWithAs(function (_ref, forwardedRef) {
183
185
  var as = _ref.as,
184
186
  children = _ref.children,
@@ -192,7 +194,9 @@ var Text = ts.forwardRefWithAs(function (_ref, forwardedRef) {
192
194
  tabularNumbers = _ref.tabularNumbers,
193
195
  toneProp = _ref.tone,
194
196
  transform = _ref.transform,
195
- weightProp = _ref.weight;
197
+ weightProp = _ref.weight,
198
+ consumerProps = _objectWithoutProperties(_ref, _excluded);
199
+
196
200
  var overflowStyles = useOverflowStrategy(overflowStrategy);
197
201
  var textContext = useTextContext();
198
202
 
@@ -220,14 +224,14 @@ var Text = ts.forwardRefWithAs(function (_ref, forwardedRef) {
220
224
  }]; // early exit for inline variant
221
225
 
222
226
  if (inline) {
223
- return /*#__PURE__*/jsxRuntime.jsx(box.Box, {
227
+ return /*#__PURE__*/jsxRuntime.jsx(box.Box, _objectSpread(_objectSpread({}, consumerProps), {}, {
224
228
  as: as !== null && as !== void 0 ? as : 'span',
225
229
  data: data,
226
230
  ref: forwardedRef,
227
231
  id: id,
228
232
  className: css.css(styles),
229
233
  children: children
230
- });
234
+ }));
231
235
  } // prepare block variant
232
236
 
233
237
 
@@ -244,14 +248,14 @@ var Text = ts.forwardRefWithAs(function (_ref, forwardedRef) {
244
248
  }, [size, tone, weight]);
245
249
  return /*#__PURE__*/jsxRuntime.jsx(TextContext.Provider, {
246
250
  value: textContextValue,
247
- children: /*#__PURE__*/jsxRuntime.jsx(box.Box, {
251
+ children: /*#__PURE__*/jsxRuntime.jsx(box.Box, _objectSpread(_objectSpread({}, consumerProps), {}, {
248
252
  as: as,
249
253
  data: data,
250
254
  ref: forwardedRef,
251
255
  id: id,
252
256
  className: css.css(styles),
253
257
  children: content
254
- })
258
+ }))
255
259
  });
256
260
  });
257
261
 
@@ -6,9 +6,10 @@ var react = require('react');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var css = require('@emotion/css');
8
8
  var theme = require('@spark-web/theme');
9
+ var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
10
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
9
11
  var box = require('@spark-web/box');
10
12
  var ts = require('@spark-web/utils/ts');
11
- var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
12
13
 
13
14
  var TextContext = /*#__PURE__*/react.createContext(undefined);
14
15
  function useTextContext() {
@@ -179,6 +180,7 @@ function createTextStyles(_ref2) {
179
180
  }, leadingTrim);
180
181
  }
181
182
 
183
+ var _excluded = ["as", "children", "data", "id", "align", "baseline", "inline", "overflowStrategy", "size", "tabularNumbers", "tone", "transform", "weight"];
182
184
  var Text = ts.forwardRefWithAs(function (_ref, forwardedRef) {
183
185
  var as = _ref.as,
184
186
  children = _ref.children,
@@ -192,7 +194,9 @@ var Text = ts.forwardRefWithAs(function (_ref, forwardedRef) {
192
194
  tabularNumbers = _ref.tabularNumbers,
193
195
  toneProp = _ref.tone,
194
196
  transform = _ref.transform,
195
- weightProp = _ref.weight;
197
+ weightProp = _ref.weight,
198
+ consumerProps = _objectWithoutProperties(_ref, _excluded);
199
+
196
200
  var overflowStyles = useOverflowStrategy(overflowStrategy);
197
201
  var textContext = useTextContext();
198
202
 
@@ -220,14 +224,14 @@ var Text = ts.forwardRefWithAs(function (_ref, forwardedRef) {
220
224
  }]; // early exit for inline variant
221
225
 
222
226
  if (inline) {
223
- return /*#__PURE__*/jsxRuntime.jsx(box.Box, {
227
+ return /*#__PURE__*/jsxRuntime.jsx(box.Box, _objectSpread(_objectSpread({}, consumerProps), {}, {
224
228
  as: as !== null && as !== void 0 ? as : 'span',
225
229
  data: data,
226
230
  ref: forwardedRef,
227
231
  id: id,
228
232
  className: css.css(styles),
229
233
  children: children
230
- });
234
+ }));
231
235
  } // prepare block variant
232
236
 
233
237
 
@@ -244,14 +248,14 @@ var Text = ts.forwardRefWithAs(function (_ref, forwardedRef) {
244
248
  }, [size, tone, weight]);
245
249
  return /*#__PURE__*/jsxRuntime.jsx(TextContext.Provider, {
246
250
  value: textContextValue,
247
- children: /*#__PURE__*/jsxRuntime.jsx(box.Box, {
251
+ children: /*#__PURE__*/jsxRuntime.jsx(box.Box, _objectSpread(_objectSpread({}, consumerProps), {}, {
248
252
  as: as,
249
253
  data: data,
250
254
  ref: forwardedRef,
251
255
  id: id,
252
256
  className: css.css(styles),
253
257
  children: content
254
- })
258
+ }))
255
259
  });
256
260
  });
257
261
 
@@ -2,9 +2,10 @@ import { useContext, createContext, useMemo } from 'react';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { css } from '@emotion/css';
4
4
  import { useTheme } from '@spark-web/theme';
5
+ import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
6
+ import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
5
7
  import { useBackgroundLightness, Box } from '@spark-web/box';
6
8
  import { forwardRefWithAs } from '@spark-web/utils/ts';
7
- import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
8
9
 
9
10
  var TextContext = /*#__PURE__*/createContext(undefined);
10
11
  function useTextContext() {
@@ -175,6 +176,7 @@ function createTextStyles(_ref2) {
175
176
  }, leadingTrim);
176
177
  }
177
178
 
179
+ var _excluded = ["as", "children", "data", "id", "align", "baseline", "inline", "overflowStrategy", "size", "tabularNumbers", "tone", "transform", "weight"];
178
180
  var Text = forwardRefWithAs(function (_ref, forwardedRef) {
179
181
  var as = _ref.as,
180
182
  children = _ref.children,
@@ -188,7 +190,9 @@ var Text = forwardRefWithAs(function (_ref, forwardedRef) {
188
190
  tabularNumbers = _ref.tabularNumbers,
189
191
  toneProp = _ref.tone,
190
192
  transform = _ref.transform,
191
- weightProp = _ref.weight;
193
+ weightProp = _ref.weight,
194
+ consumerProps = _objectWithoutProperties(_ref, _excluded);
195
+
192
196
  var overflowStyles = useOverflowStrategy(overflowStrategy);
193
197
  var textContext = useTextContext();
194
198
 
@@ -216,14 +220,14 @@ var Text = forwardRefWithAs(function (_ref, forwardedRef) {
216
220
  }]; // early exit for inline variant
217
221
 
218
222
  if (inline) {
219
- return /*#__PURE__*/jsx(Box, {
223
+ return /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, consumerProps), {}, {
220
224
  as: as !== null && as !== void 0 ? as : 'span',
221
225
  data: data,
222
226
  ref: forwardedRef,
223
227
  id: id,
224
228
  className: css(styles),
225
229
  children: children
226
- });
230
+ }));
227
231
  } // prepare block variant
228
232
 
229
233
 
@@ -240,14 +244,14 @@ var Text = forwardRefWithAs(function (_ref, forwardedRef) {
240
244
  }, [size, tone, weight]);
241
245
  return /*#__PURE__*/jsx(TextContext.Provider, {
242
246
  value: textContextValue,
243
- children: /*#__PURE__*/jsx(Box, {
247
+ children: /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, consumerProps), {}, {
244
248
  as: as,
245
249
  data: data,
246
250
  ref: forwardedRef,
247
251
  id: id,
248
252
  className: css(styles),
249
253
  children: content
250
- })
254
+ }))
251
255
  });
252
256
  });
253
257
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-web/text",
3
- "version": "1.0.7",
3
+ "version": "1.1.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/spark-web-text.cjs.js",
6
6
  "module": "dist/spark-web-text.esm.js",
@@ -10,9 +10,9 @@
10
10
  "dependencies": {
11
11
  "@babel/runtime": "^7.18.9",
12
12
  "@emotion/css": "^11.9.0",
13
- "@spark-web/box": "^1.0.7",
14
- "@spark-web/theme": "^3.0.3",
15
- "@spark-web/utils": "^1.2.0"
13
+ "@spark-web/box": "^1.0.8",
14
+ "@spark-web/theme": "^3.0.5",
15
+ "@spark-web/utils": "^1.2.1"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/react": "^17.0.12",