@nypl/design-system-react-components 0.25.7 → 0.25.8

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/components/Icons/IconSvgs.d.ts +1 -0
  3. package/dist/components/Icons/IconTypes.d.ts +1 -0
  4. package/dist/components/Image/ImageTypes.d.ts +3 -1
  5. package/dist/components/Link/LinkTypes.d.ts +1 -0
  6. package/dist/components/Notification/Notification.d.ts +2 -0
  7. package/dist/components/Select/Select.d.ts +2 -0
  8. package/dist/components/Toggle/Toggle.d.ts +47 -0
  9. package/dist/components/Toggle/ToggleSizes.d.ts +4 -0
  10. package/dist/components/VideoPlayer/VideoPlayer.d.ts +5 -3
  11. package/dist/design-system-react-components.cjs.development.js +613 -366
  12. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  13. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  14. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  15. package/dist/design-system-react-components.esm.js +606 -354
  16. package/dist/design-system-react-components.esm.js.map +1 -1
  17. package/dist/index.d.ts +3 -0
  18. package/dist/theme/components/notification.d.ts +8 -4
  19. package/dist/theme/components/toggle.d.ts +68 -0
  20. package/dist/theme/foundations/spacing.d.ts +2 -0
  21. package/package.json +1 -1
  22. package/src/components/Accordion/Accordion.stories.mdx +1 -2
  23. package/src/components/Breadcrumbs/Breadcrumbs.stories.mdx +1 -1
  24. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +10 -0
  25. package/src/components/Breadcrumbs/__snapshots__/Breadcrumbs.test.tsx.snap +99 -0
  26. package/src/components/Button/Button.tsx +0 -1
  27. package/src/components/Card/Card.stories.mdx +74 -7
  28. package/src/components/Card/Card.tsx +9 -8
  29. package/src/components/Card/__snapshots__/Card.test.tsx.snap +67 -35
  30. package/src/components/Chakra/Grid.stories.mdx +11 -14
  31. package/src/components/DatePicker/DatePicker.test.tsx +8 -6
  32. package/src/components/DatePicker/__snapshots__/DatePicker.test.tsx.snap +5 -4
  33. package/src/components/Icons/Icon.stories.mdx +3 -2
  34. package/src/components/Icons/IconSvgs.tsx +2 -0
  35. package/src/components/Icons/IconTypes.tsx +1 -0
  36. package/src/components/Image/Image.stories.mdx +152 -90
  37. package/src/components/Image/Image.test.tsx +10 -0
  38. package/src/components/Image/ImageTypes.ts +2 -0
  39. package/src/components/Image/__snapshots__/Image.test.tsx.snap +24 -8
  40. package/src/components/Label/Label.stories.mdx +1 -1
  41. package/src/components/Link/Link.stories.mdx +2 -3
  42. package/src/components/Link/Link.test.tsx +71 -0
  43. package/src/components/Link/Link.tsx +41 -9
  44. package/src/components/Link/LinkTypes.tsx +1 -0
  45. package/src/components/Link/__snapshots__/Link.test.tsx.snap +201 -0
  46. package/src/components/Notification/Notification.stories.mdx +36 -3
  47. package/src/components/Notification/Notification.test.tsx +62 -16
  48. package/src/components/Notification/Notification.tsx +17 -5
  49. package/src/components/Notification/__snapshots__/Notification.test.tsx.snap +117 -0
  50. package/src/components/Pagination/Pagination.stories.mdx +1 -2
  51. package/src/components/Pagination/__snapshots__/Pagination.test.tsx.snap +42 -0
  52. package/src/components/ProgressIndicator/ProgressIndicator.stories.mdx +2 -3
  53. package/src/components/SearchBar/SearchBar.stories.mdx +1 -1
  54. package/src/components/Select/Select.stories.mdx +132 -55
  55. package/src/components/Select/Select.test.tsx +2 -2
  56. package/src/components/Select/Select.tsx +6 -2
  57. package/src/components/Slider/Slider.stories.mdx +3 -2
  58. package/src/components/Slider/Slider.test.tsx +35 -0
  59. package/src/components/Slider/Slider.tsx +8 -2
  60. package/src/components/Template/Template.stories.mdx +1 -2
  61. package/src/components/Toggle/Toggle.stories.mdx +176 -0
  62. package/src/components/Toggle/Toggle.test.tsx +140 -0
  63. package/src/components/Toggle/Toggle.tsx +118 -0
  64. package/src/components/Toggle/ToggleSizes.tsx +4 -0
  65. package/src/components/Toggle/__snapshots__/Toggle.test.tsx.snap +255 -0
  66. package/src/components/VideoPlayer/VideoPlayer.stories.mdx +39 -18
  67. package/src/components/VideoPlayer/VideoPlayer.test.tsx +103 -1
  68. package/src/components/VideoPlayer/VideoPlayer.tsx +57 -17
  69. package/src/components/VideoPlayer/__snapshots__/VideoPlayer.test.tsx.snap +48 -0
  70. package/src/index.ts +6 -0
  71. package/src/theme/components/breadcrumb.ts +1 -1
  72. package/src/theme/components/card.ts +4 -5
  73. package/src/theme/components/global.ts +1 -1
  74. package/src/theme/components/icon.ts +2 -2
  75. package/src/theme/components/image.ts +8 -0
  76. package/src/theme/components/notification.ts +8 -6
  77. package/src/theme/components/toggle.ts +65 -0
  78. package/src/theme/foundations/spacing.ts +3 -0
  79. package/src/theme/index.ts +2 -0
  80. package/src/utils/componentCategories.ts +3 -1
package/CHANGELOG.md CHANGED
@@ -8,6 +8,34 @@ Currently, this repo is in Prerelease. When it is released, this project will ad
8
8
 
9
9
  ## Prerelease
10
10
 
11
+ ## 0.25.8 (January 6, 2022)
12
+
13
+ ### Adds
14
+
15
+ - Adds `embedCode` prop to `VideoPlayer` component.
16
+ - Adds export statements for `ProgressIndicatorSizes` and `ProgressIndicatorTypes` enums to `index.ts`.
17
+ - Adds `ExtraSmall` and `ExtraExtraSmall` size variants to the `Image` component.
18
+ - Adds `ExtraSmall` and `ExtraExtraSmall` size variants for `CardImage` in the `Card` component.
19
+ - Adds `AlertNotificationImportant` icon to `Icon` component.
20
+ - Adds `Toggle` component.
21
+ - Adds `xxxs` (2px) spacing option to DS design tokens.
22
+ - Adds `external` variant to `Link` component.
23
+
24
+ ### Changes
25
+
26
+ - Changes category for `Table` component from `Basic Elements` to `Page Layout`.
27
+ - Updates the background color for the `Locations` variant in the `Breadcrumbs` component from `section.locations.secondary` to `section.locations.primary`.
28
+ - Updates the `Notification` component to show the `AlertNotificationImportant` icon for the `Standard` variant.
29
+ - Reduces the bottom margin on labels and legends for form components from "16px" to "8px", or "s" to "sx" in Chakra-theme variables.
30
+ - Updates docs for Chakra `Grid` component to use theme object values rather than CSS variables.
31
+ - Updates the spacing in the `Notification` component to improve the alignment of the icon and text elements.
32
+ - Updates the `Notification` component to optionally display/hide the `Icon` in the heading or content area.
33
+
34
+ ### Fixes
35
+
36
+ - Fixes two bugs in the `Slider`: (1) unable to call the `onChange` function when it is not passed, and (2) fixing the default array value for the range slider so it mounts properly.
37
+ - Updates the `Select` component's controlled state so that an initial empty `value` prop is acceptable.
38
+
11
39
  ## 0.25.7 (December 20, 2021)
12
40
 
13
41
  ### Fixes
@@ -20,6 +48,7 @@ Currently, this repo is in Prerelease. When it is released, this project will ad
20
48
 
21
49
  - Adds export statements for `ProgressIndicator` and `Slider` components to `index.ts`.
22
50
  - Adds `Blogs` variant to `Breadcrumbs` component.
51
+ - Adds the `placeholder` prop to the `Select` component.
23
52
 
24
53
  ### Changes
25
54
 
@@ -5,6 +5,7 @@ declare const _default: {
5
5
  action_help_default: string;
6
6
  action_help_outline: string;
7
7
  action_launch: string;
8
+ alert_notification_important: string;
8
9
  arrow: string;
9
10
  brooklyn: string;
10
11
  check: string;
@@ -46,6 +46,7 @@ export declare enum IconNames {
46
46
  ActionCheckCircle = "action_check_circle",
47
47
  ActionHelpDefault = "action_help_default",
48
48
  ActionHelpOutline = "action_help_outline",
49
+ AlertNotificationImportant = "alert_notification_important",
49
50
  ActionLaunch = "action_launch",
50
51
  Arrow = "arrow",
51
52
  Check = "check",
@@ -12,7 +12,9 @@ export declare enum ImageSizes {
12
12
  Default = "default",
13
13
  Large = "large",
14
14
  Medium = "medium",
15
- Small = "small"
15
+ Small = "small",
16
+ ExtraSmall = "xsmall",
17
+ ExtraExtraSmall = "xxsmall"
16
18
  }
17
19
  export declare enum ImageTypes {
18
20
  Default = "default",
@@ -3,5 +3,6 @@ export declare enum LinkTypes {
3
3
  Backwards = "backwards",
4
4
  Button = "button",
5
5
  Default = "default",
6
+ External = "external",
6
7
  Forwards = "forwards"
7
8
  }
@@ -29,6 +29,8 @@ export interface NotificationProps extends BasePropsWithoutAlignText {
29
29
  notificationContent: string | JSX.Element;
30
30
  /** Content to be rendered in a `NotificationHeading` component. */
31
31
  notificationHeading?: string;
32
+ /** Prop to display the `Notification` icon. Defaults to `true`. */
33
+ showIcon?: boolean;
32
34
  }
33
35
  /**
34
36
  * NotificationHeading child-component.
@@ -26,6 +26,8 @@ export interface SelectProps {
26
26
  /** The callback function to get the selected value.
27
27
  * Should be passed along with `value` for controlled components. */
28
28
  onChange?: (event: React.FormEvent) => void;
29
+ /** Placeholder text in the select element. */
30
+ placeholder?: string;
29
31
  /** Offers the ability to hide the helper/invalid text. */
30
32
  showHelperInvalidText?: boolean;
31
33
  /** Offers the ability to show the select's label onscreen or hide it. Refer
@@ -0,0 +1,47 @@
1
+ import * as React from "react";
2
+ import { ToggleSizes } from "./ToggleSizes";
3
+ export interface ToggleProps {
4
+ /** Optionally pass in additional Chakra-based styles. */
5
+ additionalStyles?: {
6
+ [key: string]: any;
7
+ };
8
+ /** Used for uncontrolled scenarios. Sets the state of the Toggle when the page first loads.
9
+ * If true, the toggle will be initially set to the "on" position. */
10
+ defaultChecked?: boolean;
11
+ /** Optional string to populate the HelperErrorText for standard state */
12
+ helperText?: string;
13
+ /** ID that other components can cross reference for accessibility purposes */
14
+ id?: string;
15
+ /** Optional string to populate the HelperErrorText for the error state
16
+ * when `isInvalid` is true. */
17
+ invalidText?: string;
18
+ /** When using the Toggle as a "controlled" form element, you can specify
19
+ * the Toggle's checked state using this prop.
20
+ * Learn more about controlled and uncontrolled form fields:
21
+ * https://goshakkk.name/controlled-vs-uncontrolled-inputs-react/ */
22
+ isChecked?: boolean;
23
+ /** Adds the 'disabled' and `aria-disabled` attributes to the input when true.
24
+ * This also makes the text italic and color scheme gray. */
25
+ isDisabled?: boolean;
26
+ /** Adds the 'aria-invalid' attribute to the input when true. This also makes
27
+ * the color theme "NYPL error" red for the button and text. */
28
+ isInvalid?: boolean;
29
+ /** Adds the 'required' attribute to the input when true. */
30
+ isRequired?: boolean;
31
+ /** The checkbox's label. This will serve as the text content for a `<label>`
32
+ * element if `showlabel` is true, or an "aria-label" if `showLabel` is false. */
33
+ labelText: string;
34
+ /** The name prop indicates into which group of checkboxes this checkbox
35
+ * belongs. If none is specified, 'default' will be used */
36
+ name?: string;
37
+ /** The action to perform on the `<input>`'s onChange function */
38
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
39
+ /** Offers the ability to hide the helper/invalid text. */
40
+ size?: ToggleSizes;
41
+ }
42
+ export declare const onChangeDefault: () => void;
43
+ /**
44
+ * Component that renders Chakra's `Switch` component along with NYPL defaults.
45
+ */
46
+ declare const Toggle: React.ForwardRefExoticComponent<ToggleProps & React.RefAttributes<HTMLInputElement>>;
47
+ export default Toggle;
@@ -0,0 +1,4 @@
1
+ export declare enum ToggleSizes {
2
+ Large = "large",
3
+ Small = "small"
4
+ }
@@ -7,19 +7,21 @@ export interface VideoPlayerProps {
7
7
  className?: string;
8
8
  /** Optional string to set the text for a video description */
9
9
  descriptionText?: string;
10
+ /** Optional string to set a code snippet provided by YouTube or Vimeo; the `videoPlayer` component will accept the `embedCode` prop or the `videoId` and `videoType` props */
11
+ embedCode?: string;
10
12
  /** Optional string to set the text for a `Heading` component */
11
13
  headingText?: string;
12
14
  /** Optional string to set the text for a `HelperErrorText` component */
13
15
  helperText?: string;
14
16
  /** ID that other components can cross reference for accessibility purposes */
15
17
  id?: string;
16
- /** Optional title to be added to the `<iframe>` element for improved accessibility; this title should describe in a few words the content of the video; if omitted, a generic title will be added */
18
+ /** Optional title to be added to the `<iframe>` element for improved accessibility; this title should describe in a few words the content of the video; if omitted, a generic title will be added; if a `title` attribute is already present in the `embedCode` prop, this prop will be ignored */
17
19
  iframeTitle?: string;
18
20
  /** Offers the ability to hide the helper/invalid text. */
19
21
  showHelperInvalidText?: boolean;
20
22
  /** Required YouTube or Vimeo video ID. This value can be pulled from a video's YouTube or Vimeo URL. */
21
- videoId: string;
23
+ videoId?: string;
22
24
  /** Required. Used to specify which video service is being used. */
23
- videoType: VideoPlayerTypes;
25
+ videoType?: VideoPlayerTypes;
24
26
  }
25
27
  export default function VideoPlayer(props: React.PropsWithChildren<VideoPlayerProps>): JSX.Element;