@zendeskgarden/react-theming 9.0.0-next.1 → 9.0.0-next.3
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 +15 -10
- package/dist/index.esm.js +14 -8
- package/dist/typings/elements/ThemeProvider.d.ts +2 -2
- package/dist/typings/index.d.ts +2 -4
- package/dist/typings/types/index.d.ts +3 -3
- package/dist/typings/utils/getArrowPosition.d.ts +4 -2
- package/dist/typings/utils/menuStyles.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -356,8 +356,18 @@ const POSITION_MAP = {
|
|
|
356
356
|
'left-start': 'right-top',
|
|
357
357
|
'left-end': 'right-bottom'
|
|
358
358
|
};
|
|
359
|
-
const
|
|
360
|
-
|
|
359
|
+
const RTL_POSITION_MAP = {
|
|
360
|
+
'bottom-left': 'bottom-right',
|
|
361
|
+
'bottom-right': 'bottom-left',
|
|
362
|
+
'top-left': 'top-right',
|
|
363
|
+
'top-right': 'top-left'
|
|
364
|
+
};
|
|
365
|
+
const getArrowPosition = (theme, placement) => {
|
|
366
|
+
let retVal = POSITION_MAP[placement];
|
|
367
|
+
if (theme.rtl) {
|
|
368
|
+
retVal = RTL_POSITION_MAP[retVal] || retVal;
|
|
369
|
+
}
|
|
370
|
+
return retVal;
|
|
361
371
|
};
|
|
362
372
|
|
|
363
373
|
const DEFAULT_SHADE = 600;
|
|
@@ -422,13 +432,9 @@ const RTL_PLACEMENT_MAP = {
|
|
|
422
432
|
left: 'right',
|
|
423
433
|
'left-start': 'right-start',
|
|
424
434
|
'left-end': 'right-end',
|
|
425
|
-
'top-start': 'top-end',
|
|
426
|
-
'top-end': 'top-start',
|
|
427
435
|
right: 'left',
|
|
428
436
|
'right-start': 'left-start',
|
|
429
|
-
'right-end': 'left-end'
|
|
430
|
-
'bottom-start': 'bottom-end',
|
|
431
|
-
'bottom-end': 'bottom-start'
|
|
437
|
+
'right-end': 'left-end'
|
|
432
438
|
};
|
|
433
439
|
const toFloatingPlacement = (placement, theme) => {
|
|
434
440
|
let retVal = PLACEMENT_MAP[placement] || placement;
|
|
@@ -712,9 +718,9 @@ const ARROW_POSITION = ['top', 'top-left', 'top-right', 'right', 'right-top', 'r
|
|
|
712
718
|
const MENU_POSITION = ['top', 'right', 'bottom', 'left'];
|
|
713
719
|
const PLACEMENT = ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'end', 'end-top', 'end-bottom', 'start', 'start-top', 'start-bottom'];
|
|
714
720
|
|
|
715
|
-
exports.
|
|
716
|
-
exports.ARRAY_MENU_POSITION = MENU_POSITION;
|
|
721
|
+
exports.ARROW_POSITION = ARROW_POSITION;
|
|
717
722
|
exports.DEFAULT_THEME = DEFAULT_THEME;
|
|
723
|
+
exports.MENU_POSITION = MENU_POSITION;
|
|
718
724
|
exports.PALETTE = PALETTE;
|
|
719
725
|
exports.PLACEMENT = PLACEMENT;
|
|
720
726
|
exports.SELECTOR_FOCUS_VISIBLE = SELECTOR_FOCUS_VISIBLE;
|
|
@@ -730,7 +736,6 @@ exports.getMenuPosition = getMenuPosition;
|
|
|
730
736
|
exports.mediaQuery = mediaQuery;
|
|
731
737
|
exports.menuStyles = menuStyles;
|
|
732
738
|
exports.retrieveComponentStyles = retrieveComponentStyles;
|
|
733
|
-
exports.retrieveTheme = retrieveComponentStyles;
|
|
734
739
|
exports.useDocument = useDocument;
|
|
735
740
|
exports.useText = useText;
|
|
736
741
|
exports.useWindow = useWindow;
|
package/dist/index.esm.js
CHANGED
|
@@ -349,8 +349,18 @@ const POSITION_MAP = {
|
|
|
349
349
|
'left-start': 'right-top',
|
|
350
350
|
'left-end': 'right-bottom'
|
|
351
351
|
};
|
|
352
|
-
const
|
|
353
|
-
|
|
352
|
+
const RTL_POSITION_MAP = {
|
|
353
|
+
'bottom-left': 'bottom-right',
|
|
354
|
+
'bottom-right': 'bottom-left',
|
|
355
|
+
'top-left': 'top-right',
|
|
356
|
+
'top-right': 'top-left'
|
|
357
|
+
};
|
|
358
|
+
const getArrowPosition = (theme, placement) => {
|
|
359
|
+
let retVal = POSITION_MAP[placement];
|
|
360
|
+
if (theme.rtl) {
|
|
361
|
+
retVal = RTL_POSITION_MAP[retVal] || retVal;
|
|
362
|
+
}
|
|
363
|
+
return retVal;
|
|
354
364
|
};
|
|
355
365
|
|
|
356
366
|
const DEFAULT_SHADE = 600;
|
|
@@ -415,13 +425,9 @@ const RTL_PLACEMENT_MAP = {
|
|
|
415
425
|
left: 'right',
|
|
416
426
|
'left-start': 'right-start',
|
|
417
427
|
'left-end': 'right-end',
|
|
418
|
-
'top-start': 'top-end',
|
|
419
|
-
'top-end': 'top-start',
|
|
420
428
|
right: 'left',
|
|
421
429
|
'right-start': 'left-start',
|
|
422
|
-
'right-end': 'left-end'
|
|
423
|
-
'bottom-start': 'bottom-end',
|
|
424
|
-
'bottom-end': 'bottom-start'
|
|
430
|
+
'right-end': 'left-end'
|
|
425
431
|
};
|
|
426
432
|
const toFloatingPlacement = (placement, theme) => {
|
|
427
433
|
let retVal = PLACEMENT_MAP[placement] || placement;
|
|
@@ -705,4 +711,4 @@ const ARROW_POSITION = ['top', 'top-left', 'top-right', 'right', 'right-top', 'r
|
|
|
705
711
|
const MENU_POSITION = ['top', 'right', 'bottom', 'left'];
|
|
706
712
|
const PLACEMENT = ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'end', 'end-top', 'end-bottom', 'start', 'start-top', 'start-bottom'];
|
|
707
713
|
|
|
708
|
-
export { ARROW_POSITION
|
|
714
|
+
export { ARROW_POSITION, DEFAULT_THEME, MENU_POSITION, PALETTE, PLACEMENT, SELECTOR_FOCUS_VISIBLE, ThemeProvider, arrowStyles, focusStyles, getArrowPosition, getColor, getFloatingPlacements, getFocusBoxShadow, getLineHeight, getMenuPosition, mediaQuery, menuStyles, retrieveComponentStyles, useDocument, useText, useWindow };
|
|
@@ -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 { IThemeProviderProps } from '../types';
|
|
8
|
+
import { IGardenTheme, IThemeProviderProps } from '../types';
|
|
9
9
|
export declare const ThemeProvider: {
|
|
10
10
|
({ theme, focusVisibleRef, children, ...other }: PropsWithChildren<IThemeProviderProps>): React.JSX.Element;
|
|
11
11
|
defaultProps: {
|
|
12
|
-
theme:
|
|
12
|
+
theme: IGardenTheme;
|
|
13
13
|
};
|
|
14
14
|
};
|
package/dist/typings/index.d.ts
CHANGED
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
export { ThemeProvider } from './elements/ThemeProvider';
|
|
8
8
|
export { default as DEFAULT_THEME } from './elements/theme';
|
|
9
9
|
export { default as PALETTE } from './elements/palette';
|
|
10
|
-
export { default as retrieveComponentStyles
|
|
11
|
-
/** `retrieveTheme` is a deprecated usage for v7 compatability */
|
|
12
|
-
default as retrieveTheme } from './utils/retrieveComponentStyles';
|
|
10
|
+
export { default as retrieveComponentStyles } from './utils/retrieveComponentStyles';
|
|
13
11
|
export { getArrowPosition } from './utils/getArrowPosition';
|
|
14
12
|
export { getColor } from './utils/getColor';
|
|
15
13
|
export { getFloatingPlacements } from './utils/getFloatingPlacements';
|
|
@@ -23,4 +21,4 @@ export { useWindow } from './utils/useWindow';
|
|
|
23
21
|
export { useText } from './utils/useText';
|
|
24
22
|
export { default as menuStyles } from './utils/menuStyles';
|
|
25
23
|
export { focusStyles, SELECTOR_FOCUS_VISIBLE } from './utils/focusStyles';
|
|
26
|
-
export { ARROW_POSITION
|
|
24
|
+
export { ARROW_POSITION, MENU_POSITION, PLACEMENT, type IGardenTheme, type IThemeProviderProps, type ArrowPosition, type MenuPosition, type Placement } from './types';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
/// <reference types="react" />
|
|
8
|
-
import {
|
|
8
|
+
import { ThemeProviderProps } from 'styled-components';
|
|
9
9
|
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
10
|
export type ArrowPosition = (typeof ARROW_POSITION)[number];
|
|
11
11
|
export declare const MENU_POSITION: readonly ["top", "right", "bottom", "left"];
|
|
@@ -111,13 +111,13 @@ export interface IGardenTheme {
|
|
|
111
111
|
};
|
|
112
112
|
palette: Record<string, Hue>;
|
|
113
113
|
}
|
|
114
|
-
export interface IThemeProviderProps extends Partial<
|
|
114
|
+
export interface IThemeProviderProps extends Partial<ThemeProviderProps<IGardenTheme>> {
|
|
115
115
|
/**
|
|
116
116
|
* Provides values for component styling. See styled-components
|
|
117
117
|
* [`ThemeProvider`](https://styled-components.com/docs/api#themeprovider)
|
|
118
118
|
* for details.
|
|
119
119
|
*/
|
|
120
|
-
theme?: IGardenTheme;
|
|
120
|
+
theme?: IGardenTheme | ((theme: IGardenTheme) => IGardenTheme);
|
|
121
121
|
/**
|
|
122
122
|
* Provides a reference to the DOM node used to scope a `:focus-visible`
|
|
123
123
|
* polyfill. If left `undefined`, a scoping `<div>` will be rendered.
|
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import { Placement } from '@floating-ui/react-dom';
|
|
8
|
-
import { ArrowPosition } from '../types';
|
|
8
|
+
import { ArrowPosition, IGardenTheme } from '../types';
|
|
9
9
|
export declare const POSITION_MAP: Record<Placement, ArrowPosition>;
|
|
10
|
+
export declare const RTL_POSITION_MAP: Record<string, ArrowPosition>;
|
|
10
11
|
/**
|
|
11
12
|
* Convert Floating-UI placement to a valid `arrowStyles` position.
|
|
12
13
|
*
|
|
14
|
+
* @param {Object} theme Context `theme` object used to determine if layout is right-to-left.
|
|
13
15
|
* @param {string} placement A Floating-UI placement.
|
|
14
16
|
*
|
|
15
17
|
* @returns An `arrowStyles` position.
|
|
16
18
|
*/
|
|
17
|
-
export declare const getArrowPosition: (placement: Placement) => ArrowPosition;
|
|
19
|
+
export declare const getArrowPosition: (theme: IGardenTheme, placement: Placement) => ArrowPosition;
|
|
@@ -16,8 +16,8 @@ type MenuOptions = {
|
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* CSS for a `wrapper > menu` at the given position. The wrapper provides
|
|
19
|
-
* absolute positioning (e.g. via
|
|
20
|
-
* optional animation.
|
|
19
|
+
* absolute positioning (e.g. via Floating-UI). The menu provides basic styling
|
|
20
|
+
* and optional animation.
|
|
21
21
|
*
|
|
22
22
|
* @param {string} position One of:
|
|
23
23
|
* - `'top'`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-theming",
|
|
3
|
-
"version": "9.0.0-next.
|
|
3
|
+
"version": "9.0.0-next.3",
|
|
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>",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"zendeskgarden:src": "src/index.ts",
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "d5086e8a3ae0c8608361966954bf434ef03005ec"
|
|
50
50
|
}
|