@charcoal-ui/react 3.10.1-beta.1 → 4.0.0-beta.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 (31) hide show
  1. package/dist/_lib/useClassNames.d.ts +5 -0
  2. package/dist/_lib/useClassNames.d.ts.map +1 -0
  3. package/dist/components/Button/index.d.ts +13 -10
  4. package/dist/components/Button/index.d.ts.map +1 -1
  5. package/dist/components/Button/index.story.d.ts +9 -4
  6. package/dist/components/Button/index.story.d.ts.map +1 -1
  7. package/dist/index.cjs.js +314 -357
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.css +118 -0
  10. package/dist/index.css.map +1 -0
  11. package/dist/index.esm.js +208 -251
  12. package/dist/index.esm.js.map +1 -1
  13. package/dist/styled.d.ts +4 -4
  14. package/package.json +17 -11
  15. package/src/_lib/useClassNames.ts +14 -0
  16. package/src/components/Button/__snapshots__/index.story.storyshot +22 -1754
  17. package/src/components/Button/index.css +125 -0
  18. package/src/components/Button/index.story.tsx +1 -95
  19. package/src/components/Button/index.tsx +36 -42
  20. package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +4 -111
  21. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +2 -105
  22. package/src/components/Modal/__snapshots__/index.story.storyshot +569 -1621
  23. package/dist/components/Button/StyledButton.d.ts +0 -13
  24. package/dist/components/Button/StyledButton.d.ts.map +0 -1
  25. package/dist/components/Button/lib/variantToBackground.d.ts +0 -3
  26. package/dist/components/Button/lib/variantToBackground.d.ts.map +0 -1
  27. package/dist/components/Button/lib/variantToFont.d.ts +0 -3
  28. package/dist/components/Button/lib/variantToFont.d.ts.map +0 -1
  29. package/src/components/Button/StyledButton.tsx +0 -71
  30. package/src/components/Button/lib/variantToBackground.tsx +0 -19
  31. package/src/components/Button/lib/variantToFont.tsx +0 -19
@@ -1,13 +0,0 @@
1
- import { variantToFont } from './lib/variantToFont';
2
- import { variantToBackground } from './lib/variantToBackground';
3
- import type { Size } from '.';
4
- type StyledButtonProps = {
5
- $fullWidth: boolean;
6
- $size: Size;
7
- $background: ReturnType<typeof variantToBackground>;
8
- $color: ReturnType<typeof variantToFont>;
9
- $isActive: boolean;
10
- };
11
- export declare const StyledButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../Clickable").ClickableProps & import("react").RefAttributes<import("../Clickable").ClickableElement>>, import("styled-components").DefaultTheme, StyledButtonProps, never>;
12
- export {};
13
- //# sourceMappingURL=StyledButton.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StyledButton.d.ts","sourceRoot":"","sources":["../../../src/components/Button/StyledButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,CAAA;AAa7B,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,EAAE,IAAI,CAAA;IACX,WAAW,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAA;IACnD,MAAM,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;IACxC,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,YAAY,4QA6CxB,CAAA"}
@@ -1,3 +0,0 @@
1
- import type { Variant } from '..';
2
- export declare function variantToBackground(variant: Variant): "assertive" | "surface4" | "surface3" | "brand" | "surface6";
3
- //# sourceMappingURL=variantToBackground.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"variantToBackground.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/lib/variantToBackground.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAEjC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,gEAenD"}
@@ -1,3 +0,0 @@
1
- import type { Variant } from '..';
2
- export declare function variantToFont(variant: Variant): "text5" | "text2";
3
- //# sourceMappingURL=variantToFont.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"variantToFont.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/lib/variantToFont.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAEjC,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,qBAe7C"}
@@ -1,71 +0,0 @@
1
- import styled, { css } from 'styled-components'
2
- import Clickable from '../Clickable'
3
- import { variantToFont } from './lib/variantToFont'
4
- import { variantToBackground } from './lib/variantToBackground'
5
- import type { Size } from '.'
6
- import { focusVisibleFocusRingCss } from '@charcoal-ui/styled'
7
-
8
- const horizontalPaddingSmall = css`
9
- padding-right: 16px;
10
- padding-left: 16px;
11
- `
12
-
13
- const horizontalPaddingMedium = css`
14
- padding-right: 24px;
15
- padding-left: 24px;
16
- `
17
-
18
- type StyledButtonProps = {
19
- $fullWidth: boolean
20
- $size: Size
21
- $background: ReturnType<typeof variantToBackground>
22
- $color: ReturnType<typeof variantToFont>
23
- $isActive: boolean
24
- }
25
-
26
- export const StyledButton = styled(Clickable)<StyledButtonProps>`
27
- width: ${(p) => (p.$fullWidth ? 'stretch' : 'min-content')};
28
- display: inline-grid;
29
- align-items: center;
30
- justify-content: center;
31
- cursor: pointer;
32
- user-select: none;
33
- white-space: nowrap;
34
- border-radius: 999999px;
35
- font-size: 14px;
36
- line-height: 22px;
37
- font-weight: bold;
38
-
39
- ${(p) => (p.$size === 'M' ? horizontalPaddingMedium : horizontalPaddingSmall)}
40
- color: var(--charcoal-${(p) => p.$color});
41
- background-color: var(--charcoal-${(p) => p.$background});
42
- transition: 0.2s color, 0.2s background-color, 0.2s box-shadow;
43
-
44
- &:not(:disabled):not([aria-disabled]),
45
- &[aria-disabled='false'] {
46
- ${focusVisibleFocusRingCss}
47
-
48
- ${({ $isActive: $active, $color, $background }) =>
49
- $active
50
- ? css`
51
- color: var(--charcoal-${$color}-press);
52
- background-color: var(--charcoal-${$background}-press);
53
- `
54
- : css`
55
- &:hover {
56
- color: var(--charcoal-${$color}-hover);
57
- background-color: var(--charcoal-${$background}-hover);
58
- }
59
- &:active {
60
- color: var(--charcoal-${$color}-press);
61
- background-color: var(--charcoal-${$background}-press);
62
- }
63
- `}
64
- }
65
-
66
- &:disabled,
67
- &[aria-disabled]:not([aria-disabled='false']) {
68
- opacity: 0.32;
69
- }
70
- height: ${(p) => (p.$size === 'M' ? 40 : 32)}px;
71
- `
@@ -1,19 +0,0 @@
1
- import { unreachable } from '../../../_lib'
2
- import type { Variant } from '..'
3
-
4
- export function variantToBackground(variant: Variant) {
5
- switch (variant) {
6
- case 'Overlay':
7
- return 'surface4'
8
- case 'Default':
9
- return 'surface3'
10
- case 'Primary':
11
- return 'brand'
12
- case 'Navigation':
13
- return 'surface6'
14
- case 'Danger':
15
- return 'assertive'
16
- default:
17
- return unreachable(variant)
18
- }
19
- }
@@ -1,19 +0,0 @@
1
- import { unreachable } from '../../../_lib'
2
- import type { Variant } from '..'
3
-
4
- export function variantToFont(variant: Variant) {
5
- switch (variant) {
6
- case 'Overlay':
7
- return 'text5'
8
- case 'Default':
9
- return 'text2'
10
- case 'Primary':
11
- return 'text5'
12
- case 'Navigation':
13
- return 'text5'
14
- case 'Danger':
15
- return 'text5'
16
- default:
17
- return unreachable(variant)
18
- }
19
- }