@nypl/design-system-react-components 0.23.4 → 0.25.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/CHANGELOG.md +98 -1
- package/README.md +46 -11
- package/dist/components/Accordion/Accordion.d.ts +14 -14
- package/dist/components/Autosuggest/Autosuggest.stories.d.ts +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +11 -14
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +6 -0
- package/dist/components/Button/Button.d.ts +6 -13
- package/dist/components/Button/ButtonTypes.d.ts +5 -3
- package/dist/components/Card/Card.d.ts +59 -10
- package/dist/components/Card/CardTypes.d.ts +19 -0
- package/dist/components/CardEdition/CardEdition.d.ts +21 -0
- package/dist/components/{StyleGuide/Colors.stories.d.ts → CardEdition/CardEdition.stories.d.ts} +5 -2
- package/dist/components/Checkbox/Checkbox.d.ts +21 -16
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +43 -0
- package/dist/components/CheckboxGroup/CheckboxGroupLayoutTypes.d.ts +4 -0
- package/dist/components/DatePicker/DatePicker.d.ts +79 -0
- package/dist/components/DatePicker/DatePickerTypes.d.ts +5 -0
- package/dist/components/Form/Form.d.ts +16 -8
- package/dist/components/Form/FormTypes.d.ts +2 -0
- package/dist/components/Grid/GridTypes.d.ts +9 -0
- package/dist/components/Grid/SimpleGrid.d.ts +14 -0
- package/dist/components/Heading/Heading.d.ts +9 -11
- package/dist/components/Heading/{HeadingDisplaySizes.d.ts → HeadingTypes.d.ts} +8 -0
- package/dist/components/HelperErrorText/HelperErrorText.stories.d.ts +2 -1
- package/dist/components/Hero/Hero.d.ts +19 -14
- package/dist/components/Hero/HeroTypes.d.ts +10 -5
- package/dist/components/Icons/Icon.d.ts +13 -16
- package/dist/components/Icons/IconSvgs.d.ts +4 -0
- package/dist/components/Icons/IconTypes.d.ts +78 -60
- package/dist/components/Image/Image.stories.d.ts +2 -1
- package/dist/components/Label/Label.d.ts +10 -26
- package/dist/components/Link/Link.d.ts +8 -12
- package/dist/components/List/List.stories.d.ts +1 -0
- package/dist/components/Radio/Radio.d.ts +30 -24
- package/dist/components/RadioGroup/RadioGroup.d.ts +40 -0
- package/dist/components/RadioGroup/RadioGroupLayoutTypes.d.ts +4 -0
- package/dist/components/SearchBar/SearchBar.d.ts +45 -27
- package/dist/components/Select/Select.d.ts +34 -35
- package/dist/components/Select/SelectTypes.d.ts +4 -0
- package/dist/components/SkeletonLoader/SkeletonLoader.d.ts +1 -1
- package/dist/components/SkeletonLoader/SkeletonLoaderTypes.d.ts +2 -2
- package/dist/components/StatusBadge/StatusBadge.d.ts +8 -6
- package/dist/components/StatusBadge/StatusBadgeTypes.d.ts +5 -0
- package/dist/components/Tabs/Tabs.d.ts +25 -0
- package/dist/components/Template/Template.d.ts +91 -0
- package/dist/components/Text/Text.d.ts +16 -0
- package/dist/components/Text/TextTypes.d.ts +6 -0
- package/dist/components/TextInput/TextInput.d.ts +37 -30
- package/dist/components/TextInput/TextInputTypes.d.ts +5 -0
- package/dist/design-system-react-components.cjs.development.js +4102 -917
- 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 +4023 -920
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +23 -5
- package/dist/resources.scss +133 -24
- package/dist/styles.css +1 -1
- package/dist/theme/components/accordion.d.ts +25 -0
- package/dist/theme/components/breadcrumb.d.ts +90 -0
- package/dist/theme/components/button.d.ts +109 -0
- package/dist/theme/components/checkbox.d.ts +91 -0
- package/dist/theme/components/customCheckboxGroup.d.ts +18 -0
- package/dist/theme/components/customRadioGroup.d.ts +18 -0
- package/dist/theme/components/global.d.ts +55 -0
- package/dist/theme/components/globalMixins.d.ts +15 -0
- package/dist/theme/components/heading.d.ts +110 -0
- package/dist/theme/components/hero.d.ts +492 -0
- package/dist/theme/components/icon.d.ts +13 -0
- package/dist/theme/components/label.d.ts +16 -0
- package/dist/theme/components/link.d.ts +45 -0
- package/dist/theme/components/radio.d.ts +95 -0
- package/dist/theme/components/searchBar.d.ts +20 -0
- package/dist/theme/components/select.d.ts +58 -0
- package/dist/theme/components/statusBadge.d.ts +25 -0
- package/dist/theme/components/tabs.d.ts +85 -0
- package/dist/theme/components/template.d.ts +105 -0
- package/dist/theme/components/text.d.ts +20 -0
- package/dist/theme/components/textInput.d.ts +105 -0
- package/dist/theme/foundations/breakpoints.d.ts +23 -0
- package/dist/theme/foundations/colors.d.ts +3 -0
- package/dist/theme/foundations/global.d.ts +23 -0
- package/dist/theme/foundations/shadows.d.ts +4 -0
- package/dist/theme/foundations/spacing.d.ts +77 -0
- package/dist/theme/foundations/typography.d.ts +8 -0
- package/dist/theme/index.d.ts +20 -0
- package/dist/theme/provider.d.ts +5 -0
- package/dist/theme/types.d.ts +1 -0
- package/dist/utils/utils.d.ts +6 -0
- package/package.json +9 -2
- package/src/components/Accordion/Accordion.stories.mdx +233 -33
- package/src/components/Accordion/Accordion.test.tsx +135 -19
- package/src/components/Accordion/Accordion.tsx +81 -56
- package/src/components/Autosuggest/Autosuggest.stories.mdx +4 -3
- package/src/components/Autosuggest/Autosuggest.stories.tsx +1 -1
- package/src/components/Autosuggest/_Autosuggest.scss +2 -2
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +57 -56
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +31 -25
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +71 -73
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +6 -0
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +100 -0
- package/src/components/Button/Button.stories.mdx +125 -138
- package/src/components/Button/Button.test.tsx +65 -11
- package/src/components/Button/Button.tsx +72 -68
- package/src/components/Button/ButtonTypes.tsx +4 -2
- package/src/components/Button/_Button.scss +7 -92
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +58 -3
- package/src/components/Card/Card.stories.mdx +694 -0
- package/src/components/Card/Card.test.tsx +97 -102
- package/src/components/Card/Card.tsx +182 -31
- package/src/components/Card/CardTypes.tsx +21 -0
- package/src/components/Card/_Card.scss +234 -49
- package/src/components/{Card/Card.stories.tsx → CardEdition/CardEdition.stories.tsx} +32 -22
- package/src/components/CardEdition/CardEdition.test.tsx +395 -0
- package/src/components/CardEdition/CardEdition.tsx +60 -0
- package/src/components/CardEdition/_CardEdition.scss +138 -0
- package/src/components/Chakra/Box.stories.mdx +57 -0
- package/src/components/Chakra/Center.stories.mdx +99 -0
- package/src/components/Chakra/Grid.stories.mdx +79 -0
- package/src/components/Chakra/Stack.stories.mdx +93 -0
- package/src/components/Checkbox/Checkbox.stories.mdx +57 -35
- package/src/components/Checkbox/Checkbox.test.tsx +117 -147
- package/src/components/Checkbox/Checkbox.tsx +76 -50
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +325 -0
- package/src/components/CheckboxGroup/CheckboxGroup.stories.mdx +249 -0
- package/src/components/CheckboxGroup/CheckboxGroup.test.tsx +345 -0
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +148 -0
- package/src/components/CheckboxGroup/CheckboxGroupLayoutTypes.tsx +4 -0
- package/src/components/CheckboxGroup/__snapshots__/CheckboxGroup.test.tsx.snap +1360 -0
- package/src/components/DatePicker/DatePicker.stories.mdx +284 -0
- package/src/components/DatePicker/DatePicker.test.tsx +657 -0
- package/src/components/DatePicker/DatePicker.tsx +396 -0
- package/src/components/DatePicker/DatePickerTypes.tsx +5 -0
- package/src/components/DatePicker/_DatePicker.scss +76 -0
- package/src/components/Form/Form.stories.mdx +130 -27
- package/src/components/Form/Form.test.tsx +78 -36
- package/src/components/Form/Form.tsx +53 -19
- package/src/components/Form/FormTypes.tsx +3 -0
- package/src/components/Form/__snapshots__/Form.test.tsx.snap +38 -0
- package/src/components/Grid/GridTypes.tsx +9 -0
- package/src/components/Grid/SimpleGrid.stories.mdx +275 -0
- package/src/components/Grid/SimpleGrid.test.tsx +66 -0
- package/src/components/Grid/SimpleGrid.tsx +37 -0
- package/src/components/Grid/__snapshots__/SimpleGrid.test.tsx.snap +8 -0
- package/src/components/Heading/Heading.stories.mdx +63 -33
- package/src/components/Heading/Heading.test.tsx +24 -16
- package/src/components/Heading/Heading.tsx +54 -38
- package/src/components/Heading/{HeadingDisplaySizes.tsx → HeadingTypes.tsx} +9 -0
- package/src/components/HelperErrorText/HelperErrorText.stories.tsx +2 -1
- package/src/components/HelperErrorText/_HelperErrorText.scss +1 -1
- package/src/components/Hero/Hero.stories.mdx +195 -85
- package/src/components/Hero/Hero.test.tsx +544 -113
- package/src/components/Hero/Hero.tsx +80 -93
- package/src/components/Hero/HeroTypes.tsx +17 -5
- package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +307 -0
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +6 -1
- package/src/components/HorizontalRule/_HorizontalRule.scss +1 -1
- package/src/components/Icons/Icon.stories.mdx +89 -74
- package/src/components/Icons/Icon.test.tsx +30 -22
- package/src/components/Icons/Icon.tsx +63 -61
- package/src/components/Icons/IconSvgs.tsx +8 -0
- package/src/components/Icons/IconTypes.tsx +80 -60
- package/src/components/Image/Image.stories.tsx +2 -1
- package/src/components/Input/_Input.scss +2 -2
- package/src/components/Label/Label.stories.mdx +77 -0
- package/src/components/Label/Label.test.tsx +43 -12
- package/src/components/Label/Label.tsx +28 -45
- package/src/components/Label/__snapshots__/Label.test.tsx.snap +41 -0
- package/src/components/Link/Link.stories.mdx +47 -41
- package/src/components/Link/Link.test.tsx +33 -44
- package/src/components/Link/Link.tsx +114 -100
- package/src/components/List/List.stories.mdx +7 -3
- package/src/components/List/List.stories.tsx +14 -9
- package/src/components/List/List.test.tsx +12 -8
- package/src/components/List/List.tsx +9 -7
- package/src/components/List/_List.scss +3 -3
- package/src/components/Modal/Modal.stories.mdx +7 -3
- package/src/components/Modal/_Modal.scss +1 -1
- package/src/components/Notification/Notification.stories.mdx +99 -65
- package/src/components/Notification/Notification.test.tsx +3 -16
- package/src/components/Notification/Notification.tsx +12 -12
- package/src/components/Notification/_Notification.scss +5 -4
- package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +1 -1
- package/src/components/Pagination/Pagination.stories.mdx +7 -1
- package/src/components/Pagination/Pagination.test.tsx +16 -10
- package/src/components/Radio/Radio.stories.mdx +57 -46
- package/src/components/Radio/Radio.test.tsx +92 -138
- package/src/components/Radio/Radio.tsx +70 -69
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +250 -0
- package/src/components/RadioGroup/RadioGroup.stories.mdx +247 -0
- package/src/components/RadioGroup/RadioGroup.test.tsx +327 -0
- package/src/components/RadioGroup/RadioGroup.tsx +154 -0
- package/src/components/RadioGroup/RadioGroupLayoutTypes.tsx +4 -0
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +1101 -0
- package/src/components/SearchBar/SearchBar.Test.tsx +151 -16
- package/src/components/SearchBar/SearchBar.stories.mdx +196 -224
- package/src/components/SearchBar/SearchBar.tsx +151 -46
- package/src/components/Select/Select.stories.mdx +193 -168
- package/src/components/Select/Select.test.tsx +129 -324
- package/src/components/Select/Select.tsx +120 -160
- package/src/components/Select/SelectTypes.tsx +4 -0
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +18 -29
- package/src/components/SkeletonLoader/SkeletonLoader.test.tsx +7 -7
- package/src/components/SkeletonLoader/SkeletonLoader.tsx +4 -2
- package/src/components/SkeletonLoader/SkeletonLoaderTypes.tsx +2 -2
- package/src/components/SkeletonLoader/_SkeletonLoader.scss +3 -3
- package/src/components/StatusBadge/StatusBadge.stories.mdx +91 -0
- package/src/components/StatusBadge/StatusBadge.test.tsx +35 -7
- package/src/components/StatusBadge/StatusBadge.tsx +24 -25
- package/src/components/StatusBadge/StatusBadgeTypes.tsx +5 -0
- package/src/components/StatusBadge/__snapshots__/StatusBadge.test.tsx.snap +28 -0
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +112 -90
- package/src/components/StyleGuide/Buttons.stories.mdx +98 -100
- package/src/components/StyleGuide/Colors.stories.mdx +336 -0
- package/src/components/StyleGuide/Forms.stories.mdx +85 -0
- package/src/components/StyleGuide/Iconography.stories.mdx +86 -93
- package/src/components/StyleGuide/Spacing.stories.mdx +0 -1
- package/src/components/StyleGuide/Typography.stories.mdx +164 -166
- package/src/components/StyleGuide/UIDocCard.tsx +4 -4
- package/src/components/Tabs/Tabs.stories.mdx +221 -0
- package/src/components/Tabs/Tabs.test.tsx +264 -0
- package/src/components/Tabs/Tabs.tsx +220 -0
- package/src/components/Template/Template.stories.mdx +574 -0
- package/src/components/Template/Template.test.tsx +124 -0
- package/src/components/Template/Template.tsx +226 -0
- package/src/components/Text/Text.stories.mdx +70 -0
- package/src/components/Text/Text.test.tsx +63 -0
- package/src/components/Text/Text.tsx +55 -0
- package/src/components/Text/TextTypes.tsx +6 -0
- package/src/components/Text/__snapshots__/Text.test.tsx.snap +33 -0
- package/src/components/TextInput/TextInput.stories.mdx +90 -90
- package/src/components/TextInput/TextInput.test.tsx +103 -83
- package/src/components/TextInput/TextInput.tsx +108 -91
- package/src/components/TextInput/TextInputTypes.tsx +6 -0
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +2 -1
- package/src/components/VideoPlayer/VideoPlayer.tsx +4 -2
- package/src/components/VideoPlayer/_VideoPlayer.scss +1 -1
- package/src/docs/Chakra.stories.mdx +341 -0
- package/src/docs/Intro.stories.mdx +31 -24
- package/src/index.ts +70 -5
- package/src/styles/01-colors/_colors-brand.scss +6 -4
- package/src/styles/01-colors/_colors-utility.scss +14 -15
- package/src/styles/03-space/_space-inline.scss +47 -7
- package/src/styles/03-space/_space-inset.scss +33 -5
- package/src/styles/03-space/_space-stack.scss +48 -8
- package/src/styles/base/_02-breakpoints.scss +5 -4
- package/src/styles/base/_04-base.scss +2 -1
- package/src/styles/base/_place-holder.scss +1 -1
- package/src/styles/base/_typography.scss +1 -29
- package/src/styles.scss +22 -25
- package/src/theme/components/accordion.ts +30 -0
- package/src/theme/components/breadcrumb.ts +77 -0
- package/src/theme/components/button.ts +125 -0
- package/src/theme/components/checkbox.ts +107 -0
- package/src/theme/components/customCheckboxGroup.ts +12 -0
- package/src/theme/components/customRadioGroup.ts +12 -0
- package/src/theme/components/global.ts +71 -0
- package/src/theme/components/globalMixins.ts +16 -0
- package/src/theme/components/heading.ts +72 -0
- package/src/theme/components/hero.ts +239 -0
- package/src/theme/components/icon.ts +79 -0
- package/src/theme/components/label.ts +17 -0
- package/src/theme/components/link.ts +47 -0
- package/src/theme/components/radio.ts +106 -0
- package/src/theme/components/searchBar.ts +21 -0
- package/src/theme/components/select.ts +50 -0
- package/src/theme/components/statusBadge.ts +27 -0
- package/src/theme/components/tabs.ts +79 -0
- package/src/theme/components/template.ts +114 -0
- package/src/theme/components/text.ts +31 -0
- package/src/theme/components/textInput.ts +61 -0
- package/src/theme/foundations/breakpoints.ts +24 -0
- package/src/theme/foundations/colors.ts +208 -0
- package/src/theme/foundations/global.ts +26 -0
- package/src/theme/foundations/shadows.ts +5 -0
- package/src/theme/foundations/spacing.ts +85 -0
- package/src/theme/foundations/typography.ts +35 -0
- package/src/theme/index.ts +88 -0
- package/src/theme/provider.tsx +9 -0
- package/src/theme/types.ts +1 -0
- package/src/utils/componentCategories.ts +56 -21
- package/src/utils/utils.ts +13 -0
- package/dist/components/Accordion/Accordion.stories.d.ts +0 -5
- package/dist/components/Card/Card.stories.d.ts +0 -27
- package/dist/components/Label/Label.stories.d.ts +0 -12
- package/dist/components/StatusBadge/StatusBadge.stories.d.ts +0 -8
- package/dist/components/Template/Template.stories.d.ts +0 -29
- package/src/components/Accordion/Accordion.stories.tsx +0 -65
- package/src/components/Accordion/_Accordion.scss +0 -81
- package/src/components/Breadcrumbs/_Breadcrumbs.scss +0 -97
- package/src/components/Checkbox/_Checkbox.scss +0 -97
- package/src/components/Form/_Form.scss +0 -28
- package/src/components/Heading/_Heading.scss +0 -163
- package/src/components/Hero/_Hero.scss +0 -256
- package/src/components/Icons/_Icons.scss +0 -116
- package/src/components/Label/Label.stories.tsx +0 -30
- package/src/components/Label/_Label.scss +0 -22
- package/src/components/Link/_Link.scss +0 -73
- package/src/components/Radio/_Radio.scss +0 -84
- package/src/components/SearchBar/_SearchBar.scss +0 -16
- package/src/components/Select/_Select.scss +0 -82
- package/src/components/StatusBadge/StatusBadge.stories.tsx +0 -33
- package/src/components/StatusBadge/_StatusBadge.scss +0 -23
- package/src/components/StyleGuide/Colors.stories.tsx +0 -288
- package/src/components/Template/Template.stories.tsx +0 -85
- package/src/components/Template/_Template.scss +0 -63
- package/src/components/TextInput/_TextInput.scss +0 -59
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Variant styling
|
|
2
|
+
const booksAndMore = {
|
|
3
|
+
bg: "section.books-and-more.secondary",
|
|
4
|
+
};
|
|
5
|
+
const locations = {
|
|
6
|
+
bg: "section.locations.secondary",
|
|
7
|
+
};
|
|
8
|
+
const research = {
|
|
9
|
+
bg: "section.research.secondary",
|
|
10
|
+
};
|
|
11
|
+
const whatsOn = {
|
|
12
|
+
bg: "section.whats-on.secondary",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const Breadcrumb = {
|
|
16
|
+
baseStyle: {
|
|
17
|
+
bg: "ui.black",
|
|
18
|
+
color: "ui.white",
|
|
19
|
+
fontSize: "-1",
|
|
20
|
+
fontWeight: "regular",
|
|
21
|
+
paddingBottom: "xs",
|
|
22
|
+
paddingTop: "xs",
|
|
23
|
+
ol: {
|
|
24
|
+
alignItems: { base: "center", md: "unset" },
|
|
25
|
+
display: { base: "flex", md: "block" },
|
|
26
|
+
margin: "auto",
|
|
27
|
+
maxWidth: "1280px",
|
|
28
|
+
paddingLeft: "s",
|
|
29
|
+
paddingRight: "s",
|
|
30
|
+
},
|
|
31
|
+
a: {
|
|
32
|
+
_hover: {
|
|
33
|
+
color: "ui.gray.light-cool",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
"li:last-child": {
|
|
37
|
+
fontWeight: { base: "regular", md: "bold" },
|
|
38
|
+
".chakra-breadcrumb__link": {
|
|
39
|
+
_hover: {
|
|
40
|
+
cursor: "default",
|
|
41
|
+
textDecoration: "none",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
".icon": {
|
|
45
|
+
display: "none",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
"li:not(:last-child)": {
|
|
49
|
+
display: { base: "none", md: "inline-block" },
|
|
50
|
+
a: {
|
|
51
|
+
marginRight: { base: "xs", md: "0" },
|
|
52
|
+
},
|
|
53
|
+
".icon": {
|
|
54
|
+
display: { base: "inline", md: "none" },
|
|
55
|
+
},
|
|
56
|
+
"span:not(.breadcrumb-label)": {
|
|
57
|
+
marginInlineEnd: "xxs",
|
|
58
|
+
marginInlineStart: "xxs",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
"li:nth-last-child(2)": {
|
|
62
|
+
display: "inline-block",
|
|
63
|
+
span: {
|
|
64
|
+
display: { base: "none", md: "inline" },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
// Available variants:
|
|
69
|
+
variants: {
|
|
70
|
+
booksAndMore,
|
|
71
|
+
locations,
|
|
72
|
+
research,
|
|
73
|
+
whatsOn,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export default Breadcrumb;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// Style object for base or default style
|
|
2
|
+
const baseStyle = {
|
|
3
|
+
borderRadius: "2px",
|
|
4
|
+
lineHeight: "1.5",
|
|
5
|
+
display: "flex",
|
|
6
|
+
cursor: "pointer",
|
|
7
|
+
color: "ui.white",
|
|
8
|
+
justifyContent: "center",
|
|
9
|
+
py: "xs",
|
|
10
|
+
px: "s",
|
|
11
|
+
textDecoration: "none",
|
|
12
|
+
wordWrap: "normal",
|
|
13
|
+
svg: {
|
|
14
|
+
fill: "currentColor",
|
|
15
|
+
marginTop: "xxs",
|
|
16
|
+
},
|
|
17
|
+
_hover: {
|
|
18
|
+
bg: "ui.link.secondary",
|
|
19
|
+
},
|
|
20
|
+
_visited: {
|
|
21
|
+
color: "ui.white",
|
|
22
|
+
},
|
|
23
|
+
_disabled: {
|
|
24
|
+
bg: "ui.gray.light-cool",
|
|
25
|
+
color: "ui.gray.dark",
|
|
26
|
+
pointerEvents: "none",
|
|
27
|
+
opacity: "1",
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
// Styles for different "lg" size
|
|
31
|
+
const sizes = {
|
|
32
|
+
lg: {
|
|
33
|
+
width: "150px",
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
// Styles for different visual variants:
|
|
37
|
+
// primary, secondary, link, pill, icon-only, callout
|
|
38
|
+
const primary = {
|
|
39
|
+
bg: "ui.link.primary",
|
|
40
|
+
minWidth: "none",
|
|
41
|
+
height: "none",
|
|
42
|
+
};
|
|
43
|
+
const secondary = {
|
|
44
|
+
bg: "ui.white",
|
|
45
|
+
border: "1px solid",
|
|
46
|
+
borderColor: "ui.gray.light-cool",
|
|
47
|
+
color: "inherit",
|
|
48
|
+
_hover: {
|
|
49
|
+
bg: "ui.gray.xx-light-cool",
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
const link = {
|
|
53
|
+
bg: "transparent",
|
|
54
|
+
lineHeight: "2.5",
|
|
55
|
+
color: "ui.link.primary",
|
|
56
|
+
textDecoration: "underline",
|
|
57
|
+
_disabled: {
|
|
58
|
+
bg: "transparent",
|
|
59
|
+
},
|
|
60
|
+
_hover: {
|
|
61
|
+
bg: "transparent",
|
|
62
|
+
color: "ui.link.secondary",
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
const pill = {
|
|
66
|
+
bg: "ui.white",
|
|
67
|
+
border: "1px solid",
|
|
68
|
+
borderColor: "ui.gray.light-cool",
|
|
69
|
+
color: "inherit",
|
|
70
|
+
borderRadius: "20px",
|
|
71
|
+
py: "xs",
|
|
72
|
+
paddingInlineStart: "m",
|
|
73
|
+
paddingInlineEnd: "m",
|
|
74
|
+
_hover: {
|
|
75
|
+
bg: "ui.gray.xx-light-cool",
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
const iconOnly = {
|
|
79
|
+
bg: "ui.white",
|
|
80
|
+
border: "1px solid",
|
|
81
|
+
borderColor: "ui.gray.light-cool",
|
|
82
|
+
color: "inherit",
|
|
83
|
+
_hover: {
|
|
84
|
+
bg: "ui.gray.xx-light-cool",
|
|
85
|
+
},
|
|
86
|
+
paddingInlineStart: "xs",
|
|
87
|
+
paddingInlineEnd: "xs",
|
|
88
|
+
};
|
|
89
|
+
const callout = {
|
|
90
|
+
bg: "brand.primary",
|
|
91
|
+
_hover: {
|
|
92
|
+
bg: "brand.secondary",
|
|
93
|
+
},
|
|
94
|
+
_active: {
|
|
95
|
+
bg: "brand.secondary",
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
const searchBar = {
|
|
99
|
+
...primary,
|
|
100
|
+
borderLeftRadius: "0",
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const Button = {
|
|
104
|
+
baseStyle,
|
|
105
|
+
sizes,
|
|
106
|
+
// Available variants:
|
|
107
|
+
// primary, secondary, link, pill, icon-only, searchBar
|
|
108
|
+
variants: {
|
|
109
|
+
primary,
|
|
110
|
+
secondary,
|
|
111
|
+
link,
|
|
112
|
+
pill,
|
|
113
|
+
["icon-only"]: iconOnly,
|
|
114
|
+
callout,
|
|
115
|
+
searchBar,
|
|
116
|
+
},
|
|
117
|
+
// Default values
|
|
118
|
+
defaultProps: {
|
|
119
|
+
size: "md",
|
|
120
|
+
variant: "primary",
|
|
121
|
+
colorScheme: "blue",
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export default Button;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// @see https://github.com/chakra-ui/chakra-ui/blob/main/packages/theme/src/components/checkbox.ts
|
|
2
|
+
// for available theme override options.
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
checkboxRadioLabelStyles,
|
|
6
|
+
checkboxRadioControlSize,
|
|
7
|
+
checkboxRadioHelperStyle,
|
|
8
|
+
} from "./global";
|
|
9
|
+
|
|
10
|
+
// Style object for the Checkbox's visual icon.
|
|
11
|
+
const baseStyleIcon = {
|
|
12
|
+
transitionProperty: "transform",
|
|
13
|
+
transitionDuration: "normal",
|
|
14
|
+
width: "22px",
|
|
15
|
+
height: "22px",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// Style object for the Checkbox's "control."
|
|
19
|
+
const baseStyleControl = {
|
|
20
|
+
border: "2px solid",
|
|
21
|
+
borderRadius: "sm",
|
|
22
|
+
borderColor: "ui.black",
|
|
23
|
+
color: "ui.black",
|
|
24
|
+
outline: "none",
|
|
25
|
+
transitionProperty: "box-shadow",
|
|
26
|
+
transitionDuration: "normal",
|
|
27
|
+
|
|
28
|
+
_checked: {
|
|
29
|
+
bg: "ui.white",
|
|
30
|
+
borderColor: "ui.focus",
|
|
31
|
+
color: "ui.focus",
|
|
32
|
+
|
|
33
|
+
_hover: {
|
|
34
|
+
bg: "ui.white",
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
_disabled: {
|
|
38
|
+
bg: "ui.white",
|
|
39
|
+
borderColor: "ui.gray.medium",
|
|
40
|
+
color: "ui.gray.medium",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
_indeterminate: {
|
|
45
|
+
bg: "ui.white",
|
|
46
|
+
borderColor: "ui.gray.medium",
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
_disabled: {
|
|
50
|
+
bg: "ui.white",
|
|
51
|
+
borderColor: "ui.gray.medium",
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
_focus: {
|
|
55
|
+
borderColor: "ui.focus",
|
|
56
|
+
boxShadow: "none",
|
|
57
|
+
outlineColor: "ui.focus",
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
_invalid: {
|
|
61
|
+
borderColor: "ui.error.primary",
|
|
62
|
+
color: "ui.error.primary",
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Style object for the Checkbox's label
|
|
67
|
+
const baseStyleLabel = {
|
|
68
|
+
...checkboxRadioLabelStyles,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// Style object for the Checkbox's helper text
|
|
72
|
+
const baseStyleHelper = {
|
|
73
|
+
...checkboxRadioHelperStyle,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const baseStyle = {
|
|
77
|
+
icon: baseStyleIcon,
|
|
78
|
+
control: baseStyleControl,
|
|
79
|
+
label: baseStyleLabel,
|
|
80
|
+
helper: baseStyleHelper,
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// Sticking to "lg" for the default size.
|
|
84
|
+
const sizes = {
|
|
85
|
+
lg: {
|
|
86
|
+
// Controls the width/height of the checkbox itself.
|
|
87
|
+
control: {
|
|
88
|
+
...checkboxRadioControlSize,
|
|
89
|
+
borderRadius: "3px",
|
|
90
|
+
},
|
|
91
|
+
// Controls the font-size of the label only.
|
|
92
|
+
label: { fontSize: "md" },
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const Checkbox = {
|
|
97
|
+
parts: ["icon", "control", "label", "helper"],
|
|
98
|
+
baseStyle,
|
|
99
|
+
sizes,
|
|
100
|
+
// Default values
|
|
101
|
+
defaultProps: {
|
|
102
|
+
size: "lg",
|
|
103
|
+
colorScheme: "white",
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default Checkbox;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { checkboxRadioGroupLayout } from "./global";
|
|
2
|
+
|
|
3
|
+
const CustomCheckboxGroup = {
|
|
4
|
+
parts: ["legend", "required", "helper"],
|
|
5
|
+
baseStyle: {
|
|
6
|
+
...checkboxRadioGroupLayout,
|
|
7
|
+
},
|
|
8
|
+
sizes: {},
|
|
9
|
+
defaultProps: {},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default CustomCheckboxGroup;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** Export "mixin" styles. */
|
|
2
|
+
export { wrapperStyles } from "./globalMixins";
|
|
3
|
+
|
|
4
|
+
/** Reusable component styles. */
|
|
5
|
+
|
|
6
|
+
// Used in `Select` and `TextInput`.
|
|
7
|
+
const activeFocus = {
|
|
8
|
+
border: "1px solid",
|
|
9
|
+
borderColor: "ui.focus",
|
|
10
|
+
zIndex: "9999",
|
|
11
|
+
outline: "1px solid",
|
|
12
|
+
outlineColor: "ui.focus",
|
|
13
|
+
};
|
|
14
|
+
// Used in `Select` and `TextInput`.
|
|
15
|
+
const helperTextMargin = {
|
|
16
|
+
marginTop: "xs",
|
|
17
|
+
marginBottom: "0",
|
|
18
|
+
};
|
|
19
|
+
// Used in `Checkbox` and `Radio`.
|
|
20
|
+
const checkboxRadioLabelStyles = {
|
|
21
|
+
userSelect: "none",
|
|
22
|
+
fontSize: "0",
|
|
23
|
+
fontWeight: "light",
|
|
24
|
+
marginBottom: "0",
|
|
25
|
+
marginLeft: "xs",
|
|
26
|
+
verticalAlign: "middle",
|
|
27
|
+
_disabled: {
|
|
28
|
+
color: "ui.gray.dark",
|
|
29
|
+
opacity: 1,
|
|
30
|
+
fontStyle: "italic",
|
|
31
|
+
},
|
|
32
|
+
_invalid: {
|
|
33
|
+
color: "ui.error.primary",
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
// Custom values not in the spacing theme.
|
|
37
|
+
// Used in `Checkbox` and `Radio`.
|
|
38
|
+
const checkboxRadioControlSize = {
|
|
39
|
+
h: "1.375rem",
|
|
40
|
+
w: "1.375rem",
|
|
41
|
+
};
|
|
42
|
+
// Used in `CheckboxGroup` and `RadioGroup`.
|
|
43
|
+
const checkboxRadioGroupLayout = {
|
|
44
|
+
legend: {
|
|
45
|
+
fontSize: "14px",
|
|
46
|
+
marginBottom: "s",
|
|
47
|
+
},
|
|
48
|
+
required: {
|
|
49
|
+
marginLeft: "m",
|
|
50
|
+
},
|
|
51
|
+
helper: {
|
|
52
|
+
marginTop: "s",
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
// Used in `Checkbox` and `Radio`.
|
|
56
|
+
const checkboxRadioHelperStyle = {
|
|
57
|
+
...helperTextMargin,
|
|
58
|
+
marginLeft: "30px", // calc(22px + var(--space-xs))
|
|
59
|
+
_disabled: {
|
|
60
|
+
fontStyle: "italic",
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
activeFocus,
|
|
66
|
+
checkboxRadioLabelStyles,
|
|
67
|
+
checkboxRadioControlSize,
|
|
68
|
+
checkboxRadioGroupLayout,
|
|
69
|
+
checkboxRadioHelperStyle,
|
|
70
|
+
helperTextMargin,
|
|
71
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* These objects are also SCSS mixins but are now JS objects in the
|
|
3
|
+
* context of css-in-js and the custom NYPL-theme.
|
|
4
|
+
*/
|
|
5
|
+
const wrapperStyles = {
|
|
6
|
+
marginY: "0",
|
|
7
|
+
marginX: "auto",
|
|
8
|
+
maxWidth: "1280px",
|
|
9
|
+
paddingTop: "0",
|
|
10
|
+
paddingBottom: "0",
|
|
11
|
+
paddingRight: "0",
|
|
12
|
+
paddingLeft: "0",
|
|
13
|
+
width: "100%",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { wrapperStyles };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const margins = {
|
|
2
|
+
marginTop: "0",
|
|
3
|
+
marginLeft: "0",
|
|
4
|
+
marginRight: "0",
|
|
5
|
+
marginBottom: "s",
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// Heading Styles
|
|
9
|
+
const headings = {
|
|
10
|
+
h1: {
|
|
11
|
+
fontSize: "4", // var(--font-size-4);
|
|
12
|
+
fontWeight: "light",
|
|
13
|
+
letterSpacing: "0",
|
|
14
|
+
lineHeight: "1.1",
|
|
15
|
+
...margins,
|
|
16
|
+
width: "auto",
|
|
17
|
+
},
|
|
18
|
+
h2: {
|
|
19
|
+
fontSize: "3", // var(--font-size-3);
|
|
20
|
+
fontWeight: "medium",
|
|
21
|
+
lineHeight: "1.25",
|
|
22
|
+
...margins,
|
|
23
|
+
width: "auto",
|
|
24
|
+
},
|
|
25
|
+
h3: {
|
|
26
|
+
fontSize: "2", // var(--font-size-2);
|
|
27
|
+
fontWeight: "medium",
|
|
28
|
+
lineHeight: "1.25",
|
|
29
|
+
...margins,
|
|
30
|
+
width: "auto",
|
|
31
|
+
},
|
|
32
|
+
h4: {
|
|
33
|
+
fontSize: "1", // var(--font-size-1);
|
|
34
|
+
fontWeight: "medium",
|
|
35
|
+
lineHeight: "1.15",
|
|
36
|
+
...margins,
|
|
37
|
+
width: "auto",
|
|
38
|
+
},
|
|
39
|
+
fallback: {
|
|
40
|
+
fontSize: "1", // var(--font-size-1);
|
|
41
|
+
fontWeight: "regular",
|
|
42
|
+
lineHeight: "1.15",
|
|
43
|
+
...margins,
|
|
44
|
+
width: "auto",
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Styles for different visual variants
|
|
49
|
+
const variants = {
|
|
50
|
+
h1: headings.h1,
|
|
51
|
+
h2: headings.h2,
|
|
52
|
+
h3: headings.h3,
|
|
53
|
+
h4: headings.h4,
|
|
54
|
+
h5: headings.fallback,
|
|
55
|
+
h6: headings.fallback,
|
|
56
|
+
primary: headings.h1,
|
|
57
|
+
secondary: headings.h2,
|
|
58
|
+
tertiary: headings.h3,
|
|
59
|
+
callout: headings.h4,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const Heading = {
|
|
63
|
+
// Available variants:
|
|
64
|
+
// h1, h2, h3, h4, h5, h6,
|
|
65
|
+
// primary, secondary, tertiary, callout
|
|
66
|
+
variants,
|
|
67
|
+
defaultProps: {
|
|
68
|
+
variant: "secondary",
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export default Heading;
|