@zendeskgarden/react-theming 9.0.0-next.1 → 9.0.0-next.2
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
|
@@ -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;
|
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;
|
|
@@ -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.2",
|
|
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": "e47dd011fedf130106acdb485a023340564171af"
|
|
50
50
|
}
|