Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Autodesk/hig
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: development
Choose a base ref
...
head repository: DynamoDS/hig
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: development
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 10 commits
  • 36 files changed
  • 3 contributors

Commits on Aug 9, 2022

  1. notifications-panel component (#1)

    * notifications-panel component
    
    * changing package name
    
    * updating CHANGELOG.md
    
    * removing @hig/flyout package
    
    * updating README file
    filipeotero authored Aug 9, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    613b56b View commit details

Commits on Aug 29, 2022

  1. Remove extra space footer (#2)

    * adding extra space at the bottom of the panel
    
    * updating comment
    filipeotero authored Aug 29, 2022
    Copy the full SHA
    a115177 View commit details

Commits on May 30, 2023

  1. feat:update EmptyStatePresenter and share any notification dismiss ev…

    …ent back to NotificationCenter (#3)
    Enzo707 authored May 30, 2023
    Copy the full SHA
    507b355 View commit details

Commits on Jun 8, 2023

  1. Copy the full SHA
    82c5213 View commit details

Commits on Jun 9, 2023

  1. Copy the full SHA
    b9418e0 View commit details

Commits on Jul 11, 2023

  1. DYN-5219-Dismiss-feature-notification-icon-should-mark-as-read (#6)

    * Dismiss-feature-notification-icon-should-mark-as-read
    
    * feature: implement notification item transition onDismiss
    Enzo707 authored Jul 11, 2023
    Copy the full SHA
    51b4a6a View commit details

Commits on Jul 17, 2023

  1. Fix/DYN 5219 dismiss notification icon should mark as read (#7)

    * fix: notifications markAsRead
    
    * style: remove useless code
    
    * style: remove comments
    Enzo707 authored Jul 17, 2023
    Copy the full SHA
    ed1bff4 View commit details

Commits on Nov 17, 2023

  1. Copy the full SHA
    9d817e0 View commit details

Commits on Nov 20, 2023

  1. Copy the full SHA
    f9e04ec View commit details

Commits on Feb 29, 2024

  1. Copy the full SHA
    92e3587 View commit details
Showing with 2,902 additions and 0 deletions.
  1. +6 −0 packages/notifications-panel/CHANGELOG.md
  2. +50 −0 packages/notifications-panel/README.md
  3. +8 −0 packages/notifications-panel/__mocks__/@hig/progress-ring.js
  4. +72 −0 packages/notifications-panel/package.json
  5. +127 −0 packages/notifications-panel/src/Notification.js
  6. +167 −0 packages/notifications-panel/src/NotificationsPanel.js
  7. +53 −0 packages/notifications-panel/src/Panel.js
  8. +24 −0 packages/notifications-panel/src/__stories__/NotificationsPanel.new-stories.js
  9. +94 −0 packages/notifications-panel/src/behaviors/NotificationBehavior.js
  10. +139 −0 packages/notifications-panel/src/behaviors/NotificationFlyoutBehavior.js
  11. +97 −0 packages/notifications-panel/src/behaviors/PanelBehavior.js
  12. +61 −0 ...ges/notifications-panel/src/behaviors/__snapshots__/teste.NotificationFlyoutBehavior.test.js.snap
  13. +72 −0 packages/notifications-panel/src/behaviors/parseNotifications.js
  14. +9 −0 packages/notifications-panel/src/index.js
  15. +40 −0 packages/notifications-panel/src/presenters/Bell.svg
  16. +39 −0 packages/notifications-panel/src/presenters/DismissButtonPresenter.js
  17. +19 −0 packages/notifications-panel/src/presenters/DismissButtonPresenter.test.js
  18. +36 −0 packages/notifications-panel/src/presenters/EmptyStatePresenter.js
  19. +18 −0 packages/notifications-panel/src/presenters/EmptyStatePresenter.test.js
  20. +9 −0 packages/notifications-panel/src/presenters/ImagePresenter.js
  21. +16 −0 packages/notifications-panel/src/presenters/ImagePresenter.test.js
  22. +58 −0 packages/notifications-panel/src/presenters/IndicatorPresenter.js
  23. +21 −0 packages/notifications-panel/src/presenters/IndicatorPresenter.test.js
  24. +118 −0 packages/notifications-panel/src/presenters/NotificationPresenter.js
  25. +30 −0 packages/notifications-panel/src/presenters/NotificationPresenter.test.js
  26. +96 −0 packages/notifications-panel/src/presenters/PanelPresenter.js
  27. +27 −0 packages/notifications-panel/src/presenters/PanelPresenter.test.js
  28. +168 −0 packages/notifications-panel/src/presenters/__snapshots__/DismissButtonPresenter.test.js.snap
  29. +101 −0 packages/notifications-panel/src/presenters/__snapshots__/EmptyStatePresenter.test.js.snap
  30. +17 −0 packages/notifications-panel/src/presenters/__snapshots__/ImagePresenter.test.js.snap
  31. +216 −0 packages/notifications-panel/src/presenters/__snapshots__/IndicatorPresenter.test.js.snap
  32. +417 −0 packages/notifications-panel/src/presenters/__snapshots__/NotificationPresenter.test.js.snap
  33. +212 −0 packages/notifications-panel/src/presenters/__snapshots__/PanelPresenter.test.js.snap
  34. +179 −0 packages/notifications-panel/src/presenters/stylesheet.js
  35. +78 −0 packages/notifications-panel/src/presenters/stylesheet.test.js
  36. +8 −0 packages/notifications-panel/src/types.js
6 changes: 6 additions & 0 deletions packages/notifications-panel/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Features

* this component leverages @hig/notifications-flyout@3.2.0 ([9b8069e](https://github.com/DynamoDS/hig/pull/1/commits/9b8069ec26b66cfad929b88edd20eb0c1a145676))
* Addition of the 'Mark all as read' feature

# [@hig/notifications-panel-v0.1.0](https://github.com/DynamoDS/hig/pull/1) (2022-08-04)
50 changes: 50 additions & 0 deletions packages/notifications-panel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Notifications Panel

The notifications panel provides information and warnings that products may recover from without user involvement. It is meant to be displayed in a flyout as a list of notifications.

## Getting started

```bash
yarn add @hig/notifications-panel @hig/theme-context @hig/theme-data
```

## Import the component

```js
import NotificationsPanel, { Notification } from "@hig/notifications-panel";
```

## Basic usage

```jsx
<NotificationsPanel>
<Notification>
<p>Your subscription expires May 5</p>
</Notification>
</NotificationsPanel>
```

## Advanced usage

```jsx
import NotificationsPanel, { anchorPoints } from "@hig/notifications-panel";
import Timestamp from "@hig/timestamp";

<NotificationsPanel
open
heading="Alerts"
indicatorTitle="View application alerts"
notifications={[
{
id: "unique-id",
featured: true,
unread: true,
timestamp: <Timestamp timestamp="2018-08-20T20:24:50.333Z" />,
content: <p>Something happened</p>
},
{
content: "Hello world"
}
]}
/>
```
8 changes: 8 additions & 0 deletions packages/notifications-panel/__mocks__/@hig/progress-ring.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @todo Remove when `@hig/progress-ring` is migrated from vanilla */
import React from "react";

function ProgressRingMock(props) {
return <div data-props={JSON.stringify(props, null, 2)} />;
}

module.exports = jest.fn(ProgressRingMock);
72 changes: 72 additions & 0 deletions packages/notifications-panel/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"name": "@dynamods/notifications-panel",
"version": "0.0.10",
"description": "HIG NotificationsPanel",
"author": "Autodesk Inc.",
"license": "Apache-2.0",
"homepage": "https://hig.autodesk.com",
"repository": {
"type": "git",
"url": "https://github.com/DynamoDS/hig.git"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
},
"main": "build/index.js",
"module": "build/index.es.js",
"files": [
"build/*"
],
"dependencies": {
"@hig/behaviors": "^2.1.0",
"@hig/icon-button": "^3.1.0",
"@hig/icons": "^4.1.0",
"@hig/progress-ring": "^2.2.0",
"@hig/rich-text": "^2.1.0",
"@hig/typography": "^2.1.0",
"@hig/utils": "^0.4.1",
"emotion": "^10.0.0",
"prop-types": "^15.7.1",
"react-transition-group": "^4.4.2"
},
"devDependencies": {
"@hig/avatar": "^2.1.0",
"@hig/babel-preset": "^0.1.1",
"@hig/eslint-config": "^0.1.0",
"@hig/jest-preset": "^0.1.0",
"@hig/scripts": "^0.1.2",
"@hig/semantic-release-config": "^0.1.0",
"@hig/text-link": "^2.1.0"
},
"peerDependencies": {
"@hig/theme-context": "^4.2.0",
"@hig/theme-data": "^3.0.0",
"react": "^17.0.0"
},
"scripts": {
"build": "hig-scripts-build",
"lint": "hig-scripts-lint",
"test": "hig-scripts-test",
"release": "hig-scripts-release",
"publish:npm": "rm -rf dist && mkdir dist && babel src/component -d dist --copy-files"
},
"eslintConfig": {
"extends": "@hig"
},
"jest": {
"preset": "@hig/jest-preset"
},
"release": {
"extends": "@hig/semantic-release-config"
},
"babel": {
"env": {
"test": {
"presets": [
"@hig/babel-preset/test"
]
}
}
}
}
127 changes: 127 additions & 0 deletions packages/notifications-panel/src/Notification.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import PropTypes from "prop-types";
import React from "react";
import { ControlBehavior } from "@hig/behaviors";

import NotificationBehavior from "./behaviors/NotificationBehavior";
import NotificationPresenter from "./presenters/NotificationPresenter";

const Notification = (props) => {
/**
* @param {NotificationShape} shape
* @returns {import("react").ReactElement}
*/
const renderChildren = () => {
const { children, hideFlyout, onDismiss: dismiss } = props;

if (typeof children !== "function") {
return children;
}

return children({ dismiss, hideFlyout });
};

const {
dismissButtonTitle,
featured,
image,
onDismiss,
onNotificationClick,
onMouseEnter,
onMouseLeave,
stylesheet,
timestamp,
type,
unread,
// Notifications dismiss button will be displayed in case featured is true
showDismissButton = featured,
...otherProps
} = props;
const { className } = otherProps;

return (
<NotificationBehavior onDismiss={onDismiss}>
{({ handleDismissButtonClick, height, innerRef, transitionStatus }) => (
<ControlBehavior
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
>
{({
hasHover,
onMouseEnter: handleMouseEnter,
onMouseLeave: handleMouseLeave,
}) => (
<NotificationPresenter
className={className}
dismissButtonTitle={dismissButtonTitle}
featured={featured}
hasHover={hasHover}
height={height}
image={image}
innerRef={innerRef}
onDismissButtonClick={handleDismissButtonClick}
onNotificationClick={onNotificationClick}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
showDismissButton={showDismissButton}
stylesheet={stylesheet}
timestamp={timestamp}
transitionStatus={transitionStatus}
type={type}
unread={unread}
>
{renderChildren()}
</NotificationPresenter>
)}
</ControlBehavior>
)}
</NotificationBehavior>
);
};

Notification.displayName = "Notification";

Notification.propTypes = {
/** Notification content */
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
/** Title HTML attribute for the dismiss button */
dismissButtonTitle: PropTypes.string,
/** Determines whether the notification is featured */
featured: PropTypes.bool,
/** An action provided hide the flyout. This is provided to the `children` render prop */
hideFlyout: PropTypes.func,
/** An image to display such as an avatar or and icon */
image: PropTypes.node,
/** A callback called when user dismisses a featured notification */
onDismiss: PropTypes.func,
/** A callback when the user clicks anywhere within the notification */
onNotificationClick: PropTypes.func,
/**
* Triggers when the user's mouse is over the notification
*/
onMouseEnter: PropTypes.func,
/**
* Triggers when the user's mouse is no longer over the notification
*/
onMouseLeave: PropTypes.func,
/** Determines whether the dismiss button is shown */
showDismissButton: PropTypes.bool,
/** Function to modify the component's styles */
stylesheet: PropTypes.func,
/** Timestamp component */
timestamp: PropTypes.node,
/** Determines notification variant */
type: PropTypes.string,
/** Determines whether notification has not been read */
unread: PropTypes.bool,
};

Notification.defaultProps = {
/**
* This is an action that's provided to the consumer,
* as a result a value must always be available.
*/
hideFlyout: () => {},
onNotificationClick: () => {},
};

export default Notification;
Loading