@nypl/design-system-react-components 0.25.3 → 0.25.7
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 +65 -0
- package/README.md +47 -11
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/dist/components/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -0
- package/dist/components/Button/Button.d.ts +9 -6
- package/dist/components/Button/ButtonTypes.d.ts +2 -1
- package/dist/components/Card/Card.d.ts +0 -25
- package/dist/components/Icons/IconSvgs.d.ts +3 -0
- package/dist/components/Icons/IconTypes.d.ts +3 -0
- package/dist/components/Notification/Notification.d.ts +6 -4
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +29 -0
- package/dist/components/ProgressIndicator/ProgressIndicatorTypes.d.ts +8 -0
- package/dist/components/SearchBar/SearchBar.d.ts +3 -3
- package/dist/components/Slider/Slider.d.ts +57 -0
- package/dist/components/Tabs/Tabs.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +6 -0
- package/dist/design-system-react-components.cjs.development.js +1022 -455
- 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 +1015 -444
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/resources.scss +180 -170
- package/dist/styles.css +1 -1
- package/dist/theme/components/breadcrumb.d.ts +9 -0
- package/dist/theme/components/button.d.ts +10 -0
- package/dist/theme/components/progressIndicator.d.ts +50 -0
- package/dist/theme/components/slider.d.ts +51 -0
- package/dist/theme/foundations/breakpoints.d.ts +8 -8
- package/dist/theme/foundations/global.d.ts +6 -1
- package/package.json +71 -83
- package/src/__tests__/setup.ts +2 -2
- package/src/components/Accordion/Accordion.stories.mdx +30 -34
- package/src/components/Autosuggest/Autosuggest.stories.mdx +3 -3
- package/src/components/Autosuggest/Autosuggest.stories.tsx +1 -0
- package/src/components/Autosuggest/_Autosuggest.scss +5 -5
- package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +24 -8
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +33 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +5 -1
- package/src/components/Breadcrumbs/BreadcrumbsTypes.tsx +1 -0
- package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +297 -1
- package/src/components/Button/Button.stories.mdx +8 -6
- package/src/components/Button/Button.test.tsx +20 -0
- package/src/components/Button/Button.tsx +14 -23
- package/src/components/Button/ButtonTypes.tsx +1 -0
- package/src/components/Button/__snapshots__/Button.test.tsx.snap +29 -4
- package/src/components/Card/Card.stories.mdx +1 -1
- package/src/components/Card/Card.tsx +3 -3
- package/src/components/CardEdition/CardEdition.stories.tsx +15 -47
- package/src/components/CardEdition/_CardEdition.scss +22 -23
- package/src/components/Chakra/Box.stories.mdx +14 -15
- package/src/components/Chakra/Center.stories.mdx +15 -8
- package/src/components/Chakra/Grid.stories.mdx +16 -7
- package/src/components/Chakra/Stack.stories.mdx +35 -18
- package/src/components/DatePicker/DatePicker.test.tsx +31 -30
- package/src/components/DatePicker/DatePicker.tsx +7 -4
- package/src/components/DatePicker/_DatePicker.scss +4 -4
- package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +19 -5
- package/src/components/Form/Form.stories.mdx +4 -5
- package/src/components/Grid/SimpleGrid.stories.mdx +1 -0
- package/src/components/Hero/HeroTypes.tsx +1 -0
- package/src/components/HorizontalRule/HorizontalRule.stories.mdx +2 -3
- package/src/components/Icons/Icon.stories.mdx +2 -3
- package/src/components/Icons/IconSvgs.tsx +6 -0
- package/src/components/Icons/IconTypes.tsx +3 -0
- package/src/components/Image/Image.stories.mdx +2 -3
- package/src/components/Input/Input.stories.tsx +20 -64
- package/src/components/Input/_Input.scss +23 -14
- package/src/components/Modal/Modal.stories.mdx +3 -3
- package/src/components/Modal/_Modal.scss +2 -2
- package/src/components/Notification/Notification.stories.mdx +1 -1
- package/src/components/Notification/Notification.tsx +13 -4
- package/src/components/Pagination/Pagination.stories.mdx +3 -2
- package/src/components/Pagination/Pagination.stories.tsx +1 -2
- package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +292 -0
- package/src/components/ProgressIndicator/ProgressIndicator.test.tsx +225 -0
- package/src/components/ProgressIndicator/ProgressIndicator.tsx +126 -0
- package/src/components/ProgressIndicator/ProgressIndicatorTypes.ts +8 -0
- package/src/components/ProgressIndicator/__snapshots__/ProgressIndicator.test.tsx.snap +357 -0
- package/src/components/Radio/__snapshots__/Radio.test.tsx.snap +3 -0
- package/src/components/RadioGroup/RadioGroup.stories.mdx +2 -3
- package/src/components/RadioGroup/__snapshots__/RadioGroup.test.tsx.snap +4 -0
- package/src/components/SearchBar/SearchBar.Test.tsx +66 -21
- package/src/components/SearchBar/SearchBar.stories.mdx +110 -11
- package/src/components/SearchBar/SearchBar.tsx +15 -5
- package/src/components/Select/SelectTypes.tsx +1 -0
- package/src/components/Slider/Slider.stories.mdx +529 -0
- package/src/components/Slider/Slider.test.tsx +653 -0
- package/src/components/Slider/Slider.tsx +303 -0
- package/src/components/Slider/__snapshots__/Slider.test.tsx.snap +1946 -0
- package/src/components/StyleGuide/Bidirectionality.stories.mdx +1 -1
- package/src/components/StyleGuide/Breakpoints.stories.mdx +21 -7
- package/src/components/StyleGuide/Buttons.stories.mdx +9 -2
- package/src/components/StyleGuide/DesignTokens.stories.mdx +170 -0
- package/src/components/Tabs/Tabs.tsx +5 -5
- package/src/components/Template/Template.stories.mdx +6 -6
- package/src/components/TextInput/TextInput.stories.mdx +1 -1
- package/src/components/TextInput/TextInput.tsx +15 -2
- package/src/components/TextInput/TextInputTypes.tsx +2 -0
- package/src/components/VideoPlayer/VideoPlayer.stories.mdx +2 -3
- package/src/docs/Chakra.stories.mdx +2 -2
- package/src/index.ts +12 -6
- package/src/resources.scss +5 -5
- package/src/styles/base/{_02-breakpoints.scss → _01-breakpoints.scss} +9 -10
- package/src/styles/base/{_03-mixins.scss → _02-mixins.scss} +16 -5
- package/src/styles/base/{_04-base.scss → _03-base.scss} +7 -2
- package/src/styles/base/{_05-focus.scss → _04-focus.scss} +0 -15
- package/src/styles/base/_place-holder.scss +14 -3
- package/src/styles/{03-space → space}/_space-inline.scss +14 -14
- package/src/styles/{03-space → space}/_space-inset.scss +10 -10
- package/src/styles/space/_space-stack.scss +116 -0
- package/src/styles.scss +13 -44
- package/src/theme/components/breadcrumb.ts +10 -0
- package/src/theme/components/button.ts +10 -2
- package/src/theme/components/card.ts +11 -9
- package/src/theme/components/datePicker.ts +1 -1
- package/src/theme/components/list.ts +2 -2
- package/src/theme/components/notification.ts +5 -3
- package/src/theme/components/progressIndicator.ts +62 -0
- package/src/theme/components/skeletonLoader.ts +1 -1
- package/src/theme/components/slider.ts +79 -0
- package/src/theme/foundations/breakpoints.ts +8 -8
- package/src/theme/foundations/global.ts +6 -1
- package/src/theme/index.ts +4 -0
- package/src/utils/componentCategories.ts +3 -3
- package/src/styles/01-colors/_colors-brand.scss +0 -62
- package/src/styles/01-colors/_colors-utility.scss +0 -67
- package/src/styles/02-typography/_type-scale.css +0 -11
- package/src/styles/02-typography/_type-weight.css +0 -7
- package/src/styles/02-typography/_typefaces.css +0 -4
- package/src/styles/03-space/_space-stack.scss +0 -116
- package/src/styles/03-space/_space.css +0 -30
- package/src/styles/base/_card-grid.scss +0 -77
- package/src/styles/base/_typography.scss +0 -11
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React, { useState, forwardRef } from "react";
|
|
2
2
|
import ReactDatePicker from "react-datepicker";
|
|
3
3
|
|
|
4
|
-
import { FormRow, FormField } from "../Form/Form";
|
|
5
4
|
import { DatePickerTypes } from "./DatePickerTypes";
|
|
5
|
+
import Fieldset from "../Fieldset/Fieldset";
|
|
6
|
+
import { FormRow, FormField } from "../Form/Form";
|
|
7
|
+
import { FormSpacing } from "../Form/FormTypes";
|
|
8
|
+
import HelperErrorText from "../HelperErrorText/HelperErrorText";
|
|
6
9
|
import TextInput, {
|
|
7
10
|
InputProps,
|
|
8
11
|
TextInputRefType,
|
|
9
12
|
} from "../TextInput/TextInput";
|
|
10
|
-
import HelperErrorText from "../HelperErrorText/HelperErrorText";
|
|
11
13
|
import generateUUID from "../../helpers/generateUUID";
|
|
12
|
-
import Fieldset from "../Fieldset/Fieldset";
|
|
13
14
|
import { useMultiStyleConfig } from "@chakra-ui/system";
|
|
14
15
|
|
|
15
16
|
// The object shape for the DatePicker's start and end date state values.
|
|
@@ -214,7 +215,9 @@ const DateRangeRow: React.FC<DateRangeRowProps> = ({
|
|
|
214
215
|
children,
|
|
215
216
|
}) =>
|
|
216
217
|
isDateRange ? (
|
|
217
|
-
<FormRow id={`${id}-form-row`}
|
|
218
|
+
<FormRow id={`${id}-form-row`} gap={FormSpacing.ExtraSmall}>
|
|
219
|
+
{children}
|
|
220
|
+
</FormRow>
|
|
218
221
|
) : (
|
|
219
222
|
<>{children}</>
|
|
220
223
|
);
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
&--keyboard-selected,
|
|
20
20
|
&--in-range,
|
|
21
21
|
&--in-selecting-range {
|
|
22
|
-
background-color:
|
|
22
|
+
background-color: var(--nypl-colors-ui-black);
|
|
23
23
|
border-radius: 0;
|
|
24
|
-
color:
|
|
24
|
+
color: var(--nypl-colors-ui-white);
|
|
25
25
|
opacity: 0.3;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
// Selected states.
|
|
29
29
|
&-text--selected,
|
|
30
30
|
&--selected {
|
|
31
|
-
background-color:
|
|
31
|
+
background-color: var(--nypl-colors-ui-black);
|
|
32
32
|
border-radius: 0;
|
|
33
|
-
color:
|
|
33
|
+
color: var(--nypl-colors-ui-white);
|
|
34
34
|
opacity: 1;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -18,7 +18,7 @@ exports[`DatePicker Date Range renders the UI snapshot correctly 1`] = `
|
|
|
18
18
|
</div>
|
|
19
19
|
</legend>
|
|
20
20
|
<div
|
|
21
|
-
className="css-
|
|
21
|
+
className="css-ahcv85"
|
|
22
22
|
id="basic-form-row"
|
|
23
23
|
>
|
|
24
24
|
<div
|
|
@@ -50,6 +50,7 @@ exports[`DatePicker Date Range renders the UI snapshot correctly 1`] = `
|
|
|
50
50
|
onClick={[Function]}
|
|
51
51
|
onFocus={[Function]}
|
|
52
52
|
required={false}
|
|
53
|
+
step={null}
|
|
53
54
|
type="text"
|
|
54
55
|
value="1988-01-02"
|
|
55
56
|
/>
|
|
@@ -86,6 +87,7 @@ exports[`DatePicker Date Range renders the UI snapshot correctly 1`] = `
|
|
|
86
87
|
onClick={[Function]}
|
|
87
88
|
onFocus={[Function]}
|
|
88
89
|
required={false}
|
|
90
|
+
step={null}
|
|
89
91
|
type="text"
|
|
90
92
|
value="1988-02-02"
|
|
91
93
|
/>
|
|
@@ -116,7 +118,7 @@ exports[`DatePicker Date Range renders the UI snapshot correctly 2`] = `
|
|
|
116
118
|
</div>
|
|
117
119
|
</legend>
|
|
118
120
|
<div
|
|
119
|
-
className="css-
|
|
121
|
+
className="css-ahcv85"
|
|
120
122
|
id="no-label-form-row"
|
|
121
123
|
>
|
|
122
124
|
<div
|
|
@@ -148,6 +150,7 @@ exports[`DatePicker Date Range renders the UI snapshot correctly 2`] = `
|
|
|
148
150
|
onClick={[Function]}
|
|
149
151
|
onFocus={[Function]}
|
|
150
152
|
required={false}
|
|
153
|
+
step={null}
|
|
151
154
|
type="text"
|
|
152
155
|
value="1988-01-02"
|
|
153
156
|
/>
|
|
@@ -184,6 +187,7 @@ exports[`DatePicker Date Range renders the UI snapshot correctly 2`] = `
|
|
|
184
187
|
onClick={[Function]}
|
|
185
188
|
onFocus={[Function]}
|
|
186
189
|
required={false}
|
|
190
|
+
step={null}
|
|
187
191
|
type="text"
|
|
188
192
|
value="1988-02-02"
|
|
189
193
|
/>
|
|
@@ -214,7 +218,7 @@ exports[`DatePicker Date Range renders the UI snapshot correctly 3`] = `
|
|
|
214
218
|
</div>
|
|
215
219
|
</legend>
|
|
216
220
|
<div
|
|
217
|
-
className="css-
|
|
221
|
+
className="css-ahcv85"
|
|
218
222
|
id="custom-format-form-row"
|
|
219
223
|
>
|
|
220
224
|
<div
|
|
@@ -246,6 +250,7 @@ exports[`DatePicker Date Range renders the UI snapshot correctly 3`] = `
|
|
|
246
250
|
onClick={[Function]}
|
|
247
251
|
onFocus={[Function]}
|
|
248
252
|
required={false}
|
|
253
|
+
step={null}
|
|
249
254
|
type="text"
|
|
250
255
|
value="1988/02/01"
|
|
251
256
|
/>
|
|
@@ -282,6 +287,7 @@ exports[`DatePicker Date Range renders the UI snapshot correctly 3`] = `
|
|
|
282
287
|
onClick={[Function]}
|
|
283
288
|
onFocus={[Function]}
|
|
284
289
|
required={false}
|
|
290
|
+
step={null}
|
|
285
291
|
type="text"
|
|
286
292
|
value="1988/02/02"
|
|
287
293
|
/>
|
|
@@ -312,7 +318,7 @@ exports[`DatePicker Date Range renders the UI snapshot correctly 4`] = `
|
|
|
312
318
|
</div>
|
|
313
319
|
</legend>
|
|
314
320
|
<div
|
|
315
|
-
className="css-
|
|
321
|
+
className="css-ahcv85"
|
|
316
322
|
id="invalid-form-row"
|
|
317
323
|
>
|
|
318
324
|
<div
|
|
@@ -345,6 +351,7 @@ exports[`DatePicker Date Range renders the UI snapshot correctly 4`] = `
|
|
|
345
351
|
onClick={[Function]}
|
|
346
352
|
onFocus={[Function]}
|
|
347
353
|
required={false}
|
|
354
|
+
step={null}
|
|
348
355
|
type="text"
|
|
349
356
|
value="1988-01-02"
|
|
350
357
|
/>
|
|
@@ -396,6 +403,7 @@ exports[`DatePicker Date Range renders the UI snapshot correctly 4`] = `
|
|
|
396
403
|
onClick={[Function]}
|
|
397
404
|
onFocus={[Function]}
|
|
398
405
|
required={false}
|
|
406
|
+
step={null}
|
|
399
407
|
type="text"
|
|
400
408
|
value="1988-02-02"
|
|
401
409
|
/>
|
|
@@ -449,7 +457,7 @@ exports[`DatePicker Date Range renders the UI snapshot correctly 5`] = `
|
|
|
449
457
|
</div>
|
|
450
458
|
</legend>
|
|
451
459
|
<div
|
|
452
|
-
className="css-
|
|
460
|
+
className="css-ahcv85"
|
|
453
461
|
id="disabled-form-row"
|
|
454
462
|
>
|
|
455
463
|
<div
|
|
@@ -481,6 +489,7 @@ exports[`DatePicker Date Range renders the UI snapshot correctly 5`] = `
|
|
|
481
489
|
onClick={[Function]}
|
|
482
490
|
onFocus={[Function]}
|
|
483
491
|
required={false}
|
|
492
|
+
step={null}
|
|
484
493
|
type="text"
|
|
485
494
|
value="1988-01-02"
|
|
486
495
|
/>
|
|
@@ -517,6 +526,7 @@ exports[`DatePicker Date Range renders the UI snapshot correctly 5`] = `
|
|
|
517
526
|
onClick={[Function]}
|
|
518
527
|
onFocus={[Function]}
|
|
519
528
|
required={false}
|
|
529
|
+
step={null}
|
|
520
530
|
type="text"
|
|
521
531
|
value="1988-02-02"
|
|
522
532
|
/>
|
|
@@ -616,7 +626,11 @@ exports[`DatePicker Single input renders the UI snapshot correctly 2`] = `
|
|
|
616
626
|
onFocus={[Function]}
|
|
617
627
|
required={false}
|
|
618
628
|
type="text"
|
|
629
|
+
<<<<<<< HEAD
|
|
630
|
+
value="2021-11-17"
|
|
631
|
+
=======
|
|
619
632
|
value="1988-01-02"
|
|
633
|
+
>>>>>>> development
|
|
620
634
|
/>
|
|
621
635
|
</div>
|
|
622
636
|
</div>
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
Story,
|
|
4
4
|
Canvas,
|
|
5
5
|
ArgsTable,
|
|
6
|
-
Preview,
|
|
7
6
|
Description,
|
|
8
7
|
} from "@storybook/addon-docs/blocks";
|
|
9
8
|
import { withDesign } from "storybook-addon-designs";
|
|
@@ -57,7 +56,7 @@ The `Form` component renders a standard `<form>` element and should be used to h
|
|
|
57
56
|
|
|
58
57
|
`FormRow` should be used as a parent of multiple `FormField` components when you need to render multiple input components in a horizontal row.
|
|
59
58
|
|
|
60
|
-
<
|
|
59
|
+
<Canvas withToolbar>
|
|
61
60
|
<Story
|
|
62
61
|
name="Form"
|
|
63
62
|
args={{
|
|
@@ -187,7 +186,7 @@ The `Form` component renders a standard `<form>` element and should be used to h
|
|
|
187
186
|
</Form>
|
|
188
187
|
)}
|
|
189
188
|
</Story>
|
|
190
|
-
</
|
|
189
|
+
</Canvas>
|
|
191
190
|
|
|
192
191
|
<ArgsTable story="Form" />
|
|
193
192
|
|
|
@@ -254,7 +253,7 @@ By default, the `Form` component will handle the NYPL spacing around form input
|
|
|
254
253
|
|
|
255
254
|
Below are the spacing variants available with the `FormSpacing` enum.
|
|
256
255
|
|
|
257
|
-
<
|
|
256
|
+
<Canvas>
|
|
258
257
|
<Story
|
|
259
258
|
name="Spacing Variants"
|
|
260
259
|
args={{
|
|
@@ -263,7 +262,7 @@ Below are the spacing variants available with the `FormSpacing` enum.
|
|
|
263
262
|
>
|
|
264
263
|
{getForms(sizes)}
|
|
265
264
|
</Story>
|
|
266
|
-
</
|
|
265
|
+
</Canvas>
|
|
267
266
|
|
|
268
267
|
## Example Code
|
|
269
268
|
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
Story,
|
|
4
4
|
Canvas,
|
|
5
5
|
ArgsTable,
|
|
6
|
-
Preview,
|
|
7
6
|
Description,
|
|
8
7
|
} from "@storybook/addon-docs/blocks";
|
|
9
8
|
import { withDesign } from "storybook-addon-designs";
|
|
@@ -43,8 +42,8 @@ The `HorizontalRule` component renders a basic `<hr>` element. The `height`,
|
|
|
43
42
|
number, a `px` value, a `em` value, or a `rem` value. Otherwise, the default
|
|
44
43
|
value of "2px" will be used.
|
|
45
44
|
|
|
46
|
-
<
|
|
45
|
+
<Canvas withToolbar>
|
|
47
46
|
<Story name="HorizontalRule">{(args) => <HorizontalRule {...args} />}</Story>
|
|
48
|
-
</
|
|
47
|
+
</Canvas>
|
|
49
48
|
|
|
50
49
|
<ArgsTable story="HorizontalRule" />
|
|
@@ -28,8 +28,7 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
28
28
|
parameters={{
|
|
29
29
|
design: {
|
|
30
30
|
type: "figma",
|
|
31
|
-
url:
|
|
32
|
-
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=10734%3A3945",
|
|
31
|
+
url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Main?node-id=10734%3A3945",
|
|
33
32
|
},
|
|
34
33
|
jest: ["Icon.test.tsx"],
|
|
35
34
|
}}
|
|
@@ -45,7 +44,7 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
45
44
|
| Component Version | DS Version |
|
|
46
45
|
| ----------------- | ---------- |
|
|
47
46
|
| Added | `0.0.4` |
|
|
48
|
-
| Latest | `0.25.
|
|
47
|
+
| Latest | `0.25.4` |
|
|
49
48
|
|
|
50
49
|
<Description of={Icon} />
|
|
51
50
|
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import accessibility_full from "../../../icons/svg/accessibility_full.svg";
|
|
3
3
|
import accessibility_partial from "../../../icons/svg/accessibility_partial.svg";
|
|
4
4
|
import action_check_circle from "../../../icons/svg/action_check_circle.svg";
|
|
5
|
+
import action_help_default from "../../../icons/svg/action_help_default.svg";
|
|
6
|
+
import action_help_outline from "../../../icons/svg/action_help_outline.svg";
|
|
7
|
+
import action_launch from "../../../icons/svg/action_launch.svg";
|
|
5
8
|
import arrow from "../../../icons/svg/arrow.svg";
|
|
6
9
|
import brooklyn from "../../../icons/svg/brooklyn.svg";
|
|
7
10
|
import check from "../../../icons/svg/check.svg";
|
|
@@ -51,6 +54,9 @@ export default {
|
|
|
51
54
|
accessibility_full,
|
|
52
55
|
accessibility_partial,
|
|
53
56
|
action_check_circle,
|
|
57
|
+
action_help_default,
|
|
58
|
+
action_help_outline,
|
|
59
|
+
action_launch,
|
|
54
60
|
arrow,
|
|
55
61
|
brooklyn,
|
|
56
62
|
check,
|
|
@@ -50,6 +50,9 @@ export enum IconNames {
|
|
|
50
50
|
AccessibilityFull = "accessibility_full",
|
|
51
51
|
AccessibilityPartial = "accessibility_partial",
|
|
52
52
|
ActionCheckCircle = "action_check_circle",
|
|
53
|
+
ActionHelpDefault = "action_help_default",
|
|
54
|
+
ActionHelpOutline = "action_help_outline",
|
|
55
|
+
ActionLaunch = "action_launch",
|
|
53
56
|
Arrow = "arrow",
|
|
54
57
|
Check = "check",
|
|
55
58
|
Clock = "clock",
|
|
@@ -20,8 +20,7 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
20
20
|
parameters={{
|
|
21
21
|
design: {
|
|
22
22
|
type: "figma",
|
|
23
|
-
url:
|
|
24
|
-
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11896%3A45379",
|
|
23
|
+
url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11896%3A45379",
|
|
25
24
|
},
|
|
26
25
|
jest: ["Image.test.tsx"],
|
|
27
26
|
}}
|
|
@@ -37,7 +36,7 @@ import { getCategory } from "../../utils/componentCategories";
|
|
|
37
36
|
| Component Version | DS Version |
|
|
38
37
|
| ----------------- | ---------- |
|
|
39
38
|
| Added | `0.0.6` |
|
|
40
|
-
| Latest | `0.25.
|
|
39
|
+
| Latest | `0.25.3` |
|
|
41
40
|
|
|
42
41
|
<Description of={Image} />
|
|
43
42
|
|
|
@@ -6,8 +6,6 @@ import Label from "../Label/Label";
|
|
|
6
6
|
import Button from "../Button/Button";
|
|
7
7
|
import { ButtonTypes } from "../Button/ButtonTypes";
|
|
8
8
|
import HelperErrorText from "../HelperErrorText/HelperErrorText";
|
|
9
|
-
// eslint-disable-next-line id-blacklist
|
|
10
|
-
import { text, boolean, select, number } from "@storybook/addon-knobs";
|
|
11
9
|
import { action } from "@storybook/addon-actions";
|
|
12
10
|
import { getCategory } from "../../utils/componentCategories";
|
|
13
11
|
|
|
@@ -16,47 +14,24 @@ export default {
|
|
|
16
14
|
component: Input,
|
|
17
15
|
};
|
|
18
16
|
|
|
19
|
-
let showLabel, showHelperText;
|
|
20
|
-
|
|
21
17
|
export const input = () => (
|
|
22
18
|
<>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
htmlFor="inputID"
|
|
27
|
-
optReqFlag={select(
|
|
28
|
-
"Optional/Required Flag",
|
|
29
|
-
["Required", "Optional", ""],
|
|
30
|
-
"Required"
|
|
31
|
-
)}
|
|
32
|
-
id={"label"}
|
|
33
|
-
>
|
|
34
|
-
{text("Input Label", "Choose your islander name: ")}
|
|
35
|
-
</Label>
|
|
36
|
-
)}
|
|
19
|
+
<Label htmlFor="inputID" optReqFlag="Required" id={"label"}>
|
|
20
|
+
Choose your islander name:
|
|
21
|
+
</Label>
|
|
37
22
|
<Input
|
|
38
23
|
id="inputID"
|
|
39
24
|
ariaLabel="Input Label"
|
|
40
25
|
ariaLabelledBy={"helperText"}
|
|
41
|
-
required={
|
|
42
|
-
placeholder=
|
|
43
|
-
type={
|
|
44
|
-
disabled={
|
|
26
|
+
required={false}
|
|
27
|
+
placeholder="CoolPerson99"
|
|
28
|
+
type={InputTypes.text}
|
|
29
|
+
disabled={false}
|
|
45
30
|
></Input>
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<HelperErrorText
|
|
51
|
-
isInvalid={boolean("Helper Text Errored", false)}
|
|
52
|
-
id={"helperText"}
|
|
53
|
-
>
|
|
54
|
-
{text(
|
|
55
|
-
"Helper Text Content",
|
|
56
|
-
"Once you pick a name for your islander it cannot be changed, so choose wisely!"
|
|
57
|
-
)}
|
|
58
|
-
</HelperErrorText>
|
|
59
|
-
)}
|
|
31
|
+
<HelperErrorText isInvalid={false} id={"helperText"}>
|
|
32
|
+
Once you pick a name for your islander it cannot be changed, so choose
|
|
33
|
+
wisely!
|
|
34
|
+
</HelperErrorText>
|
|
60
35
|
</>
|
|
61
36
|
);
|
|
62
37
|
|
|
@@ -64,8 +39,7 @@ input.storyName = "Input";
|
|
|
64
39
|
input.parameters = {
|
|
65
40
|
design: {
|
|
66
41
|
type: "figma",
|
|
67
|
-
url:
|
|
68
|
-
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11895%3A547",
|
|
42
|
+
url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11895%3A547",
|
|
69
43
|
},
|
|
70
44
|
jest: ["Input.test.tsx"],
|
|
71
45
|
};
|
|
@@ -74,12 +48,7 @@ let groupErrored;
|
|
|
74
48
|
|
|
75
49
|
export const inputGroup = () => (
|
|
76
50
|
<fieldset className="fieldset">
|
|
77
|
-
|
|
78
|
-
? (groupErrored = true)
|
|
79
|
-
: (groupErrored = false)}
|
|
80
|
-
<legend className="legend">
|
|
81
|
-
{text("Input Group Label", "Construction Time Request Form: ")}
|
|
82
|
-
</legend>
|
|
51
|
+
<legend className="legend">Construction Time Request Form:</legend>
|
|
83
52
|
<div className="input-group">
|
|
84
53
|
<div style={{ flex: "1" }}>
|
|
85
54
|
<Label htmlFor="input1" id={"label1"}>
|
|
@@ -87,17 +56,13 @@ export const inputGroup = () => (
|
|
|
87
56
|
</Label>
|
|
88
57
|
<Input
|
|
89
58
|
id="input1"
|
|
90
|
-
ariaLabelledBy=
|
|
91
|
-
groupErrored
|
|
92
|
-
? "helperText1 sharedHelperText label1"
|
|
93
|
-
: "helperText1 label1"
|
|
94
|
-
}
|
|
59
|
+
ariaLabelledBy="helperText1 sharedHelperText label1"
|
|
95
60
|
errored={groupErrored ? true : false}
|
|
96
61
|
required={true}
|
|
97
62
|
type={InputTypes.text}
|
|
98
63
|
></Input>
|
|
99
64
|
<HelperErrorText isInvalid={false} id={"helperText1"}>
|
|
100
|
-
|
|
65
|
+
"E.g., 10am"
|
|
101
66
|
</HelperErrorText>
|
|
102
67
|
</div>
|
|
103
68
|
|
|
@@ -112,23 +77,15 @@ export const inputGroup = () => (
|
|
|
112
77
|
? "helperText2 sharedHelperText label2"
|
|
113
78
|
: "helperText2 label2"
|
|
114
79
|
}
|
|
115
|
-
errored={
|
|
80
|
+
errored={false}
|
|
116
81
|
required={true}
|
|
117
82
|
type={InputTypes.text}
|
|
118
83
|
></Input>
|
|
119
84
|
<HelperErrorText isInvalid={false} id={"helperText2"}>
|
|
120
|
-
|
|
85
|
+
E.g., 11am
|
|
121
86
|
</HelperErrorText>
|
|
122
87
|
</div>
|
|
123
88
|
</div>
|
|
124
|
-
{groupErrored && (
|
|
125
|
-
<HelperErrorText isInvalid={true} id={"sharedHelperText"}>
|
|
126
|
-
{text(
|
|
127
|
-
"Additional Error Text",
|
|
128
|
-
"Sorry villager! Those times are not available right now."
|
|
129
|
-
)}
|
|
130
|
-
</HelperErrorText>
|
|
131
|
-
)}
|
|
132
89
|
<Button
|
|
133
90
|
onClick={action("clicked")}
|
|
134
91
|
id="button"
|
|
@@ -144,8 +101,7 @@ inputGroup.storyName = "Input Group";
|
|
|
144
101
|
inputGroup.parameters = {
|
|
145
102
|
design: {
|
|
146
103
|
type: "figma",
|
|
147
|
-
url:
|
|
148
|
-
"https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11895%3A547",
|
|
104
|
+
url: "https://www.figma.com/file/qShodlfNCJHb8n03IFyApM/Master?node-id=11895%3A547",
|
|
149
105
|
},
|
|
150
106
|
jest: ["Input.test.tsx"],
|
|
151
107
|
};
|
|
@@ -165,8 +121,8 @@ export const inputAttributes = () => (
|
|
|
165
121
|
attributes={{
|
|
166
122
|
onBlur: action("onBlur"),
|
|
167
123
|
onChange: action("onChange"),
|
|
168
|
-
maxLength:
|
|
169
|
-
tabIndex:
|
|
124
|
+
maxLength: 10,
|
|
125
|
+
tabIndex: 0,
|
|
170
126
|
}}
|
|
171
127
|
></Input>
|
|
172
128
|
<HelperErrorText isInvalid={false} id="helperText-attrs">
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
$break-input-mobile: 400px;
|
|
2
2
|
|
|
3
3
|
.input {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
padding: var(--nypl-space-xs);
|
|
5
|
+
margin-bottom: var(--nypl-space-xs);
|
|
6
6
|
|
|
7
|
-
border: 1px solid var(--ui-gray-medium);
|
|
7
|
+
border: 1px solid var(--nypl-colors-ui-gray-medium);
|
|
8
8
|
|
|
9
9
|
&[type="text"],
|
|
10
10
|
&[type="number"],
|
|
@@ -17,43 +17,43 @@ $break-input-mobile: 400px;
|
|
|
17
17
|
|
|
18
18
|
+ .label {
|
|
19
19
|
display: unset;
|
|
20
|
-
margin-left: var(--space-s);
|
|
20
|
+
margin-left: var(--nypl-space-s);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
&::-webkit-input-placeholder {
|
|
25
|
-
color: var(--ui-gray-dark);
|
|
25
|
+
color: var(--nypl-colors-ui-gray-dark);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
&:-moz-placeholder {
|
|
29
|
-
color: var(--ui-gray-dark);
|
|
29
|
+
color: var(--nypl-colors-ui-gray-dark);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
&:-ms-input-placeholder {
|
|
33
|
-
color: var(--ui-gray-dark);
|
|
33
|
+
color: var(--nypl-colors-ui-gray-dark);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
&:hover {
|
|
37
|
-
border-color: var(--ui-gray-dark);
|
|
37
|
+
border-color: var(--nypl-colors-ui-gray-dark);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
&:disabled {
|
|
41
|
-
background-color: var(--ui-gray-xx-light-cool);
|
|
42
|
-
color: var(--ui-gray-xdark);
|
|
41
|
+
background-color: var(--nypl-colors-ui-gray-xx-light-cool);
|
|
42
|
+
color: var(--nypl-colors-ui-gray-xdark);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
&:active,
|
|
46
46
|
&:focus,
|
|
47
47
|
&:active:hover,
|
|
48
48
|
&:focus:hover {
|
|
49
|
-
border: 1px solid var(--ui-focus);
|
|
49
|
+
border: 1px solid var(--nypl-colors-ui-focus);
|
|
50
50
|
box-shadow: 0;
|
|
51
|
-
outline: 1px solid var(--ui-focus);
|
|
51
|
+
outline: 1px solid var(--nypl-colors-ui-focus);
|
|
52
52
|
z-index: 9999;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
&--error {
|
|
56
|
-
border: 1px solid var(--ui-error-primary);
|
|
56
|
+
border: 1px solid var(--nypl-colors-ui-error-primary);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -63,7 +63,16 @@ $break-input-mobile: 400px;
|
|
|
63
63
|
justify-content: space-between;
|
|
64
64
|
|
|
65
65
|
> *:not(:last-child) {
|
|
66
|
-
|
|
66
|
+
margin-right: var(--nypl-space-m);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
// Used in `Input.stories.tsx`
|
|
72
|
+
.fieldset {
|
|
73
|
+
@include fieldset-reset;
|
|
74
|
+
}
|
|
75
|
+
.legend {
|
|
76
|
+
border: 0;
|
|
77
|
+
font-weight: 500;
|
|
78
|
+
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Meta,
|
|
4
4
|
Story,
|
|
5
5
|
ArgsTable,
|
|
6
|
-
|
|
6
|
+
Canvas,
|
|
7
7
|
Description,
|
|
8
8
|
} from "@storybook/addon-docs/blocks";
|
|
9
9
|
import Modal from "./Modal";
|
|
@@ -118,11 +118,11 @@ export const ModalStory = (args) => {
|
|
|
118
118
|
);
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
-
<
|
|
121
|
+
<Canvas withToolbar>
|
|
122
122
|
<Story name="Basic" args={{ open: false }}>
|
|
123
123
|
{(args) => <ModalStory {...args} />}
|
|
124
124
|
</Story>
|
|
125
|
-
</
|
|
125
|
+
</Canvas>
|
|
126
126
|
|
|
127
127
|
<ArgsTable story="Basic" />
|
|
128
128
|
|
|
@@ -11,7 +11,7 @@ import { NotificationTypes } from "./NotificationTypes";
|
|
|
11
11
|
import generateUUID from "../../helpers/generateUUID";
|
|
12
12
|
|
|
13
13
|
interface BaseProps {
|
|
14
|
-
/** Optional prop to control text alignment
|
|
14
|
+
/** Optional prop to control text alignment in `NotificationContent` */
|
|
15
15
|
alignText?: boolean;
|
|
16
16
|
/** Optional prop to control horizontal alignment of the `Notification` content */
|
|
17
17
|
centered?: boolean;
|
|
@@ -22,7 +22,12 @@ interface BaseProps {
|
|
|
22
22
|
notificationType?: NotificationTypes;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
// Used for `NotificationHeading` and `Notification`
|
|
26
|
+
type BasePropsWithoutAlignText = Omit<BaseProps, "alignText">;
|
|
27
|
+
// Used for `NotificationContent`
|
|
28
|
+
type BasePropsWithoutCentered = Omit<BaseProps, "centered">;
|
|
29
|
+
|
|
30
|
+
export interface NotificationProps extends BasePropsWithoutAlignText {
|
|
26
31
|
/** Additional `className` to add. */
|
|
27
32
|
className?: string;
|
|
28
33
|
/** Optional prop to control whether a `Notification` can be dismissed
|
|
@@ -43,7 +48,9 @@ export interface NotificationProps extends BaseProps {
|
|
|
43
48
|
/**
|
|
44
49
|
* NotificationHeading child-component.
|
|
45
50
|
*/
|
|
46
|
-
export function NotificationHeading(
|
|
51
|
+
export function NotificationHeading(
|
|
52
|
+
props: React.PropsWithChildren<BasePropsWithoutAlignText>
|
|
53
|
+
) {
|
|
47
54
|
const { centered, children, icon, notificationType } = props;
|
|
48
55
|
const styles = useMultiStyleConfig("NotificationHeading", {
|
|
49
56
|
centered,
|
|
@@ -62,7 +69,9 @@ export function NotificationHeading(props: React.PropsWithChildren<BaseProps>) {
|
|
|
62
69
|
/**
|
|
63
70
|
* NotificationContent child-component.
|
|
64
71
|
*/
|
|
65
|
-
export function NotificationContent(
|
|
72
|
+
export function NotificationContent(
|
|
73
|
+
props: React.PropsWithChildren<BasePropsWithoutCentered>
|
|
74
|
+
) {
|
|
66
75
|
const { alignText, children, icon, notificationType } = props;
|
|
67
76
|
const styles = useMultiStyleConfig("NotificationContent", {
|
|
68
77
|
alignText,
|