@nypl/design-system-react-components 0.27.0 → 0.28.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.
- package/CHANGELOG.md +29 -0
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -5
- package/dist/components/Button/Button.d.ts +2 -10
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +22 -0
- package/dist/components/Card/Card.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.d.ts +10 -8
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/Form/Form.d.ts +2 -2
- package/dist/components/Grid/SimpleGrid.d.ts +6 -3
- package/dist/components/Heading/Heading.d.ts +2 -5
- package/dist/components/HelperErrorText/HelperErrorText.d.ts +1 -5
- package/dist/components/Hero/Hero.d.ts +13 -9
- package/dist/components/Icons/Icon.d.ts +6 -5
- package/dist/components/Icons/IconSvgs.d.ts +21 -21
- package/dist/components/Image/Image.d.ts +8 -5
- package/dist/components/Link/Link.d.ts +1 -9
- package/dist/components/List/List.d.ts +7 -11
- package/dist/components/Logo/Logo.d.ts +2 -5
- package/dist/components/Logo/LogoSvgs.d.ts +39 -39
- package/dist/components/Notification/Notification.d.ts +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +2 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/SearchBar/SearchBar.d.ts +3 -2
- package/dist/components/Select/Select.d.ts +2 -5
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +4 -4
- package/dist/components/SkipNavigation/SkipNavigation.d.ts +17 -0
- package/dist/components/StatusBadge/StatusBadge.d.ts +2 -3
- package/dist/components/StructuredContent/StructuredContent.d.ts +2 -2
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Template/Template.d.ts +2 -0
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +21 -9
- package/dist/components/Toggle/Toggle.d.ts +1 -5
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +2 -1
- package/dist/design-system-react-components.cjs.development.js +856 -1155
- package/dist/design-system-react-components.cjs.development.js.map +1 -1
- package/dist/design-system-react-components.cjs.production.min.js +1 -1
- package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
- package/dist/design-system-react-components.esm.js +858 -1220
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/helpers/types.d.ts +1 -0
- package/dist/index.d.ts +26 -47
- package/dist/theme/components/buttonGroup.d.ts +11 -0
- package/dist/theme/components/card.d.ts +104 -8
- package/dist/theme/components/componentWrapper.d.ts +4 -3
- package/dist/theme/components/customTable.d.ts +11 -14
- package/dist/theme/components/fieldset.d.ts +4 -3
- package/dist/theme/components/helperErrorText.d.ts +4 -3
- package/dist/theme/components/hero.d.ts +1 -1
- package/dist/theme/components/horizontalRule.d.ts +4 -3
- package/dist/theme/components/icon.d.ts +47743 -1
- package/dist/theme/components/image.d.ts +563 -10
- package/dist/theme/components/label.d.ts +4 -3
- package/dist/theme/components/list.d.ts +6 -7
- package/dist/theme/components/logo.d.ts +474 -1
- package/dist/theme/components/notification.d.ts +20 -16
- package/dist/theme/components/progressIndicator.d.ts +6 -4
- package/dist/theme/components/select.d.ts +4 -4
- package/dist/theme/components/skeletonLoader.d.ts +14 -10
- package/dist/theme/components/skipNavigation.d.ts +22 -0
- package/dist/theme/components/slider.d.ts +7 -6
- package/dist/theme/components/structuredContent.d.ts +10 -9
- package/dist/theme/components/text.d.ts +7 -1
- package/dist/theme/components/toggle.d.ts +6 -4
- package/dist/theme/provider.d.ts +2 -4
- package/dist/utils/componentCategories.d.ts +1 -1
- package/dist/utils/interfaces.d.ts +5 -0
- package/dist/utils/utils.d.ts +2 -18
- package/package.json +2 -2
- package/src/__tests__/setup.ts +3 -3
- package/src/__tests__/utils/utils.test.ts +1 -23
- package/src/components/AccessibilityGuide/SkipNavigation.stories.mdx +22 -14
- package/src/components/Accordion/Accordion.stories.mdx +43 -44
- package/src/components/Accordion/Accordion.test.tsx +5 -13
- package/src/components/Accordion/Accordion.tsx +14 -18
- package/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap +6 -6
- package/src/components/Autosuggest/Autosuggest.stories.mdx +1 -1
- package/src/components/Autosuggest/Autosuggest.stories.tsx +23 -25
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +21 -37
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +4 -17
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +18 -21
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +1 -100
- package/src/components/Button/Button.stories.mdx +89 -126
- package/src/components/Button/Button.test.tsx +16 -30
- package/src/components/Button/Button.tsx +14 -20
- package/src/components/ButtonGroup/ButtonGroup.stories.mdx +147 -0
- package/src/components/ButtonGroup/ButtonGroup.test.tsx +141 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +99 -0
- package/src/components/ButtonGroup/__snapshots__/ButtonGroup.test.tsx.snap +117 -0
- package/src/components/Card/Card.stories.mdx +143 -177
- package/src/components/Card/Card.test.tsx +36 -97
- package/src/components/Card/Card.tsx +78 -74
- package/src/components/Chakra/Box.stories.mdx +2 -6
- package/src/components/Chakra/Center.stories.mdx +5 -23
- package/src/components/Chakra/Flex.stories.mdx +4 -6
- package/src/components/Chakra/Stack.stories.mdx +9 -10
- package/src/components/Checkbox/Checkbox.stories.mdx +1 -1
- package/src/components/Checkbox/Checkbox.test.tsx +2 -2
- package/src/components/Checkbox/Checkbox.tsx +20 -13
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +6 -17
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +1 -7
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +33 -29
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +0 -11
- package/src/components/ComponentWrapper/ComponentWrapper.tsx +3 -10
- package/src/components/DatePicker/DatePicker.stories.mdx +23 -37
- package/src/components/DatePicker/DatePicker.test.tsx +21 -19
- package/src/components/DatePicker/DatePicker.tsx +57 -49
- package/src/components/Form/Form.stories.mdx +46 -31
- package/src/components/Form/Form.test.tsx +1 -18
- package/src/components/Form/Form.tsx +7 -7
- package/src/components/Grid/SimpleGrid.stories.mdx +73 -49
- package/src/components/Grid/SimpleGrid.test.tsx +7 -9
- package/src/components/Grid/SimpleGrid.tsx +14 -11
- package/src/components/Heading/Heading.stories.mdx +27 -72
- package/src/components/Heading/Heading.test.tsx +18 -44
- package/src/components/Heading/Heading.tsx +7 -10
- package/src/components/HelperErrorText/HelperErrorText.stories.mdx +1 -3
- package/src/components/HelperErrorText/HelperErrorText.tsx +1 -5
- package/src/components/Hero/Hero.stories.mdx +219 -216
- package/src/components/Hero/Hero.test.tsx +107 -223
- package/src/components/Hero/Hero.tsx +63 -61
- package/src/components/Icons/Icon.stories.mdx +172 -118
- package/src/components/Icons/Icon.test.tsx +8 -16
- package/src/components/Icons/Icon.tsx +75 -29
- package/src/components/Icons/IconSvgs.tsx +42 -42
- package/src/components/Image/Image.stories.mdx +45 -132
- package/src/components/Image/Image.test.tsx +16 -31
- package/src/components/Image/Image.tsx +28 -12
- package/src/components/Link/Link.stories.mdx +30 -80
- package/src/components/Link/Link.test.tsx +25 -53
- package/src/components/Link/Link.tsx +43 -56
- package/src/components/Link/__snapshots__/Link.test.tsx.snap +1 -2
- package/src/components/List/List.stories.mdx +20 -31
- package/src/components/List/List.test.tsx +24 -43
- package/src/components/List/List.tsx +25 -36
- package/src/components/Logo/Logo.stories.mdx +94 -50
- package/src/components/Logo/Logo.test.tsx +10 -19
- package/src/components/Logo/Logo.tsx +50 -17
- package/src/components/Logo/LogoSvgs.tsx +78 -78
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +4 -4
- package/src/components/Modal/Modal.stories.mdx +8 -9
- package/src/components/Modal/Modal.test.tsx +5 -10
- package/src/components/Modal/Modal.tsx +1 -1
- package/src/components/Notification/Notification.stories.mdx +10 -28
- package/src/components/Notification/Notification.test.tsx +9 -12
- package/src/components/Notification/Notification.tsx +34 -37
- package/src/components/Pagination/Pagination.stories.mdx +2 -2
- package/src/components/Pagination/Pagination.tsx +15 -10
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +27 -53
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +9 -10
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +17 -21
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +0 -10
- package/src/components/Radio/Radio.stories.mdx +1 -1
- package/src/components/Radio/Radio.tsx +9 -6
- package/src/components/RadioGroup/RadioGroup.stories.mdx +15 -16
- package/src/components/RadioGroup/RadioGroup.test.tsx +2 -8
- package/src/components/RadioGroup/RadioGroup.tsx +28 -24
- package/src/components/SearchBar/SearchBar.stories.mdx +1 -1
- package/src/components/SearchBar/SearchBar.test.tsx +1 -1
- package/src/components/SearchBar/SearchBar.tsx +14 -22
- package/src/components/SearchBar/__snapshots__/SearchBar.test.tsx.snap +0 -12
- package/src/components/Select/Select.stories.mdx +8 -23
- package/src/components/Select/Select.test.tsx +6 -7
- package/src/components/Select/Select.tsx +13 -26
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +17 -56
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -21
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +9 -8
- package/src/components/SkeletonLoader/__snapshots__/SkeletonLoader.test.tsx.snap +33 -33
- package/src/components/SkipNavigation/SkipNavigation.stories.mdx +90 -0
- package/src/components/SkipNavigation/SkipNavigation.test.tsx +63 -0
- package/src/components/SkipNavigation/SkipNavigation.tsx +51 -0
- package/src/components/SkipNavigation/__snapshots__/SkipNavigation.test.tsx.snap +130 -0
- package/src/components/Slider/Slider.stories.mdx +19 -53
- package/src/components/Slider/Slider.test.tsx +2 -2
- package/src/components/Slider/Slider.tsx +10 -12
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +2 -9
- package/src/components/StatusBadge/StatusBadge.stories.mdx +6 -21
- package/src/components/StatusBadge/StatusBadge.test.tsx +2 -3
- package/src/components/StatusBadge/StatusBadge.tsx +3 -10
- package/src/components/StructuredContent/StructuredContent.stories.mdx +30 -58
- package/src/components/StructuredContent/StructuredContent.test.tsx +42 -44
- package/src/components/StructuredContent/StructuredContent.tsx +9 -18
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +9 -23
- package/src/components/StyleGuide/Buttons.stories.mdx +62 -62
- package/src/components/StyleGuide/ColorCard.tsx +2 -4
- package/src/components/StyleGuide/Colors.stories.mdx +7 -8
- package/src/components/StyleGuide/DesignTokens.stories.mdx +5 -7
- package/src/components/StyleGuide/Forms.stories.mdx +0 -1
- package/src/components/StyleGuide/Iconography.stories.mdx +59 -77
- package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
- package/src/components/StyleGuide/Typography.stories.mdx +15 -18
- package/src/components/Table/Table.stories.mdx +85 -1
- package/src/components/Table/Table.test.tsx +57 -1
- package/src/components/Table/Table.tsx +7 -4
- package/src/components/Table/__snapshots__/Table.test.tsx.snap +121 -0
- package/src/components/Tabs/Tabs.stories.mdx +1 -1
- package/src/components/Tabs/Tabs.test.tsx +2 -2
- package/src/components/Tabs/Tabs.tsx +26 -27
- package/src/components/Template/Template.stories.mdx +49 -54
- package/src/components/Template/Template.tsx +9 -3
- package/src/components/Text/Text.stories.mdx +5 -11
- package/src/components/Text/Text.test.tsx +3 -6
- package/src/components/Text/Text.tsx +3 -5
- package/src/components/TextInput/TextInput.stories.mdx +10 -22
- package/src/components/TextInput/TextInput.test.tsx +32 -62
- package/src/components/TextInput/TextInput.tsx +61 -30
- package/src/components/TextInput/__snapshots__/TextInput.test.tsx.snap +1 -0
- package/src/components/Toggle/Toggle.stories.mdx +5 -16
- package/src/components/Toggle/Toggle.test.tsx +2 -3
- package/src/components/Toggle/Toggle.tsx +9 -10
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +13 -29
- package/src/components/VideoPlayer/VideoPlayer.test.tsx +18 -23
- package/src/components/VideoPlayer/VideoPlayer.tsx +13 -10
- package/src/docs/Chakra.stories.mdx +14 -11
- package/src/docs/Welcome.stories.mdx +23 -43
- package/src/helpers/types.ts +1 -0
- package/src/hooks/tests/useNYPLTheme.test.tsx +1 -1
- package/src/hooks/useNYPLTheme.stories.mdx +3 -6
- package/src/index.ts +51 -45
- package/src/theme/components/buttonGroup.ts +10 -0
- package/src/theme/components/card.ts +50 -15
- package/src/theme/components/componentWrapper.ts +5 -1
- package/src/theme/components/customTable.ts +8 -2
- package/src/theme/components/fieldset.ts +5 -1
- package/src/theme/components/helperErrorText.ts +5 -1
- package/src/theme/components/hero.ts +2 -2
- package/src/theme/components/horizontalRule.ts +5 -1
- package/src/theme/components/icon.ts +7 -1
- package/src/theme/components/image.ts +14 -3
- package/src/theme/components/label.ts +5 -1
- package/src/theme/components/list.ts +8 -2
- package/src/theme/components/logo.ts +5 -1
- package/src/theme/components/notification.ts +38 -14
- package/src/theme/components/progressIndicator.ts +10 -5
- package/src/theme/components/select.ts +5 -2
- package/src/theme/components/skeletonLoader.ts +8 -2
- package/src/theme/components/skipNavigation.ts +26 -0
- package/src/theme/components/slider.ts +13 -1
- package/src/theme/components/structuredContent.ts +11 -1
- package/src/theme/components/text.ts +12 -5
- package/src/theme/components/toggle.ts +9 -3
- package/src/theme/index.ts +4 -0
- package/src/theme/provider.tsx +1 -1
- package/src/utils/componentCategories.ts +13 -5
- package/src/utils/interfaces.ts +5 -0
- package/src/utils/utils.ts +2 -32
- package/dist/components/Accordion/AccordionTypes.d.ts +0 -5
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +0 -8
- package/dist/components/Button/ButtonTypes.d.ts +0 -8
- package/dist/components/DatePicker/DatePickerTypes.d.ts +0 -5
- package/dist/components/Form/FormTypes.d.ts +0 -2
- package/dist/components/Grid/GridTypes.d.ts +0 -9
- package/dist/components/Heading/HeadingTypes.d.ts +0 -14
- package/dist/components/Hero/HeroTypes.d.ts +0 -12
- package/dist/components/Icons/IconTypes.d.ts +0 -77
- package/dist/components/Image/ImageTypes.d.ts +0 -22
- package/dist/components/Link/LinkTypes.d.ts +0 -8
- package/dist/components/List/ListTypes.d.ts +0 -5
- package/dist/components/Logo/LogoTypes.d.ts +0 -54
- package/dist/components/Notification/NotificationTypes.d.ts +0 -5
- package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +0 -8
- package/dist/components/Select/SelectTypes.d.ts +0 -8
- package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +0 -5
- package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +0 -5
- package/dist/components/StructuredContent/StructuredContentTypes.d.ts +0 -5
- package/dist/components/Text/TextTypes.d.ts +0 -6
- package/dist/components/TextInput/TextInputTypes.d.ts +0 -25
- package/dist/components/Toggle/ToggleTypes.d.ts +0 -4
- package/dist/components/VideoPlayer/VideoPlayerTypes.d.ts +0 -9
- package/dist/helpers/enums.d.ts +0 -4
- package/dist/utils/siteSections.d.ts +0 -2
- package/src/components/Accordion/AccordionTypes.tsx +0 -5
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +0 -8
- package/src/components/Button/ButtonTypes.tsx +0 -8
- package/src/components/DatePicker/DatePickerTypes.tsx +0 -5
- package/src/components/Form/FormTypes.tsx +0 -3
- package/src/components/Grid/GridTypes.tsx +0 -9
- package/src/components/Heading/HeadingTypes.tsx +0 -15
- package/src/components/Hero/HeroTypes.tsx +0 -20
- package/src/components/Icons/IconTypes.tsx +0 -83
- package/src/components/Image/ImageTypes.ts +0 -24
- package/src/components/Link/LinkTypes.tsx +0 -8
- package/src/components/List/ListTypes.tsx +0 -5
- package/src/components/Logo/LogoTypes.tsx +0 -56
- package/src/components/Notification/NotificationTypes.tsx +0 -5
- package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +0 -8
- package/src/components/Select/SelectTypes.tsx +0 -10
- package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +0 -5
- package/src/components/StatusBadge/StatusBadgeTypes.tsx +0 -5
- package/src/components/StructuredContent/StructuredContentTypes.tsx +0 -5
- package/src/components/Text/TextTypes.tsx +0 -6
- package/src/components/TextInput/TextInputTypes.tsx +0 -48
- package/src/components/Toggle/ToggleTypes.tsx +0 -4
- package/src/components/VideoPlayer/VideoPlayerTypes.tsx +0 -10
- package/src/helpers/enums.ts +0 -4
- package/src/utils/siteSections.ts +0 -10
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
interface CustomSliderBaseStyle {
|
|
2
|
+
isDisabled: boolean;
|
|
3
|
+
isInvalid: boolean;
|
|
4
|
+
showBoxes: boolean;
|
|
5
|
+
showValues: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
1
8
|
// Margins around the static display values.
|
|
2
9
|
const staticValues = {
|
|
3
10
|
marginTop: "xs",
|
|
@@ -16,7 +23,12 @@ const CustomSlider = {
|
|
|
16
23
|
"track",
|
|
17
24
|
"thumb",
|
|
18
25
|
],
|
|
19
|
-
baseStyle: ({
|
|
26
|
+
baseStyle: ({
|
|
27
|
+
isDisabled,
|
|
28
|
+
isInvalid,
|
|
29
|
+
showBoxes,
|
|
30
|
+
showValues,
|
|
31
|
+
}: CustomSliderBaseStyle) => {
|
|
20
32
|
let baseColor = "ui.link.primary";
|
|
21
33
|
if (isInvalid) {
|
|
22
34
|
baseColor = "ui.error.primary";
|
|
@@ -9,9 +9,19 @@ import {
|
|
|
9
9
|
baseUnorderedStyles,
|
|
10
10
|
} from "./list";
|
|
11
11
|
|
|
12
|
+
interface StructuredContentBaseStyle {
|
|
13
|
+
hasFigureImage: boolean;
|
|
14
|
+
imageAspectRatio: string;
|
|
15
|
+
imagePosition: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
12
18
|
const StructuredContent = {
|
|
13
19
|
parts: ["image", "imageFigure", "imageWrapper"],
|
|
14
|
-
baseStyle: ({
|
|
20
|
+
baseStyle: ({
|
|
21
|
+
hasFigureImage,
|
|
22
|
+
imageAspectRatio,
|
|
23
|
+
imagePosition,
|
|
24
|
+
}: StructuredContentBaseStyle) => {
|
|
15
25
|
const styles: { maxWidth?: string } = {};
|
|
16
26
|
const wrapperStyles = {
|
|
17
27
|
float: [
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
interface TextBaseStyle {
|
|
2
|
+
isBold: boolean;
|
|
3
|
+
isItalic: boolean;
|
|
4
|
+
noSpace: boolean;
|
|
5
|
+
variant: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
1
8
|
const variants = {
|
|
2
9
|
default: {},
|
|
3
10
|
caption: {
|
|
@@ -11,18 +18,18 @@ const variants = {
|
|
|
11
18
|
},
|
|
12
19
|
};
|
|
13
20
|
const Text = {
|
|
14
|
-
baseStyle: (
|
|
15
|
-
const fontWeight =
|
|
16
|
-
?
|
|
21
|
+
baseStyle: ({ isBold, isItalic, noSpace, variant }: TextBaseStyle) => {
|
|
22
|
+
const fontWeight = isBold
|
|
23
|
+
? variant === "tag" || variant === "mini"
|
|
17
24
|
? "medium"
|
|
18
25
|
: "bold"
|
|
19
26
|
: null;
|
|
20
|
-
const fontStyle =
|
|
27
|
+
const fontStyle = isItalic ? "italic" : null;
|
|
21
28
|
|
|
22
29
|
return {
|
|
23
30
|
fontStyle: fontStyle,
|
|
24
31
|
fontWeight: fontWeight,
|
|
25
|
-
marginBottom:
|
|
32
|
+
marginBottom: noSpace ? "0 !important" : null,
|
|
26
33
|
};
|
|
27
34
|
},
|
|
28
35
|
variants,
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { cssVar } from "@chakra-ui/theme-tools";
|
|
2
|
-
import { ToggleSizes } from "../../components/Toggle/ToggleTypes";
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
import { ToggleSizes } from "../../components/Toggle/Toggle";
|
|
4
|
+
|
|
5
|
+
interface ToggleBaseStyle {
|
|
6
|
+
isDisabled: boolean;
|
|
7
|
+
size: ToggleSizes;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const toggleBaseStyle = ({ isDisabled, size }: ToggleBaseStyle) => {
|
|
5
11
|
const label = { alignItems: "start", display: "flex", width: "fit-content" };
|
|
6
12
|
const helperErrorText = {
|
|
7
|
-
marginLeft: size ===
|
|
13
|
+
marginLeft: size === "default" ? "xxl" : "xl",
|
|
8
14
|
fontStyle: isDisabled ? "italic" : null,
|
|
9
15
|
};
|
|
10
16
|
return {
|
package/src/theme/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ import typography from "./foundations/typography";
|
|
|
11
11
|
import Accordion from "./components/accordion";
|
|
12
12
|
import Breadcrumb from "./components/breadcrumb";
|
|
13
13
|
import Button from "./components/button";
|
|
14
|
+
import ButtonGroup from "./components/buttonGroup";
|
|
14
15
|
import Card from "./components/card";
|
|
15
16
|
import Checkbox from "./components/checkbox";
|
|
16
17
|
import ComponentWrapper from "./components/componentWrapper";
|
|
@@ -35,6 +36,7 @@ import Radio from "./components/radio";
|
|
|
35
36
|
import RadioGroup from "./components/radioGroup";
|
|
36
37
|
import SearchBar from "./components/searchBar";
|
|
37
38
|
import { Skeleton, SkeletonLoader } from "./components/skeletonLoader";
|
|
39
|
+
import SkipNavigation from "./components/skipNavigation";
|
|
38
40
|
import CustomSlider from "./components/slider";
|
|
39
41
|
import StatusBadge from "./components/statusBadge";
|
|
40
42
|
import StructuredContent from "./components/structuredContent";
|
|
@@ -80,6 +82,7 @@ const theme = extendTheme({
|
|
|
80
82
|
Accordion,
|
|
81
83
|
Breadcrumb,
|
|
82
84
|
Button,
|
|
85
|
+
ButtonGroup,
|
|
83
86
|
...Card,
|
|
84
87
|
Checkbox,
|
|
85
88
|
CheckboxGroup,
|
|
@@ -106,6 +109,7 @@ const theme = extendTheme({
|
|
|
106
109
|
SearchBar,
|
|
107
110
|
Skeleton,
|
|
108
111
|
SkeletonLoader,
|
|
112
|
+
SkipNavigation,
|
|
109
113
|
CustomSlider,
|
|
110
114
|
StatusBadge,
|
|
111
115
|
StructuredContent,
|
package/src/theme/provider.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { ChakraProvider } from "@chakra-ui/react";
|
|
3
3
|
import theme from "./index";
|
|
4
4
|
|
|
5
|
-
const DSProvider = ({ children }) => (
|
|
5
|
+
const DSProvider = ({ children }: React.PropsWithChildren<{}>) => (
|
|
6
6
|
<ChakraProvider theme={theme}>{children}</ChakraProvider>
|
|
7
7
|
);
|
|
8
8
|
|
|
@@ -53,6 +53,7 @@ const categories = {
|
|
|
53
53
|
title: "Components/Form Elements",
|
|
54
54
|
components: [
|
|
55
55
|
"Button",
|
|
56
|
+
"ButtonGroup",
|
|
56
57
|
"Checkbox",
|
|
57
58
|
"CheckboxGroup",
|
|
58
59
|
"DatePicker",
|
|
@@ -108,7 +109,14 @@ const categories = {
|
|
|
108
109
|
},
|
|
109
110
|
navigation: {
|
|
110
111
|
title: "Components/Navigation",
|
|
111
|
-
components: [
|
|
112
|
+
components: [
|
|
113
|
+
"Breadcrumbs",
|
|
114
|
+
"Link",
|
|
115
|
+
"Menu",
|
|
116
|
+
"Pagination",
|
|
117
|
+
"SkipNavigation",
|
|
118
|
+
"Subnavigation",
|
|
119
|
+
],
|
|
112
120
|
},
|
|
113
121
|
styleguide: {
|
|
114
122
|
title: "Style Guide",
|
|
@@ -131,11 +139,11 @@ const categories = {
|
|
|
131
139
|
},
|
|
132
140
|
};
|
|
133
141
|
|
|
134
|
-
export const getCategory = (component) => {
|
|
142
|
+
export const getCategory = (component: string) => {
|
|
135
143
|
let catPath = component;
|
|
136
|
-
Object.keys(categories).forEach((key) => {
|
|
137
|
-
const t = categories[key].title;
|
|
138
|
-
const c = categories[key].components;
|
|
144
|
+
Object.keys(categories).forEach((key: string) => {
|
|
145
|
+
const t = categories[key as keyof typeof categories].title;
|
|
146
|
+
const c = categories[key as keyof typeof categories].components;
|
|
139
147
|
if (c.includes(component)) {
|
|
140
148
|
catPath = `${t}/${component}`;
|
|
141
149
|
}
|
package/src/utils/utils.ts
CHANGED
|
@@ -15,43 +15,13 @@ export const range = (start: number, stop: number, step = 1): number[] => {
|
|
|
15
15
|
.map((x, y) => x + y * step);
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Map an enum value to a component's Chakra theme variant object. If a wrong
|
|
20
|
-
* value is passed (typically in non-Typescript scenarios), then the "fallback"
|
|
21
|
-
* value, if provided, will be used.
|
|
22
|
-
*/
|
|
23
|
-
export const getVariant = (variant, collection, fallback = null) => {
|
|
24
|
-
const variantMap = {};
|
|
25
|
-
for (const type in collection) {
|
|
26
|
-
variantMap[collection[type]] = collection[type];
|
|
27
|
-
}
|
|
28
|
-
return variantMap[variant] || fallback;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Given an enum object and its name, this will return (1) an array `options`
|
|
33
|
-
* of all values with the enum name as the prefix, and (2) a function that
|
|
34
|
-
* returns the correct enum value given a string from the `options` array.
|
|
35
|
-
* @NOTE this is only used for Storybook documentation.
|
|
36
|
-
*/
|
|
37
|
-
export const getStorybookEnumValues = (enumObject, name) => {
|
|
38
|
-
const options = Object.keys(enumObject).map((key) => `${name}.${key}`);
|
|
39
|
-
const getValue = (key) => {
|
|
40
|
-
// In case no value is passed, return the first value from the array above
|
|
41
|
-
// as the default. Otherwise, remove the dot from the string and get the
|
|
42
|
-
// last part to be able to get the correct enum value.
|
|
43
|
-
return !key ? options[0] : enumObject[key.substr(key.indexOf(".") + 1)];
|
|
44
|
-
};
|
|
45
|
-
return { options, getValue };
|
|
46
|
-
};
|
|
47
|
-
|
|
48
18
|
/**
|
|
49
19
|
* Given a pagination's pageCount, this will return (1) a page number,
|
|
50
20
|
* derived from the current URL, and (2) a function that, when passed to
|
|
51
21
|
* Pagination component, makes the URL change and refreshes the page.
|
|
52
22
|
* @NOTE this is only used for Storybook documentation.
|
|
53
23
|
*/
|
|
54
|
-
export const getStorybookHrefProps = (pageCount) => {
|
|
24
|
+
export const getStorybookHrefProps = (pageCount: number) => {
|
|
55
25
|
// This uses the `addon-queryparams` Storybook addon.
|
|
56
26
|
const urlParams = new URLSearchParams(document.location.search);
|
|
57
27
|
const pageParam = urlParams.get("page");
|
|
@@ -66,7 +36,7 @@ export const getStorybookHrefProps = (pageCount) => {
|
|
|
66
36
|
const location = window.location;
|
|
67
37
|
// Passing this function into `Pagination` makes the URL to change
|
|
68
38
|
// and refreshes the page.
|
|
69
|
-
const getPageHref = (selectedPage) => {
|
|
39
|
+
const getPageHref = (selectedPage: number) => {
|
|
70
40
|
return `${location.href}&page=${selectedPage}`;
|
|
71
41
|
};
|
|
72
42
|
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare enum HeadingSizes {
|
|
2
|
-
Primary = "primary",
|
|
3
|
-
Secondary = "secondary",
|
|
4
|
-
Tertiary = "tertiary",
|
|
5
|
-
Callout = "callout"
|
|
6
|
-
}
|
|
7
|
-
export declare enum HeadingLevels {
|
|
8
|
-
One = "one",
|
|
9
|
-
Two = "two",
|
|
10
|
-
Three = "three",
|
|
11
|
-
Four = "four",
|
|
12
|
-
Five = "five",
|
|
13
|
-
Six = "six"
|
|
14
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare enum HeroTypes {
|
|
2
|
-
Primary = "primary",
|
|
3
|
-
Secondary = "secondary",
|
|
4
|
-
SecondaryBooksAndMore = "secondaryBooksAndMore",
|
|
5
|
-
SecondaryLocations = "secondaryLocations",
|
|
6
|
-
SecondaryResearch = "secondaryResearch",
|
|
7
|
-
SecondaryWhatsOn = "secondaryWhatsOn",
|
|
8
|
-
Tertiary = "tertiary",
|
|
9
|
-
Campaign = "campaign",
|
|
10
|
-
FiftyFifty = "fiftyfifty"
|
|
11
|
-
}
|
|
12
|
-
export declare const HeroSecondaryTypes: HeroTypes[];
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
export declare enum IconAlign {
|
|
2
|
-
Left = "left",
|
|
3
|
-
Right = "right",
|
|
4
|
-
None = "none"
|
|
5
|
-
}
|
|
6
|
-
export declare enum IconTypes {
|
|
7
|
-
Default = "default",
|
|
8
|
-
Breadcrumbs = "breadcrumbs"
|
|
9
|
-
}
|
|
10
|
-
export declare enum IconRotationTypes {
|
|
11
|
-
Rotate0 = "rotate0",
|
|
12
|
-
Rotate90 = "rotate90",
|
|
13
|
-
Rotate180 = "rotate180",
|
|
14
|
-
Rotate270 = "rotate270"
|
|
15
|
-
}
|
|
16
|
-
export declare enum IconColors {
|
|
17
|
-
UiBlack = "ui.black",
|
|
18
|
-
UiWhite = "ui.white",
|
|
19
|
-
BrandPrimary = "brand.primary",
|
|
20
|
-
BrandSecondary = "brand.secondary",
|
|
21
|
-
SectionBlogsPrimary = "section.blogs.primary",
|
|
22
|
-
SectionBlogsSecondary = "section.blogs.secondary",
|
|
23
|
-
SectionBooksAndMorePrimary = "section.books-and-more.primary",
|
|
24
|
-
SectionBooksAndMoreSecondary = "section.books-and-more.secondary",
|
|
25
|
-
SectionEducationPrimary = "section.education.primary",
|
|
26
|
-
SectionEducationSecondary = "section.education.secondary",
|
|
27
|
-
SectionLocationsPrimary = "section.locations.primary",
|
|
28
|
-
SectionLocationsSecondary = "section.locations.secondary",
|
|
29
|
-
SectionResearchPrimary = "section.research.primary",
|
|
30
|
-
SectionResearchSecondary = "section.research.secondary",
|
|
31
|
-
SectionResearchLibraryLpa = "section.research-library.lpa",
|
|
32
|
-
SectionResearchLibrarySchomburg = "section.research-library.schomburg",
|
|
33
|
-
SectionResearchLibrarySchwartzman = "section.research-library.schwartzman",
|
|
34
|
-
SectionWhatsOnPrimary = "section.whats-on.primary",
|
|
35
|
-
SectionWhatsOnSecondary = "section.whats-on.secondary"
|
|
36
|
-
}
|
|
37
|
-
export declare enum IconSizes {
|
|
38
|
-
Default = "default",
|
|
39
|
-
Small = "small",
|
|
40
|
-
Medium = "medium",
|
|
41
|
-
Large = "large",
|
|
42
|
-
ExtraLarge = "xlarge",
|
|
43
|
-
ExtraExtraLarge = "xxlarge",
|
|
44
|
-
ExtraExtraExtraLarge = "xxxlarge"
|
|
45
|
-
}
|
|
46
|
-
export declare enum IconNames {
|
|
47
|
-
AccessibilityFull = "accessibility_full",
|
|
48
|
-
AccessibilityPartial = "accessibility_partial",
|
|
49
|
-
ActionCheckCircle = "action_check_circle",
|
|
50
|
-
ActionHelpDefault = "action_help_default",
|
|
51
|
-
ActionHelpOutline = "action_help_outline",
|
|
52
|
-
AlertNotificationImportant = "alert_notification_important",
|
|
53
|
-
ActionLaunch = "action_launch",
|
|
54
|
-
Arrow = "arrow",
|
|
55
|
-
Check = "check",
|
|
56
|
-
Clock = "clock",
|
|
57
|
-
Close = "close",
|
|
58
|
-
Download = "download",
|
|
59
|
-
ErrorFilled = "error_filled",
|
|
60
|
-
ErrorOutline = "error_outline",
|
|
61
|
-
FileTypeAudio = "file_type_audio",
|
|
62
|
-
FileTypeDoc = "file_type_doc",
|
|
63
|
-
FileTypeGenericDoc = "file_type_generic_doc",
|
|
64
|
-
FileTypeImage = "file_type_image",
|
|
65
|
-
FileTypePdf = "file_type_pdf",
|
|
66
|
-
FileTypeSpreadsheet = "file_type_spreadsheet",
|
|
67
|
-
FileTypeVideo = "file_type_video",
|
|
68
|
-
Headset = "headset",
|
|
69
|
-
Minus = "minus",
|
|
70
|
-
Plus = "plus",
|
|
71
|
-
Search = "search",
|
|
72
|
-
SpeakerNotes = "speaker_notes",
|
|
73
|
-
UtilityAccountFilled = "utility_account_filled",
|
|
74
|
-
UtilityAccountUnfilled = "utility_account_unfilled",
|
|
75
|
-
UtilityHamburger = "utility_hamburger",
|
|
76
|
-
UtilitySearch = "utility_search"
|
|
77
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare enum ImageRatios {
|
|
2
|
-
FourByThree = "fourByThree",
|
|
3
|
-
OneByTwo = "oneByTwo",
|
|
4
|
-
Original = "original",
|
|
5
|
-
SixteenByNine = "sixteenByNine",
|
|
6
|
-
Square = "square",
|
|
7
|
-
ThreeByFour = "threeByFour",
|
|
8
|
-
ThreeByTwo = "threeByTwo",
|
|
9
|
-
TwoByOne = "twoByOne"
|
|
10
|
-
}
|
|
11
|
-
export declare enum ImageSizes {
|
|
12
|
-
Default = "default",
|
|
13
|
-
ExtraExtraSmall = "xxsmall",
|
|
14
|
-
ExtraSmall = "xsmall",
|
|
15
|
-
Small = "small",
|
|
16
|
-
Medium = "medium",
|
|
17
|
-
Large = "large"
|
|
18
|
-
}
|
|
19
|
-
export declare enum ImageTypes {
|
|
20
|
-
Default = "default",
|
|
21
|
-
Circle = "circle"
|
|
22
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export declare enum LogoColors {
|
|
2
|
-
Default = "",
|
|
3
|
-
UiBlack = "ui.black",
|
|
4
|
-
UiWhite = "ui.white"
|
|
5
|
-
}
|
|
6
|
-
export declare enum LogoSizes {
|
|
7
|
-
Default = "default",
|
|
8
|
-
ExtraExtraSmall = "xxsmall",
|
|
9
|
-
ExtraSmall = "xsmall",
|
|
10
|
-
Small = "small",
|
|
11
|
-
Medium = "medium",
|
|
12
|
-
Large = "large"
|
|
13
|
-
}
|
|
14
|
-
export declare enum LogoNames {
|
|
15
|
-
BrooklynPublicLibraryBlack = "logo_bpl_black",
|
|
16
|
-
BrooklynPublicLibraryWhite = "logo_bpl_white",
|
|
17
|
-
CleverColor = "logo_clever_color",
|
|
18
|
-
CleverWhite = "logo_clever_white",
|
|
19
|
-
FirstBookColor = "logo_firstbook_color",
|
|
20
|
-
FirstBookColorNegative = "logo_firstbook_color_negative",
|
|
21
|
-
LPAColor = "logo_lpa_color",
|
|
22
|
-
LPABlack = "logo_lpa_black",
|
|
23
|
-
LPAWhite = "logo_lpa_white",
|
|
24
|
-
MyLibraryNYCBlack = "logo_mln_black",
|
|
25
|
-
MyLibraryNYCWhite = "logo_mln_white",
|
|
26
|
-
NYPLBlack = "logo_nypl_full_black",
|
|
27
|
-
NYPLWhite = "logo_nypl_full_white",
|
|
28
|
-
NYPLLionBlack = "logo_nypl_lion_black",
|
|
29
|
-
NYPLLionWhite = "logo_nypl_lion_white",
|
|
30
|
-
OpenEBooksColor = "logo_openebooks_color",
|
|
31
|
-
OpenEBooksNegative = "logo_openebooks_negative",
|
|
32
|
-
OpenEBooksWithTextColor = "logo_openebooks_wtext_color",
|
|
33
|
-
OpenEBooksWithTextNegative = "logo_openebooks_wtext_negative",
|
|
34
|
-
QueensPublicLibraryColor = "logo_qpl_color",
|
|
35
|
-
QueensPublicLibraryBlack = "logo_qpl_black",
|
|
36
|
-
QueensPublicLibraryWhite = "logo_qpl_white",
|
|
37
|
-
QueensPublicLibraryAltBlack = "logo_qpl_alt_black",
|
|
38
|
-
QueensPublicLibraryAltWhite = "logo_qpl_alt_white",
|
|
39
|
-
ReservoirIconColor = "logo_reservoir_icon_color",
|
|
40
|
-
ReservoirVerticalColor = "logo_reservoir_vertical_color",
|
|
41
|
-
SchomburgColor = "logo_schomburg_color",
|
|
42
|
-
SchomburgBlack = "logo_schomburg_black",
|
|
43
|
-
SchomburgWhite = "logo_schomburg_white",
|
|
44
|
-
SchomburgCircleColor = "logo_schomburg_circle_color",
|
|
45
|
-
SchomburgCircleBlack = "logo_schomburg_circle_black",
|
|
46
|
-
SchomburgCircleWhite = "logo_schomburg_circle_white",
|
|
47
|
-
SimplyEColor = "logo_simplye_color",
|
|
48
|
-
SimplyEBlack = "logo_simplye_black",
|
|
49
|
-
SimplyEWhite = "logo_simplye_white",
|
|
50
|
-
SNFLBlack = "logo_snfl_black",
|
|
51
|
-
SNFLWhite = "logo_snfl_white",
|
|
52
|
-
TreasuresColor = "logo_treasures_color",
|
|
53
|
-
TreasuresColorNegative = "logo_treasures_color_negative"
|
|
54
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export declare enum TextInputTypes {
|
|
2
|
-
email = "email",
|
|
3
|
-
hidden = "hidden",
|
|
4
|
-
number = "number",
|
|
5
|
-
password = "password",
|
|
6
|
-
text = "text",
|
|
7
|
-
textarea = "textarea",
|
|
8
|
-
tel = "tel",
|
|
9
|
-
url = "url"
|
|
10
|
-
}
|
|
11
|
-
export declare enum TextInputFormats {
|
|
12
|
-
email = "jdoe@domain.com",
|
|
13
|
-
hidden = "",
|
|
14
|
-
number = "",
|
|
15
|
-
password = "",
|
|
16
|
-
text = "",
|
|
17
|
-
tel = "(123) 123-1234",
|
|
18
|
-
textarea = "",
|
|
19
|
-
url = "https://domain.com"
|
|
20
|
-
}
|
|
21
|
-
export declare enum TextInputVariants {
|
|
22
|
-
Default = "default",
|
|
23
|
-
SearchBar = "searchBar",
|
|
24
|
-
SearchBarSelect = "searchBarSelect"
|
|
25
|
-
}
|
package/dist/helpers/enums.d.ts
DELETED