@kaizen/components 1.67.21 → 1.68.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 (65) hide show
  1. package/dist/cjs/EmptyState/EmptyState.cjs +15 -17
  2. package/dist/cjs/EmptyState/EmptyState.module.css.cjs +20 -0
  3. package/dist/cjs/__actions__/Button/v3/Button.cjs +43 -8
  4. package/dist/cjs/__actions__/Button/v3/Button.module.css.cjs +21 -0
  5. package/dist/cjs/__actions__/Button/v3/subcomponents/ButtonContent/ButtonContent.cjs +37 -0
  6. package/dist/cjs/__actions__/Button/v3/subcomponents/ButtonContent/ButtonContent.module.css.cjs +9 -0
  7. package/dist/cjs/__actions__/Button/v3/subcomponents/PendingContent/PendingContent.cjs +35 -0
  8. package/dist/cjs/__actions__/Button/v3/subcomponents/PendingContent/PendingContent.module.css.cjs +8 -0
  9. package/dist/cjs/__overlays__/Tooltip/v3/Tooltip.cjs +2 -2
  10. package/dist/esm/EmptyState/EmptyState.mjs +15 -17
  11. package/dist/esm/EmptyState/EmptyState.module.css.mjs +18 -0
  12. package/dist/esm/__actions__/Button/v3/Button.mjs +44 -9
  13. package/dist/esm/__actions__/Button/v3/Button.module.css.mjs +19 -0
  14. package/dist/esm/__actions__/Button/v3/subcomponents/ButtonContent/ButtonContent.mjs +28 -0
  15. package/dist/esm/__actions__/Button/v3/subcomponents/ButtonContent/ButtonContent.module.css.mjs +7 -0
  16. package/dist/esm/__actions__/Button/v3/subcomponents/PendingContent/PendingContent.mjs +26 -0
  17. package/dist/esm/__actions__/Button/v3/subcomponents/PendingContent/PendingContent.module.css.mjs +6 -0
  18. package/dist/esm/__overlays__/Tooltip/v3/Tooltip.mjs +1 -1
  19. package/dist/styles.css +360 -246
  20. package/dist/types/EmptyState/EmptyState.d.ts +2 -1
  21. package/dist/types/__actions__/Button/v3/Button.d.ts +17 -4
  22. package/dist/types/__actions__/Button/v3/index.d.ts +1 -0
  23. package/dist/types/__actions__/Button/v3/subcomponents/ButtonContent/ButtonContent.d.ts +11 -0
  24. package/dist/types/__actions__/Button/v3/subcomponents/ButtonContent/index.d.ts +1 -0
  25. package/dist/types/__actions__/Button/v3/subcomponents/PendingContent/PendingContent.d.ts +5 -0
  26. package/dist/types/__actions__/Button/v3/subcomponents/PendingContent/index.d.ts +1 -0
  27. package/dist/types/__actions__/Button/v3/subcomponents/index.d.ts +2 -0
  28. package/dist/types/__actions__/Button/v3/types.d.ts +21 -0
  29. package/package.json +1 -1
  30. package/src/EmptyState/EmptyState.module.css +114 -0
  31. package/src/EmptyState/EmptyState.tsx +18 -20
  32. package/src/EmptyState/_docs/EmptyState.stickersheet.stories.tsx +55 -39
  33. package/src/__actions__/Button/v3/Button.module.css +235 -0
  34. package/src/__actions__/Button/v3/Button.tsx +92 -29
  35. package/src/__actions__/Button/v3/_docs/Button--api-specification.mdx +150 -0
  36. package/src/__actions__/Button/v3/_docs/Button--usage-guidelines.mdx +30 -0
  37. package/src/__actions__/Button/v3/_docs/Button.docs.stories.tsx +112 -50
  38. package/src/__actions__/Button/v3/_docs/Button.spec.stories.tsx +80 -120
  39. package/src/__actions__/Button/v3/_docs/Button.stickersheet.stories.tsx +183 -81
  40. package/src/__actions__/Button/v3/index.ts +1 -0
  41. package/src/__actions__/Button/v3/subcomponents/ButtonContent/ButtonContent.module.css +19 -0
  42. package/src/__actions__/Button/v3/subcomponents/ButtonContent/ButtonContent.tsx +40 -0
  43. package/src/__actions__/Button/v3/subcomponents/ButtonContent/index.ts +1 -0
  44. package/src/__actions__/Button/v3/subcomponents/PendingContent/PendingContent.module.css +16 -0
  45. package/src/__actions__/Button/v3/subcomponents/PendingContent/PendingContent.tsx +28 -0
  46. package/src/__actions__/Button/v3/subcomponents/PendingContent/index.ts +1 -0
  47. package/src/__actions__/Button/v3/subcomponents/index.ts +2 -0
  48. package/src/__actions__/Button/v3/types.ts +25 -0
  49. package/src/__actions__/Menu/v3/_docs/Menu.docs.stories.tsx +54 -18
  50. package/src/__actions__/Menu/v3/_docs/Menu.spec.stories.tsx +30 -10
  51. package/src/__actions__/Menu/v3/_docs/Menu.stories.tsx +12 -4
  52. package/src/__future__/Icon/_docs/Icon.docs.stories.tsx +7 -7
  53. package/src/__overlays__/Tooltip/v3/Tooltip.tsx +1 -1
  54. package/src/__overlays__/Tooltip/v3/_docs/Tooltip.spec.stories.tsx +2 -0
  55. package/dist/cjs/EmptyState/EmptyState.module.scss.cjs +0 -23
  56. package/dist/cjs/__actions__/Button/v3/Button.module.scss.cjs +0 -9
  57. package/dist/esm/EmptyState/EmptyState.module.scss.mjs +0 -21
  58. package/dist/esm/__actions__/Button/v3/Button.module.scss.mjs +0 -7
  59. package/src/EmptyState/EmptyState.module.scss +0 -186
  60. package/src/EmptyState/EmptyState.spec.tsx +0 -48
  61. package/src/EmptyState/_mixins.scss +0 -44
  62. package/src/__actions__/Button/v3/Button.module.scss +0 -104
  63. package/src/__actions__/Button/v3/_docs/ApiSpecification.mdx +0 -173
  64. package/src/__actions__/Button/v3/_docs/Button.mdx +0 -41
  65. package/src/__actions__/Button/v3/_docs/Button.stories.tsx +0 -98
@@ -1,104 +0,0 @@
1
- .button {
2
- --button-min-height-width: var(--spacing-48);
3
- --button-padding-x: calc(
4
- #{var(--spacing-12)} - #{var(--border-solid-border-width)}
5
- );
6
- --button-padding-y: calc(
7
- #{var(--spacing-8)} - #{var(--border-solid-border-width)}
8
- );
9
- --button-icon-size: var(--spacing-24);
10
-
11
- // RESET
12
- appearance: none;
13
- background: transparent;
14
- color: inherit;
15
- font: inherit;
16
- margin: 0;
17
- border: none;
18
- // RESET
19
- border: var(--border-solid-border-width) var(--border-solid-border-style);
20
- border-radius: var(--border-solid-border-radius);
21
- box-sizing: border-box;
22
- display: inline-flex;
23
- align-items: center;
24
- justify-content: center;
25
- text-align: left;
26
- gap: var(--spacing-8);
27
- font-family: var(--typography-button-primary-font-family);
28
- font-weight: var(--typography-button-primary-font-weight);
29
- font-size: var(--typography-button-primary-font-size);
30
- line-height: var(--typography-button-primary-line-height);
31
- min-height: var(--button-min-height-width);
32
- min-width: var(--button-min-height-width);
33
- outline: none;
34
- position: relative;
35
- padding: var(--button-padding-y) var(--button-padding-x);
36
- -webkit-font-smoothing: antialiased;
37
- -moz-osx-font-smoothing: grayscale;
38
-
39
- &[data-focus-visible]::after {
40
- content: "";
41
- position: absolute;
42
- background: transparent;
43
- border-color: var(--color-blue-500);
44
- border-radius: var(--border-focus-ring-border-radius);
45
- border-width: var(--border-focus-ring-border-width);
46
- border-style: var(--border-focus-ring-border-style);
47
- inset: calc(-1 * ((#{var(--border-focus-ring-border-width)} * 2) + 1px));
48
- }
49
-
50
- svg {
51
- height: var(--button-icon-size);
52
- width: var(--button-icon-size);
53
- }
54
- }
55
-
56
- .default {
57
- border-color: var(--color-gray-500);
58
- color: var(--color-purple-800);
59
-
60
- &[data-hovered],
61
- &[data-focus-visible],
62
- &[data-pressed] {
63
- background-color: var(--color-gray-200);
64
- border-color: var(--color-purple-800);
65
- }
66
-
67
- &[data-disabled] {
68
- opacity: 0.3;
69
- }
70
-
71
- &.reversed {
72
- background-color: transparent;
73
- border-color: rgba(var(--color-white-rgb), 0.65);
74
- color: var(--color-white);
75
-
76
- &[data-hovered],
77
- &[data-focus-visible] {
78
- background-color: rgba(var(--color-white-rgb), 0.1);
79
- border-color: var(--color-white);
80
- }
81
-
82
- &[data-focus-visible]::after {
83
- border-color: var(--color-blue-300);
84
- }
85
-
86
- &[data-disabled]::after {
87
- border-color: var(--color-gray-400);
88
- }
89
- }
90
- }
91
-
92
- .small {
93
- // spacing-40 does not currently exist. Holding on adding this until the button rfc has been signed off
94
- --button-min-height-width: 2.5rem;
95
- --button-padding-x: calc(
96
- #{var(--spacing-8)} - #{var(--border-solid-border-width)}
97
- );
98
- --button-padding-y: calc(
99
- #{var(--spacing-8)} - #{var(--border-solid-border-width)}
100
- );
101
- --button-icon-size: var(--spacing-16);
102
-
103
- gap: var(--spacing-8);
104
- }
@@ -1,173 +0,0 @@
1
- import { Canvas, Meta, Controls } from "@storybook/blocks"
2
- import { ResourceLinks, SbContent, KAIOInstallation } from "~storybook/components"
3
- import * as docsStories from "./Button.docs.stories"
4
- import * as exampleStories from "./Button.stories"
5
-
6
- <Meta title="Actions/Button/Button (v3)/API Specification" />
7
-
8
- <SbContent>
9
- # Button API Specification (v3)
10
-
11
-
12
- Updated July 15, 2024
13
- </SbContent>
14
-
15
- <ResourceLinks
16
- sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__actions__/Button/v3"
17
- figma="https://www.figma.com/design/eZKEE5kXbEMY3lx84oz8iN/%F0%9F%92%9C-Heart-UI-Kit?m=auto&t=a6VcoKBJx6snn0ut-1"
18
- ariaComponentPage="https://react-spectrum.adobe.com/react-aria/Button.html"
19
- designGuidelines="/?path=/docs/actions-button-v3-usage-guidelines--docs"
20
- />
21
-
22
- <SbContent className="mb-24">
23
- <div className="bg-yellow-100 border-default border-yellow-400 rounded px-24">
24
- ### Disclaimer
25
-
26
- The `v3` of `Button` is a partial rebuild to support [Menu v3](/docs/actions-menu-v3-api-specification--docs). As the changes to the API between `v1/v2` to `v3` is significant, our recommendation is to hold on adopting this outside of `Menu` `v3` as it will have a limited set of options.
27
- </div>
28
- </SbContent>
29
-
30
- <SbContent>
31
- <KAIOInstallation exportNames={["Tooltip", "TooltipTrigger" ]} family="actions" version="3" />
32
-
33
-
34
- ## Overview
35
-
36
- </SbContent>
37
-
38
- <Canvas of={exampleStories.Playground} />
39
-
40
- <SbContent className="mb-64">
41
- ### React Aria
42
-
43
- This component is built using the react-aria-components library and extends the [Button](https://react-spectrum.adobe.com/react-aria/Button.html) component.
44
-
45
- As this shares the same core [anatomy](https://react-spectrum.adobe.com/react-aria/Button.html#anatomy), [props types](https://react-spectrum.adobe.com/react-aria/Button.html#anatomy) and [event handlers](https://react-spectrum.adobe.com/react-aria/Button.html#events), the guidance below is tailored to our implementation and should cover most known use cases of the Button.
46
-
47
- For more scenarios that may not be present below, we recommend checkout out React Aria&apos;s documentation on the [Button's available hooks](https://react-spectrum.adobe.com/react-aria/Button.html#hooks) or [advanced customization](https://react-spectrum.adobe.com/react-aria/Button.html#advanced-customization) options.
48
- </SbContent>
49
-
50
- <SbContent>
51
- ## API
52
- </SbContent>
53
-
54
-
55
- <Controls of={exampleStories.Playground} className="mb-64" />
56
-
57
- <SbContent className="mb-64">
58
- ### onPress vs onClick
59
-
60
- One key change to the `Button`&apos;s API is the shift from `onClick` to `onPress`. This will not require a change to the implementation of `onClick` logic, ie:
61
- ```
62
- <Button label="Submit" onClick={(e) => sumbit(e)}/>
63
- // can safely be migrated to:
64
- <Button onPress={(e) => submit(e)}>
65
- Submit
66
- </Button>
67
- ```
68
-
69
- React Aria&apos;s implementation of `onPress` provides better support for consistent touch events across device types, such mobile, desktop and tablet. You can read more about the development and reason behind this pattern [here](https://react-spectrum.adobe.com/blog/building-a-button-part-1.html#touch-interactions).
70
- </SbContent>
71
-
72
- <SbContent>
73
-
74
- ### Interactive states and styling pseudo-classes
75
-
76
- Psuedo classes, such as `hover`, `focus` or `focus-visible`, are now targeted and styled with HTML data attributes that reflect the internal state of the React Aria Button (ie: `isHovered`, `isFocusVisible`).
77
-
78
- When styling in CSS, it is recommended to use [data attributes](https://react-spectrum.adobe.com/react-aria/Button.html#styling), such as `:[data-hovered]` or `:[data-focus-visible]`, instead of using pseudo selectors like `:hover` or `:focus-visible`.
79
-
80
- ```css
81
- .button {
82
- background-color: $color-white;
83
- &:hover {
84
- background-color: $color-gray-200;
85
- }
86
- }
87
- // becomes
88
- .button {
89
- background-color: $color-white;
90
- &:[data-hovered] {
91
- background-color: $color-gray-200;
92
- }
93
- }
94
- ```
95
-
96
- #### Dynamic styles with ButtonRenderProps
97
-
98
- As `Button` extends React Aria&apos;s functionality, `className` can now accept either a `string` or function that receives the `Button`&apos;s state for styling, such as `isPressed` or `isHovered`. This useful for add dynamic styling tweaks with Tailwind or other CSS-in-JS libraries.
99
- </SbContent>
100
-
101
- <Canvas of={docsStories.ButtonClassModifierWithRenderProps} sourceState="shown" />
102
-
103
- <SbContent className="mb-64">
104
- This can also be styled in directly with Tailwind targeting the data attributes, ie:
105
-
106
- ```tsx
107
- <Button className="[&[data-focused='true']]:bg-blue-300">Label</Button>
108
- ```
109
-
110
- React Aria also offers a [Tailwind plugin](https://react-spectrum.adobe.com/react-aria/styling.html#plugin) that exposes the styling states of React Aria Components into Tailwind. This can make classes and allows you to leverage intellisense when working with React Aria components, ie:
111
-
112
- ```tsx
113
- <Button className="pressed:bg-blue-300">Label</Button>
114
- ```
115
-
116
-
117
- For more on styling with React Aria and other ways to extend the `Button`&apos;s styles, we recommend checking out the [docs here](https://react-spectrum.adobe.com/react-aria/Button.html#styling).
118
- </SbContent>
119
-
120
- <SbContent>
121
- ### Icons, labels and content as children
122
-
123
- In `v3`, labels, icons and their positions are controlled by the consumer as `children`. The immediate children of `Button` are spaced using `flex-gap` to ensure `RTL` can be supported out of the box for most cases.
124
- </ SbContent>
125
-
126
- <Canvas of={exampleStories.ButtonWithIcon} />
127
-
128
- <SbContent>
129
- While the expected default is that `children` will be a `ReactNode`, it also accepts a render function that takes `ButtonRenderProps`. Similar to the className, this exposes the internal state (`isPressed`, `isHovered`, etc) of the button and can be used for conditional rendering.
130
-
131
- ```tsx
132
- <Button>
133
- {({isPressed}) => (
134
- <>
135
- {isPressed && <PressHighlight />}
136
- Press me
137
- </>
138
- )}
139
- </Button>
140
- ```
141
- </ SbContent>
142
-
143
-
144
- <SbContent>
145
- ### Icon only buttons
146
-
147
- To achieve the `IconButton` pattern in `v3`, we recommend passing an icon in as a the sole child. The label should be added to the icon&apos;s `aria-label` prop in the SVG Icon.
148
- </ SbContent>
149
-
150
- <Canvas of={exampleStories.IconButton} className="mb-32" />
151
-
152
- <SbContent className="mb-64">
153
- We recommend against setting the `aria-label` on the `Button` itself, and letting the accessible label be [determined by the children](https://cultureamp.atlassian.net/wiki/spaces/PA/pages/3833331831/Accessible+button+and+link+labels). You can achieve this by using visually hidden elements as children, which will create an accessible label based off the contents of the button.
154
- </SbContent>
155
-
156
- <SbContent className="mb-64">
157
- ### Reversed Colors
158
-
159
- The `Button` uses the `useReversedColors` hook and `ReversedColors` provider to control the dark and light theme.
160
-
161
- <Canvas className="bg-purple-600 mb-24" of={exampleStories.OnReversed} />
162
-
163
- To enable the reversed theme, you will need to the component or application in the ReversedColors provider.
164
- </ SbContent>
165
-
166
- <SbContent>
167
- ### Buttons and links
168
-
169
- `v3` of the `Button` component does not support the `href` prop. While a `Link` component will be coming to Kaizen, we recommend using the `v2` of button if a `anchor` or routing link is needed.
170
-
171
- We do not advise passing in an `anchor` tag as a child of the `Button` as this can lead to accessibility issues.
172
- </ SbContent>
173
-
@@ -1,41 +0,0 @@
1
- import { Canvas, Meta, Controls } from "@storybook/blocks"
2
- import { ResourceLinks, SbContent, Installation } from "~storybook/components"
3
- import * as Button from "./Button.stories"
4
-
5
- <Meta title="Actions/Button/Button (v3)/Usage Guidelines" />
6
-
7
- <SbContent>
8
- # Button (v3)
9
-
10
- Updated July 12, 2024
11
- </SbContent>
12
-
13
- <ResourceLinks
14
- sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__actions__/Button/v3"
15
- figma="https://www.figma.com/design/eZKEE5kXbEMY3lx84oz8iN/%F0%9F%92%9C-Heart-UI-Kit?m=auto&t=a6VcoKBJx6snn0ut-1"
16
- ariaComponentPage="https://react-spectrum.adobe.com/react-aria/Menu.html"
17
- apiSpecification="/?path=/docs/actions-button-v3-api-specification--docs"
18
- />
19
-
20
- <SbContent className="mb-24">
21
- <div className="bg-yellow-100 border-default border-yellow-400 rounded px-24">
22
- ### Disclaimer
23
-
24
- The `v3` of `Button` is a partial rebuild to support [Menu v3](/docs/actions-menu-v3-api-specification--docs). As the changes to the API between `v1/v2` to `v3` is significant, our recommendation is to hold on adopting this outside of `Menu` `v3` as it will have a limited set of options.
25
- </div>
26
- </SbContent>
27
-
28
- <SbContent>
29
- <Installation
30
- installCommand="pnpm add @kaizen/components"
31
- importStatement='import { Button } from "@kaizen/components/v3/actions"'
32
- />
33
-
34
- ## Overview
35
-
36
- This is the rebuild of the Button component - the main changes present in `v3` will relate to an updated API. More guidance will be provided following the completion of the Button RFC.
37
- </SbContent>
38
-
39
- <Canvas of={Button.Playground} />
40
- <Controls of={Button.Playground} include={["children", "variant", "isDisabled"]} className="mb-64" />
41
-
@@ -1,98 +0,0 @@
1
- import React from "react"
2
- import { action } from "@storybook/addon-actions"
3
- import { Meta, StoryObj } from "@storybook/react"
4
- import { AddIcon, TrashIcon, ChevronUpIcon } from "~components/Icon"
5
- import { VisuallyHidden } from "~components/VisuallyHidden"
6
- import { Button } from "../index"
7
-
8
- const meta = {
9
- title: "Actions/Button/Button (v3)",
10
- component: Button,
11
- args: {
12
- children: "Label",
13
- onPress: action("Button onPress event"),
14
- },
15
- } satisfies Meta<typeof Button>
16
-
17
- export default meta
18
-
19
- type Story = StoryObj<typeof meta>
20
-
21
- export const Playground: Story = {
22
- render: ({ children, ...otherArgs }) => (
23
- <Button {...otherArgs}>{children}</Button>
24
- ),
25
- }
26
-
27
- export const ButtonWithIcon: Story = {
28
- render: ({ children, ...otherArgs }) => (
29
- <Button {...otherArgs}>{children}</Button>
30
- ),
31
- args: {
32
- children: (
33
- <>
34
- Label
35
- <AddIcon role="presentation" />
36
- </>
37
- ),
38
- },
39
- }
40
-
41
- export const ButtonWithIconStart: Story = {
42
- render: ({ children, ...otherArgs }) => (
43
- <Button {...otherArgs}>{children}</Button>
44
- ),
45
- args: {
46
- children: (
47
- <>
48
- <TrashIcon role="presentation" />
49
- Label
50
- </>
51
- ),
52
- },
53
- }
54
-
55
- export const IconButton: Story = {
56
- render: ({ children, ...otherArgs }) => (
57
- <Button {...otherArgs}>{children}</Button>
58
- ),
59
- args: {
60
- children: (
61
- <>
62
- <TrashIcon role="img" aria-label="Remove" />
63
- <VisuallyHidden> Highlights: May 8, 2024</VisuallyHidden>
64
- </>
65
- ),
66
- },
67
- }
68
-
69
- export const OnReversed: Story = {
70
- render: ({ children, ...otherArgs }) => (
71
- <Button {...otherArgs}>{children}</Button>
72
- ),
73
- args: {
74
- children: (
75
- <>
76
- Label
77
- <ChevronUpIcon role="presentation" />
78
- </>
79
- ),
80
- },
81
- parameters: {
82
- reverseColors: true,
83
- docs: {
84
- source: {
85
- code: `
86
- <ReversedColors isReversed={true}>
87
- <Button {...otherArgs}>
88
- <>
89
- Label
90
- <ChevronUpIcon role="presentation" />
91
- </>
92
- </Button>
93
- </ReversedColors>
94
- `,
95
- },
96
- },
97
- },
98
- }