@deskpro/deskpro-ui 4.6.0 → 5.0.0

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 (49) hide show
  1. package/dist/cjs/components/Card/CardKanban.js.map +1 -1
  2. package/dist/cjs/components/Card/CardList.js.map +1 -1
  3. package/dist/cjs/components/Dialog/Dialog.js +17 -8
  4. package/dist/cjs/components/Dialog/Dialog.js.map +1 -1
  5. package/dist/cjs/components/Dropdown/Dropdown.js +7 -4
  6. package/dist/cjs/components/Dropdown/Dropdown.js.map +1 -1
  7. package/dist/cjs/components/Dropdown/styles.js +1 -0
  8. package/dist/cjs/components/Dropdown/styles.js.map +1 -1
  9. package/dist/cjs/components/Icon/customIconsCodegen.js +4 -3
  10. package/dist/cjs/components/Icon/customIconsCodegen.js.map +1 -1
  11. package/dist/cjs/components/Infinite/Infinite.js +98 -58
  12. package/dist/cjs/components/Infinite/Infinite.js.map +1 -1
  13. package/dist/cjs/components/Infinite/ObservedDiv.js +2 -2
  14. package/dist/cjs/components/Infinite/ObservedDiv.js.map +1 -1
  15. package/dist/cjs/components/Infinite/styles.js.map +1 -1
  16. package/dist/cjs/components/Input/Input.js +1 -1
  17. package/dist/cjs/components/Input/Input.js.map +1 -1
  18. package/dist/cjs/components/Modal/Modal.js +35 -14
  19. package/dist/cjs/components/Modal/Modal.js.map +1 -1
  20. package/dist/cjs/utils/useInView.js +27 -0
  21. package/dist/cjs/utils/useInView.js.map +1 -0
  22. package/dist/deskpro-custom-icons.css +9 -6
  23. package/dist/deskpro-ui.d.ts +36 -17
  24. package/dist/esm/components/Card/CardKanban.js.map +1 -1
  25. package/dist/esm/components/Card/CardList.js.map +1 -1
  26. package/dist/esm/components/Dialog/Dialog.js +17 -8
  27. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  28. package/dist/esm/components/Dropdown/Dropdown.js +7 -4
  29. package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
  30. package/dist/esm/components/Dropdown/styles.js +1 -0
  31. package/dist/esm/components/Dropdown/styles.js.map +1 -1
  32. package/dist/esm/components/Icon/customIconsCodegen.js +4 -3
  33. package/dist/esm/components/Icon/customIconsCodegen.js.map +1 -1
  34. package/dist/esm/components/Infinite/Infinite.js +99 -59
  35. package/dist/esm/components/Infinite/Infinite.js.map +1 -1
  36. package/dist/esm/components/Infinite/ObservedDiv.js +2 -2
  37. package/dist/esm/components/Infinite/ObservedDiv.js.map +1 -1
  38. package/dist/esm/components/Infinite/styles.js.map +1 -1
  39. package/dist/esm/components/Input/Input.js +1 -1
  40. package/dist/esm/components/Input/Input.js.map +1 -1
  41. package/dist/esm/components/Modal/Modal.js +37 -16
  42. package/dist/esm/components/Modal/Modal.js.map +1 -1
  43. package/dist/esm/utils/useInView.js +25 -0
  44. package/dist/esm/utils/useInView.js.map +1 -0
  45. package/dist/fonts/DpCustomIcons/DpCustomIcons.eot +0 -0
  46. package/dist/fonts/DpCustomIcons/DpCustomIcons.woff +0 -0
  47. package/dist/fonts/DpCustomIcons/DpCustomIcons.woff2 +0 -0
  48. package/dist/tsdoc-metadata.json +1 -1
  49. package/package.json +24 -24
@@ -1,11 +1,12 @@
1
1
  import { Overlay } from "../Overlay";
2
2
  import { motion } from "framer-motion";
3
- import styled from "styled-components";
3
+ import styled, { css } from "styled-components";
4
4
  import * as React from "react";
5
5
  import { Stack } from "../../layout";
6
- import { TSpan } from "../Typography";
6
+ import { TSpan, v2Styles } from "../Typography";
7
7
  import { IconButton } from "../Button";
8
8
  import { dpNameProp } from "../../utils/dpName";
9
+ import { match } from "ts-pattern";
9
10
  const ModalPositonContainer = styled.div `
10
11
  position: absolute;
11
12
  ${({ top }) => (top ? "top: " + top : "")};
@@ -27,10 +28,21 @@ const ModalContainer = styled.div `
27
28
  border-radius: 8px;
28
29
  display: flex;
29
30
  flex-direction: column;
30
- padding-bottom: 10px;
31
31
  pointer-events: all;
32
- width: ${(props) => props.width ? props.width : "calc(100vw - 80px)"}; // Space for the close btn
33
- height: ${(props) => (props.height ? props.height : "90vh")};
32
+ width: ${(props) => props.width
33
+ ? props.width
34
+ : match(props.size)
35
+ .with("small", () => "480px")
36
+ .with("medium", () => "640px")
37
+ .with("large", () => "840px")
38
+ .with("xlarge", () => "1200px")
39
+ .exhaustive()}; // Space for the close btn
40
+ max-width: calc(100vw - 96px);
41
+ max-height: calc(100vh - 96px);
42
+ ${(props) => props.height &&
43
+ css `
44
+ height: ${props.height};
45
+ `};
34
46
  overflow: hidden;
35
47
  z-index: 20;
36
48
  filter: drop-shadow(0px 8px 20px rgba(0, 0, 0, 0.15));
@@ -59,23 +71,25 @@ const ModalClose = styled.div `
59
71
  color: ${({ theme }) => theme.colors.brandShade100};
60
72
  }
61
73
  `;
62
- const headerHeight = {
63
- small: 32,
64
- medium: 40,
65
- large: 48,
66
- xlarge: 76,
67
- };
68
74
  const ModalHeaderContainer = styled(Stack) `
69
75
  background-color: ${(props) => props.backgroundColor ? props.theme.colors[props.backgroundColor] : props.theme.colors.grey5};
70
76
  color: ${(props) => (props.color ? props.theme.colors[props.color] : props.theme.colors.grey100)};
71
- height: ${({ size = "small" }) => headerHeight[size]}px;
72
- padding: 0 12px;
77
+ padding: 16px 24px;
73
78
  flex-shrink: 0;
79
+ border-bottom: 1px solid ${({ theme }) => theme.colors.grey20};
80
+ `;
81
+ const ModalContent = styled.div `
82
+ padding: 20px 24px;
83
+ ${v2Styles.p_p2_paragraph}
84
+ `;
85
+ const ModalFooter = styled.div `
86
+ padding: 16px;
87
+ border-top: 1px solid ${({ theme }) => theme.colors.grey20};
74
88
  `;
75
89
  /**
76
90
  * @public
77
91
  */
78
- export function Modal({ isOpen, canClickOutsideClose, canEscClose, children, hasBackdrop, onRequestClose, closeIcon, autofocus, height, width, hideClose, top, bottom, left, right, zIndex, }) {
92
+ export function Modal({ isOpen, canClickOutsideClose, canEscClose, children, hasBackdrop, onRequestClose, closeIcon, autofocus, height, width, hideClose, top, bottom, left, right, zIndex, size = "medium", header, content, footer, }) {
79
93
  return (React.createElement(Overlay, { ...dpNameProp("Modal"), hasBackdrop: hasBackdrop, isOpen: isOpen, onRequestClose: onRequestClose, canEscClose: canEscClose, canClickOutsideClose: canClickOutsideClose, autofocus: autofocus, zIndex: zIndex },
80
94
  React.createElement(ModalOverlayContainer, { transition: {
81
95
  type: "spring",
@@ -85,12 +99,19 @@ export function Modal({ isOpen, canClickOutsideClose, canEscClose, children, has
85
99
  React.createElement(ModalCloseContainer, null,
86
100
  !hideClose && (React.createElement(ModalClose, null,
87
101
  React.createElement(IconButton, { icon: closeIcon, minimal: true }))),
88
- React.createElement(ModalContainer, { role: "dialog", width: width, height: height }, children))))));
102
+ React.createElement(ModalContainer, { role: "dialog", width: width, height: height, size: size },
103
+ header && React.createElement(ModalHeader, { size: size, title: header }),
104
+ content && React.createElement(ModalContent, null, content),
105
+ children,
106
+ footer && React.createElement(ModalFooter, null, footer)))))));
89
107
  }
90
108
  /**
91
109
  * @public
92
110
  */
93
111
  export function ModalHeader({ title, backgroundColor, color, children, size }) {
94
- return (React.createElement(ModalHeaderContainer, { as: "header", justify: "start", align: "center", backgroundColor: backgroundColor, color: color, shrink: 0, size: size }, children !== null && children !== void 0 ? children : (React.createElement(TSpan, { type: "h4", as: "h4" }, title))));
112
+ return (React.createElement(ModalHeaderContainer, { as: "header", justify: "start", align: "center", backgroundColor: backgroundColor, color: color, shrink: 0, size: size }, children !== null && children !== void 0 ? children : (React.createElement(TSpan, { type: match(size)
113
+ .with("small", () => "h_h4")
114
+ .with("large", "xlarge", () => "h_h2")
115
+ .otherwise(() => "h_h3"), as: "h4" }, title))));
95
116
  }
96
117
  //# sourceMappingURL=Modal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO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AE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAoB;IAC7F,OAAO,CACL,oBAAC,oBAAoB,IACnB,EAAE,EAAC,QAAQ,EACX,OAAO,EAAC,OAAO,EACf,KAAK,EAAC,QAAQ,EACd,eAAe,EAAE,eAAe,EAChC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,CAAC,EACT,IAAI,EAAE,IAAI,IAET,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,CACX,oBAAC,KAAK,IACJ,IAAI,EAAE,KAAK,CAAiC,IAAI,CAAC;aAC9C,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC;aAC3B,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC;aACrC,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,EAC1B,EAAE,EAAC,IAAI,IAEN,KAAK,CACA,CACT,CACoB,CACxB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { useEffect, useMemo, useState } from "react";
2
+ // hook that detects when the provided element is within the viewport
3
+ const useInView = () => {
4
+ const [ref, setRef] = useState(null);
5
+ const [inView, setInView] = useState(false);
6
+ const visibilityOptions = useMemo(() => ({
7
+ root: null,
8
+ threshold: [0, 1],
9
+ }), []);
10
+ useEffect(() => {
11
+ if (!ref)
12
+ return;
13
+ const observer = new IntersectionObserver((entries) => entries.forEach((entry) => {
14
+ setInView(entry.isIntersecting);
15
+ }), visibilityOptions);
16
+ observer.observe(ref);
17
+ return () => {
18
+ setInView(false);
19
+ observer.disconnect();
20
+ };
21
+ }, [ref, visibilityOptions]);
22
+ return useMemo(() => ({ ref: setRef, inView }), [inView]);
23
+ };
24
+ export default useInView;
25
+ //# sourceMappingURL=useInView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInView.js","sourceRoot":"","sources":["../../../src/utils/useInView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,O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}
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deskpro/deskpro-ui",
3
- "version": "4.6.0",
3
+ "version": "5.0.0",
4
4
  "description": "Deskpro UI components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/deskpro/deskpro-ui/issues"
@@ -23,8 +23,8 @@
23
23
  ],
24
24
  "peerDependencies": {
25
25
  "@typescript/lib-dom": "npm:@types/web",
26
- "react": "^17 || ^18",
27
- "react-dom": "^17 || ^18",
26
+ "react": "^18",
27
+ "react-dom": "^18",
28
28
  "styled-components": "^5"
29
29
  },
30
30
  "dependencies": {
@@ -41,8 +41,8 @@
41
41
  "react-highlight-words": "^0.17.0",
42
42
  "react-is": "^17.0.2",
43
43
  "react-popper": "^2.2.4",
44
- "simplebar-react": "^2.3.6",
45
44
  "simplebar": "^5.3.6",
45
+ "simplebar-react": "^2.3.6",
46
46
  "tippy.js": "^6.3.1",
47
47
  "ts-pattern": "^4.0.5",
48
48
  "tslib": "~2.4.0",
@@ -54,33 +54,33 @@
54
54
  "@babel/core": "^7.17.10",
55
55
  "@changesets/changelog-git": "^0.1.11",
56
56
  "@changesets/cli": "^2.24.3",
57
- "@microsoft/api-extractor": "7.29.5",
57
+ "@microsoft/api-extractor": "^7.33.6",
58
58
  "@shopify/jest-dom-mocks": "^3.0.16",
59
- "@storybook/addon-actions": "^6.4.22",
60
- "@storybook/addon-docs": "^6.4.22",
61
- "@storybook/addon-essentials": "^6.4.22",
62
- "@storybook/addon-interactions": "^6.4.22",
59
+ "@storybook/addon-actions": "^6.5.13",
60
+ "@storybook/addon-docs": "^6.5.13",
61
+ "@storybook/addon-essentials": "^6.5.13",
62
+ "@storybook/addon-interactions": "^6.5.13",
63
63
  "@storybook/addon-knobs": "^6.4.0",
64
- "@storybook/addon-links": "^6.4.22",
65
- "@storybook/addons": "^6.4.22",
66
- "@storybook/api": "^6.4.22",
67
- "@storybook/components": "^6.4.22",
68
- "@storybook/core-events": "^6.4.22",
69
- "@storybook/react": "^6.4.22",
70
- "@storybook/testing-library": "^0.0.9",
71
- "@storybook/theming": "^6.4.22",
64
+ "@storybook/addon-links": "^6.5.13",
65
+ "@storybook/addons": "^6.5.13",
66
+ "@storybook/api": "^6.5.13",
67
+ "@storybook/components": "^6.5.13",
68
+ "@storybook/core-events": "^6.5.13",
69
+ "@storybook/react": "^6.5.13",
70
+ "@storybook/testing-library": "^0.0.13",
71
+ "@storybook/theming": "^6.5.13",
72
72
  "@swc/core": "^1.2.218",
73
73
  "@swc/jest": "^0.2.22",
74
74
  "@testing-library/dom": "^8.16.1",
75
75
  "@testing-library/jest-dom": "^5.16.4",
76
- "@testing-library/react": "^12.1.5",
76
+ "@testing-library/react": "^13.4.0",
77
77
  "@testing-library/user-event": "^14.4.2",
78
78
  "@types/jest": "^27.5.1",
79
79
  "@types/node": "^17.0.32",
80
+ "@types/react": "18.0.17",
80
81
  "@types/react-dom": "18.0.6",
81
82
  "@types/react-highlight-words": "^0.16.4",
82
83
  "@types/react-is": "^17.0.3",
83
- "@types/react": "18.0.17",
84
84
  "@types/styled-components": "^5.1.23",
85
85
  "@types/testing-library__jest-dom": "^5.14.3",
86
86
  "@types/uuid": "^8.3.4",
@@ -91,28 +91,28 @@
91
91
  "chromatic": "6.5.4",
92
92
  "conditional-type-checks": "1.0.5",
93
93
  "cross-env": "^7.0.3",
94
+ "eslint": "8.22.0",
94
95
  "eslint-config-prettier": "8.5.0",
95
96
  "eslint-plugin-react-hooks": "4.5.0",
96
97
  "eslint-plugin-storybook": "^0.5.11",
97
- "eslint": "8.22.0",
98
98
  "fantasticon": "1.2.3",
99
99
  "fast-check": "2.25.0",
100
100
  "husky": "^8.0.1",
101
101
  "identity-obj-proxy": "^3.0.0",
102
- "jest-environment-jsdom": "^28.1.0",
103
102
  "jest": "^28.1.0",
103
+ "jest-environment-jsdom": "^28.1.0",
104
104
  "lint-staged": "^12.4.1",
105
105
  "modern-normalize": "^1.1.0",
106
106
  "prettier": "^2.7.1",
107
107
  "prop-types": "^15.8.1",
108
- "react-dom": "^17.0.2",
109
- "react": "^17.0.2",
108
+ "react": "^18.2.0",
109
+ "react-dom": "^18.2.0",
110
110
  "rimraf": "3.0.2",
111
111
  "storybook-addon-pseudo-states": "^1.15.1",
112
112
  "styled-components": "^5.3.5",
113
113
  "ts-prune": "^0.10.3",
114
114
  "typedoc": "^0.23.11",
115
- "typescript": "4.8.2",
115
+ "typescript": "4.9.3",
116
116
  "webpack": "^5.72.1"
117
117
  },
118
118
  "lint-staged": {