@nypl/design-system-react-components 0.25.0 → 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 +30 -0
- package/dist/components/Accordion/Accordion.d.ts +14 -14
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +11 -14
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +6 -0
- package/dist/components/Button/ButtonTypes.d.ts +2 -1
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/CardTypes.d.ts +2 -2
- 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 +3 -3
- package/dist/components/Form/Form.d.ts +13 -8
- package/dist/components/Form/FormTypes.d.ts +2 -8
- 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 +4 -4
- 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/IconTypes.d.ts +78 -64
- package/dist/components/Label/Label.d.ts +5 -17
- package/dist/components/Link/Link.d.ts +8 -12
- package/dist/components/SearchBar/SearchBar.d.ts +45 -27
- package/dist/components/Select/Select.d.ts +32 -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/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 +32 -31
- package/dist/components/TextInput/TextInputTypes.d.ts +5 -0
- package/dist/design-system-react-components.cjs.development.js +2597 -1170
- 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 +2580 -1173
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +8 -1
- 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 +17 -7
- package/dist/theme/components/checkbox.d.ts +7 -7
- package/dist/theme/components/customCheckboxGroup.d.ts +18 -0
- package/dist/theme/components/customRadioGroup.d.ts +4 -3
- 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 +50 -20
- 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 +8 -7
- 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 +9 -9
- 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/global.d.ts +3 -0
- package/dist/theme/foundations/shadows.d.ts +4 -0
- package/dist/utils/utils.d.ts +6 -0
- package/package.json +3 -2
- package/src/components/Accordion/Accordion.stories.mdx +227 -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 +1 -1
- package/src/components/Autosuggest/Autosuggest.stories.tsx +1 -1
- package/src/components/Autosuggest/_Autosuggest.scss +2 -2
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +46 -52
- 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 +31 -27
- package/src/components/Button/Button.test.tsx +17 -5
- package/src/components/Button/ButtonTypes.tsx +1 -0
- package/src/components/Button/_Button.scss +3 -27
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +11 -0
- package/src/components/Card/Card.stories.mdx +24 -20
- package/src/components/Card/Card.test.tsx +13 -19
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/Card/CardTypes.tsx +2 -2
- package/src/components/Card/_Card.scss +1 -1
- package/src/components/CardEdition/CardEdition.stories.tsx +11 -6
- package/src/components/CardEdition/CardEdition.test.tsx +23 -31
- package/src/components/CardEdition/_CardEdition.scss +2 -2
- package/src/components/Chakra/Center.stories.mdx +31 -14
- package/src/components/Chakra/Grid.stories.mdx +79 -0
- package/src/components/Chakra/Stack.stories.mdx +4 -4
- package/src/components/Checkbox/Checkbox.tsx +9 -12
- package/src/components/Checkbox/__snapshots__/Checkbox.test.tsx.snap +2 -5
- 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.test.tsx +4 -4
- package/src/components/DatePicker/DatePicker.tsx +13 -13
- package/src/components/DatePicker/_DatePicker.scss +1 -0
- package/src/components/Form/Form.stories.mdx +46 -21
- package/src/components/Form/Form.test.tsx +58 -45
- package/src/components/Form/Form.tsx +49 -21
- package/src/components/Form/FormTypes.tsx +3 -8
- package/src/components/Form/__snapshots__/Form.test.tsx.snap +24 -14
- 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 +1 -0
- package/src/components/Heading/Heading.tsx +12 -6
- package/src/components/HelperErrorText/_HelperErrorText.scss +1 -1
- package/src/components/Hero/Hero.stories.mdx +188 -121
- package/src/components/Hero/Hero.test.tsx +537 -107
- package/src/components/Hero/Hero.tsx +79 -92
- package/src/components/Hero/HeroTypes.tsx +17 -5
- package/src/components/Hero/__snapshots__/Hero.test.tsx.snap +307 -0
- package/src/components/HorizontalRule/_HorizontalRule.scss +1 -1
- package/src/components/Icons/Icon.stories.mdx +83 -74
- package/src/components/Icons/Icon.test.tsx +30 -22
- package/src/components/Icons/Icon.tsx +63 -61
- package/src/components/Icons/IconTypes.tsx +80 -64
- package/src/components/Input/_Input.scss +2 -2
- package/src/components/Label/Label.stories.mdx +28 -7
- package/src/components/Label/Label.test.tsx +43 -12
- package/src/components/Label/Label.tsx +21 -34
- package/src/components/Label/__snapshots__/Label.test.tsx.snap +41 -0
- package/src/components/Link/Link.stories.mdx +41 -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 +0 -2
- package/src/components/List/List.stories.tsx +5 -5
- package/src/components/List/_List.scss +3 -3
- package/src/components/Modal/_Modal.scss +1 -1
- package/src/components/Notification/Notification.stories.mdx +12 -1
- package/src/components/Notification/Notification.test.tsx +3 -16
- package/src/components/Notification/Notification.tsx +9 -10
- package/src/components/Notification/_Notification.scss +4 -4
- package/src/components/Pagination/Pagination.test.tsx +16 -10
- package/src/components/RadioGroup/RadioGroup.stories.mdx +1 -1
- package/src/components/RadioGroup/RadioGroup.tsx +2 -10
- package/src/components/SearchBar/SearchBar.Test.tsx +151 -16
- package/src/components/SearchBar/SearchBar.stories.mdx +189 -219
- package/src/components/SearchBar/SearchBar.tsx +151 -46
- package/src/components/Select/Select.stories.mdx +188 -170
- package/src/components/Select/Select.test.tsx +125 -380
- package/src/components/Select/Select.tsx +118 -165
- package/src/components/Select/SelectTypes.tsx +4 -0
- package/src/components/SkeletonLoader/SkeletonLoader.stories.mdx +13 -25
- 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 +16 -16
- package/src/components/StyleGuide/Buttons.stories.mdx +15 -15
- package/src/components/StyleGuide/Colors.stories.mdx +336 -0
- package/src/components/StyleGuide/Iconography.stories.mdx +88 -90
- package/src/components/StyleGuide/UIDocCard.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +7 -9
- 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 +89 -90
- package/src/components/TextInput/TextInput.test.tsx +65 -86
- package/src/components/TextInput/TextInput.tsx +101 -95
- package/src/components/TextInput/TextInputTypes.tsx +6 -0
- package/src/components/VideoPlayer/_VideoPlayer.scss +1 -1
- package/src/docs/Chakra.stories.mdx +4 -4
- package/src/docs/Intro.stories.mdx +15 -13
- package/src/index.ts +20 -0
- package/src/styles/01-colors/_colors-brand.scss +6 -0
- package/src/styles/01-colors/_colors-utility.scss +14 -12
- package/src/styles/base/_04-base.scss +2 -1
- package/src/styles/base/_place-holder.scss +1 -1
- package/src/styles.scss +10 -12
- package/src/theme/components/accordion.ts +30 -0
- package/src/theme/components/breadcrumb.ts +77 -0
- package/src/theme/components/button.ts +77 -63
- package/src/theme/components/checkbox.ts +15 -27
- package/src/theme/components/customCheckboxGroup.ts +12 -0
- package/src/theme/components/customRadioGroup.ts +4 -10
- package/src/theme/components/global.ts +71 -0
- package/src/theme/components/globalMixins.ts +16 -0
- package/src/theme/components/heading.ts +15 -8
- 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 +20 -31
- 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 +72 -69
- 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/colors.ts +29 -13
- package/src/theme/foundations/global.ts +3 -0
- package/src/theme/foundations/shadows.ts +5 -0
- package/src/theme/index.ts +37 -7
- package/src/utils/componentCategories.ts +8 -2
- package/src/utils/utils.ts +13 -0
- package/dist/components/Accordion/Accordion.stories.d.ts +0 -6
- package/dist/components/StatusBadge/StatusBadge.stories.d.ts +0 -8
- package/dist/components/StyleGuide/Colors.stories.d.ts +0 -25
- package/dist/components/Template/Template.stories.d.ts +0 -30
- package/src/components/Accordion/Accordion.stories.tsx +0 -66
- package/src/components/Accordion/_Accordion.scss +0 -81
- package/src/components/Breadcrumbs/_Breadcrumbs.scss +0 -97
- package/src/components/Form/_Form.scss +0 -67
- package/src/components/Hero/_Hero.scss +0 -256
- package/src/components/Icons/_Icons.scss +0 -116
- package/src/components/Label/_Label.scss +0 -22
- package/src/components/Link/_Link.scss +0 -73
- package/src/components/SearchBar/_SearchBar.scss +0 -16
- package/src/components/Select/_Select.scss +0 -82
- package/src/components/StatusBadge/StatusBadge.stories.tsx +0 -34
- package/src/components/StatusBadge/_StatusBadge.scss +0 -23
- package/src/components/StyleGuide/Colors.stories.tsx +0 -289
- package/src/components/Template/Template.stories.tsx +0 -86
- package/src/components/Template/_Template.scss +0 -63
- package/src/components/TextInput/_TextInput.scss +0 -59
|
@@ -10,7 +10,12 @@ import { withDesign } from "storybook-addon-designs";
|
|
|
10
10
|
import Button, { ButtonGroup } from "./Button";
|
|
11
11
|
import { ButtonTypes } from "./ButtonTypes";
|
|
12
12
|
import Icon from "../Icons/Icon";
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
IconNames,
|
|
15
|
+
IconRotationTypes,
|
|
16
|
+
IconAlign,
|
|
17
|
+
IconSizes,
|
|
18
|
+
} from "../Icons/IconTypes";
|
|
14
19
|
import getCSSVariable from "../../helpers/getCSSVariable";
|
|
15
20
|
import { getCategory } from "../../utils/componentCategories";
|
|
16
21
|
import DSProvider from "../../theme/provider";
|
|
@@ -83,7 +88,7 @@ Controls for this Story section to preview a `Button` with the selected icon.
|
|
|
83
88
|
args={{
|
|
84
89
|
displayLeft: true,
|
|
85
90
|
buttonText: "Button Text",
|
|
86
|
-
iconType: IconNames.
|
|
91
|
+
iconType: IconNames.Search,
|
|
87
92
|
}}
|
|
88
93
|
argTypes={{
|
|
89
94
|
iconType: {
|
|
@@ -99,16 +104,16 @@ Controls for this Story section to preview a `Button` with the selected icon.
|
|
|
99
104
|
{args.displayLeft && (
|
|
100
105
|
<Icon
|
|
101
106
|
name={args.iconType}
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
align={IconAlign.Left}
|
|
108
|
+
size={IconSizes.Small}
|
|
104
109
|
/>
|
|
105
110
|
)}
|
|
106
111
|
{args.buttonText}
|
|
107
112
|
{!args.displayLeft && (
|
|
108
113
|
<Icon
|
|
109
114
|
name={args.iconType}
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
align={IconAlign.Right}
|
|
116
|
+
size={IconSizes.Small}
|
|
112
117
|
/>
|
|
113
118
|
)}
|
|
114
119
|
</Button>
|
|
@@ -123,20 +128,20 @@ The icon can be placed to the left or the right of the button text.
|
|
|
123
128
|
<ButtonGroup>
|
|
124
129
|
<Button buttonType={ButtonTypes.Secondary}>
|
|
125
130
|
<Icon
|
|
126
|
-
name={IconNames.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
131
|
+
name={IconNames.Arrow}
|
|
132
|
+
iconRotation={IconRotationTypes.Rotate90}
|
|
133
|
+
align={IconAlign.Left}
|
|
134
|
+
size={IconSizes.Small}
|
|
130
135
|
/>
|
|
131
136
|
Previous
|
|
132
137
|
</Button>
|
|
133
138
|
<Button buttonType={ButtonTypes.Secondary}>
|
|
134
139
|
Next
|
|
135
140
|
<Icon
|
|
136
|
-
name={IconNames.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
141
|
+
name={IconNames.Arrow}
|
|
142
|
+
iconRotation={IconRotationTypes.Rotate270}
|
|
143
|
+
align={IconAlign.Right}
|
|
144
|
+
size={IconSizes.Small}
|
|
140
145
|
/>
|
|
141
146
|
</Button>
|
|
142
147
|
</ButtonGroup>
|
|
@@ -157,10 +162,9 @@ is an `aria-label` passed to the `Button` component through the `attributes` pro
|
|
|
157
162
|
}}
|
|
158
163
|
>
|
|
159
164
|
<Icon
|
|
160
|
-
name={IconNames.
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
modifiers={["small"]}
|
|
165
|
+
name={IconNames.Arrow}
|
|
166
|
+
iconRotation={IconRotationTypes.Rotate90}
|
|
167
|
+
size={IconSizes.Small}
|
|
164
168
|
/>
|
|
165
169
|
</Button>
|
|
166
170
|
<Button
|
|
@@ -170,10 +174,9 @@ is an `aria-label` passed to the `Button` component through the `attributes` pro
|
|
|
170
174
|
}}
|
|
171
175
|
>
|
|
172
176
|
<Icon
|
|
173
|
-
name={IconNames.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
modifiers={["small"]}
|
|
177
|
+
name={IconNames.Arrow}
|
|
178
|
+
iconRotation={IconRotationTypes.Rotate270}
|
|
179
|
+
size={IconSizes.Small}
|
|
177
180
|
/>
|
|
178
181
|
</Button>
|
|
179
182
|
<Button
|
|
@@ -182,7 +185,7 @@ is an `aria-label` passed to the `Button` component through the `attributes` pro
|
|
|
182
185
|
"aria-label": "Close",
|
|
183
186
|
}}
|
|
184
187
|
>
|
|
185
|
-
<Icon name={IconNames.
|
|
188
|
+
<Icon name={IconNames.Close} size={IconSizes.Small} />
|
|
186
189
|
</Button>
|
|
187
190
|
</ButtonGroup>
|
|
188
191
|
</DSProvider>
|
|
@@ -201,10 +204,11 @@ must include an up arrow icon on the right side.
|
|
|
201
204
|
<Button buttonType={ButtonTypes.Secondary}>
|
|
202
205
|
Back to Top
|
|
203
206
|
<Icon
|
|
204
|
-
name={IconNames.
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
207
|
+
name={IconNames.Arrow}
|
|
208
|
+
iconRotation={IconRotationTypes.Rotate180}
|
|
209
|
+
size={IconSizes.Small}
|
|
210
|
+
className="right"
|
|
211
|
+
align={IconAlign.Right}
|
|
208
212
|
/>
|
|
209
213
|
</Button>
|
|
210
214
|
</ButtonGroup>
|
|
@@ -6,7 +6,7 @@ import renderer from "react-test-renderer";
|
|
|
6
6
|
|
|
7
7
|
import Button from "./Button";
|
|
8
8
|
import Icon from "../Icons/Icon";
|
|
9
|
-
import { IconNames } from "../Icons/IconTypes";
|
|
9
|
+
import { IconAlign, IconNames, IconSizes } from "../Icons/IconTypes";
|
|
10
10
|
import { ButtonTypes } from "./ButtonTypes";
|
|
11
11
|
|
|
12
12
|
describe("Button Accessibility", () => {
|
|
@@ -94,13 +94,13 @@ describe("padding for icon only button", () => {
|
|
|
94
94
|
const { container } = render(
|
|
95
95
|
<Button id="button" onClick={onClick} type="button">
|
|
96
96
|
<Icon
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
align={IconAlign.Left}
|
|
98
|
+
name={IconNames.Check}
|
|
99
|
+
size={IconSizes.Small}
|
|
100
100
|
/>
|
|
101
101
|
</Button>
|
|
102
102
|
);
|
|
103
|
-
expect(container.querySelector(".button
|
|
103
|
+
expect(container.querySelector(".button svg")).toBeInTheDocument();
|
|
104
104
|
});
|
|
105
105
|
});
|
|
106
106
|
|
|
@@ -149,11 +149,23 @@ describe("Button Snapshot", () => {
|
|
|
149
149
|
</Button>
|
|
150
150
|
)
|
|
151
151
|
.toJSON();
|
|
152
|
+
const searchBar = renderer
|
|
153
|
+
.create(
|
|
154
|
+
<Button
|
|
155
|
+
id="button"
|
|
156
|
+
onClick={jest.fn()}
|
|
157
|
+
buttonType={ButtonTypes.SearchBar}
|
|
158
|
+
>
|
|
159
|
+
SearchBar
|
|
160
|
+
</Button>
|
|
161
|
+
)
|
|
162
|
+
.toJSON();
|
|
152
163
|
|
|
153
164
|
expect(primary).toMatchSnapshot();
|
|
154
165
|
expect(secondary).toMatchSnapshot();
|
|
155
166
|
expect(callout).toMatchSnapshot();
|
|
156
167
|
expect(pill).toMatchSnapshot();
|
|
157
168
|
expect(link).toMatchSnapshot();
|
|
169
|
+
expect(searchBar).toMatchSnapshot();
|
|
158
170
|
});
|
|
159
171
|
});
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
@include button-base;
|
|
14
14
|
|
|
15
15
|
background-color: var(--ui-white);
|
|
16
|
-
border: 1px solid var(--ui-gray-light);
|
|
16
|
+
border: 1px solid var(--ui-gray-light-cool);
|
|
17
17
|
color: inherit;
|
|
18
18
|
|
|
19
19
|
&:visited {
|
|
@@ -21,36 +21,12 @@
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
&:hover {
|
|
24
|
-
background-color: var(--ui-gray-
|
|
24
|
+
background-color: var(--ui-gray-xx-light-cool);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
&:disabled {
|
|
28
|
-
background-color: var(--ui-gray-light);
|
|
28
|
+
background-color: var(--ui-gray-light-cool);
|
|
29
29
|
color: var(--ui-gray-dark);
|
|
30
30
|
pointer-events: none;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
.button {
|
|
35
|
-
// These `icon` rules are a better fit for the Icon
|
|
36
|
-
// component but we'll keep them here for now.
|
|
37
|
-
.icon {
|
|
38
|
-
@include icon;
|
|
39
|
-
|
|
40
|
-
fill: currentColor;
|
|
41
|
-
|
|
42
|
-
&--small,
|
|
43
|
-
&--icon-left,
|
|
44
|
-
&--icon-right {
|
|
45
|
-
margin-top: var(--space-xxs);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
&--icon-left {
|
|
49
|
-
margin-right: var(--space-xs);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
&--icon-right {
|
|
53
|
-
margin-left: var(--space-xs);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -54,3 +54,14 @@ exports[`Button Snapshot Renders the UI snapshot correctly 5`] = `
|
|
|
54
54
|
Link
|
|
55
55
|
</button>
|
|
56
56
|
`;
|
|
57
|
+
|
|
58
|
+
exports[`Button Snapshot Renders the UI snapshot correctly 6`] = `
|
|
59
|
+
<button
|
|
60
|
+
className="chakra-button button css-0"
|
|
61
|
+
id="button"
|
|
62
|
+
onClick={[MockFunction]}
|
|
63
|
+
type="button"
|
|
64
|
+
>
|
|
65
|
+
SearchBar
|
|
66
|
+
</button>
|
|
67
|
+
`;
|
|
@@ -19,7 +19,6 @@ import HorizontalRule from "../HorizontalRule/HorizontalRule";
|
|
|
19
19
|
import { LinkTypes } from "../Link/LinkTypes";
|
|
20
20
|
import { HeadingDisplaySizes, HeadingLevels } from "../Heading/HeadingTypes";
|
|
21
21
|
import Icon from "../Icons/Icon";
|
|
22
|
-
import { IconRotationTypes, IconNames } from "../Icons/IconTypes";
|
|
23
22
|
import Image from "../Image/Image";
|
|
24
23
|
import { getCategory } from "../../utils/componentCategories";
|
|
25
24
|
|
|
@@ -81,7 +80,7 @@ The `CardContent` component should be used to display all content other than hea
|
|
|
81
80
|
name="Card Props"
|
|
82
81
|
args={{
|
|
83
82
|
id: "custom-card",
|
|
84
|
-
layout: CardLayouts.
|
|
83
|
+
layout: CardLayouts.Row,
|
|
85
84
|
imageSrc: "https://placeimg.com/400/300/animals",
|
|
86
85
|
imageAspectRatio: CardImageRatios.ThreeByFour,
|
|
87
86
|
imageAlt: "Alt text",
|
|
@@ -132,9 +131,12 @@ The `CardContent` component should be used to display all content other than hea
|
|
|
132
131
|
|
|
133
132
|
## Image Position
|
|
134
133
|
|
|
135
|
-
By default, the image is always the first element within a `Card`. This means
|
|
134
|
+
By default, the image is always the first element within a `Card`. This means
|
|
135
|
+
the image is at the top of a `Card` with a column layout and on the left side of
|
|
136
|
+
a `Card` with a row layout. However, you can use the `imageAtEnd` prop to override
|
|
137
|
+
the default placement and move the image to the last element within a `Card`.
|
|
136
138
|
|
|
137
|
-
###
|
|
139
|
+
### Column Cards
|
|
138
140
|
|
|
139
141
|
<Preview>
|
|
140
142
|
<Story name="Card Image Position">
|
|
@@ -176,7 +178,7 @@ By default, the image is always the first element within a `Card`. This means th
|
|
|
176
178
|
</Story>
|
|
177
179
|
</Preview>
|
|
178
180
|
|
|
179
|
-
###
|
|
181
|
+
### Row Cards
|
|
180
182
|
|
|
181
183
|
<Preview>
|
|
182
184
|
<div
|
|
@@ -187,7 +189,7 @@ By default, the image is always the first element within a `Card`. This means th
|
|
|
187
189
|
}}
|
|
188
190
|
>
|
|
189
191
|
<Card
|
|
190
|
-
layout={CardLayouts.
|
|
192
|
+
layout={CardLayouts.Row}
|
|
191
193
|
center
|
|
192
194
|
imageSrc="https://placeimg.com/400/200/animals"
|
|
193
195
|
imageAlt="Alt text"
|
|
@@ -203,7 +205,7 @@ By default, the image is always the first element within a `Card`. This means th
|
|
|
203
205
|
</CardContent>
|
|
204
206
|
</Card>
|
|
205
207
|
<Card
|
|
206
|
-
layout={CardLayouts.
|
|
208
|
+
layout={CardLayouts.Row}
|
|
207
209
|
center
|
|
208
210
|
imageSrc="https://placeimg.com/410/210/animals"
|
|
209
211
|
imageAlt="Alt text"
|
|
@@ -224,9 +226,11 @@ By default, the image is always the first element within a `Card`. This means th
|
|
|
224
226
|
|
|
225
227
|
## Image Size
|
|
226
228
|
|
|
227
|
-
By default, the image width is `100%` for a
|
|
229
|
+
By default, the image width is `100%` for a `Card` with a column layout and
|
|
230
|
+
`225px` for a `Card` with a row layout. However, you can use the `imageSize`
|
|
231
|
+
prop to override the default width.
|
|
228
232
|
|
|
229
|
-
###
|
|
233
|
+
### Column Cards
|
|
230
234
|
|
|
231
235
|
<Preview>
|
|
232
236
|
<Story name="Card Image Size">
|
|
@@ -313,7 +317,7 @@ By default, the image width is `100%` for a vertical `Card` and `225px` for a ho
|
|
|
313
317
|
</Story>
|
|
314
318
|
</Preview>
|
|
315
319
|
|
|
316
|
-
###
|
|
320
|
+
### Row Cards
|
|
317
321
|
|
|
318
322
|
<Preview>
|
|
319
323
|
<div
|
|
@@ -324,7 +328,7 @@ By default, the image width is `100%` for a vertical `Card` and `225px` for a ho
|
|
|
324
328
|
}}
|
|
325
329
|
>
|
|
326
330
|
<Card
|
|
327
|
-
layout={CardLayouts.
|
|
331
|
+
layout={CardLayouts.Row}
|
|
328
332
|
center
|
|
329
333
|
imageSrc="https://placeimg.com/400/200/animals"
|
|
330
334
|
imageAlt="Alt text"
|
|
@@ -342,7 +346,7 @@ By default, the image width is `100%` for a vertical `Card` and `225px` for a ho
|
|
|
342
346
|
</CardContent>
|
|
343
347
|
</Card>
|
|
344
348
|
<Card
|
|
345
|
-
layout={CardLayouts.
|
|
349
|
+
layout={CardLayouts.Row}
|
|
346
350
|
center
|
|
347
351
|
imageSrc="https://placeimg.com/410/210/animals"
|
|
348
352
|
imageAlt="Alt text"
|
|
@@ -361,7 +365,7 @@ By default, the image width is `100%` for a vertical `Card` and `225px` for a ho
|
|
|
361
365
|
</CardContent>
|
|
362
366
|
</Card>
|
|
363
367
|
<Card
|
|
364
|
-
layout={CardLayouts.
|
|
368
|
+
layout={CardLayouts.Row}
|
|
365
369
|
center
|
|
366
370
|
imageSrc="https://placeimg.com/400/250/animals"
|
|
367
371
|
imageAlt="Alt text"
|
|
@@ -381,7 +385,7 @@ By default, the image width is `100%` for a vertical `Card` and `225px` for a ho
|
|
|
381
385
|
</CardContent>
|
|
382
386
|
</Card>
|
|
383
387
|
<Card
|
|
384
|
-
layout={CardLayouts.
|
|
388
|
+
layout={CardLayouts.Row}
|
|
385
389
|
center
|
|
386
390
|
imageSrc="https://placeimg.com/450/250/animals"
|
|
387
391
|
imageAlt="Alt text"
|
|
@@ -507,7 +511,7 @@ By default, the image width is `100%` for a vertical `Card` and `225px` for a ho
|
|
|
507
511
|
}}
|
|
508
512
|
>
|
|
509
513
|
<Card
|
|
510
|
-
layout={CardLayouts.
|
|
514
|
+
layout={CardLayouts.Row}
|
|
511
515
|
center
|
|
512
516
|
imageSrc="https://placeimg.com/400/200/animals"
|
|
513
517
|
imageAlt="Alt text"
|
|
@@ -523,7 +527,7 @@ By default, the image width is `100%` for a vertical `Card` and `225px` for a ho
|
|
|
523
527
|
</CardContent>
|
|
524
528
|
</Card>
|
|
525
529
|
<Card
|
|
526
|
-
layout={CardLayouts.
|
|
530
|
+
layout={CardLayouts.Row}
|
|
527
531
|
center
|
|
528
532
|
imageSrc="https://placeimg.com/410/210/animals"
|
|
529
533
|
imageAlt="Alt text"
|
|
@@ -539,7 +543,7 @@ By default, the image width is `100%` for a vertical `Card` and `225px` for a ho
|
|
|
539
543
|
</CardContent>
|
|
540
544
|
</Card>
|
|
541
545
|
<Card
|
|
542
|
-
layout={CardLayouts.
|
|
546
|
+
layout={CardLayouts.Row}
|
|
543
547
|
center
|
|
544
548
|
imageSrc="https://placeimg.com/420/220/animals"
|
|
545
549
|
imageAlt="Alt text"
|
|
@@ -646,7 +650,7 @@ Instead of passing a path for the `imageSrc` prop, you can pass a custom image c
|
|
|
646
650
|
"grid-template-columns": "repeat(1, 1fr)",
|
|
647
651
|
}}
|
|
648
652
|
>
|
|
649
|
-
<Card layout={CardLayouts.
|
|
653
|
+
<Card layout={CardLayouts.Row} border>
|
|
650
654
|
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
651
655
|
Card Heading
|
|
652
656
|
</CardHeading>
|
|
@@ -659,7 +663,7 @@ Instead of passing a path for the `imageSrc` prop, you can pass a custom image c
|
|
|
659
663
|
eget metus.
|
|
660
664
|
</CardContent>
|
|
661
665
|
</Card>
|
|
662
|
-
<Card layout={CardLayouts.
|
|
666
|
+
<Card layout={CardLayouts.Row} border>
|
|
663
667
|
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
664
668
|
Card Heading
|
|
665
669
|
</CardHeading>
|
|
@@ -672,7 +676,7 @@ Instead of passing a path for the `imageSrc` prop, you can pass a custom image c
|
|
|
672
676
|
eget metus.
|
|
673
677
|
</CardContent>
|
|
674
678
|
</Card>
|
|
675
|
-
<Card layout={CardLayouts.
|
|
679
|
+
<Card layout={CardLayouts.Row} border>
|
|
676
680
|
<CardHeading level={HeadingLevels.Three} id="heading1">
|
|
677
681
|
Card Heading
|
|
678
682
|
</CardHeading>
|
|
@@ -9,7 +9,7 @@ import Button from "../Button/Button";
|
|
|
9
9
|
import { ButtonTypes } from "../Button/ButtonTypes";
|
|
10
10
|
import { HeadingLevels } from "../Heading/HeadingTypes";
|
|
11
11
|
import Icon from "../Icons/Icon";
|
|
12
|
-
import { IconRotationTypes, IconNames } from "../Icons/IconTypes";
|
|
12
|
+
import { IconRotationTypes, IconNames, IconAlign } from "../Icons/IconTypes";
|
|
13
13
|
|
|
14
14
|
describe("Card Accessibility", () => {
|
|
15
15
|
it("passes axe accessibility test", async () => {
|
|
@@ -92,12 +92,10 @@ describe("Card", () => {
|
|
|
92
92
|
<div className="edition-card__download">
|
|
93
93
|
<Link href="#url" type={LinkTypes.Action}>
|
|
94
94
|
<Icon
|
|
95
|
-
name={IconNames.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
iconRotation={IconRotationTypes.rotate0}
|
|
100
|
-
></Icon>
|
|
95
|
+
name={IconNames.Download}
|
|
96
|
+
align={IconAlign.Left}
|
|
97
|
+
iconRotation={IconRotationTypes.Rotate0}
|
|
98
|
+
/>
|
|
101
99
|
Download
|
|
102
100
|
</Link>
|
|
103
101
|
</div>
|
|
@@ -144,12 +142,10 @@ describe("Card", () => {
|
|
|
144
142
|
<div className="edition-card__download">
|
|
145
143
|
<Link href="#url" type={LinkTypes.Action}>
|
|
146
144
|
<Icon
|
|
147
|
-
name={IconNames.
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
iconRotation={IconRotationTypes.rotate0}
|
|
152
|
-
></Icon>
|
|
145
|
+
name={IconNames.Download}
|
|
146
|
+
align={IconAlign.Left}
|
|
147
|
+
iconRotation={IconRotationTypes.Rotate0}
|
|
148
|
+
/>
|
|
153
149
|
Download
|
|
154
150
|
</Link>
|
|
155
151
|
</div>
|
|
@@ -175,12 +171,10 @@ describe("Card", () => {
|
|
|
175
171
|
<div className="edition-card__download">
|
|
176
172
|
<Link href="#url" type={LinkTypes.Action}>
|
|
177
173
|
<Icon
|
|
178
|
-
name={IconNames.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
iconRotation={IconRotationTypes.rotate0}
|
|
183
|
-
></Icon>
|
|
174
|
+
name={IconNames.Download}
|
|
175
|
+
align={IconAlign.Left}
|
|
176
|
+
iconRotation={IconRotationTypes.Rotate0}
|
|
177
|
+
/>
|
|
184
178
|
Download
|
|
185
179
|
</Link>
|
|
186
180
|
</div>
|
|
@@ -63,7 +63,7 @@ export interface CardProps {
|
|
|
63
63
|
imageSize?: CardImageSizes;
|
|
64
64
|
/** The path to the image displayed with the card */
|
|
65
65
|
imageSrc?: string;
|
|
66
|
-
/** Optional value to control the position of the image placeholder; default value is `
|
|
66
|
+
/** Optional value to control the position of the image placeholder; default value is `column` */
|
|
67
67
|
layout?: CardLayouts;
|
|
68
68
|
/** Modifiers array for use with BEM. See how to work with modifiers and BEM here: http://getbem.com/introduction/ */
|
|
69
69
|
modifiers?: string[];
|
|
@@ -9,7 +9,12 @@ import Image from "../Image/Image";
|
|
|
9
9
|
import Button from "../Button/Button";
|
|
10
10
|
import Link from "../Link/Link";
|
|
11
11
|
import Icon from "../Icons/Icon";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
IconRotationTypes,
|
|
14
|
+
IconNames,
|
|
15
|
+
IconSizes,
|
|
16
|
+
IconAlign,
|
|
17
|
+
} from "../Icons/IconTypes";
|
|
13
18
|
import { LinkTypes } from "../Link/LinkTypes";
|
|
14
19
|
import { ButtonTypes } from "../Button/ButtonTypes";
|
|
15
20
|
import { getCategory } from "../../utils/componentCategories";
|
|
@@ -122,11 +127,11 @@ export const ExampleCardEdition = () => (
|
|
|
122
127
|
</div>
|
|
123
128
|
<div className="book__filetype">
|
|
124
129
|
<Icon
|
|
125
|
-
name={IconNames.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
iconRotation={IconRotationTypes.
|
|
129
|
-
|
|
130
|
+
name={IconNames.Headset}
|
|
131
|
+
size={IconSizes.Small}
|
|
132
|
+
align={IconAlign.Left}
|
|
133
|
+
iconRotation={IconRotationTypes.Rotate0}
|
|
134
|
+
/>
|
|
130
135
|
Audiobook
|
|
131
136
|
</div>
|
|
132
137
|
<div className="book__description">
|
|
@@ -11,7 +11,7 @@ import Image from "../Image/Image";
|
|
|
11
11
|
import Button from "../Button/Button";
|
|
12
12
|
import { ButtonTypes } from "../Button/ButtonTypes";
|
|
13
13
|
import Icon from "../Icons/Icon";
|
|
14
|
-
import { IconRotationTypes, IconNames } from "../Icons/IconTypes";
|
|
14
|
+
import { IconRotationTypes, IconNames, IconAlign } from "../Icons/IconTypes";
|
|
15
15
|
|
|
16
16
|
describe("CardEdition Accessibility", () => {
|
|
17
17
|
const regularCard = (
|
|
@@ -99,12 +99,11 @@ describe("CardEdition", () => {
|
|
|
99
99
|
<div className="edition-card__download">
|
|
100
100
|
<Link href="#url" type={LinkTypes.Action}>
|
|
101
101
|
<Icon
|
|
102
|
-
name={IconNames.
|
|
103
|
-
blockName="more-link"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
></Icon>
|
|
102
|
+
name={IconNames.Download}
|
|
103
|
+
// blockName="more-link"
|
|
104
|
+
align={IconAlign.Left}
|
|
105
|
+
iconRotation={IconRotationTypes.Rotate0}
|
|
106
|
+
/>
|
|
108
107
|
Download
|
|
109
108
|
</Link>
|
|
110
109
|
</div>
|
|
@@ -164,12 +163,11 @@ describe("CardEdition", () => {
|
|
|
164
163
|
<div className="edition-card__download">
|
|
165
164
|
<Link href="#url" type={LinkTypes.Action}>
|
|
166
165
|
<Icon
|
|
167
|
-
name={IconNames.
|
|
168
|
-
blockName="more-link"
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
></Icon>
|
|
166
|
+
name={IconNames.Download}
|
|
167
|
+
// blockName="more-link"
|
|
168
|
+
align={IconAlign.Left}
|
|
169
|
+
iconRotation={IconRotationTypes.Rotate0}
|
|
170
|
+
/>
|
|
173
171
|
Download
|
|
174
172
|
</Link>
|
|
175
173
|
</div>
|
|
@@ -198,12 +196,10 @@ describe("CardEdition", () => {
|
|
|
198
196
|
<div className="edition-card__download">
|
|
199
197
|
<Link href="#url" type={LinkTypes.Action}>
|
|
200
198
|
<Icon
|
|
201
|
-
name={IconNames.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
iconRotation={IconRotationTypes.rotate0}
|
|
206
|
-
></Icon>
|
|
199
|
+
name={IconNames.Download}
|
|
200
|
+
align={IconAlign.Left}
|
|
201
|
+
iconRotation={IconRotationTypes.Rotate0}
|
|
202
|
+
/>
|
|
207
203
|
Download
|
|
208
204
|
</Link>
|
|
209
205
|
</div>
|
|
@@ -227,12 +223,10 @@ describe("CardEdition", () => {
|
|
|
227
223
|
<div className="edition-card__download">
|
|
228
224
|
<Link href="#url" type={LinkTypes.Action}>
|
|
229
225
|
<Icon
|
|
230
|
-
name={IconNames.
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
iconRotation={IconRotationTypes.rotate0}
|
|
235
|
-
></Icon>
|
|
226
|
+
name={IconNames.Download}
|
|
227
|
+
align={IconAlign.Left}
|
|
228
|
+
iconRotation={IconRotationTypes.Rotate0}
|
|
229
|
+
/>
|
|
236
230
|
Download
|
|
237
231
|
</Link>
|
|
238
232
|
</div>
|
|
@@ -265,12 +259,10 @@ describe("CardEdition", () => {
|
|
|
265
259
|
<div className="edition-card__download">
|
|
266
260
|
<Link href="#url" type={LinkTypes.Action}>
|
|
267
261
|
<Icon
|
|
268
|
-
name={IconNames.
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
iconRotation={IconRotationTypes.rotate0}
|
|
273
|
-
></Icon>
|
|
262
|
+
name={IconNames.Download}
|
|
263
|
+
align={IconAlign.Left}
|
|
264
|
+
iconRotation={IconRotationTypes.Rotate0}
|
|
265
|
+
/>
|
|
274
266
|
Download
|
|
275
267
|
</Link>
|
|
276
268
|
</div>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
@include space-stack-s;
|
|
3
3
|
|
|
4
4
|
align-items: flex-start;
|
|
5
|
-
border: 1px solid var(--ui-gray-light);
|
|
5
|
+
border: 1px solid var(--ui-gray-light-cool);
|
|
6
6
|
border-radius: 5px;
|
|
7
7
|
display: flex;
|
|
8
8
|
flex-flow: column wrap;
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
@include space-stack-s;
|
|
33
33
|
|
|
34
34
|
align-items: center;
|
|
35
|
-
background-color: var(--ui-gray-
|
|
35
|
+
background-color: var(--ui-gray-x-light-cool);
|
|
36
36
|
display: flex;
|
|
37
37
|
flex: 0 0 150px;
|
|
38
38
|
height: 150px;
|