@zendeskgarden/react-theming 9.0.0-next.6 → 9.0.0-next.7

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/dist/index.cjs.js CHANGED
@@ -9,8 +9,6 @@
9
9
 
10
10
  var React = require('react');
11
11
  var styledComponents = require('styled-components');
12
- var containerFocusvisible = require('@zendeskgarden/container-focusvisible');
13
- var containerUtilities = require('@zendeskgarden/container-utilities');
14
12
  var chromaJs = require('chroma-js');
15
13
  var polished = require('polished');
16
14
  var get = require('lodash.get');
@@ -453,37 +451,14 @@ const DEFAULT_THEME = {
453
451
  space
454
452
  };
455
453
 
456
- const useDocument = theme => {
457
- const [controlledDocument, setControlledDocument] = React.useState();
458
- React.useEffect(() => {
459
- if (theme && theme.document) {
460
- setControlledDocument(theme.document);
461
- } else {
462
- setControlledDocument(document);
463
- }
464
- }, [theme]);
465
- return controlledDocument;
466
- };
467
-
468
454
  const ThemeProvider = _ref => {
469
455
  let {
470
456
  theme,
471
- focusVisibleRef,
472
- children,
473
457
  ...other
474
458
  } = _ref;
475
- const scopeRef = React.useRef(null);
476
- const relativeDocument = useDocument(theme);
477
- const controlledScopeRef = focusVisibleRef === null ? React__default.default.createRef() : containerUtilities.getControlledValue(focusVisibleRef, scopeRef);
478
- containerFocusvisible.useFocusVisible({
479
- scope: controlledScopeRef,
480
- relativeDocument
481
- });
482
459
  return React__default.default.createElement(styledComponents.ThemeProvider, _extends({
483
460
  theme: theme
484
- }, other), focusVisibleRef === undefined ? React__default.default.createElement("div", {
485
- ref: scopeRef
486
- }, children) : children);
461
+ }, other));
487
462
  };
488
463
  ThemeProvider.defaultProps = {
489
464
  theme: DEFAULT_THEME
@@ -1057,6 +1032,18 @@ function arrowStyles(position) {
1057
1032
  return styledComponents.css(["position:relative;&::before{border-width:inherit;border-style:inherit;border-color:transparent;background-clip:content-box;}&::after{z-index:-1;border:inherit;box-shadow:inherit;}&::before,&::after{position:absolute;transform:rotate(45deg);background-color:inherit;box-sizing:inherit;width:", ";height:", ";content:'';}", ";", ";"], squareSize, squareSize, positionStyles(position, squareSize, inset), options.animationModifier && animationStyles$1(position, options.animationModifier));
1058
1033
  }
1059
1034
 
1035
+ const useDocument = theme => {
1036
+ const [controlledDocument, setControlledDocument] = React.useState();
1037
+ React.useEffect(() => {
1038
+ if (theme && theme.document) {
1039
+ setControlledDocument(theme.document);
1040
+ } else {
1041
+ setControlledDocument(document);
1042
+ }
1043
+ }, [theme]);
1044
+ return controlledDocument;
1045
+ };
1046
+
1060
1047
  const useWindow = theme => {
1061
1048
  const [controlledWindow, setControlledWindow] = React.useState();
1062
1049
  React.useEffect(() => {
@@ -1127,7 +1114,7 @@ function menuStyles(position) {
1127
1114
  return styledComponents.css(["position:absolute;z-index:", ";", ":", ";line-height:0;font-size:0.01px;& ", "{display:inline-block;position:relative;margin:0;box-sizing:border-box;border:", " ", ";border-radius:", ";box-shadow:", ";background-color:", ";cursor:default;padding:0;text-align:", ";white-space:normal;font-size:", ";font-weight:", ";direction:", ";:focus{outline:none;}}", ";", ";"], options.zIndex || 0, marginProperty, options.margin, options.childSelector || '> *', theme.borders.sm, getColorV8('neutralHue', 300, theme), theme.borderRadii.md, theme.shadows.lg(`${theme.space.base * 5}px`, `${theme.space.base * 7.5}px`, getColorV8('chromeHue', 600, theme, 0.15)), getColorV8('background', 600 , theme), theme.rtl ? 'right' : 'left', theme.fontSizes.md, theme.fontWeights.regular, theme.rtl && 'rtl', options.animationModifier && animationStyles(position, options), options.hidden && hiddenStyles(options));
1128
1115
  }
1129
1116
 
1130
- const SELECTOR_FOCUS_VISIBLE = '&:focus-visible, &[data-garden-focus-visible="true"]';
1117
+ const SELECTOR_FOCUS_VISIBLE = '&:focus-visible';
1131
1118
  const focusStyles = _ref => {
1132
1119
  let {
1133
1120
  condition = true,
package/dist/index.esm.js CHANGED
@@ -5,10 +5,8 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
 
8
- import React, { useState, useEffect, useRef, useMemo } from 'react';
8
+ import React, { useState, useEffect, useMemo } from 'react';
9
9
  import { ThemeProvider as ThemeProvider$1, css, keyframes } from 'styled-components';
10
- import { useFocusVisible } from '@zendeskgarden/container-focusvisible';
11
- import { getControlledValue } from '@zendeskgarden/container-utilities';
12
10
  import { valid, scale } from 'chroma-js';
13
11
  import { rgba, darken, lighten, getValueAndUnit, math } from 'polished';
14
12
  import get from 'lodash.get';
@@ -445,37 +443,14 @@ const DEFAULT_THEME = {
445
443
  space
446
444
  };
447
445
 
448
- const useDocument = theme => {
449
- const [controlledDocument, setControlledDocument] = useState();
450
- useEffect(() => {
451
- if (theme && theme.document) {
452
- setControlledDocument(theme.document);
453
- } else {
454
- setControlledDocument(document);
455
- }
456
- }, [theme]);
457
- return controlledDocument;
458
- };
459
-
460
446
  const ThemeProvider = _ref => {
461
447
  let {
462
448
  theme,
463
- focusVisibleRef,
464
- children,
465
449
  ...other
466
450
  } = _ref;
467
- const scopeRef = useRef(null);
468
- const relativeDocument = useDocument(theme);
469
- const controlledScopeRef = focusVisibleRef === null ? React.createRef() : getControlledValue(focusVisibleRef, scopeRef);
470
- useFocusVisible({
471
- scope: controlledScopeRef,
472
- relativeDocument
473
- });
474
451
  return React.createElement(ThemeProvider$1, _extends({
475
452
  theme: theme
476
- }, other), focusVisibleRef === undefined ? React.createElement("div", {
477
- ref: scopeRef
478
- }, children) : children);
453
+ }, other));
479
454
  };
480
455
  ThemeProvider.defaultProps = {
481
456
  theme: DEFAULT_THEME
@@ -1049,6 +1024,18 @@ function arrowStyles(position) {
1049
1024
  return css(["position:relative;&::before{border-width:inherit;border-style:inherit;border-color:transparent;background-clip:content-box;}&::after{z-index:-1;border:inherit;box-shadow:inherit;}&::before,&::after{position:absolute;transform:rotate(45deg);background-color:inherit;box-sizing:inherit;width:", ";height:", ";content:'';}", ";", ";"], squareSize, squareSize, positionStyles(position, squareSize, inset), options.animationModifier && animationStyles$1(position, options.animationModifier));
1050
1025
  }
1051
1026
 
1027
+ const useDocument = theme => {
1028
+ const [controlledDocument, setControlledDocument] = useState();
1029
+ useEffect(() => {
1030
+ if (theme && theme.document) {
1031
+ setControlledDocument(theme.document);
1032
+ } else {
1033
+ setControlledDocument(document);
1034
+ }
1035
+ }, [theme]);
1036
+ return controlledDocument;
1037
+ };
1038
+
1052
1039
  const useWindow = theme => {
1053
1040
  const [controlledWindow, setControlledWindow] = useState();
1054
1041
  useEffect(() => {
@@ -1119,7 +1106,7 @@ function menuStyles(position) {
1119
1106
  return css(["position:absolute;z-index:", ";", ":", ";line-height:0;font-size:0.01px;& ", "{display:inline-block;position:relative;margin:0;box-sizing:border-box;border:", " ", ";border-radius:", ";box-shadow:", ";background-color:", ";cursor:default;padding:0;text-align:", ";white-space:normal;font-size:", ";font-weight:", ";direction:", ";:focus{outline:none;}}", ";", ";"], options.zIndex || 0, marginProperty, options.margin, options.childSelector || '> *', theme.borders.sm, getColorV8('neutralHue', 300, theme), theme.borderRadii.md, theme.shadows.lg(`${theme.space.base * 5}px`, `${theme.space.base * 7.5}px`, getColorV8('chromeHue', 600, theme, 0.15)), getColorV8('background', 600 , theme), theme.rtl ? 'right' : 'left', theme.fontSizes.md, theme.fontWeights.regular, theme.rtl && 'rtl', options.animationModifier && animationStyles(position, options), options.hidden && hiddenStyles(options));
1120
1107
  }
1121
1108
 
1122
- const SELECTOR_FOCUS_VISIBLE = '&:focus-visible, &[data-garden-focus-visible="true"]';
1109
+ const SELECTOR_FOCUS_VISIBLE = '&:focus-visible';
1123
1110
  const focusStyles = _ref => {
1124
1111
  let {
1125
1112
  condition = true,
@@ -5,10 +5,10 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import React, { PropsWithChildren } from 'react';
8
- import { IGardenTheme, IThemeProviderProps } from '../types';
8
+ import { IThemeProviderProps } from '../types';
9
9
  export declare const ThemeProvider: {
10
- ({ theme, focusVisibleRef, children, ...other }: PropsWithChildren<IThemeProviderProps>): React.JSX.Element;
10
+ ({ theme, ...other }: PropsWithChildren<IThemeProviderProps>): React.JSX.Element;
11
11
  defaultProps: {
12
- theme: IGardenTheme;
12
+ theme: import("../types").IGardenTheme;
13
13
  };
14
14
  };
@@ -4,7 +4,6 @@
4
4
  * Use of this source code is governed under the Apache License, Version 2.0
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
- /// <reference types="react" />
8
7
  import { ThemeProviderProps } from 'styled-components';
9
8
  export declare const ARROW_POSITION: readonly ["top", "top-left", "top-right", "right", "right-top", "right-bottom", "bottom", "bottom-left", "bottom-right", "left", "left-top", "left-bottom"];
10
9
  export type ArrowPosition = (typeof ARROW_POSITION)[number];
@@ -128,11 +127,4 @@ export interface IThemeProviderProps extends Partial<ThemeProviderProps<IGardenT
128
127
  * for details.
129
128
  */
130
129
  theme?: IGardenTheme | ((theme: IGardenTheme) => IGardenTheme);
131
- /**
132
- * Provides a reference to the DOM node used to scope a `:focus-visible`
133
- * polyfill. If left `undefined`, a scoping `<div>` will be rendered.
134
- * Assigning `null` (on a nested `ThemeProvider`, for example) prevents the
135
- * added polyfill and scoping `<div>`.
136
- */
137
- focusVisibleRef?: React.RefObject<HTMLElement> | null;
138
130
  }
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { CSSObject } from 'styled-components';
8
8
  import { FocusBoxShadowParameters } from './getFocusBoxShadow';
9
- export declare const SELECTOR_FOCUS_VISIBLE = "&:focus-visible, &[data-garden-focus-visible=\"true\"]";
9
+ export declare const SELECTOR_FOCUS_VISIBLE = "&:focus-visible";
10
10
  type FocusStylesParameters = FocusBoxShadowParameters & {
11
11
  condition?: boolean;
12
12
  selector?: string;
@@ -33,8 +33,7 @@ type FocusStylesParameters = FocusBoxShadowParameters & {
33
33
  * outline: none;
34
34
  * }
35
35
  *
36
- * :focus-visible,
37
- * [data-garden-focus-visible='true'] {
36
+ * :focus-visible {
38
37
  * box-shadow: 0 0 0 {1px} #fff,
39
38
  * 0 0 0 {3px} {blue};
40
39
  * outline: {2px} solid transparent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-theming",
3
- "version": "9.0.0-next.6",
3
+ "version": "9.0.0-next.7",
4
4
  "description": "Theming utilities and components within the Garden Design System",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Zendesk Garden <garden@zendesk.com>",
@@ -22,8 +22,6 @@
22
22
  "types": "dist/typings/index.d.ts",
23
23
  "dependencies": {
24
24
  "@floating-ui/react-dom": "^2.0.0",
25
- "@zendeskgarden/container-focusvisible": "^2.0.0",
26
- "@zendeskgarden/container-utilities": "^2.0.0",
27
25
  "chroma-js": "^2.4.2",
28
26
  "lodash.get": "^4.4.2",
29
27
  "lodash.memoize": "^4.1.2",
@@ -50,5 +48,5 @@
50
48
  "access": "public"
51
49
  },
52
50
  "zendeskgarden:src": "src/index.ts",
53
- "gitHead": "45c56ad1c73af40afba8e5415f529a2c9601c83f"
51
+ "gitHead": "50a2b45b2e237a490a6d460818d33498b92479ec"
54
52
  }