@postenbring/hedwig-react 0.0.4 → 0.0.6
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/accordion/accordion-item-content.d.mts +9 -0
- package/dist/accordion/accordion-item-content.d.ts +9 -0
- package/dist/accordion/accordion-item-content.js +98 -0
- package/dist/accordion/accordion-item-content.mjs +8 -0
- package/dist/accordion/accordion-item-trigger.d.mts +9 -0
- package/dist/accordion/accordion-item-trigger.d.ts +9 -0
- package/dist/accordion/accordion-item-trigger.js +108 -0
- package/dist/accordion/accordion-item-trigger.mjs +8 -0
- package/dist/accordion/accordion-item.d.mts +15 -0
- package/dist/accordion/accordion-item.d.ts +15 -0
- package/dist/accordion/accordion-item.js +116 -0
- package/dist/accordion/accordion-item.mjs +8 -0
- package/dist/accordion/accordion.d.mts +28 -0
- package/dist/accordion/accordion.d.ts +28 -0
- package/dist/accordion/accordion.js +93 -0
- package/dist/accordion/accordion.mjs +8 -0
- package/dist/accordion/index.d.mts +6 -0
- package/dist/accordion/index.d.ts +6 -0
- package/dist/accordion/index.js +217 -0
- package/dist/accordion/index.mjs +21 -0
- package/dist/badge/badge.d.mts +2 -2
- package/dist/badge/badge.d.ts +2 -2
- package/dist/badge/badge.js +8 -14
- package/dist/badge/badge.mjs +2 -2
- package/dist/badge/index.js +10 -15
- package/dist/badge/index.mjs +3 -3
- package/dist/box/box.d.mts +36 -0
- package/dist/box/box.d.ts +36 -0
- package/dist/box/box.js +131 -0
- package/dist/box/box.mjs +9 -0
- package/dist/box/index.d.mts +3 -0
- package/dist/box/index.d.ts +3 -0
- package/dist/box/index.js +137 -0
- package/dist/box/index.mjs +10 -0
- package/dist/button/button.d.mts +2 -2
- package/dist/button/button.d.ts +2 -2
- package/dist/button/button.js +0 -13
- package/dist/button/button.mjs +2 -2
- package/dist/button/index.js +2 -14
- package/dist/button/index.mjs +3 -3
- package/dist/chunk-2V6SWZ5G.mjs +16 -0
- package/dist/chunk-4XWB4ZSR.mjs +6 -0
- package/dist/chunk-7F7QB4D5.mjs +50 -0
- package/dist/{chunk-NSNVKFU3.mjs → chunk-AYGPUYPZ.mjs} +2 -1
- package/dist/chunk-B3PZUFG2.mjs +40 -0
- package/dist/{chunk-H5SSXV32.mjs → chunk-CYW3DUD2.mjs} +2 -1
- package/dist/chunk-EKFYWUBE.mjs +36 -0
- package/dist/chunk-EX4U7YZF.mjs +83 -0
- package/dist/{chunk-BTCTQCPO.mjs → chunk-FUJQIYOF.mjs} +1 -12
- package/dist/{chunk-SF42ETS4.mjs → chunk-GSPFHK2Z.mjs} +2 -4
- package/dist/chunk-ID5KKZMK.mjs +5 -0
- package/dist/chunk-IOOSUX5O.mjs +6 -0
- package/dist/chunk-IWDN3WGQ.mjs +47 -0
- package/dist/chunk-IWV4FFE3.mjs +35 -0
- package/dist/chunk-KBVDBI2L.mjs +59 -0
- package/dist/chunk-LNYNZ4EG.mjs +40 -0
- package/dist/chunk-NMSLCM2K.mjs +18 -0
- package/dist/{chunk-YH2NWXPK.mjs → chunk-O3NMR6GE.mjs} +10 -5
- package/dist/chunk-PCKWBORI.mjs +5 -0
- package/dist/{chunk-AHYBSRCR.mjs → chunk-VZNNGRKM.mjs} +2 -1
- package/dist/{chunk-7FQ4XFS7.mjs → chunk-X3OAJSS2.mjs} +2 -4
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +395 -16
- package/dist/index.mjs +58 -9
- package/dist/input/input.d.mts +13 -0
- package/dist/input/input.d.ts +13 -0
- package/dist/input/input.js +109 -0
- package/dist/input/input.mjs +51 -0
- package/dist/link/index.js +2 -14
- package/dist/link/index.mjs +3 -3
- package/dist/link/link.d.mts +2 -2
- package/dist/link/link.d.ts +2 -2
- package/dist/link/link.js +0 -13
- package/dist/link/link.mjs +2 -2
- package/dist/list/description-list.d.mts +32 -0
- package/dist/list/description-list.d.ts +32 -0
- package/dist/list/description-list.js +89 -0
- package/dist/list/description-list.mjs +13 -0
- package/dist/list/index.d.mts +5 -0
- package/dist/list/index.d.ts +5 -0
- package/dist/list/index.js +144 -0
- package/dist/list/index.mjs +22 -0
- package/dist/list/link-list.d.mts +13 -0
- package/dist/list/link-list.d.ts +13 -0
- package/dist/list/link-list.js +102 -0
- package/dist/list/link-list.mjs +8 -0
- package/dist/list/list.d.mts +25 -0
- package/dist/list/list.d.ts +25 -0
- package/dist/list/list.js +95 -0
- package/dist/list/list.mjs +9 -0
- package/dist/message/index.d.mts +4 -0
- package/dist/message/index.d.ts +4 -0
- package/dist/message/index.js +162 -0
- package/dist/message/index.mjs +9 -0
- package/dist/message/message.d.mts +16 -0
- package/dist/message/message.d.ts +16 -0
- package/dist/message/message.js +155 -0
- package/dist/message/message.mjs +8 -0
- package/dist/utils-BfZsjuFH.d.mts +17 -0
- package/dist/utils-BfZsjuFH.d.ts +17 -0
- package/package.json +17 -17
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { O as OverridableComponent } from '../utils-BfZsjuFH.mjs';
|
|
3
|
+
|
|
4
|
+
interface AccordionContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const AccordionContent: OverridableComponent<AccordionContentProps, HTMLDivElement>;
|
|
8
|
+
|
|
9
|
+
export { AccordionContent, type AccordionContentProps };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { O as OverridableComponent } from '../utils-BfZsjuFH.js';
|
|
3
|
+
|
|
4
|
+
interface AccordionContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const AccordionContent: OverridableComponent<AccordionContentProps, HTMLDivElement>;
|
|
8
|
+
|
|
9
|
+
export { AccordionContent, type AccordionContentProps };
|
|
@@ -0,0 +1,98 @@
|
|
|
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 __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
var __export = (target, all) => {
|
|
36
|
+
for (var name in all)
|
|
37
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
38
|
+
};
|
|
39
|
+
var __copyProps = (to, from, except, desc) => {
|
|
40
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
+
for (let key of __getOwnPropNames(from))
|
|
42
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
+
}
|
|
45
|
+
return to;
|
|
46
|
+
};
|
|
47
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
|
+
|
|
49
|
+
// src/accordion/accordion-item-content.tsx
|
|
50
|
+
var accordion_item_content_exports = {};
|
|
51
|
+
__export(accordion_item_content_exports, {
|
|
52
|
+
AccordionContent: () => AccordionContent
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(accordion_item_content_exports);
|
|
55
|
+
var import_react2 = require("react");
|
|
56
|
+
var import_clsx = require("clsx");
|
|
57
|
+
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
58
|
+
|
|
59
|
+
// src/accordion/context.ts
|
|
60
|
+
var import_react = require("react");
|
|
61
|
+
var AccordionContext = (0, import_react.createContext)({
|
|
62
|
+
variant: "multiple",
|
|
63
|
+
mounted: false,
|
|
64
|
+
openItems: [],
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Added default section, without handling
|
|
66
|
+
toggleOpenItem: (id) => {
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
var AccordionItemContext = (0, import_react.createContext)(null);
|
|
70
|
+
|
|
71
|
+
// src/accordion/accordion-item-content.tsx
|
|
72
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
73
|
+
var AccordionContent = (0, import_react2.forwardRef)((_a, ref) => {
|
|
74
|
+
var _b = _a, { as: Component = "div", children, className } = _b, rest = __objRest(_b, ["as", "children", "className"]);
|
|
75
|
+
const context = (0, import_react2.useContext)(AccordionItemContext);
|
|
76
|
+
if (context === null) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
80
|
+
Component,
|
|
81
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
82
|
+
className: (0, import_clsx.clsx)(
|
|
83
|
+
(0, import_typed_classname.t)("hds-accordion-item-content"),
|
|
84
|
+
{
|
|
85
|
+
[(0, import_typed_classname.t)(`hds-accordion-item-content--closed`)]: !context.open
|
|
86
|
+
},
|
|
87
|
+
className
|
|
88
|
+
),
|
|
89
|
+
ref,
|
|
90
|
+
children
|
|
91
|
+
})
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
AccordionContent.displayName = "AccordionContent";
|
|
95
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
96
|
+
0 && (module.exports = {
|
|
97
|
+
AccordionContent
|
|
98
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { O as OverridableComponent } from '../utils-BfZsjuFH.mjs';
|
|
3
|
+
|
|
4
|
+
interface AccordionTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const AccordionTrigger: OverridableComponent<AccordionTriggerProps, HTMLButtonElement>;
|
|
8
|
+
|
|
9
|
+
export { AccordionTrigger, type AccordionTriggerProps };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { O as OverridableComponent } from '../utils-BfZsjuFH.js';
|
|
3
|
+
|
|
4
|
+
interface AccordionTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const AccordionTrigger: OverridableComponent<AccordionTriggerProps, HTMLButtonElement>;
|
|
8
|
+
|
|
9
|
+
export { AccordionTrigger, type AccordionTriggerProps };
|
|
@@ -0,0 +1,108 @@
|
|
|
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 __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
var __export = (target, all) => {
|
|
36
|
+
for (var name in all)
|
|
37
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
38
|
+
};
|
|
39
|
+
var __copyProps = (to, from, except, desc) => {
|
|
40
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
+
for (let key of __getOwnPropNames(from))
|
|
42
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
+
}
|
|
45
|
+
return to;
|
|
46
|
+
};
|
|
47
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
|
+
|
|
49
|
+
// src/accordion/accordion-item-trigger.tsx
|
|
50
|
+
var accordion_item_trigger_exports = {};
|
|
51
|
+
__export(accordion_item_trigger_exports, {
|
|
52
|
+
AccordionTrigger: () => AccordionTrigger
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(accordion_item_trigger_exports);
|
|
55
|
+
var import_react2 = require("react");
|
|
56
|
+
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
57
|
+
var import_clsx = require("clsx");
|
|
58
|
+
|
|
59
|
+
// src/accordion/context.ts
|
|
60
|
+
var import_react = require("react");
|
|
61
|
+
var AccordionContext = (0, import_react.createContext)({
|
|
62
|
+
variant: "multiple",
|
|
63
|
+
mounted: false,
|
|
64
|
+
openItems: [],
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Added default section, without handling
|
|
66
|
+
toggleOpenItem: (id) => {
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
var AccordionItemContext = (0, import_react.createContext)(null);
|
|
70
|
+
|
|
71
|
+
// src/accordion/accordion-item-trigger.tsx
|
|
72
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
73
|
+
function FaArrowDownButNotReally() {
|
|
74
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "v " });
|
|
75
|
+
}
|
|
76
|
+
function FaArrowUpButNotReally() {
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "^ " });
|
|
78
|
+
}
|
|
79
|
+
var AccordionTrigger = (0, import_react2.forwardRef)((_a, ref) => {
|
|
80
|
+
var _b = _a, { as: Component = "button", children, className, onClick } = _b, rest = __objRest(_b, ["as", "children", "className", "onClick"]);
|
|
81
|
+
const itemContext = (0, import_react2.useContext)(AccordionItemContext);
|
|
82
|
+
if (itemContext === null) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
const expandOrCollapse = (e) => {
|
|
86
|
+
itemContext.setOpen(!itemContext.open);
|
|
87
|
+
onClick && onClick(e);
|
|
88
|
+
};
|
|
89
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
90
|
+
Component,
|
|
91
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
92
|
+
"aria-expanded": itemContext.open,
|
|
93
|
+
className: (0, import_clsx.clsx)((0, import_typed_classname.t)("hds-accordion-item-trigger"), className),
|
|
94
|
+
onClick: expandOrCollapse,
|
|
95
|
+
ref,
|
|
96
|
+
type: "button",
|
|
97
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_clsx.clsx)((0, import_typed_classname.t)("hds-accordion-item-trigger--icon")), children: itemContext.open ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaArrowUpButNotReally, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaArrowDownButNotReally, {}) }),
|
|
99
|
+
children
|
|
100
|
+
] })
|
|
101
|
+
})
|
|
102
|
+
);
|
|
103
|
+
});
|
|
104
|
+
AccordionTrigger.displayName = "AccordionTrigger";
|
|
105
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
106
|
+
0 && (module.exports = {
|
|
107
|
+
AccordionTrigger
|
|
108
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactElement, HTMLAttributes } from 'react';
|
|
2
|
+
import { O as OverridableComponent } from '../utils-BfZsjuFH.mjs';
|
|
3
|
+
import { AccordionTriggerProps } from './accordion-item-trigger.mjs';
|
|
4
|
+
import { AccordionContentProps } from './accordion-item-content.mjs';
|
|
5
|
+
|
|
6
|
+
type AccordionItemChildrenType = ReactElement<AccordionTriggerProps> | ReactElement<AccordionContentProps>;
|
|
7
|
+
interface AccordionItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
/**
|
|
9
|
+
* Accepts type of <AccordionContent/> and <AccordionTrigger/>
|
|
10
|
+
*/
|
|
11
|
+
children: AccordionItemChildrenType[];
|
|
12
|
+
}
|
|
13
|
+
declare const AccordionItem: OverridableComponent<AccordionItemProps, HTMLDivElement>;
|
|
14
|
+
|
|
15
|
+
export { AccordionItem, type AccordionItemChildrenType, type AccordionItemProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactElement, HTMLAttributes } from 'react';
|
|
2
|
+
import { O as OverridableComponent } from '../utils-BfZsjuFH.js';
|
|
3
|
+
import { AccordionTriggerProps } from './accordion-item-trigger.js';
|
|
4
|
+
import { AccordionContentProps } from './accordion-item-content.js';
|
|
5
|
+
|
|
6
|
+
type AccordionItemChildrenType = ReactElement<AccordionTriggerProps> | ReactElement<AccordionContentProps>;
|
|
7
|
+
interface AccordionItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
/**
|
|
9
|
+
* Accepts type of <AccordionContent/> and <AccordionTrigger/>
|
|
10
|
+
*/
|
|
11
|
+
children: AccordionItemChildrenType[];
|
|
12
|
+
}
|
|
13
|
+
declare const AccordionItem: OverridableComponent<AccordionItemProps, HTMLDivElement>;
|
|
14
|
+
|
|
15
|
+
export { AccordionItem, type AccordionItemChildrenType, type AccordionItemProps };
|
|
@@ -0,0 +1,116 @@
|
|
|
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 __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
var __export = (target, all) => {
|
|
36
|
+
for (var name in all)
|
|
37
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
38
|
+
};
|
|
39
|
+
var __copyProps = (to, from, except, desc) => {
|
|
40
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
+
for (let key of __getOwnPropNames(from))
|
|
42
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
+
}
|
|
45
|
+
return to;
|
|
46
|
+
};
|
|
47
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
|
+
|
|
49
|
+
// src/accordion/accordion-item.tsx
|
|
50
|
+
var accordion_item_exports = {};
|
|
51
|
+
__export(accordion_item_exports, {
|
|
52
|
+
AccordionItem: () => AccordionItem
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(accordion_item_exports);
|
|
55
|
+
var import_react2 = require("react");
|
|
56
|
+
var import_clsx = require("clsx");
|
|
57
|
+
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
58
|
+
|
|
59
|
+
// src/accordion/context.ts
|
|
60
|
+
var import_react = require("react");
|
|
61
|
+
var AccordionContext = (0, import_react.createContext)({
|
|
62
|
+
variant: "multiple",
|
|
63
|
+
mounted: false,
|
|
64
|
+
openItems: [],
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Added default section, without handling
|
|
66
|
+
toggleOpenItem: (id) => {
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
var AccordionItemContext = (0, import_react.createContext)(null);
|
|
70
|
+
|
|
71
|
+
// src/accordion/accordion-item.tsx
|
|
72
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
73
|
+
var AccordionItem = (0, import_react2.forwardRef)(
|
|
74
|
+
(_a, ref) => {
|
|
75
|
+
var _b = _a, { as: Component = "div", children, className } = _b, rest = __objRest(_b, ["as", "children", "className"]);
|
|
76
|
+
const context = (0, import_react2.useContext)(AccordionContext);
|
|
77
|
+
const [open, setOpen] = (0, import_react2.useState)(false);
|
|
78
|
+
const accordionItemId = (0, import_react2.useId)();
|
|
79
|
+
const handleOpen = () => {
|
|
80
|
+
setOpen(!open);
|
|
81
|
+
if (context.variant === "single") {
|
|
82
|
+
context.toggleOpenItem(accordionItemId);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
if (!context.mounted) {
|
|
86
|
+
throw new Error("Context required. Did you use <AccordionItem/> outside of <Accordion/>?");
|
|
87
|
+
}
|
|
88
|
+
(0, import_react2.useEffect)(() => {
|
|
89
|
+
if (context.variant === "multiple") {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (open && !context.openItems.includes(accordionItemId)) {
|
|
93
|
+
setOpen(false);
|
|
94
|
+
}
|
|
95
|
+
}, [context.openItems]);
|
|
96
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
97
|
+
Component,
|
|
98
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
99
|
+
className: (0, import_clsx.clsx)(
|
|
100
|
+
(0, import_typed_classname.t)("hds-accordion-item"),
|
|
101
|
+
{
|
|
102
|
+
[(0, import_typed_classname.t)(`hds-accordion-item__expanded`)]: open
|
|
103
|
+
},
|
|
104
|
+
className
|
|
105
|
+
),
|
|
106
|
+
ref,
|
|
107
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionItemContext.Provider, { value: { open, setOpen: handleOpen }, children })
|
|
108
|
+
})
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
AccordionItem.displayName = "AccordionItem";
|
|
113
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
114
|
+
0 && (module.exports = {
|
|
115
|
+
AccordionItem
|
|
116
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactElement } from 'react';
|
|
2
|
+
import { O as OverridableComponent } from '../utils-BfZsjuFH.mjs';
|
|
3
|
+
import { AccordionItemProps } from './accordion-item.mjs';
|
|
4
|
+
import './accordion-item-trigger.mjs';
|
|
5
|
+
import './accordion-item-content.mjs';
|
|
6
|
+
|
|
7
|
+
type AccordionType = "multiple" | "single";
|
|
8
|
+
|
|
9
|
+
interface AccordionProps extends HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Accepts type of <AccordionItem/>
|
|
12
|
+
*/
|
|
13
|
+
children: ReactElement<AccordionItemProps> | ReactElement<AccordionItemProps>[];
|
|
14
|
+
className?: string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Can be either "single" or "multiple".
|
|
17
|
+
*
|
|
18
|
+
* Single will basically mean that just a singular item will be opened at the time, and all
|
|
19
|
+
* others will be closed
|
|
20
|
+
*
|
|
21
|
+
* Multiple is the default option, and will allow for multiple options to be visible/opened at the
|
|
22
|
+
* same time
|
|
23
|
+
*/
|
|
24
|
+
variant?: AccordionType;
|
|
25
|
+
}
|
|
26
|
+
declare const Accordion: OverridableComponent<AccordionProps, HTMLDivElement>;
|
|
27
|
+
|
|
28
|
+
export { Accordion, type AccordionProps };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactElement } from 'react';
|
|
2
|
+
import { O as OverridableComponent } from '../utils-BfZsjuFH.js';
|
|
3
|
+
import { AccordionItemProps } from './accordion-item.js';
|
|
4
|
+
import './accordion-item-trigger.js';
|
|
5
|
+
import './accordion-item-content.js';
|
|
6
|
+
|
|
7
|
+
type AccordionType = "multiple" | "single";
|
|
8
|
+
|
|
9
|
+
interface AccordionProps extends HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Accepts type of <AccordionItem/>
|
|
12
|
+
*/
|
|
13
|
+
children: ReactElement<AccordionItemProps> | ReactElement<AccordionItemProps>[];
|
|
14
|
+
className?: string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Can be either "single" or "multiple".
|
|
17
|
+
*
|
|
18
|
+
* Single will basically mean that just a singular item will be opened at the time, and all
|
|
19
|
+
* others will be closed
|
|
20
|
+
*
|
|
21
|
+
* Multiple is the default option, and will allow for multiple options to be visible/opened at the
|
|
22
|
+
* same time
|
|
23
|
+
*/
|
|
24
|
+
variant?: AccordionType;
|
|
25
|
+
}
|
|
26
|
+
declare const Accordion: OverridableComponent<AccordionProps, HTMLDivElement>;
|
|
27
|
+
|
|
28
|
+
export { Accordion, type AccordionProps };
|
|
@@ -0,0 +1,93 @@
|
|
|
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 __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
var __export = (target, all) => {
|
|
36
|
+
for (var name in all)
|
|
37
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
38
|
+
};
|
|
39
|
+
var __copyProps = (to, from, except, desc) => {
|
|
40
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
+
for (let key of __getOwnPropNames(from))
|
|
42
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
+
}
|
|
45
|
+
return to;
|
|
46
|
+
};
|
|
47
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
|
+
|
|
49
|
+
// src/accordion/accordion.tsx
|
|
50
|
+
var accordion_exports = {};
|
|
51
|
+
__export(accordion_exports, {
|
|
52
|
+
Accordion: () => Accordion
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(accordion_exports);
|
|
55
|
+
var import_react2 = require("react");
|
|
56
|
+
var import_clsx = require("clsx");
|
|
57
|
+
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
58
|
+
|
|
59
|
+
// src/accordion/context.ts
|
|
60
|
+
var import_react = require("react");
|
|
61
|
+
var AccordionContext = (0, import_react.createContext)({
|
|
62
|
+
variant: "multiple",
|
|
63
|
+
mounted: false,
|
|
64
|
+
openItems: [],
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Added default section, without handling
|
|
66
|
+
toggleOpenItem: (id) => {
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
var AccordionItemContext = (0, import_react.createContext)(null);
|
|
70
|
+
|
|
71
|
+
// src/accordion/accordion.tsx
|
|
72
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
73
|
+
var Accordion = (0, import_react2.forwardRef)(
|
|
74
|
+
(_a, ref) => {
|
|
75
|
+
var _b = _a, { as: Component = "div", children, className, variant = "multiple" } = _b, rest = __objRest(_b, ["as", "children", "className", "variant"]);
|
|
76
|
+
const [openItems, setOpenItems] = (0, import_react2.useState)([]);
|
|
77
|
+
const toggleOpenItem = (itemId) => {
|
|
78
|
+
if (variant === "single") {
|
|
79
|
+
setOpenItems([itemId]);
|
|
80
|
+
} else {
|
|
81
|
+
setOpenItems(
|
|
82
|
+
openItems.includes(itemId) ? openItems.filter((id) => id !== itemId) : [...openItems, itemId]
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContext.Provider, { value: { variant, openItems, toggleOpenItem, mounted: true }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, __spreadProps(__spreadValues({}, rest), { className: (0, import_clsx.clsx)((0, import_typed_classname.t)("hds-accordion"), className), ref, children })) });
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
Accordion.displayName = "Accordion";
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
Accordion
|
|
93
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Accordion, AccordionProps } from './accordion.mjs';
|
|
2
|
+
export { AccordionItem, AccordionItemChildrenType, AccordionItemProps } from './accordion-item.mjs';
|
|
3
|
+
export { AccordionTrigger, AccordionTriggerProps } from './accordion-item-trigger.mjs';
|
|
4
|
+
export { AccordionContent, AccordionContentProps } from './accordion-item-content.mjs';
|
|
5
|
+
import 'react';
|
|
6
|
+
import '../utils-BfZsjuFH.mjs';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Accordion, AccordionProps } from './accordion.js';
|
|
2
|
+
export { AccordionItem, AccordionItemChildrenType, AccordionItemProps } from './accordion-item.js';
|
|
3
|
+
export { AccordionTrigger, AccordionTriggerProps } from './accordion-item-trigger.js';
|
|
4
|
+
export { AccordionContent, AccordionContentProps } from './accordion-item-content.js';
|
|
5
|
+
import 'react';
|
|
6
|
+
import '../utils-BfZsjuFH.js';
|