@khanacademy/wonder-blocks-tabs 0.0.0-PR2910-20251216214914 → 0.0.0-PR2910-20251217181751

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/CHANGELOG.md CHANGED
@@ -1,11 +1,15 @@
1
1
  # @khanacademy/wonder-blocks-tabs
2
2
 
3
- ## 0.0.0-PR2910-20251216214914
3
+ ## 0.0.0-PR2910-20251217181751
4
4
 
5
5
  ### Minor Changes
6
6
 
7
7
  - 27a30ad: Adds TabsDropdown component
8
8
 
9
+ ### Patch Changes
10
+
11
+ - 75b5418: TabsDropdown: Improve a11y
12
+
9
13
  ## 0.4.1
10
14
 
11
15
  ### Patch Changes
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { StyleType } from "@khanacademy/wonder-blocks-core";
3
+ import { AriaLabelOrAriaLabelledby } from "./types";
3
4
  type TabDropdownItem = {
4
5
  /**
5
6
  * The label of the tab
@@ -13,14 +14,29 @@ type TabDropdownItem = {
13
14
  * The contents for the tab
14
15
  */
15
16
  panel: React.ReactNode;
17
+ /**
18
+ * Optional test ID for e2e testing of the menu item.
19
+ */
20
+ testId?: string;
16
21
  };
17
- type Props = {
22
+ type Props = AriaLabelOrAriaLabelledby & {
18
23
  /**
19
- * A unique id for the component.
24
+ * A unique id for the component. If not provided, a unique base id will be
25
+ * generated automatically.
26
+ *
27
+ * Here is how the id is used for the different elements in the component:
28
+ * - The root will have an id of `${id}`
29
+ * - The opener will have an id of `${id}-opener`
30
+ * - The panel will have an id of `${id}-panel`
20
31
  */
21
32
  id?: string;
22
33
  /**
23
34
  * Optional test ID for e2e testing.
35
+ *
36
+ * Here is how the testId is used for the different elements in the component:
37
+ * - The root will have a testId of `${testId}`
38
+ * - The opener will have a testId of `${testId}-opener`
39
+ * - The panel will have a testId of `${testId}-panel`
24
40
  */
25
41
  testId?: string;
26
42
  /**
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { AriaProps, PropsFor, StyleType } from "@khanacademy/wonder-blocks-core";
3
3
  import { Tab } from "./tab";
4
+ import { AriaLabelOrAriaLabelledby } from "./types";
4
5
  export type TabRenderProps = Omit<PropsFor<typeof Tab>, "children">;
5
6
  export type TabItem = AriaProps & {
6
7
  /**
@@ -36,24 +37,6 @@ export type TabItem = AriaProps & {
36
37
  */
37
38
  testId?: string;
38
39
  };
39
- /**
40
- * Type to help ensure aria-label or aria-labelledby is set.
41
- */
42
- type AriaLabelOrAriaLabelledby = {
43
- /**
44
- * If there is no visible label for the tabs, set aria-label to a
45
- * label describing the tabs.
46
- */
47
- "aria-label": string;
48
- "aria-labelledby"?: never;
49
- } | {
50
- /**
51
- * If the tabs have a visible label, set aria-labelledby to a value
52
- * that refers to the labelling element.
53
- */
54
- "aria-labelledby": string;
55
- "aria-label"?: never;
56
- };
57
40
  type Props = {
58
41
  /**
59
42
  * A unique id to use as the base of the ids for the elements within the
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Type to help ensure aria-label or aria-labelledby is set.
3
+ */
4
+ export type AriaLabelOrAriaLabelledby = {
5
+ /**
6
+ * If there is no visible label for the tabs, set aria-label to a
7
+ * label describing the tabs.
8
+ */
9
+ "aria-label": string;
10
+ "aria-labelledby"?: never;
11
+ } | {
12
+ /**
13
+ * If the tabs have a visible label, set aria-labelledby to a value
14
+ * that refers to the labelling element.
15
+ */
16
+ "aria-labelledby": string;
17
+ "aria-label"?: never;
18
+ };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Tabs are used to control what content is shown",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "0.0.0-PR2910-20251216214914",
6
+ "version": "0.0.0-PR2910-20251217181751",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -21,11 +21,11 @@
21
21
  "types": "dist/index.d.ts",
22
22
  "dependencies": {
23
23
  "@phosphor-icons/core": "^2.0.2",
24
- "@khanacademy/wonder-blocks-core": "12.4.2",
25
24
  "@khanacademy/wonder-blocks-button": "11.2.10",
26
- "@khanacademy/wonder-blocks-icon": "5.3.5",
27
- "@khanacademy/wonder-blocks-tokens": "14.1.3",
25
+ "@khanacademy/wonder-blocks-core": "12.4.2",
28
26
  "@khanacademy/wonder-blocks-dropdown": "10.6.1",
27
+ "@khanacademy/wonder-blocks-tokens": "14.1.3",
28
+ "@khanacademy/wonder-blocks-icon": "5.3.5",
29
29
  "@khanacademy/wonder-blocks-typography": "4.2.27"
30
30
  },
31
31
  "peerDependencies": {