@postenbring/hedwig-react 0.0.12 → 0.0.14
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/breadcrumb/breadcrumb.d.mts +43 -0
- package/dist/breadcrumb/breadcrumb.d.ts +43 -0
- package/dist/breadcrumb/breadcrumb.js +52 -0
- package/dist/breadcrumb/breadcrumb.mjs +7 -0
- package/dist/breadcrumb/index.d.mts +3 -0
- package/dist/breadcrumb/index.d.ts +3 -0
- package/dist/breadcrumb/index.js +58 -0
- package/dist/breadcrumb/index.mjs +8 -0
- package/dist/chunk-EMX6J4XG.mjs +5 -0
- package/dist/chunk-FFQBRM3W.mjs +78 -0
- package/dist/chunk-Q2HYT3Z7.mjs +16 -0
- package/dist/chunk-ROSXRHEW.mjs +18 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +107 -0
- package/dist/index.mjs +17 -4
- package/dist/modal/index.d.mts +9 -0
- package/dist/modal/index.d.ts +9 -0
- package/dist/modal/index.js +217 -0
- package/dist/modal/index.mjs +12 -0
- package/dist/modal/modal.d.mts +13 -0
- package/dist/modal/modal.d.ts +13 -0
- package/dist/modal/modal.js +205 -0
- package/dist/modal/modal.mjs +10 -0
- package/package.json +2 -2
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { HTMLAttributes, ReactElement } from 'react';
|
|
3
|
+
|
|
4
|
+
interface BreadcrumbsProps extends HTMLAttributes<HTMLOListElement> {
|
|
5
|
+
children: ReactElement<HTMLLIElement> | ReactElement<HTMLLIElement>[];
|
|
6
|
+
/**
|
|
7
|
+
* Props passed to the root `nav` html element
|
|
8
|
+
*/
|
|
9
|
+
navProps?: HTMLAttributes<HTMLElement>;
|
|
10
|
+
/**
|
|
11
|
+
* Props passed to the `ol` html element
|
|
12
|
+
*/
|
|
13
|
+
olProps?: HTMLAttributes<HTMLElement>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A breadcrumbs navigation menu
|
|
17
|
+
*
|
|
18
|
+
* **Usage**
|
|
19
|
+
*
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <Breadcrumbs>
|
|
22
|
+
* <li><Link href="../">Previous page</Link></li>
|
|
23
|
+
* <li>Current page</li>
|
|
24
|
+
* </Breadcrumbs>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* Outputs this html structure
|
|
28
|
+
*
|
|
29
|
+
* ```html
|
|
30
|
+
* <nav>
|
|
31
|
+
* <ol>
|
|
32
|
+
* <li><a href="../">Previous page</a></li>
|
|
33
|
+
* <li>Current page</li>
|
|
34
|
+
* </ol>
|
|
35
|
+
* </nav>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare function Breadcrumbs({ navProps, olProps, children }: BreadcrumbsProps): react_jsx_runtime.JSX.Element;
|
|
39
|
+
declare namespace Breadcrumbs {
|
|
40
|
+
var displayName: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { Breadcrumbs, type BreadcrumbsProps };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { HTMLAttributes, ReactElement } from 'react';
|
|
3
|
+
|
|
4
|
+
interface BreadcrumbsProps extends HTMLAttributes<HTMLOListElement> {
|
|
5
|
+
children: ReactElement<HTMLLIElement> | ReactElement<HTMLLIElement>[];
|
|
6
|
+
/**
|
|
7
|
+
* Props passed to the root `nav` html element
|
|
8
|
+
*/
|
|
9
|
+
navProps?: HTMLAttributes<HTMLElement>;
|
|
10
|
+
/**
|
|
11
|
+
* Props passed to the `ol` html element
|
|
12
|
+
*/
|
|
13
|
+
olProps?: HTMLAttributes<HTMLElement>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A breadcrumbs navigation menu
|
|
17
|
+
*
|
|
18
|
+
* **Usage**
|
|
19
|
+
*
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <Breadcrumbs>
|
|
22
|
+
* <li><Link href="../">Previous page</Link></li>
|
|
23
|
+
* <li>Current page</li>
|
|
24
|
+
* </Breadcrumbs>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* Outputs this html structure
|
|
28
|
+
*
|
|
29
|
+
* ```html
|
|
30
|
+
* <nav>
|
|
31
|
+
* <ol>
|
|
32
|
+
* <li><a href="../">Previous page</a></li>
|
|
33
|
+
* <li>Current page</li>
|
|
34
|
+
* </ol>
|
|
35
|
+
* </nav>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare function Breadcrumbs({ navProps, olProps, children }: BreadcrumbsProps): react_jsx_runtime.JSX.Element;
|
|
39
|
+
declare namespace Breadcrumbs {
|
|
40
|
+
var displayName: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { Breadcrumbs, type BreadcrumbsProps };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __export = (target, all) => {
|
|
24
|
+
for (var name in all)
|
|
25
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
26
|
+
};
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
+
for (let key of __getOwnPropNames(from))
|
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
31
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
32
|
+
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
+
|
|
37
|
+
// src/breadcrumb/breadcrumb.tsx
|
|
38
|
+
var breadcrumb_exports = {};
|
|
39
|
+
__export(breadcrumb_exports, {
|
|
40
|
+
Breadcrumbs: () => Breadcrumbs
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(breadcrumb_exports);
|
|
43
|
+
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
44
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
+
function Breadcrumbs({ navProps, olProps, children }) {
|
|
46
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", __spreadProps(__spreadValues({}, navProps), { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", __spreadProps(__spreadValues({}, olProps), { className: (0, import_typed_classname.clsx)("hds-breadcrumbs", olProps == null ? void 0 : olProps.className), children })) }));
|
|
47
|
+
}
|
|
48
|
+
Breadcrumbs.displayName = "Breadcrumbs";
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
Breadcrumbs
|
|
52
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __export = (target, all) => {
|
|
24
|
+
for (var name in all)
|
|
25
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
26
|
+
};
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
+
for (let key of __getOwnPropNames(from))
|
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
31
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
32
|
+
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
+
|
|
37
|
+
// src/breadcrumb/index.tsx
|
|
38
|
+
var breadcrumb_exports = {};
|
|
39
|
+
__export(breadcrumb_exports, {
|
|
40
|
+
Breadcrumbs: () => Breadcrumbs
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(breadcrumb_exports);
|
|
43
|
+
var import_fonts = require("@postenbring/hedwig-css/dist/fonts.css");
|
|
44
|
+
var import_tokens = require("@postenbring/hedwig-css/dist/tokens.css");
|
|
45
|
+
var import_base = require("@postenbring/hedwig-css/dist/base.css");
|
|
46
|
+
var import_breadcrumb = require("@postenbring/hedwig-css/dist/breadcrumb.css");
|
|
47
|
+
|
|
48
|
+
// src/breadcrumb/breadcrumb.tsx
|
|
49
|
+
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
50
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
51
|
+
function Breadcrumbs({ navProps, olProps, children }) {
|
|
52
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", __spreadProps(__spreadValues({}, navProps), { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", __spreadProps(__spreadValues({}, olProps), { className: (0, import_typed_classname.clsx)("hds-breadcrumbs", olProps == null ? void 0 : olProps.className), children })) }));
|
|
53
|
+
}
|
|
54
|
+
Breadcrumbs.displayName = "Breadcrumbs";
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
Breadcrumbs
|
|
58
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Box
|
|
3
|
+
} from "./chunk-RXUPE4MM.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__objRest,
|
|
6
|
+
__spreadProps,
|
|
7
|
+
__spreadValues
|
|
8
|
+
} from "./chunk-FUJQIYOF.mjs";
|
|
9
|
+
|
|
10
|
+
// src/modal/modal.tsx
|
|
11
|
+
import { forwardRef, useRef } from "react";
|
|
12
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
13
|
+
|
|
14
|
+
// src/utils.ts
|
|
15
|
+
import * as React from "react";
|
|
16
|
+
function useMergeRefs(refs) {
|
|
17
|
+
return React.useMemo(() => {
|
|
18
|
+
if (refs.every((ref) => ref === null)) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return (value) => {
|
|
22
|
+
refs.forEach((ref) => {
|
|
23
|
+
if (typeof ref === "function") {
|
|
24
|
+
ref(value);
|
|
25
|
+
} else if (ref !== null) {
|
|
26
|
+
ref.current = value;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
}, refs);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// src/modal/modal.tsx
|
|
34
|
+
import { jsx } from "react/jsx-runtime";
|
|
35
|
+
var Modal = forwardRef(
|
|
36
|
+
(_a, ref) => {
|
|
37
|
+
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
|
38
|
+
const modalRef = useRef(null);
|
|
39
|
+
const mergedRef = useMergeRefs([modalRef, ref]);
|
|
40
|
+
function onClose() {
|
|
41
|
+
var _a2;
|
|
42
|
+
(_a2 = modalRef.current) == null ? void 0 : _a2.close();
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return /* @__PURE__ */ jsx(
|
|
46
|
+
Box,
|
|
47
|
+
__spreadProps(__spreadValues({
|
|
48
|
+
as: "dialog",
|
|
49
|
+
className: clsx("hds-modal", className),
|
|
50
|
+
closeable: true,
|
|
51
|
+
onClose,
|
|
52
|
+
ref: mergedRef,
|
|
53
|
+
variant: "white"
|
|
54
|
+
}, rest), {
|
|
55
|
+
children
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
Modal.displayName = "Modal";
|
|
61
|
+
var ModalHeader = forwardRef(
|
|
62
|
+
(_a, ref) => {
|
|
63
|
+
var _b = _a, { as: Component = "h1", className } = _b, rest = __objRest(_b, ["as", "className"]);
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
65
|
+
Component,
|
|
66
|
+
__spreadValues({
|
|
67
|
+
className: clsx("hds-modal__header", className),
|
|
68
|
+
ref
|
|
69
|
+
}, rest)
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
ModalHeader.displayName = "ModalHeader";
|
|
74
|
+
|
|
75
|
+
export {
|
|
76
|
+
Modal,
|
|
77
|
+
ModalHeader
|
|
78
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__spreadProps,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "./chunk-FUJQIYOF.mjs";
|
|
5
|
+
|
|
6
|
+
// src/breadcrumb/breadcrumb.tsx
|
|
7
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
function Breadcrumbs({ navProps, olProps, children }) {
|
|
10
|
+
return /* @__PURE__ */ jsx("nav", __spreadProps(__spreadValues({}, navProps), { children: /* @__PURE__ */ jsx("ol", __spreadProps(__spreadValues({}, olProps), { className: clsx("hds-breadcrumbs", olProps == null ? void 0 : olProps.className), children })) }));
|
|
11
|
+
}
|
|
12
|
+
Breadcrumbs.displayName = "Breadcrumbs";
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
Breadcrumbs
|
|
16
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Modal,
|
|
3
|
+
ModalHeader
|
|
4
|
+
} from "./chunk-FFQBRM3W.mjs";
|
|
5
|
+
|
|
6
|
+
// src/modal/index.tsx
|
|
7
|
+
import "@postenbring/hedwig-css/dist/fonts.css";
|
|
8
|
+
import "@postenbring/hedwig-css/dist/tokens.css";
|
|
9
|
+
import "@postenbring/hedwig-css/dist/base.css";
|
|
10
|
+
import "@postenbring/hedwig-css/dist/box.css";
|
|
11
|
+
import "@postenbring/hedwig-css/dist/modal.css";
|
|
12
|
+
var ModalComponent = Modal;
|
|
13
|
+
ModalComponent.Header = ModalHeader;
|
|
14
|
+
ModalComponent.Header.displayName = "Modal";
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
ModalComponent
|
|
18
|
+
};
|
package/dist/index.d.mts
CHANGED
|
@@ -10,7 +10,10 @@ export { Accordion, AccordionProps } from './accordion/accordion.mjs';
|
|
|
10
10
|
export { AccordionItem, AccordionItemChildrenType, AccordionItemProps } from './accordion/accordion-item.mjs';
|
|
11
11
|
export { AccordionTrigger, AccordionTriggerProps } from './accordion/accordion-item-trigger.mjs';
|
|
12
12
|
export { AccordionContent, AccordionContentProps } from './accordion/accordion-item-content.mjs';
|
|
13
|
+
export { Modal } from './modal/index.mjs';
|
|
14
|
+
export { Breadcrumbs, BreadcrumbsProps } from './breadcrumb/breadcrumb.mjs';
|
|
13
15
|
export { MessageDescription, MessageTitle } from './message/message.mjs';
|
|
16
|
+
export { ModalHeader } from './modal/modal.mjs';
|
|
14
17
|
import './utils-BfZsjuFH.mjs';
|
|
15
18
|
import 'react';
|
|
16
19
|
import 'react/jsx-runtime';
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,10 @@ export { Accordion, AccordionProps } from './accordion/accordion.js';
|
|
|
10
10
|
export { AccordionItem, AccordionItemChildrenType, AccordionItemProps } from './accordion/accordion-item.js';
|
|
11
11
|
export { AccordionTrigger, AccordionTriggerProps } from './accordion/accordion-item-trigger.js';
|
|
12
12
|
export { AccordionContent, AccordionContentProps } from './accordion/accordion-item-content.js';
|
|
13
|
+
export { Modal } from './modal/index.js';
|
|
14
|
+
export { Breadcrumbs, BreadcrumbsProps } from './breadcrumb/breadcrumb.js';
|
|
13
15
|
export { MessageDescription, MessageTitle } from './message/message.js';
|
|
16
|
+
export { ModalHeader } from './modal/modal.js';
|
|
14
17
|
import './utils-BfZsjuFH.js';
|
|
15
18
|
import 'react';
|
|
16
19
|
import 'react/jsx-runtime';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __defProps = Object.defineProperties;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
8
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
11
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
12
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -44,6 +46,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
44
46
|
}
|
|
45
47
|
return to;
|
|
46
48
|
};
|
|
49
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
+
mod
|
|
56
|
+
));
|
|
47
57
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
58
|
|
|
49
59
|
// src/index.tsx
|
|
@@ -57,6 +67,7 @@ __export(src_exports, {
|
|
|
57
67
|
BaseButton: () => BaseButton,
|
|
58
68
|
Box: () => Box,
|
|
59
69
|
BoxCloseButton: () => BoxCloseButton,
|
|
70
|
+
Breadcrumbs: () => Breadcrumbs,
|
|
60
71
|
DarkBadge: () => DarkBadge,
|
|
61
72
|
DescriptionDetails: () => DescriptionDetails,
|
|
62
73
|
DescriptionList: () => DescriptionList,
|
|
@@ -66,6 +77,8 @@ __export(src_exports, {
|
|
|
66
77
|
Message: () => MessageComponent,
|
|
67
78
|
MessageDescription: () => MessageDescription,
|
|
68
79
|
MessageTitle: () => MessageTitle,
|
|
80
|
+
Modal: () => ModalComponent,
|
|
81
|
+
ModalHeader: () => ModalHeader,
|
|
69
82
|
OrderedList: () => OrderedList,
|
|
70
83
|
PrimaryButton: () => PrimaryButton,
|
|
71
84
|
SecondaryButton: () => SecondaryButton,
|
|
@@ -627,6 +640,97 @@ var AccordionContent = (0, import_react9.forwardRef)((_a, ref) => {
|
|
|
627
640
|
);
|
|
628
641
|
});
|
|
629
642
|
AccordionContent.displayName = "AccordionContent";
|
|
643
|
+
|
|
644
|
+
// src/modal/index.tsx
|
|
645
|
+
var import_fonts8 = require("@postenbring/hedwig-css/dist/fonts.css");
|
|
646
|
+
var import_tokens8 = require("@postenbring/hedwig-css/dist/tokens.css");
|
|
647
|
+
var import_base8 = require("@postenbring/hedwig-css/dist/base.css");
|
|
648
|
+
var import_box5 = require("@postenbring/hedwig-css/dist/box.css");
|
|
649
|
+
var import_modal = require("@postenbring/hedwig-css/dist/modal.css");
|
|
650
|
+
|
|
651
|
+
// src/modal/modal.tsx
|
|
652
|
+
var import_react10 = require("react");
|
|
653
|
+
var import_typed_classname12 = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
654
|
+
|
|
655
|
+
// src/utils.ts
|
|
656
|
+
var React2 = __toESM(require("react"));
|
|
657
|
+
function useMergeRefs(refs) {
|
|
658
|
+
return React2.useMemo(() => {
|
|
659
|
+
if (refs.every((ref) => ref === null)) {
|
|
660
|
+
return null;
|
|
661
|
+
}
|
|
662
|
+
return (value) => {
|
|
663
|
+
refs.forEach((ref) => {
|
|
664
|
+
if (typeof ref === "function") {
|
|
665
|
+
ref(value);
|
|
666
|
+
} else if (ref !== null) {
|
|
667
|
+
ref.current = value;
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
};
|
|
671
|
+
}, refs);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
// src/modal/modal.tsx
|
|
675
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
676
|
+
var Modal = (0, import_react10.forwardRef)(
|
|
677
|
+
(_a, ref) => {
|
|
678
|
+
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
|
679
|
+
const modalRef = (0, import_react10.useRef)(null);
|
|
680
|
+
const mergedRef = useMergeRefs([modalRef, ref]);
|
|
681
|
+
function onClose() {
|
|
682
|
+
var _a2;
|
|
683
|
+
(_a2 = modalRef.current) == null ? void 0 : _a2.close();
|
|
684
|
+
return false;
|
|
685
|
+
}
|
|
686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
687
|
+
Box,
|
|
688
|
+
__spreadProps(__spreadValues({
|
|
689
|
+
as: "dialog",
|
|
690
|
+
className: (0, import_typed_classname12.clsx)("hds-modal", className),
|
|
691
|
+
closeable: true,
|
|
692
|
+
onClose,
|
|
693
|
+
ref: mergedRef,
|
|
694
|
+
variant: "white"
|
|
695
|
+
}, rest), {
|
|
696
|
+
children
|
|
697
|
+
})
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
);
|
|
701
|
+
Modal.displayName = "Modal";
|
|
702
|
+
var ModalHeader = (0, import_react10.forwardRef)(
|
|
703
|
+
(_a, ref) => {
|
|
704
|
+
var _b = _a, { as: Component = "h1", className } = _b, rest = __objRest(_b, ["as", "className"]);
|
|
705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
706
|
+
Component,
|
|
707
|
+
__spreadValues({
|
|
708
|
+
className: (0, import_typed_classname12.clsx)("hds-modal__header", className),
|
|
709
|
+
ref
|
|
710
|
+
}, rest)
|
|
711
|
+
);
|
|
712
|
+
}
|
|
713
|
+
);
|
|
714
|
+
ModalHeader.displayName = "ModalHeader";
|
|
715
|
+
|
|
716
|
+
// src/modal/index.tsx
|
|
717
|
+
var ModalComponent = Modal;
|
|
718
|
+
ModalComponent.Header = ModalHeader;
|
|
719
|
+
ModalComponent.Header.displayName = "Modal";
|
|
720
|
+
|
|
721
|
+
// src/breadcrumb/index.tsx
|
|
722
|
+
var import_fonts9 = require("@postenbring/hedwig-css/dist/fonts.css");
|
|
723
|
+
var import_tokens9 = require("@postenbring/hedwig-css/dist/tokens.css");
|
|
724
|
+
var import_base9 = require("@postenbring/hedwig-css/dist/base.css");
|
|
725
|
+
var import_breadcrumb = require("@postenbring/hedwig-css/dist/breadcrumb.css");
|
|
726
|
+
|
|
727
|
+
// src/breadcrumb/breadcrumb.tsx
|
|
728
|
+
var import_typed_classname13 = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
729
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
730
|
+
function Breadcrumbs({ navProps, olProps, children }) {
|
|
731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("nav", __spreadProps(__spreadValues({}, navProps), { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ol", __spreadProps(__spreadValues({}, olProps), { className: (0, import_typed_classname13.clsx)("hds-breadcrumbs", olProps == null ? void 0 : olProps.className), children })) }));
|
|
732
|
+
}
|
|
733
|
+
Breadcrumbs.displayName = "Breadcrumbs";
|
|
630
734
|
// Annotate the CommonJS export names for ESM import in node:
|
|
631
735
|
0 && (module.exports = {
|
|
632
736
|
Accordion,
|
|
@@ -637,6 +741,7 @@ AccordionContent.displayName = "AccordionContent";
|
|
|
637
741
|
BaseButton,
|
|
638
742
|
Box,
|
|
639
743
|
BoxCloseButton,
|
|
744
|
+
Breadcrumbs,
|
|
640
745
|
DarkBadge,
|
|
641
746
|
DescriptionDetails,
|
|
642
747
|
DescriptionList,
|
|
@@ -646,6 +751,8 @@ AccordionContent.displayName = "AccordionContent";
|
|
|
646
751
|
Message,
|
|
647
752
|
MessageDescription,
|
|
648
753
|
MessageTitle,
|
|
754
|
+
Modal,
|
|
755
|
+
ModalHeader,
|
|
649
756
|
OrderedList,
|
|
650
757
|
PrimaryButton,
|
|
651
758
|
SecondaryButton,
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ModalComponent
|
|
3
|
+
} from "./chunk-ROSXRHEW.mjs";
|
|
4
|
+
import {
|
|
5
|
+
ModalHeader
|
|
6
|
+
} from "./chunk-FFQBRM3W.mjs";
|
|
7
|
+
import "./chunk-5NDZ66M6.mjs";
|
|
8
|
+
import {
|
|
9
|
+
Link
|
|
10
|
+
} from "./chunk-TES7CVGU.mjs";
|
|
1
11
|
import "./chunk-QOVAYDPH.mjs";
|
|
2
12
|
import {
|
|
3
13
|
DescriptionDetails,
|
|
@@ -23,16 +33,16 @@ import {
|
|
|
23
33
|
Box,
|
|
24
34
|
BoxCloseButton
|
|
25
35
|
} from "./chunk-RXUPE4MM.mjs";
|
|
36
|
+
import "./chunk-EMX6J4XG.mjs";
|
|
37
|
+
import {
|
|
38
|
+
Breadcrumbs
|
|
39
|
+
} from "./chunk-Q2HYT3Z7.mjs";
|
|
26
40
|
import "./chunk-N3EFZW7T.mjs";
|
|
27
41
|
import {
|
|
28
42
|
BaseButton,
|
|
29
43
|
PrimaryButton,
|
|
30
44
|
SecondaryButton
|
|
31
45
|
} from "./chunk-ENRMC5K7.mjs";
|
|
32
|
-
import "./chunk-5NDZ66M6.mjs";
|
|
33
|
-
import {
|
|
34
|
-
Link
|
|
35
|
-
} from "./chunk-TES7CVGU.mjs";
|
|
36
46
|
import "./chunk-Z36ETKOZ.mjs";
|
|
37
47
|
import {
|
|
38
48
|
AccordionContent
|
|
@@ -64,6 +74,7 @@ export {
|
|
|
64
74
|
BaseButton,
|
|
65
75
|
Box,
|
|
66
76
|
BoxCloseButton,
|
|
77
|
+
Breadcrumbs,
|
|
67
78
|
DarkBadge,
|
|
68
79
|
DescriptionDetails,
|
|
69
80
|
DescriptionList,
|
|
@@ -73,6 +84,8 @@ export {
|
|
|
73
84
|
MessageComponent as Message,
|
|
74
85
|
MessageDescription,
|
|
75
86
|
MessageTitle,
|
|
87
|
+
ModalComponent as Modal,
|
|
88
|
+
ModalHeader,
|
|
76
89
|
OrderedList,
|
|
77
90
|
PrimaryButton,
|
|
78
91
|
SecondaryButton,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ModalProps, ModalHeader } from './modal.mjs';
|
|
3
|
+
import '../utils-BfZsjuFH.mjs';
|
|
4
|
+
|
|
5
|
+
declare const ModalComponent: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLDialogElement>> & {
|
|
6
|
+
Header: typeof ModalHeader;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { ModalComponent as Modal, ModalHeader };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ModalProps, ModalHeader } from './modal.js';
|
|
3
|
+
import '../utils-BfZsjuFH.js';
|
|
4
|
+
|
|
5
|
+
declare const ModalComponent: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLDialogElement>> & {
|
|
6
|
+
Header: typeof ModalHeader;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { ModalComponent as Modal, ModalHeader };
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __export = (target, all) => {
|
|
38
|
+
for (var name in all)
|
|
39
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
+
};
|
|
41
|
+
var __copyProps = (to, from, except, desc) => {
|
|
42
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
+
for (let key of __getOwnPropNames(from))
|
|
44
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
+
}
|
|
47
|
+
return to;
|
|
48
|
+
};
|
|
49
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
+
mod
|
|
56
|
+
));
|
|
57
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
|
+
|
|
59
|
+
// src/modal/index.tsx
|
|
60
|
+
var modal_exports = {};
|
|
61
|
+
__export(modal_exports, {
|
|
62
|
+
Modal: () => ModalComponent,
|
|
63
|
+
ModalHeader: () => ModalHeader
|
|
64
|
+
});
|
|
65
|
+
module.exports = __toCommonJS(modal_exports);
|
|
66
|
+
var import_fonts = require("@postenbring/hedwig-css/dist/fonts.css");
|
|
67
|
+
var import_tokens = require("@postenbring/hedwig-css/dist/tokens.css");
|
|
68
|
+
var import_base = require("@postenbring/hedwig-css/dist/base.css");
|
|
69
|
+
var import_box2 = require("@postenbring/hedwig-css/dist/box.css");
|
|
70
|
+
var import_modal = require("@postenbring/hedwig-css/dist/modal.css");
|
|
71
|
+
|
|
72
|
+
// src/modal/modal.tsx
|
|
73
|
+
var import_react2 = require("react");
|
|
74
|
+
var import_typed_classname2 = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
75
|
+
|
|
76
|
+
// src/box/box.tsx
|
|
77
|
+
var import_react = require("react");
|
|
78
|
+
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
79
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
80
|
+
var Box = (0, import_react.forwardRef)(
|
|
81
|
+
(_a, ref) => {
|
|
82
|
+
var _b = _a, {
|
|
83
|
+
as: Component = "div",
|
|
84
|
+
variant = "light-grey",
|
|
85
|
+
closeable = false,
|
|
86
|
+
onClose: onCloseProp,
|
|
87
|
+
closed: closedProp,
|
|
88
|
+
closeButtonProps,
|
|
89
|
+
children,
|
|
90
|
+
className
|
|
91
|
+
} = _b, rest = __objRest(_b, [
|
|
92
|
+
"as",
|
|
93
|
+
"variant",
|
|
94
|
+
"closeable",
|
|
95
|
+
"onClose",
|
|
96
|
+
"closed",
|
|
97
|
+
"closeButtonProps",
|
|
98
|
+
"children",
|
|
99
|
+
"className"
|
|
100
|
+
]);
|
|
101
|
+
const [closedState, setClosedState] = (0, import_react.useState)(false);
|
|
102
|
+
const onClose = (0, import_react.useCallback)(() => {
|
|
103
|
+
if (onCloseProp) {
|
|
104
|
+
const result = onCloseProp();
|
|
105
|
+
if (result === true) {
|
|
106
|
+
setClosedState(true);
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
setClosedState(true);
|
|
110
|
+
}
|
|
111
|
+
}, []);
|
|
112
|
+
const closed = closedProp != null ? closedProp : closedState;
|
|
113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
114
|
+
Component,
|
|
115
|
+
__spreadProps(__spreadValues({
|
|
116
|
+
className: (0, import_typed_classname.clsx)(
|
|
117
|
+
"hds-box",
|
|
118
|
+
`hds-box--${variant}`,
|
|
119
|
+
{ "hds-box--closed": closed },
|
|
120
|
+
className
|
|
121
|
+
),
|
|
122
|
+
ref
|
|
123
|
+
}, rest), {
|
|
124
|
+
children: [
|
|
125
|
+
closeable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BoxCloseButton, __spreadValues({ onClick: onClose }, closeButtonProps)) : null,
|
|
126
|
+
children
|
|
127
|
+
]
|
|
128
|
+
})
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
Box.displayName = "Box";
|
|
133
|
+
var BoxCloseButton = (0, import_react.forwardRef)(
|
|
134
|
+
(_a, ref) => {
|
|
135
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
|
136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
137
|
+
"button",
|
|
138
|
+
__spreadValues({
|
|
139
|
+
className: (0, import_typed_classname.clsx)("hds-box__close-button", className),
|
|
140
|
+
ref,
|
|
141
|
+
type: "button"
|
|
142
|
+
}, rest)
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
BoxCloseButton.displayName = "BoxCloseButton";
|
|
147
|
+
|
|
148
|
+
// src/utils.ts
|
|
149
|
+
var React = __toESM(require("react"));
|
|
150
|
+
function useMergeRefs(refs) {
|
|
151
|
+
return React.useMemo(() => {
|
|
152
|
+
if (refs.every((ref) => ref === null)) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
return (value) => {
|
|
156
|
+
refs.forEach((ref) => {
|
|
157
|
+
if (typeof ref === "function") {
|
|
158
|
+
ref(value);
|
|
159
|
+
} else if (ref !== null) {
|
|
160
|
+
ref.current = value;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
}, refs);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// src/modal/modal.tsx
|
|
168
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
169
|
+
var Modal = (0, import_react2.forwardRef)(
|
|
170
|
+
(_a, ref) => {
|
|
171
|
+
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
|
172
|
+
const modalRef = (0, import_react2.useRef)(null);
|
|
173
|
+
const mergedRef = useMergeRefs([modalRef, ref]);
|
|
174
|
+
function onClose() {
|
|
175
|
+
var _a2;
|
|
176
|
+
(_a2 = modalRef.current) == null ? void 0 : _a2.close();
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
180
|
+
Box,
|
|
181
|
+
__spreadProps(__spreadValues({
|
|
182
|
+
as: "dialog",
|
|
183
|
+
className: (0, import_typed_classname2.clsx)("hds-modal", className),
|
|
184
|
+
closeable: true,
|
|
185
|
+
onClose,
|
|
186
|
+
ref: mergedRef,
|
|
187
|
+
variant: "white"
|
|
188
|
+
}, rest), {
|
|
189
|
+
children
|
|
190
|
+
})
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
Modal.displayName = "Modal";
|
|
195
|
+
var ModalHeader = (0, import_react2.forwardRef)(
|
|
196
|
+
(_a, ref) => {
|
|
197
|
+
var _b = _a, { as: Component = "h1", className } = _b, rest = __objRest(_b, ["as", "className"]);
|
|
198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
199
|
+
Component,
|
|
200
|
+
__spreadValues({
|
|
201
|
+
className: (0, import_typed_classname2.clsx)("hds-modal__header", className),
|
|
202
|
+
ref
|
|
203
|
+
}, rest)
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
ModalHeader.displayName = "ModalHeader";
|
|
208
|
+
|
|
209
|
+
// src/modal/index.tsx
|
|
210
|
+
var ModalComponent = Modal;
|
|
211
|
+
ModalComponent.Header = ModalHeader;
|
|
212
|
+
ModalComponent.Header.displayName = "Modal";
|
|
213
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
214
|
+
0 && (module.exports = {
|
|
215
|
+
Modal,
|
|
216
|
+
ModalHeader
|
|
217
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import { O as OverridableComponent } from '../utils-BfZsjuFH.mjs';
|
|
3
|
+
|
|
4
|
+
interface ModalProps extends React.HTMLAttributes<HTMLDialogElement> {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* # 🚨 WORK IN PROGRESS 🚨
|
|
9
|
+
*/
|
|
10
|
+
declare const Modal: React$1.ForwardRefExoticComponent<ModalProps & React$1.RefAttributes<HTMLDialogElement>>;
|
|
11
|
+
declare const ModalHeader: OverridableComponent<object, HTMLParagraphElement>;
|
|
12
|
+
|
|
13
|
+
export { Modal, ModalHeader, type ModalProps };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import { O as OverridableComponent } from '../utils-BfZsjuFH.js';
|
|
3
|
+
|
|
4
|
+
interface ModalProps extends React.HTMLAttributes<HTMLDialogElement> {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* # 🚨 WORK IN PROGRESS 🚨
|
|
9
|
+
*/
|
|
10
|
+
declare const Modal: React$1.ForwardRefExoticComponent<ModalProps & React$1.RefAttributes<HTMLDialogElement>>;
|
|
11
|
+
declare const ModalHeader: OverridableComponent<object, HTMLParagraphElement>;
|
|
12
|
+
|
|
13
|
+
export { Modal, ModalHeader, type ModalProps };
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __export = (target, all) => {
|
|
38
|
+
for (var name in all)
|
|
39
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
+
};
|
|
41
|
+
var __copyProps = (to, from, except, desc) => {
|
|
42
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
+
for (let key of __getOwnPropNames(from))
|
|
44
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
+
}
|
|
47
|
+
return to;
|
|
48
|
+
};
|
|
49
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
+
mod
|
|
56
|
+
));
|
|
57
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
|
+
|
|
59
|
+
// src/modal/modal.tsx
|
|
60
|
+
var modal_exports = {};
|
|
61
|
+
__export(modal_exports, {
|
|
62
|
+
Modal: () => Modal,
|
|
63
|
+
ModalHeader: () => ModalHeader
|
|
64
|
+
});
|
|
65
|
+
module.exports = __toCommonJS(modal_exports);
|
|
66
|
+
var import_react2 = require("react");
|
|
67
|
+
var import_typed_classname2 = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
68
|
+
|
|
69
|
+
// src/box/box.tsx
|
|
70
|
+
var import_react = require("react");
|
|
71
|
+
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
72
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
73
|
+
var Box = (0, import_react.forwardRef)(
|
|
74
|
+
(_a, ref) => {
|
|
75
|
+
var _b = _a, {
|
|
76
|
+
as: Component = "div",
|
|
77
|
+
variant = "light-grey",
|
|
78
|
+
closeable = false,
|
|
79
|
+
onClose: onCloseProp,
|
|
80
|
+
closed: closedProp,
|
|
81
|
+
closeButtonProps,
|
|
82
|
+
children,
|
|
83
|
+
className
|
|
84
|
+
} = _b, rest = __objRest(_b, [
|
|
85
|
+
"as",
|
|
86
|
+
"variant",
|
|
87
|
+
"closeable",
|
|
88
|
+
"onClose",
|
|
89
|
+
"closed",
|
|
90
|
+
"closeButtonProps",
|
|
91
|
+
"children",
|
|
92
|
+
"className"
|
|
93
|
+
]);
|
|
94
|
+
const [closedState, setClosedState] = (0, import_react.useState)(false);
|
|
95
|
+
const onClose = (0, import_react.useCallback)(() => {
|
|
96
|
+
if (onCloseProp) {
|
|
97
|
+
const result = onCloseProp();
|
|
98
|
+
if (result === true) {
|
|
99
|
+
setClosedState(true);
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
setClosedState(true);
|
|
103
|
+
}
|
|
104
|
+
}, []);
|
|
105
|
+
const closed = closedProp != null ? closedProp : closedState;
|
|
106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
107
|
+
Component,
|
|
108
|
+
__spreadProps(__spreadValues({
|
|
109
|
+
className: (0, import_typed_classname.clsx)(
|
|
110
|
+
"hds-box",
|
|
111
|
+
`hds-box--${variant}`,
|
|
112
|
+
{ "hds-box--closed": closed },
|
|
113
|
+
className
|
|
114
|
+
),
|
|
115
|
+
ref
|
|
116
|
+
}, rest), {
|
|
117
|
+
children: [
|
|
118
|
+
closeable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BoxCloseButton, __spreadValues({ onClick: onClose }, closeButtonProps)) : null,
|
|
119
|
+
children
|
|
120
|
+
]
|
|
121
|
+
})
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
Box.displayName = "Box";
|
|
126
|
+
var BoxCloseButton = (0, import_react.forwardRef)(
|
|
127
|
+
(_a, ref) => {
|
|
128
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
|
129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
130
|
+
"button",
|
|
131
|
+
__spreadValues({
|
|
132
|
+
className: (0, import_typed_classname.clsx)("hds-box__close-button", className),
|
|
133
|
+
ref,
|
|
134
|
+
type: "button"
|
|
135
|
+
}, rest)
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
BoxCloseButton.displayName = "BoxCloseButton";
|
|
140
|
+
|
|
141
|
+
// src/utils.ts
|
|
142
|
+
var React = __toESM(require("react"));
|
|
143
|
+
function useMergeRefs(refs) {
|
|
144
|
+
return React.useMemo(() => {
|
|
145
|
+
if (refs.every((ref) => ref === null)) {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
return (value) => {
|
|
149
|
+
refs.forEach((ref) => {
|
|
150
|
+
if (typeof ref === "function") {
|
|
151
|
+
ref(value);
|
|
152
|
+
} else if (ref !== null) {
|
|
153
|
+
ref.current = value;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
}, refs);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// src/modal/modal.tsx
|
|
161
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
162
|
+
var Modal = (0, import_react2.forwardRef)(
|
|
163
|
+
(_a, ref) => {
|
|
164
|
+
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
|
165
|
+
const modalRef = (0, import_react2.useRef)(null);
|
|
166
|
+
const mergedRef = useMergeRefs([modalRef, ref]);
|
|
167
|
+
function onClose() {
|
|
168
|
+
var _a2;
|
|
169
|
+
(_a2 = modalRef.current) == null ? void 0 : _a2.close();
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
173
|
+
Box,
|
|
174
|
+
__spreadProps(__spreadValues({
|
|
175
|
+
as: "dialog",
|
|
176
|
+
className: (0, import_typed_classname2.clsx)("hds-modal", className),
|
|
177
|
+
closeable: true,
|
|
178
|
+
onClose,
|
|
179
|
+
ref: mergedRef,
|
|
180
|
+
variant: "white"
|
|
181
|
+
}, rest), {
|
|
182
|
+
children
|
|
183
|
+
})
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
Modal.displayName = "Modal";
|
|
188
|
+
var ModalHeader = (0, import_react2.forwardRef)(
|
|
189
|
+
(_a, ref) => {
|
|
190
|
+
var _b = _a, { as: Component = "h1", className } = _b, rest = __objRest(_b, ["as", "className"]);
|
|
191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
192
|
+
Component,
|
|
193
|
+
__spreadValues({
|
|
194
|
+
className: (0, import_typed_classname2.clsx)("hds-modal__header", className),
|
|
195
|
+
ref
|
|
196
|
+
}, rest)
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
ModalHeader.displayName = "ModalHeader";
|
|
201
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
202
|
+
0 && (module.exports = {
|
|
203
|
+
Modal,
|
|
204
|
+
ModalHeader
|
|
205
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postenbring/hedwig-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"hedwig-tsconfig": "0.0.0"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@postenbring/hedwig-css": "0.0.
|
|
22
|
+
"@postenbring/hedwig-css": "0.0.13"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|