@nypl/design-system-react-components 1.3.0 → 1.4.0-rc

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 (32) hide show
  1. package/dist/components/FilterBar/FilterBar.d.ts +111 -0
  2. package/dist/components/FilterBar/FilterBar.stories.d.ts +7 -0
  3. package/dist/components/HelperErrorText/HelperErrorText.d.ts +6 -6
  4. package/dist/components/MultiSelect/MultiSelect.d.ts +78 -0
  5. package/dist/components/MultiSelect/MultiSelect.stories.d.ts +4 -0
  6. package/dist/components/MultiSelect/MultiSelectDialog.d.ts +8 -0
  7. package/dist/components/MultiSelect/MultiSelectListbox.d.ts +9 -0
  8. package/dist/components/MultiSelect/MultiSelectMenuButton.d.ts +27 -0
  9. package/dist/components/MultiSelectGroup/MultiSelectGroup.d.ts +26 -0
  10. package/dist/components/MultiSelectGroup/MultiSelectGroup.stories.d.ts +4 -0
  11. package/dist/components/Slider/Slider.d.ts +2 -0
  12. package/dist/components/TextInput/TextInput.d.ts +2 -0
  13. package/dist/design-system-react-components.cjs.development.js +1425 -287
  14. package/dist/design-system-react-components.cjs.development.js.map +1 -1
  15. package/dist/design-system-react-components.cjs.production.min.js +1 -1
  16. package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
  17. package/dist/design-system-react-components.esm.js +1422 -289
  18. package/dist/design-system-react-components.esm.js.map +1 -1
  19. package/dist/hooks/__tests__/useFilterBar.test.d.ts +1 -0
  20. package/dist/hooks/__tests__/useMultiSelect.test.d.ts +1 -0
  21. package/dist/hooks/useFilterBar.d.ts +21 -0
  22. package/dist/hooks/useMultiSelect.d.ts +15 -0
  23. package/dist/index.d.ts +5 -0
  24. package/dist/theme/components/feedbackBox.d.ts +6 -0
  25. package/dist/theme/components/filterBar.d.ts +30 -0
  26. package/dist/theme/components/link.d.ts +22 -0
  27. package/dist/theme/components/multiSelect.d.ts +29 -0
  28. package/dist/theme/components/multiSelectMenuButton.d.ts +72 -0
  29. package/dist/theme/components/select.d.ts +3 -3
  30. package/dist/utils/utils.d.ts +6 -0
  31. package/package.json +1 -1
  32. package/CHANGELOG.md +0 -1724
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ import { SelectedItems } from "./../components/MultiSelect/MultiSelect";
2
+ /**
3
+ * The `useFilterBar` hook returns an object containing all the functions and state needed to control a FilterBar component and its child components.
4
+ * The returned object includes the functions `onChange`, `onMixedStateChange`, `onClear` and `onClearAll` for handling any changes to the selectedItems object,
5
+ * a `setSelectedItems` function that allows to set an initial selectedItems state
6
+ * and the current state of the selection: `selectedItems`.
7
+ * In addition it returns all props to handle a filter module overlay for the mobile view: a boolean value representing the current module state: `isModalOpen`,
8
+ * an `onToggle` function to change the module state or alternatively `onOpen` and `onClose` functions.
9
+ */
10
+ export default function useFilterBar(initialState?: SelectedItems): {
11
+ selectedItems: {} | SelectedItems;
12
+ setSelectedItems: (newState: SelectedItems) => void;
13
+ isModalOpen: boolean;
14
+ onOpen: () => void;
15
+ onClose: () => void;
16
+ onToggle: () => void;
17
+ onChange: (itemId: string, multiSelectId: string) => void;
18
+ onMixedStateChange: (parentId: string, multiSelectId: string, items: import("../components/MultiSelect/MultiSelect").MultiSelectItem[]) => void;
19
+ onClear: (multiSelectId: string) => void;
20
+ onClearAll: () => void;
21
+ };
@@ -0,0 +1,15 @@
1
+ import { MultiSelectItem, SelectedItems } from "../components/MultiSelect/MultiSelect";
2
+ /**
3
+ * The useMultiSelect hook returns an object containing all the functions and state needed to handle the selectedItems of a `MultiSelect` component.
4
+ * It can be used in conjunction with one single `MultiSelect` component as well as a group of `MultiSelect`s in the `MultiSelectGroup` component.
5
+ * The returned object includes the functions onChange, onClear, onMixedStateChange for handling any changes to the selection of items
6
+ * and the current state of the selection: selectedItems.
7
+ */
8
+ export default function useMultiSelect(initialState?: SelectedItems): {
9
+ selectedItems: {} | SelectedItems;
10
+ setSelectedItems: (newState: SelectedItems) => void;
11
+ onChange: (itemId: string, multiSelectId: string) => void;
12
+ onMixedStateChange: (parentId: string, multiSelectId: string, items: MultiSelectItem[]) => void;
13
+ onClear: (multiSelectId: string) => void;
14
+ onClearAll: () => void;
15
+ };
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export { default as DatePicker, DatePickerTypes, FullDateType, } from "./compone
14
14
  export { default as DSProvider } from "./theme/provider";
15
15
  export { default as FeedbackBox, useFeedbackBox, } from "./components/FeedbackBox/FeedbackBox";
16
16
  export { default as Fieldset } from "./components/Fieldset/Fieldset";
17
+ export { default as FilterBar } from "./components/FilterBar/FilterBar";
17
18
  export { default as Footer } from "./components/Footer/Footer";
18
19
  export { default as Form, FormField, FormRow } from "./components/Form/Form";
19
20
  export { default as Header } from "./components/Header/Header";
@@ -29,6 +30,8 @@ export { default as Link, LinkTypes } from "./components/Link/Link";
29
30
  export { default as List, ListTypes } from "./components/List/List";
30
31
  export { default as Logo, LogoNames, LogoSizes } from "./components/Logo/Logo";
31
32
  export { ModalTrigger, useModal } from "./components/Modal/Modal";
33
+ export { default as MultiSelect, MultiSelectProps, MultiSelectItem, SelectedItems, } from "./components/MultiSelect/MultiSelect";
34
+ export { default as MultiSelectGroup, MultiSelectGroupProps, } from "./components/MultiSelectGroup/MultiSelectGroup";
32
35
  export { default as Notification, NotificationTypes, } from "./components/Notification/Notification";
33
36
  export { default as Pagination } from "./components/Pagination/Pagination";
34
37
  export { default as ProgressIndicator, ProgressIndicatorSizes, ProgressIndicatorTypes, } from "./components/ProgressIndicator/ProgressIndicator";
@@ -52,6 +55,8 @@ export { default as Text, TextSizes } from "./components/Text/Text";
52
55
  export { default as TextInput, TextInputRefType, TextInputTypes, } from "./components/TextInput/TextInput";
53
56
  export { default as Toggle, ToggleSizes } from "./components/Toggle/Toggle";
54
57
  export { default as useCarouselStyles } from "./hooks/useCarouselStyles";
58
+ export { default as useFilterBar } from "./hooks/useFilterBar";
59
+ export { default as useMultiSelect } from "./hooks/useMultiSelect";
55
60
  export { default as useNYPLBreakpoints } from "./hooks/useNYPLBreakpoints";
56
61
  export { default as useNYPLTheme } from "./hooks/useNYPLTheme";
57
62
  export { default as useWindowSize } from "./hooks/useWindowSize";
@@ -2,7 +2,12 @@ declare const FeedbackBox: {
2
2
  parts: string[];
3
3
  baseStyle: {
4
4
  closeButton: {
5
+ /** This is overriding the default min-height value in order to keep the
6
+ * button spacing symmetrical. */
7
+ minHeight: string;
8
+ right: string;
5
9
  p: string;
10
+ position: string;
6
11
  span: {
7
12
  clip: string;
8
13
  height: {
@@ -20,6 +25,7 @@ declare const FeedbackBox: {
20
25
  };
21
26
  wordWrap: string;
22
27
  };
28
+ top: string;
23
29
  };
24
30
  drawerBody: {
25
31
  paddingTop: string;
@@ -0,0 +1,30 @@
1
+ export declare const filterBarWidth: {
2
+ default: {
3
+ width: {
4
+ base: string;
5
+ md: string;
6
+ };
7
+ };
8
+ full: {
9
+ width: string;
10
+ };
11
+ };
12
+ declare const FilterBar: {
13
+ parts: string[];
14
+ baseStyle: ({ width }: {
15
+ width: any;
16
+ }) => {
17
+ width: string;
18
+ modalHeader: {
19
+ bg: string;
20
+ };
21
+ modalFooter: {
22
+ bg: string;
23
+ };
24
+ modalCloseButton: {
25
+ mt: string;
26
+ };
27
+ globalButtonGroupWrapper: any;
28
+ };
29
+ };
30
+ export default FilterBar;
@@ -6,12 +6,34 @@ export declare const baseLinkStyles: {
6
6
  };
7
7
  };
8
8
  declare const Link: {
9
+ parts: string[];
9
10
  baseStyle: {
11
+ /** This is needed for custom anchor elements or link components
12
+ * that are passed as children to the `Link` component. */
10
13
  a: {
11
14
  _hover: {
12
15
  color: string;
13
16
  };
14
17
  };
18
+ /** The element will handle descriptive text added to aid
19
+ * screen readers. */
20
+ srOnly: {
21
+ clip: string;
22
+ height: {
23
+ base: string;
24
+ md: string;
25
+ };
26
+ overflow: string;
27
+ position: {
28
+ base: string;
29
+ md: string;
30
+ };
31
+ width: {
32
+ base: string;
33
+ md: string;
34
+ };
35
+ wordWrap: string;
36
+ };
15
37
  color: string;
16
38
  textDecoration: string;
17
39
  _hover: {
@@ -0,0 +1,29 @@
1
+ export declare const multiSelectWidths: {
2
+ default: {
3
+ width: {
4
+ base: string;
5
+ md: string;
6
+ };
7
+ };
8
+ fitContent: {
9
+ width: {
10
+ base: string;
11
+ md: string;
12
+ };
13
+ minWidth: {
14
+ md: string;
15
+ };
16
+ };
17
+ full: {
18
+ width: string;
19
+ };
20
+ };
21
+ declare const MultiSelect: {
22
+ parts: string[];
23
+ baseStyle: ({ isBlockElement, isOpen, width }: {
24
+ isBlockElement: any;
25
+ isOpen: any;
26
+ width?: string;
27
+ }) => any;
28
+ };
29
+ export default MultiSelect;
@@ -0,0 +1,72 @@
1
+ declare const MultiSelectMenuButton: {
2
+ parts: string[];
3
+ baseStyle: ({ hasSelectedItems, isOpen }: {
4
+ hasSelectedItems?: boolean;
5
+ isOpen?: boolean;
6
+ }) => {
7
+ buttonLabel: {
8
+ justifyContent: string;
9
+ overflow: string;
10
+ marginLeft: string;
11
+ marginRight: string;
12
+ textAlign: string;
13
+ textOverflow: string;
14
+ whiteSpace: string;
15
+ transition: string;
16
+ };
17
+ menuButton: {
18
+ alignItems: string;
19
+ backgroundColor: string;
20
+ borderBottomLeftRadius: string;
21
+ borderBottomRightRadius: string;
22
+ borderColor: string;
23
+ borderRadius: string;
24
+ borderWidth: string;
25
+ fontSize: string;
26
+ minHeight: {
27
+ base: string;
28
+ md: string;
29
+ };
30
+ px: string;
31
+ py: string;
32
+ display: string;
33
+ justifyContent: string;
34
+ width: string;
35
+ _hover: {
36
+ backgroundColor: string;
37
+ borderColor: string;
38
+ };
39
+ svg: {
40
+ marginTop: string;
41
+ };
42
+ };
43
+ selectedItemsCountButton: {
44
+ alignItems: string;
45
+ backgroundColor: string;
46
+ border: string;
47
+ borderRadius: string;
48
+ borderColor: string;
49
+ display: string;
50
+ flexShrink: number;
51
+ fontSize: string;
52
+ justifyContent: string;
53
+ left: string;
54
+ marginRight: string;
55
+ position: string;
56
+ top: {
57
+ base: string;
58
+ md: string;
59
+ };
60
+ width: string;
61
+ _hover: {
62
+ borderColor: string;
63
+ };
64
+ svg: {
65
+ marginLeft: string;
66
+ marginRight: string;
67
+ marginTop: string;
68
+ };
69
+ };
70
+ };
71
+ };
72
+ export default MultiSelectMenuButton;
@@ -4,9 +4,6 @@ interface SelectBaseStyle {
4
4
  declare const Select: {
5
5
  parts: string[];
6
6
  baseStyle: ({ labelPosition }: SelectBaseStyle) => {
7
- ".chakra-select__icon-wrapper": {
8
- zIndex: string;
9
- };
10
7
  inline: {
11
8
  display: {
12
9
  md: string;
@@ -52,6 +49,9 @@ declare const Select: {
52
49
  opacity: string;
53
50
  };
54
51
  _focus: {
52
+ "+ .chakra-select__icon-wrapper": {
53
+ zIndex: string;
54
+ };
55
55
  borderColor: string;
56
56
  boxShadow: string;
57
57
  outline: string;
@@ -28,4 +28,10 @@ interface GetAriaAttrsProps {
28
28
  * `aria-describedby` attributes, based on the label and footnote values.
29
29
  */
30
30
  export declare const getAriaAttrs: ({ footnote, id, labelText, name, showLabel, }: GetAriaAttrsProps) => AriaAttributes;
31
+ /** Convert a hex color value to an rgb or rgba value */
32
+ export declare const hexToRGB: (hex: string, alpha: number) => string;
33
+ /** Calculate color luminance */
34
+ export declare const colorLuminance: (r: any, g: any, b: any) => number;
35
+ /** Calculate color contrast ratio */
36
+ export declare const contrastRatio: (hex1: string, hex2: string) => string;
31
37
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nypl/design-system-react-components",
3
- "version": "1.3.0",
3
+ "version": "1.4.0-rc",
4
4
  "description": "NYPL Reservoir Design System React Components",
5
5
  "repository": {
6
6
  "type": "git",