@zendeskgarden/react-theming 8.65.0 → 8.67.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/dist/index.cjs.js +71 -2
- package/dist/index.esm.js +68 -3
- package/dist/typings/index.d.ts +3 -1
- package/dist/typings/types/index.d.ts +2 -0
- package/dist/typings/utils/focusStyles.d.ts +45 -0
- package/dist/typings/utils/getColor.d.ts +4 -5
- package/dist/typings/utils/getFocusBoxShadow.d.ts +37 -0
- package/package.json +6 -2
package/dist/index.cjs.js
CHANGED
|
@@ -12,10 +12,12 @@ var styledComponents = require('styled-components');
|
|
|
12
12
|
var containerFocusvisible = require('@zendeskgarden/container-focusvisible');
|
|
13
13
|
var containerUtilities = require('@zendeskgarden/container-utilities');
|
|
14
14
|
var polished = require('polished');
|
|
15
|
+
var memoize = require('lodash.memoize');
|
|
15
16
|
|
|
16
17
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
18
|
|
|
18
19
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
20
|
+
var memoize__default = /*#__PURE__*/_interopDefault(memoize);
|
|
19
21
|
|
|
20
22
|
function _extends() {
|
|
21
23
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -249,10 +251,12 @@ const palette = {
|
|
|
249
251
|
};
|
|
250
252
|
delete palette.product;
|
|
251
253
|
const shadowWidths = {
|
|
254
|
+
xs: '1px',
|
|
252
255
|
sm: '2px',
|
|
253
256
|
md: '3px'
|
|
254
257
|
};
|
|
255
258
|
const shadows = {
|
|
259
|
+
xs: color => `0 0 0 ${shadowWidths.xs} ${color}`,
|
|
256
260
|
sm: color => `0 0 0 ${shadowWidths.sm} ${color}`,
|
|
257
261
|
md: color => `0 0 0 ${shadowWidths.md} ${color}`,
|
|
258
262
|
lg: (offsetY, blurRadius, color) => `0 ${offsetY} ${blurRadius} 0 ${color}`
|
|
@@ -364,7 +368,7 @@ const adjust = (color, expected, actual) => {
|
|
|
364
368
|
}
|
|
365
369
|
return color;
|
|
366
370
|
};
|
|
367
|
-
|
|
371
|
+
const getColor = memoize__default.default(function (hue) {
|
|
368
372
|
let shade = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_SHADE;
|
|
369
373
|
let theme = arguments.length > 2 ? arguments[2] : undefined;
|
|
370
374
|
let transparency = arguments.length > 3 ? arguments[3] : undefined;
|
|
@@ -398,7 +402,37 @@ function getColor(hue) {
|
|
|
398
402
|
retVal = polished.rgba(retVal, transparency);
|
|
399
403
|
}
|
|
400
404
|
return retVal;
|
|
401
|
-
}
|
|
405
|
+
}, (hue, shade, theme, transparency) => JSON.stringify({
|
|
406
|
+
hue,
|
|
407
|
+
shade,
|
|
408
|
+
palette: theme?.palette,
|
|
409
|
+
colors: theme?.colors,
|
|
410
|
+
transparency
|
|
411
|
+
}));
|
|
412
|
+
|
|
413
|
+
const getFocusBoxShadow = _ref => {
|
|
414
|
+
let {
|
|
415
|
+
boxShadow,
|
|
416
|
+
inset = false,
|
|
417
|
+
hue = 'primaryHue',
|
|
418
|
+
shade = DEFAULT_SHADE,
|
|
419
|
+
shadowWidth = 'md',
|
|
420
|
+
spacerHue = 'background',
|
|
421
|
+
spacerShade = DEFAULT_SHADE,
|
|
422
|
+
spacerWidth = 'xs',
|
|
423
|
+
theme = DEFAULT_THEME
|
|
424
|
+
} = _ref;
|
|
425
|
+
const color = getColor(hue, shade, theme);
|
|
426
|
+
const shadow = theme.shadows[shadowWidth](color);
|
|
427
|
+
if (spacerWidth === null) {
|
|
428
|
+
return `${inset ? 'inset' : ''} ${shadow}`;
|
|
429
|
+
}
|
|
430
|
+
const spacerColor = getColor(spacerHue, spacerShade, theme);
|
|
431
|
+
const retVal = `
|
|
432
|
+
${inset ? 'inset' : ''} ${theme.shadows[spacerWidth](spacerColor)},
|
|
433
|
+
${inset ? 'inset' : ''} ${shadow}`;
|
|
434
|
+
return boxShadow ? `${retVal}, ${boxShadow}` : retVal;
|
|
435
|
+
};
|
|
402
436
|
|
|
403
437
|
function getLineHeight(height, fontSize) {
|
|
404
438
|
const [heightValue, heightUnit] = polished.getValueAndUnit(height.toString());
|
|
@@ -583,6 +617,38 @@ function menuStyles(position) {
|
|
|
583
617
|
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, getColor('neutralHue', 300, theme), theme.borderRadii.md, theme.shadows.lg(`${theme.space.base * 5}px`, `${theme.space.base * 7.5}px`, getColor('chromeHue', 600, theme, 0.15)), theme.colors.background, theme.rtl ? 'right' : 'left', theme.fontSizes.md, theme.fontWeights.regular, theme.rtl && 'rtl', options.animationModifier && animationStyles(position, options), options.hidden && hiddenStyles(options));
|
|
584
618
|
}
|
|
585
619
|
|
|
620
|
+
const SELECTOR_FOCUS_VISIBLE = '&:focus-visible, &[data-garden-focus-visible="true"]';
|
|
621
|
+
const focusStyles = _ref => {
|
|
622
|
+
let {
|
|
623
|
+
condition = true,
|
|
624
|
+
selector = SELECTOR_FOCUS_VISIBLE,
|
|
625
|
+
shadowWidth = 'md',
|
|
626
|
+
spacerWidth = 'xs',
|
|
627
|
+
styles: {
|
|
628
|
+
boxShadow,
|
|
629
|
+
...styles
|
|
630
|
+
} = {},
|
|
631
|
+
theme,
|
|
632
|
+
...options
|
|
633
|
+
} = _ref;
|
|
634
|
+
const _boxShadow = condition ? getFocusBoxShadow({
|
|
635
|
+
boxShadow,
|
|
636
|
+
shadowWidth,
|
|
637
|
+
spacerWidth,
|
|
638
|
+
theme,
|
|
639
|
+
...options
|
|
640
|
+
}) : boxShadow;
|
|
641
|
+
let outline;
|
|
642
|
+
let outlineOffset;
|
|
643
|
+
if (spacerWidth === null) {
|
|
644
|
+
outline = theme.shadowWidths[shadowWidth];
|
|
645
|
+
} else {
|
|
646
|
+
outline = `${polished.math(`${theme.shadowWidths[shadowWidth]} - ${theme.shadowWidths[spacerWidth]}`)} solid transparent`;
|
|
647
|
+
outlineOffset = theme.shadowWidths[spacerWidth];
|
|
648
|
+
}
|
|
649
|
+
return styledComponents.css(["&:focus{outline:none;}", "{outline:", ";outline-offset:", ";box-shadow:", ";", "}"], selector, outline, outlineOffset, _boxShadow, styles);
|
|
650
|
+
};
|
|
651
|
+
|
|
586
652
|
const ARROW_POSITION = ['top', 'top-left', 'top-right', 'right', 'right-top', 'right-bottom', 'bottom', 'bottom-left', 'bottom-right', 'left', 'left-top', 'left-bottom'];
|
|
587
653
|
const MENU_POSITION = ['top', 'right', 'bottom', 'left'];
|
|
588
654
|
|
|
@@ -590,10 +656,13 @@ exports.ARRAY_ARROW_POSITION = ARROW_POSITION;
|
|
|
590
656
|
exports.ARRAY_MENU_POSITION = MENU_POSITION;
|
|
591
657
|
exports.DEFAULT_THEME = DEFAULT_THEME;
|
|
592
658
|
exports.PALETTE = PALETTE;
|
|
659
|
+
exports.SELECTOR_FOCUS_VISIBLE = SELECTOR_FOCUS_VISIBLE;
|
|
593
660
|
exports.ThemeProvider = ThemeProvider;
|
|
594
661
|
exports.arrowStyles = arrowStyles;
|
|
662
|
+
exports.focusStyles = focusStyles;
|
|
595
663
|
exports.getColor = getColor;
|
|
596
664
|
exports.getDocument = getDocument;
|
|
665
|
+
exports.getFocusBoxShadow = getFocusBoxShadow;
|
|
597
666
|
exports.getLineHeight = getLineHeight;
|
|
598
667
|
exports.isRtl = isRtl;
|
|
599
668
|
exports.mediaQuery = mediaQuery;
|
package/dist/index.esm.js
CHANGED
|
@@ -10,6 +10,7 @@ import { ThemeProvider as ThemeProvider$1, withTheme as withTheme$1, css, keyfra
|
|
|
10
10
|
import { useFocusVisible } from '@zendeskgarden/container-focusvisible';
|
|
11
11
|
import { getControlledValue } from '@zendeskgarden/container-utilities';
|
|
12
12
|
import { rgba, darken, lighten, getValueAndUnit, math } from 'polished';
|
|
13
|
+
import memoize from 'lodash.memoize';
|
|
13
14
|
|
|
14
15
|
function _extends() {
|
|
15
16
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -243,10 +244,12 @@ const palette = {
|
|
|
243
244
|
};
|
|
244
245
|
delete palette.product;
|
|
245
246
|
const shadowWidths = {
|
|
247
|
+
xs: '1px',
|
|
246
248
|
sm: '2px',
|
|
247
249
|
md: '3px'
|
|
248
250
|
};
|
|
249
251
|
const shadows = {
|
|
252
|
+
xs: color => `0 0 0 ${shadowWidths.xs} ${color}`,
|
|
250
253
|
sm: color => `0 0 0 ${shadowWidths.sm} ${color}`,
|
|
251
254
|
md: color => `0 0 0 ${shadowWidths.md} ${color}`,
|
|
252
255
|
lg: (offsetY, blurRadius, color) => `0 ${offsetY} ${blurRadius} 0 ${color}`
|
|
@@ -358,7 +361,7 @@ const adjust = (color, expected, actual) => {
|
|
|
358
361
|
}
|
|
359
362
|
return color;
|
|
360
363
|
};
|
|
361
|
-
|
|
364
|
+
const getColor = memoize(function (hue) {
|
|
362
365
|
let shade = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_SHADE;
|
|
363
366
|
let theme = arguments.length > 2 ? arguments[2] : undefined;
|
|
364
367
|
let transparency = arguments.length > 3 ? arguments[3] : undefined;
|
|
@@ -392,7 +395,37 @@ function getColor(hue) {
|
|
|
392
395
|
retVal = rgba(retVal, transparency);
|
|
393
396
|
}
|
|
394
397
|
return retVal;
|
|
395
|
-
}
|
|
398
|
+
}, (hue, shade, theme, transparency) => JSON.stringify({
|
|
399
|
+
hue,
|
|
400
|
+
shade,
|
|
401
|
+
palette: theme?.palette,
|
|
402
|
+
colors: theme?.colors,
|
|
403
|
+
transparency
|
|
404
|
+
}));
|
|
405
|
+
|
|
406
|
+
const getFocusBoxShadow = _ref => {
|
|
407
|
+
let {
|
|
408
|
+
boxShadow,
|
|
409
|
+
inset = false,
|
|
410
|
+
hue = 'primaryHue',
|
|
411
|
+
shade = DEFAULT_SHADE,
|
|
412
|
+
shadowWidth = 'md',
|
|
413
|
+
spacerHue = 'background',
|
|
414
|
+
spacerShade = DEFAULT_SHADE,
|
|
415
|
+
spacerWidth = 'xs',
|
|
416
|
+
theme = DEFAULT_THEME
|
|
417
|
+
} = _ref;
|
|
418
|
+
const color = getColor(hue, shade, theme);
|
|
419
|
+
const shadow = theme.shadows[shadowWidth](color);
|
|
420
|
+
if (spacerWidth === null) {
|
|
421
|
+
return `${inset ? 'inset' : ''} ${shadow}`;
|
|
422
|
+
}
|
|
423
|
+
const spacerColor = getColor(spacerHue, spacerShade, theme);
|
|
424
|
+
const retVal = `
|
|
425
|
+
${inset ? 'inset' : ''} ${theme.shadows[spacerWidth](spacerColor)},
|
|
426
|
+
${inset ? 'inset' : ''} ${shadow}`;
|
|
427
|
+
return boxShadow ? `${retVal}, ${boxShadow}` : retVal;
|
|
428
|
+
};
|
|
396
429
|
|
|
397
430
|
function getLineHeight(height, fontSize) {
|
|
398
431
|
const [heightValue, heightUnit] = getValueAndUnit(height.toString());
|
|
@@ -577,7 +610,39 @@ function menuStyles(position) {
|
|
|
577
610
|
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, getColor('neutralHue', 300, theme), theme.borderRadii.md, theme.shadows.lg(`${theme.space.base * 5}px`, `${theme.space.base * 7.5}px`, getColor('chromeHue', 600, theme, 0.15)), theme.colors.background, theme.rtl ? 'right' : 'left', theme.fontSizes.md, theme.fontWeights.regular, theme.rtl && 'rtl', options.animationModifier && animationStyles(position, options), options.hidden && hiddenStyles(options));
|
|
578
611
|
}
|
|
579
612
|
|
|
613
|
+
const SELECTOR_FOCUS_VISIBLE = '&:focus-visible, &[data-garden-focus-visible="true"]';
|
|
614
|
+
const focusStyles = _ref => {
|
|
615
|
+
let {
|
|
616
|
+
condition = true,
|
|
617
|
+
selector = SELECTOR_FOCUS_VISIBLE,
|
|
618
|
+
shadowWidth = 'md',
|
|
619
|
+
spacerWidth = 'xs',
|
|
620
|
+
styles: {
|
|
621
|
+
boxShadow,
|
|
622
|
+
...styles
|
|
623
|
+
} = {},
|
|
624
|
+
theme,
|
|
625
|
+
...options
|
|
626
|
+
} = _ref;
|
|
627
|
+
const _boxShadow = condition ? getFocusBoxShadow({
|
|
628
|
+
boxShadow,
|
|
629
|
+
shadowWidth,
|
|
630
|
+
spacerWidth,
|
|
631
|
+
theme,
|
|
632
|
+
...options
|
|
633
|
+
}) : boxShadow;
|
|
634
|
+
let outline;
|
|
635
|
+
let outlineOffset;
|
|
636
|
+
if (spacerWidth === null) {
|
|
637
|
+
outline = theme.shadowWidths[shadowWidth];
|
|
638
|
+
} else {
|
|
639
|
+
outline = `${math(`${theme.shadowWidths[shadowWidth]} - ${theme.shadowWidths[spacerWidth]}`)} solid transparent`;
|
|
640
|
+
outlineOffset = theme.shadowWidths[spacerWidth];
|
|
641
|
+
}
|
|
642
|
+
return css(["&:focus{outline:none;}", "{outline:", ";outline-offset:", ";box-shadow:", ";", "}"], selector, outline, outlineOffset, _boxShadow, styles);
|
|
643
|
+
};
|
|
644
|
+
|
|
580
645
|
const ARROW_POSITION = ['top', 'top-left', 'top-right', 'right', 'right-top', 'right-bottom', 'bottom', 'bottom-left', 'bottom-right', 'left', 'left-top', 'left-bottom'];
|
|
581
646
|
const MENU_POSITION = ['top', 'right', 'bottom', 'left'];
|
|
582
647
|
|
|
583
|
-
export { ARROW_POSITION as ARRAY_ARROW_POSITION, MENU_POSITION as ARRAY_MENU_POSITION, DEFAULT_THEME, PALETTE, ThemeProvider, arrowStyles, getColor, getDocument, getLineHeight, isRtl, mediaQuery, menuStyles, retrieveComponentStyles, retrieveComponentStyles as retrieveTheme, useDocument, useText, useWindow, withTheme };
|
|
648
|
+
export { ARROW_POSITION as ARRAY_ARROW_POSITION, MENU_POSITION as ARRAY_MENU_POSITION, DEFAULT_THEME, PALETTE, SELECTOR_FOCUS_VISIBLE, ThemeProvider, arrowStyles, focusStyles, getColor, getDocument, getFocusBoxShadow, getLineHeight, isRtl, mediaQuery, menuStyles, retrieveComponentStyles, retrieveComponentStyles as retrieveTheme, useDocument, useText, useWindow, withTheme };
|
package/dist/typings/index.d.ts
CHANGED
|
@@ -13,7 +13,8 @@ export { default as retrieveComponentStyles,
|
|
|
13
13
|
default as retrieveTheme } from './utils/retrieveComponentStyles';
|
|
14
14
|
export { default as withTheme } from './utils/withTheme';
|
|
15
15
|
export { default as getDocument } from './utils/getDocument';
|
|
16
|
-
export {
|
|
16
|
+
export { getColor } from './utils/getColor';
|
|
17
|
+
export { getFocusBoxShadow } from './utils/getFocusBoxShadow';
|
|
17
18
|
export { default as getLineHeight } from './utils/getLineHeight';
|
|
18
19
|
export { default as mediaQuery } from './utils/mediaQuery';
|
|
19
20
|
export { default as arrowStyles } from './utils/arrowStyles';
|
|
@@ -21,5 +22,6 @@ export { useDocument } from './utils/useDocument';
|
|
|
21
22
|
export { useWindow } from './utils/useWindow';
|
|
22
23
|
export { useText } from './utils/useText';
|
|
23
24
|
export { default as menuStyles } from './utils/menuStyles';
|
|
25
|
+
export { focusStyles, SELECTOR_FOCUS_VISIBLE } from './utils/focusStyles';
|
|
24
26
|
export { ARROW_POSITION as ARRAY_ARROW_POSITION, MENU_POSITION as ARRAY_MENU_POSITION } from './types';
|
|
25
27
|
export type { IGardenTheme, IThemeProviderProps, ArrowPosition as ARROW_POSITION, MenuPosition as MENU_POSITION } from './types';
|
|
@@ -86,10 +86,12 @@ export interface IGardenTheme {
|
|
|
86
86
|
xxxl: string;
|
|
87
87
|
};
|
|
88
88
|
shadowWidths: {
|
|
89
|
+
xs: string;
|
|
89
90
|
sm: string;
|
|
90
91
|
md: string;
|
|
91
92
|
};
|
|
92
93
|
shadows: {
|
|
94
|
+
xs: (color: string) => string;
|
|
93
95
|
sm: (color: string) => string;
|
|
94
96
|
md: (color: string) => string;
|
|
95
97
|
lg: (offsetY: string, blurRadius: string, color: string) => string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import { CSSObject } from 'styled-components';
|
|
8
|
+
import { FocusBoxShadowParameters } from './getFocusBoxShadow';
|
|
9
|
+
export declare const SELECTOR_FOCUS_VISIBLE = "&:focus-visible, &[data-garden-focus-visible=\"true\"]";
|
|
10
|
+
type FocusStylesParameters = FocusBoxShadowParameters & {
|
|
11
|
+
condition?: boolean;
|
|
12
|
+
selector?: string;
|
|
13
|
+
styles?: CSSObject;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Garden standard `box-shadow` focus styling.
|
|
17
|
+
*
|
|
18
|
+
* @param {boolean} [options.condition=true] Supplies an optional condition that can be used to prevent the focus `box-shadow`
|
|
19
|
+
* @param {boolean} [options.inset=false] Determines whether the `box-shadow` is inset
|
|
20
|
+
* @param {string|Object} [options.hue='primaryHue'] Provides a theme object `palette` hue or `color` key, or any valid CSS color notation
|
|
21
|
+
* @param {string} [options.selector=SELECTOR_FOCUS_VISIBLE] Provides a subsitute `:focus-visible` pseudo-class CSS selector.
|
|
22
|
+
* @param {number} [options.shade=600] Selects a shade for the given hue
|
|
23
|
+
* @param {string} [options.shadowWidth='md'] Provides a theme object `shadowWidth` key for the cumulative width of the `box-shadow`
|
|
24
|
+
* @param {string} [options.spacerWidth='xs'] Provides a theme object `shadowWidth` for the white spacer, or `null` to remove
|
|
25
|
+
* @param {Object} [options.styles] Adds CSS property values to be rendered with `:focus-visible`
|
|
26
|
+
* @param {Object} options.theme Provides values used to resolve the desired color
|
|
27
|
+
*
|
|
28
|
+
* @returns CSS structured as follows, with `{values}` determined by the options provided:
|
|
29
|
+
* ```css
|
|
30
|
+
* :focus {
|
|
31
|
+
* outline: none;
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* :focus-visible,
|
|
35
|
+
* [data-garden-focus-visible='true'] {
|
|
36
|
+
* box-shadow: 0 0 0 {1px} #fff,
|
|
37
|
+
* 0 0 0 {3px} {blue};
|
|
38
|
+
* outline: {2px} solid transparent;
|
|
39
|
+
* outline-offset: {1px};
|
|
40
|
+
* // additional {styles} here...
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare const focusStyles: ({ condition, selector, shadowWidth, spacerWidth, styles: { boxShadow, ...styles }, theme, ...options }: FocusStylesParameters) => import("styled-components").FlattenSimpleInterpolation;
|
|
45
|
+
export {};
|
|
@@ -4,8 +4,10 @@
|
|
|
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="lodash" />
|
|
7
8
|
import { DefaultTheme } from 'styled-components';
|
|
8
|
-
type Hue = Record<number | string, string> | string;
|
|
9
|
+
export type Hue = Record<number | string, string> | string;
|
|
10
|
+
export declare const DEFAULT_SHADE = 600;
|
|
9
11
|
/**
|
|
10
12
|
* Get the palette color for the given hue, shade, and theme.
|
|
11
13
|
*
|
|
@@ -19,8 +21,5 @@ type Hue = Record<number | string, string> | string;
|
|
|
19
21
|
* @param {number} [shade=DEFAULT_SHADE] A hue shade.
|
|
20
22
|
* @param {Object} theme Context `theme` object.
|
|
21
23
|
* @param {Number} [transparency] An alpha-channel value between 0 and 1.
|
|
22
|
-
*
|
|
23
|
-
* @component
|
|
24
24
|
*/
|
|
25
|
-
export
|
|
26
|
-
export {};
|
|
25
|
+
export declare const getColor: ((hue: Hue, shade?: number, theme?: DefaultTheme, transparency?: number) => string | undefined) & import("lodash").MemoizedFunction;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import { IGardenTheme } from '../types';
|
|
8
|
+
import { Hue } from './getColor';
|
|
9
|
+
export type FocusBoxShadowParameters = {
|
|
10
|
+
boxShadow?: string;
|
|
11
|
+
inset?: boolean;
|
|
12
|
+
hue?: Hue;
|
|
13
|
+
shade?: number;
|
|
14
|
+
shadowWidth?: 'sm' | 'md';
|
|
15
|
+
spacerHue?: Hue;
|
|
16
|
+
spacerShade?: number;
|
|
17
|
+
spacerWidth?: null | 'xs' | 'sm';
|
|
18
|
+
theme: IGardenTheme;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Get a CSS `box-shadow` property value for focus state styling. The `hue` and
|
|
22
|
+
* `shade` are used to determine the color of the focus ring.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} [options.boxShadow] Provides an existing `box-shadow` (a drop shadow, for example) to be retained along with the focus ring
|
|
25
|
+
* @param {boolean} [options.inset=false] Determines whether the `box-shadow` is inset
|
|
26
|
+
* @param {string|Object} [options.hue='primaryHue'] Provides a theme object `palette` hue or `color` key, or any valid CSS color notation
|
|
27
|
+
* @param {number} [options.shade=600] Selects a shade for the given `hue`
|
|
28
|
+
* @param {string} [options.shadowWidth='md'] Provides a theme object `shadowWidth` key for the cumulative width of the `box-shadow`
|
|
29
|
+
* @param {string|Object} [options.spacerHue='background'] Provides a theme object `palette` hue or `color` key, or any valid CSS color notation
|
|
30
|
+
* @param {number} [options.spacerShade=600] Selects a shade for the given `spacerHue`
|
|
31
|
+
* @param {string} [options.spacerWidth='xs'] Provides a theme object `shadowWidth` for the white spacer, or `null` to remove
|
|
32
|
+
* @param {Object} options.theme Provides values used to resolve the desired color
|
|
33
|
+
*
|
|
34
|
+
* @returns A `box-shadow` property value for the given options. Default is a
|
|
35
|
+
* 3px `blue[600]` ring with a 1px white spacer overlay.
|
|
36
|
+
*/
|
|
37
|
+
export declare const getFocusBoxShadow: ({ boxShadow, inset, hue, shade, shadowWidth, spacerHue, spacerShade, spacerWidth, theme }: FocusBoxShadowParameters) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-theming",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.67.0",
|
|
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>",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@zendeskgarden/container-focusvisible": "^1.0.0",
|
|
25
25
|
"@zendeskgarden/container-utilities": "^1.0.0",
|
|
26
|
+
"lodash.memoize": "^4.1.2",
|
|
26
27
|
"polished": "^4.0.0",
|
|
27
28
|
"prop-types": "^15.5.7"
|
|
28
29
|
},
|
|
@@ -31,6 +32,9 @@
|
|
|
31
32
|
"react-dom": ">=16.8.0",
|
|
32
33
|
"styled-components": "^4.2.0 || ^5.0.0"
|
|
33
34
|
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/lodash.memoize": "4.1.7"
|
|
37
|
+
},
|
|
34
38
|
"keywords": [
|
|
35
39
|
"components",
|
|
36
40
|
"garden",
|
|
@@ -41,5 +45,5 @@
|
|
|
41
45
|
"access": "public"
|
|
42
46
|
},
|
|
43
47
|
"zendeskgarden:src": "src/index.ts",
|
|
44
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "50a98b0cd7c85bed2ed88ad869e6f2cd3fc68f62"
|
|
45
49
|
}
|