@postenbring/hedwig-react 0.0.77 → 0.0.79
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/_tsup-dts-rollup.d.mts +7 -7
- package/dist/_tsup-dts-rollup.d.ts +7 -7
- package/dist/{chunk-7JDEN3T6.mjs → chunk-4WQWU5TL.mjs} +5 -3
- package/dist/chunk-4WQWU5TL.mjs.map +1 -0
- package/dist/{chunk-QY2K3GWU.mjs → chunk-F2C3KZFX.mjs} +2 -2
- package/dist/{chunk-P6WIBHQH.mjs → chunk-FB5GEZNH.mjs} +2 -2
- package/dist/{chunk-A4ME3VXV.mjs → chunk-GGNMBB3K.mjs} +2 -2
- package/dist/{chunk-RYM3LM7K.mjs → chunk-GJO7Z2YL.mjs} +2 -2
- package/dist/{chunk-DCCQXWD6.mjs → chunk-IJAX6APL.mjs} +2 -2
- package/dist/{chunk-UMYOYHUI.mjs → chunk-KI6WRKZY.mjs} +3 -3
- package/dist/{chunk-6N4TGRZB.mjs → chunk-LG7QWKFP.mjs} +2 -2
- package/dist/{chunk-FCPQXZQV.mjs → chunk-MPHMD4LO.mjs} +29 -44
- package/dist/chunk-MPHMD4LO.mjs.map +1 -0
- package/dist/{chunk-7W4HONVO.mjs → chunk-O4HIHUMD.mjs} +3 -3
- package/dist/{chunk-DFU2THGC.mjs → chunk-RZZDMBB7.mjs} +4 -3
- package/dist/chunk-RZZDMBB7.mjs.map +1 -0
- package/dist/{chunk-JL4PLDXN.mjs → chunk-WPCWXROV.mjs} +2 -2
- package/dist/{chunk-ACEYO4LN.mjs → chunk-XDYXNQDV.mjs} +2 -2
- package/dist/{chunk-NAIBK23T.mjs → chunk-XFODQH3I.mjs} +2 -2
- package/dist/form/checkbox/checkbox.js +3 -2
- package/dist/form/checkbox/checkbox.js.map +1 -1
- package/dist/form/checkbox/checkbox.mjs +3 -3
- package/dist/form/checkbox/index.js +3 -2
- package/dist/form/checkbox/index.js.map +1 -1
- package/dist/form/checkbox/index.mjs +3 -3
- package/dist/form/date-picker/date-picker.js +3 -2
- package/dist/form/date-picker/date-picker.js.map +1 -1
- package/dist/form/date-picker/date-picker.mjs +3 -3
- package/dist/form/date-picker/index.js +3 -2
- package/dist/form/date-picker/index.js.map +1 -1
- package/dist/form/date-picker/index.mjs +3 -3
- package/dist/form/error-message/error-message.js +3 -2
- package/dist/form/error-message/error-message.js.map +1 -1
- package/dist/form/error-message/error-message.mjs +1 -1
- package/dist/form/error-message/index.js +3 -2
- package/dist/form/error-message/index.js.map +1 -1
- package/dist/form/error-message/index.mjs +1 -1
- package/dist/form/fieldset/fieldset.js +3 -2
- package/dist/form/fieldset/fieldset.js.map +1 -1
- package/dist/form/fieldset/fieldset.mjs +2 -2
- package/dist/form/fieldset/index.js +3 -2
- package/dist/form/fieldset/index.js.map +1 -1
- package/dist/form/fieldset/index.mjs +2 -2
- package/dist/form/index.js +3 -2
- package/dist/form/index.js.map +1 -1
- package/dist/form/index.mjs +10 -10
- package/dist/form/input/index.js +3 -2
- package/dist/form/input/index.js.map +1 -1
- package/dist/form/input/index.mjs +3 -3
- package/dist/form/input/input.js +3 -2
- package/dist/form/input/input.js.map +1 -1
- package/dist/form/input/input.mjs +3 -3
- package/dist/form/input-group/index.js +3 -2
- package/dist/form/input-group/index.js.map +1 -1
- package/dist/form/input-group/index.mjs +2 -2
- package/dist/form/input-group/input-group.js +3 -2
- package/dist/form/input-group/input-group.js.map +1 -1
- package/dist/form/input-group/input-group.mjs +2 -2
- package/dist/form/radiobutton/index.js +3 -2
- package/dist/form/radiobutton/index.js.map +1 -1
- package/dist/form/radiobutton/index.mjs +4 -4
- package/dist/form/radiobutton/radiobutton.js +3 -2
- package/dist/form/radiobutton/radiobutton.js.map +1 -1
- package/dist/form/radiobutton/radiobutton.mjs +4 -4
- package/dist/form/radiobutton/radiogroup.js +3 -2
- package/dist/form/radiobutton/radiogroup.js.map +1 -1
- package/dist/form/radiobutton/radiogroup.mjs +3 -3
- package/dist/form/select/index.js +3 -2
- package/dist/form/select/index.js.map +1 -1
- package/dist/form/select/index.mjs +3 -3
- package/dist/form/select/select.js +3 -2
- package/dist/form/select/select.js.map +1 -1
- package/dist/form/select/select.mjs +3 -3
- package/dist/form/textarea/index.js +3 -2
- package/dist/form/textarea/index.js.map +1 -1
- package/dist/form/textarea/index.mjs +3 -3
- package/dist/form/textarea/textarea.js +3 -2
- package/dist/form/textarea/textarea.js.map +1 -1
- package/dist/form/textarea/textarea.mjs +3 -3
- package/dist/index-no-css.js +34 -47
- package/dist/index-no-css.js.map +1 -1
- package/dist/index-no-css.mjs +14 -14
- package/dist/index.js +34 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -14
- package/dist/navbar/index.js +28 -43
- package/dist/navbar/index.js.map +1 -1
- package/dist/navbar/index.mjs +2 -2
- package/dist/navbar/navbar-expandable-menu.js +28 -43
- package/dist/navbar/navbar-expandable-menu.js.map +1 -1
- package/dist/navbar/navbar-expandable-menu.mjs +1 -1
- package/dist/tabs/index.js +19 -2
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/index.mjs +2 -2
- package/dist/tabs/tabs-list.js +19 -2
- package/dist/tabs/tabs-list.js.map +1 -1
- package/dist/tabs/tabs-list.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-7JDEN3T6.mjs.map +0 -1
- package/dist/chunk-DFU2THGC.mjs.map +0 -1
- package/dist/chunk-FCPQXZQV.mjs.map +0 -1
- /package/dist/{chunk-QY2K3GWU.mjs.map → chunk-F2C3KZFX.mjs.map} +0 -0
- /package/dist/{chunk-P6WIBHQH.mjs.map → chunk-FB5GEZNH.mjs.map} +0 -0
- /package/dist/{chunk-A4ME3VXV.mjs.map → chunk-GGNMBB3K.mjs.map} +0 -0
- /package/dist/{chunk-RYM3LM7K.mjs.map → chunk-GJO7Z2YL.mjs.map} +0 -0
- /package/dist/{chunk-DCCQXWD6.mjs.map → chunk-IJAX6APL.mjs.map} +0 -0
- /package/dist/{chunk-UMYOYHUI.mjs.map → chunk-KI6WRKZY.mjs.map} +0 -0
- /package/dist/{chunk-6N4TGRZB.mjs.map → chunk-LG7QWKFP.mjs.map} +0 -0
- /package/dist/{chunk-7W4HONVO.mjs.map → chunk-O4HIHUMD.mjs.map} +0 -0
- /package/dist/{chunk-JL4PLDXN.mjs.map → chunk-WPCWXROV.mjs.map} +0 -0
- /package/dist/{chunk-ACEYO4LN.mjs.map → chunk-XDYXNQDV.mjs.map} +0 -0
- /package/dist/{chunk-NAIBK23T.mjs.map → chunk-XFODQH3I.mjs.map} +0 -0
|
@@ -1498,7 +1498,7 @@ export { NavbarExpandableMenu as NavbarExpandableMenu_alias_1 }
|
|
|
1498
1498
|
export { NavbarExpandableMenu as NavbarExpandableMenu_alias_2 }
|
|
1499
1499
|
export { NavbarExpandableMenu as NavbarExpandableMenu_alias_3 }
|
|
1500
1500
|
|
|
1501
|
-
declare const NavbarExpandableMenuContent:
|
|
1501
|
+
declare const NavbarExpandableMenuContent: ForwardRefExoticComponent<NavbarExpandableMenuContentProps & RefAttributes<HTMLDivElement>>;
|
|
1502
1502
|
export { NavbarExpandableMenuContent }
|
|
1503
1503
|
export { NavbarExpandableMenuContent as NavbarExpandableMenuContent_alias_1 }
|
|
1504
1504
|
export { NavbarExpandableMenuContent as NavbarExpandableMenuContent_alias_2 }
|
|
@@ -1508,15 +1508,15 @@ export { NavbarExpandableMenuContent as NavbarExpandableMenuContent_alias_3 }
|
|
|
1508
1508
|
* Content
|
|
1509
1509
|
*/
|
|
1510
1510
|
export declare interface NavbarExpandableMenuContentProps {
|
|
1511
|
-
children:
|
|
1511
|
+
children: React.ReactNode;
|
|
1512
1512
|
className?: string;
|
|
1513
1513
|
}
|
|
1514
1514
|
|
|
1515
1515
|
export declare interface NavbarExpandableMenuProps {
|
|
1516
|
-
children:
|
|
1516
|
+
children: React.ReactNode;
|
|
1517
1517
|
}
|
|
1518
1518
|
|
|
1519
|
-
declare const NavbarExpandableMenuTrigger:
|
|
1519
|
+
declare const NavbarExpandableMenuTrigger: ForwardRefExoticComponent<NavbarExpandableMenuTriggerProps & RefAttributes<HTMLButtonElement>>;
|
|
1520
1520
|
export { NavbarExpandableMenuTrigger }
|
|
1521
1521
|
export { NavbarExpandableMenuTrigger as NavbarExpandableMenuTrigger_alias_1 }
|
|
1522
1522
|
export { NavbarExpandableMenuTrigger as NavbarExpandableMenuTrigger_alias_2 }
|
|
@@ -1525,10 +1525,10 @@ export { NavbarExpandableMenuTrigger as NavbarExpandableMenuTrigger_alias_3 }
|
|
|
1525
1525
|
/**
|
|
1526
1526
|
* Trigger
|
|
1527
1527
|
*/
|
|
1528
|
-
export declare interface NavbarExpandableMenuTriggerProps extends Omit<
|
|
1529
|
-
whenClosedText:
|
|
1528
|
+
export declare interface NavbarExpandableMenuTriggerProps extends Omit<React.HTMLAttributes<HTMLButtonElement>, "children"> {
|
|
1529
|
+
whenClosedText: React.ReactNode;
|
|
1530
1530
|
whenClosedHelperTitle?: string;
|
|
1531
|
-
whenOpenText:
|
|
1531
|
+
whenOpenText: React.ReactNode;
|
|
1532
1532
|
whenOpenHelperTitle?: string;
|
|
1533
1533
|
}
|
|
1534
1534
|
|
|
@@ -1498,7 +1498,7 @@ export { NavbarExpandableMenu as NavbarExpandableMenu_alias_1 }
|
|
|
1498
1498
|
export { NavbarExpandableMenu as NavbarExpandableMenu_alias_2 }
|
|
1499
1499
|
export { NavbarExpandableMenu as NavbarExpandableMenu_alias_3 }
|
|
1500
1500
|
|
|
1501
|
-
declare const NavbarExpandableMenuContent:
|
|
1501
|
+
declare const NavbarExpandableMenuContent: ForwardRefExoticComponent<NavbarExpandableMenuContentProps & RefAttributes<HTMLDivElement>>;
|
|
1502
1502
|
export { NavbarExpandableMenuContent }
|
|
1503
1503
|
export { NavbarExpandableMenuContent as NavbarExpandableMenuContent_alias_1 }
|
|
1504
1504
|
export { NavbarExpandableMenuContent as NavbarExpandableMenuContent_alias_2 }
|
|
@@ -1508,15 +1508,15 @@ export { NavbarExpandableMenuContent as NavbarExpandableMenuContent_alias_3 }
|
|
|
1508
1508
|
* Content
|
|
1509
1509
|
*/
|
|
1510
1510
|
export declare interface NavbarExpandableMenuContentProps {
|
|
1511
|
-
children:
|
|
1511
|
+
children: React.ReactNode;
|
|
1512
1512
|
className?: string;
|
|
1513
1513
|
}
|
|
1514
1514
|
|
|
1515
1515
|
export declare interface NavbarExpandableMenuProps {
|
|
1516
|
-
children:
|
|
1516
|
+
children: React.ReactNode;
|
|
1517
1517
|
}
|
|
1518
1518
|
|
|
1519
|
-
declare const NavbarExpandableMenuTrigger:
|
|
1519
|
+
declare const NavbarExpandableMenuTrigger: ForwardRefExoticComponent<NavbarExpandableMenuTriggerProps & RefAttributes<HTMLButtonElement>>;
|
|
1520
1520
|
export { NavbarExpandableMenuTrigger }
|
|
1521
1521
|
export { NavbarExpandableMenuTrigger as NavbarExpandableMenuTrigger_alias_1 }
|
|
1522
1522
|
export { NavbarExpandableMenuTrigger as NavbarExpandableMenuTrigger_alias_2 }
|
|
@@ -1525,10 +1525,10 @@ export { NavbarExpandableMenuTrigger as NavbarExpandableMenuTrigger_alias_3 }
|
|
|
1525
1525
|
/**
|
|
1526
1526
|
* Trigger
|
|
1527
1527
|
*/
|
|
1528
|
-
export declare interface NavbarExpandableMenuTriggerProps extends Omit<
|
|
1529
|
-
whenClosedText:
|
|
1528
|
+
export declare interface NavbarExpandableMenuTriggerProps extends Omit<React.HTMLAttributes<HTMLButtonElement>, "children"> {
|
|
1529
|
+
whenClosedText: React.ReactNode;
|
|
1530
1530
|
whenClosedHelperTitle?: string;
|
|
1531
|
-
whenOpenText:
|
|
1531
|
+
whenOpenText: React.ReactNode;
|
|
1532
1532
|
whenOpenHelperTitle?: string;
|
|
1533
1533
|
}
|
|
1534
1534
|
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-KQITCS3U.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useHydrated,
|
|
6
|
+
useMergeRefs,
|
|
6
7
|
useResize
|
|
7
8
|
} from "./chunk-DEX36MFK.mjs";
|
|
8
9
|
import {
|
|
@@ -16,10 +17,11 @@ import { forwardRef, useEffect, useRef } from "react";
|
|
|
16
17
|
import { clsx } from "@postenbring/hedwig-css/typed-classname";
|
|
17
18
|
import { jsx } from "react/jsx-runtime";
|
|
18
19
|
var TabsList = forwardRef(
|
|
19
|
-
(_a) => {
|
|
20
|
+
(_a, ref) => {
|
|
20
21
|
var _b = _a, { children, direction = "horizontal", className } = _b, rest = __objRest(_b, ["children", "direction", "className"]);
|
|
21
22
|
const { activeTabId } = useTabsContext();
|
|
22
23
|
const tabsListRef = useRef(null);
|
|
24
|
+
const mergedRef = useMergeRefs([tabsListRef, ref]);
|
|
23
25
|
const { width: tabsWidth } = useResize(tabsListRef);
|
|
24
26
|
const isClientSide = useHydrated();
|
|
25
27
|
const { innerWidth } = isClientSide ? window : { innerWidth: 1e3 };
|
|
@@ -63,7 +65,7 @@ var TabsList = forwardRef(
|
|
|
63
65
|
},
|
|
64
66
|
className
|
|
65
67
|
),
|
|
66
|
-
ref:
|
|
68
|
+
ref: mergedRef,
|
|
67
69
|
role: "tablist"
|
|
68
70
|
}, rest), {
|
|
69
71
|
children
|
|
@@ -106,4 +108,4 @@ export {
|
|
|
106
108
|
TabsList,
|
|
107
109
|
TabsTab
|
|
108
110
|
};
|
|
109
|
-
//# sourceMappingURL=chunk-
|
|
111
|
+
//# sourceMappingURL=chunk-4WQWU5TL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tabs/tabs-list.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactElement, MouseEvent } from \"react\";\nimport { forwardRef, useEffect, useRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { useResize, useHydrated, useMergeRefs } from \"../utils\";\nimport { useTabsContext } from \"./context\";\n\nexport interface TabsListProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactElement<TabsTabProps> | ReactElement<TabsTabProps>[];\n\n /**\n * Direction of the tabs. Can either be vertical or horizontal.\n * Horizontal breaks on window width with fallback back to vertical\n *\n * @default \"horizontal\"\n */\n direction?: \"vertical\" | \"horizontal\";\n}\n\nexport const TabsList = forwardRef<HTMLDivElement, TabsListProps>(\n ({ children, direction = \"horizontal\", className, ...rest }, ref) => {\n const { activeTabId } = useTabsContext();\n const tabsListRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs([tabsListRef, ref]);\n const { width: tabsWidth } = useResize(tabsListRef);\n\n const isClientSide = useHydrated();\n const { innerWidth } = isClientSide ? window : { innerWidth: 1000 };\n const wideEnough = innerWidth >= tabsWidth;\n\n const previousTabId = useRef(activeTabId);\n\n // Marker animation\n useEffect(() => {\n const tabList = tabsListRef.current;\n const activeTab = tabList?.querySelector(`[data-tabid=\"${activeTabId}\"]`);\n if (!activeTab || !tabList) return;\n\n const { offsetHeight: containerHeight, offsetWidth: containerWidth } = tabList;\n const { offsetHeight, offsetWidth, offsetTop, offsetLeft } = activeTab as HTMLElement;\n\n // Calculate the height and width of the marker relative to the container\n const height = offsetHeight / containerHeight;\n const width = offsetWidth / containerWidth;\n\n // NOTE: Doing a DOM manipulation here to set the CSS variables for the marker\n // Not really the react idomatic way, but as long as it works we are able to skip some intermidiate `useState`\n tabsListRef.current.style.setProperty(\"--_hds-tabs-marker-height\", String(height));\n tabsListRef.current.style.setProperty(\"--_hds-tabs-marker-width\", String(width));\n tabsListRef.current.style.setProperty(\"--_hds-tabs-marker-top\", `${offsetTop}px`);\n tabsListRef.current.style.setProperty(\"--_hds-tabs-marker-left\", `${offsetLeft}px`);\n\n // Start with border fallback, then switch to the animated marker when the user changes tabs\n // This way the marker is placed immediately to the default tab, then animates smoothly to the next when selected\n if (previousTabId.current !== activeTabId) {\n tabsListRef.current.style.setProperty(\n \"--_hds-tabs-marker-animated-color\",\n \"var(--_hds-tabs-marker-color)\",\n );\n tabsListRef.current.style.setProperty(\n \"--_hds-tabs-marker-border-fallback-color\",\n \"transparent\",\n );\n }\n previousTabId.current = activeTabId;\n }, [activeTabId, innerWidth]);\n\n return (\n <div\n className={clsx(\n \"hds-tabs__list\",\n direction === \"horizontal\"\n ? {\n \"hds-tabs__list--horizontal\": wideEnough,\n \"hds-tabs__list--vertical\": !wideEnough,\n }\n : {\n \"hds-tabs__list--vertical\": true,\n },\n className as undefined,\n )}\n ref={mergedRef}\n role=\"tablist\"\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\nTabsList.displayName = \"Tabs.List\";\n\nexport interface TabsTabProps extends HTMLAttributes<HTMLButtonElement> {\n children: ReactElement<HTMLElement> | string;\n\n /**\n * Identifier for the tab\n */\n tabId: string;\n}\n\nexport const TabsTab = forwardRef<HTMLButtonElement, TabsTabProps>(\n ({ children, tabId, className, onClick, ...rest }, ref) => {\n const context = useTabsContext();\n\n const toggleTab = (e: MouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n context.toggleActiveTabId(tabId);\n onClick?.(e);\n };\n return (\n <button\n className={clsx(\n \"hds-tabs__tab\",\n { \"hds-tabs__tab--active\": context.activeTabId === tabId },\n className as undefined,\n )}\n data-tabid={tabId}\n onClick={toggleTab}\n ref={ref}\n type=\"button\"\n role=\"tab\"\n {...rest}\n >\n {children}\n </button>\n );\n },\n);\nTabsTab.displayName = \"Tabs.Tab\";\n"],"mappings":";;;;;;;;;;;;;;;AACA,SAAS,YAAY,WAAW,cAAc;AAC9C,SAAS,YAAY;AAiEf;AAjDC,IAAM,WAAW;AAAA,EACtB,CAAC,IAA4D,QAAQ;AAApE,iBAAE,YAAU,YAAY,cAAc,UAnBzC,IAmBG,IAAoD,iBAApD,IAAoD,CAAlD,YAAU,aAA0B;AACrC,UAAM,EAAE,YAAY,IAAI,eAAe;AACvC,UAAM,cAAc,OAAuB,IAAI;AAC/C,UAAM,YAAY,aAAa,CAAC,aAAa,GAAG,CAAC;AACjD,UAAM,EAAE,OAAO,UAAU,IAAI,UAAU,WAAW;AAElD,UAAM,eAAe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A1D,iBAAE,YAAU,OAAO,WAAW,QArGjC,IAqGG,IAA0C,iBAA1C,IAA0C,CAAxC,YAAU,SAAO,aAAW;AAC7B,UAAM,UAAU,eAAe;AAE/B,UAAM,YAAY,CAAC,MAAqC;AACtD,QAAE,eAAe;AACjB,cAAQ,kBAAkB,KAAK;AAC/B,yCAAU;AAAA,IACZ;AACA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA,EAAE,yBAAyB,QAAQ,gBAAgB,MAAM;AAAA,UACzD;AAAA,QACF;AAAA,QACA,cAAY;AAAA,QACZ,SAAS;AAAA,QACT;AAAA,QACA,MAAK;AAAA,QACL,MAAK;AAAA,SACD,OAXL;AAAA,QAaE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,QAAQ,cAAc;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InputGroup
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FB5GEZNH.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useMergeRefs
|
|
6
6
|
} from "./chunk-DEX36MFK.mjs";
|
|
@@ -83,4 +83,4 @@ DatePicker.displayName = "DatePicker";
|
|
|
83
83
|
export {
|
|
84
84
|
DatePicker
|
|
85
85
|
};
|
|
86
|
-
//# sourceMappingURL=chunk-
|
|
86
|
+
//# sourceMappingURL=chunk-F2C3KZFX.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ErrorMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RZZDMBB7.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadProps,
|
|
@@ -99,4 +99,4 @@ var InputGroup = forwardRef(function InputGroup2(_a, ref) {
|
|
|
99
99
|
export {
|
|
100
100
|
InputGroup
|
|
101
101
|
};
|
|
102
|
-
//# sourceMappingURL=chunk-
|
|
102
|
+
//# sourceMappingURL=chunk-FB5GEZNH.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InputGroup
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FB5GEZNH.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadProps,
|
|
@@ -34,4 +34,4 @@ Input.displayName = "Input";
|
|
|
34
34
|
export {
|
|
35
35
|
Input
|
|
36
36
|
};
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
37
|
+
//# sourceMappingURL=chunk-GGNMBB3K.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Fieldset
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LG7QWKFP.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadProps,
|
|
@@ -31,4 +31,4 @@ export {
|
|
|
31
31
|
useRadioGroupContext,
|
|
32
32
|
RadioGroup
|
|
33
33
|
};
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-GJO7Z2YL.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TabsList,
|
|
3
3
|
TabsTab
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4WQWU5TL.mjs";
|
|
5
5
|
import {
|
|
6
6
|
Tabs
|
|
7
7
|
} from "./chunk-3MQKXNZ6.mjs";
|
|
@@ -20,4 +20,4 @@ TabsComponent.Content = TabsContent;
|
|
|
20
20
|
export {
|
|
21
21
|
TabsComponent
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-IJAX6APL.mjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useFieldsetContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LG7QWKFP.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ErrorMessage
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RZZDMBB7.mjs";
|
|
7
7
|
import {
|
|
8
8
|
__objRest,
|
|
9
9
|
__spreadProps,
|
|
@@ -73,4 +73,4 @@ Checkbox.displayName = "Checkbox";
|
|
|
73
73
|
export {
|
|
74
74
|
Checkbox
|
|
75
75
|
};
|
|
76
|
-
//# sourceMappingURL=chunk-
|
|
76
|
+
//# sourceMappingURL=chunk-KI6WRKZY.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ErrorMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RZZDMBB7.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadProps,
|
|
@@ -64,4 +64,4 @@ export {
|
|
|
64
64
|
useFieldsetContext,
|
|
65
65
|
Fieldset
|
|
66
66
|
};
|
|
67
|
-
//# sourceMappingURL=chunk-
|
|
67
|
+
//# sourceMappingURL=chunk-LG7QWKFP.mjs.map
|
|
@@ -43,46 +43,31 @@ function NavbarExpandableMenu({ children }) {
|
|
|
43
43
|
return /* @__PURE__ */ jsx(expandableMenuContext.Provider, { value: [open, toggleOpen], children });
|
|
44
44
|
}
|
|
45
45
|
NavbarExpandableMenu.displayName = "NavbarExpandableMenu";
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
className,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
className: clsx("hds-navbar__item", className),
|
|
72
|
-
onClick: toggleOpen,
|
|
73
|
-
ref: ref != null ? ref : innerRef,
|
|
74
|
-
style,
|
|
75
|
-
title,
|
|
76
|
-
type: "button"
|
|
77
|
-
}, rest), {
|
|
78
|
-
children: [
|
|
79
|
-
/* @__PURE__ */ jsx("span", { className: clsx("hds-navbar__item-responsive-text"), children: text }),
|
|
80
|
-
" ",
|
|
81
|
-
icon
|
|
82
|
-
]
|
|
83
|
-
})
|
|
84
|
-
);
|
|
85
|
-
}
|
|
46
|
+
var RenderButton = forwardRef(
|
|
47
|
+
(_a, ref) => {
|
|
48
|
+
var _b = _a, { className, innerRef, open = false, text, title, toggleOpen, width } = _b, rest = __objRest(_b, ["className", "innerRef", "open", "text", "title", "toggleOpen", "width"]);
|
|
49
|
+
const icon = open ? /* @__PURE__ */ jsx(CloseIcon, {}) : /* @__PURE__ */ jsx(MenuIcon, {});
|
|
50
|
+
const style = width ? { width } : {};
|
|
51
|
+
return /* @__PURE__ */ jsxs(
|
|
52
|
+
"button",
|
|
53
|
+
__spreadProps(__spreadValues({
|
|
54
|
+
className: clsx("hds-navbar__item", className),
|
|
55
|
+
onClick: toggleOpen,
|
|
56
|
+
ref: ref != null ? ref : innerRef,
|
|
57
|
+
style,
|
|
58
|
+
title,
|
|
59
|
+
type: "button"
|
|
60
|
+
}, rest), {
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ jsx("span", { className: clsx("hds-navbar__item-responsive-text"), children: text }),
|
|
63
|
+
" ",
|
|
64
|
+
icon
|
|
65
|
+
]
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
RenderButton.displayName = "Navbar.RenderButton";
|
|
86
71
|
var NavbarExpandableMenuTrigger = forwardRef(
|
|
87
72
|
(_a, ref) => {
|
|
88
73
|
var _b = _a, {
|
|
@@ -123,7 +108,7 @@ var NavbarExpandableMenuTrigger = forwardRef(
|
|
|
123
108
|
/* @__PURE__ */ jsx(
|
|
124
109
|
RenderButton,
|
|
125
110
|
__spreadValues({
|
|
126
|
-
className
|
|
111
|
+
className,
|
|
127
112
|
innerRef: measureButtonRef,
|
|
128
113
|
text: whenClosedText,
|
|
129
114
|
title
|
|
@@ -134,7 +119,7 @@ var NavbarExpandableMenuTrigger = forwardRef(
|
|
|
134
119
|
/* @__PURE__ */ jsx(
|
|
135
120
|
RenderButton,
|
|
136
121
|
__spreadValues({
|
|
137
|
-
className
|
|
122
|
+
className,
|
|
138
123
|
innerRef: measureButtonRef,
|
|
139
124
|
open: true,
|
|
140
125
|
text: whenOpenText,
|
|
@@ -151,7 +136,7 @@ var NavbarExpandableMenuTrigger = forwardRef(
|
|
|
151
136
|
return /* @__PURE__ */ jsx(
|
|
152
137
|
RenderButton,
|
|
153
138
|
__spreadValues({
|
|
154
|
-
className
|
|
139
|
+
className,
|
|
155
140
|
open,
|
|
156
141
|
ref,
|
|
157
142
|
text,
|
|
@@ -185,4 +170,4 @@ export {
|
|
|
185
170
|
NavbarExpandableMenuTrigger,
|
|
186
171
|
NavbarExpandableMenuContent
|
|
187
172
|
};
|
|
188
|
-
//# sourceMappingURL=chunk-
|
|
173
|
+
//# sourceMappingURL=chunk-MPHMD4LO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/navbar/navbar-expandable-menu.tsx"],"sourcesContent":["import { createContext, useContext, forwardRef, useState, useRef, useEffect } from \"react\";\nimport { createRoot } from \"react-dom/client\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { focusTrap } from \"../utils\";\nimport { CloseIcon, MenuIcon } from \"./icons\";\n\nconst expandableMenuContext = createContext([\n false as boolean,\n () => {\n // Empty\n },\n] as const);\nexport const useNavbarExpendableMenuContext = () => useContext(expandableMenuContext);\n\nexport interface NavbarExpandableMenuProps {\n children: React.ReactNode;\n}\n\n/**\n * Expandable Menu Provider\n * Handles scroll and focus locking,\n * as well as scrolling the user to the top of the page.\n *\n * If we want a sticky header in the future the scrolling should be configurable\n */\nexport function NavbarExpandableMenu({ children }: NavbarExpandableMenuProps) {\n const [open, setOpen] = useState(false);\n function toggleOpen() {\n setOpen((prev) => !prev);\n }\n\n useEffect(() => {\n if (open) {\n window.scrollTo(0, 0);\n document.body.classList.add(clsx(\"hds-navbar-scroll-lock\"));\n const releaseFocusTrap = focusTrap(\n document.getElementsByClassName(clsx(\"hds-navbar\"))[0] as HTMLElement,\n );\n\n return () => {\n document.body.classList.remove(clsx(\"hds-navbar-scroll-lock\"));\n releaseFocusTrap();\n };\n }\n }, [open]);\n\n return (\n <expandableMenuContext.Provider value={[open, toggleOpen]}>\n {children}\n </expandableMenuContext.Provider>\n );\n}\nNavbarExpandableMenu.displayName = \"NavbarExpandableMenu\";\n\ninterface ButtonInterface extends React.HTMLAttributes<HTMLButtonElement> {\n open?: boolean;\n innerRef?: React.RefObject<HTMLButtonElement>;\n text: React.ReactNode;\n title?: string;\n toggleOpen?: () => void;\n width?: number;\n}\n\nconst RenderButton = forwardRef<HTMLButtonElement, ButtonInterface>(\n ({ className, innerRef, open = false, text, title, toggleOpen, width, ...rest }, ref) => {\n const icon = open ? <CloseIcon /> : <MenuIcon />;\n const style = width ? { width } : {};\n return (\n <button\n className={clsx(\"hds-navbar__item\", className as undefined)}\n onClick={toggleOpen}\n ref={ref ?? innerRef}\n style={style}\n title={title}\n type=\"button\"\n {...rest}\n >\n <span className={clsx(\"hds-navbar__item-responsive-text\")}>{text}</span> {icon}\n </button>\n );\n },\n);\nRenderButton.displayName = \"Navbar.RenderButton\";\n\n/**\n * Trigger\n */\nexport interface NavbarExpandableMenuTriggerProps\n extends Omit<React.HTMLAttributes<HTMLButtonElement>, \"children\"> {\n whenClosedText: React.ReactNode;\n whenClosedHelperTitle?: string;\n\n whenOpenText: React.ReactNode;\n whenOpenHelperTitle?: string;\n}\nexport const NavbarExpandableMenuTrigger = forwardRef<\n HTMLButtonElement,\n NavbarExpandableMenuTriggerProps\n>(\n (\n {\n whenClosedText,\n whenClosedHelperTitle,\n\n whenOpenText,\n whenOpenHelperTitle,\n\n className,\n ...rest\n },\n ref,\n ) => {\n const [open, toggleOpen] = useNavbarExpendableMenuContext();\n const [width, setWidth] = useState(0);\n const measureButtonRef = useRef<HTMLButtonElement>(null);\n\n const text: React.ReactNode = open ? whenOpenText : whenClosedText;\n const title = open ? whenOpenHelperTitle : whenClosedHelperTitle;\n\n /**\n *\n * @param element - Button to measure\n * @param callback - report the width back\n */\n const measureButton = (element: React.ReactNode, callback: (width: number) => void) => {\n // Create an empty div to render the Button in\n const container = document.createElement(\"div\");\n container.style.cssText = \"display: inline-block; position: absolute; visibility: hidden\";\n\n // Attach the empty div inside the navigation section\n const c = document.getElementsByClassName(\"hds-navbar__navigation\")[0];\n c.appendChild(container);\n\n // Render the Button here\n const root = createRoot(container as HTMLElement);\n root.render(element);\n\n /**\n * Get the offsetWidth now that it is rendered\n * Also clean up after us\n */\n const getWidth = () => {\n callback(measureButtonRef.current?.offsetWidth ?? 0);\n root.unmount();\n c.removeChild(container);\n };\n // This is instead of the callback that used to be on ReactDOM.render()\n setTimeout(getWidth, 0);\n };\n\n useEffect(() => {\n measureButton(\n <RenderButton\n className={className}\n innerRef={measureButtonRef}\n text={whenClosedText}\n title={title}\n {...rest}\n />,\n (closedWidth: number) => {\n measureButton(\n <RenderButton\n className={className}\n innerRef={measureButtonRef}\n open\n text={whenOpenText}\n title={title}\n {...rest}\n />,\n (openWidth: number) => {\n setWidth(Math.max(openWidth, closedWidth));\n },\n );\n },\n );\n }, [className, rest, title, whenClosedText, whenOpenText]);\n\n return (\n <RenderButton\n className={className}\n open={open}\n ref={ref}\n text={text as string}\n title={title}\n toggleOpen={toggleOpen}\n width={width}\n {...rest}\n />\n );\n },\n);\nNavbarExpandableMenuTrigger.displayName = \"Navbar.ExpandableMenuTrigger\";\n\n/**\n * Content\n */\nexport interface NavbarExpandableMenuContentProps {\n children: React.ReactNode;\n className?: string;\n}\nexport const NavbarExpandableMenuContent = forwardRef<\n HTMLDivElement,\n NavbarExpandableMenuContentProps\n>(({ children, className, ...rest }, ref) => {\n const [open] = useNavbarExpendableMenuContext();\n return (\n <section\n {...rest}\n className={clsx(\"hds-navbar__expandable-menu-content\", className as undefined)}\n data-state={open ? \"open\" : \"closed\"}\n {...{ inert: open ? \"true\" : undefined }}\n ref={ref}\n >\n <div className={clsx(\"hds-navbar__expandable-menu-content-inner\")}>{children}</div>\n </section>\n );\n});\nNavbarExpandableMenuContent.displayName = \"Navbar.ExpandableMenuContent\";\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,eAAe,YAAY,YAAY,UAAU,QAAQ,iBAAiB;AACnF,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AA6CjB,cAqBE,YArBF;AAzCJ,IAAM,wBAAwB,cAAc;AAAA,EAC1C;AAAA,EACA,MAAM;AAAA,EAEN;AACF,CAAU;AACH,IAAM,iCAAiC,MAAM,WAAW,qBAAqB;AAa7E,SAAS,qBAAqB,EAAE,SAAS,GAA8B;AAC5E,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AACtC,WAAS,aAAa;AACpB,YAAQ,CAAC,SAAS,CAAC,IAAI;AAAA,EACzB;AAEA,YAAU,MAAM;AACd,QAAI,MAAM;AACR,aAAO,SAAS,GAAG,CAAC;AACpB,eAAS,KAAK,UAAU,IAAI,KAAK,wBAAwB,CAAC;AAC1D,YAAM,mBAAmB;AAAA,QACvB,SAAS,uBAAuB,KAAK,YAAY,CAAC,EAAE,CAAC;AAAA,MACvD;AAEA,aAAO,MAAM;AACX,iBAAS,KAAK,UAAU,OAAO,KAAK,wBAAwB,CAAC;AAC7D,yBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,IAAI,CAAC;AAET,SACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,CAAC,MAAM,UAAU,GACrD,UACH;AAEJ;AACA,qBAAqB,cAAc;AAWnC,IAAM,eAAe;AAAA,EACnB,CAAC,IAAgF,QAAQ;AAAxF,iBAAE,aAAW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,CAAC;AACD,4BAA4B,cAAc;","names":["_a","_b"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useRadioGroupContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GJO7Z2YL.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useFieldsetContext
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LG7QWKFP.mjs";
|
|
7
7
|
import {
|
|
8
8
|
__objRest,
|
|
9
9
|
__spreadProps,
|
|
@@ -89,4 +89,4 @@ Radiobutton.displayName = "Radiobutton";
|
|
|
89
89
|
export {
|
|
90
90
|
Radiobutton
|
|
91
91
|
};
|
|
92
|
-
//# sourceMappingURL=chunk-
|
|
92
|
+
//# sourceMappingURL=chunk-O4HIHUMD.mjs.map
|
|
@@ -9,14 +9,15 @@ import { clsx } from "@postenbring/hedwig-css/typed-classname";
|
|
|
9
9
|
import { forwardRef } from "react";
|
|
10
10
|
import { jsx } from "react/jsx-runtime";
|
|
11
11
|
var ErrorMessage = forwardRef(
|
|
12
|
-
(_a) => {
|
|
12
|
+
(_a, ref) => {
|
|
13
13
|
var _b = _a, { children, id, className } = _b, rest = __objRest(_b, ["children", "id", "className"]);
|
|
14
14
|
return /* @__PURE__ */ jsx(
|
|
15
15
|
"div",
|
|
16
16
|
__spreadProps(__spreadValues({
|
|
17
17
|
"aria-live": "assertive",
|
|
18
18
|
className: clsx("hds-error-message", className),
|
|
19
|
-
id
|
|
19
|
+
id,
|
|
20
|
+
ref
|
|
20
21
|
}, rest), {
|
|
21
22
|
children
|
|
22
23
|
})
|
|
@@ -28,4 +29,4 @@ ErrorMessage.displayName = "ErrorMessage";
|
|
|
28
29
|
export {
|
|
29
30
|
ErrorMessage
|
|
30
31
|
};
|
|
31
|
-
//# sourceMappingURL=chunk-
|
|
32
|
+
//# sourceMappingURL=chunk-RZZDMBB7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/form/error-message/error-message.tsx"],"sourcesContent":["import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nexport interface ErrorMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport const ErrorMessage = forwardRef<HTMLDivElement, ErrorMessageProps>(\n ({ children, id, className, ...rest }, ref) => {\n return (\n <div\n aria-live=\"assertive\"\n className={clsx(\"hds-error-message\", className as undefined)}\n id={id}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\nErrorMessage.displayName = \"ErrorMessage\";\n"],"mappings":";;;;;;;AAAA,SAAS,YAAY;AACrB,SAAS,kBAAkC;AAWrC;AAHC,IAAM,eAAe;AAAA,EAC1B,CAAC,IAAsC,QAAQ;AAA9C,iBAAE,YAAU,IAAI,UAVnB,IAUG,IAA8B,iBAA9B,IAA8B,CAA5B,YAAU,MAAI;AACf,WACE;AAAA,MAAC;AAAA;AAAA,QACC,aAAU;AAAA,QACV,WAAW,KAAK,qBAAqB,SAAsB;AAAA,QAC3D;AAAA,QACA;AAAA,SACI,OALL;AAAA,QAOE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,aAAa,cAAc;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InputGroup
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FB5GEZNH.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadProps,
|
|
@@ -34,4 +34,4 @@ Textarea.displayName = "Textarea";
|
|
|
34
34
|
export {
|
|
35
35
|
Textarea
|
|
36
36
|
};
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
37
|
+
//# sourceMappingURL=chunk-WPCWXROV.mjs.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
NavbarExpandableMenu,
|
|
13
13
|
NavbarExpandableMenuContent,
|
|
14
14
|
NavbarExpandableMenuTrigger
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-MPHMD4LO.mjs";
|
|
16
16
|
|
|
17
17
|
// src/navbar/index.tsx
|
|
18
18
|
var NavbarComponent = Navbar;
|
|
@@ -30,4 +30,4 @@ NavbarComponent.Navigation = NavbarNavigation;
|
|
|
30
30
|
export {
|
|
31
31
|
NavbarComponent
|
|
32
32
|
};
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
33
|
+
//# sourceMappingURL=chunk-XDYXNQDV.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InputGroup
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FB5GEZNH.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadProps,
|
|
@@ -33,4 +33,4 @@ Select.displayName = "Select";
|
|
|
33
33
|
export {
|
|
34
34
|
Select
|
|
35
35
|
};
|
|
36
|
-
//# sourceMappingURL=chunk-
|
|
36
|
+
//# sourceMappingURL=chunk-XFODQH3I.mjs.map
|
|
@@ -60,14 +60,15 @@ var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
|
|
|
60
60
|
var import_react = require("react");
|
|
61
61
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
62
62
|
var ErrorMessage = (0, import_react.forwardRef)(
|
|
63
|
-
(_a) => {
|
|
63
|
+
(_a, ref) => {
|
|
64
64
|
var _b = _a, { children, id, className } = _b, rest = __objRest(_b, ["children", "id", "className"]);
|
|
65
65
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
66
|
"div",
|
|
67
67
|
__spreadProps(__spreadValues({
|
|
68
68
|
"aria-live": "assertive",
|
|
69
69
|
className: (0, import_typed_classname.clsx)("hds-error-message", className),
|
|
70
|
-
id
|
|
70
|
+
id,
|
|
71
|
+
ref
|
|
71
72
|
}, rest), {
|
|
72
73
|
children
|
|
73
74
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/checkbox/checkbox.tsx","../../../src/form/error-message/error-message.tsx","../../../src/form/fieldset/fieldset.tsx"],"sourcesContent":["import { forwardRef, useId, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ErrorMessage } from \"../error-message\";\nimport { useFieldsetContext } from \"../fieldset\";\n\nexport type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\"> & {\n children: ReactNode;\n variant?: \"plain\" | \"bounding-box\";\n title?: string;\n} & (\n | {\n /**\n * Set to `true` to add error styling. The component will take care of aria to indicate invalid state.\n *\n * Normally you don't need this, as you should wrap your Checkboxes in the Fieldset component.\n * When providing an errorMessage to Fieldset, all contained Checkboxes will get correct hasError state.\n *\n * You can use this when your checkbox is part of a non-HDS fieldset which shows an error message.\n */\n hasError?: boolean;\n errorMessage?: never;\n }\n | {\n hasError?: never;\n /**\n * Set an error message to add error styling, and display the error message.\n * The component will take care of aria to connect the error message to the checkbox.\n *\n * Use this when your checkbox is standalone (not part of a fieldset).\n */\n errorMessage?: ReactNode;\n }\n );\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n (\n {\n variant = \"plain\",\n hasError: hasErrorProp,\n errorMessage,\n title,\n children,\n className,\n ...rest\n },\n ref,\n ) => {\n const errorMessageId = useId();\n const { hasError: hasFieldsetError } = useFieldsetContext();\n const hasError = !!errorMessage || hasFieldsetError || hasErrorProp;\n\n return (\n <div className={clsx(\"hds-checkbox-wrapper\")}>\n <div\n className={clsx(\n \"hds-checkbox\",\n {\n [`hds-checkbox--${variant}`]: variant === \"bounding-box\",\n \"hds-checkbox--error\": hasError,\n },\n className as undefined,\n )}\n >\n <label>\n <input\n {...rest}\n aria-invalid={hasError ? true : undefined}\n aria-describedby={errorMessage ? errorMessageId : undefined}\n ref={ref}\n type=\"checkbox\"\n />\n <span aria-hidden className=\"hds-checkbox__checkmark\" />\n {title ? <p className=\"hds-checkbox__title\">{title}</p> : children}\n </label>\n {title ? children : null}\n </div>\n {errorMessage ? <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage> : null}\n </div>\n );\n },\n);\nCheckbox.displayName = \"Checkbox\";\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nexport interface ErrorMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport const ErrorMessage = forwardRef<HTMLDivElement, ErrorMessageProps>(\n ({ children, id, className, ...rest }) => {\n return (\n <div\n aria-live=\"assertive\"\n className={clsx(\"hds-error-message\", className as undefined)}\n id={id}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\nErrorMessage.displayName = \"ErrorMessage\";\n","import { useId, forwardRef, createContext, useContext } from \"react\";\nimport type { FieldsetHTMLAttributes, HTMLAttributes, ReactNode, CSSProperties } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ErrorMessage } from \"../error-message\";\n\nexport interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement> {\n className?: string;\n style?: CSSProperties;\n /**\n * Providing an errorMessage will also give contained Checkboxes or Radiobuttons\n * error styling and aria to indicate invalid state.\n *\n * For Radiobuttons you are even better off using RadioGroup.\n */\n errorMessage?: ReactNode;\n legendProps?: HTMLAttributes<HTMLElement> & { size: \"default\" | \"large\" };\n legend: ReactNode;\n children: ReactNode;\n}\n\nconst FieldsetContext = createContext<{ hasError: boolean }>({ hasError: false });\n\nexport const useFieldsetContext = () => useContext(FieldsetContext);\n\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(function Fieldset(\n {\n className,\n style,\n errorMessage,\n legendProps: { size: legendSize = \"default\", className: legendClassName, ...legendProps } = {},\n legend,\n children,\n ...rest\n },\n ref,\n) {\n const errorMessageId = useId();\n\n return (\n <fieldset\n aria-describedby={errorMessage ? errorMessageId : undefined}\n aria-invalid={errorMessage ? true : undefined}\n className={clsx(\"hds-fieldset\", className as undefined)}\n ref={ref}\n style={style}\n {...rest}\n >\n <legend\n className={clsx(\n \"hds-fieldset__legend\",\n { [`hds-fieldset__legend--${legendSize}`]: legendSize },\n legendClassName as undefined,\n )}\n {...legendProps}\n >\n {legend}\n </legend>\n <FieldsetContext.Provider value={{ hasError: Boolean(errorMessage) }}>\n {children}\n </FieldsetContext.Provider>\n <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage>\n </fieldset>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA4E;AAC5E,IAAAC,0BAAqB;;;ACDrB,6BAAqB;AACrB,mBAA2C;AAWrC;AAHC,IAAM,mBAAe;AAAA,EAC1B,CAAC,
|
|
1
|
+
{"version":3,"sources":["../../../src/form/checkbox/checkbox.tsx","../../../src/form/error-message/error-message.tsx","../../../src/form/fieldset/fieldset.tsx"],"sourcesContent":["import { forwardRef, useId, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ErrorMessage } from \"../error-message\";\nimport { useFieldsetContext } from \"../fieldset\";\n\nexport type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\"> & {\n children: ReactNode;\n variant?: \"plain\" | \"bounding-box\";\n title?: string;\n} & (\n | {\n /**\n * Set to `true` to add error styling. The component will take care of aria to indicate invalid state.\n *\n * Normally you don't need this, as you should wrap your Checkboxes in the Fieldset component.\n * When providing an errorMessage to Fieldset, all contained Checkboxes will get correct hasError state.\n *\n * You can use this when your checkbox is part of a non-HDS fieldset which shows an error message.\n */\n hasError?: boolean;\n errorMessage?: never;\n }\n | {\n hasError?: never;\n /**\n * Set an error message to add error styling, and display the error message.\n * The component will take care of aria to connect the error message to the checkbox.\n *\n * Use this when your checkbox is standalone (not part of a fieldset).\n */\n errorMessage?: ReactNode;\n }\n );\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n (\n {\n variant = \"plain\",\n hasError: hasErrorProp,\n errorMessage,\n title,\n children,\n className,\n ...rest\n },\n ref,\n ) => {\n const errorMessageId = useId();\n const { hasError: hasFieldsetError } = useFieldsetContext();\n const hasError = !!errorMessage || hasFieldsetError || hasErrorProp;\n\n return (\n <div className={clsx(\"hds-checkbox-wrapper\")}>\n <div\n className={clsx(\n \"hds-checkbox\",\n {\n [`hds-checkbox--${variant}`]: variant === \"bounding-box\",\n \"hds-checkbox--error\": hasError,\n },\n className as undefined,\n )}\n >\n <label>\n <input\n {...rest}\n aria-invalid={hasError ? true : undefined}\n aria-describedby={errorMessage ? errorMessageId : undefined}\n ref={ref}\n type=\"checkbox\"\n />\n <span aria-hidden className=\"hds-checkbox__checkmark\" />\n {title ? <p className=\"hds-checkbox__title\">{title}</p> : children}\n </label>\n {title ? children : null}\n </div>\n {errorMessage ? <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage> : null}\n </div>\n );\n },\n);\nCheckbox.displayName = \"Checkbox\";\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nexport interface ErrorMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport const ErrorMessage = forwardRef<HTMLDivElement, ErrorMessageProps>(\n ({ children, id, className, ...rest }, ref) => {\n return (\n <div\n aria-live=\"assertive\"\n className={clsx(\"hds-error-message\", className as undefined)}\n id={id}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\nErrorMessage.displayName = \"ErrorMessage\";\n","import { useId, forwardRef, createContext, useContext } from \"react\";\nimport type { FieldsetHTMLAttributes, HTMLAttributes, ReactNode, CSSProperties } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ErrorMessage } from \"../error-message\";\n\nexport interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement> {\n className?: string;\n style?: CSSProperties;\n /**\n * Providing an errorMessage will also give contained Checkboxes or Radiobuttons\n * error styling and aria to indicate invalid state.\n *\n * For Radiobuttons you are even better off using RadioGroup.\n */\n errorMessage?: ReactNode;\n legendProps?: HTMLAttributes<HTMLElement> & { size: \"default\" | \"large\" };\n legend: ReactNode;\n children: ReactNode;\n}\n\nconst FieldsetContext = createContext<{ hasError: boolean }>({ hasError: false });\n\nexport const useFieldsetContext = () => useContext(FieldsetContext);\n\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(function Fieldset(\n {\n className,\n style,\n errorMessage,\n legendProps: { size: legendSize = \"default\", className: legendClassName, ...legendProps } = {},\n legend,\n children,\n ...rest\n },\n ref,\n) {\n const errorMessageId = useId();\n\n return (\n <fieldset\n aria-describedby={errorMessage ? errorMessageId : undefined}\n aria-invalid={errorMessage ? true : undefined}\n className={clsx(\"hds-fieldset\", className as undefined)}\n ref={ref}\n style={style}\n {...rest}\n >\n <legend\n className={clsx(\n \"hds-fieldset__legend\",\n { [`hds-fieldset__legend--${legendSize}`]: legendSize },\n legendClassName as undefined,\n )}\n {...legendProps}\n >\n {legend}\n </legend>\n <FieldsetContext.Provider value={{ hasError: Boolean(errorMessage) }}>\n {children}\n </FieldsetContext.Provider>\n <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage>\n </fieldset>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA4E;AAC5E,IAAAC,0BAAqB;;;ACDrB,6BAAqB;AACrB,mBAA2C;AAWrC;AAHC,IAAM,mBAAe;AAAA,EAC1B,CAAC,IAAsC,QAAQ;AAA9C,iBAAE,YAAU,IAAI,UAVnB,IAUG,IAA8B,iBAA9B,IAA8B,CAA5B,YAAU,MAA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AAC,gBAAa,IAAI,gBAAiB,wBAAa;AAAA;AAAA;AAAA,EAClD;AAEJ,CAAC;;;AFAS,IAAAC,sBAAA;AA7BH,IAAM,eAAW;AAAA,EACtB,CACE,IASA,QACG;AAVH,iBACE;AAAA,gBAAU;AAAA,MACV,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IA1CN,IAoCI,IAOK,iBAPL,IAOK;AAAA,MANH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF,UAAM,qBAAiB,qBAAM;AAC7B,UAAM,EAAE,UAAU,iBAAiB,IAAI,mBAAmB;AAC1D,UAAM,WAAW,CAAC,CAAC,gBAAgB,oBAAoB;AAEvD,WACE,8CAAC,SAAI,eAAW,8BAAK,sBAAsB,GACzC;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,eAAW;AAAA,YACT;AAAA,YACA;AAAA,cACE,CAAC,iBAAiB,OAAO,EAAE,GAAG,YAAY;AAAA,cAC1C,uBAAuB;AAAA,YACzB;AAAA,YACA;AAAA,UACF;AAAA,UAEA;AAAA,0DAAC,WACC;AAAA;AAAA,gBAAC;AAAA,iDACK,OADL;AAAA,kBAEC,gBAAc,WAAW,OAAO;AAAA,kBAChC,oBAAkB,eAAe,iBAAiB;AAAA,kBAClD;AAAA,kBACA,MAAK;AAAA;AAAA,cACP;AAAA,cACA,6CAAC,UAAK,eAAW,MAAC,WAAU,2BAA0B;AAAA,cACrD,QAAQ,6CAAC,OAAE,WAAU,uBAAuB,iBAAM,IAAO;AAAA,eAC5D;AAAA,YACC,QAAQ,WAAW;AAAA;AAAA;AAAA,MACtB;AAAA,MACC,eAAe,6CAAC,gBAAa,IAAI,gBAAiB,wBAAa,IAAkB;AAAA,OACpF;AAAA,EAEJ;AACF;AACA,SAAS,cAAc;","names":["import_react","import_typed_classname","import_react","import_typed_classname","import_jsx_runtime","Fieldset","import_jsx_runtime"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Checkbox
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-KI6WRKZY.mjs";
|
|
4
4
|
import "../../chunk-LMF3QGSF.mjs";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-LG7QWKFP.mjs";
|
|
6
6
|
import "../../chunk-NSLSA7F7.mjs";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-RZZDMBB7.mjs";
|
|
8
8
|
import "../../chunk-R4SQKVDQ.mjs";
|
|
9
9
|
export {
|
|
10
10
|
Checkbox
|
|
@@ -62,14 +62,15 @@ var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
|
|
|
62
62
|
var import_react = require("react");
|
|
63
63
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
64
64
|
var ErrorMessage = (0, import_react.forwardRef)(
|
|
65
|
-
(_a) => {
|
|
65
|
+
(_a, ref) => {
|
|
66
66
|
var _b = _a, { children, id, className } = _b, rest = __objRest(_b, ["children", "id", "className"]);
|
|
67
67
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
68
68
|
"div",
|
|
69
69
|
__spreadProps(__spreadValues({
|
|
70
70
|
"aria-live": "assertive",
|
|
71
71
|
className: (0, import_typed_classname.clsx)("hds-error-message", className),
|
|
72
|
-
id
|
|
72
|
+
id,
|
|
73
|
+
ref
|
|
73
74
|
}, rest), {
|
|
74
75
|
children
|
|
75
76
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/checkbox/index.tsx","../../../src/form/checkbox/checkbox.tsx","../../../src/form/error-message/error-message.tsx","../../../src/form/fieldset/fieldset.tsx"],"sourcesContent":["export { Checkbox } from \"./checkbox\";\nexport type * from \"./checkbox\";\n","import { forwardRef, useId, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ErrorMessage } from \"../error-message\";\nimport { useFieldsetContext } from \"../fieldset\";\n\nexport type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\"> & {\n children: ReactNode;\n variant?: \"plain\" | \"bounding-box\";\n title?: string;\n} & (\n | {\n /**\n * Set to `true` to add error styling. The component will take care of aria to indicate invalid state.\n *\n * Normally you don't need this, as you should wrap your Checkboxes in the Fieldset component.\n * When providing an errorMessage to Fieldset, all contained Checkboxes will get correct hasError state.\n *\n * You can use this when your checkbox is part of a non-HDS fieldset which shows an error message.\n */\n hasError?: boolean;\n errorMessage?: never;\n }\n | {\n hasError?: never;\n /**\n * Set an error message to add error styling, and display the error message.\n * The component will take care of aria to connect the error message to the checkbox.\n *\n * Use this when your checkbox is standalone (not part of a fieldset).\n */\n errorMessage?: ReactNode;\n }\n );\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n (\n {\n variant = \"plain\",\n hasError: hasErrorProp,\n errorMessage,\n title,\n children,\n className,\n ...rest\n },\n ref,\n ) => {\n const errorMessageId = useId();\n const { hasError: hasFieldsetError } = useFieldsetContext();\n const hasError = !!errorMessage || hasFieldsetError || hasErrorProp;\n\n return (\n <div className={clsx(\"hds-checkbox-wrapper\")}>\n <div\n className={clsx(\n \"hds-checkbox\",\n {\n [`hds-checkbox--${variant}`]: variant === \"bounding-box\",\n \"hds-checkbox--error\": hasError,\n },\n className as undefined,\n )}\n >\n <label>\n <input\n {...rest}\n aria-invalid={hasError ? true : undefined}\n aria-describedby={errorMessage ? errorMessageId : undefined}\n ref={ref}\n type=\"checkbox\"\n />\n <span aria-hidden className=\"hds-checkbox__checkmark\" />\n {title ? <p className=\"hds-checkbox__title\">{title}</p> : children}\n </label>\n {title ? children : null}\n </div>\n {errorMessage ? <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage> : null}\n </div>\n );\n },\n);\nCheckbox.displayName = \"Checkbox\";\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nexport interface ErrorMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport const ErrorMessage = forwardRef<HTMLDivElement, ErrorMessageProps>(\n ({ children, id, className, ...rest }) => {\n return (\n <div\n aria-live=\"assertive\"\n className={clsx(\"hds-error-message\", className as undefined)}\n id={id}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\nErrorMessage.displayName = \"ErrorMessage\";\n","import { useId, forwardRef, createContext, useContext } from \"react\";\nimport type { FieldsetHTMLAttributes, HTMLAttributes, ReactNode, CSSProperties } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ErrorMessage } from \"../error-message\";\n\nexport interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement> {\n className?: string;\n style?: CSSProperties;\n /**\n * Providing an errorMessage will also give contained Checkboxes or Radiobuttons\n * error styling and aria to indicate invalid state.\n *\n * For Radiobuttons you are even better off using RadioGroup.\n */\n errorMessage?: ReactNode;\n legendProps?: HTMLAttributes<HTMLElement> & { size: \"default\" | \"large\" };\n legend: ReactNode;\n children: ReactNode;\n}\n\nconst FieldsetContext = createContext<{ hasError: boolean }>({ hasError: false });\n\nexport const useFieldsetContext = () => useContext(FieldsetContext);\n\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(function Fieldset(\n {\n className,\n style,\n errorMessage,\n legendProps: { size: legendSize = \"default\", className: legendClassName, ...legendProps } = {},\n legend,\n children,\n ...rest\n },\n ref,\n) {\n const errorMessageId = useId();\n\n return (\n <fieldset\n aria-describedby={errorMessage ? errorMessageId : undefined}\n aria-invalid={errorMessage ? true : undefined}\n className={clsx(\"hds-fieldset\", className as undefined)}\n ref={ref}\n style={style}\n {...rest}\n >\n <legend\n className={clsx(\n \"hds-fieldset__legend\",\n { [`hds-fieldset__legend--${legendSize}`]: legendSize },\n legendClassName as undefined,\n )}\n {...legendProps}\n >\n {legend}\n </legend>\n <FieldsetContext.Provider value={{ hasError: Boolean(errorMessage) }}>\n {children}\n </FieldsetContext.Provider>\n <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage>\n </fieldset>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAA4E;AAC5E,IAAAC,0BAAqB;;;ACDrB,6BAAqB;AACrB,mBAA2C;AAWrC;AAHC,IAAM,mBAAe;AAAA,EAC1B,CAAC,
|
|
1
|
+
{"version":3,"sources":["../../../src/form/checkbox/index.tsx","../../../src/form/checkbox/checkbox.tsx","../../../src/form/error-message/error-message.tsx","../../../src/form/fieldset/fieldset.tsx"],"sourcesContent":["export { Checkbox } from \"./checkbox\";\nexport type * from \"./checkbox\";\n","import { forwardRef, useId, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ErrorMessage } from \"../error-message\";\nimport { useFieldsetContext } from \"../fieldset\";\n\nexport type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\"> & {\n children: ReactNode;\n variant?: \"plain\" | \"bounding-box\";\n title?: string;\n} & (\n | {\n /**\n * Set to `true` to add error styling. The component will take care of aria to indicate invalid state.\n *\n * Normally you don't need this, as you should wrap your Checkboxes in the Fieldset component.\n * When providing an errorMessage to Fieldset, all contained Checkboxes will get correct hasError state.\n *\n * You can use this when your checkbox is part of a non-HDS fieldset which shows an error message.\n */\n hasError?: boolean;\n errorMessage?: never;\n }\n | {\n hasError?: never;\n /**\n * Set an error message to add error styling, and display the error message.\n * The component will take care of aria to connect the error message to the checkbox.\n *\n * Use this when your checkbox is standalone (not part of a fieldset).\n */\n errorMessage?: ReactNode;\n }\n );\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n (\n {\n variant = \"plain\",\n hasError: hasErrorProp,\n errorMessage,\n title,\n children,\n className,\n ...rest\n },\n ref,\n ) => {\n const errorMessageId = useId();\n const { hasError: hasFieldsetError } = useFieldsetContext();\n const hasError = !!errorMessage || hasFieldsetError || hasErrorProp;\n\n return (\n <div className={clsx(\"hds-checkbox-wrapper\")}>\n <div\n className={clsx(\n \"hds-checkbox\",\n {\n [`hds-checkbox--${variant}`]: variant === \"bounding-box\",\n \"hds-checkbox--error\": hasError,\n },\n className as undefined,\n )}\n >\n <label>\n <input\n {...rest}\n aria-invalid={hasError ? true : undefined}\n aria-describedby={errorMessage ? errorMessageId : undefined}\n ref={ref}\n type=\"checkbox\"\n />\n <span aria-hidden className=\"hds-checkbox__checkmark\" />\n {title ? <p className=\"hds-checkbox__title\">{title}</p> : children}\n </label>\n {title ? children : null}\n </div>\n {errorMessage ? <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage> : null}\n </div>\n );\n },\n);\nCheckbox.displayName = \"Checkbox\";\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nexport interface ErrorMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport const ErrorMessage = forwardRef<HTMLDivElement, ErrorMessageProps>(\n ({ children, id, className, ...rest }, ref) => {\n return (\n <div\n aria-live=\"assertive\"\n className={clsx(\"hds-error-message\", className as undefined)}\n id={id}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\nErrorMessage.displayName = \"ErrorMessage\";\n","import { useId, forwardRef, createContext, useContext } from \"react\";\nimport type { FieldsetHTMLAttributes, HTMLAttributes, ReactNode, CSSProperties } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ErrorMessage } from \"../error-message\";\n\nexport interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement> {\n className?: string;\n style?: CSSProperties;\n /**\n * Providing an errorMessage will also give contained Checkboxes or Radiobuttons\n * error styling and aria to indicate invalid state.\n *\n * For Radiobuttons you are even better off using RadioGroup.\n */\n errorMessage?: ReactNode;\n legendProps?: HTMLAttributes<HTMLElement> & { size: \"default\" | \"large\" };\n legend: ReactNode;\n children: ReactNode;\n}\n\nconst FieldsetContext = createContext<{ hasError: boolean }>({ hasError: false });\n\nexport const useFieldsetContext = () => useContext(FieldsetContext);\n\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(function Fieldset(\n {\n className,\n style,\n errorMessage,\n legendProps: { size: legendSize = \"default\", className: legendClassName, ...legendProps } = {},\n legend,\n children,\n ...rest\n },\n ref,\n) {\n const errorMessageId = useId();\n\n return (\n <fieldset\n aria-describedby={errorMessage ? errorMessageId : undefined}\n aria-invalid={errorMessage ? true : undefined}\n className={clsx(\"hds-fieldset\", className as undefined)}\n ref={ref}\n style={style}\n {...rest}\n >\n <legend\n className={clsx(\n \"hds-fieldset__legend\",\n { [`hds-fieldset__legend--${legendSize}`]: legendSize },\n legendClassName as undefined,\n )}\n {...legendProps}\n >\n {legend}\n </legend>\n <FieldsetContext.Provider value={{ hasError: Boolean(errorMessage) }}>\n {children}\n </FieldsetContext.Provider>\n <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage>\n </fieldset>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAA4E;AAC5E,IAAAC,0BAAqB;;;ACDrB,6BAAqB;AACrB,mBAA2C;AAWrC;AAHC,IAAM,mBAAe;AAAA,EAC1B,CAAC,IAAsC,QAAQ;AAA9C,iBAAE,YAAU,IAAI,UAVnB,IAUG,IAA8B,iBAA9B,IAA8B,CAA5B,YAAU,MAAI;AACf,WACE;AAAA,MAAC;AAAA;AAAA,QACC,aAAU;AAAA,QACV,eAAW,6BAAK,qBAAqB,SAAsB;AAAA,QAC3D;AAAA,QACA;AAAA,SACI,OALL;AAAA,QAOE;AAAA;AAAA,IACH;AAAA,EAEJ;A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,MACV,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IA1CN,IAoCI,IAOK,iBAPL,IAOK;AAAA,MANH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF,UAAM,qBAAiB,qBAAM;AAC7B,UAAM,EAAE,UAAU,iBAAiB,IAAI,mBAAmB;AAC1D,UAAM,WAAW,CAAC,CAAC,gBAAgB,oBAAoB;AAEvD,WACE,8CAAC,SAAI,eAAW,8BAAK,sBAAsB,GACzC;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,eAAW;AAAA,YACT;AAAA,YACA;AAAA,cACE,CAAC,iBAAiB,OAAO,EAAE,GAAG,YAAY;AAAA,cAC1C,uBAAuB;AAAA,YACzB;AAAA,YACA;AAAA,UACF;AAAA,UAEA;AAAA,0DAAC,WACC;AAAA;AAAA,gBAAC;AAAA,iDACK,OADL;AAAA,kBAEC,gBAAc,WAAW,OAAO;AAAA,kBAChC,oBAAkB,eAAe,iBAAiB;AAAA,kBAClD;AAAA,kBACA,MAAK;AAAA;AAAA,cACP;AAAA,cACA,6CAAC,UAAK,eAAW,MAAC,WAAU,2BAA0B;AAAA,cACrD,QAAQ,6CAAC,OAAE,WAAU,uBAAuB,iBAAM,IAAO;AAAA,eAC5D;AAAA,YACC,QAAQ,WAAW;AAAA;AAAA;AAAA,MACtB;AAAA,MACC,eAAe,6CAAC,gBAAa,IAAI,gBAAiB,wBAAa,IAAkB;AAAA,OACpF;AAAA,EAEJ;AACF;AACA,SAAS,cAAc;","names":["import_react","import_typed_classname","import_react","import_typed_classname","import_jsx_runtime","Fieldset","import_jsx_runtime"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../../chunk-YJOOSTJC.mjs";
|
|
2
2
|
import {
|
|
3
3
|
Checkbox
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-KI6WRKZY.mjs";
|
|
5
5
|
import "../../chunk-LMF3QGSF.mjs";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-LG7QWKFP.mjs";
|
|
7
7
|
import "../../chunk-NSLSA7F7.mjs";
|
|
8
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-RZZDMBB7.mjs";
|
|
9
9
|
import "../../chunk-R4SQKVDQ.mjs";
|
|
10
10
|
export {
|
|
11
11
|
Checkbox
|