@postenbring/hedwig-react 0.0.49 → 0.0.51
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/chunk-4RD7KCEO.mjs +64 -0
- package/dist/{chunk-JOKO7Y7O.mjs → chunk-BIPWW7NV.mjs} +8 -202
- package/dist/chunk-CFMCOWLY.mjs +91 -0
- package/dist/chunk-GP3JFLYZ.mjs +204 -0
- package/dist/chunk-VIFCPFRJ.mjs +29 -0
- package/dist/form/index.mjs +8 -8
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +29236 -11
- package/dist/index.mjs +37 -12
- package/dist/navbar/index.mjs +2 -1
- package/dist/navbar/navbar-expandable-menu.mjs +2 -1
- package/dist/show-more/auto-animate-height.d.mts +30 -0
- package/dist/show-more/auto-animate-height.d.ts +30 -0
- package/dist/show-more/auto-animate-height.js +29198 -0
- package/dist/show-more/auto-animate-height.mjs +8 -0
- package/dist/show-more/show-more.d.mts +38 -0
- package/dist/show-more/show-more.d.ts +38 -0
- package/dist/show-more/show-more.js +76 -0
- package/dist/show-more/show-more.mjs +7 -0
- package/dist/step-indicator/step-indicator.d.mts +42 -0
- package/dist/step-indicator/step-indicator.d.ts +42 -0
- package/dist/step-indicator/step-indicator.js +111 -0
- package/dist/step-indicator/step-indicator.mjs +7 -0
- package/package.json +2 -2
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "./chunk-FKR5F35B.mjs";
|
|
6
|
+
|
|
7
|
+
// src/step-indicator/step-indicator.tsx
|
|
8
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
function StepIndicator(_a) {
|
|
11
|
+
var _b = _a, {
|
|
12
|
+
activeStep,
|
|
13
|
+
totalSteps,
|
|
14
|
+
className,
|
|
15
|
+
leftLabel,
|
|
16
|
+
rightLabel,
|
|
17
|
+
rightLabelLang = "en",
|
|
18
|
+
title,
|
|
19
|
+
titleAs: TitleComponent
|
|
20
|
+
} = _b, rest = __objRest(_b, [
|
|
21
|
+
"activeStep",
|
|
22
|
+
"totalSteps",
|
|
23
|
+
"className",
|
|
24
|
+
"leftLabel",
|
|
25
|
+
"rightLabel",
|
|
26
|
+
"rightLabelLang",
|
|
27
|
+
"title",
|
|
28
|
+
"titleAs"
|
|
29
|
+
]);
|
|
30
|
+
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ className: clsx("hds-step-indicator", className) }, rest), { children: [
|
|
31
|
+
/* @__PURE__ */ jsxs("div", { className: clsx("hds-step-indicator__header"), children: [
|
|
32
|
+
/* @__PURE__ */ jsx("span", { className: clsx("hds-step-indicator__left-label"), children: leftLabel }),
|
|
33
|
+
/* @__PURE__ */ jsx("span", { lang: rightLabel ? void 0 : rightLabelLang, children: rightLabel != null ? rightLabel : stepLabelTranslations[rightLabelLang](activeStep, totalSteps) })
|
|
34
|
+
] }),
|
|
35
|
+
/* @__PURE__ */ jsx("div", { className: clsx("hds-step-indicator__steps"), children: Array.from({ length: totalSteps }, (_, i) => /* @__PURE__ */ jsx(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: clsx("hds-step-indicator__step"),
|
|
39
|
+
"data-state": getStepState(i + 1, activeStep)
|
|
40
|
+
},
|
|
41
|
+
i
|
|
42
|
+
)) }),
|
|
43
|
+
title ? /* @__PURE__ */ jsx(TitleComponent, { className: clsx("hds-step-indicator__title"), children: title }) : null
|
|
44
|
+
] }));
|
|
45
|
+
}
|
|
46
|
+
var stepLabelTranslations = {
|
|
47
|
+
no: (activeStep, totalSteps) => `steg ${activeStep} av ${totalSteps}`,
|
|
48
|
+
en: (activeStep, totalSteps) => `step ${activeStep} of ${totalSteps}`,
|
|
49
|
+
da: (activeStep, totalSteps) => `trin ${activeStep} af ${totalSteps}`,
|
|
50
|
+
sv: (activeStep, totalSteps) => `steg ${activeStep} av ${totalSteps}`
|
|
51
|
+
};
|
|
52
|
+
function getStepState(renderedStep, activeStep) {
|
|
53
|
+
if (renderedStep < activeStep) {
|
|
54
|
+
return "previous";
|
|
55
|
+
}
|
|
56
|
+
if (renderedStep === activeStep) {
|
|
57
|
+
return "active";
|
|
58
|
+
}
|
|
59
|
+
return "next";
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export {
|
|
63
|
+
StepIndicator
|
|
64
|
+
};
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CloseIcon,
|
|
3
|
-
MenuIcon
|
|
4
|
-
} from "./chunk-HIRUCFWO.mjs";
|
|
5
1
|
import {
|
|
6
2
|
__commonJS,
|
|
7
|
-
|
|
8
|
-
__require,
|
|
9
|
-
__spreadProps,
|
|
10
|
-
__spreadValues,
|
|
11
|
-
__toESM
|
|
3
|
+
__require
|
|
12
4
|
} from "./chunk-FKR5F35B.mjs";
|
|
13
5
|
|
|
14
6
|
// ../../node_modules/.pnpm/scheduler@0.23.0/node_modules/scheduler/cjs/scheduler.production.min.js
|
|
@@ -7896,9 +7888,9 @@ var require_react_dom_development = __commonJS({
|
|
|
7896
7888
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
|
7897
7889
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
7898
7890
|
}
|
|
7899
|
-
var
|
|
7891
|
+
var React = __require("react");
|
|
7900
7892
|
var Scheduler = require_scheduler();
|
|
7901
|
-
var ReactSharedInternals =
|
|
7893
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
7902
7894
|
var suppressWarning = false;
|
|
7903
7895
|
function setSuppressWarning(newSuppressWarning) {
|
|
7904
7896
|
{
|
|
@@ -9503,7 +9495,7 @@ var require_react_dom_development = __commonJS({
|
|
|
9503
9495
|
{
|
|
9504
9496
|
if (props.value == null) {
|
|
9505
9497
|
if (typeof props.children === "object" && props.children !== null) {
|
|
9506
|
-
|
|
9498
|
+
React.Children.forEach(props.children, function(child) {
|
|
9507
9499
|
if (child == null) {
|
|
9508
9500
|
return;
|
|
9509
9501
|
}
|
|
@@ -17950,7 +17942,7 @@ var require_react_dom_development = __commonJS({
|
|
|
17950
17942
|
}
|
|
17951
17943
|
}
|
|
17952
17944
|
var fakeInternalInstance = {};
|
|
17953
|
-
var emptyRefsObject = new
|
|
17945
|
+
var emptyRefsObject = new React.Component().refs;
|
|
17954
17946
|
var didWarnAboutStateAssignmentForComponent;
|
|
17955
17947
|
var didWarnAboutUninitializedState;
|
|
17956
17948
|
var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
|
|
@@ -28552,7 +28544,7 @@ var require_react_dom_development = __commonJS({
|
|
|
28552
28544
|
unmarkContainerAsRoot(container);
|
|
28553
28545
|
}
|
|
28554
28546
|
};
|
|
28555
|
-
function
|
|
28547
|
+
function createRoot(container, options2) {
|
|
28556
28548
|
if (!isValidContainer(container)) {
|
|
28557
28549
|
throw new Error("createRoot(...): Target container is not a DOM element.");
|
|
28558
28550
|
}
|
|
@@ -28923,7 +28915,7 @@ var require_react_dom_development = __commonJS({
|
|
|
28923
28915
|
error('You are importing createRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".');
|
|
28924
28916
|
}
|
|
28925
28917
|
}
|
|
28926
|
-
return
|
|
28918
|
+
return createRoot(container, options2);
|
|
28927
28919
|
}
|
|
28928
28920
|
function hydrateRoot$1(container, initialChildren, options2) {
|
|
28929
28921
|
{
|
|
@@ -29003,194 +28995,8 @@ var require_react_dom = __commonJS({
|
|
|
29003
28995
|
}
|
|
29004
28996
|
});
|
|
29005
28997
|
|
|
29006
|
-
// ../../node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/client.js
|
|
29007
|
-
var require_client = __commonJS({
|
|
29008
|
-
"../../node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/client.js"(exports) {
|
|
29009
|
-
"use strict";
|
|
29010
|
-
var m = require_react_dom();
|
|
29011
|
-
if (process.env.NODE_ENV === "production") {
|
|
29012
|
-
exports.createRoot = m.createRoot;
|
|
29013
|
-
exports.hydrateRoot = m.hydrateRoot;
|
|
29014
|
-
} else {
|
|
29015
|
-
i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
29016
|
-
exports.createRoot = function(c, o) {
|
|
29017
|
-
i.usingClientEntryPoint = true;
|
|
29018
|
-
try {
|
|
29019
|
-
return m.createRoot(c, o);
|
|
29020
|
-
} finally {
|
|
29021
|
-
i.usingClientEntryPoint = false;
|
|
29022
|
-
}
|
|
29023
|
-
};
|
|
29024
|
-
exports.hydrateRoot = function(c, h, o) {
|
|
29025
|
-
i.usingClientEntryPoint = true;
|
|
29026
|
-
try {
|
|
29027
|
-
return m.hydrateRoot(c, h, o);
|
|
29028
|
-
} finally {
|
|
29029
|
-
i.usingClientEntryPoint = false;
|
|
29030
|
-
}
|
|
29031
|
-
};
|
|
29032
|
-
}
|
|
29033
|
-
var i;
|
|
29034
|
-
}
|
|
29035
|
-
});
|
|
29036
|
-
|
|
29037
|
-
// src/navbar/navbar-expandable-menu.tsx
|
|
29038
|
-
var import_client = __toESM(require_client());
|
|
29039
|
-
import { createContext, useContext, forwardRef, useState, useRef, useEffect } from "react";
|
|
29040
|
-
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
29041
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
29042
|
-
var navbarContext = createContext([
|
|
29043
|
-
false,
|
|
29044
|
-
() => {
|
|
29045
|
-
}
|
|
29046
|
-
]);
|
|
29047
|
-
function NavbarExpandableMenu({ children }) {
|
|
29048
|
-
const [open, setOpen] = useState(false);
|
|
29049
|
-
const toggleOpen = () => {
|
|
29050
|
-
setOpen((currentOpen) => !currentOpen);
|
|
29051
|
-
};
|
|
29052
|
-
return /* @__PURE__ */ jsx(navbarContext.Provider, { value: [open, toggleOpen], children });
|
|
29053
|
-
}
|
|
29054
|
-
NavbarExpandableMenu.displayName = "NavbarExpandableMenu";
|
|
29055
|
-
function RenderButton(_a) {
|
|
29056
|
-
var _b = _a, {
|
|
29057
|
-
className,
|
|
29058
|
-
innerRef,
|
|
29059
|
-
open = false,
|
|
29060
|
-
ref,
|
|
29061
|
-
text,
|
|
29062
|
-
title,
|
|
29063
|
-
toggleOpen,
|
|
29064
|
-
width
|
|
29065
|
-
} = _b, rest = __objRest(_b, [
|
|
29066
|
-
"className",
|
|
29067
|
-
"innerRef",
|
|
29068
|
-
"open",
|
|
29069
|
-
"ref",
|
|
29070
|
-
"text",
|
|
29071
|
-
"title",
|
|
29072
|
-
"toggleOpen",
|
|
29073
|
-
"width"
|
|
29074
|
-
]);
|
|
29075
|
-
const icon = open ? /* @__PURE__ */ jsx(CloseIcon, {}) : /* @__PURE__ */ jsx(MenuIcon, {});
|
|
29076
|
-
const style = width ? { width } : {};
|
|
29077
|
-
return /* @__PURE__ */ jsxs(
|
|
29078
|
-
"button",
|
|
29079
|
-
__spreadProps(__spreadValues({
|
|
29080
|
-
className: clsx("hds-navbar__button", className),
|
|
29081
|
-
onClick: toggleOpen,
|
|
29082
|
-
ref: ref != null ? ref : innerRef,
|
|
29083
|
-
style,
|
|
29084
|
-
title,
|
|
29085
|
-
type: "button"
|
|
29086
|
-
}, rest), {
|
|
29087
|
-
children: [
|
|
29088
|
-
text,
|
|
29089
|
-
" ",
|
|
29090
|
-
icon
|
|
29091
|
-
]
|
|
29092
|
-
})
|
|
29093
|
-
);
|
|
29094
|
-
}
|
|
29095
|
-
var NavbarExpandableMenuTrigger = forwardRef(
|
|
29096
|
-
(_a, ref) => {
|
|
29097
|
-
var _b = _a, {
|
|
29098
|
-
whenClosedText,
|
|
29099
|
-
whenClosedHelperTitle,
|
|
29100
|
-
whenOpenText,
|
|
29101
|
-
whenOpenHelperTitle,
|
|
29102
|
-
className
|
|
29103
|
-
} = _b, rest = __objRest(_b, [
|
|
29104
|
-
"whenClosedText",
|
|
29105
|
-
"whenClosedHelperTitle",
|
|
29106
|
-
"whenOpenText",
|
|
29107
|
-
"whenOpenHelperTitle",
|
|
29108
|
-
"className"
|
|
29109
|
-
]);
|
|
29110
|
-
const [open, toggleOpen] = useContext(navbarContext);
|
|
29111
|
-
const [width, setWidth] = useState(0);
|
|
29112
|
-
const measureButtonRef = useRef(null);
|
|
29113
|
-
const text = open ? whenOpenText : whenClosedText;
|
|
29114
|
-
const title = open ? whenOpenHelperTitle : whenClosedHelperTitle;
|
|
29115
|
-
const measureButton = (element, callback) => {
|
|
29116
|
-
const container = document.createElement("div");
|
|
29117
|
-
container.style.cssText = "display: inline-block; position: absolute; visibility: hidden";
|
|
29118
|
-
const c = document.getElementsByClassName("hds-navbar__navigation")[0];
|
|
29119
|
-
c.appendChild(container);
|
|
29120
|
-
const root = (0, import_client.createRoot)(container);
|
|
29121
|
-
root.render(element);
|
|
29122
|
-
const getWidth = () => {
|
|
29123
|
-
var _a2, _b2;
|
|
29124
|
-
callback((_b2 = (_a2 = measureButtonRef.current) == null ? void 0 : _a2.offsetWidth) != null ? _b2 : 0);
|
|
29125
|
-
root.unmount();
|
|
29126
|
-
c.removeChild(container);
|
|
29127
|
-
};
|
|
29128
|
-
setTimeout(getWidth, 0);
|
|
29129
|
-
};
|
|
29130
|
-
useEffect(() => {
|
|
29131
|
-
measureButton(
|
|
29132
|
-
/* @__PURE__ */ jsx(
|
|
29133
|
-
RenderButton,
|
|
29134
|
-
__spreadValues({
|
|
29135
|
-
className: className ? className : "",
|
|
29136
|
-
innerRef: measureButtonRef,
|
|
29137
|
-
text: whenClosedText,
|
|
29138
|
-
title
|
|
29139
|
-
}, rest)
|
|
29140
|
-
),
|
|
29141
|
-
(closedWidth) => {
|
|
29142
|
-
measureButton(
|
|
29143
|
-
/* @__PURE__ */ jsx(
|
|
29144
|
-
RenderButton,
|
|
29145
|
-
__spreadValues({
|
|
29146
|
-
className: className ? className : "",
|
|
29147
|
-
innerRef: measureButtonRef,
|
|
29148
|
-
open: true,
|
|
29149
|
-
text: whenOpenText,
|
|
29150
|
-
title
|
|
29151
|
-
}, rest)
|
|
29152
|
-
),
|
|
29153
|
-
(openWidth) => {
|
|
29154
|
-
setWidth(Math.max(openWidth, closedWidth));
|
|
29155
|
-
}
|
|
29156
|
-
);
|
|
29157
|
-
}
|
|
29158
|
-
);
|
|
29159
|
-
}, [className, rest, title, whenClosedText, whenOpenText]);
|
|
29160
|
-
return /* @__PURE__ */ jsx(
|
|
29161
|
-
RenderButton,
|
|
29162
|
-
__spreadValues({
|
|
29163
|
-
className: className ? className : "",
|
|
29164
|
-
open,
|
|
29165
|
-
ref,
|
|
29166
|
-
text,
|
|
29167
|
-
title,
|
|
29168
|
-
toggleOpen,
|
|
29169
|
-
width
|
|
29170
|
-
}, rest)
|
|
29171
|
-
);
|
|
29172
|
-
}
|
|
29173
|
-
);
|
|
29174
|
-
NavbarExpandableMenuTrigger.displayName = "Navbar.ExpandableMenu.Trigger";
|
|
29175
|
-
var NavbarExpandableMenuContent = forwardRef((_a, ref) => {
|
|
29176
|
-
var _b = _a, { as: Component = "section", children, className } = _b, rest = __objRest(_b, ["as", "children", "className"]);
|
|
29177
|
-
const [open] = useContext(navbarContext);
|
|
29178
|
-
return /* @__PURE__ */ jsx(
|
|
29179
|
-
Component,
|
|
29180
|
-
__spreadProps(__spreadValues({}, rest), {
|
|
29181
|
-
className: clsx("hds-navbar__expandable-menu-content", className),
|
|
29182
|
-
"data-state": open ? "open" : "closed",
|
|
29183
|
-
ref,
|
|
29184
|
-
children
|
|
29185
|
-
})
|
|
29186
|
-
);
|
|
29187
|
-
});
|
|
29188
|
-
NavbarExpandableMenuContent.displayName = "Navbar.ExpandableMenu.Content";
|
|
29189
|
-
|
|
29190
28998
|
export {
|
|
29191
|
-
|
|
29192
|
-
NavbarExpandableMenuTrigger,
|
|
29193
|
-
NavbarExpandableMenuContent
|
|
28999
|
+
require_react_dom
|
|
29194
29000
|
};
|
|
29195
29001
|
/*! Bundled license information:
|
|
29196
29002
|
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_react_dom
|
|
3
|
+
} from "./chunk-BIPWW7NV.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__objRest,
|
|
6
|
+
__spreadProps,
|
|
7
|
+
__spreadValues,
|
|
8
|
+
__toESM
|
|
9
|
+
} from "./chunk-FKR5F35B.mjs";
|
|
10
|
+
|
|
11
|
+
// src/show-more/auto-animate-height.tsx
|
|
12
|
+
var import_react_dom = __toESM(require_react_dom());
|
|
13
|
+
import { cloneElement, forwardRef, useEffect, useRef, useState } from "react";
|
|
14
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var animationDurationToValue = {
|
|
16
|
+
quick: 100,
|
|
17
|
+
normal: 300,
|
|
18
|
+
slow: 700
|
|
19
|
+
};
|
|
20
|
+
var AutoAnimateHeight = forwardRef(
|
|
21
|
+
(_a, ref) => {
|
|
22
|
+
var _b = _a, {
|
|
23
|
+
as: Component = "div",
|
|
24
|
+
children,
|
|
25
|
+
style,
|
|
26
|
+
animationDuration = "normal",
|
|
27
|
+
animationEasing = "normal"
|
|
28
|
+
} = _b, rest = __objRest(_b, [
|
|
29
|
+
"as",
|
|
30
|
+
"children",
|
|
31
|
+
"style",
|
|
32
|
+
"animationDuration",
|
|
33
|
+
"animationEasing"
|
|
34
|
+
]);
|
|
35
|
+
const measurementRef = useRef(null);
|
|
36
|
+
const [height, setHeight] = useState(void 0);
|
|
37
|
+
const [clonedChildren, setClonedChildren] = useState(
|
|
38
|
+
() => cloneElement(/* @__PURE__ */ jsx(Fragment, { children }), {})
|
|
39
|
+
);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (measurementRef.current) {
|
|
42
|
+
const { height: newHeight } = measurementRef.current.getBoundingClientRect();
|
|
43
|
+
if (newHeight < (height != null ? height : 0)) {
|
|
44
|
+
(0, import_react_dom.flushSync)(() => {
|
|
45
|
+
setHeight(newHeight);
|
|
46
|
+
});
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
setClonedChildren(cloneElement(/* @__PURE__ */ jsx(Fragment, { children }), {}));
|
|
49
|
+
}, animationDurationToValue[animationDuration]);
|
|
50
|
+
} else {
|
|
51
|
+
setHeight(newHeight);
|
|
52
|
+
setClonedChildren(cloneElement(/* @__PURE__ */ jsx(Fragment, { children }), {}));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}, [children]);
|
|
56
|
+
return /* @__PURE__ */ jsxs(
|
|
57
|
+
Component,
|
|
58
|
+
__spreadProps(__spreadValues({
|
|
59
|
+
ref,
|
|
60
|
+
style: __spreadValues({
|
|
61
|
+
overflow: "hidden",
|
|
62
|
+
height,
|
|
63
|
+
transitionProperty: "height",
|
|
64
|
+
transitionDuration: `var(--hds-micro-animation-duration-${animationDuration})`,
|
|
65
|
+
transitionTimingFunction: `var(--hds-micro-animation-easing-${animationEasing})`
|
|
66
|
+
}, style)
|
|
67
|
+
}, rest), {
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ jsx(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
"aria-hidden": true,
|
|
73
|
+
ref: measurementRef,
|
|
74
|
+
style: {
|
|
75
|
+
position: "absolute",
|
|
76
|
+
visibility: "hidden"
|
|
77
|
+
},
|
|
78
|
+
children
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
clonedChildren
|
|
82
|
+
]
|
|
83
|
+
})
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
AutoAnimateHeight.displayName = "AutoAnimateHeight";
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
AutoAnimateHeight
|
|
91
|
+
};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CloseIcon,
|
|
3
|
+
MenuIcon
|
|
4
|
+
} from "./chunk-HIRUCFWO.mjs";
|
|
5
|
+
import {
|
|
6
|
+
require_react_dom
|
|
7
|
+
} from "./chunk-BIPWW7NV.mjs";
|
|
8
|
+
import {
|
|
9
|
+
__commonJS,
|
|
10
|
+
__objRest,
|
|
11
|
+
__spreadProps,
|
|
12
|
+
__spreadValues,
|
|
13
|
+
__toESM
|
|
14
|
+
} from "./chunk-FKR5F35B.mjs";
|
|
15
|
+
|
|
16
|
+
// ../../node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/client.js
|
|
17
|
+
var require_client = __commonJS({
|
|
18
|
+
"../../node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/client.js"(exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
var m = require_react_dom();
|
|
21
|
+
if (process.env.NODE_ENV === "production") {
|
|
22
|
+
exports.createRoot = m.createRoot;
|
|
23
|
+
exports.hydrateRoot = m.hydrateRoot;
|
|
24
|
+
} else {
|
|
25
|
+
i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
26
|
+
exports.createRoot = function(c, o) {
|
|
27
|
+
i.usingClientEntryPoint = true;
|
|
28
|
+
try {
|
|
29
|
+
return m.createRoot(c, o);
|
|
30
|
+
} finally {
|
|
31
|
+
i.usingClientEntryPoint = false;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
exports.hydrateRoot = function(c, h, o) {
|
|
35
|
+
i.usingClientEntryPoint = true;
|
|
36
|
+
try {
|
|
37
|
+
return m.hydrateRoot(c, h, o);
|
|
38
|
+
} finally {
|
|
39
|
+
i.usingClientEntryPoint = false;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
var i;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// src/navbar/navbar-expandable-menu.tsx
|
|
48
|
+
var import_client = __toESM(require_client());
|
|
49
|
+
import { createContext, useContext, forwardRef, useState, useRef, useEffect } from "react";
|
|
50
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
51
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
52
|
+
var navbarContext = createContext([
|
|
53
|
+
false,
|
|
54
|
+
() => {
|
|
55
|
+
}
|
|
56
|
+
]);
|
|
57
|
+
function NavbarExpandableMenu({ children }) {
|
|
58
|
+
const [open, setOpen] = useState(false);
|
|
59
|
+
const toggleOpen = () => {
|
|
60
|
+
setOpen((currentOpen) => !currentOpen);
|
|
61
|
+
};
|
|
62
|
+
return /* @__PURE__ */ jsx(navbarContext.Provider, { value: [open, toggleOpen], children });
|
|
63
|
+
}
|
|
64
|
+
NavbarExpandableMenu.displayName = "NavbarExpandableMenu";
|
|
65
|
+
function RenderButton(_a) {
|
|
66
|
+
var _b = _a, {
|
|
67
|
+
className,
|
|
68
|
+
innerRef,
|
|
69
|
+
open = false,
|
|
70
|
+
ref,
|
|
71
|
+
text,
|
|
72
|
+
title,
|
|
73
|
+
toggleOpen,
|
|
74
|
+
width
|
|
75
|
+
} = _b, rest = __objRest(_b, [
|
|
76
|
+
"className",
|
|
77
|
+
"innerRef",
|
|
78
|
+
"open",
|
|
79
|
+
"ref",
|
|
80
|
+
"text",
|
|
81
|
+
"title",
|
|
82
|
+
"toggleOpen",
|
|
83
|
+
"width"
|
|
84
|
+
]);
|
|
85
|
+
const icon = open ? /* @__PURE__ */ jsx(CloseIcon, {}) : /* @__PURE__ */ jsx(MenuIcon, {});
|
|
86
|
+
const style = width ? { width } : {};
|
|
87
|
+
return /* @__PURE__ */ jsxs(
|
|
88
|
+
"button",
|
|
89
|
+
__spreadProps(__spreadValues({
|
|
90
|
+
className: clsx("hds-navbar__button", className),
|
|
91
|
+
onClick: toggleOpen,
|
|
92
|
+
ref: ref != null ? ref : innerRef,
|
|
93
|
+
style,
|
|
94
|
+
title,
|
|
95
|
+
type: "button"
|
|
96
|
+
}, rest), {
|
|
97
|
+
children: [
|
|
98
|
+
text,
|
|
99
|
+
" ",
|
|
100
|
+
icon
|
|
101
|
+
]
|
|
102
|
+
})
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
var NavbarExpandableMenuTrigger = forwardRef(
|
|
106
|
+
(_a, ref) => {
|
|
107
|
+
var _b = _a, {
|
|
108
|
+
whenClosedText,
|
|
109
|
+
whenClosedHelperTitle,
|
|
110
|
+
whenOpenText,
|
|
111
|
+
whenOpenHelperTitle,
|
|
112
|
+
className
|
|
113
|
+
} = _b, rest = __objRest(_b, [
|
|
114
|
+
"whenClosedText",
|
|
115
|
+
"whenClosedHelperTitle",
|
|
116
|
+
"whenOpenText",
|
|
117
|
+
"whenOpenHelperTitle",
|
|
118
|
+
"className"
|
|
119
|
+
]);
|
|
120
|
+
const [open, toggleOpen] = useContext(navbarContext);
|
|
121
|
+
const [width, setWidth] = useState(0);
|
|
122
|
+
const measureButtonRef = useRef(null);
|
|
123
|
+
const text = open ? whenOpenText : whenClosedText;
|
|
124
|
+
const title = open ? whenOpenHelperTitle : whenClosedHelperTitle;
|
|
125
|
+
const measureButton = (element, callback) => {
|
|
126
|
+
const container = document.createElement("div");
|
|
127
|
+
container.style.cssText = "display: inline-block; position: absolute; visibility: hidden";
|
|
128
|
+
const c = document.getElementsByClassName("hds-navbar__navigation")[0];
|
|
129
|
+
c.appendChild(container);
|
|
130
|
+
const root = (0, import_client.createRoot)(container);
|
|
131
|
+
root.render(element);
|
|
132
|
+
const getWidth = () => {
|
|
133
|
+
var _a2, _b2;
|
|
134
|
+
callback((_b2 = (_a2 = measureButtonRef.current) == null ? void 0 : _a2.offsetWidth) != null ? _b2 : 0);
|
|
135
|
+
root.unmount();
|
|
136
|
+
c.removeChild(container);
|
|
137
|
+
};
|
|
138
|
+
setTimeout(getWidth, 0);
|
|
139
|
+
};
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
measureButton(
|
|
142
|
+
/* @__PURE__ */ jsx(
|
|
143
|
+
RenderButton,
|
|
144
|
+
__spreadValues({
|
|
145
|
+
className: className ? className : "",
|
|
146
|
+
innerRef: measureButtonRef,
|
|
147
|
+
text: whenClosedText,
|
|
148
|
+
title
|
|
149
|
+
}, rest)
|
|
150
|
+
),
|
|
151
|
+
(closedWidth) => {
|
|
152
|
+
measureButton(
|
|
153
|
+
/* @__PURE__ */ jsx(
|
|
154
|
+
RenderButton,
|
|
155
|
+
__spreadValues({
|
|
156
|
+
className: className ? className : "",
|
|
157
|
+
innerRef: measureButtonRef,
|
|
158
|
+
open: true,
|
|
159
|
+
text: whenOpenText,
|
|
160
|
+
title
|
|
161
|
+
}, rest)
|
|
162
|
+
),
|
|
163
|
+
(openWidth) => {
|
|
164
|
+
setWidth(Math.max(openWidth, closedWidth));
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
}, [className, rest, title, whenClosedText, whenOpenText]);
|
|
170
|
+
return /* @__PURE__ */ jsx(
|
|
171
|
+
RenderButton,
|
|
172
|
+
__spreadValues({
|
|
173
|
+
className: className ? className : "",
|
|
174
|
+
open,
|
|
175
|
+
ref,
|
|
176
|
+
text,
|
|
177
|
+
title,
|
|
178
|
+
toggleOpen,
|
|
179
|
+
width
|
|
180
|
+
}, rest)
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
NavbarExpandableMenuTrigger.displayName = "Navbar.ExpandableMenu.Trigger";
|
|
185
|
+
var NavbarExpandableMenuContent = forwardRef((_a, ref) => {
|
|
186
|
+
var _b = _a, { as: Component = "section", children, className } = _b, rest = __objRest(_b, ["as", "children", "className"]);
|
|
187
|
+
const [open] = useContext(navbarContext);
|
|
188
|
+
return /* @__PURE__ */ jsx(
|
|
189
|
+
Component,
|
|
190
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
191
|
+
className: clsx("hds-navbar__expandable-menu-content", className),
|
|
192
|
+
"data-state": open ? "open" : "closed",
|
|
193
|
+
ref,
|
|
194
|
+
children
|
|
195
|
+
})
|
|
196
|
+
);
|
|
197
|
+
});
|
|
198
|
+
NavbarExpandableMenuContent.displayName = "Navbar.ExpandableMenu.Content";
|
|
199
|
+
|
|
200
|
+
export {
|
|
201
|
+
NavbarExpandableMenu,
|
|
202
|
+
NavbarExpandableMenuTrigger,
|
|
203
|
+
NavbarExpandableMenuContent
|
|
204
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "./chunk-FKR5F35B.mjs";
|
|
6
|
+
|
|
7
|
+
// src/show-more/show-more.tsx
|
|
8
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
function ShowMoreButton(_a) {
|
|
11
|
+
var _b = _a, { text, expanded = false, className } = _b, rest = __objRest(_b, ["text", "expanded", "className"]);
|
|
12
|
+
return /* @__PURE__ */ jsxs(
|
|
13
|
+
"button",
|
|
14
|
+
__spreadProps(__spreadValues({
|
|
15
|
+
className: clsx("hds-show-more", className),
|
|
16
|
+
"data-state": expanded ? "expanded" : void 0,
|
|
17
|
+
type: "button"
|
|
18
|
+
}, rest), {
|
|
19
|
+
children: [
|
|
20
|
+
text,
|
|
21
|
+
/* @__PURE__ */ jsx("span", { className: clsx("hds-show-more__icon") })
|
|
22
|
+
]
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
ShowMoreButton
|
|
29
|
+
};
|
package/dist/form/index.mjs
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import "../chunk-5OGUAHLN.mjs";
|
|
2
|
-
import "../chunk-ERFGFY3Q.mjs";
|
|
3
|
-
import {
|
|
4
|
-
Radiobutton
|
|
5
|
-
} from "../chunk-ZDZR5FVC.mjs";
|
|
6
2
|
import "../chunk-OPW2JS5I.mjs";
|
|
7
3
|
import {
|
|
8
4
|
Select
|
|
@@ -11,10 +7,6 @@ import "../chunk-5NWYVPBZ.mjs";
|
|
|
11
7
|
import {
|
|
12
8
|
Textarea
|
|
13
9
|
} from "../chunk-OSCKYUZ3.mjs";
|
|
14
|
-
import "../chunk-JTHBBJZW.mjs";
|
|
15
|
-
import {
|
|
16
|
-
Checkbox
|
|
17
|
-
} from "../chunk-SDR3TESK.mjs";
|
|
18
10
|
import "../chunk-OKWNTFU5.mjs";
|
|
19
11
|
import {
|
|
20
12
|
Fieldset
|
|
@@ -25,6 +17,14 @@ import {
|
|
|
25
17
|
} from "../chunk-OX5NTX6M.mjs";
|
|
26
18
|
import "../chunk-S4F2KVFJ.mjs";
|
|
27
19
|
import "../chunk-CCNB2ABL.mjs";
|
|
20
|
+
import "../chunk-ERFGFY3Q.mjs";
|
|
21
|
+
import {
|
|
22
|
+
Radiobutton
|
|
23
|
+
} from "../chunk-ZDZR5FVC.mjs";
|
|
24
|
+
import "../chunk-JTHBBJZW.mjs";
|
|
25
|
+
import {
|
|
26
|
+
Checkbox
|
|
27
|
+
} from "../chunk-SDR3TESK.mjs";
|
|
28
28
|
import "../chunk-67OMX7FP.mjs";
|
|
29
29
|
import "../chunk-RBOWRO3L.mjs";
|
|
30
30
|
import "../chunk-FKR5F35B.mjs";
|
package/dist/index.d.mts
CHANGED
|
@@ -20,6 +20,9 @@ export { Modal } from './modal/index.mjs';
|
|
|
20
20
|
export { Tabs } from './tabs/index.mjs';
|
|
21
21
|
export { WarningBanner, WarningBannerProps } from './warning-banner/warning-banner.mjs';
|
|
22
22
|
export { StyledHtml, StyledHtmlProps } from './styled-html/styled-html.mjs';
|
|
23
|
+
export { AutoAnimateHeight } from './show-more/auto-animate-height.mjs';
|
|
24
|
+
export { ShowMoreButton } from './show-more/show-more.mjs';
|
|
25
|
+
export { StepIndicator } from './step-indicator/step-indicator.mjs';
|
|
23
26
|
export { AccordionProps } from './accordion/accordion.mjs';
|
|
24
27
|
export { AccordionItem, AccordionItemChildrenType, AccordionItemProps } from './accordion/accordion-item.mjs';
|
|
25
28
|
export { AccordionHeader, AccordionHeaderProps } from './accordion/accordion-header.mjs';
|