@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.
Files changed (64) hide show
  1. package/dist/cjs/Filter/FilterSelect/FilterSelect.cjs +2 -0
  2. package/dist/cjs/__future__/Select/subcomponents/ListBox/ListBox.cjs +46 -2
  3. package/dist/cjs/__future__/Select/subcomponents/Overlay/Overlay.cjs +1 -1
  4. package/dist/cjs/__future__/Tabs/Tabs.cjs +23 -0
  5. package/dist/cjs/__future__/Tabs/subcomponents/Tab/Tab.cjs +39 -0
  6. package/dist/cjs/__future__/Tabs/subcomponents/Tab/Tab.module.css.cjs +7 -0
  7. package/dist/cjs/__future__/Tabs/subcomponents/TabList/TabList.cjs +31 -0
  8. package/dist/cjs/__future__/Tabs/subcomponents/TabList/TabList.module.css.cjs +7 -0
  9. package/dist/cjs/__future__/Tabs/subcomponents/TabPanel/TabPanel.cjs +24 -0
  10. package/dist/cjs/__utilities__/useIsClientReady/useIsClientReady.cjs +20 -0
  11. package/dist/cjs/future.cjs +8 -0
  12. package/dist/esm/Filter/FilterSelect/FilterSelect.mjs +2 -0
  13. package/dist/esm/__future__/Select/subcomponents/ListBox/ListBox.mjs +47 -3
  14. package/dist/esm/__future__/Select/subcomponents/Overlay/Overlay.mjs +1 -1
  15. package/dist/esm/__future__/Tabs/Tabs.mjs +15 -0
  16. package/dist/esm/__future__/Tabs/subcomponents/Tab/Tab.mjs +30 -0
  17. package/dist/esm/__future__/Tabs/subcomponents/Tab/Tab.module.css.mjs +5 -0
  18. package/dist/esm/__future__/Tabs/subcomponents/TabList/TabList.mjs +22 -0
  19. package/dist/esm/__future__/Tabs/subcomponents/TabList/TabList.module.css.mjs +5 -0
  20. package/dist/esm/__future__/Tabs/subcomponents/TabPanel/TabPanel.mjs +16 -0
  21. package/dist/esm/__utilities__/useIsClientReady/useIsClientReady.mjs +18 -0
  22. package/dist/esm/future.mjs +4 -0
  23. package/dist/styles.css +244 -127
  24. package/dist/types/Tabs/subcomponents/index.d.ts +0 -1
  25. package/dist/types/__future__/Select/subcomponents/ListBox/ListBox.d.ts +2 -2
  26. package/dist/types/__future__/Tabs/Tabs.d.ts +11 -0
  27. package/dist/types/__future__/Tabs/index.d.ts +2 -0
  28. package/dist/types/__future__/Tabs/subcomponents/Tab/Tab.d.ts +12 -0
  29. package/dist/types/__future__/Tabs/subcomponents/Tab/index.d.ts +1 -0
  30. package/dist/types/__future__/Tabs/subcomponents/TabList/TabList.d.ts +17 -0
  31. package/dist/types/__future__/Tabs/subcomponents/TabList/index.d.ts +1 -0
  32. package/dist/types/__future__/Tabs/subcomponents/TabPanel/TabPanel.d.ts +6 -0
  33. package/dist/types/__future__/Tabs/subcomponents/TabPanel/index.d.ts +1 -0
  34. package/dist/types/__future__/Tabs/subcomponents/index.d.ts +3 -0
  35. package/dist/types/__future__/index.d.ts +1 -0
  36. package/dist/types/__utilities__/useIsClientReady/index.d.ts +1 -0
  37. package/dist/types/__utilities__/useIsClientReady/useIsClientReady.d.ts +5 -0
  38. package/package.json +2 -2
  39. package/src/Filter/FilterSelect/FilterSelect.spec.tsx +97 -2
  40. package/src/Filter/FilterSelect/FilterSelect.tsx +3 -0
  41. package/src/Tabs/subcomponents/index.ts +0 -1
  42. package/src/__future__/Select/Select.spec.tsx +5 -3
  43. package/src/__future__/Select/_docs/Select.mdx +1 -3
  44. package/src/__future__/Select/_docs/Select.stories.tsx +33 -17
  45. package/src/__future__/Select/subcomponents/ListBox/ListBox.tsx +56 -4
  46. package/src/__future__/Select/subcomponents/Overlay/Overlay.tsx +1 -1
  47. package/src/__future__/Tabs/Tabs.tsx +18 -0
  48. package/src/__future__/Tabs/_docs/Tabs--api-specification.mdx +43 -0
  49. package/src/__future__/Tabs/_docs/Tabs--migration-guide.mdx +93 -0
  50. package/src/__future__/Tabs/_docs/Tabs.stories.tsx +74 -0
  51. package/src/__future__/Tabs/index.ts +2 -0
  52. package/src/__future__/Tabs/subcomponents/Tab/Tab.module.css +94 -0
  53. package/src/__future__/Tabs/subcomponents/Tab/Tab.tsx +58 -0
  54. package/src/__future__/Tabs/subcomponents/Tab/index.ts +1 -0
  55. package/src/__future__/Tabs/subcomponents/TabList/TabList.module.css +8 -0
  56. package/src/__future__/Tabs/subcomponents/TabList/TabList.tsx +45 -0
  57. package/src/__future__/Tabs/subcomponents/TabList/index.ts +1 -0
  58. package/src/__future__/Tabs/subcomponents/TabPanel/TabPanel.module.css +12 -0
  59. package/src/__future__/Tabs/subcomponents/TabPanel/TabPanel.tsx +20 -0
  60. package/src/__future__/Tabs/subcomponents/TabPanel/index.ts +1 -0
  61. package/src/__future__/Tabs/subcomponents/index.ts +3 -0
  62. package/src/__future__/index.ts +1 -0
  63. package/src/__utilities__/useIsClientReady/index.ts +1 -0
  64. 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,8 @@
1
+ .tabList {
2
+ border-bottom: 1px solid rgba(var(--color-gray-600-rgb), 0.1);
3
+ padding: var(--spacing-xs) var(--spacing-md) 0;
4
+ }
5
+
6
+ .noPadding {
7
+ padding: 0;
8
+ }
@@ -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,12 @@
1
+ .tabPanel {
2
+ border: 2px solid transparent;
3
+
4
+ &:focus {
5
+ outline: none;
6
+ }
7
+
8
+ &:focus-visible {
9
+ border-color: var(--color-blue-500);
10
+ border-radius: var(--border-focus-ring-border-radius);
11
+ }
12
+ }
@@ -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"
@@ -0,0 +1,3 @@
1
+ export * from "./Tab/"
2
+ export * from "./TabList/"
3
+ export * from "./TabPanel/"
@@ -1,2 +1,3 @@
1
1
  export * from "./Select"
2
2
  export * from "./Tag"
3
+ export * from "./Tabs"
@@ -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
+ }