@kaizen/components 3.0.5 → 3.0.7

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 (35) hide show
  1. package/dist/cjs/src/Avatar/Avatar.module.css.cjs +15 -15
  2. package/dist/cjs/src/Link/Link.module.css.cjs +15 -15
  3. package/dist/cjs/src/Notification/subcomponents/NotificationIcon/NotificationIcon.module.css.cjs +1 -1
  4. package/dist/cjs/src/TimeField/TimeField.module.css.cjs +6 -6
  5. package/dist/cjs/src/__alpha__/SingleSelect/subcomponents/SelectTrigger/SelectTrigger.module.css.cjs +8 -8
  6. package/dist/esm/src/Avatar/Avatar.module.css.mjs +15 -15
  7. package/dist/esm/src/Link/Link.module.css.mjs +15 -15
  8. package/dist/esm/src/Notification/subcomponents/NotificationIcon/NotificationIcon.module.css.mjs +1 -1
  9. package/dist/esm/src/TimeField/TimeField.module.css.mjs +6 -6
  10. package/dist/esm/src/__alpha__/SingleSelect/subcomponents/SelectTrigger/SelectTrigger.module.css.mjs +8 -8
  11. package/dist/styles.css +101 -101
  12. package/package.json +2 -2
  13. package/src/Avatar/Avatar.module.css +1 -1
  14. package/src/Link/Link.module.css +1 -1
  15. package/src/Notification/subcomponents/NotificationIcon/NotificationIcon.module.css +2 -1
  16. package/src/TimeField/TimeField.module.css +2 -1
  17. package/src/__alpha__/SingleSelect/subcomponents/SelectTrigger/SelectTrigger.module.css +1 -1
  18. package/dist/types/TabsV1/Tabs.d.ts +0 -29
  19. package/dist/types/TabsV1/index.d.ts +0 -2
  20. package/dist/types/TabsV1/subcomponents/Tab.d.ts +0 -21
  21. package/dist/types/TabsV1/subcomponents/TabList.d.ts +0 -17
  22. package/dist/types/TabsV1/subcomponents/TabPanel.d.ts +0 -9
  23. package/dist/types/TabsV1/subcomponents/TabPanels.d.ts +0 -9
  24. package/dist/types/TabsV1/subcomponents/index.d.ts +0 -4
  25. package/src/TabsV1/Tabs.tsx +0 -38
  26. package/src/TabsV1/_docs/Tabs.stories.tsx +0 -78
  27. package/src/TabsV1/index.ts +0 -2
  28. package/src/TabsV1/subcomponents/Tab.module.scss +0 -105
  29. package/src/TabsV1/subcomponents/Tab.tsx +0 -78
  30. package/src/TabsV1/subcomponents/TabList.module.scss +0 -13
  31. package/src/TabsV1/subcomponents/TabList.tsx +0 -39
  32. package/src/TabsV1/subcomponents/TabPanel.module.scss +0 -17
  33. package/src/TabsV1/subcomponents/TabPanel.tsx +0 -20
  34. package/src/TabsV1/subcomponents/TabPanels.tsx +0 -15
  35. package/src/TabsV1/subcomponents/index.ts +0 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaizen/components",
3
- "version": "3.0.5",
3
+ "version": "3.0.7",
4
4
  "description": "Kaizen component library",
5
5
  "author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
6
6
  "homepage": "https://cultureamp.design",
@@ -132,6 +132,7 @@
132
132
  "@cultureamp/frontend-apis": "13.3.0",
133
133
  "@cultureamp/i18n-react-intl": "^4.1.0",
134
134
  "@cultureamp/package-bundler": "^4.0.1",
135
+ "cssnano": "^7.1.3",
135
136
  "@testing-library/dom": "^10.4.1",
136
137
  "@types/jest-axe": "^3.5.9",
137
138
  "@types/lodash.debounce": "^4.0.9",
@@ -140,7 +141,6 @@
140
141
  "@types/uuid": "^11.0.0",
141
142
  "autoprefixer": "^10.4.27",
142
143
  "concat-cli": "^4.0.0",
143
- "cssnano": "^7.1.3",
144
144
  "identity-obj-proxy": "^3.0.0",
145
145
  "jest-axe": "^10.0.0",
146
146
  "lodash.isempty": "^4.4.0",
@@ -74,7 +74,7 @@
74
74
  border-radius: var(--spacing-4);
75
75
  }
76
76
 
77
- .fallbackIcon {
77
+ .wrapper .fallbackIcon {
78
78
  color: rgb(var(--color-purple-800-rgb), 0.7);
79
79
  font-size: calc(var(--avatar-x-y) * 0.7);
80
80
  }
@@ -21,7 +21,7 @@
21
21
  border-bottom: var(--spacing-1) solid var(--link-text-color, var(--color-blue-500));
22
22
  }
23
23
 
24
- .icon > * {
24
+ .link .icon > * {
25
25
  vertical-align: text-bottom;
26
26
  font-size: var(--icon-font-size, 1em);
27
27
  }
@@ -1,5 +1,6 @@
1
1
  @layer kz-components {
2
- .notificationIcon {
2
+ /* Doubled class raises specificity to (0,2,0) to override Icon's own font-size rule */
3
+ .notificationIcon.notificationIcon {
3
4
  font-size: inherit;
4
5
  }
5
6
  }
@@ -16,7 +16,8 @@
16
16
  color: var(--color-purple-800);
17
17
  }
18
18
 
19
- .label {
19
+ /* Doubled class raises specificity to (0,2,0) to override Label's own display rule */
20
+ .label.label {
20
21
  display: block;
21
22
  margin-bottom: var(--spacing-6);
22
23
  }
@@ -51,7 +51,7 @@
51
51
  background-color: var(--color-gray-100);
52
52
  }
53
53
 
54
- .disabledText {
54
+ .trigger .disabledText {
55
55
  color: var(--color-gray-500);
56
56
  }
57
57
 
@@ -1,29 +0,0 @@
1
- import { type HTMLAttributes, type ReactNode } from 'react';
2
- export type TabsProps = {
3
- /**
4
- * Index of tab to show by default
5
- * Only works in uncontrolled mode (when no selectedIndex is provided)
6
- */
7
- defaultIndex?: number;
8
- /**
9
- * Set the selected tab explictly.
10
- * Enabled controlled mode, meaning you're also responsible for updating this using the onChange callback
11
- */
12
- selectedIndex?: number;
13
- /**
14
- * Callback on tab change
15
- */
16
- onChange?: (index: number) => void;
17
- children: ReactNode;
18
- } & Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>;
19
- /**
20
- * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081929117/Tabs Guidance} |
21
- * {@link https://cultureamp.design/?path=/docs/components-tabs--controlled Storybook}
22
- *
23
- * Wrapper around all of the tab subcomponents
24
- * Holds a TabList and TabPanels
25
- */
26
- export declare const Tabs: {
27
- (props: TabsProps): JSX.Element;
28
- displayName: string;
29
- };
@@ -1,2 +0,0 @@
1
- export * from './Tabs';
2
- export * from './subcomponents';
@@ -1,21 +0,0 @@
1
- import { type HTMLAttributes, type ReactNode, type SyntheticEvent } from 'react';
2
- import { type OverrideClassName } from "../../types/OverrideClassName";
3
- export type TabProps = {
4
- /**
5
- * Gets injected by TabList, no need to specify yourself
6
- */
7
- isSelected?: boolean;
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
- disabled?: boolean;
14
- children: ReactNode;
15
- onBlur?: (e: SyntheticEvent) => void;
16
- onFocus?: (e: SyntheticEvent) => void;
17
- } & OverrideClassName<Omit<HTMLAttributes<HTMLButtonElement>, 'onFocus' | 'onBlur' | 'onMouseEnter' | 'onMouseLeave'>>;
18
- /**
19
- * A tab button
20
- */
21
- export declare const Tab: (props: TabProps) => JSX.Element;
@@ -1,17 +0,0 @@
1
- import { type HTMLAttributes, type ReactNode } from 'react';
2
- import { type OverrideClassName } from "../../types/OverrideClassName";
3
- export type TabListProps = {
4
- /**
5
- * Accessible name for the set of tabs
6
- */
7
- 'aria-label': string;
8
- /**
9
- * Removes the built in padding
10
- */
11
- 'noPadding'?: boolean;
12
- 'children': ReactNode;
13
- } & OverrideClassName<HTMLAttributes<HTMLDivElement>>;
14
- /**
15
- * Wrapper for the tabs themselves
16
- */
17
- export declare const TabList: (props: TabListProps) => JSX.Element;
@@ -1,9 +0,0 @@
1
- import { type HTMLAttributes, type ReactNode } from 'react';
2
- import { type OverrideClassName } from "../../types/OverrideClassName";
3
- export type TabPanelProps = {
4
- children: ReactNode;
5
- } & OverrideClassName<HTMLAttributes<HTMLDivElement>>;
6
- /**
7
- * Wrapper for the content that shows when tab is active
8
- */
9
- export declare const TabPanel: (props: TabPanelProps) => JSX.Element;
@@ -1,9 +0,0 @@
1
- import { type HTMLAttributes, type ReactNode } from 'react';
2
- import { type OverrideClassName } from "../../types/OverrideClassName";
3
- export type TabPanelsProps = {
4
- children: ReactNode;
5
- } & OverrideClassName<HTMLAttributes<HTMLDivElement>>;
6
- /**
7
- * Wrapper for the content panels
8
- */
9
- export declare const TabPanels: (props: TabPanelsProps) => JSX.Element;
@@ -1,4 +0,0 @@
1
- export * from './Tab';
2
- export * from './TabList';
3
- export * from './TabPanel';
4
- export * from './TabPanels';
@@ -1,38 +0,0 @@
1
- import React, { type HTMLAttributes, type ReactNode } from 'react'
2
- import { Tabs as ReachTabs } from '@reach/tabs'
3
-
4
- export type TabsProps = {
5
- /**
6
- * Index of tab to show by default
7
- * Only works in uncontrolled mode (when no selectedIndex is provided)
8
- */
9
- defaultIndex?: number
10
- /**
11
- * Set the selected tab explictly.
12
- * Enabled controlled mode, meaning you're also responsible for updating this using the onChange callback
13
- */
14
- selectedIndex?: number
15
- /**
16
- * Callback on tab change
17
- */
18
- onChange?: (index: number) => void
19
- children: ReactNode
20
- } & Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>
21
-
22
- /**
23
- * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081929117/Tabs Guidance} |
24
- * {@link https://cultureamp.design/?path=/docs/components-tabs--controlled Storybook}
25
- *
26
- * Wrapper around all of the tab subcomponents
27
- * Holds a TabList and TabPanels
28
- */
29
- export const Tabs = (props: TabsProps): JSX.Element => {
30
- const { defaultIndex, selectedIndex, onChange, children, ...restProps } = props
31
- return (
32
- <ReachTabs defaultIndex={defaultIndex} index={selectedIndex} onChange={onChange} {...restProps}>
33
- {children}
34
- </ReachTabs>
35
- )
36
- }
37
-
38
- Tabs.displayName = 'Tabs'
@@ -1,78 +0,0 @@
1
- import React, { useState } from 'react'
2
- import { type Meta, type StoryObj } from '@storybook/react'
3
- import { Button } from '~components/ButtonV1'
4
- import { Card } from '~components/Card'
5
- import { Text } from '~components/Text'
6
- import { Tab, TabList, TabPanel, TabPanels, Tabs } from '../index'
7
-
8
- const meta = {
9
- title: 'Components/Tabs/Tabs (deprecated)',
10
- component: Tabs,
11
- args: {
12
- children: (
13
- <>
14
- <TabList aria-label="Tabs">
15
- <Tab>Tab 1</Tab>
16
- <Tab>Tab 2</Tab>
17
- <Tab badge="3">Tab 3</Tab>
18
- <Tab disabled>Disabled Tab</Tab>
19
- </TabList>
20
- <TabPanels>
21
- <TabPanel classNameOverride="p-24">
22
- <Text variant="body">Content 1</Text>
23
- </TabPanel>
24
- <TabPanel classNameOverride="p-24">
25
- <Text variant="body">Content 2</Text>
26
- </TabPanel>
27
- <TabPanel classNameOverride="p-24">
28
- <Text variant="body">Content 3</Text>
29
- </TabPanel>
30
- </TabPanels>
31
- </>
32
- ),
33
- },
34
- tags: ['!dev'],
35
- } satisfies Meta<typeof Tabs>
36
-
37
- export default meta
38
-
39
- type Story = StoryObj<typeof meta>
40
-
41
- export const Playground: Story = {
42
- parameters: {
43
- chromatic: { disable: false },
44
- docs: {
45
- canvas: {
46
- sourceState: 'shown',
47
- },
48
- },
49
- },
50
- args: {
51
- defaultIndex: 1,
52
-
53
- onChange: (index): void => console.log('Tab changed to ', index),
54
- },
55
- }
56
-
57
- export const Controlled: Story = {
58
- render: (args) => {
59
- const [selectedIndex, setSelectedIndex] = useState<number>(0)
60
- return (
61
- <>
62
- <Tabs {...args} selectedIndex={selectedIndex} onChange={setSelectedIndex} />
63
- <Button label="Switch to tab 2" onClick={(): void => setSelectedIndex(1)} />
64
- </>
65
- )
66
- },
67
- }
68
-
69
- export const UsageInCard: Story = {
70
- parameters: {
71
- backgrounds: { default: 'Gray 100' },
72
- },
73
- render: (args) => (
74
- <Card>
75
- <Tabs {...args} />
76
- </Card>
77
- ),
78
- }
@@ -1,2 +0,0 @@
1
- export * from './Tabs'
2
- export * from './subcomponents'
@@ -1,105 +0,0 @@
1
- @import '~@kaizen/design-tokens/sass/border';
2
- @import '~@kaizen/design-tokens/sass/spacing';
3
- @import '~@kaizen/design-tokens/sass/color';
4
- @import '~@kaizen/design-tokens/sass/typography';
5
-
6
- @layer kz-components {
7
- .tab {
8
- display: inline-flex;
9
- align-items: center;
10
- border: 0;
11
- border-top: 2px solid transparent;
12
- border-left: 2px solid transparent;
13
- border-right: 2px solid transparent;
14
- border-top-left-radius: $border-borderless-border-radius;
15
- border-top-right-radius: $border-borderless-border-radius;
16
- background: $color-white;
17
- white-space: nowrap;
18
- text-decoration: none;
19
- padding: $spacing-md $spacing-md;
20
- margin: 0;
21
- font-family: $typography-heading-4-font-family;
22
- font-size: $typography-heading-4-font-size;
23
- font-weight: $typography-heading-4-font-weight;
24
- line-height: $typography-heading-4-line-height;
25
- letter-spacing: $typography-heading-4-letter-spacing;
26
- color: $color-purple-800;
27
-
28
- &:focus {
29
- outline: none;
30
- }
31
-
32
- &:focus-visible {
33
- background: $color-blue-100;
34
- color: $color-blue-500;
35
- border-color: $color-blue-500;
36
- }
37
-
38
- &:disabled {
39
- opacity: 30%;
40
- }
41
-
42
- &:not(:first-child) {
43
- margin-inline-start: $spacing-xs;
44
- }
45
-
46
- &:not(:disabled):hover {
47
- background: $color-blue-100;
48
- color: $color-blue-500;
49
- }
50
- }
51
-
52
- .tab[data-selected] {
53
- position: relative;
54
- color: $color-blue-500;
55
-
56
- &::before {
57
- content: '';
58
- display: block;
59
- border-top-left-radius: 5px;
60
- border-top-right-radius: 5px;
61
- background-color: currentcolor;
62
- height: 5px;
63
- width: 100%;
64
- position: absolute;
65
- left: 0;
66
- right: 0;
67
- bottom: 0;
68
- }
69
- }
70
-
71
- .badge {
72
- margin-inline-start: $spacing-sm;
73
- display: inline-flex;
74
- align-items: center;
75
- }
76
-
77
- @media (forced-colors: active) {
78
- .tab {
79
- border: 2px solid transparent;
80
-
81
- &:focus-visible::after {
82
- $focus-ring-offset: calc((#{$border-focus-ring-border-width} * 2) + 1px);
83
-
84
- content: '';
85
- position: absolute;
86
- background: transparent;
87
- border-radius: $border-focus-ring-border-radius;
88
- border-width: $border-focus-ring-border-width;
89
- border-style: $border-focus-ring-border-style;
90
- border-color: transparent;
91
- inset: calc(-1 * #{$focus-ring-offset});
92
- }
93
- }
94
-
95
- .tab.selected::before {
96
- // High contrast also doesn't see the pseudo element created to show the active tab.
97
- content: '';
98
- position: absolute;
99
- left: 0;
100
- right: 0;
101
- bottom: 0;
102
- border-bottom: 2px solid transparent;
103
- }
104
- }
105
- }
@@ -1,78 +0,0 @@
1
- import React, {
2
- useRef,
3
- useState,
4
- type HTMLAttributes,
5
- type ReactNode,
6
- type SyntheticEvent,
7
- } from 'react'
8
- import { Tab as ReachTab } from '@reach/tabs'
9
- import classnames from 'classnames'
10
- import { useFocusable } from 'react-aria'
11
- import { Badge } from '~components/Badge'
12
- import { type OverrideClassName } from '~components/types/OverrideClassName'
13
- import styles from './Tab.module.scss'
14
-
15
- export type TabProps = {
16
- /**
17
- * Gets injected by TabList, no need to specify yourself
18
- */
19
- isSelected?: boolean
20
- /**
21
- * Adds a Kaizen Badge component to the tab.
22
- * Comes with some logic baked in - changes variant based on active/focus/hover state.
23
- */
24
- badge?: string
25
- disabled?: boolean
26
- children: ReactNode
27
- onBlur?: (e: SyntheticEvent) => void
28
- onFocus?: (e: SyntheticEvent) => void
29
- } & OverrideClassName<
30
- Omit<
31
- HTMLAttributes<HTMLButtonElement>,
32
- // These props are used in the component internals, but could be extended if needed
33
- 'onFocus' | 'onBlur' | 'onMouseEnter' | 'onMouseLeave'
34
- >
35
- >
36
-
37
- /**
38
- * A tab button
39
- */
40
- export const Tab = (props: TabProps): JSX.Element => {
41
- const { isSelected, badge, disabled, children, classNameOverride, ...restProps } = props
42
- const ref = useRef<HTMLButtonElement>(null)
43
- const [isHovered, setIsHovered] = useState<boolean>(false)
44
- const [isFocused, setIsFocused] = useState<boolean>(false)
45
- const showActiveBadge = Boolean(isSelected || isHovered || isFocused)
46
-
47
- const tabProps = {
48
- disabled,
49
- className: classnames(styles.tab, classNameOverride, isSelected && styles.selected),
50
- onFocus: (event: SyntheticEvent): void => {
51
- setIsFocused(true)
52
- props.onFocus?.(event)
53
- },
54
- onBlur: (event: SyntheticEvent): void => {
55
- setIsFocused(false)
56
- props.onBlur?.(event)
57
- },
58
- onMouseEnter: (): void => setIsHovered(true),
59
- onMouseLeave: (): void => setIsHovered(false),
60
- ...restProps,
61
- }
62
-
63
- const { focusableProps } = useFocusable(tabProps, ref)
64
-
65
- // Reach is setting and managing tabIndex for us here, so we remove it from the focusableProps (also it needs to be non-defined, undefined is not enough)
66
- delete focusableProps.tabIndex
67
-
68
- return (
69
- <ReachTab ref={ref} {...tabProps} {...focusableProps}>
70
- {children}
71
- {badge && (
72
- <span className={styles.badge}>
73
- <Badge variant={showActiveBadge ? 'active' : 'default'}>{badge}</Badge>
74
- </span>
75
- )}
76
- </ReachTab>
77
- )
78
- }
@@ -1,13 +0,0 @@
1
- @import '~@kaizen/design-tokens/sass/spacing';
2
- @import '~@kaizen/design-tokens/sass/color';
3
-
4
- @layer kz-components {
5
- .tabList {
6
- border-bottom: 1px solid rgba($color-gray-600-rgb, 0.1);
7
- padding: $spacing-xs $spacing-md 0;
8
- }
9
-
10
- .tabList.noPadding {
11
- padding: 0;
12
- }
13
- }
@@ -1,39 +0,0 @@
1
- import React, { type HTMLAttributes, type ReactNode } from 'react'
2
- import { TabList as ReachTabList } from '@reach/tabs'
3
- import classnames from 'classnames'
4
- import { type OverrideClassName } from '~components/types/OverrideClassName'
5
- import styles from './TabList.module.scss'
6
-
7
- export type TabListProps = {
8
- /**
9
- * Accessible name for the set of tabs
10
- */
11
- 'aria-label': string
12
- /**
13
- * Removes the built in padding
14
- */
15
- 'noPadding'?: boolean
16
- 'children': ReactNode
17
- } & OverrideClassName<HTMLAttributes<HTMLDivElement>>
18
-
19
- /**
20
- * Wrapper for the tabs themselves
21
- */
22
- export const TabList = (props: TabListProps): JSX.Element => {
23
- const {
24
- 'aria-label': ariaLabel,
25
- noPadding = false,
26
- children,
27
- classNameOverride,
28
- ...restProps
29
- } = props
30
- return (
31
- <ReachTabList
32
- aria-label={ariaLabel}
33
- className={classnames(styles.tabList, classNameOverride, noPadding && styles.noPadding)}
34
- {...restProps}
35
- >
36
- {children}
37
- </ReachTabList>
38
- )
39
- }
@@ -1,17 +0,0 @@
1
- @import '~@kaizen/design-tokens/sass/border';
2
- @import '~@kaizen/design-tokens/sass/color';
3
-
4
- @layer kz-components {
5
- .tabPanel {
6
- border: 2px solid transparent;
7
-
8
- &:focus {
9
- outline: none;
10
- }
11
-
12
- &:focus-visible {
13
- border-color: $color-blue-500;
14
- border-radius: $border-focus-ring-border-radius;
15
- }
16
- }
17
- }
@@ -1,20 +0,0 @@
1
- import React, { type HTMLAttributes, type ReactNode } from 'react'
2
- import { TabPanel as ReachTabPanel } from '@reach/tabs'
3
- import { type OverrideClassName } from '~components/types/OverrideClassName'
4
- import styles from './TabPanel.module.scss'
5
-
6
- export type TabPanelProps = {
7
- children: ReactNode
8
- } & OverrideClassName<HTMLAttributes<HTMLDivElement>>
9
-
10
- /**
11
- * Wrapper for the content that shows when tab is active
12
- */
13
- export const TabPanel = (props: TabPanelProps): JSX.Element => {
14
- const { classNameOverride, children, ...restProps } = props
15
- return (
16
- <ReachTabPanel className={(styles.tabPanel, classNameOverride)} {...restProps}>
17
- {children}
18
- </ReachTabPanel>
19
- )
20
- }
@@ -1,15 +0,0 @@
1
- import React, { type HTMLAttributes, type ReactNode } from 'react'
2
- import { TabPanels as ReachTabPanels } from '@reach/tabs'
3
- import { type OverrideClassName } from '~components/types/OverrideClassName'
4
-
5
- export type TabPanelsProps = {
6
- children: ReactNode
7
- } & OverrideClassName<HTMLAttributes<HTMLDivElement>>
8
-
9
- /**
10
- * Wrapper for the content panels
11
- */
12
- export const TabPanels = (props: TabPanelsProps): JSX.Element => {
13
- const { children, ...restProps } = props
14
- return <ReachTabPanels {...restProps}>{children}</ReachTabPanels>
15
- }
@@ -1,4 +0,0 @@
1
- export * from './Tab'
2
- export * from './TabList'
3
- export * from './TabPanel'
4
- export * from './TabPanels'