@react-cupertino-ui/mini-notification 1.0.1

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.
package/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Anderson Lima
4
+
5
+ This project is inspired by Apple's design principles but is not affiliated with, endorsed, or sponsored by Apple Inc.
6
+
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
package/dist/index.css ADDED
@@ -0,0 +1,40 @@
1
+ .react-cupertino-ui-mini-notification {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 0.75rem;
5
+ padding: 0.75rem 1rem;
6
+ border-radius: 18px;
7
+ background: rgba(255, 255, 255, 0.9);
8
+ box-shadow: 0 22px 45px rgba(15, 15, 15, 0.18);
9
+ }
10
+ .react-cupertino-ui-mini-notification .title {
11
+ margin: 0;
12
+ font-weight: 600;
13
+ }
14
+ .react-cupertino-ui-mini-notification .message {
15
+ margin: 0.2rem 0 0;
16
+ color: rgba(15, 23, 42, 0.6);
17
+ font-size: 0.9rem;
18
+ }
19
+ .react-cupertino-ui-mini-notification__action {
20
+ border: none;
21
+ background: transparent;
22
+ color: #0ea5e9;
23
+ font-weight: 600;
24
+ cursor: pointer;
25
+ }
26
+ .react-cupertino-ui-mini-notification__dismiss {
27
+ border: none;
28
+ background: transparent;
29
+ opacity: 0.6;
30
+ cursor: pointer;
31
+ }
32
+ .react-cupertino-ui-mini-notification.tone-success {
33
+ border-left: 3px solid #22c55e;
34
+ }
35
+ .react-cupertino-ui-mini-notification.tone-warning {
36
+ border-left: 3px solid #f59e0b;
37
+ }
38
+ .react-cupertino-ui-mini-notification.tone-critical {
39
+ border-left: 3px solid #ef4444;
40
+ }
@@ -0,0 +1,16 @@
1
+ import * as React from "react";
2
+ import type { BaseProps } from "@react-cupertino-ui/shared/lib/interfaces/BaseProps";
3
+ import "./index.scss";
4
+ export type MiniNotificationTone = "info" | "success" | "warning" | "critical";
5
+ export interface MiniNotificationProps extends Omit<BaseProps<HTMLDivElement>, "children"> {
6
+ title: string;
7
+ message?: string;
8
+ tone?: MiniNotificationTone;
9
+ onDismiss?: () => void;
10
+ action?: {
11
+ label: string;
12
+ onClick: () => void;
13
+ };
14
+ }
15
+ declare const MiniNotification: React.ForwardRefExoticComponent<MiniNotificationProps & React.RefAttributes<HTMLDivElement>>;
16
+ export { MiniNotification };
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { cn } from "@react-cupertino-ui/shared/lib/utils";
4
+ import "./index.scss";
5
+ const MiniNotification = React.forwardRef((props, ref) => {
6
+ const { className, title, message, tone = "info", onDismiss, action, ...rest } = props;
7
+ return (_jsxs("div", { ref: ref, className: cn("react-cupertino-ui-mini-notification", `tone-${tone}`, className), role: "status", ...rest, children: [_jsxs("div", { className: "react-cupertino-ui-mini-notification__content", children: [_jsx("p", { className: "title", children: title }), message ? _jsx("p", { className: "message", children: message }) : null] }), action ? (_jsx("button", { type: "button", className: "react-cupertino-ui-mini-notification__action", onClick: action.onClick, children: action.label })) : null, onDismiss ? (_jsx("button", { type: "button", className: "react-cupertino-ui-mini-notification__dismiss", onClick: onDismiss, "aria-label": "Dismiss", children: "\u00D7" })) : null] }));
8
+ });
9
+ MiniNotification.displayName = "MiniNotification";
10
+ export { MiniNotification };
@@ -0,0 +1,47 @@
1
+ .react-cupertino-ui-mini-notification {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 0.75rem;
5
+ padding: 0.75rem 1rem;
6
+ border-radius: 18px;
7
+ background: rgba(255, 255, 255, 0.9);
8
+ box-shadow: 0 22px 45px rgba(15, 15, 15, 0.18);
9
+
10
+ .title {
11
+ margin: 0;
12
+ font-weight: 600;
13
+ }
14
+
15
+ .message {
16
+ margin: 0.2rem 0 0;
17
+ color: rgba(15, 23, 42, 0.6);
18
+ font-size: 0.9rem;
19
+ }
20
+
21
+ &__action {
22
+ border: none;
23
+ background: transparent;
24
+ color: #0ea5e9;
25
+ font-weight: 600;
26
+ cursor: pointer;
27
+ }
28
+
29
+ &__dismiss {
30
+ border: none;
31
+ background: transparent;
32
+ opacity: 0.6;
33
+ cursor: pointer;
34
+ }
35
+
36
+ &.tone-success {
37
+ border-left: 3px solid #22c55e;
38
+ }
39
+
40
+ &.tone-warning {
41
+ border-left: 3px solid #f59e0b;
42
+ }
43
+
44
+ &.tone-critical {
45
+ border-left: 3px solid #ef4444;
46
+ }
47
+ }
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@react-cupertino-ui/mini-notification",
3
+ "version": "1.0.1",
4
+ "description": "Compact notification banner",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "sideEffects": [
13
+ "./dist/**/*.css",
14
+ "./dist/**/*.scss"
15
+ ],
16
+ "scripts": {
17
+ "build": "tsc -p tsconfig.build.json && npm run build:styles",
18
+ "build:styles": "node ../../../scripts/build-styles.mjs"
19
+ },
20
+ "peerDependencies": {
21
+ "react": "^18.3.1",
22
+ "react-dom": "^18.3.1"
23
+ },
24
+ "dependencies": {
25
+ "@react-cupertino-ui/shared": "workspace:*"
26
+ },
27
+ "devDependencies": {
28
+ "typescript": "^5.2.2"
29
+ },
30
+ "gitHead": "3f53987bdb936a331665691b517c2ba9984777f8",
31
+ "publishConfig": {
32
+ "access": "public"
33
+ }
34
+ }