@tonyarbor/components 0.6.0 → 0.7.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.
- package/dist/Button.d.mts +1 -1
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +56 -0
- package/dist/Button.js.map +1 -1
- package/dist/Button.mjs +1 -1
- package/dist/Modal.d.mts +73 -0
- package/dist/Modal.d.ts +73 -0
- package/dist/Modal.js +114 -0
- package/dist/Modal.js.map +1 -0
- package/dist/Modal.mjs +9 -0
- package/dist/Modal.mjs.map +1 -0
- package/dist/ModalFooter.d.mts +40 -0
- package/dist/ModalFooter.d.ts +40 -0
- package/dist/ModalFooter.js +73 -0
- package/dist/ModalFooter.js.map +1 -0
- package/dist/ModalFooter.mjs +7 -0
- package/dist/ModalFooter.mjs.map +1 -0
- package/dist/ModalHeader.d.mts +65 -0
- package/dist/ModalHeader.d.ts +65 -0
- package/dist/ModalHeader.js +257 -0
- package/dist/ModalHeader.js.map +1 -0
- package/dist/ModalHeader.mjs +8 -0
- package/dist/ModalHeader.mjs.map +1 -0
- package/dist/chunk-7JWINM2N.mjs +77 -0
- package/dist/chunk-7JWINM2N.mjs.map +1 -0
- package/dist/chunk-GIQDPHZQ.mjs +121 -0
- package/dist/chunk-GIQDPHZQ.mjs.map +1 -0
- package/dist/{chunk-ALEJXAZY.mjs → chunk-NOUFR6W2.mjs} +57 -1
- package/dist/chunk-NOUFR6W2.mjs.map +1 -0
- package/dist/chunk-P7RKUESQ.mjs +37 -0
- package/dist/chunk-P7RKUESQ.mjs.map +1 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +282 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -1
- package/package.json +16 -1
- package/dist/chunk-ALEJXAZY.mjs.map +0 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SectionIconVariant } from './SectionIcon.mjs';
|
|
3
|
+
|
|
4
|
+
interface ModalHeaderProps {
|
|
5
|
+
/**
|
|
6
|
+
* The title text for the modal header
|
|
7
|
+
*/
|
|
8
|
+
title: string;
|
|
9
|
+
/**
|
|
10
|
+
* Optional icon variant to display before the title
|
|
11
|
+
* Uses the SectionIcon component variants: 'warning', 'danger', 'info', 'success'
|
|
12
|
+
*/
|
|
13
|
+
icon?: SectionIconVariant;
|
|
14
|
+
/**
|
|
15
|
+
* Callback when close button is clicked
|
|
16
|
+
* If not provided, close button will not be shown
|
|
17
|
+
*/
|
|
18
|
+
onClose?: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Additional CSS class name
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Additional inline styles
|
|
25
|
+
*/
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* ModalHeader component - Arbor Design System
|
|
30
|
+
*
|
|
31
|
+
* The header part of a modal dialog with title, optional icon, and close button.
|
|
32
|
+
* The icon uses SectionIcon variants (warning, danger, info, success).
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* // Basic modal header with close button
|
|
37
|
+
* <ModalHeader
|
|
38
|
+
* title="What would you like to do?"
|
|
39
|
+
* onClose={() => setIsOpen(false)}
|
|
40
|
+
* />
|
|
41
|
+
*
|
|
42
|
+
* // Modal header with warning icon
|
|
43
|
+
* <ModalHeader
|
|
44
|
+
* title="Are you sure?"
|
|
45
|
+
* icon="warning"
|
|
46
|
+
* onClose={() => setIsOpen(false)}
|
|
47
|
+
* />
|
|
48
|
+
*
|
|
49
|
+
* // Modal header with danger icon (error state)
|
|
50
|
+
* <ModalHeader
|
|
51
|
+
* title="Sorry, we can't find this page"
|
|
52
|
+
* icon="danger"
|
|
53
|
+
* onClose={() => setIsOpen(false)}
|
|
54
|
+
* />
|
|
55
|
+
*
|
|
56
|
+
* // Modal header without close button
|
|
57
|
+
* <ModalHeader
|
|
58
|
+
* title="Processing..."
|
|
59
|
+
* icon="info"
|
|
60
|
+
* />
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare const ModalHeader: React.ForwardRefExoticComponent<ModalHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
64
|
+
|
|
65
|
+
export { ModalHeader, type ModalHeaderProps };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SectionIconVariant } from './SectionIcon.js';
|
|
3
|
+
|
|
4
|
+
interface ModalHeaderProps {
|
|
5
|
+
/**
|
|
6
|
+
* The title text for the modal header
|
|
7
|
+
*/
|
|
8
|
+
title: string;
|
|
9
|
+
/**
|
|
10
|
+
* Optional icon variant to display before the title
|
|
11
|
+
* Uses the SectionIcon component variants: 'warning', 'danger', 'info', 'success'
|
|
12
|
+
*/
|
|
13
|
+
icon?: SectionIconVariant;
|
|
14
|
+
/**
|
|
15
|
+
* Callback when close button is clicked
|
|
16
|
+
* If not provided, close button will not be shown
|
|
17
|
+
*/
|
|
18
|
+
onClose?: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Additional CSS class name
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Additional inline styles
|
|
25
|
+
*/
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* ModalHeader component - Arbor Design System
|
|
30
|
+
*
|
|
31
|
+
* The header part of a modal dialog with title, optional icon, and close button.
|
|
32
|
+
* The icon uses SectionIcon variants (warning, danger, info, success).
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* // Basic modal header with close button
|
|
37
|
+
* <ModalHeader
|
|
38
|
+
* title="What would you like to do?"
|
|
39
|
+
* onClose={() => setIsOpen(false)}
|
|
40
|
+
* />
|
|
41
|
+
*
|
|
42
|
+
* // Modal header with warning icon
|
|
43
|
+
* <ModalHeader
|
|
44
|
+
* title="Are you sure?"
|
|
45
|
+
* icon="warning"
|
|
46
|
+
* onClose={() => setIsOpen(false)}
|
|
47
|
+
* />
|
|
48
|
+
*
|
|
49
|
+
* // Modal header with danger icon (error state)
|
|
50
|
+
* <ModalHeader
|
|
51
|
+
* title="Sorry, we can't find this page"
|
|
52
|
+
* icon="danger"
|
|
53
|
+
* onClose={() => setIsOpen(false)}
|
|
54
|
+
* />
|
|
55
|
+
*
|
|
56
|
+
* // Modal header without close button
|
|
57
|
+
* <ModalHeader
|
|
58
|
+
* title="Processing..."
|
|
59
|
+
* icon="info"
|
|
60
|
+
* />
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare const ModalHeader: React.ForwardRefExoticComponent<ModalHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
64
|
+
|
|
65
|
+
export { ModalHeader, type ModalHeaderProps };
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/ModalHeader/index.ts
|
|
31
|
+
var ModalHeader_exports = {};
|
|
32
|
+
__export(ModalHeader_exports, {
|
|
33
|
+
ModalHeader: () => ModalHeader
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(ModalHeader_exports);
|
|
36
|
+
|
|
37
|
+
// src/ModalHeader/ModalHeader.tsx
|
|
38
|
+
var React2 = __toESM(require("react"));
|
|
39
|
+
var import_clsx2 = require("clsx");
|
|
40
|
+
|
|
41
|
+
// src/SectionIcon/SectionIcon.tsx
|
|
42
|
+
var React = __toESM(require("react"));
|
|
43
|
+
var import_clsx = require("clsx");
|
|
44
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
+
var WarningIcon = ({ color }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { width: "14", height: "12", viewBox: "0 0 14 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
46
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
47
|
+
"path",
|
|
48
|
+
{
|
|
49
|
+
d: "M7 0.5L13.5 11.5H0.5L7 0.5Z",
|
|
50
|
+
stroke: color,
|
|
51
|
+
strokeWidth: "1.2",
|
|
52
|
+
strokeLinejoin: "round",
|
|
53
|
+
fill: "none"
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
|
+
"path",
|
|
58
|
+
{
|
|
59
|
+
d: "M7 4.5V7",
|
|
60
|
+
stroke: color,
|
|
61
|
+
strokeWidth: "1.2",
|
|
62
|
+
strokeLinecap: "round"
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "7", cy: "9", r: "0.75", fill: color })
|
|
66
|
+
] });
|
|
67
|
+
var InfoIcon = ({ color }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "7", cy: "7", r: "6", stroke: color, strokeWidth: "1.2", fill: "none" }),
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M7 6V10", stroke: color, strokeWidth: "1.2", strokeLinecap: "round" }),
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "7", cy: "4", r: "0.75", fill: color })
|
|
71
|
+
] });
|
|
72
|
+
var SuccessIcon = ({ color }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "7", cy: "7", r: "6", stroke: color, strokeWidth: "1.2", fill: "none" }),
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 7L6 9L10 5", stroke: color, strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
75
|
+
] });
|
|
76
|
+
var variantConfig = {
|
|
77
|
+
warning: {
|
|
78
|
+
backgroundColor: "#fffaf5",
|
|
79
|
+
iconColor: "#e4720d"
|
|
80
|
+
},
|
|
81
|
+
danger: {
|
|
82
|
+
backgroundColor: "#fff5f5",
|
|
83
|
+
iconColor: "#c93232"
|
|
84
|
+
},
|
|
85
|
+
info: {
|
|
86
|
+
backgroundColor: "#f5fbff",
|
|
87
|
+
iconColor: "#2c8bca"
|
|
88
|
+
},
|
|
89
|
+
success: {
|
|
90
|
+
backgroundColor: "#f5fff8",
|
|
91
|
+
iconColor: "#16a33d"
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
var sectionIconStyles = {
|
|
95
|
+
container: {
|
|
96
|
+
display: "inline-flex",
|
|
97
|
+
alignItems: "center",
|
|
98
|
+
justifyContent: "center",
|
|
99
|
+
padding: "4px",
|
|
100
|
+
borderRadius: "99px"
|
|
101
|
+
},
|
|
102
|
+
iconWrapper: {
|
|
103
|
+
display: "flex",
|
|
104
|
+
alignItems: "center",
|
|
105
|
+
justifyContent: "center",
|
|
106
|
+
width: "16px",
|
|
107
|
+
height: "16px"
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
var SectionIcon = React.forwardRef(
|
|
111
|
+
({ variant = "info", className, style, ...props }, ref) => {
|
|
112
|
+
const config = variantConfig[variant];
|
|
113
|
+
const renderIcon = () => {
|
|
114
|
+
switch (variant) {
|
|
115
|
+
case "warning":
|
|
116
|
+
case "danger":
|
|
117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WarningIcon, { color: config.iconColor });
|
|
118
|
+
case "success":
|
|
119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SuccessIcon, { color: config.iconColor });
|
|
120
|
+
case "info":
|
|
121
|
+
default:
|
|
122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InfoIcon, { color: config.iconColor });
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
126
|
+
"div",
|
|
127
|
+
{
|
|
128
|
+
ref,
|
|
129
|
+
className: (0, import_clsx.clsx)("arbor-section-icon", className),
|
|
130
|
+
style: {
|
|
131
|
+
...sectionIconStyles.container,
|
|
132
|
+
backgroundColor: config.backgroundColor,
|
|
133
|
+
...style
|
|
134
|
+
},
|
|
135
|
+
...props,
|
|
136
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: sectionIconStyles.iconWrapper, children: renderIcon() })
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
SectionIcon.displayName = "SectionIcon";
|
|
142
|
+
|
|
143
|
+
// src/ModalHeader/ModalHeader.tsx
|
|
144
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
145
|
+
var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
146
|
+
"svg",
|
|
147
|
+
{
|
|
148
|
+
width: "10",
|
|
149
|
+
height: "10",
|
|
150
|
+
viewBox: "0 0 10 10",
|
|
151
|
+
fill: "none",
|
|
152
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
153
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
154
|
+
"path",
|
|
155
|
+
{
|
|
156
|
+
d: "M1 1L9 9M9 1L1 9",
|
|
157
|
+
stroke: "#2f2f2f",
|
|
158
|
+
strokeWidth: "1.5",
|
|
159
|
+
strokeLinecap: "round",
|
|
160
|
+
strokeLinejoin: "round"
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
var modalHeaderStyles = {
|
|
166
|
+
container: {
|
|
167
|
+
display: "flex",
|
|
168
|
+
alignItems: "center",
|
|
169
|
+
justifyContent: "space-between",
|
|
170
|
+
width: "100%",
|
|
171
|
+
padding: "16px",
|
|
172
|
+
backgroundColor: "#ffffff",
|
|
173
|
+
boxSizing: "border-box",
|
|
174
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
175
|
+
minHeight: "56px"
|
|
176
|
+
},
|
|
177
|
+
leftContent: {
|
|
178
|
+
display: "flex",
|
|
179
|
+
alignItems: "center",
|
|
180
|
+
gap: "16px",
|
|
181
|
+
flex: 1
|
|
182
|
+
},
|
|
183
|
+
title: {
|
|
184
|
+
fontSize: "22px",
|
|
185
|
+
fontWeight: "600",
|
|
186
|
+
color: "#2f2f2f",
|
|
187
|
+
lineHeight: "1.25",
|
|
188
|
+
margin: 0
|
|
189
|
+
},
|
|
190
|
+
closeButton: {
|
|
191
|
+
display: "flex",
|
|
192
|
+
alignItems: "center",
|
|
193
|
+
justifyContent: "center",
|
|
194
|
+
width: "32px",
|
|
195
|
+
height: "32px",
|
|
196
|
+
borderRadius: "16px",
|
|
197
|
+
backgroundColor: "#ffffff",
|
|
198
|
+
border: "none",
|
|
199
|
+
cursor: "pointer",
|
|
200
|
+
padding: 0,
|
|
201
|
+
flexShrink: 0,
|
|
202
|
+
transition: "background-color 0.15s ease-in-out"
|
|
203
|
+
},
|
|
204
|
+
closeButtonHover: {
|
|
205
|
+
backgroundColor: "#f8f8f8"
|
|
206
|
+
},
|
|
207
|
+
closeButtonFocus: {
|
|
208
|
+
outline: "3px solid #3cad51",
|
|
209
|
+
outlineOffset: "-3px"
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
var ModalHeader = React2.forwardRef(
|
|
213
|
+
({ title, icon, onClose, className, style, ...props }, ref) => {
|
|
214
|
+
const [isHovered, setIsHovered] = React2.useState(false);
|
|
215
|
+
const [isFocused, setIsFocused] = React2.useState(false);
|
|
216
|
+
const closeButtonStyle = {
|
|
217
|
+
...modalHeaderStyles.closeButton,
|
|
218
|
+
...isHovered && modalHeaderStyles.closeButtonHover,
|
|
219
|
+
...isFocused && modalHeaderStyles.closeButtonFocus
|
|
220
|
+
};
|
|
221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
222
|
+
"div",
|
|
223
|
+
{
|
|
224
|
+
ref,
|
|
225
|
+
className: (0, import_clsx2.clsx)("arbor-modal-header", className),
|
|
226
|
+
style: { ...modalHeaderStyles.container, ...style },
|
|
227
|
+
...props,
|
|
228
|
+
children: [
|
|
229
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: modalHeaderStyles.leftContent, children: [
|
|
230
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SectionIcon, { variant: icon }),
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { style: modalHeaderStyles.title, children: title })
|
|
232
|
+
] }),
|
|
233
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
234
|
+
"button",
|
|
235
|
+
{
|
|
236
|
+
type: "button",
|
|
237
|
+
onClick: onClose,
|
|
238
|
+
onMouseEnter: () => setIsHovered(true),
|
|
239
|
+
onMouseLeave: () => setIsHovered(false),
|
|
240
|
+
onFocus: () => setIsFocused(true),
|
|
241
|
+
onBlur: () => setIsFocused(false),
|
|
242
|
+
style: closeButtonStyle,
|
|
243
|
+
"aria-label": "Close modal",
|
|
244
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CloseIcon, {})
|
|
245
|
+
}
|
|
246
|
+
)
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
ModalHeader.displayName = "ModalHeader";
|
|
253
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
254
|
+
0 && (module.exports = {
|
|
255
|
+
ModalHeader
|
|
256
|
+
});
|
|
257
|
+
//# sourceMappingURL=ModalHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ModalHeader/index.ts","../src/ModalHeader/ModalHeader.tsx","../src/SectionIcon/SectionIcon.tsx"],"sourcesContent":["export { ModalHeader } from './ModalHeader';\nexport type { ModalHeaderProps } from './ModalHeader';\n","import * as React from 'react';\nimport { clsx } from 'clsx';\nimport { SectionIcon, SectionIconVariant } from '../SectionIcon';\n\nexport interface ModalHeaderProps {\n /**\n * The title text for the modal header\n */\n title: string;\n /**\n * Optional icon variant to display before the title\n * Uses the SectionIcon component variants: 'warning', 'danger', 'info', 'success'\n */\n icon?: SectionIconVariant;\n /**\n * Callback when close button is clicked\n * If not provided, close button will not be shown\n */\n onClose?: () => void;\n /**\n * Additional CSS class name\n */\n className?: string;\n /**\n * Additional inline styles\n */\n style?: React.CSSProperties;\n}\n\n// Close X icon\nconst CloseIcon = () => (\n <svg\n width=\"10\"\n height=\"10\"\n viewBox=\"0 0 10 10\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M1 1L9 9M9 1L1 9\"\n stroke=\"#2f2f2f\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\n\n// Arbor Design System modal header styles\nconst modalHeaderStyles = {\n container: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n width: '100%',\n padding: '16px',\n backgroundColor: '#ffffff',\n boxSizing: 'border-box' as const,\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n minHeight: '56px',\n },\n leftContent: {\n display: 'flex',\n alignItems: 'center',\n gap: '16px',\n flex: 1,\n },\n title: {\n fontSize: '22px',\n fontWeight: '600',\n color: '#2f2f2f',\n lineHeight: '1.25',\n margin: 0,\n },\n closeButton: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '32px',\n height: '32px',\n borderRadius: '16px',\n backgroundColor: '#ffffff',\n border: 'none',\n cursor: 'pointer',\n padding: 0,\n flexShrink: 0,\n transition: 'background-color 0.15s ease-in-out',\n },\n closeButtonHover: {\n backgroundColor: '#f8f8f8',\n },\n closeButtonFocus: {\n outline: '3px solid #3cad51',\n outlineOffset: '-3px',\n },\n};\n\n/**\n * ModalHeader component - Arbor Design System\n *\n * The header part of a modal dialog with title, optional icon, and close button.\n * The icon uses SectionIcon variants (warning, danger, info, success).\n *\n * @example\n * ```tsx\n * // Basic modal header with close button\n * <ModalHeader\n * title=\"What would you like to do?\"\n * onClose={() => setIsOpen(false)}\n * />\n *\n * // Modal header with warning icon\n * <ModalHeader\n * title=\"Are you sure?\"\n * icon=\"warning\"\n * onClose={() => setIsOpen(false)}\n * />\n *\n * // Modal header with danger icon (error state)\n * <ModalHeader\n * title=\"Sorry, we can't find this page\"\n * icon=\"danger\"\n * onClose={() => setIsOpen(false)}\n * />\n *\n * // Modal header without close button\n * <ModalHeader\n * title=\"Processing...\"\n * icon=\"info\"\n * />\n * ```\n */\nexport const ModalHeader = React.forwardRef<HTMLDivElement, ModalHeaderProps>(\n ({ title, icon, onClose, className, style, ...props }, ref) => {\n const [isHovered, setIsHovered] = React.useState(false);\n const [isFocused, setIsFocused] = React.useState(false);\n\n const closeButtonStyle: React.CSSProperties = {\n ...modalHeaderStyles.closeButton,\n ...(isHovered && modalHeaderStyles.closeButtonHover),\n ...(isFocused && modalHeaderStyles.closeButtonFocus),\n };\n\n return (\n <div\n ref={ref}\n className={clsx('arbor-modal-header', className)}\n style={{ ...modalHeaderStyles.container, ...style }}\n {...props}\n >\n <div style={modalHeaderStyles.leftContent}>\n {icon && <SectionIcon variant={icon} />}\n <h2 style={modalHeaderStyles.title}>{title}</h2>\n </div>\n {onClose && (\n <button\n type=\"button\"\n onClick={onClose}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n style={closeButtonStyle}\n aria-label=\"Close modal\"\n >\n <CloseIcon />\n </button>\n )}\n </div>\n );\n }\n);\n\nModalHeader.displayName = 'ModalHeader';\n","import * as React from 'react';\nimport { clsx } from 'clsx';\n\nexport type SectionIconVariant = 'warning' | 'danger' | 'info' | 'success';\n\nexport interface SectionIconProps {\n /**\n * The variant/style of the section icon\n * @default 'info'\n */\n variant?: SectionIconVariant;\n /**\n * Additional CSS class name\n */\n className?: string;\n /**\n * Additional inline styles\n */\n style?: React.CSSProperties;\n}\n\n// Warning triangle icon\nconst WarningIcon = ({ color }: { color: string }) => (\n <svg width=\"14\" height=\"12\" viewBox=\"0 0 14 12\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M7 0.5L13.5 11.5H0.5L7 0.5Z\"\n stroke={color}\n strokeWidth=\"1.2\"\n strokeLinejoin=\"round\"\n fill=\"none\"\n />\n <path\n d=\"M7 4.5V7\"\n stroke={color}\n strokeWidth=\"1.2\"\n strokeLinecap=\"round\"\n />\n <circle cx=\"7\" cy=\"9\" r=\"0.75\" fill={color} />\n </svg>\n);\n\n// Info circle icon\nconst InfoIcon = ({ color }: { color: string }) => (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"7\" cy=\"7\" r=\"6\" stroke={color} strokeWidth=\"1.2\" fill=\"none\" />\n <path d=\"M7 6V10\" stroke={color} strokeWidth=\"1.2\" strokeLinecap=\"round\" />\n <circle cx=\"7\" cy=\"4\" r=\"0.75\" fill={color} />\n </svg>\n);\n\n// Success checkmark icon\nconst SuccessIcon = ({ color }: { color: string }) => (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"7\" cy=\"7\" r=\"6\" stroke={color} strokeWidth=\"1.2\" fill=\"none\" />\n <path d=\"M4 7L6 9L10 5\" stroke={color} strokeWidth=\"1.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n);\n\n// Variant configurations\nconst variantConfig: Record<SectionIconVariant, { backgroundColor: string; iconColor: string }> = {\n warning: {\n backgroundColor: '#fffaf5',\n iconColor: '#e4720d',\n },\n danger: {\n backgroundColor: '#fff5f5',\n iconColor: '#c93232',\n },\n info: {\n backgroundColor: '#f5fbff',\n iconColor: '#2c8bca',\n },\n success: {\n backgroundColor: '#f5fff8',\n iconColor: '#16a33d',\n },\n};\n\n// Arbor Design System section icon styles\nconst sectionIconStyles = {\n container: {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: '4px',\n borderRadius: '99px',\n },\n iconWrapper: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '16px',\n height: '16px',\n },\n};\n\n/**\n * SectionIcon component - Arbor Design System\n *\n * A small badge-like icon used in section headings to indicate status or alerts.\n * Available in 4 variants: warning (orange), danger (red), info (blue), success (green).\n *\n * @example\n * ```tsx\n * <SectionIcon variant=\"warning\" />\n * <SectionIcon variant=\"danger\" />\n * <SectionIcon variant=\"info\" />\n * <SectionIcon variant=\"success\" />\n * ```\n */\nexport const SectionIcon = React.forwardRef<HTMLDivElement, SectionIconProps>(\n ({ variant = 'info', className, style, ...props }, ref) => {\n const config = variantConfig[variant];\n\n const renderIcon = () => {\n switch (variant) {\n case 'warning':\n case 'danger':\n return <WarningIcon color={config.iconColor} />;\n case 'success':\n return <SuccessIcon color={config.iconColor} />;\n case 'info':\n default:\n return <InfoIcon color={config.iconColor} />;\n }\n };\n\n return (\n <div\n ref={ref}\n className={clsx('arbor-section-icon', className)}\n style={{\n ...sectionIconStyles.container,\n backgroundColor: config.backgroundColor,\n ...style,\n }}\n {...props}\n >\n <div style={sectionIconStyles.iconWrapper}>\n {renderIcon()}\n </div>\n </div>\n );\n }\n);\n\nSectionIcon.displayName = 'SectionIcon';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,SAAuB;AACvB,IAAAC,eAAqB;;;ACDrB,YAAuB;AACvB,kBAAqB;AAsBnB;AADF,IAAM,cAAc,CAAC,EAAE,MAAM,MAC3B,6CAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,OAAM,8BAChE;AAAA;AAAA,IAAC;AAAA;AAAA,MACC,GAAE;AAAA,MACF,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ACA,eAAW,mBAAK,sBAAsB,SAAS;AAAA,QAC/C,OAAO,EAAE,GAAG,kBAAkB,WAAW,GAAG,MAAM;AAAA,QACjD,GAAG;AAAA,QAEJ;AAAA,wDAAC,SAAI,OAAO,kBAAkB,aAC3B;AAAA,oBAAQ,6CAAC,eAAY,SAAS,MAAM;AAAA,YACrC,6CAAC,QAAG,OAAO,kBAAkB,OAAQ,iBAAM;AAAA,aAC7C;AAAA,UACC,WACC;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAS;AAAA,cACT,cAAc,MAAM,aAAa,IAAI;AAAA,cACrC,cAAc,MAAM,aAAa,KAAK;AAAA,cACtC,SAAS,MAAM,aAAa,IAAI;AAAA,cAChC,QAAQ,MAAM,aAAa,KAAK;AAAA,cAChC,OAAO;AAAA,cACP,cAAW;AAAA,cAEX,uDAAC,aAAU;AAAA;AAAA,UACb;AAAA;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;","names":["React","import_clsx","import_jsx_runtime"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// src/Modal/Modal.tsx
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { clsx } from "clsx";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
var modalStyles = {
|
|
6
|
+
container: {
|
|
7
|
+
display: "flex",
|
|
8
|
+
flexDirection: "column",
|
|
9
|
+
alignItems: "flex-start",
|
|
10
|
+
backgroundColor: "#f8f8f8",
|
|
11
|
+
// grey-050
|
|
12
|
+
borderRadius: "8px",
|
|
13
|
+
boxShadow: "0px 8px 24px 0px rgba(32, 32, 32, 0.12)",
|
|
14
|
+
overflow: "hidden",
|
|
15
|
+
boxSizing: "border-box",
|
|
16
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
17
|
+
},
|
|
18
|
+
content: {
|
|
19
|
+
display: "flex",
|
|
20
|
+
alignItems: "center",
|
|
21
|
+
justifyContent: "center",
|
|
22
|
+
width: "100%",
|
|
23
|
+
padding: "32px 16px",
|
|
24
|
+
backgroundColor: "#f8f8f8",
|
|
25
|
+
// grey-050
|
|
26
|
+
boxSizing: "border-box"
|
|
27
|
+
},
|
|
28
|
+
contentText: {
|
|
29
|
+
flex: 1,
|
|
30
|
+
fontSize: "13px",
|
|
31
|
+
fontWeight: "400",
|
|
32
|
+
color: "#2f2f2f",
|
|
33
|
+
lineHeight: "1.5"
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var Modal = React.forwardRef(
|
|
37
|
+
({ children, width = 584, className, style, ...props }, ref) => {
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
ref,
|
|
42
|
+
className: clsx("arbor-modal", className),
|
|
43
|
+
style: {
|
|
44
|
+
...modalStyles.container,
|
|
45
|
+
width: typeof width === "number" ? `${width}px` : width,
|
|
46
|
+
...style
|
|
47
|
+
},
|
|
48
|
+
role: "dialog",
|
|
49
|
+
"aria-modal": "true",
|
|
50
|
+
...props,
|
|
51
|
+
children
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
Modal.displayName = "Modal";
|
|
57
|
+
var ModalContent = React.forwardRef(
|
|
58
|
+
({ children, className, style, ...props }, ref) => {
|
|
59
|
+
return /* @__PURE__ */ jsx(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
ref,
|
|
63
|
+
className: clsx("arbor-modal-content", className),
|
|
64
|
+
style: { ...modalStyles.content, ...style },
|
|
65
|
+
...props,
|
|
66
|
+
children: /* @__PURE__ */ jsx("div", { style: modalStyles.contentText, children })
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
ModalContent.displayName = "ModalContent";
|
|
72
|
+
|
|
73
|
+
export {
|
|
74
|
+
Modal,
|
|
75
|
+
ModalContent
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=chunk-7JWINM2N.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Modal/Modal.tsx"],"sourcesContent":["import * as React from 'react';\nimport { clsx } from 'clsx';\n\nexport interface ModalProps {\n /**\n * The content of the modal (typically ModalHeader, content, and ModalFooter)\n */\n children: React.ReactNode;\n /**\n * Width of the modal\n * @default 584\n */\n width?: number | string;\n /**\n * Additional CSS class name\n */\n className?: string;\n /**\n * Additional inline styles\n */\n style?: React.CSSProperties;\n}\n\nexport interface ModalContentProps {\n /**\n * The content to display in the modal body\n */\n children: React.ReactNode;\n /**\n * Additional CSS class name\n */\n className?: string;\n /**\n * Additional inline styles\n */\n style?: React.CSSProperties;\n}\n\n// Arbor Design System modal styles\nconst modalStyles = {\n container: {\n display: 'flex',\n flexDirection: 'column' as const,\n alignItems: 'flex-start',\n backgroundColor: '#f8f8f8', // grey-050\n borderRadius: '8px',\n boxShadow: '0px 8px 24px 0px rgba(32, 32, 32, 0.12)',\n overflow: 'hidden',\n boxSizing: 'border-box' as const,\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n },\n content: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '100%',\n padding: '32px 16px',\n backgroundColor: '#f8f8f8', // grey-050\n boxSizing: 'border-box' as const,\n },\n contentText: {\n flex: 1,\n fontSize: '13px',\n fontWeight: '400',\n color: '#2f2f2f',\n lineHeight: '1.5',\n },\n};\n\n/**\n * Modal component - Arbor Design System\n *\n * A modal dialog container that wraps ModalHeader, content, and ModalFooter.\n *\n * @example\n * ```tsx\n * <Modal width={584}>\n * <ModalHeader\n * title=\"Delete postal address?\"\n * onClose={() => setIsOpen(false)}\n * />\n * <ModalContent>\n * <p>This will delete the postal address. Are you sure?</p>\n * </ModalContent>\n * <ModalFooter>\n * <Button variant=\"tertiary\">Cancel</Button>\n * <Button variant=\"destructive-secondary\">Confirm</Button>\n * </ModalFooter>\n * </Modal>\n * ```\n */\nexport const Modal = React.forwardRef<HTMLDivElement, ModalProps>(\n ({ children, width = 584, className, style, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={clsx('arbor-modal', className)}\n style={{\n ...modalStyles.container,\n width: typeof width === 'number' ? `${width}px` : width,\n ...style,\n }}\n role=\"dialog\"\n aria-modal=\"true\"\n {...props}\n >\n {children}\n </div>\n );\n }\n);\n\nModal.displayName = 'Modal';\n\n/**\n * ModalContent component - Arbor Design System\n *\n * The content/body area of a modal dialog.\n *\n * @example\n * ```tsx\n * <ModalContent>\n * <p>Your content here</p>\n * </ModalContent>\n * ```\n */\nexport const ModalContent = React.forwardRef<HTMLDivElement, ModalContentProps>(\n ({ children, className, style, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={clsx('arbor-modal-content', className)}\n style={{ ...modalStyles.content, ...style }}\n {...props}\n >\n <div style={modalStyles.contentText}>{children}</div>\n </div>\n );\n }\n);\n\nModalContent.displayName = 'ModalContent';\n"],"mappings":";AAAA,YAAY,WAAW;AACvB,SAAS,YAAY;AA6Ff;AAvDN,IAAM,cAAc;AAAA,EAClB,WAAW;AAAA,IACT,SAAS;AAAA,IACT,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,iBAAiB;AAAA;AAAA,IACjB,cAAc;AAAA,IACd,WAAW;AAAA,IACX,UAAU;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EACA,SAAS;AAAA,IACP,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,OAAO;AAAA,IACP,SAAS;AAAA,IACT,iBAAiB;AAAA;AAAA,IACjB,WAAW;AAAA,EACb;AAAA,EACA,aAAa;AAAA,IACX,MAAM;AAAA,IACN,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,YAAY;AAAA,EACd;AACF;AAwBO,IAAM,QAAc;AAAA,EACzB,CAAC,EAAE,UAAU,QAAQ,KAAK,WAAW,OAAO,GAAG,MAAM,GAAG,QAAQ;AAC9D,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,KAAK,eAAe,SAAS;AAAA,QACxC,OAAO;AAAA,UACL,GAAG,YAAY;AAAA,UACf,OAAO,OAAO,UAAU,WAAW,GAAG,KAAK,OAAO;AAAA,UAClD,GAAG;AAAA,QACL;AAAA,QACA,MAAK;AAAA,QACL,cAAW;AAAA,QACV,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,MAAM,cAAc;AAcb,IAAM,eAAqB;AAAA,EAChC,CAAC,EAAE,UAAU,WAAW,OAAO,GAAG,MAAM,GAAG,QAAQ;AACjD,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,KAAK,uBAAuB,SAAS;AAAA,QAChD,OAAO,EAAE,GAAG,YAAY,SAAS,GAAG,MAAM;AAAA,QACzC,GAAG;AAAA,QAEJ,8BAAC,SAAI,OAAO,YAAY,aAAc,UAAS;AAAA;AAAA,IACjD;AAAA,EAEJ;AACF;AAEA,aAAa,cAAc;","names":[]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SectionIcon
|
|
3
|
+
} from "./chunk-7NYBJKJS.mjs";
|
|
4
|
+
|
|
5
|
+
// src/ModalHeader/ModalHeader.tsx
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { clsx } from "clsx";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
var CloseIcon = () => /* @__PURE__ */ jsx(
|
|
10
|
+
"svg",
|
|
11
|
+
{
|
|
12
|
+
width: "10",
|
|
13
|
+
height: "10",
|
|
14
|
+
viewBox: "0 0 10 10",
|
|
15
|
+
fill: "none",
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
17
|
+
children: /* @__PURE__ */ jsx(
|
|
18
|
+
"path",
|
|
19
|
+
{
|
|
20
|
+
d: "M1 1L9 9M9 1L1 9",
|
|
21
|
+
stroke: "#2f2f2f",
|
|
22
|
+
strokeWidth: "1.5",
|
|
23
|
+
strokeLinecap: "round",
|
|
24
|
+
strokeLinejoin: "round"
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
var modalHeaderStyles = {
|
|
30
|
+
container: {
|
|
31
|
+
display: "flex",
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
justifyContent: "space-between",
|
|
34
|
+
width: "100%",
|
|
35
|
+
padding: "16px",
|
|
36
|
+
backgroundColor: "#ffffff",
|
|
37
|
+
boxSizing: "border-box",
|
|
38
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
39
|
+
minHeight: "56px"
|
|
40
|
+
},
|
|
41
|
+
leftContent: {
|
|
42
|
+
display: "flex",
|
|
43
|
+
alignItems: "center",
|
|
44
|
+
gap: "16px",
|
|
45
|
+
flex: 1
|
|
46
|
+
},
|
|
47
|
+
title: {
|
|
48
|
+
fontSize: "22px",
|
|
49
|
+
fontWeight: "600",
|
|
50
|
+
color: "#2f2f2f",
|
|
51
|
+
lineHeight: "1.25",
|
|
52
|
+
margin: 0
|
|
53
|
+
},
|
|
54
|
+
closeButton: {
|
|
55
|
+
display: "flex",
|
|
56
|
+
alignItems: "center",
|
|
57
|
+
justifyContent: "center",
|
|
58
|
+
width: "32px",
|
|
59
|
+
height: "32px",
|
|
60
|
+
borderRadius: "16px",
|
|
61
|
+
backgroundColor: "#ffffff",
|
|
62
|
+
border: "none",
|
|
63
|
+
cursor: "pointer",
|
|
64
|
+
padding: 0,
|
|
65
|
+
flexShrink: 0,
|
|
66
|
+
transition: "background-color 0.15s ease-in-out"
|
|
67
|
+
},
|
|
68
|
+
closeButtonHover: {
|
|
69
|
+
backgroundColor: "#f8f8f8"
|
|
70
|
+
},
|
|
71
|
+
closeButtonFocus: {
|
|
72
|
+
outline: "3px solid #3cad51",
|
|
73
|
+
outlineOffset: "-3px"
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var ModalHeader = React.forwardRef(
|
|
77
|
+
({ title, icon, onClose, className, style, ...props }, ref) => {
|
|
78
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
79
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
80
|
+
const closeButtonStyle = {
|
|
81
|
+
...modalHeaderStyles.closeButton,
|
|
82
|
+
...isHovered && modalHeaderStyles.closeButtonHover,
|
|
83
|
+
...isFocused && modalHeaderStyles.closeButtonFocus
|
|
84
|
+
};
|
|
85
|
+
return /* @__PURE__ */ jsxs(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
ref,
|
|
89
|
+
className: clsx("arbor-modal-header", className),
|
|
90
|
+
style: { ...modalHeaderStyles.container, ...style },
|
|
91
|
+
...props,
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsxs("div", { style: modalHeaderStyles.leftContent, children: [
|
|
94
|
+
icon && /* @__PURE__ */ jsx(SectionIcon, { variant: icon }),
|
|
95
|
+
/* @__PURE__ */ jsx("h2", { style: modalHeaderStyles.title, children: title })
|
|
96
|
+
] }),
|
|
97
|
+
onClose && /* @__PURE__ */ jsx(
|
|
98
|
+
"button",
|
|
99
|
+
{
|
|
100
|
+
type: "button",
|
|
101
|
+
onClick: onClose,
|
|
102
|
+
onMouseEnter: () => setIsHovered(true),
|
|
103
|
+
onMouseLeave: () => setIsHovered(false),
|
|
104
|
+
onFocus: () => setIsFocused(true),
|
|
105
|
+
onBlur: () => setIsFocused(false),
|
|
106
|
+
style: closeButtonStyle,
|
|
107
|
+
"aria-label": "Close modal",
|
|
108
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
ModalHeader.displayName = "ModalHeader";
|
|
117
|
+
|
|
118
|
+
export {
|
|
119
|
+
ModalHeader
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=chunk-GIQDPHZQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ModalHeader/ModalHeader.tsx"],"sourcesContent":["import * as React from 'react';\nimport { clsx } from 'clsx';\nimport { SectionIcon, SectionIconVariant } from '../SectionIcon';\n\nexport interface ModalHeaderProps {\n /**\n * The title text for the modal header\n */\n title: string;\n /**\n * Optional icon variant to display before the title\n * Uses the SectionIcon component variants: 'warning', 'danger', 'info', 'success'\n */\n icon?: SectionIconVariant;\n /**\n * Callback when close button is clicked\n * If not provided, close button will not be shown\n */\n onClose?: () => void;\n /**\n * Additional CSS class name\n */\n className?: string;\n /**\n * Additional inline styles\n */\n style?: React.CSSProperties;\n}\n\n// Close X icon\nconst CloseIcon = () => (\n <svg\n width=\"10\"\n height=\"10\"\n viewBox=\"0 0 10 10\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M1 1L9 9M9 1L1 9\"\n stroke=\"#2f2f2f\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\n\n// Arbor Design System modal header styles\nconst modalHeaderStyles = {\n container: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n width: '100%',\n padding: '16px',\n backgroundColor: '#ffffff',\n boxSizing: 'border-box' as const,\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n minHeight: '56px',\n },\n leftContent: {\n display: 'flex',\n alignItems: 'center',\n gap: '16px',\n flex: 1,\n },\n title: {\n fontSize: '22px',\n fontWeight: '600',\n color: '#2f2f2f',\n lineHeight: '1.25',\n margin: 0,\n },\n closeButton: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '32px',\n height: '32px',\n borderRadius: '16px',\n backgroundColor: '#ffffff',\n border: 'none',\n cursor: 'pointer',\n padding: 0,\n flexShrink: 0,\n transition: 'background-color 0.15s ease-in-out',\n },\n closeButtonHover: {\n backgroundColor: '#f8f8f8',\n },\n closeButtonFocus: {\n outline: '3px solid #3cad51',\n outlineOffset: '-3px',\n },\n};\n\n/**\n * ModalHeader component - Arbor Design System\n *\n * The header part of a modal dialog with title, optional icon, and close button.\n * The icon uses SectionIcon variants (warning, danger, info, success).\n *\n * @example\n * ```tsx\n * // Basic modal header with close button\n * <ModalHeader\n * title=\"What would you like to do?\"\n * onClose={() => setIsOpen(false)}\n * />\n *\n * // Modal header with warning icon\n * <ModalHeader\n * title=\"Are you sure?\"\n * icon=\"warning\"\n * onClose={() => setIsOpen(false)}\n * />\n *\n * // Modal header with danger icon (error state)\n * <ModalHeader\n * title=\"Sorry, we can't find this page\"\n * icon=\"danger\"\n * onClose={() => setIsOpen(false)}\n * />\n *\n * // Modal header without close button\n * <ModalHeader\n * title=\"Processing...\"\n * icon=\"info\"\n * />\n * ```\n */\nexport const ModalHeader = React.forwardRef<HTMLDivElement, ModalHeaderProps>(\n ({ title, icon, onClose, className, style, ...props }, ref) => {\n const [isHovered, setIsHovered] = React.useState(false);\n const [isFocused, setIsFocused] = React.useState(false);\n\n const closeButtonStyle: React.CSSProperties = {\n ...modalHeaderStyles.closeButton,\n ...(isHovered && modalHeaderStyles.closeButtonHover),\n ...(isFocused && modalHeaderStyles.closeButtonFocus),\n };\n\n return (\n <div\n ref={ref}\n className={clsx('arbor-modal-header', className)}\n style={{ ...modalHeaderStyles.container, ...style }}\n {...props}\n >\n <div style={modalHeaderStyles.leftContent}>\n {icon && <SectionIcon variant={icon} />}\n <h2 style={modalHeaderStyles.title}>{title}</h2>\n </div>\n {onClose && (\n <button\n type=\"button\"\n onClick={onClose}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n style={closeButtonStyle}\n aria-label=\"Close modal\"\n >\n <CloseIcon />\n </button>\n )}\n </div>\n );\n }\n);\n\nModalHeader.displayName = 'ModalHeader';\n"],"mappings":";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,YAAY;AAqCjB,cAgHI,YAhHJ;AARJ,IAAM,YAAY,MAChB;AAAA,EAAC;AAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,OAAM;AAAA,IAEN;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,QAAO;AAAA,QACP,aAAY;AAAA,QACZ,eAAc;AAAA,QACd,gBAAe;AAAA;AAAA,IACjB;AAAA;AACF;AAIF,IAAM,oBAAoB;AAAA,EACxB,WAAW;AAAA,IACT,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,OAAO;AAAA,IACP,SAAS;AAAA,IACT,iBAAiB;AAAA,IACjB,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,aAAa;AAAA,IACX,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,KAAK;AAAA,IACL,MAAM;AAAA,EACR;AAAA,EACA,OAAO;AAAA,IACL,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAQ;AAAA,EACV;AAAA,EACA,aAAa;AAAA,IACX,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,YAAY;AAAA,EACd;AAAA,EACA,kBAAkB;AAAA,IAChB,iBAAiB;AAAA,EACnB;AAAA,EACA,k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