@khanacademy/wonder-blocks-tabs 0.1.0 → 0.1.1
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
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type NavigationTabItemLinkProps = {
|
|
4
|
+
style: StyleType;
|
|
5
|
+
"aria-current"?: "page";
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A component for a tab item in NavigationTabs. It is used with a Link
|
|
9
|
+
* component.
|
|
10
|
+
*
|
|
11
|
+
* ## Usage
|
|
12
|
+
*
|
|
13
|
+
* ```jsx
|
|
14
|
+
* import {NavigationTab, NavigationTabItem} from "@khanacademy/wonder-blocks-tabs";
|
|
15
|
+
* import Link from "@khanacademy/wonder-blocks-link";
|
|
16
|
+
*
|
|
17
|
+
* <NavigationTabs>
|
|
18
|
+
* <NavigationTabItem>
|
|
19
|
+
* <Link href="/link-1">Link 1</Link>
|
|
20
|
+
* </NavigationTabItem>
|
|
21
|
+
* <NavigationTabItem>
|
|
22
|
+
* <Link href="/link-2">Link 2</Link>
|
|
23
|
+
* </NavigationTabItem>
|
|
24
|
+
* </NavigationTabs>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const NavigationTabItem: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
|
|
28
|
+
role?: import("@khanacademy/wonder-blocks-core").AriaRole;
|
|
29
|
+
}> & {
|
|
30
|
+
/**
|
|
31
|
+
* The `Link` to render for the navigation tab item.
|
|
32
|
+
*
|
|
33
|
+
* When a `Link` component is passed in for the `children` prop,
|
|
34
|
+
* `NavigationTabItem` will inject props for the `Link`. For specific use
|
|
35
|
+
* cases where the `Link` component is wrapped by another component (like a
|
|
36
|
+
* `Tooltip` or `Popover`), a render function can be used instead. The
|
|
37
|
+
* render function provides the Link props that should be applied to the
|
|
38
|
+
* Link component. See example in the docs for more details.
|
|
39
|
+
*/
|
|
40
|
+
children: React.ReactElement | ((linkProps: NavigationTabItemLinkProps) => React.ReactElement);
|
|
41
|
+
/**
|
|
42
|
+
* An id for the root element.
|
|
43
|
+
*/
|
|
44
|
+
id?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Optional test ID for e2e testing.
|
|
47
|
+
*/
|
|
48
|
+
testId?: string;
|
|
49
|
+
/**
|
|
50
|
+
* If the `NavigationTabItem` is the current page. If `true`, current
|
|
51
|
+
* styling and aria-current=page will be applied to the Link.
|
|
52
|
+
*/
|
|
53
|
+
current?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Custom styles for overriding default styles. For custom link styling,
|
|
56
|
+
* prefer applying the styles to the `Link` component. Note: The
|
|
57
|
+
* `NavigationTabItem` will also set styles to the `Link` child component.
|
|
58
|
+
*/
|
|
59
|
+
style?: StyleType;
|
|
60
|
+
} & React.RefAttributes<HTMLLIElement>>;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* The `NavigationTabs` component is a tabbed interface for link navigation.
|
|
5
|
+
* The tabs are links and keyboard users can change tabs using tab.
|
|
6
|
+
* The `NavigationTabs` component is used with `NavigationTabItem` and `Link`
|
|
7
|
+
* components. If the tabs should not be links, see the `Tabs` component,
|
|
8
|
+
* which implements different semantics and keyboard interactions.
|
|
9
|
+
*
|
|
10
|
+
* ## Usage
|
|
11
|
+
*
|
|
12
|
+
* ```jsx
|
|
13
|
+
* import {NavigationTab, NavigationTabItem} from "@khanacademy/wonder-blocks-tabs";
|
|
14
|
+
* import Link from "@khanacademy/wonder-blocks-link";
|
|
15
|
+
*
|
|
16
|
+
* <NavigationTabs>
|
|
17
|
+
* <NavigationTabItem>
|
|
18
|
+
* <Link href="/link-1">Link 1</Link>
|
|
19
|
+
* </NavigationTabItem>
|
|
20
|
+
* <NavigationTabItem>
|
|
21
|
+
* <Link href="/link-2">Link 2</Link>
|
|
22
|
+
* </NavigationTabItem>
|
|
23
|
+
* </NavigationTabs>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const NavigationTabs: React.ForwardRefExoticComponent<Readonly<import("@khanacademy/wonder-blocks-core").AriaAttributes> & Readonly<{
|
|
27
|
+
role?: import("@khanacademy/wonder-blocks-core").AriaRole;
|
|
28
|
+
}> & {
|
|
29
|
+
/**
|
|
30
|
+
* The NavigationTabItem components to render.
|
|
31
|
+
*/
|
|
32
|
+
children: React.ReactElement | Array<React.ReactElement>;
|
|
33
|
+
/**
|
|
34
|
+
* An id for the navigation element.
|
|
35
|
+
*/
|
|
36
|
+
id?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Optional test ID for e2e testing.
|
|
39
|
+
*/
|
|
40
|
+
testId?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Accessible label for the navigation element.
|
|
43
|
+
*
|
|
44
|
+
* It is important to provide a unique aria-label if there are multiple
|
|
45
|
+
* navigation elements on the page.
|
|
46
|
+
*
|
|
47
|
+
* If there is a visual label for the navigation tabs already, use
|
|
48
|
+
* `aria-labelledby` instead.
|
|
49
|
+
*/
|
|
50
|
+
"aria-label"?: string;
|
|
51
|
+
/**
|
|
52
|
+
* If there is a visual label for the navigation tabs already, set
|
|
53
|
+
* `aria-labelledby` to the `id` of the element that labels the navigation
|
|
54
|
+
* tabs.
|
|
55
|
+
*/
|
|
56
|
+
"aria-labelledby"?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Custom styles for the elements in NavigationTabs.
|
|
59
|
+
* - `root`: Styles the root `nav` element.
|
|
60
|
+
* - `list`: Styles the underlying `ul` element that wraps the
|
|
61
|
+
* `NavigationTabItem` components
|
|
62
|
+
*/
|
|
63
|
+
styles?: {
|
|
64
|
+
root?: StyleType;
|
|
65
|
+
list?: StyleType;
|
|
66
|
+
};
|
|
67
|
+
} & React.RefAttributes<HTMLElement>>;
|
package/dist/index.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-tabs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"description": "Tabs are used to control what content is shown",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@babel/runtime": "^7.24.5",
|
|
16
|
+
"@khanacademy/wonder-blocks-core": "12.2.1",
|
|
16
17
|
"@khanacademy/wonder-blocks-tokens": "5.1.1",
|
|
17
|
-
"@khanacademy/wonder-blocks-typography": "3.1.3"
|
|
18
|
-
"@khanacademy/wonder-blocks-core": "12.2.1"
|
|
18
|
+
"@khanacademy/wonder-blocks-typography": "3.1.3"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"aphrodite": "^1.2.5",
|