@kaizen/components 1.64.13 → 1.65.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.
- package/dist/cjs/Filter/FilterSelect/FilterSelect.cjs +2 -0
- package/dist/cjs/__future__/Select/subcomponents/ListBox/ListBox.cjs +46 -2
- package/dist/cjs/__future__/Select/subcomponents/Overlay/Overlay.cjs +1 -1
- package/dist/cjs/__future__/Tabs/Tabs.cjs +23 -0
- package/dist/cjs/__future__/Tabs/subcomponents/Tab/Tab.cjs +39 -0
- package/dist/cjs/__future__/Tabs/subcomponents/Tab/Tab.module.css.cjs +7 -0
- package/dist/cjs/__future__/Tabs/subcomponents/TabList/TabList.cjs +31 -0
- package/dist/cjs/__future__/Tabs/subcomponents/TabList/TabList.module.css.cjs +7 -0
- package/dist/cjs/__future__/Tabs/subcomponents/TabPanel/TabPanel.cjs +24 -0
- package/dist/cjs/__utilities__/useIsClientReady/useIsClientReady.cjs +20 -0
- package/dist/cjs/future.cjs +8 -0
- package/dist/esm/Filter/FilterSelect/FilterSelect.mjs +2 -0
- package/dist/esm/__future__/Select/subcomponents/ListBox/ListBox.mjs +47 -3
- package/dist/esm/__future__/Select/subcomponents/Overlay/Overlay.mjs +1 -1
- package/dist/esm/__future__/Tabs/Tabs.mjs +15 -0
- package/dist/esm/__future__/Tabs/subcomponents/Tab/Tab.mjs +30 -0
- package/dist/esm/__future__/Tabs/subcomponents/Tab/Tab.module.css.mjs +5 -0
- package/dist/esm/__future__/Tabs/subcomponents/TabList/TabList.mjs +22 -0
- package/dist/esm/__future__/Tabs/subcomponents/TabList/TabList.module.css.mjs +5 -0
- package/dist/esm/__future__/Tabs/subcomponents/TabPanel/TabPanel.mjs +16 -0
- package/dist/esm/__utilities__/useIsClientReady/useIsClientReady.mjs +18 -0
- package/dist/esm/future.mjs +4 -0
- package/dist/styles.css +244 -127
- package/dist/types/Tabs/subcomponents/index.d.ts +0 -1
- package/dist/types/__future__/Select/subcomponents/ListBox/ListBox.d.ts +2 -2
- package/dist/types/__future__/Tabs/Tabs.d.ts +11 -0
- package/dist/types/__future__/Tabs/index.d.ts +2 -0
- package/dist/types/__future__/Tabs/subcomponents/Tab/Tab.d.ts +12 -0
- package/dist/types/__future__/Tabs/subcomponents/Tab/index.d.ts +1 -0
- package/dist/types/__future__/Tabs/subcomponents/TabList/TabList.d.ts +17 -0
- package/dist/types/__future__/Tabs/subcomponents/TabList/index.d.ts +1 -0
- package/dist/types/__future__/Tabs/subcomponents/TabPanel/TabPanel.d.ts +6 -0
- package/dist/types/__future__/Tabs/subcomponents/TabPanel/index.d.ts +1 -0
- package/dist/types/__future__/Tabs/subcomponents/index.d.ts +3 -0
- package/dist/types/__future__/index.d.ts +1 -0
- package/dist/types/__utilities__/useIsClientReady/index.d.ts +1 -0
- package/dist/types/__utilities__/useIsClientReady/useIsClientReady.d.ts +5 -0
- package/package.json +2 -2
- package/src/Filter/FilterSelect/FilterSelect.spec.tsx +97 -2
- package/src/Filter/FilterSelect/FilterSelect.tsx +3 -0
- package/src/Tabs/subcomponents/index.ts +0 -1
- package/src/__future__/Select/Select.spec.tsx +5 -3
- package/src/__future__/Select/_docs/Select.mdx +1 -3
- package/src/__future__/Select/_docs/Select.stories.tsx +33 -17
- package/src/__future__/Select/subcomponents/ListBox/ListBox.tsx +56 -4
- package/src/__future__/Select/subcomponents/Overlay/Overlay.tsx +1 -1
- package/src/__future__/Tabs/Tabs.tsx +18 -0
- package/src/__future__/Tabs/_docs/Tabs--api-specification.mdx +43 -0
- package/src/__future__/Tabs/_docs/Tabs--migration-guide.mdx +93 -0
- package/src/__future__/Tabs/_docs/Tabs.stories.tsx +74 -0
- package/src/__future__/Tabs/index.ts +2 -0
- package/src/__future__/Tabs/subcomponents/Tab/Tab.module.css +94 -0
- package/src/__future__/Tabs/subcomponents/Tab/Tab.tsx +58 -0
- package/src/__future__/Tabs/subcomponents/Tab/index.ts +1 -0
- package/src/__future__/Tabs/subcomponents/TabList/TabList.module.css +8 -0
- package/src/__future__/Tabs/subcomponents/TabList/TabList.tsx +45 -0
- package/src/__future__/Tabs/subcomponents/TabList/index.ts +1 -0
- package/src/__future__/Tabs/subcomponents/TabPanel/TabPanel.module.css +12 -0
- package/src/__future__/Tabs/subcomponents/TabPanel/TabPanel.tsx +20 -0
- package/src/__future__/Tabs/subcomponents/TabPanel/index.ts +1 -0
- package/src/__future__/Tabs/subcomponents/index.ts +3 -0
- package/src/__future__/index.ts +1 -0
- package/src/__utilities__/useIsClientReady/index.ts +1 -0
- package/src/__utilities__/useIsClientReady/useIsClientReady.tsx +17 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import classnames from "classnames"
|
|
3
|
+
import { Tab as RACTab, TabProps as RACTabProps } from "react-aria-components"
|
|
4
|
+
import { Badge } from "~components/Badge"
|
|
5
|
+
import styles from "./Tab.module.css"
|
|
6
|
+
|
|
7
|
+
export type TabProps = {
|
|
8
|
+
/**
|
|
9
|
+
* Adds a Kaizen Badge component to the tab.
|
|
10
|
+
* Comes with some logic baked in - changes variant based on active/focus/hover state.
|
|
11
|
+
*/
|
|
12
|
+
badge?: string
|
|
13
|
+
} & Omit<
|
|
14
|
+
RACTabProps,
|
|
15
|
+
// omitting link functionality because it goes against WAI ARIA standards https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
|
|
16
|
+
| "href"
|
|
17
|
+
| "hrefLang"
|
|
18
|
+
| "target"
|
|
19
|
+
| "rel"
|
|
20
|
+
| "download"
|
|
21
|
+
| "ping"
|
|
22
|
+
| "referrerPolicy"
|
|
23
|
+
>
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A tab button
|
|
27
|
+
*/
|
|
28
|
+
export const Tab = (props: TabProps): JSX.Element => {
|
|
29
|
+
const { badge, children, className, ...restProps } = props
|
|
30
|
+
|
|
31
|
+
const tabProps = {
|
|
32
|
+
className: classnames(styles.tab, className),
|
|
33
|
+
...restProps,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<RACTab {...tabProps}>
|
|
38
|
+
{({ isSelected, isFocusVisible, isHovered }) => (
|
|
39
|
+
<>
|
|
40
|
+
{children}
|
|
41
|
+
{badge && (
|
|
42
|
+
<span className={styles.badge}>
|
|
43
|
+
<Badge
|
|
44
|
+
variant={
|
|
45
|
+
isSelected || isFocusVisible || isHovered
|
|
46
|
+
? "active"
|
|
47
|
+
: "default"
|
|
48
|
+
}
|
|
49
|
+
>
|
|
50
|
+
{badge}
|
|
51
|
+
</Badge>
|
|
52
|
+
</span>
|
|
53
|
+
)}
|
|
54
|
+
</>
|
|
55
|
+
)}
|
|
56
|
+
</RACTab>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Tab"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { ReactNode } from "react"
|
|
2
|
+
import classnames from "classnames"
|
|
3
|
+
import {
|
|
4
|
+
TabList as RACTabList,
|
|
5
|
+
TabListProps as RACTabListProps,
|
|
6
|
+
} from "react-aria-components"
|
|
7
|
+
import styles from "./TabList.module.css"
|
|
8
|
+
|
|
9
|
+
export type TabListProps = {
|
|
10
|
+
/**
|
|
11
|
+
* Accessible name for the set of tabs
|
|
12
|
+
*/
|
|
13
|
+
"aria-label": string
|
|
14
|
+
/**
|
|
15
|
+
* Removes the built in padding
|
|
16
|
+
*/
|
|
17
|
+
noPadding?: boolean
|
|
18
|
+
children: ReactNode
|
|
19
|
+
} & RACTabListProps<HTMLElement>
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Wrapper for the tabs themselves
|
|
23
|
+
*/
|
|
24
|
+
export const TabList = (props: TabListProps): JSX.Element => {
|
|
25
|
+
const {
|
|
26
|
+
"aria-label": ariaLabel,
|
|
27
|
+
noPadding = false,
|
|
28
|
+
children,
|
|
29
|
+
className,
|
|
30
|
+
...restProps
|
|
31
|
+
} = props
|
|
32
|
+
return (
|
|
33
|
+
<RACTabList
|
|
34
|
+
aria-label={ariaLabel}
|
|
35
|
+
className={classnames(
|
|
36
|
+
styles.tabList,
|
|
37
|
+
className,
|
|
38
|
+
noPadding && styles.noPadding
|
|
39
|
+
)}
|
|
40
|
+
{...restProps}
|
|
41
|
+
>
|
|
42
|
+
{children}
|
|
43
|
+
</RACTabList>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TabList"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import {
|
|
3
|
+
TabPanel as RACTabPanel,
|
|
4
|
+
TabPanelProps as RACTabPanelProps,
|
|
5
|
+
} from "react-aria-components"
|
|
6
|
+
import styles from "./TabPanel.module.css"
|
|
7
|
+
|
|
8
|
+
export type TabPanelProps = RACTabPanelProps
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wrapper for the content that shows when tab is active
|
|
12
|
+
*/
|
|
13
|
+
export const TabPanel = (props: TabPanelProps): JSX.Element => {
|
|
14
|
+
const { className, children, ...restProps } = props
|
|
15
|
+
return (
|
|
16
|
+
<RACTabPanel className={(styles.tabPanel, className)} {...restProps}>
|
|
17
|
+
{children}
|
|
18
|
+
</RACTabPanel>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TabPanel"
|
package/src/__future__/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useIsClientReady"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useState, useEffect } from "react"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A hook that returns a truthy value indicating if the code can be run on client side.
|
|
5
|
+
* This is a useful hook for determining if the `document` or `window` objects are available.
|
|
6
|
+
*/
|
|
7
|
+
export const useIsClientReady = (): boolean => {
|
|
8
|
+
const [isClientReady, setIsClientReady] = useState(false)
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
12
|
+
setIsClientReady(true)
|
|
13
|
+
}
|
|
14
|
+
}, [])
|
|
15
|
+
|
|
16
|
+
return isClientReady
|
|
17
|
+
}
|