@charcoal-ui/react 4.0.0-beta.8 → 4.0.0-rc.1
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/_lib/compat.d.ts +0 -12
- package/dist/_lib/compat.d.ts.map +1 -1
- package/dist/_lib/createDivComponent.d.ts +2 -2
- package/dist/_lib/createDivComponent.d.ts.map +1 -1
- package/dist/components/Button/index.d.ts +2 -6
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Clickable/index.d.ts +4 -7
- package/dist/components/Clickable/index.d.ts.map +1 -1
- package/dist/components/IconButton/index.d.ts +1 -2
- package/dist/components/IconButton/index.d.ts.map +1 -1
- package/dist/components/Modal/Dialog/index.d.ts +1 -1
- package/dist/components/Modal/Dialog/index.d.ts.map +1 -1
- package/dist/components/Modal/ModalPlumbing.d.ts +6 -6
- package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/useCustomModalOverlay.d.ts +1 -0
- package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
- package/dist/components/TagItem/index.d.ts +2 -6
- package/dist/components/TagItem/index.d.ts.map +1 -1
- package/dist/components/TextArea/index.d.ts +1 -1
- package/dist/components/TextArea/index.d.ts.map +1 -1
- package/dist/components/TextField/AssistiveText/index.d.ts +2 -2
- package/dist/components/TextField/AssistiveText/index.d.ts.map +1 -1
- package/dist/components/TextField/index.d.ts +3 -3
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/core/CharcoalProvider.d.ts +4 -11
- package/dist/core/CharcoalProvider.d.ts.map +1 -1
- package/dist/index.cjs.js +300 -334
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +2 -5
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +233 -265
- package/dist/index.esm.js.map +1 -1
- package/dist/layered.css +1214 -0
- package/dist/layered.css.map +1 -0
- package/package.json +17 -13
- package/src/README.mdx +68 -0
- package/src/SSR.mdx +67 -0
- package/src/_lib/compat.ts +0 -11
- package/src/_lib/index.ts +1 -1
- package/src/components/Button/__snapshots__/index.story.storyshot +9 -9
- package/src/components/Button/index.tsx +4 -10
- package/src/components/Checkbox/CheckboxInput/__snapshots__/index.story.storyshot +5 -5
- package/src/components/Checkbox/CheckboxInput/index.css +4 -5
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +6 -6
- package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
- package/src/components/Clickable/index.story.tsx +1 -1
- package/src/components/Clickable/index.tsx +7 -12
- package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +7 -6
- package/src/components/DropdownSelector/ListItem/index.story.tsx +11 -5
- package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +3 -3
- package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +1 -1
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +14 -14
- package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
- package/src/components/IconButton/__snapshots__/index.story.storyshot +3 -3
- package/src/components/IconButton/index.tsx +3 -6
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +4 -4
- package/src/components/Modal/Dialog/index.tsx +2 -1
- package/src/components/Modal/__snapshots__/index.story.storyshot +102 -261
- package/src/components/Modal/index.story.tsx +26 -11
- package/src/components/Modal/index.tsx +5 -6
- package/src/components/Modal/useCustomModalOverlay.tsx +20 -0
- package/src/components/Radio/__snapshots__/index.story.storyshot +40 -65
- package/src/components/Radio/index.story.tsx +14 -7
- package/src/components/Radio/index.test.tsx +20 -27
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +2 -2
- package/src/components/Switch/__snapshots__/index.story.storyshot +4 -4
- package/src/components/TagItem/__snapshots__/index.story.storyshot +8 -8
- package/src/components/TagItem/index.tsx +4 -8
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +11 -11
- package/src/components/TextField/TextField.story.tsx +8 -9
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +20 -26
- package/src/components/TextField/index.tsx +2 -2
- package/src/core/CharcoalProvider.tsx +5 -29
- package/src/index.ts +0 -5
- package/src/type.d.ts +2 -13
- package/dist/components/Modal/__stories__/InternalScrollStory.d.ts +0 -4
- package/dist/components/Modal/__stories__/InternalScrollStory.d.ts.map +0 -1
- package/dist/core/ComponentAbstraction.d.ts +0 -24
- package/dist/core/ComponentAbstraction.d.ts.map +0 -1
- package/dist/styled.d.ts +0 -95
- package/dist/styled.d.ts.map +0 -1
- package/src/components/Button/__snapshots__/index.test.tsx.snap +0 -11
- package/src/components/Button/index.test.tsx +0 -32
- package/src/components/Modal/__stories__/InternalScrollStory.tsx +0 -75
- package/src/components/a11y.test.tsx +0 -99
- package/src/core/ComponentAbstraction.tsx +0 -48
- package/src/styled.ts +0 -3
|
@@ -26,7 +26,7 @@ export type TextFieldProps = {
|
|
|
26
26
|
requiredText?: string
|
|
27
27
|
disabled?: boolean
|
|
28
28
|
subLabel?: React.ReactNode
|
|
29
|
-
|
|
29
|
+
rdfaPrefix?: string
|
|
30
30
|
|
|
31
31
|
getCount?: (value: string) => number
|
|
32
32
|
} & Omit<React.ComponentPropsWithoutRef<'input'>, 'prefix' | 'onChange'>
|
|
@@ -89,7 +89,7 @@ const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
89
89
|
const showAssistiveText =
|
|
90
90
|
assistiveText != null && assistiveText.length !== 0
|
|
91
91
|
|
|
92
|
-
const classNames = useClassNames('charcoal-text-field-root')
|
|
92
|
+
const classNames = useClassNames('charcoal-text-field-root', className)
|
|
93
93
|
|
|
94
94
|
return (
|
|
95
95
|
<div className={classNames} aria-disabled={disabled}>
|
|
@@ -1,39 +1,15 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
-
import { ThemeProvider } from 'styled-components'
|
|
3
|
-
import ComponentAbstraction, { Components } from './ComponentAbstraction'
|
|
4
|
-
import { TokenInjector } from '@charcoal-ui/styled'
|
|
5
|
-
import type { ThemeMap } from '@charcoal-ui/styled/src/TokenInjector'
|
|
6
|
-
import { CharcoalTheme, ThemeColor } from '@charcoal-ui/theme'
|
|
7
|
-
|
|
8
2
|
import { OverlayProvider } from './OverlayProvider'
|
|
9
3
|
import { SSRProvider } from './SSRProvider'
|
|
10
4
|
|
|
11
|
-
export type CharcoalProviderProps =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
injectTokens?: boolean
|
|
15
|
-
components?: Partial<Components>
|
|
16
|
-
background?: keyof ThemeColor
|
|
17
|
-
}>
|
|
5
|
+
export type CharcoalProviderProps = {
|
|
6
|
+
children: React.ReactNode
|
|
7
|
+
}
|
|
18
8
|
|
|
19
|
-
export function CharcoalProvider({
|
|
20
|
-
themeMap,
|
|
21
|
-
defaultTheme = themeMap[':root'],
|
|
22
|
-
components = {},
|
|
23
|
-
injectTokens = true,
|
|
24
|
-
children,
|
|
25
|
-
background,
|
|
26
|
-
}: CharcoalProviderProps) {
|
|
9
|
+
export function CharcoalProvider({ children }: CharcoalProviderProps) {
|
|
27
10
|
return (
|
|
28
11
|
<SSRProvider>
|
|
29
|
-
<
|
|
30
|
-
{injectTokens && (
|
|
31
|
-
<TokenInjector theme={themeMap} background={background} />
|
|
32
|
-
)}
|
|
33
|
-
<ComponentAbstraction components={components}>
|
|
34
|
-
<OverlayProvider>{children}</OverlayProvider>
|
|
35
|
-
</ComponentAbstraction>
|
|
36
|
-
</ThemeProvider>
|
|
12
|
+
<OverlayProvider>{children}</OverlayProvider>
|
|
37
13
|
</SSRProvider>
|
|
38
14
|
)
|
|
39
15
|
}
|
package/src/index.ts
CHANGED
package/src/type.d.ts
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CharcoalTheme as Theme } from '@charcoal-ui/theme'
|
|
3
|
-
|
|
4
|
-
declare module 'styled-components' {
|
|
5
|
-
export interface DefaultTheme extends Theme {}
|
|
6
|
-
}
|
|
1
|
+
import 'react'
|
|
7
2
|
|
|
8
3
|
declare module 'react' {
|
|
9
4
|
interface CSSProperties {
|
|
10
|
-
[key: `--${string}`]: string |
|
|
11
|
-
}
|
|
12
|
-
interface Attributes {
|
|
13
|
-
css?: CSSProp<DefaultTheme>
|
|
14
|
-
}
|
|
15
|
-
interface CSSProperties {
|
|
16
|
-
[key: `--${string}`]: string | undefined
|
|
5
|
+
[key: `--${string}`]: string | number
|
|
17
6
|
}
|
|
18
7
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InternalScrollStory.d.ts","sourceRoot":"","sources":["../../../../src/components/Modal/__stories__/InternalScrollStory.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAC5C,OAAc,EAAe,UAAU,EAAE,MAAM,IAAI,CAAA;AAQnD,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,UAAU,CA0BjD,CAAA"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export type LinkProps = {
|
|
3
|
-
/**
|
|
4
|
-
* リンクのURL
|
|
5
|
-
*/
|
|
6
|
-
to: string;
|
|
7
|
-
} & Omit<React.ComponentPropsWithoutRef<'a'>, 'href'>;
|
|
8
|
-
export declare const DefaultLink: React.ForwardRefExoticComponent<{
|
|
9
|
-
/**
|
|
10
|
-
* リンクのURL
|
|
11
|
-
*/
|
|
12
|
-
to: string;
|
|
13
|
-
} & Omit<Pick<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "key" | "css" | keyof React.AnchorHTMLAttributes<HTMLAnchorElement>>, "href"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
14
|
-
export interface Components {
|
|
15
|
-
Link: React.ComponentType<React.ComponentPropsWithRef<typeof DefaultLink>>;
|
|
16
|
-
}
|
|
17
|
-
interface Props {
|
|
18
|
-
children: React.ReactNode;
|
|
19
|
-
components: Partial<Components>;
|
|
20
|
-
}
|
|
21
|
-
export default function ComponentAbstraction({ children, components }: Props): JSX.Element;
|
|
22
|
-
export declare function useComponentAbstraction(): Components;
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=ComponentAbstraction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentAbstraction.d.ts","sourceRoot":"","sources":["../../src/core/ComponentAbstraction.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,MAAM,SAAS,GAAG;IACtB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;CACX,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAA;AAErD,eAAO,MAAM,WAAW;IANtB;;OAEG;QACC,MAAM;gOAWX,CAAA;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,qBAAqB,CAAC,OAAO,WAAW,CAAC,CAAC,CAAA;CAC3E;AAQD,UAAU,KAAK;IACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,CAAA;CAChC;AAED,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,KAAK,eAQ3E;AAED,wBAAgB,uBAAuB,eAEtC"}
|
package/dist/styled.d.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
export declare const theme: (specFn: (o: Record<string, unknown> & Readonly<{
|
|
2
|
-
bg: Record<string, unknown> & {
|
|
3
|
-
readonly assertive: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
4
|
-
readonly border: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
5
|
-
readonly transparent: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
6
|
-
readonly background1: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
7
|
-
readonly background2: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
8
|
-
readonly surface1: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
9
|
-
readonly surface2: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
10
|
-
readonly surface3: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
11
|
-
readonly surface4: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
12
|
-
readonly surface6: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
13
|
-
readonly surface7: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
14
|
-
readonly surface8: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
15
|
-
readonly surface9: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
16
|
-
readonly surface10: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
17
|
-
readonly link1: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
18
|
-
readonly link2: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
19
|
-
readonly text1: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
20
|
-
readonly text2: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
21
|
-
readonly text3: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
22
|
-
readonly text4: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
23
|
-
readonly text5: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
24
|
-
readonly icon6: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
25
|
-
readonly brand: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
26
|
-
readonly warning: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
27
|
-
readonly success: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
28
|
-
readonly updatedItem: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
29
|
-
} & {
|
|
30
|
-
readonly surface5: (direction: "to top" | "to bottom" | "to left" | "to right") => import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
31
|
-
readonly callToAction: (direction: "to top" | "to bottom" | "to left" | "to right") => import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
32
|
-
};
|
|
33
|
-
font: {
|
|
34
|
-
readonly assertive: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
35
|
-
readonly border: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
36
|
-
readonly transparent: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
37
|
-
readonly background1: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
38
|
-
readonly background2: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
39
|
-
readonly surface1: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
40
|
-
readonly surface2: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
41
|
-
readonly surface3: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
42
|
-
readonly surface4: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
43
|
-
readonly surface6: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
44
|
-
readonly surface7: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
45
|
-
readonly surface8: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
46
|
-
readonly surface9: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
47
|
-
readonly surface10: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
48
|
-
readonly link1: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
49
|
-
readonly link2: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
50
|
-
readonly text1: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
51
|
-
readonly text2: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
52
|
-
readonly text3: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
53
|
-
readonly text4: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
54
|
-
readonly text5: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
55
|
-
readonly icon6: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
56
|
-
readonly brand: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
57
|
-
readonly warning: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
58
|
-
readonly success: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
59
|
-
readonly updatedItem: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
60
|
-
};
|
|
61
|
-
}> & {
|
|
62
|
-
readonly typography: (size: keyof import("@charcoal-ui/theme").Typography) => import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "bold" | "monospace" | "preserveHalfLeading">;
|
|
63
|
-
} & {
|
|
64
|
-
readonly margin: import("@charcoal-ui/styled/dist/factories/lib").MethodChain<import("@charcoal-ui/styled/dist/internals").Internal, "horizontal" | "vertical" | "all" | "bottom" | "left" | "right" | "top", [0 | "auto" | 4 | 8 | 16 | 40 | 24 | 64 | 104 | 168 | 272 | 440]>;
|
|
65
|
-
readonly padding: import("@charcoal-ui/styled/dist/factories/lib").MethodChain<import("@charcoal-ui/styled/dist/internals").Internal, "horizontal" | "vertical" | "all" | "bottom" | "left" | "right" | "top", [0 | "auto" | 4 | 8 | 16 | 40 | 24 | 64 | 104 | 168 | 272 | 440]>;
|
|
66
|
-
} & {
|
|
67
|
-
readonly height: Readonly<{
|
|
68
|
-
px: (size: 0 | "auto" | 4 | 8 | 16 | 40 | 24 | 64 | 104 | 168 | 272 | 440) => import("@charcoal-ui/styled/dist/internals").Internal;
|
|
69
|
-
column: (span: number) => import("@charcoal-ui/styled/dist/internals").Internal;
|
|
70
|
-
auto: import("@charcoal-ui/styled/dist/internals").Internal;
|
|
71
|
-
full: import("@charcoal-ui/styled/dist/internals").Internal;
|
|
72
|
-
}>;
|
|
73
|
-
readonly width: Readonly<{
|
|
74
|
-
px: (size: 0 | "auto" | 4 | 8 | 16 | 40 | 24 | 64 | 104 | 168 | 272 | 440) => import("@charcoal-ui/styled/dist/internals").Internal;
|
|
75
|
-
column: (span: number) => import("@charcoal-ui/styled/dist/internals").Internal;
|
|
76
|
-
auto: import("@charcoal-ui/styled/dist/internals").Internal;
|
|
77
|
-
full: import("@charcoal-ui/styled/dist/internals").Internal;
|
|
78
|
-
}>;
|
|
79
|
-
} & import("@charcoal-ui/styled/dist/internals").Internal & {
|
|
80
|
-
readonly hover: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "press" | "disabled">;
|
|
81
|
-
readonly press: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "disabled">;
|
|
82
|
-
readonly disabled: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "hover" | "press">;
|
|
83
|
-
} & Readonly<{
|
|
84
|
-
border: {
|
|
85
|
-
readonly default: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "bottom" | "left" | "right" | "top">;
|
|
86
|
-
};
|
|
87
|
-
}> & Readonly<{
|
|
88
|
-
borderRadius: (radius: "none" | 4 | 8 | 16 | 24 | "oval") => import("@charcoal-ui/styled/dist/internals").Internal;
|
|
89
|
-
}> & Readonly<{
|
|
90
|
-
outline: {
|
|
91
|
-
readonly assertive: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "focus">;
|
|
92
|
-
readonly default: import("@charcoal-ui/styled/dist/factories/lib").PropertyChain<import("@charcoal-ui/styled/dist/internals").Internal, "focus">;
|
|
93
|
-
};
|
|
94
|
-
}>) => import("@charcoal-ui/styled/dist/util").ArrayOrSingle<import("@charcoal-ui/styled/dist/internals").Internal | (false | null | undefined)>) => import("@charcoal-ui/styled").ThemeProp<import("styled-components").DefaultTheme>;
|
|
95
|
-
//# sourceMappingURL=styled.d.ts.map
|
package/dist/styled.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../src/styled.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sOAAsB,CAAA"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import 'jest-styled-components'
|
|
2
|
-
|
|
3
|
-
import renderer from 'react-test-renderer'
|
|
4
|
-
import Button from '.'
|
|
5
|
-
|
|
6
|
-
function Link({
|
|
7
|
-
as,
|
|
8
|
-
children,
|
|
9
|
-
...props
|
|
10
|
-
}: { as: string; children: React.ReactNode } & React.ComponentProps<'a'>) {
|
|
11
|
-
return (
|
|
12
|
-
<a {...props} data-as={as}>
|
|
13
|
-
{children}
|
|
14
|
-
</a>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
describe('<Button />', () => {
|
|
19
|
-
test('componentAs props are passed to the data-as attribute', () => {
|
|
20
|
-
expect(
|
|
21
|
-
renderer.create(
|
|
22
|
-
<Button
|
|
23
|
-
href="/"
|
|
24
|
-
target="_blank"
|
|
25
|
-
fullWidth
|
|
26
|
-
as={Link}
|
|
27
|
-
componentAs="componentAs"
|
|
28
|
-
/>
|
|
29
|
-
)
|
|
30
|
-
).toMatchSnapshot()
|
|
31
|
-
})
|
|
32
|
-
})
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Story } from '../../../_lib/compat'
|
|
2
|
-
import Modal, { BottomSheet, ModalProps } from '..'
|
|
3
|
-
import { OverlayProvider } from '@react-aria/overlays'
|
|
4
|
-
import { useOverlayTriggerState } from 'react-stately'
|
|
5
|
-
import Button from '../../Button'
|
|
6
|
-
import { ModalBody, ModalButtons, ModalHeader } from '../ModalPlumbing'
|
|
7
|
-
import styled, { css } from 'styled-components'
|
|
8
|
-
import { maxWidth } from '@charcoal-ui/utils'
|
|
9
|
-
|
|
10
|
-
export const InternalScrollStory: Story<ModalProps> = (args: ModalProps) => {
|
|
11
|
-
const state = useOverlayTriggerState({})
|
|
12
|
-
return (
|
|
13
|
-
<OverlayProvider>
|
|
14
|
-
<Button onClick={() => state.open()}>Open Modal</Button>
|
|
15
|
-
|
|
16
|
-
<Modal {...args} isOpen={state.isOpen} onClose={() => state.close()}>
|
|
17
|
-
<ModalHeader />
|
|
18
|
-
<ModalBody>
|
|
19
|
-
<ModalBodyOverflowDiv $offset={56} $bottomSheet={args.bottomSheet}>
|
|
20
|
-
<div
|
|
21
|
-
style={{
|
|
22
|
-
height: 1000,
|
|
23
|
-
background: `linear-gradient(#e66465, #9198e5)`,
|
|
24
|
-
}}
|
|
25
|
-
></div>
|
|
26
|
-
</ModalBodyOverflowDiv>
|
|
27
|
-
<TopBorderButtons>
|
|
28
|
-
<Button fullWidth onClick={() => state.close()}>
|
|
29
|
-
Close
|
|
30
|
-
</Button>
|
|
31
|
-
</TopBorderButtons>
|
|
32
|
-
</ModalBody>
|
|
33
|
-
</Modal>
|
|
34
|
-
</OverlayProvider>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// underlay padding-top: 40px (desktop)
|
|
39
|
-
// underlay padding-bottom: 40px (desktop)
|
|
40
|
-
// modal header: 64px (desktop)
|
|
41
|
-
// modal header: 48px (mobile-bottom-sheet)
|
|
42
|
-
// modal padding-bottom: 40px
|
|
43
|
-
// button and space: 56px
|
|
44
|
-
const MAX_HEIGHT_OFFSET = 64 + 40 + 40 + 40
|
|
45
|
-
const MAX_HEIGHT_OFFSET_MOBILE = MAX_HEIGHT_OFFSET - 40 * 2 - 16
|
|
46
|
-
const ModalBodyOverflowDiv = styled.div<{
|
|
47
|
-
$offset: number
|
|
48
|
-
$bottomSheet?: BottomSheet
|
|
49
|
-
}>`
|
|
50
|
-
overflow: auto;
|
|
51
|
-
max-height: calc(
|
|
52
|
-
100vh - ${MAX_HEIGHT_OFFSET}px - ${({ $offset }) => $offset}px
|
|
53
|
-
);
|
|
54
|
-
${({ $bottomSheet, $offset }) =>
|
|
55
|
-
($bottomSheet === true || $bottomSheet === 'full') &&
|
|
56
|
-
css`
|
|
57
|
-
@media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {
|
|
58
|
-
max-height: calc(100vh - ${MAX_HEIGHT_OFFSET_MOBILE}px - ${$offset}px);
|
|
59
|
-
}
|
|
60
|
-
`}
|
|
61
|
-
`
|
|
62
|
-
|
|
63
|
-
const TopBorderButtons = styled(ModalButtons)`
|
|
64
|
-
position: relative;
|
|
65
|
-
&::before {
|
|
66
|
-
content: '';
|
|
67
|
-
pointer-events: none;
|
|
68
|
-
border-top: 1px solid ${({ theme }) => theme.border.default.color};
|
|
69
|
-
position: absolute;
|
|
70
|
-
left: 0;
|
|
71
|
-
top: 0;
|
|
72
|
-
width: 100%;
|
|
73
|
-
height: 100%;
|
|
74
|
-
}
|
|
75
|
-
`
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
import * as glob from 'glob'
|
|
3
|
-
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
4
|
-
import { render } from '@testing-library/react'
|
|
5
|
-
import { ThemeProvider } from 'styled-components'
|
|
6
|
-
import { Story } from '../_lib/compat'
|
|
7
|
-
import ComponentAbstraction, { DefaultLink } from '../core/ComponentAbstraction'
|
|
8
|
-
import { light, dark } from '@charcoal-ui/theme'
|
|
9
|
-
|
|
10
|
-
expect.extend(toHaveNoViolations)
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
-
interface StoryWithMetadata<ArgsType = any> {
|
|
14
|
-
filename: string
|
|
15
|
-
name: string
|
|
16
|
-
story: Story<ArgsType>
|
|
17
|
-
args: ArgsType
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const stories: StoryWithMetadata[] = glob
|
|
21
|
-
.sync(path.resolve(__dirname, '**/*.story.tsx'))
|
|
22
|
-
.flatMap((filePath) => {
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
24
|
-
const exports = require(`./${path.relative(
|
|
25
|
-
__dirname,
|
|
26
|
-
filePath
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
-
)}`) as Record<string, any>
|
|
29
|
-
|
|
30
|
-
return Object.entries(exports)
|
|
31
|
-
.filter(
|
|
32
|
-
([exportName, exportValue]) =>
|
|
33
|
-
exportName !== 'default' && typeof exportValue === 'function'
|
|
34
|
-
)
|
|
35
|
-
.map(([exportName, exportValue]) => ({
|
|
36
|
-
filename: path.relative(__dirname, filePath),
|
|
37
|
-
name: exportName,
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
-
story: exportValue as Story<any>,
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
41
|
-
args: { ...exports.default.args, ...exportValue.args },
|
|
42
|
-
}))
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
const themes = Object.entries({
|
|
46
|
-
light,
|
|
47
|
-
dark,
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
const links = Object.entries({
|
|
51
|
-
DefaultLink,
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
const div = document.body.appendChild(document.createElement('div'))
|
|
55
|
-
|
|
56
|
-
beforeEach(() => {
|
|
57
|
-
global.IntersectionObserver = jest.fn().mockImplementation(() => ({
|
|
58
|
-
observe() {
|
|
59
|
-
return null
|
|
60
|
-
},
|
|
61
|
-
disconnect() {
|
|
62
|
-
return null
|
|
63
|
-
},
|
|
64
|
-
}))
|
|
65
|
-
|
|
66
|
-
global.matchMedia = jest.fn().mockImplementation(() => ({
|
|
67
|
-
matches: true,
|
|
68
|
-
media: '(max-width: 600px)',
|
|
69
|
-
addEventListener() {
|
|
70
|
-
// Do Nothing
|
|
71
|
-
},
|
|
72
|
-
removeEventListener() {
|
|
73
|
-
// Do Nothing
|
|
74
|
-
},
|
|
75
|
-
}))
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
describe.each(themes)('using %s theme', (_name, theme) => {
|
|
79
|
-
describe.each(links)('using %s component', (_name, link) => {
|
|
80
|
-
describe.each(stories)(
|
|
81
|
-
'storiesOf($filename).add($name)',
|
|
82
|
-
({ story: Story, args }) => {
|
|
83
|
-
it('has no accessibility violations', async () => {
|
|
84
|
-
expect(() => {
|
|
85
|
-
render(
|
|
86
|
-
<ThemeProvider theme={theme}>
|
|
87
|
-
<ComponentAbstraction components={{ Link: link }}>
|
|
88
|
-
<Story {...args} />
|
|
89
|
-
</ComponentAbstraction>
|
|
90
|
-
</ThemeProvider>
|
|
91
|
-
)
|
|
92
|
-
}).not.toThrow()
|
|
93
|
-
|
|
94
|
-
expect(await axe(div)).toHaveNoViolations()
|
|
95
|
-
})
|
|
96
|
-
}
|
|
97
|
-
)
|
|
98
|
-
})
|
|
99
|
-
})
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react'
|
|
2
|
-
import * as React from 'react'
|
|
3
|
-
|
|
4
|
-
export type LinkProps = {
|
|
5
|
-
/**
|
|
6
|
-
* リンクのURL
|
|
7
|
-
*/
|
|
8
|
-
to: string
|
|
9
|
-
} & Omit<React.ComponentPropsWithoutRef<'a'>, 'href'>
|
|
10
|
-
|
|
11
|
-
export const DefaultLink = React.forwardRef<HTMLAnchorElement, LinkProps>(
|
|
12
|
-
function DefaultLink({ to, children, ...rest }, ref) {
|
|
13
|
-
return (
|
|
14
|
-
<a href={to} ref={ref} {...rest}>
|
|
15
|
-
{children}
|
|
16
|
-
</a>
|
|
17
|
-
)
|
|
18
|
-
}
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
export interface Components {
|
|
22
|
-
Link: React.ComponentType<React.ComponentPropsWithRef<typeof DefaultLink>>
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const DefaultValue: Components = {
|
|
26
|
-
Link: DefaultLink,
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const ComponentAbstractionContext = React.createContext(DefaultValue)
|
|
30
|
-
|
|
31
|
-
interface Props {
|
|
32
|
-
children: React.ReactNode
|
|
33
|
-
components: Partial<Components>
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export default function ComponentAbstraction({ children, components }: Props) {
|
|
37
|
-
return (
|
|
38
|
-
<ComponentAbstractionContext.Provider
|
|
39
|
-
value={{ ...DefaultValue, ...components }}
|
|
40
|
-
>
|
|
41
|
-
{children}
|
|
42
|
-
</ComponentAbstractionContext.Provider>
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function useComponentAbstraction() {
|
|
47
|
-
return useContext(ComponentAbstractionContext)
|
|
48
|
-
}
|
package/src/styled.ts
DELETED