boflow-components 1.0.3 → 1.0.4

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/dist/App.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Button, Checkbox, Input } from "./components/index.js";
2
+ import { Alert, Button, Checkbox, Input } from "./components/index.js";
3
3
  import { ButtonSize } from "./types/index.js";
4
4
  const App = ()=>/*#__PURE__*/ jsxs("div", {
5
5
  style: {
@@ -489,6 +489,56 @@ const App = ()=>/*#__PURE__*/ jsxs("div", {
489
489
  ]
490
490
  })
491
491
  ]
492
+ }),
493
+ /*#__PURE__*/ jsx("hr", {
494
+ style: {
495
+ borderColor: 'var(--neutral-4)'
496
+ }
497
+ }),
498
+ /*#__PURE__*/ jsx("h1", {
499
+ children: "Alert Component Examples"
500
+ }),
501
+ /*#__PURE__*/ jsxs("div", {
502
+ style: {
503
+ display: 'flex',
504
+ flexDirection: 'column',
505
+ gap: '1rem'
506
+ },
507
+ children: [
508
+ /*#__PURE__*/ jsx(Alert, {
509
+ intent: "default",
510
+ title: "Label",
511
+ description: "By Jove, my quick study of lexicography won a prize!"
512
+ }),
513
+ /*#__PURE__*/ jsx(Alert, {
514
+ intent: "info",
515
+ title: "Label",
516
+ description: "By Jove, my quick study of lexicography won a prize!"
517
+ }),
518
+ /*#__PURE__*/ jsx(Alert, {
519
+ intent: "warning",
520
+ title: "Label",
521
+ description: "By Jove, my quick study of lexicography won a prize!"
522
+ }),
523
+ /*#__PURE__*/ jsx(Alert, {
524
+ intent: "error",
525
+ title: "Label",
526
+ description: "By Jove, my quick study of lexicography won a prize!"
527
+ }),
528
+ /*#__PURE__*/ jsx(Alert, {
529
+ intent: "success",
530
+ title: "Label",
531
+ description: "By Jove, my quick study of lexicography won a prize!"
532
+ }),
533
+ /*#__PURE__*/ jsx("h3", {
534
+ children: "Shadow Variant"
535
+ }),
536
+ /*#__PURE__*/ jsx(Alert, {
537
+ variant: "shadow",
538
+ intent: "info",
539
+ title: "Label (Shadow variant)"
540
+ })
541
+ ]
492
542
  })
493
543
  ]
494
544
  });
@@ -0,0 +1,3 @@
1
+ import type { AlertProps } from '../../types';
2
+ import './alert.scss';
3
+ export declare const Alert: import("react").ForwardRefExoticComponent<AlertProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,200 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import "./alert.css";
4
+ const DefaultIcons = {
5
+ info: /*#__PURE__*/ jsxs("svg", {
6
+ width: "20",
7
+ height: "20",
8
+ viewBox: "0 0 24 24",
9
+ fill: "none",
10
+ stroke: "currentColor",
11
+ strokeWidth: "2",
12
+ strokeLinecap: "round",
13
+ strokeLinejoin: "round",
14
+ role: "img",
15
+ "aria-label": "info",
16
+ children: [
17
+ /*#__PURE__*/ jsx("title", {
18
+ children: "Info"
19
+ }),
20
+ /*#__PURE__*/ jsx("circle", {
21
+ cx: "12",
22
+ cy: "12",
23
+ r: "10"
24
+ }),
25
+ /*#__PURE__*/ jsx("line", {
26
+ x1: "12",
27
+ y1: "16",
28
+ x2: "12",
29
+ y2: "12"
30
+ }),
31
+ /*#__PURE__*/ jsx("line", {
32
+ x1: "12",
33
+ y1: "8",
34
+ x2: "12.01",
35
+ y2: "8"
36
+ })
37
+ ]
38
+ }),
39
+ warning: /*#__PURE__*/ jsxs("svg", {
40
+ width: "20",
41
+ height: "20",
42
+ viewBox: "0 0 24 24",
43
+ fill: "none",
44
+ stroke: "currentColor",
45
+ strokeWidth: "2",
46
+ strokeLinecap: "round",
47
+ strokeLinejoin: "round",
48
+ role: "img",
49
+ "aria-label": "warning",
50
+ children: [
51
+ /*#__PURE__*/ jsx("title", {
52
+ children: "Warning"
53
+ }),
54
+ /*#__PURE__*/ jsx("path", {
55
+ d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"
56
+ }),
57
+ /*#__PURE__*/ jsx("line", {
58
+ x1: "12",
59
+ y1: "9",
60
+ x2: "12",
61
+ y2: "13"
62
+ }),
63
+ /*#__PURE__*/ jsx("line", {
64
+ x1: "12",
65
+ y1: "17",
66
+ x2: "12.01",
67
+ y2: "17"
68
+ })
69
+ ]
70
+ }),
71
+ error: /*#__PURE__*/ jsxs("svg", {
72
+ width: "20",
73
+ height: "20",
74
+ viewBox: "0 0 24 24",
75
+ fill: "none",
76
+ stroke: "currentColor",
77
+ strokeWidth: "2",
78
+ strokeLinecap: "round",
79
+ strokeLinejoin: "round",
80
+ role: "img",
81
+ "aria-label": "error",
82
+ children: [
83
+ /*#__PURE__*/ jsx("title", {
84
+ children: "Error"
85
+ }),
86
+ /*#__PURE__*/ jsx("circle", {
87
+ cx: "12",
88
+ cy: "12",
89
+ r: "10"
90
+ }),
91
+ /*#__PURE__*/ jsx("line", {
92
+ x1: "12",
93
+ y1: "8",
94
+ x2: "12",
95
+ y2: "12"
96
+ }),
97
+ /*#__PURE__*/ jsx("line", {
98
+ x1: "12",
99
+ y1: "16",
100
+ x2: "12.01",
101
+ y2: "16"
102
+ })
103
+ ]
104
+ }),
105
+ success: /*#__PURE__*/ jsxs("svg", {
106
+ width: "20",
107
+ height: "20",
108
+ viewBox: "0 0 24 24",
109
+ fill: "none",
110
+ stroke: "currentColor",
111
+ strokeWidth: "2",
112
+ strokeLinecap: "round",
113
+ strokeLinejoin: "round",
114
+ role: "img",
115
+ "aria-label": "success",
116
+ children: [
117
+ /*#__PURE__*/ jsx("title", {
118
+ children: "Success"
119
+ }),
120
+ /*#__PURE__*/ jsx("path", {
121
+ d: "M22 11.08V12a10 10 0 1 1-5.93-9.14"
122
+ }),
123
+ /*#__PURE__*/ jsx("polyline", {
124
+ points: "22 4 12 14.01 9 11.01"
125
+ })
126
+ ]
127
+ }),
128
+ default: null
129
+ };
130
+ const CloseIcon = /*#__PURE__*/ jsxs("svg", {
131
+ width: "20",
132
+ height: "20",
133
+ viewBox: "0 0 24 24",
134
+ fill: "none",
135
+ stroke: "currentColor",
136
+ strokeWidth: "2",
137
+ strokeLinecap: "round",
138
+ strokeLinejoin: "round",
139
+ role: "img",
140
+ "aria-label": "close",
141
+ children: [
142
+ /*#__PURE__*/ jsx("line", {
143
+ x1: "18",
144
+ y1: "6",
145
+ x2: "6",
146
+ y2: "18"
147
+ }),
148
+ /*#__PURE__*/ jsx("line", {
149
+ x1: "6",
150
+ y1: "6",
151
+ x2: "18",
152
+ y2: "18"
153
+ })
154
+ ]
155
+ });
156
+ const Alert = /*#__PURE__*/ forwardRef(({ intent = 'default', variant = 'outlined', title, description, icon, action, closable = true, onClose, className = '', ...props }, ref)=>{
157
+ let renderIcon = icon;
158
+ if (void 0 === icon) renderIcon = DefaultIcons[intent];
159
+ const intentClass = `bo-alert--${intent}`;
160
+ const variantClass = `bo-alert--${variant}`;
161
+ const layoutClass = description ? "bo-alert--with-description" : 'bo-alert--single-line';
162
+ return /*#__PURE__*/ jsxs("div", {
163
+ ref: ref,
164
+ className: `bo-alert ${intentClass} ${variantClass} ${layoutClass} ${className}`.trim(),
165
+ role: "alert",
166
+ ...props,
167
+ children: [
168
+ null !== renderIcon && /*#__PURE__*/ jsx("div", {
169
+ className: "bo-alert__icon",
170
+ children: renderIcon
171
+ }),
172
+ /*#__PURE__*/ jsxs("div", {
173
+ className: "bo-alert__content",
174
+ children: [
175
+ title && /*#__PURE__*/ jsx("div", {
176
+ className: "bo-alert__title",
177
+ children: title
178
+ }),
179
+ description && /*#__PURE__*/ jsx("div", {
180
+ className: "bo-alert__description",
181
+ children: description
182
+ })
183
+ ]
184
+ }),
185
+ action && /*#__PURE__*/ jsx("div", {
186
+ className: "bo-alert__action",
187
+ children: action
188
+ }),
189
+ closable && /*#__PURE__*/ jsx("button", {
190
+ type: "button",
191
+ className: "bo-alert__close",
192
+ onClick: onClose,
193
+ "aria-label": "Close alert",
194
+ children: CloseIcon
195
+ })
196
+ ]
197
+ });
198
+ });
199
+ Alert.displayName = 'Alert';
200
+ export { Alert };
@@ -0,0 +1,167 @@
1
+ .bo-alert {
2
+ border-radius: 8px;
3
+ align-items: flex-start;
4
+ gap: 12px;
5
+ padding: 12px 16px;
6
+ font-family: Inter Tight, sans-serif;
7
+ display: flex;
8
+ }
9
+
10
+ .bo-alert--single-line {
11
+ align-items: center;
12
+ }
13
+
14
+ .bo-alert__icon {
15
+ flex-shrink: 0;
16
+ justify-content: center;
17
+ align-items: center;
18
+ margin-top: 2px;
19
+ display: flex;
20
+ }
21
+
22
+ .bo-alert--single-line .bo-alert__icon {
23
+ margin-top: 0;
24
+ }
25
+
26
+ .bo-alert__content {
27
+ flex-direction: column;
28
+ flex-grow: 1;
29
+ align-self: center;
30
+ gap: 4px;
31
+ display: flex;
32
+ }
33
+
34
+ .bo-alert__title {
35
+ color: #0d0d12;
36
+ font-size: 14px;
37
+ font-weight: 600;
38
+ line-height: 1.4;
39
+ }
40
+
41
+ .bo-alert__description {
42
+ color: #818898;
43
+ font-size: 14px;
44
+ font-weight: 400;
45
+ line-height: 1.4;
46
+ }
47
+
48
+ .bo-alert__action {
49
+ flex-shrink: 0;
50
+ align-items: center;
51
+ display: flex;
52
+ }
53
+
54
+ .bo-alert__close {
55
+ cursor: pointer;
56
+ color: #0d0d12;
57
+ background: none;
58
+ border: none;
59
+ border-radius: 4px;
60
+ flex-shrink: 0;
61
+ justify-content: center;
62
+ align-items: center;
63
+ margin-left: auto;
64
+ padding: 2px;
65
+ transition: background-color .15s;
66
+ display: flex;
67
+ }
68
+
69
+ .bo-alert__close:hover {
70
+ background-color: #0000000d;
71
+ }
72
+
73
+ .bo-alert__close:focus-visible {
74
+ outline-offset: 2px;
75
+ outline: 2px solid #131313;
76
+ }
77
+
78
+ .bo-alert--outlined.bo-alert--default {
79
+ background-color: #fff;
80
+ border: 1px solid #dfe1e7;
81
+ }
82
+
83
+ .bo-alert--outlined.bo-alert--default .bo-alert__icon {
84
+ color: #0d0d12;
85
+ }
86
+
87
+ .bo-alert--outlined.bo-alert--error {
88
+ background-color: #fff0f3;
89
+ border: 1px solid #ed8296;
90
+ }
91
+
92
+ .bo-alert--outlined.bo-alert--error .bo-alert__icon {
93
+ color: #0d0d12;
94
+ }
95
+
96
+ .bo-alert--outlined.bo-alert--warning {
97
+ background-color: #fff6e0;
98
+ border: 1px solid #fcda83;
99
+ }
100
+
101
+ .bo-alert--outlined.bo-alert--warning .bo-alert__icon {
102
+ color: #0d0d12;
103
+ }
104
+
105
+ .bo-alert--outlined.bo-alert--info {
106
+ background-color: #f0fbff;
107
+ border: 1px solid #7eddf1;
108
+ }
109
+
110
+ .bo-alert--outlined.bo-alert--info .bo-alert__icon {
111
+ color: #0d0d12;
112
+ }
113
+
114
+ .bo-alert--outlined.bo-alert--success {
115
+ background-color: #effefa;
116
+ border: 1px solid #9ee1d4;
117
+ }
118
+
119
+ .bo-alert--outlined.bo-alert--success .bo-alert__icon {
120
+ color: #0d0d12;
121
+ }
122
+
123
+ .bo-alert--shadow {
124
+ border: 1px solid #0000;
125
+ box-shadow: 0 1px 3px #0000001a, 0 1px 2px -1px #0000001a;
126
+ }
127
+
128
+ .bo-alert--shadow.bo-alert--default {
129
+ background-color: #fff;
130
+ }
131
+
132
+ .bo-alert--shadow.bo-alert--default .bo-alert__icon {
133
+ color: #0d0d12;
134
+ }
135
+
136
+ .bo-alert--shadow.bo-alert--error {
137
+ background-color: #fff0f3;
138
+ }
139
+
140
+ .bo-alert--shadow.bo-alert--error .bo-alert__icon {
141
+ color: #0d0d12;
142
+ }
143
+
144
+ .bo-alert--shadow.bo-alert--warning {
145
+ background-color: #fff6e0;
146
+ }
147
+
148
+ .bo-alert--shadow.bo-alert--warning .bo-alert__icon {
149
+ color: #0d0d12;
150
+ }
151
+
152
+ .bo-alert--shadow.bo-alert--info {
153
+ background-color: #f0fbff;
154
+ }
155
+
156
+ .bo-alert--shadow.bo-alert--info .bo-alert__icon {
157
+ color: #0d0d12;
158
+ }
159
+
160
+ .bo-alert--shadow.bo-alert--success {
161
+ background-color: #effefa;
162
+ }
163
+
164
+ .bo-alert--shadow.bo-alert--success .bo-alert__icon {
165
+ color: #0d0d12;
166
+ }
167
+
@@ -1,3 +1,4 @@
1
1
  export { Button } from './Button/Button';
2
2
  export { Checkbox } from './Checkbox/Checkbox';
3
3
  export { Input } from './Input/Input';
4
+ export { Alert } from './Alert/Alert';
@@ -1,4 +1,5 @@
1
1
  import { Button } from "./Button/Button.js";
2
2
  import { Checkbox } from "./Checkbox/Checkbox.js";
3
3
  import { Input } from "./Input/Input.js";
4
- export { Button, Checkbox, Input };
4
+ import { Alert } from "./Alert/Alert.js";
5
+ export { Alert, Button, Checkbox, Input };
@@ -0,0 +1,40 @@
1
+ import type { HTMLAttributes, ReactNode } from 'react';
2
+ export type AlertIntent = 'default' | 'error' | 'warning' | 'info' | 'success';
3
+ export type AlertVariant = 'outlined' | 'shadow';
4
+ export interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
5
+ /**
6
+ * The visual intent of the alert
7
+ * @default 'default'
8
+ */
9
+ intent?: AlertIntent;
10
+ /**
11
+ * The visual variant of the alert
12
+ * @default 'outlined'
13
+ */
14
+ variant?: AlertVariant;
15
+ /**
16
+ * The main title of the alert
17
+ */
18
+ title?: ReactNode;
19
+ /**
20
+ * Secondary description text
21
+ */
22
+ description?: ReactNode;
23
+ /**
24
+ * Replace the default intent icon or set to null to remove the icon entirely
25
+ */
26
+ icon?: ReactNode;
27
+ /**
28
+ * Optional action button or element displayed on the right
29
+ */
30
+ action?: ReactNode;
31
+ /**
32
+ * Whether the alert can be closed/dismissed
33
+ * @default true
34
+ */
35
+ closable?: boolean;
36
+ /**
37
+ * Callback fired when the close button is clicked
38
+ */
39
+ onClose?: () => void;
40
+ }
File without changes
@@ -3,3 +3,4 @@ export { ButtonSize } from './Button';
3
3
  export type { CheckboxProps } from './Checkbox';
4
4
  export type { CheckboxSize } from './Checkbox';
5
5
  export type { InputProps } from './Input';
6
+ export type { AlertProps, AlertIntent, AlertVariant } from './Alert';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "boflow-components",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {