@nypl/web-reader 0.1.4 → 0.2.0-alpha.3
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/cjs/ServiceWorker/sw.js +2 -0
- package/dist/cjs/ServiceWorker/sw.js.map +7 -0
- package/dist/cjs/index.js +683 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/esm/ServiceWorker/sw.js +1263 -0
- package/dist/esm/ServiceWorker/sw.js.map +7 -0
- package/dist/esm/index.js +88803 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/html-styles.css +2 -0
- package/dist/html-styles.css.map +7 -0
- package/dist/pdf-styles.css +2 -0
- package/dist/pdf-styles.css.map +7 -0
- package/dist/{HtmlReader → types/HtmlReader}/HtmlReaderContent.d.ts +3 -3
- package/dist/{HtmlReader → types/HtmlReader}/index.d.ts +22 -22
- package/dist/{HtmlReader → types/HtmlReader}/injectables.d.ts +30 -30
- package/dist/{PdfReader → types/PdfReader}/index.d.ts +11 -12
- package/dist/{PdfReader → types/PdfReader}/useMeasure.d.ts +7 -4
- package/dist/{ServiceWorker → types/ServiceWorker}/client.d.ts +9 -9
- package/dist/{ServiceWorker → types/ServiceWorker}/constants.d.ts +3 -3
- package/{src/ServiceWorker/index.ts → dist/types/ServiceWorker/index.d.ts} +0 -0
- package/dist/{ServiceWorker → types/ServiceWorker}/sw.d.ts +7 -7
- package/dist/{ServiceWorker → types/ServiceWorker}/types.d.ts +3 -3
- package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/ConformsTo.d.ts +3 -3
- package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/Contributor.d.ts +17 -17
- package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/EpubExtension.d.ts +47 -47
- package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/LanguageMap.d.ts +3 -3
- package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/Metadata.d.ts +46 -46
- package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/OPDSLink.d.ts +63 -63
- package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/PresentationHints.d.ts +53 -53
- package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/ReadiumLink.d.ts +58 -58
- package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/Subject.d.ts +16 -16
- package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/WebpubManifest.d.ts +14 -14
- package/dist/{constants.d.ts → types/constants.d.ts} +2 -2
- package/dist/{index.d.ts → types/index.d.ts} +7 -7
- package/dist/{types.d.ts → types/types.d.ts} +66 -66
- package/dist/{ui → types/ui}/Button.d.ts +9 -7
- package/dist/{ui → types/ui}/Header.d.ts +6 -6
- package/dist/{ui → types/ui}/HtmlSettings.d.ts +9 -9
- package/dist/{ui → types/ui}/PageButton.d.ts +7 -7
- package/dist/{ui → types/ui}/PdfSettings.d.ts +9 -9
- package/dist/{ui → types/ui}/SettingsButton.d.ts +5 -5
- package/dist/{ui → types/ui}/TableOfContent.d.ts +7 -7
- package/dist/{ui → types/ui}/ToggleButton.d.ts +10 -10
- package/dist/{ui → types/ui}/ToggleGroup.d.ts +8 -8
- package/dist/{ui → types/ui}/constants.d.ts +1 -1
- package/dist/{ui → types/ui}/hooks/useColorModeValue.d.ts +7 -7
- package/dist/{ui → types/ui}/hooks/useContainerWidth.d.ts +6 -6
- package/dist/{ui → types/ui}/hooks/useEventListener.d.ts +8 -8
- package/dist/{ui → types/ui}/manager.d.ts +9 -9
- package/dist/{ui → types/ui}/nypl-base-theme/components/button.d.ts +94 -94
- package/dist/{ui → types/ui}/nypl-base-theme/components/checkbox.d.ts +41 -41
- package/dist/{ui → types/ui}/nypl-base-theme/components/form-error.d.ts +14 -14
- package/dist/{ui → types/ui}/nypl-base-theme/components/form-label.d.ts +14 -14
- package/dist/{ui → types/ui}/nypl-base-theme/components/form.d.ts +15 -15
- package/dist/{ui → types/ui}/nypl-base-theme/components/input.d.ts +107 -107
- package/dist/{ui → types/ui}/nypl-base-theme/components/text-area.d.ts +34 -34
- package/dist/{ui → types/ui}/nypl-base-theme/foundations/breakpoints.d.ts +8 -8
- package/dist/{ui → types/ui}/nypl-base-theme/foundations/colors.d.ts +3 -3
- package/dist/{ui → types/ui}/nypl-base-theme/foundations/global.d.ts +13 -13
- package/dist/{ui → types/ui}/nypl-base-theme/foundations/radii.d.ts +12 -12
- package/dist/{ui → types/ui}/nypl-base-theme/foundations/spacing.d.ts +49 -49
- package/dist/{ui → types/ui}/nypl-base-theme/foundations/typography.d.ts +10 -10
- package/dist/{ui → types/ui}/nypl-base-theme/index.d.ts +6 -6
- package/dist/{ui → types/ui}/nypl-base-theme/types.d.ts +1 -1
- package/dist/{ui → types/ui}/theme/components/button.d.ts +78 -78
- package/dist/{ui → types/ui}/theme/components/text.d.ts +20 -20
- package/dist/{ui → types/ui}/theme/foundations/colors.d.ts +3 -3
- package/dist/{ui → types/ui}/theme/index.d.ts +11 -11
- package/dist/{ui → types/ui}/theme/types.d.ts +1 -1
- package/dist/{useWebReader.d.ts → types/useWebReader.d.ts} +7 -7
- package/dist/{utils → types/utils}/decryptAxisNow.d.ts +0 -0
- package/dist/{utils → types/utils}/fetch.d.ts +4 -4
- package/dist/{utils → types/utils}/getColor.d.ts +2 -2
- package/dist/{utils → types/utils}/toggleFullScreen.d.ts +5 -5
- package/package.json +21 -33
- package/dist/ServiceWorker/index.d.ts +0 -1
- package/dist/index.js +0 -8
- package/dist/web-reader.cjs.development.js +0 -3363
- package/dist/web-reader.cjs.development.js.map +0 -1
- package/dist/web-reader.cjs.production.min.js +0 -2
- package/dist/web-reader.cjs.production.min.js.map +0 -1
- package/dist/web-reader.esm.js +0 -3356
- package/dist/web-reader.esm.js.map +0 -1
- package/src/HtmlReader/HtmlReaderContent.tsx +0 -19
- package/src/HtmlReader/index.tsx +0 -262
- package/src/HtmlReader/injectables.ts +0 -26
- package/src/PdfReader/index.tsx +0 -492
- package/src/PdfReader/useMeasure.tsx +0 -68
- package/src/ServiceWorker/client.ts +0 -106
- package/src/ServiceWorker/constants.ts +0 -4
- package/src/ServiceWorker/sw.ts +0 -84
- package/src/ServiceWorker/types.ts +0 -3
- package/src/WebpubManifestTypes/ConformsTo.ts +0 -9
- package/src/WebpubManifestTypes/Contributor.ts +0 -24
- package/src/WebpubManifestTypes/EpubExtension.ts +0 -48
- package/src/WebpubManifestTypes/LanguageMap.ts +0 -5
- package/src/WebpubManifestTypes/Metadata.ts +0 -48
- package/src/WebpubManifestTypes/OPDSLink.ts +0 -251
- package/src/WebpubManifestTypes/PresentationHints.ts +0 -54
- package/src/WebpubManifestTypes/ReadiumLink.ts +0 -61
- package/src/WebpubManifestTypes/Subject.ts +0 -20
- package/src/WebpubManifestTypes/WebpubManifest.ts +0 -15
- package/src/constants.ts +0 -3
- package/src/index.tsx +0 -25
- package/src/types.ts +0 -94
- package/src/ui/Button.tsx +0 -12
- package/src/ui/Header.tsx +0 -89
- package/src/ui/HtmlSettings.tsx +0 -97
- package/src/ui/PageButton.tsx +0 -39
- package/src/ui/PdfSettings.tsx +0 -85
- package/src/ui/SettingsButton.tsx +0 -71
- package/src/ui/TableOfContent.tsx +0 -144
- package/src/ui/ToggleButton.tsx +0 -60
- package/src/ui/ToggleGroup.tsx +0 -41
- package/src/ui/constants.ts +0 -2
- package/src/ui/hooks/useColorModeValue.tsx +0 -19
- package/src/ui/hooks/useContainerWidth.ts +0 -24
- package/src/ui/hooks/useEventListener.ts +0 -26
- package/src/ui/manager.tsx +0 -73
- package/src/ui/nypl-base-theme/components/button.ts +0 -117
- package/src/ui/nypl-base-theme/components/checkbox.ts +0 -45
- package/src/ui/nypl-base-theme/components/form-error.ts +0 -15
- package/src/ui/nypl-base-theme/components/form-label.ts +0 -15
- package/src/ui/nypl-base-theme/components/form.ts +0 -16
- package/src/ui/nypl-base-theme/components/input.ts +0 -101
- package/src/ui/nypl-base-theme/components/text-area.ts +0 -17
- package/src/ui/nypl-base-theme/foundations/breakpoints.ts +0 -10
- package/src/ui/nypl-base-theme/foundations/colors.ts +0 -136
- package/src/ui/nypl-base-theme/foundations/global.ts +0 -16
- package/src/ui/nypl-base-theme/foundations/radii.ts +0 -13
- package/src/ui/nypl-base-theme/foundations/spacing.ts +0 -58
- package/src/ui/nypl-base-theme/foundations/typography.ts +0 -43
- package/src/ui/nypl-base-theme/index.ts +0 -42
- package/src/ui/nypl-base-theme/types.ts +0 -1
- package/src/ui/theme/components/button.ts +0 -85
- package/src/ui/theme/components/text.ts +0 -24
- package/src/ui/theme/foundations/colors.ts +0 -10
- package/src/ui/theme/index.ts +0 -34
- package/src/ui/theme/types.ts +0 -1
- package/src/useWebReader.tsx +0 -105
- package/src/utils/decryptAxisNow.ts +0 -45
- package/src/utils/fetch.ts +0 -13
- package/src/utils/getColor.ts +0 -14
- package/src/utils/toggleFullScreen.ts +0 -71
package/src/ui/ToggleGroup.tsx
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Flex, useRadioGroup, UseRadioGroupProps } from '@chakra-ui/react';
|
|
3
|
-
|
|
4
|
-
type ToggleGroupProps = Omit<UseRadioGroupProps, 'value' | 'defaultValue'> & {
|
|
5
|
-
value: string;
|
|
6
|
-
label: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const ToggleGroup: React.FC<ToggleGroupProps> = ({
|
|
10
|
-
value,
|
|
11
|
-
label,
|
|
12
|
-
name,
|
|
13
|
-
children,
|
|
14
|
-
onChange,
|
|
15
|
-
}) => {
|
|
16
|
-
const { getRootProps, getRadioProps } = useRadioGroup({
|
|
17
|
-
name,
|
|
18
|
-
onChange,
|
|
19
|
-
value,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const group = getRootProps();
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<Flex {...group} aria-label={label} flex="1 0 auto" flexWrap="wrap" my={2}>
|
|
26
|
-
{React.Children.map(children, (element) => {
|
|
27
|
-
try {
|
|
28
|
-
const value = (element as any).props.value;
|
|
29
|
-
const radio = getRadioProps({ value });
|
|
30
|
-
return React.cloneElement(element as any, radio);
|
|
31
|
-
} catch (e) {
|
|
32
|
-
throw new Error(
|
|
33
|
-
'ToggleGroup expects ToggleButton children with `value` props.'
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
})}
|
|
37
|
-
</Flex>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default ToggleGroup;
|
package/src/ui/constants.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useTheme, Theme } from '@emotion/react';
|
|
2
|
-
import { ColorMode } from '../../types';
|
|
3
|
-
import { getColor } from '../../utils/getColor';
|
|
4
|
-
|
|
5
|
-
export interface ColorModeTheme extends Theme {
|
|
6
|
-
currentColorMode: ColorMode;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const useColorModeValue = (
|
|
10
|
-
light: string,
|
|
11
|
-
dark: string,
|
|
12
|
-
sepia: string
|
|
13
|
-
): string => {
|
|
14
|
-
const { currentColorMode } = useTheme() as ColorModeTheme;
|
|
15
|
-
const color = getColor(currentColorMode)(light, dark, sepia);
|
|
16
|
-
return color;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default useColorModeValue;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useCallback, useState } from 'react';
|
|
2
|
-
import useEventListener from './useEventListener';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Returns the interior width of the container in pixels.
|
|
6
|
-
*
|
|
7
|
-
* @returns {number} Width of the container in pixels
|
|
8
|
-
*/
|
|
9
|
-
export default function useContainerWidth(containerId: string): number {
|
|
10
|
-
const [containerWidth, setContainerWidth] = useState(window.innerWidth);
|
|
11
|
-
|
|
12
|
-
const getContainerWidth = useCallback(() => {
|
|
13
|
-
const el = document.getElementById(containerId);
|
|
14
|
-
if (!el) {
|
|
15
|
-
setContainerWidth(window.innerWidth);
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
setContainerWidth(el.clientWidth);
|
|
19
|
-
}, [containerId]);
|
|
20
|
-
|
|
21
|
-
useEventListener(window, 'resize', getContainerWidth);
|
|
22
|
-
|
|
23
|
-
return containerWidth;
|
|
24
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Adds event listener to a given element.
|
|
5
|
-
*
|
|
6
|
-
* @param {HTMLElement} element Element to attach the listener to
|
|
7
|
-
* @param {string} type Event type
|
|
8
|
-
* @param {Function} listener Event listener
|
|
9
|
-
*/
|
|
10
|
-
export default function useEventListener(
|
|
11
|
-
element: HTMLElement | Window,
|
|
12
|
-
type: string,
|
|
13
|
-
listener: () => void
|
|
14
|
-
) {
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
if (!element) {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
element.addEventListener(type, listener);
|
|
21
|
-
|
|
22
|
-
return () => {
|
|
23
|
-
element.removeEventListener(type, listener);
|
|
24
|
-
};
|
|
25
|
-
}, [element, type, listener]);
|
|
26
|
-
}
|
package/src/ui/manager.tsx
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { ThemeProvider, Flex } from '@chakra-ui/react';
|
|
2
|
-
import {
|
|
3
|
-
Icon,
|
|
4
|
-
IconNames,
|
|
5
|
-
IconRotationTypes,
|
|
6
|
-
} from '@nypl/design-system-react-components';
|
|
7
|
-
import * as React from 'react';
|
|
8
|
-
import { ReaderReturn } from '../types';
|
|
9
|
-
import Header from './Header';
|
|
10
|
-
import useColorModeValue from './hooks/useColorModeValue';
|
|
11
|
-
import PageButton from './PageButton';
|
|
12
|
-
import { getTheme } from './theme';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The default Manager UI. This will be broken into individual components
|
|
16
|
-
* that can be imported and used separately or in a customized setup.
|
|
17
|
-
* It takes the return value of useWebReader as props
|
|
18
|
-
*/
|
|
19
|
-
const ManagerUI: React.FC<ReaderReturn> = (props) => {
|
|
20
|
-
return (
|
|
21
|
-
<ThemeProvider theme={getTheme(props.state?.colorMode ?? 'day')}>
|
|
22
|
-
<WebReaderContent {...props} />
|
|
23
|
-
</ThemeProvider>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const WebReaderContent: React.FC<ReaderReturn> = ({ children, ...props }) => {
|
|
28
|
-
const bgColor = useColorModeValue('ui.white', 'ui.black', 'ui.sepia');
|
|
29
|
-
return (
|
|
30
|
-
<Flex flexDir="column" minHeight="100vh" w="100vw">
|
|
31
|
-
{!props.isLoading && <Header {...props} />}
|
|
32
|
-
<PageButton
|
|
33
|
-
onClick={props.navigator?.goBackward}
|
|
34
|
-
left={0}
|
|
35
|
-
pr={2}
|
|
36
|
-
aria-label="Previous Page"
|
|
37
|
-
>
|
|
38
|
-
<Icon
|
|
39
|
-
decorative
|
|
40
|
-
name={IconNames.arrow}
|
|
41
|
-
modifiers={['small']}
|
|
42
|
-
iconRotation={IconRotationTypes.rotate90}
|
|
43
|
-
/>
|
|
44
|
-
</PageButton>
|
|
45
|
-
<Flex
|
|
46
|
-
width="100vw"
|
|
47
|
-
bg={bgColor}
|
|
48
|
-
// accounting for the prev/next buttons
|
|
49
|
-
px={{ sm: 10, md: '5vw' }}
|
|
50
|
-
flexDir="column"
|
|
51
|
-
alignItems="stretch"
|
|
52
|
-
flex="1 1 100%"
|
|
53
|
-
>
|
|
54
|
-
{children}
|
|
55
|
-
</Flex>
|
|
56
|
-
<PageButton
|
|
57
|
-
onClick={props.navigator?.goForward}
|
|
58
|
-
right={0}
|
|
59
|
-
pl={2}
|
|
60
|
-
aria-label="Next Page"
|
|
61
|
-
>
|
|
62
|
-
<Icon
|
|
63
|
-
decorative
|
|
64
|
-
name={IconNames.arrow}
|
|
65
|
-
modifiers={['small']}
|
|
66
|
-
iconRotation={IconRotationTypes.rotate270}
|
|
67
|
-
/>
|
|
68
|
-
</PageButton>
|
|
69
|
-
</Flex>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export default ManagerUI;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { Dict } from '../types';
|
|
2
|
-
|
|
3
|
-
const sizes = {
|
|
4
|
-
lg: {
|
|
5
|
-
h: 12,
|
|
6
|
-
minW: 12,
|
|
7
|
-
fontSize: 'lg',
|
|
8
|
-
px: 6,
|
|
9
|
-
},
|
|
10
|
-
md: {
|
|
11
|
-
h: '38px',
|
|
12
|
-
minW: 10,
|
|
13
|
-
fontSize: 'sm',
|
|
14
|
-
px: 2.5,
|
|
15
|
-
},
|
|
16
|
-
sm: {
|
|
17
|
-
h: 8,
|
|
18
|
-
minW: 8,
|
|
19
|
-
fontSize: 'sm',
|
|
20
|
-
px: 3,
|
|
21
|
-
},
|
|
22
|
-
xs: {
|
|
23
|
-
h: 6,
|
|
24
|
-
minW: 6,
|
|
25
|
-
fontSize: 'xs',
|
|
26
|
-
px: 2,
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const ButtonStyle = {
|
|
31
|
-
// style object for base or default style
|
|
32
|
-
baseStyle: {
|
|
33
|
-
borderRadius: 'sm',
|
|
34
|
-
fontWeight: 'light',
|
|
35
|
-
},
|
|
36
|
-
// styles for different sizes ("sm", "md", "lg")
|
|
37
|
-
sizes,
|
|
38
|
-
// styles for different visual variants ("outline", "solid")
|
|
39
|
-
variants: {
|
|
40
|
-
pill: {
|
|
41
|
-
border: '1px solid',
|
|
42
|
-
borderColor: 'gray.200',
|
|
43
|
-
borderRadius: '2xl',
|
|
44
|
-
height: 6,
|
|
45
|
-
px: 6,
|
|
46
|
-
fontSize: '-1',
|
|
47
|
-
my: 'auto',
|
|
48
|
-
},
|
|
49
|
-
solid: variantSolid,
|
|
50
|
-
secondary: {
|
|
51
|
-
border: '1px solid',
|
|
52
|
-
borderColor: 'ui.gray.light-cool',
|
|
53
|
-
_hover: {
|
|
54
|
-
bg: 'ui.gray.x-light-cool',
|
|
55
|
-
borderColor: 'ui.gray.medium',
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
// default values for `size`, `variant`, `colorScheme`
|
|
60
|
-
defaultProps: {
|
|
61
|
-
size: 'md',
|
|
62
|
-
variant: 'solid',
|
|
63
|
-
colorScheme: 'gray',
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
function solidColors(colorScheme: string) {
|
|
68
|
-
switch (colorScheme) {
|
|
69
|
-
case 'gray':
|
|
70
|
-
return {
|
|
71
|
-
bg: 'gray.100',
|
|
72
|
-
_hover: {
|
|
73
|
-
bg: 'gray.200',
|
|
74
|
-
_disabled: {
|
|
75
|
-
bg: 'gray.100',
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
_active: { bg: 'gray.300' },
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
case 'red':
|
|
82
|
-
return {
|
|
83
|
-
bg: 'brand.nypl-red',
|
|
84
|
-
color: 'white',
|
|
85
|
-
hoverBg: 'red.500',
|
|
86
|
-
activeBg: 'red.600',
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
default:
|
|
90
|
-
return {
|
|
91
|
-
bg: `${colorScheme}.500`,
|
|
92
|
-
color: 'white',
|
|
93
|
-
hoverBg: `${colorScheme}.600`,
|
|
94
|
-
activeBg: `${colorScheme}.700`,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function variantSolid(props: Dict) {
|
|
100
|
-
const colors = solidColors(props.colorScheme);
|
|
101
|
-
|
|
102
|
-
return {
|
|
103
|
-
...colors,
|
|
104
|
-
_hover: {
|
|
105
|
-
_disabled: {
|
|
106
|
-
bg: 'ui.gray.light-cool',
|
|
107
|
-
color: 'ui.gray.dark',
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
_disabled: {
|
|
111
|
-
bg: 'ui.gray.light-cool',
|
|
112
|
-
color: 'ui.gray.dark',
|
|
113
|
-
},
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export default ButtonStyle;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const baseStyleLabel = {
|
|
2
|
-
userSelect: 'none',
|
|
3
|
-
fontWeight: 'light',
|
|
4
|
-
_disabled: { color: 'ui.gray.x-dark', opacity: 1 },
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
const Checkbox = {
|
|
8
|
-
// style object for base or default style
|
|
9
|
-
baseStyle: {
|
|
10
|
-
control: {
|
|
11
|
-
borderColor: 'ui.gray.dark',
|
|
12
|
-
_hover: {
|
|
13
|
-
bg: 'white',
|
|
14
|
-
_disabled: {
|
|
15
|
-
bg: 'ui.gray.x-light-cool',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
_checked: {
|
|
19
|
-
bg: 'white',
|
|
20
|
-
color: 'gray.800',
|
|
21
|
-
borderColor: 'ui.gray.dark',
|
|
22
|
-
_hover: {
|
|
23
|
-
bg: 'white',
|
|
24
|
-
borderColor: 'ui.gray.x-dark',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
_disabled: {
|
|
28
|
-
bg: 'ui.gray.x-light-cool',
|
|
29
|
-
borderColor: 'ui.gray.medium',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
label: baseStyleLabel,
|
|
33
|
-
},
|
|
34
|
-
// styles for different sizes ("sm", "md", "lg")
|
|
35
|
-
sizes: {},
|
|
36
|
-
// styles for different visual variants ("outline", "solid")
|
|
37
|
-
variants: {},
|
|
38
|
-
// default values for `size`, `variant`, `colorScheme`
|
|
39
|
-
defaultProps: {
|
|
40
|
-
size: 'md',
|
|
41
|
-
colorScheme: 'gray',
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export default Checkbox;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
const size = {
|
|
2
|
-
lg: {
|
|
3
|
-
fontSize: 'lg',
|
|
4
|
-
px: 4,
|
|
5
|
-
h: 12,
|
|
6
|
-
borderRadius: 'none',
|
|
7
|
-
},
|
|
8
|
-
md: {
|
|
9
|
-
fontSize: 'sm',
|
|
10
|
-
px: 4,
|
|
11
|
-
h: 9,
|
|
12
|
-
borderRadius: 'none',
|
|
13
|
-
},
|
|
14
|
-
sm: {
|
|
15
|
-
fontSize: 'sm',
|
|
16
|
-
px: 3,
|
|
17
|
-
h: 8,
|
|
18
|
-
borderRadius: 'none',
|
|
19
|
-
},
|
|
20
|
-
xs: {
|
|
21
|
-
fontSize: 'xs',
|
|
22
|
-
px: 2,
|
|
23
|
-
h: 6,
|
|
24
|
-
borderRadius: 'none',
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const sizes = {
|
|
29
|
-
lg: {
|
|
30
|
-
field: size.lg,
|
|
31
|
-
addon: size.lg,
|
|
32
|
-
},
|
|
33
|
-
md: {
|
|
34
|
-
field: size.md,
|
|
35
|
-
addon: size.md,
|
|
36
|
-
},
|
|
37
|
-
sm: {
|
|
38
|
-
field: size.sm,
|
|
39
|
-
addon: size.sm,
|
|
40
|
-
},
|
|
41
|
-
xs: {
|
|
42
|
-
field: size.xs,
|
|
43
|
-
addon: size.xs,
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const Input = {
|
|
48
|
-
// style object for base or default style
|
|
49
|
-
baseStyle: {
|
|
50
|
-
field: {
|
|
51
|
-
borderRadius: 'none',
|
|
52
|
-
fontSize: 'sm',
|
|
53
|
-
_focus: {
|
|
54
|
-
borderColor: 'ui.link.primary',
|
|
55
|
-
_hover: {
|
|
56
|
-
borderColor: 'ui.link.primary',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
_placeholder: {
|
|
60
|
-
fontStyle: 'italic',
|
|
61
|
-
color: 'ui.gray.dark',
|
|
62
|
-
},
|
|
63
|
-
_invalid: {
|
|
64
|
-
borderColor: 'ui.error',
|
|
65
|
-
_placeholder: {
|
|
66
|
-
color: 'ui.error',
|
|
67
|
-
},
|
|
68
|
-
_hover: {
|
|
69
|
-
borderColor: 'ui.error',
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
// styles for different sizes ("sm", "md", "lg")
|
|
75
|
-
sizes,
|
|
76
|
-
// styles for different visual variants ("outline", "solid")
|
|
77
|
-
variants: {
|
|
78
|
-
outline: {
|
|
79
|
-
field: {
|
|
80
|
-
_disabled: {
|
|
81
|
-
bg: 'ui.gray.xx-light-cool',
|
|
82
|
-
},
|
|
83
|
-
_focus: {
|
|
84
|
-
boxShadow: 'none',
|
|
85
|
-
_hover: {
|
|
86
|
-
borderColor: 'ui.link.primary',
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
_invalid: {
|
|
90
|
-
boxShadow: 'none',
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
// default values for `size`, `variant`, `colorScheme`
|
|
96
|
-
defaultProps: {
|
|
97
|
-
size: 'md',
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export default Input;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import Input from './input';
|
|
2
|
-
|
|
3
|
-
const sizes = {
|
|
4
|
-
xs: Input.sizes.xs.field,
|
|
5
|
-
sm: Input.sizes.sm.field,
|
|
6
|
-
md: Input.sizes.md.field,
|
|
7
|
-
lg: Input.sizes.lg.field,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
baseStyle: {
|
|
12
|
-
_disabled: {
|
|
13
|
-
bg: 'ui.gray.x-light-cool',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
sizes,
|
|
17
|
-
};
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { Colors } from '@chakra-ui/react';
|
|
2
|
-
|
|
3
|
-
const colors: Colors = {
|
|
4
|
-
transparent: 'transparent',
|
|
5
|
-
|
|
6
|
-
// ui fills
|
|
7
|
-
ui: {
|
|
8
|
-
black: '#000',
|
|
9
|
-
white: '#fff',
|
|
10
|
-
focus: '#4181F1',
|
|
11
|
-
link: {
|
|
12
|
-
primary: '#0576D3',
|
|
13
|
-
secondary: '#004B98',
|
|
14
|
-
},
|
|
15
|
-
success: {
|
|
16
|
-
primary: '#077719',
|
|
17
|
-
secondary: '#095212',
|
|
18
|
-
},
|
|
19
|
-
warning: {
|
|
20
|
-
primary: '#F0974E',
|
|
21
|
-
secondary: '#EC7B1F',
|
|
22
|
-
},
|
|
23
|
-
status: {
|
|
24
|
-
primary: '#F9E08E',
|
|
25
|
-
secondary: '#FBE7E1',
|
|
26
|
-
},
|
|
27
|
-
error: '#97272C',
|
|
28
|
-
disabled: {
|
|
29
|
-
primary: '#E0E0E0',
|
|
30
|
-
secondary: '#FAFAFA',
|
|
31
|
-
},
|
|
32
|
-
test: '#FF6347',
|
|
33
|
-
gray: {
|
|
34
|
-
'x-dark': '#424242',
|
|
35
|
-
dark: '#616161',
|
|
36
|
-
medium: '#BDBDBD',
|
|
37
|
-
'light-cool': '#E0E0E0',
|
|
38
|
-
'light-warm': '#EFEDEB',
|
|
39
|
-
'x-light-cool': '#F5F5F5',
|
|
40
|
-
'x-light-warm': '#F8F8F7',
|
|
41
|
-
'xx-light-cool': '#FAFAFA',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
// brand fills. Only primary and secondary filled in for now.
|
|
46
|
-
brand: {
|
|
47
|
-
primary: '#C60917',
|
|
48
|
-
secondary: '#760000',
|
|
49
|
-
'nypl-red': '#D0343A',
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* The following color scales are useful for color edge cases
|
|
54
|
-
* where a distinct named ui or brand color doesn't quite work.
|
|
55
|
-
*/
|
|
56
|
-
// based on ui/gray/medium
|
|
57
|
-
gray: {
|
|
58
|
-
'50': '#F2F2F2',
|
|
59
|
-
'100': '#DBDBDB',
|
|
60
|
-
'200': '#C4C4C4',
|
|
61
|
-
'300': '#ADADAD',
|
|
62
|
-
'400': '#969696',
|
|
63
|
-
'500': '#808080',
|
|
64
|
-
'600': '#666666',
|
|
65
|
-
'700': '#4D4D4D',
|
|
66
|
-
'800': '#333333',
|
|
67
|
-
'900': '#1A1A1A',
|
|
68
|
-
},
|
|
69
|
-
// based on NYPL red
|
|
70
|
-
red: {
|
|
71
|
-
50: '#ffe7e6',
|
|
72
|
-
100: '#f6c2bf',
|
|
73
|
-
200: '#e99796',
|
|
74
|
-
300: '#de6d6e',
|
|
75
|
-
400: '#d4454a',
|
|
76
|
-
500: '#ba2f2b',
|
|
77
|
-
600: '#922b21',
|
|
78
|
-
700: '#692216',
|
|
79
|
-
800: '#41150a',
|
|
80
|
-
900: '#1d0a01',
|
|
81
|
-
},
|
|
82
|
-
// based on ui/warning/secondary
|
|
83
|
-
orange: {
|
|
84
|
-
'50': '#FDF1E7',
|
|
85
|
-
'100': '#F9D8BD',
|
|
86
|
-
'200': '#F6BF93',
|
|
87
|
-
'300': '#F2A669',
|
|
88
|
-
'400': '#EF8D3E',
|
|
89
|
-
'500': '#EB7414',
|
|
90
|
-
'600': '#BC5D10',
|
|
91
|
-
'700': '#8D460C',
|
|
92
|
-
'800': '#5E2F08',
|
|
93
|
-
'900': '#2F1704',
|
|
94
|
-
},
|
|
95
|
-
// based on ui/status/primary
|
|
96
|
-
yellow: {
|
|
97
|
-
'50': '#FEF8E7',
|
|
98
|
-
'100': '#FBECBB',
|
|
99
|
-
'200': '#F9E090',
|
|
100
|
-
'300': '#F7D464',
|
|
101
|
-
'400': '#F4C938',
|
|
102
|
-
'500': '#F2BD0D',
|
|
103
|
-
'600': '#C2970A',
|
|
104
|
-
'700': '#917108',
|
|
105
|
-
'800': '#614B05',
|
|
106
|
-
'900': '#302603',
|
|
107
|
-
},
|
|
108
|
-
// based on ui/success/primary
|
|
109
|
-
green: {
|
|
110
|
-
'50': '#E7FEEB',
|
|
111
|
-
'100': '#BCFBC6',
|
|
112
|
-
'200': '#90F8A1',
|
|
113
|
-
'300': '#65F67C',
|
|
114
|
-
'400': '#3AF357',
|
|
115
|
-
'500': '#0EF133',
|
|
116
|
-
'600': '#0BC128',
|
|
117
|
-
'700': '#08911E',
|
|
118
|
-
'800': '#066014',
|
|
119
|
-
'900': '#03300A',
|
|
120
|
-
},
|
|
121
|
-
// based on NYPL blue
|
|
122
|
-
blue: {
|
|
123
|
-
50: '#dbefff',
|
|
124
|
-
100: '#add2ff',
|
|
125
|
-
200: '#7cb8ff',
|
|
126
|
-
300: '#4aa2ff',
|
|
127
|
-
400: '#1a8fff',
|
|
128
|
-
500: '#007ee6',
|
|
129
|
-
600: '#0056b4',
|
|
130
|
-
700: '#003582',
|
|
131
|
-
800: '#001a51',
|
|
132
|
-
900: '#000621',
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
export default colors;
|