@spaced-out/ui-design-system 0.1.44-beta.0 → 0.1.45

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.
@@ -1,8 +1,9 @@
1
1
  amet
2
2
  Anant
3
3
  argstable
4
- atleast
5
4
  ashwini-sensehq
5
+ Ashwini
6
+ atleast
6
7
  autodocs
7
8
  circlehollow
8
9
  CODEOWNERS
@@ -5,6 +5,7 @@
5
5
  name="viewport"
6
6
  content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
7
7
  />
8
+ <!-- Fetch fontawesome from the cdn -->
8
9
  <link
9
10
  rel="icon"
10
11
  sizes="any"
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.45](https://github.com/spaced-out/ui-design-system/compare/v0.1.44...v0.1.45) (2023-08-29)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * add use modal hook ([#139](https://github.com/spaced-out/ui-design-system/issues/139)) ([bf5a6a9](https://github.com/spaced-out/ui-design-system/commit/bf5a6a99f3fcefb8493f33e0a1a188a5cb619799))
11
+
12
+ ### [0.1.44](https://github.com/spaced-out/ui-design-system/compare/v0.1.44-beta.0...v0.1.44) (2023-08-28)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * added fa block in storybook ([e85eab9](https://github.com/spaced-out/ui-design-system/commit/e85eab9d47a79633dc738f11181465e266da9644))
18
+
5
19
  ### [0.1.44-beta.0](https://github.com/spaced-out/ui-design-system/compare/v0.1.43...v0.1.44-beta.0) (2023-08-28)
6
20
 
7
21
 
@@ -47,6 +47,17 @@ Object.keys(_useLockedBody).forEach(function (key) {
47
47
  }
48
48
  });
49
49
  });
50
+ var _useModal = require("./useModal");
51
+ Object.keys(_useModal).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (key in exports && exports[key] === _useModal[key]) return;
54
+ Object.defineProperty(exports, key, {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _useModal[key];
58
+ }
59
+ });
60
+ });
50
61
  var _useMountTransition = require("./useMountTransition");
51
62
  Object.keys(_useMountTransition).forEach(function (key) {
52
63
  if (key === "default" || key === "__esModule") return;
@@ -4,6 +4,7 @@ export * from './useCopyToClipboard';
4
4
  export * from './useFileUpload';
5
5
  export * from './useInputState';
6
6
  export * from './useLockedBody';
7
+ export * from './useModal';
7
8
  export * from './useMountTransition';
8
9
  export * from './usePagination';
9
10
  export * from './useToastPortal';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _useModal = require("./useModal");
7
+ Object.keys(_useModal).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _useModal[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _useModal[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,3 @@
1
+ // @flow strict
2
+
3
+ export * from './useModal';
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useModal = void 0;
7
+ var _react = require("react");
8
+
9
+ const useModal = () => {
10
+ const [isOpen, setIsOpen] = (0, _react.useState)(false);
11
+ const [extras, setExtras] = (0, _react.useState)({});
12
+ const openModal = (0, _react.useCallback)(function () {
13
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
14
+ setExtras(props);
15
+ setIsOpen(true);
16
+ }, []);
17
+ const closeModal = () => {
18
+ setIsOpen(false);
19
+ setExtras({});
20
+ };
21
+ return {
22
+ isOpen,
23
+ openModal,
24
+ closeModal,
25
+ extras
26
+ };
27
+ };
28
+ exports.useModal = useModal;
@@ -0,0 +1,34 @@
1
+ // @flow strict
2
+
3
+ import {useCallback, useState} from 'react';
4
+
5
+
6
+ export type UseModalExtras = {
7
+ // TODO(Ashwini): Add type for extras
8
+ // $FlowFixMe
9
+ [key: string]: any,
10
+ };
11
+
12
+ export type UseModalReturnType = {
13
+ isOpen: boolean,
14
+ openModal: (extras?: UseModalExtras) => void,
15
+ closeModal: () => void,
16
+ extras: UseModalExtras,
17
+ };
18
+
19
+ export const useModal = (): UseModalReturnType => {
20
+ const [isOpen, setIsOpen] = useState(false);
21
+ const [extras, setExtras] = useState({});
22
+
23
+ const openModal = useCallback((props?: UseModalExtras = {}) => {
24
+ setExtras(props);
25
+ setIsOpen(true);
26
+ }, []);
27
+
28
+ const closeModal = () => {
29
+ setIsOpen(false);
30
+ setExtras({});
31
+ };
32
+
33
+ return {isOpen, openModal, closeModal, extras};
34
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.1.44-beta.0",
3
+ "version": "0.1.45",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {