@postenbring/hedwig-react 0.0.0-dropdown-20231207124052 → 0.0.0-export-input-react-20231221220025
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/index.js +1 -1
- package/dist/accordion/index.mjs +1 -1
- package/dist/badge/badge.d.mts +3 -3
- package/dist/badge/badge.d.ts +3 -3
- package/dist/badge/index.js +1 -1
- package/dist/badge/index.mjs +1 -1
- package/dist/box/box.d.mts +2 -2
- package/dist/box/box.d.ts +2 -2
- package/dist/box/index.js +1 -1
- package/dist/box/index.mjs +1 -1
- package/dist/breadcrumb/index.js +1 -1
- package/dist/breadcrumb/index.mjs +1 -1
- package/dist/button/index.js +1 -1
- package/dist/button/index.mjs +1 -1
- package/dist/chunk-4RBJ5GJR.mjs +37 -0
- package/dist/chunk-4ZM45P62.mjs +13 -0
- package/dist/{chunk-QOVAYDPH.mjs → chunk-5OAMKZDX.mjs} +1 -1
- package/dist/{chunk-5NDZ66M6.mjs → chunk-7SCOBRDZ.mjs} +1 -1
- package/dist/{chunk-BJANCH4F.mjs → chunk-AJBQ2EJU.mjs} +1 -1
- package/dist/chunk-BKXVC23Y.mjs +5 -0
- package/dist/{chunk-XJ44O3HY.mjs → chunk-EW2DCMLN.mjs} +30 -15
- package/dist/chunk-FSBY3NKV.mjs +47 -0
- package/dist/{chunk-6AW5BEDP.mjs → chunk-HMESGVY5.mjs} +1 -1
- package/dist/{chunk-R55SMUE7.mjs → chunk-IEY4EQ4E.mjs} +1 -1
- package/dist/{chunk-Z36ETKOZ.mjs → chunk-LNPO2XQW.mjs} +1 -1
- package/dist/{chunk-JNIAIH63.mjs → chunk-LZSDIT5D.mjs} +1 -1
- package/dist/chunk-NVMNXQ5Q.mjs +79 -0
- package/dist/chunk-NXFD7TFE.mjs +5 -0
- package/dist/{chunk-FFQBRM3W.mjs → chunk-QV33ZHNO.mjs} +3 -21
- package/dist/{chunk-N3EFZW7T.mjs → chunk-VX6MSLLO.mjs} +1 -1
- package/dist/{chunk-ROSXRHEW.mjs → chunk-YFBW5ZRC.mjs} +2 -2
- package/dist/{chunk-EMX6J4XG.mjs → chunk-YRAMCYSB.mjs} +1 -1
- package/dist/chunk-ZLCNSHLT.mjs +31 -0
- package/dist/dropdown/dropdown.d.mts +3 -3
- package/dist/dropdown/dropdown.d.ts +3 -3
- package/dist/dropdown/index.js +1 -1
- package/dist/dropdown/index.mjs +1 -1
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +244 -14
- package/dist/index.mjs +35 -11
- package/dist/input/index.d.mts +0 -1
- package/dist/input/index.d.ts +0 -1
- package/dist/input/index.js +31 -26
- package/dist/input/index.mjs +2 -7
- package/dist/input/input.d.mts +8 -8
- package/dist/input/input.d.ts +8 -8
- package/dist/input/input.js +30 -25
- package/dist/input/input.mjs +1 -1
- package/dist/link/index.js +1 -1
- package/dist/link/index.mjs +1 -1
- package/dist/link/link.d.mts +4 -4
- package/dist/link/link.d.ts +4 -4
- package/dist/list/index.js +1 -1
- package/dist/list/index.mjs +1 -1
- package/dist/list/link-list.d.mts +2 -2
- package/dist/list/link-list.d.ts +2 -2
- package/dist/list/list.d.mts +2 -2
- package/dist/list/list.d.ts +2 -2
- package/dist/message/index.d.mts +5 -5
- package/dist/message/index.d.ts +5 -5
- package/dist/message/index.js +1 -1
- package/dist/message/index.mjs +1 -1
- package/dist/message/message.d.mts +2 -2
- package/dist/message/message.d.ts +2 -2
- package/dist/modal/index.d.mts +2 -2
- package/dist/modal/index.d.ts +2 -2
- package/dist/modal/index.js +6 -5
- package/dist/modal/index.mjs +3 -2
- package/dist/modal/modal.d.mts +2 -2
- package/dist/modal/modal.d.ts +2 -2
- package/dist/modal/modal.js +5 -4
- package/dist/modal/modal.mjs +2 -1
- package/dist/tabs/index.d.mts +6 -0
- package/dist/tabs/index.d.ts +6 -0
- package/dist/tabs/index.js +227 -0
- package/dist/tabs/index.mjs +22 -0
- package/dist/tabs/tabs-content.d.mts +21 -0
- package/dist/tabs/tabs-content.d.ts +21 -0
- package/dist/tabs/tabs-content.js +94 -0
- package/dist/tabs/tabs-content.mjs +10 -0
- package/dist/tabs/tabs-list.d.mts +26 -0
- package/dist/tabs/tabs-list.d.ts +26 -0
- package/dist/tabs/tabs-list.js +170 -0
- package/dist/tabs/tabs-list.mjs +11 -0
- package/dist/tabs/tabs.d.mts +16 -0
- package/dist/tabs/tabs.d.ts +16 -0
- package/dist/tabs/tabs.js +87 -0
- package/dist/tabs/tabs.mjs +8 -0
- package/package.json +5 -5
package/dist/accordion/index.js
CHANGED
|
@@ -57,7 +57,7 @@ __export(accordion_exports, {
|
|
|
57
57
|
module.exports = __toCommonJS(accordion_exports);
|
|
58
58
|
var import_fonts = require("@postenbring/hedwig-css/dist/fonts.css");
|
|
59
59
|
var import_tokens = require("@postenbring/hedwig-css/dist/tokens.css");
|
|
60
|
-
var
|
|
60
|
+
var import_body = require("@postenbring/hedwig-css/dist/body.css");
|
|
61
61
|
var import_accordion = require("@postenbring/hedwig-css/dist/accordion.css");
|
|
62
62
|
|
|
63
63
|
// src/accordion/accordion.tsx
|
package/dist/accordion/index.mjs
CHANGED
package/dist/badge/badge.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as
|
|
2
|
+
import * as react from 'react';
|
|
3
3
|
|
|
4
|
-
interface BadgeProps extends
|
|
4
|
+
interface BadgeProps extends react.AnchorHTMLAttributes<HTMLSpanElement> {
|
|
5
5
|
/**
|
|
6
6
|
* Font size of the badge
|
|
7
7
|
*/
|
|
8
8
|
size?: "small" | "smaller";
|
|
9
|
-
children:
|
|
9
|
+
children: react.ReactNode;
|
|
10
10
|
}
|
|
11
11
|
declare function Badge(props: BadgeProps): react_jsx_runtime.JSX.Element;
|
|
12
12
|
declare namespace Badge {
|
package/dist/badge/badge.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as
|
|
2
|
+
import * as react from 'react';
|
|
3
3
|
|
|
4
|
-
interface BadgeProps extends
|
|
4
|
+
interface BadgeProps extends react.AnchorHTMLAttributes<HTMLSpanElement> {
|
|
5
5
|
/**
|
|
6
6
|
* Font size of the badge
|
|
7
7
|
*/
|
|
8
8
|
size?: "small" | "smaller";
|
|
9
|
-
children:
|
|
9
|
+
children: react.ReactNode;
|
|
10
10
|
}
|
|
11
11
|
declare function Badge(props: BadgeProps): react_jsx_runtime.JSX.Element;
|
|
12
12
|
declare namespace Badge {
|
package/dist/badge/index.js
CHANGED
|
@@ -57,7 +57,7 @@ __export(badge_exports, {
|
|
|
57
57
|
module.exports = __toCommonJS(badge_exports);
|
|
58
58
|
var import_fonts = require("@postenbring/hedwig-css/dist/fonts.css");
|
|
59
59
|
var import_tokens = require("@postenbring/hedwig-css/dist/tokens.css");
|
|
60
|
-
var
|
|
60
|
+
var import_body = require("@postenbring/hedwig-css/dist/body.css");
|
|
61
61
|
var import_badge = require("@postenbring/hedwig-css/dist/badge.css");
|
|
62
62
|
|
|
63
63
|
// src/badge/badge.tsx
|
package/dist/badge/index.mjs
CHANGED
package/dist/box/box.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { O as OverridableComponent } from '../utils-BfZsjuFH.mjs';
|
|
3
3
|
|
|
4
4
|
interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -31,6 +31,6 @@ interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
31
31
|
}
|
|
32
32
|
declare const Box: OverridableComponent<BoxProps, HTMLDivElement>;
|
|
33
33
|
type BoxCloseButtonProps = Omit<React.HTMLAttributes<HTMLButtonElement>, "children">;
|
|
34
|
-
declare const BoxCloseButton:
|
|
34
|
+
declare const BoxCloseButton: react.ForwardRefExoticComponent<BoxCloseButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
35
35
|
|
|
36
36
|
export { Box, BoxCloseButton, type BoxCloseButtonProps, type BoxProps };
|
package/dist/box/box.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { O as OverridableComponent } from '../utils-BfZsjuFH.js';
|
|
3
3
|
|
|
4
4
|
interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -31,6 +31,6 @@ interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
31
31
|
}
|
|
32
32
|
declare const Box: OverridableComponent<BoxProps, HTMLDivElement>;
|
|
33
33
|
type BoxCloseButtonProps = Omit<React.HTMLAttributes<HTMLButtonElement>, "children">;
|
|
34
|
-
declare const BoxCloseButton:
|
|
34
|
+
declare const BoxCloseButton: react.ForwardRefExoticComponent<BoxCloseButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
35
35
|
|
|
36
36
|
export { Box, BoxCloseButton, type BoxCloseButtonProps, type BoxProps };
|
package/dist/box/index.js
CHANGED
|
@@ -55,7 +55,7 @@ __export(box_exports, {
|
|
|
55
55
|
module.exports = __toCommonJS(box_exports);
|
|
56
56
|
var import_fonts = require("@postenbring/hedwig-css/dist/fonts.css");
|
|
57
57
|
var import_tokens = require("@postenbring/hedwig-css/dist/tokens.css");
|
|
58
|
-
var
|
|
58
|
+
var import_body = require("@postenbring/hedwig-css/dist/body.css");
|
|
59
59
|
var import_box = require("@postenbring/hedwig-css/dist/box.css");
|
|
60
60
|
|
|
61
61
|
// src/box/box.tsx
|
package/dist/box/index.mjs
CHANGED
package/dist/breadcrumb/index.js
CHANGED
|
@@ -42,7 +42,7 @@ __export(breadcrumb_exports, {
|
|
|
42
42
|
module.exports = __toCommonJS(breadcrumb_exports);
|
|
43
43
|
var import_fonts = require("@postenbring/hedwig-css/dist/fonts.css");
|
|
44
44
|
var import_tokens = require("@postenbring/hedwig-css/dist/tokens.css");
|
|
45
|
-
var
|
|
45
|
+
var import_body = require("@postenbring/hedwig-css/dist/body.css");
|
|
46
46
|
var import_breadcrumb = require("@postenbring/hedwig-css/dist/breadcrumb.css");
|
|
47
47
|
|
|
48
48
|
// src/breadcrumb/breadcrumb.tsx
|
package/dist/button/index.js
CHANGED
|
@@ -56,7 +56,7 @@ __export(button_exports, {
|
|
|
56
56
|
module.exports = __toCommonJS(button_exports);
|
|
57
57
|
var import_fonts = require("@postenbring/hedwig-css/dist/fonts.css");
|
|
58
58
|
var import_tokens = require("@postenbring/hedwig-css/dist/tokens.css");
|
|
59
|
-
var
|
|
59
|
+
var import_body = require("@postenbring/hedwig-css/dist/body.css");
|
|
60
60
|
var import_button = require("@postenbring/hedwig-css/dist/button.css");
|
|
61
61
|
|
|
62
62
|
// src/button/button.tsx
|
package/dist/button/index.mjs
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TabsContext
|
|
3
|
+
} from "./chunk-4ZM45P62.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__objRest,
|
|
6
|
+
__spreadProps,
|
|
7
|
+
__spreadValues
|
|
8
|
+
} from "./chunk-FUJQIYOF.mjs";
|
|
9
|
+
|
|
10
|
+
// src/tabs/tabs-content.tsx
|
|
11
|
+
import { forwardRef, useContext } from "react";
|
|
12
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
function TabContents(_a) {
|
|
15
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
|
16
|
+
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({ className: clsx("hds-tabs--contents") }, rest), { children }));
|
|
17
|
+
}
|
|
18
|
+
TabContents.displayName = "TabContents";
|
|
19
|
+
var TabContent = forwardRef(
|
|
20
|
+
(_a, ref) => {
|
|
21
|
+
var _b = _a, { as: Component = "div", forTabId, children } = _b, rest = __objRest(_b, ["as", "forTabId", "children"]);
|
|
22
|
+
const context = useContext(TabsContext);
|
|
23
|
+
if (!context.mounted) {
|
|
24
|
+
throw new Error("Context required. Did you use <TabContent/> outside of <Tabs/>?");
|
|
25
|
+
}
|
|
26
|
+
if (context.activeTabId === forTabId) {
|
|
27
|
+
return /* @__PURE__ */ jsx(Component, __spreadProps(__spreadValues({}, rest), { ref, children }));
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
TabContent.displayName = "TabContent";
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
TabContents,
|
|
36
|
+
TabContent
|
|
37
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/tabs/context.ts
|
|
2
|
+
import { createContext } from "react";
|
|
3
|
+
var TabsContext = createContext({
|
|
4
|
+
mounted: false,
|
|
5
|
+
activeTabId: void 0,
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Added default section, without handling
|
|
7
|
+
toggleActiveTabId: (tabId) => {
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
TabsContext
|
|
13
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/list/index.tsx
|
|
2
2
|
import "@postenbring/hedwig-css/dist/fonts.css";
|
|
3
3
|
import "@postenbring/hedwig-css/dist/tokens.css";
|
|
4
|
-
import "@postenbring/hedwig-css/dist/
|
|
4
|
+
import "@postenbring/hedwig-css/dist/body.css";
|
|
5
5
|
import "@postenbring/hedwig-css/dist/description-list.css";
|
|
6
6
|
import "@postenbring/hedwig-css/dist/list.css";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/link/index.tsx
|
|
2
2
|
import "@postenbring/hedwig-css/dist/fonts.css";
|
|
3
3
|
import "@postenbring/hedwig-css/dist/tokens.css";
|
|
4
|
-
import "@postenbring/hedwig-css/dist/
|
|
4
|
+
import "@postenbring/hedwig-css/dist/body.css";
|
|
5
5
|
import "@postenbring/hedwig-css/dist/link.css";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/box/index.tsx
|
|
2
2
|
import "@postenbring/hedwig-css/dist/fonts.css";
|
|
3
3
|
import "@postenbring/hedwig-css/dist/tokens.css";
|
|
4
|
-
import "@postenbring/hedwig-css/dist/
|
|
4
|
+
import "@postenbring/hedwig-css/dist/body.css";
|
|
5
5
|
import "@postenbring/hedwig-css/dist/box.css";
|
|
@@ -5,27 +5,31 @@ import {
|
|
|
5
5
|
} from "./chunk-FUJQIYOF.mjs";
|
|
6
6
|
|
|
7
7
|
// src/input/input.tsx
|
|
8
|
-
import
|
|
8
|
+
import { useId, forwardRef } from "react";
|
|
9
9
|
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
|
|
11
|
+
var Input = forwardRef(function Input2(_a, ref) {
|
|
12
12
|
var _b = _a, {
|
|
13
13
|
variant = "default",
|
|
14
14
|
errorMessage,
|
|
15
15
|
labelProps,
|
|
16
16
|
label,
|
|
17
17
|
id,
|
|
18
|
-
className
|
|
18
|
+
className,
|
|
19
|
+
disabled,
|
|
20
|
+
readOnly
|
|
19
21
|
} = _b, rest = __objRest(_b, [
|
|
20
22
|
"variant",
|
|
21
23
|
"errorMessage",
|
|
22
24
|
"labelProps",
|
|
23
25
|
"label",
|
|
24
26
|
"id",
|
|
25
|
-
"className"
|
|
27
|
+
"className",
|
|
28
|
+
"disabled",
|
|
29
|
+
"readOnly"
|
|
26
30
|
]);
|
|
27
|
-
const errorMessageId =
|
|
28
|
-
const inputId =
|
|
31
|
+
const errorMessageId = useId();
|
|
32
|
+
const inputId = useId();
|
|
29
33
|
return /* @__PURE__ */ jsxs(
|
|
30
34
|
"div",
|
|
31
35
|
{
|
|
@@ -39,19 +43,30 @@ function Input(_a) {
|
|
|
39
43
|
),
|
|
40
44
|
children: [
|
|
41
45
|
/* @__PURE__ */ jsx("label", __spreadProps(__spreadValues({ className: "hds-input__label" }, labelProps), { htmlFor: id || inputId, children: label })),
|
|
42
|
-
!!errorMessage && /* @__PURE__ */ jsx("span", { className: "hds-input__error-message", id: errorMessageId, children: errorMessage }),
|
|
43
46
|
/* @__PURE__ */ jsx(
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
className: clsx("hds-input__input-wrapper"),
|
|
50
|
+
"data-disabled": disabled,
|
|
51
|
+
"data-readonly": readOnly,
|
|
52
|
+
children: /* @__PURE__ */ jsx(
|
|
53
|
+
"input",
|
|
54
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
55
|
+
"aria-describedby": errorMessage ? errorMessageId : void 0,
|
|
56
|
+
className: "hds-input__input",
|
|
57
|
+
disabled,
|
|
58
|
+
id: id || inputId,
|
|
59
|
+
readOnly,
|
|
60
|
+
ref
|
|
61
|
+
})
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
!!errorMessage && /* @__PURE__ */ jsx("span", { className: "hds-input__error-message", id: errorMessageId, children: errorMessage })
|
|
51
66
|
]
|
|
52
67
|
}
|
|
53
68
|
);
|
|
54
|
-
}
|
|
69
|
+
});
|
|
55
70
|
|
|
56
71
|
export {
|
|
57
72
|
Input
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// src/utils.ts
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useCallback, useEffect, useState } from "react";
|
|
4
|
+
function useMergeRefs(refs) {
|
|
5
|
+
return React.useMemo(() => {
|
|
6
|
+
if (refs.every((ref) => ref === null)) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return (value) => {
|
|
10
|
+
refs.forEach((ref) => {
|
|
11
|
+
if (typeof ref === "function") {
|
|
12
|
+
ref(value);
|
|
13
|
+
} else if (ref !== null) {
|
|
14
|
+
ref.current = value;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
}, refs);
|
|
19
|
+
}
|
|
20
|
+
function useResize(ref) {
|
|
21
|
+
const [width, setWidth] = useState(0);
|
|
22
|
+
const [height, setHeight] = useState(0);
|
|
23
|
+
const handleResize = useCallback(() => {
|
|
24
|
+
var _a, _b, _c, _d;
|
|
25
|
+
if ((ref == null ? void 0 : ref.current) !== null) {
|
|
26
|
+
setWidth((_b = (_a = ref == null ? void 0 : ref.current) == null ? void 0 : _a.offsetWidth) != null ? _b : 0);
|
|
27
|
+
setHeight((_d = (_c = ref == null ? void 0 : ref.current) == null ? void 0 : _c.offsetHeight) != null ? _d : 0);
|
|
28
|
+
}
|
|
29
|
+
}, [ref]);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
window.addEventListener("load", handleResize);
|
|
32
|
+
window.addEventListener("resize", handleResize);
|
|
33
|
+
return () => {
|
|
34
|
+
window.removeEventListener("load", handleResize);
|
|
35
|
+
window.removeEventListener("resize", handleResize);
|
|
36
|
+
};
|
|
37
|
+
}, [ref, handleResize]);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
handleResize();
|
|
40
|
+
}, []);
|
|
41
|
+
return { width, height };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export {
|
|
45
|
+
useMergeRefs,
|
|
46
|
+
useResize
|
|
47
|
+
};
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
// src/message/index.tsx
|
|
8
8
|
import "@postenbring/hedwig-css/dist/fonts.css";
|
|
9
9
|
import "@postenbring/hedwig-css/dist/tokens.css";
|
|
10
|
-
import "@postenbring/hedwig-css/dist/
|
|
10
|
+
import "@postenbring/hedwig-css/dist/body.css";
|
|
11
11
|
import "@postenbring/hedwig-css/dist/box.css";
|
|
12
12
|
import "@postenbring/hedwig-css/dist/message.css";
|
|
13
13
|
var MessageComponent = Message;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/badge/index.tsx
|
|
2
2
|
import "@postenbring/hedwig-css/dist/fonts.css";
|
|
3
3
|
import "@postenbring/hedwig-css/dist/tokens.css";
|
|
4
|
-
import "@postenbring/hedwig-css/dist/
|
|
4
|
+
import "@postenbring/hedwig-css/dist/body.css";
|
|
5
5
|
import "@postenbring/hedwig-css/dist/badge.css";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/accordion/index.tsx
|
|
2
2
|
import "@postenbring/hedwig-css/dist/fonts.css";
|
|
3
3
|
import "@postenbring/hedwig-css/dist/tokens.css";
|
|
4
|
-
import "@postenbring/hedwig-css/dist/
|
|
4
|
+
import "@postenbring/hedwig-css/dist/body.css";
|
|
5
5
|
import "@postenbring/hedwig-css/dist/accordion.css";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/dropdown/index.tsx
|
|
2
2
|
import "@postenbring/hedwig-css/dist/fonts.css";
|
|
3
3
|
import "@postenbring/hedwig-css/dist/tokens.css";
|
|
4
|
-
import "@postenbring/hedwig-css/dist/
|
|
4
|
+
import "@postenbring/hedwig-css/dist/body.css";
|
|
5
5
|
import "@postenbring/hedwig-css/dist/dropdown.css";
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useResize
|
|
3
|
+
} from "./chunk-FSBY3NKV.mjs";
|
|
4
|
+
import {
|
|
5
|
+
TabsContext
|
|
6
|
+
} from "./chunk-4ZM45P62.mjs";
|
|
7
|
+
import {
|
|
8
|
+
__objRest,
|
|
9
|
+
__spreadProps,
|
|
10
|
+
__spreadValues
|
|
11
|
+
} from "./chunk-FUJQIYOF.mjs";
|
|
12
|
+
|
|
13
|
+
// src/tabs/tabs-list.tsx
|
|
14
|
+
import { forwardRef, useContext, useRef } from "react";
|
|
15
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
16
|
+
import { jsx } from "react/jsx-runtime";
|
|
17
|
+
function TabList(_a) {
|
|
18
|
+
var _b = _a, { children, direction = "horizontal", className } = _b, rest = __objRest(_b, ["children", "direction", "className"]);
|
|
19
|
+
const tabsListRef = useRef(null);
|
|
20
|
+
const { width: tabsWidth } = useResize(tabsListRef);
|
|
21
|
+
const { innerWidth } = window;
|
|
22
|
+
const wideEnough = innerWidth >= tabsWidth;
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
"div",
|
|
25
|
+
__spreadProps(__spreadValues({
|
|
26
|
+
className: clsx(
|
|
27
|
+
"hds-tabs--list",
|
|
28
|
+
direction === "horizontal" ? {
|
|
29
|
+
[`hds-tabs--list-horizontal`]: wideEnough,
|
|
30
|
+
"hds-tabs--list-vertical": !wideEnough
|
|
31
|
+
} : {
|
|
32
|
+
"hds-tabs--list-vertical": true
|
|
33
|
+
},
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
ref: tabsListRef,
|
|
37
|
+
role: "tablist"
|
|
38
|
+
}, rest), {
|
|
39
|
+
children
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
TabList.displayName = "TabList";
|
|
44
|
+
var Tab = forwardRef(
|
|
45
|
+
(_a, ref) => {
|
|
46
|
+
var _b = _a, { as: Component = "button", children, tabId, className, onClick } = _b, rest = __objRest(_b, ["as", "children", "tabId", "className", "onClick"]);
|
|
47
|
+
const context = useContext(TabsContext);
|
|
48
|
+
if (!context.mounted) {
|
|
49
|
+
throw new Error("Context required. Did you use <TabContent/> outside of <Tabs/>?");
|
|
50
|
+
}
|
|
51
|
+
const toggleTab = (e) => {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
context.toggleActiveTabId(tabId);
|
|
54
|
+
onClick && onClick(e);
|
|
55
|
+
};
|
|
56
|
+
return /* @__PURE__ */ jsx(
|
|
57
|
+
Component,
|
|
58
|
+
__spreadProps(__spreadValues({
|
|
59
|
+
className: clsx(
|
|
60
|
+
"hds-tabs--tab",
|
|
61
|
+
{ "hds-tabs--tab-active": context.activeTabId === tabId },
|
|
62
|
+
className
|
|
63
|
+
),
|
|
64
|
+
"data-tabid": tabId,
|
|
65
|
+
onClick: toggleTab,
|
|
66
|
+
ref,
|
|
67
|
+
role: "tab"
|
|
68
|
+
}, rest), {
|
|
69
|
+
children
|
|
70
|
+
})
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
Tab.displayName = "Tab";
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
TabList,
|
|
78
|
+
Tab
|
|
79
|
+
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useMergeRefs
|
|
3
|
+
} from "./chunk-FSBY3NKV.mjs";
|
|
1
4
|
import {
|
|
2
5
|
Box
|
|
3
6
|
} from "./chunk-RXUPE4MM.mjs";
|
|
@@ -10,27 +13,6 @@ import {
|
|
|
10
13
|
// src/modal/modal.tsx
|
|
11
14
|
import { forwardRef, useRef } from "react";
|
|
12
15
|
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
16
|
import { jsx } from "react/jsx-runtime";
|
|
35
17
|
var Modal = forwardRef(
|
|
36
18
|
(_a, ref) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/button/index.tsx
|
|
2
2
|
import "@postenbring/hedwig-css/dist/fonts.css";
|
|
3
3
|
import "@postenbring/hedwig-css/dist/tokens.css";
|
|
4
|
-
import "@postenbring/hedwig-css/dist/
|
|
4
|
+
import "@postenbring/hedwig-css/dist/body.css";
|
|
5
5
|
import "@postenbring/hedwig-css/dist/button.css";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Modal,
|
|
3
3
|
ModalHeader
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QV33ZHNO.mjs";
|
|
5
5
|
|
|
6
6
|
// src/modal/index.tsx
|
|
7
7
|
import "@postenbring/hedwig-css/dist/fonts.css";
|
|
8
8
|
import "@postenbring/hedwig-css/dist/tokens.css";
|
|
9
|
-
import "@postenbring/hedwig-css/dist/
|
|
9
|
+
import "@postenbring/hedwig-css/dist/body.css";
|
|
10
10
|
import "@postenbring/hedwig-css/dist/box.css";
|
|
11
11
|
import "@postenbring/hedwig-css/dist/modal.css";
|
|
12
12
|
var ModalComponent = Modal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/breadcrumb/index.tsx
|
|
2
2
|
import "@postenbring/hedwig-css/dist/fonts.css";
|
|
3
3
|
import "@postenbring/hedwig-css/dist/tokens.css";
|
|
4
|
-
import "@postenbring/hedwig-css/dist/
|
|
4
|
+
import "@postenbring/hedwig-css/dist/body.css";
|
|
5
5
|
import "@postenbring/hedwig-css/dist/breadcrumb.css";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TabsContext
|
|
3
|
+
} from "./chunk-4ZM45P62.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__objRest,
|
|
6
|
+
__spreadProps,
|
|
7
|
+
__spreadValues
|
|
8
|
+
} from "./chunk-FUJQIYOF.mjs";
|
|
9
|
+
|
|
10
|
+
// src/tabs/tabs.tsx
|
|
11
|
+
import { forwardRef, useState } from "react";
|
|
12
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
var Tabs = forwardRef(
|
|
15
|
+
(_a, ref) => {
|
|
16
|
+
var _b = _a, { as: Component = "div", defaultTab, children } = _b, rest = __objRest(_b, ["as", "defaultTab", "children"]);
|
|
17
|
+
const [activeTabId, setActiveTabId] = useState(defaultTab);
|
|
18
|
+
return /* @__PURE__ */ jsx(Component, __spreadProps(__spreadValues({ className: clsx("hds-tabs"), ref }, rest), { children: /* @__PURE__ */ jsx(
|
|
19
|
+
TabsContext.Provider,
|
|
20
|
+
{
|
|
21
|
+
value: { activeTabId, toggleActiveTabId: setActiveTabId, mounted: true },
|
|
22
|
+
children
|
|
23
|
+
}
|
|
24
|
+
) }));
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
Tabs.displayName = "Tabs";
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
Tabs
|
|
31
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as
|
|
2
|
+
import * as react from 'react';
|
|
3
3
|
|
|
4
|
-
interface DropdownProps extends Omit<
|
|
4
|
+
interface DropdownProps extends Omit<react.SelectHTMLAttributes<HTMLSelectElement>, "children"> {
|
|
5
5
|
label: string;
|
|
6
6
|
variant: "default" | "white" | "lined";
|
|
7
7
|
errorMessage?: string;
|
|
8
|
-
children:
|
|
8
|
+
children: react.ReactNode;
|
|
9
9
|
}
|
|
10
10
|
declare function Dropdown({ label, variant, errorMessage, className, children, ...rest }: DropdownProps): react_jsx_runtime.JSX.Element;
|
|
11
11
|
declare namespace Dropdown {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as
|
|
2
|
+
import * as react from 'react';
|
|
3
3
|
|
|
4
|
-
interface DropdownProps extends Omit<
|
|
4
|
+
interface DropdownProps extends Omit<react.SelectHTMLAttributes<HTMLSelectElement>, "children"> {
|
|
5
5
|
label: string;
|
|
6
6
|
variant: "default" | "white" | "lined";
|
|
7
7
|
errorMessage?: string;
|
|
8
|
-
children:
|
|
8
|
+
children: react.ReactNode;
|
|
9
9
|
}
|
|
10
10
|
declare function Dropdown({ label, variant, errorMessage, className, children, ...rest }: DropdownProps): react_jsx_runtime.JSX.Element;
|
|
11
11
|
declare namespace Dropdown {
|
package/dist/dropdown/index.js
CHANGED
|
@@ -54,7 +54,7 @@ __export(dropdown_exports, {
|
|
|
54
54
|
module.exports = __toCommonJS(dropdown_exports);
|
|
55
55
|
var import_fonts = require("@postenbring/hedwig-css/dist/fonts.css");
|
|
56
56
|
var import_tokens = require("@postenbring/hedwig-css/dist/tokens.css");
|
|
57
|
-
var
|
|
57
|
+
var import_body = require("@postenbring/hedwig-css/dist/body.css");
|
|
58
58
|
var import_dropdown = require("@postenbring/hedwig-css/dist/dropdown.css");
|
|
59
59
|
|
|
60
60
|
// src/dropdown/dropdown.tsx
|
package/dist/dropdown/index.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -13,6 +13,10 @@ export { AccordionContent, AccordionContentProps } from './accordion/accordion-i
|
|
|
13
13
|
export { Dropdown, DropdownProps } from './dropdown/dropdown.mjs';
|
|
14
14
|
export { Modal } from './modal/index.mjs';
|
|
15
15
|
export { Breadcrumbs, BreadcrumbsProps } from './breadcrumb/breadcrumb.mjs';
|
|
16
|
+
export { Tabs, TabsProps } from './tabs/tabs.mjs';
|
|
17
|
+
export { Tab, TabList, TabListProps, TabProps } from './tabs/tabs-list.mjs';
|
|
18
|
+
export { TabContent, TabContentProps, TabContents, TabContentsProps } from './tabs/tabs-content.mjs';
|
|
19
|
+
export { Input, InputProps } from './input/input.mjs';
|
|
16
20
|
export { MessageDescription, MessageTitle } from './message/message.mjs';
|
|
17
21
|
export { ModalHeader } from './modal/modal.mjs';
|
|
18
22
|
import './utils-BfZsjuFH.mjs';
|