@spark-web/box 1.0.0 → 1.0.1

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
@@ -1,5 +1,20 @@
1
1
  # @spark-web/box
2
2
 
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#36](https://github.com/brighte-labs/spark-web/pull/36)
8
+ [`8546f8f`](https://github.com/brighte-labs/spark-web/commit/8546f8f05daaa79ea3ff954c6c4928a7a2d0622d)
9
+ Thanks [@lukebennett88](https://github.com/lukebennett88)! - Update Babel
10
+ config
11
+
12
+ - Updated dependencies
13
+ [[`aebff30`](https://github.com/brighte-labs/spark-web/commit/aebff30c86cb0a9db22b545c46159ce0d1c14afb),
14
+ [`8546f8f`](https://github.com/brighte-labs/spark-web/commit/8546f8f05daaa79ea3ff954c6c4928a7a2d0622d)]:
15
+ - @spark-web/theme@2.0.0
16
+ - @spark-web/utils@1.0.1
17
+
3
18
  ## 1.0.0
4
19
 
5
20
  ### Major Changes
@@ -15,7 +15,7 @@ export declare type BoxProps = {
15
15
  /** Exposes a prop-based API for adding styles to a view, within the constraints of the theme. */
16
16
  export declare const Box: <Comp extends import("react").ElementType<any> = "div">(props: {
17
17
  as?: Comp | undefined;
18
- ref?: import("react").Ref<Comp extends "symbol" | "clipPath" | "filter" | "mask" | "marker" | "text" | "circle" | "svg" | "animate" | "animateMotion" | "animateTransform" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "switch" | "textPath" | "tspan" | "use" | "view" | keyof HTMLElementTagNameMap | "set" ? (HTMLElementTagNameMap & Pick<SVGElementTagNameMap, "symbol" | "clipPath" | "filter" | "mask" | "marker" | "text" | "circle" | "svg" | "animate" | "animateMotion" | "animateTransform" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "switch" | "textPath" | "tspan" | "use" | "view" | "set">)[Comp] : Comp extends new (...args: any) => any ? InstanceType<Comp> : undefined> | undefined;
18
+ ref?: import("react").Ref<Comp extends "symbol" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | "set" | keyof HTMLElementTagNameMap ? (HTMLElementTagNameMap & Pick<SVGElementTagNameMap, "symbol" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | "set">)[Comp] : Comp extends new (...args: any) => any ? InstanceType<Comp> : undefined> | undefined;
19
19
  } & Omit<import("react").PropsWithoutRef<import("react").ComponentProps<Comp>>, "as"> & {
20
20
  children?: ReactNode;
21
21
  /** An identifier which must be unique in the whole document. */
@@ -28,11 +28,11 @@ export declare const Box: <Comp extends import("react").ElementType<any> = "div"
28
28
  */
29
29
  asElement?: keyof HTMLElementTagNameMap | undefined;
30
30
  } & {
31
- background?: "disabled" | "body" | "input" | "infoLight" | "criticalLight" | "positiveLight" | "cautionLight" | "temporary-green" | "temporary-green-low" | "temporary-green-high" | "temporary-green-soft" | "temporary-yellow" | "temporary-yellow-low" | "temporary-yellow-high" | "temporary-yellow-soft" | "temporary-dark" | "temporary-dark-low" | "temporary-dark-high" | "temporary-dark-soft" | "temporary-blue" | "temporary-blue-low" | "temporary-blue-high" | "temporary-blue-soft" | "temporary-red" | "temporary-red-low" | "temporary-red-high" | "temporary-red-soft" | "muted" | "backdrop" | "surface" | "surfaceMuted" | "surfacePressed" | "fieldAccent" | "inputPressed" | "inputDisabled" | "accent" | "accentMuted" | "neutral" | "neutralLow" | "primary" | "primaryLow" | "primaryMuted" | "secondary" | "secondaryLow" | "secondaryMuted" | "caution" | "cautionLow" | "cautionMuted" | "critical" | "criticalLow" | "criticalMuted" | "info" | "infoLow" | "infoMuted" | "positive" | "positiveLow" | "positiveMuted" | undefined;
31
+ background?: "body" | "input" | "infoLight" | "criticalLight" | "positiveLight" | "cautionLight" | "muted" | "disabled" | "backdrop" | "surface" | "surfaceMuted" | "surfacePressed" | "fieldAccent" | "inputPressed" | "inputDisabled" | "accent" | "accentMuted" | "neutral" | "neutralLow" | "primary" | "primaryLow" | "primaryMuted" | "secondary" | "secondaryLow" | "secondaryMuted" | "caution" | "cautionLow" | "cautionMuted" | "critical" | "criticalLow" | "criticalMuted" | "info" | "infoLow" | "infoMuted" | "positive" | "positiveLow" | "positiveMuted" | undefined;
32
32
  cursor?: "default" | "pointer" | undefined;
33
33
  minHeight?: 0 | undefined;
34
34
  minWidth?: 0 | undefined;
35
- overflow?: "auto" | "hidden" | "visible" | "scroll" | undefined;
36
- shadow?: "medium" | "large" | "small" | undefined;
35
+ overflow?: "scroll" | "hidden" | "auto" | "visible" | undefined;
36
+ shadow?: "small" | "medium" | "large" | undefined;
37
37
  userSelect?: "none" | undefined;
38
38
  } & import("./useBoxStyles").ResponsiveBoxProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
@@ -4,4 +4,4 @@ export declare type BackgroundVariant = NonNullable<BoxStyleProps['background']>
4
4
  export declare const InternalBackgroundProvider: import("react").Provider<BackgroundVariant>;
5
5
  export declare const useBackground: () => BackgroundVariant;
6
6
  export declare function renderBackgroundProvider(background: BackgroundVariant | undefined, element: ReactElement | null): JSX.Element | null;
7
- export declare const useBackgroundLightness: (backgroundOverride?: BackgroundVariant | undefined) => "dark" | "light";
7
+ export declare const useBackgroundLightness: (backgroundOverride?: BackgroundVariant | undefined) => "light" | "dark";
@@ -2,31 +2,27 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var React = require('react');
6
5
  var theme = require('@spark-web/theme');
7
- var _extends = require('@babel/runtime/helpers/esm/extends');
8
- var _objectWithoutProperties = require('@babel/runtime/helpers/esm/objectWithoutProperties');
6
+ var react = require('react');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+ var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
9
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
9
10
  var css = require('@emotion/css');
10
11
  var internal = require('@spark-web/utils/internal');
11
12
  var ts = require('@spark-web/utils/ts');
12
- var _defineProperty = require('@babel/runtime/helpers/esm/defineProperty');
13
13
 
14
- function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
15
-
16
- var React__default = /*#__PURE__*/_interopDefault(React);
17
-
18
- var __jsx$1 = React__default["default"].createElement;
19
14
  // prepare context
20
- var backgroundContext = /*#__PURE__*/React.createContext('body');
15
+ var backgroundContext = /*#__PURE__*/react.createContext('body');
21
16
  var InternalBackgroundProvider = backgroundContext.Provider;
22
17
  var useBackground = function useBackground() {
23
- return React.useContext(backgroundContext);
18
+ return react.useContext(backgroundContext);
24
19
  }; // conditional provider
25
20
 
26
21
  function renderBackgroundProvider(background, element) {
27
- return background ? __jsx$1(InternalBackgroundProvider, {
28
- value: background
29
- }, element) : element;
22
+ return background ? /*#__PURE__*/jsxRuntime.jsx(InternalBackgroundProvider, {
23
+ value: background,
24
+ children: element
25
+ }) : element;
30
26
  } // a11y contrast utility
31
27
 
32
28
  var useBackgroundLightness = function useBackgroundLightness(backgroundOverride) {
@@ -56,9 +52,6 @@ var BackgroundProvider = function BackgroundProvider(_ref) {
56
52
  return renderBackgroundProvider(type === 'dark' ? 'UNKNOWN_DARK' : 'UNKNOWN_LIGHT', children);
57
53
  };
58
54
 
59
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
60
-
61
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
62
55
  // TODO: review responsive props! Now that we're using object syntax, un-mapped properties don't behave as expected
63
56
  // types
64
57
 
@@ -288,7 +281,6 @@ function useBoxProps(props) {
288
281
  }
289
282
 
290
283
  var _excluded = ["as", "asElement", "className", "id"];
291
- var __jsx = React__default["default"].createElement;
292
284
 
293
285
  /** Exposes a prop-based API for adding styles to a view, within the constraints of the theme. */
294
286
  var Box = ts.forwardRefWithAs(function (_ref, forwardedRef) {
@@ -305,7 +297,7 @@ var Box = ts.forwardRefWithAs(function (_ref, forwardedRef) {
305
297
 
306
298
  var resetStyles = internal.resetElementStyles(asElement !== null && asElement !== void 0 ? asElement : Tag);
307
299
 
308
- var element = __jsx(Tag, _extends({
300
+ var element = /*#__PURE__*/jsxRuntime.jsx(Tag, _objectSpread({
309
301
  ref: forwardedRef,
310
302
  id: id,
311
303
  className: css.cx(css.css(resetStyles), css.css(styles), className)
@@ -2,31 +2,27 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var React = require('react');
6
5
  var theme = require('@spark-web/theme');
7
- var _extends = require('@babel/runtime/helpers/esm/extends');
8
- var _objectWithoutProperties = require('@babel/runtime/helpers/esm/objectWithoutProperties');
6
+ var react = require('react');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+ var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
9
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
9
10
  var css = require('@emotion/css');
10
11
  var internal = require('@spark-web/utils/internal');
11
12
  var ts = require('@spark-web/utils/ts');
12
- var _defineProperty = require('@babel/runtime/helpers/esm/defineProperty');
13
13
 
14
- function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
15
-
16
- var React__default = /*#__PURE__*/_interopDefault(React);
17
-
18
- var __jsx$1 = React__default["default"].createElement;
19
14
  // prepare context
20
- var backgroundContext = /*#__PURE__*/React.createContext('body');
15
+ var backgroundContext = /*#__PURE__*/react.createContext('body');
21
16
  var InternalBackgroundProvider = backgroundContext.Provider;
22
17
  var useBackground = function useBackground() {
23
- return React.useContext(backgroundContext);
18
+ return react.useContext(backgroundContext);
24
19
  }; // conditional provider
25
20
 
26
21
  function renderBackgroundProvider(background, element) {
27
- return background ? __jsx$1(InternalBackgroundProvider, {
28
- value: background
29
- }, element) : element;
22
+ return background ? /*#__PURE__*/jsxRuntime.jsx(InternalBackgroundProvider, {
23
+ value: background,
24
+ children: element
25
+ }) : element;
30
26
  } // a11y contrast utility
31
27
 
32
28
  var useBackgroundLightness = function useBackgroundLightness(backgroundOverride) {
@@ -56,9 +52,6 @@ var BackgroundProvider = function BackgroundProvider(_ref) {
56
52
  return renderBackgroundProvider(type === 'dark' ? 'UNKNOWN_DARK' : 'UNKNOWN_LIGHT', children);
57
53
  };
58
54
 
59
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
60
-
61
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
62
55
  // TODO: review responsive props! Now that we're using object syntax, un-mapped properties don't behave as expected
63
56
  // types
64
57
 
@@ -288,7 +281,6 @@ function useBoxProps(props) {
288
281
  }
289
282
 
290
283
  var _excluded = ["as", "asElement", "className", "id"];
291
- var __jsx = React__default["default"].createElement;
292
284
 
293
285
  /** Exposes a prop-based API for adding styles to a view, within the constraints of the theme. */
294
286
  var Box = ts.forwardRefWithAs(function (_ref, forwardedRef) {
@@ -305,7 +297,7 @@ var Box = ts.forwardRefWithAs(function (_ref, forwardedRef) {
305
297
 
306
298
  var resetStyles = internal.resetElementStyles(asElement !== null && asElement !== void 0 ? asElement : Tag);
307
299
 
308
- var element = __jsx(Tag, _extends({
300
+ var element = /*#__PURE__*/jsxRuntime.jsx(Tag, _objectSpread({
309
301
  ref: forwardedRef,
310
302
  id: id,
311
303
  className: css.cx(css.css(resetStyles), css.css(styles), className)
@@ -1,13 +1,12 @@
1
- import React, { createContext, useContext } from 'react';
2
1
  import { useTheme } from '@spark-web/theme';
3
- import _extends from '@babel/runtime/helpers/esm/extends';
2
+ import { createContext, useContext } from 'react';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
4
5
  import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
5
6
  import { cx, css } from '@emotion/css';
6
7
  import { resetElementStyles } from '@spark-web/utils/internal';
7
8
  import { forwardRefWithAs } from '@spark-web/utils/ts';
8
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
9
9
 
10
- var __jsx$1 = React.createElement;
11
10
  // prepare context
12
11
  var backgroundContext = /*#__PURE__*/createContext('body');
13
12
  var InternalBackgroundProvider = backgroundContext.Provider;
@@ -16,9 +15,10 @@ var useBackground = function useBackground() {
16
15
  }; // conditional provider
17
16
 
18
17
  function renderBackgroundProvider(background, element) {
19
- return background ? __jsx$1(InternalBackgroundProvider, {
20
- value: background
21
- }, element) : element;
18
+ return background ? /*#__PURE__*/jsx(InternalBackgroundProvider, {
19
+ value: background,
20
+ children: element
21
+ }) : element;
22
22
  } // a11y contrast utility
23
23
 
24
24
  var useBackgroundLightness = function useBackgroundLightness(backgroundOverride) {
@@ -48,9 +48,6 @@ var BackgroundProvider = function BackgroundProvider(_ref) {
48
48
  return renderBackgroundProvider(type === 'dark' ? 'UNKNOWN_DARK' : 'UNKNOWN_LIGHT', children);
49
49
  };
50
50
 
51
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
52
-
53
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
54
51
  // TODO: review responsive props! Now that we're using object syntax, un-mapped properties don't behave as expected
55
52
  // types
56
53
 
@@ -280,7 +277,6 @@ function useBoxProps(props) {
280
277
  }
281
278
 
282
279
  var _excluded = ["as", "asElement", "className", "id"];
283
- var __jsx = React.createElement;
284
280
 
285
281
  /** Exposes a prop-based API for adding styles to a view, within the constraints of the theme. */
286
282
  var Box = forwardRefWithAs(function (_ref, forwardedRef) {
@@ -297,7 +293,7 @@ var Box = forwardRefWithAs(function (_ref, forwardedRef) {
297
293
 
298
294
  var resetStyles = resetElementStyles(asElement !== null && asElement !== void 0 ? asElement : Tag);
299
295
 
300
- var element = __jsx(Tag, _extends({
296
+ var element = /*#__PURE__*/jsx(Tag, _objectSpread({
301
297
  ref: forwardedRef,
302
298
  id: id,
303
299
  className: cx(css(resetStyles), css(styles), className)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spark-web/box",
3
3
  "license": "MIT",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "main": "dist/spark-web-box.cjs.js",
6
6
  "module": "dist/spark-web-box.esm.js",
7
7
  "devDependencies": {
@@ -10,8 +10,8 @@
10
10
  "dependencies": {
11
11
  "@babel/runtime": "^7.14.6",
12
12
  "@emotion/css": "^11.7.1",
13
- "@spark-web/theme": "^1.0.0",
14
- "@spark-web/utils": "^1.0.0",
13
+ "@spark-web/theme": "^2.0.0",
14
+ "@spark-web/utils": "^1.0.1",
15
15
  "react": "^17.0.2"
16
16
  },
17
17
  "engines": {