@codecademy/gamut 68.2.3-alpha.f27e78.0 → 68.2.3-alpha.f802ae.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.
@@ -1,8 +1,7 @@
1
1
  import { MiniChevronLeftIcon, MiniChevronRightIcon } from '@codecademy/gamut-icons';
2
- import { useElementDir } from '@codecademy/gamut-styles';
3
- import { useMemo, useRef, useState } from 'react';
2
+ import { useMemo, useState } from 'react';
4
3
  import * as React from 'react';
5
- import { Text } from '..';
4
+ import { HiddenText } from '..';
6
5
  import { FlexBox } from '../Box';
7
6
  import { AnimatedFadeButton, AnimatedSlideButton } from './AnimatedPaginationButtons';
8
7
  import { EllipsisButton } from './EllipsisButton';
@@ -24,8 +23,6 @@ export const Pagination = ({
24
23
  const [currentPage, setCurrentPage] = useState(pageNumber ?? defaultPageNumber);
25
24
  const [liveText, setLiveText] = useState('');
26
25
  const [shownPageArray, setShownPageArray] = useState([0]);
27
- const rootRef = useRef(null);
28
- const isRtl = useElementDir(rootRef);
29
26
  const showSkipToButtons = !!(type === undefined && totalPages >= 10 || type === 'includeSkipToButtons');
30
27
  const changeShownPages = shouldPagesChange({
31
28
  chapterSize,
@@ -70,16 +67,14 @@ export const Pagination = ({
70
67
  chapterSize
71
68
  }) : 'initial'}`
72
69
  },
73
- ref: rootRef,
74
- children: [/*#__PURE__*/_jsx(Text, {
70
+ children: [/*#__PURE__*/_jsx(HiddenText, {
75
71
  "aria-live": "polite",
76
- screenreader: true,
77
72
  children: liveText
78
73
  }), /*#__PURE__*/_jsx(AnimatedFadeButton, {
79
74
  "aria-label": `Navigate back to page ${currentPage - 1}`,
80
75
  buttonType: variant,
81
76
  href: navigation,
82
- icon: isRtl ? MiniChevronRightIcon : MiniChevronLeftIcon,
77
+ icon: MiniChevronLeftIcon,
83
78
  showButton: currentPage === 1 ? 'hidden' : 'shown',
84
79
  onClick: () => changeHandler(currentPage - 1)
85
80
  }), showSkipToButtons && /*#__PURE__*/_jsxs(_Fragment, {
@@ -134,7 +129,7 @@ export const Pagination = ({
134
129
  "aria-label": `Navigate forward to page ${currentPage + 1}`,
135
130
  buttonType: variant,
136
131
  href: navigation,
137
- icon: isRtl ? MiniChevronLeftIcon : MiniChevronRightIcon,
132
+ icon: MiniChevronRightIcon,
138
133
  showButton: currentPage === totalPages ? 'hidden' : 'shown',
139
134
  onClick: () => changeHandler(currentPage + 1)
140
135
  })]
@@ -1,7 +1,10 @@
1
1
  import { PopoverProps } from '../types';
2
2
  export declare const beakRightCenterStylesLrg: {
3
3
  left: number;
4
- transform: string;
4
+ '&:dir(rtl)': {
5
+ transform: "rotate(135deg)" | "rotate(-45deg)";
6
+ };
7
+ transform: "rotate(45deg)" | "rotate(-135deg)" | "rotate(135deg)" | "rotate(-45deg)";
5
8
  backgroundImage: string;
6
9
  borderColor: string;
7
10
  borderWidth: string;
@@ -1,5 +1,7 @@
1
- import { beakBottomStyles, beakLeftCenterStyles, beakRightCenterStyles, beakStylesBase, beakTopStyles, getBeakBgAndRotation, tooltipBgColor } from '../../Tip/shared/styles/styles';
1
+ import { beakBottomStyles, beakLeftCenterStyles, beakRightCenterStyles, beakStylesBase, beakTopStyles, getBeakBgAndRotation, horizontalCenterBeakRtlPopover, tooltipBgColor } from '../../Tip/shared/styles/styles';
2
2
  import { popoverPrimaryBgColor } from './base';
3
+ const rtlBeakBoxRight = horizontalCenterBeakRtlPopover('right');
4
+ const rtlBeakBoxLeft = horizontalCenterBeakRtlPopover('left');
3
5
  const positionAbove = {
4
6
  top: 'calc(100% - 10px)',
5
7
  ...beakStylesBase,
@@ -52,6 +54,7 @@ const beakYCenterSml = {
52
54
  };
53
55
  const beakRightCenterStylesSml = {
54
56
  ...beakRightCenterStyles,
57
+ ...rtlBeakBoxRight,
55
58
  left: -8
56
59
  };
57
60
  export const beakRightCenterStylesLrg = {
@@ -60,10 +63,12 @@ export const beakRightCenterStylesLrg = {
60
63
  alignment: 'right',
61
64
  color: popoverPrimaryBgColor
62
65
  }),
66
+ ...rtlBeakBoxRight,
63
67
  left: -10
64
68
  };
65
69
  const beakLeftCenterStylesSml = {
66
70
  ...beakLeftCenterStyles,
71
+ ...rtlBeakBoxLeft,
67
72
  right: -8
68
73
  };
69
74
  const beakLeftCenterStylesLrg = {
@@ -72,6 +77,7 @@ const beakLeftCenterStylesLrg = {
72
77
  alignment: 'left',
73
78
  color: popoverPrimaryBgColor
74
79
  }),
80
+ ...rtlBeakBoxLeft,
75
81
  right: -10
76
82
  };
77
83
  export const beakBoxX = {
@@ -26,17 +26,35 @@ export declare const centerHorizontal: {
26
26
  readonly my: "auto";
27
27
  };
28
28
  declare const beakBackgroundRotation: {
29
- above: string;
30
- below: string;
31
- right: string;
32
- left: string;
29
+ readonly above: "rotate(45deg)";
30
+ readonly below: "rotate(-135deg)";
31
+ readonly right: "rotate(135deg)";
32
+ readonly left: "rotate(-45deg)";
33
+ };
34
+ type SideCenterBeakSide = 'left' | 'right';
35
+ /**
36
+ * Inline ToolTip / InfoTip: RTL beak rotation on the container that owns `::after`
37
+ * (avoids invalid `::after:dir(rtl)` when the same beak object is merged under `&::after`).
38
+ */
39
+ export declare const horizontalCenterBeakRtlInline: (side: SideCenterBeakSide) => {
40
+ '&:dir(rtl)': {
41
+ '&::after': {
42
+ transform: "rotate(135deg)" | "rotate(-45deg)";
43
+ };
44
+ };
45
+ };
46
+ /** Popover beak is a real node; `:dir(rtl)` applies on that element (not under `&::after`). */
47
+ export declare const horizontalCenterBeakRtlPopover: (side: SideCenterBeakSide) => {
48
+ '&:dir(rtl)': {
49
+ transform: "rotate(135deg)" | "rotate(-45deg)";
50
+ };
33
51
  };
34
52
  type GetBeakBackgroundType = {
35
53
  alignment: keyof typeof beakBackgroundRotation;
36
54
  color: typeof tooltipBgColor | typeof popoverPrimaryBgColor;
37
55
  };
38
56
  export declare const getBeakBgAndRotation: ({ alignment, color, }: GetBeakBackgroundType) => {
39
- transform: string;
57
+ transform: "rotate(45deg)" | "rotate(-135deg)" | "rotate(135deg)" | "rotate(-45deg)";
40
58
  backgroundImage: string;
41
59
  };
42
60
  export declare const beakStylesBase: {
@@ -44,25 +62,25 @@ export declare const beakStylesBase: {
44
62
  borderWidth: string;
45
63
  };
46
64
  export declare const beakTopStyles: {
47
- transform: string;
65
+ transform: "rotate(45deg)" | "rotate(-135deg)" | "rotate(135deg)" | "rotate(-45deg)";
48
66
  backgroundImage: string;
49
67
  borderColor: string;
50
68
  borderWidth: string;
51
69
  };
52
70
  export declare const beakBottomStyles: {
53
- transform: string;
71
+ transform: "rotate(45deg)" | "rotate(-135deg)" | "rotate(135deg)" | "rotate(-45deg)";
54
72
  backgroundImage: string;
55
73
  borderColor: string;
56
74
  borderWidth: string;
57
75
  };
58
76
  export declare const beakRightCenterStyles: {
59
- transform: string;
77
+ transform: "rotate(45deg)" | "rotate(-135deg)" | "rotate(135deg)" | "rotate(-45deg)";
60
78
  backgroundImage: string;
61
79
  borderColor: string;
62
80
  borderWidth: string;
63
81
  };
64
82
  export declare const beakLeftCenterStyles: {
65
- transform: string;
83
+ transform: "rotate(45deg)" | "rotate(-135deg)" | "rotate(135deg)" | "rotate(-45deg)";
66
84
  backgroundImage: string;
67
85
  borderColor: string;
68
86
  borderWidth: string;
@@ -73,7 +91,7 @@ export declare const topStyles: {
73
91
  };
74
92
  export declare const topStylesAfter: {
75
93
  readonly bottom: "0.25rem";
76
- readonly transform: string;
94
+ readonly transform: "rotate(45deg)" | "rotate(-135deg)" | "rotate(135deg)" | "rotate(-45deg)";
77
95
  readonly backgroundImage: string;
78
96
  readonly borderColor: string;
79
97
  readonly borderWidth: string;
@@ -103,14 +121,19 @@ export declare const bottomStylesBefore: {
103
121
  };
104
122
  export declare const bottomStylesAfter: {
105
123
  readonly top: "0.25rem";
106
- readonly transform: string;
124
+ readonly transform: "rotate(45deg)" | "rotate(-135deg)" | "rotate(135deg)" | "rotate(-45deg)";
107
125
  readonly backgroundImage: string;
108
126
  readonly borderColor: string;
109
127
  readonly borderWidth: string;
110
128
  };
111
129
  export declare const rightAlignStyles: {
112
- readonly pl: 12;
113
- readonly left: "100%";
130
+ '&:dir(rtl)': {
131
+ '&::after': {
132
+ transform: "rotate(135deg)" | "rotate(-45deg)";
133
+ };
134
+ };
135
+ pl: number;
136
+ left: string;
114
137
  };
115
138
  export declare const horizontalCenterStyles: {
116
139
  readonly maxWidth: number;
@@ -121,8 +144,13 @@ export declare const horizontalCenterStyles: {
121
144
  readonly minWidth: 4;
122
145
  };
123
146
  export declare const leftAlignStyles: {
124
- readonly pr: 12;
125
- readonly right: "100%";
147
+ '&:dir(rtl)': {
148
+ '&::after': {
149
+ transform: "rotate(135deg)" | "rotate(-45deg)";
150
+ };
151
+ };
152
+ pr: number;
153
+ right: string;
126
154
  };
127
155
  export declare const verticalCenterStyles: {
128
156
  readonly left: "calc(50% - 4rem)";
@@ -147,14 +175,14 @@ export declare const rightVertStylesAfter: {
147
175
  readonly left: "1.5rem";
148
176
  };
149
177
  export declare const rightAlignStylesAfter: {
150
- readonly transform: string;
178
+ readonly transform: "rotate(45deg)" | "rotate(-135deg)" | "rotate(135deg)" | "rotate(-45deg)";
151
179
  readonly backgroundImage: string;
152
180
  readonly borderColor: string;
153
181
  readonly borderWidth: string;
154
182
  readonly left: "4px";
155
183
  };
156
184
  export declare const leftAlignStylesAfter: {
157
- readonly transform: string;
185
+ readonly transform: "rotate(45deg)" | "rotate(-135deg)" | "rotate(135deg)" | "rotate(-45deg)";
158
186
  readonly backgroundImage: string;
159
187
  readonly borderColor: string;
160
188
  readonly borderWidth: string;
@@ -58,6 +58,26 @@ const beakBackgroundRotation = {
58
58
  right: 'rotate(135deg)',
59
59
  left: 'rotate(-45deg)'
60
60
  };
61
+ const sideCenterMirroredTransform = side => side === 'right' ? beakBackgroundRotation.left : beakBackgroundRotation.right;
62
+
63
+ /**
64
+ * Inline ToolTip / InfoTip: RTL beak rotation on the container that owns `::after`
65
+ * (avoids invalid `::after:dir(rtl)` when the same beak object is merged under `&::after`).
66
+ */
67
+ export const horizontalCenterBeakRtlInline = side => ({
68
+ '&:dir(rtl)': {
69
+ '&::after': {
70
+ transform: sideCenterMirroredTransform(side)
71
+ }
72
+ }
73
+ });
74
+
75
+ /** Popover beak is a real node; `:dir(rtl)` applies on that element (not under `&::after`). */
76
+ export const horizontalCenterBeakRtlPopover = side => ({
77
+ '&:dir(rtl)': {
78
+ transform: sideCenterMirroredTransform(side)
79
+ }
80
+ });
61
81
  export const getBeakBgAndRotation = ({
62
82
  alignment,
63
83
  color
@@ -137,7 +157,8 @@ export const bottomStylesAfter = {
137
157
  };
138
158
  export const rightAlignStyles = {
139
159
  pl: containerOffsetVertical,
140
- left: '100%'
160
+ left: '100%',
161
+ ...horizontalCenterBeakRtlInline('right')
141
162
  };
142
163
  export const horizontalCenterStyles = {
143
164
  ...horizontalCenterWidths,
@@ -150,7 +171,8 @@ export const horizontalCenterStyles = {
150
171
  };
151
172
  export const leftAlignStyles = {
152
173
  pr: containerOffsetVertical,
153
- right: '100%'
174
+ right: '100%',
175
+ ...horizontalCenterBeakRtlInline('left')
154
176
  };
155
177
  export const verticalCenterStyles = {
156
178
  ...verticalCenterWidths,
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@codecademy/gamut",
3
3
  "description": "Styleguide & Component library for Codecademy",
4
- "version": "68.2.3-alpha.f27e78.0",
4
+ "version": "68.2.3-alpha.f802ae.0",
5
5
  "author": "Codecademy Engineering <dev@codecademy.com>",
6
6
  "dependencies": {
7
- "@codecademy/gamut-icons": "9.57.3-alpha.f27e78.0",
8
- "@codecademy/gamut-illustrations": "0.58.10-alpha.f27e78.0",
9
- "@codecademy/gamut-patterns": "0.10.29-alpha.f27e78.0",
10
- "@codecademy/gamut-styles": "17.13.2-alpha.f27e78.0",
11
- "@codecademy/variance": "0.26.2-alpha.f27e78.0",
7
+ "@codecademy/gamut-icons": "9.57.3-alpha.f802ae.0",
8
+ "@codecademy/gamut-illustrations": "0.58.10-alpha.f802ae.0",
9
+ "@codecademy/gamut-patterns": "0.10.29-alpha.f802ae.0",
10
+ "@codecademy/gamut-styles": "17.13.2-alpha.f802ae.0",
11
+ "@codecademy/variance": "0.26.2-alpha.f802ae.0",
12
12
  "@react-aria/interactions": "3.25.0",
13
13
  "@types/marked": "^4.0.8",
14
14
  "@vidstack/react": "^1.12.12",