@postenbring/hedwig-react 0.0.87 → 0.0.89
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/badge/badge.d.ts +7 -3
- package/dist/badge/badge.d.ts.map +1 -1
- package/dist/badge/badge.js.map +1 -1
- package/dist/badge/badge.mjs +1 -1
- package/dist/badge/index.js.map +1 -1
- package/dist/badge/index.mjs +1 -1
- package/dist/blockquote/blockquote.d.ts +29 -0
- package/dist/blockquote/blockquote.d.ts.map +1 -0
- package/dist/blockquote/blockquote.js +83 -0
- package/dist/blockquote/blockquote.js.map +1 -0
- package/dist/blockquote/blockquote.mjs +8 -0
- package/dist/blockquote/index.d.ts +3 -0
- package/dist/blockquote/index.d.ts.map +1 -0
- package/dist/blockquote/index.js +85 -0
- package/dist/blockquote/index.js.map +1 -0
- package/dist/blockquote/index.mjs +9 -0
- package/dist/chunk-3H7S7C3S.mjs +37 -0
- package/dist/chunk-3H7S7C3S.mjs.map +1 -0
- package/dist/{chunk-YIERXOCG.mjs → chunk-6ZO2TMOX.mjs} +2 -2
- package/dist/{chunk-F4EAUOJX.mjs → chunk-EAFQ3XQU.mjs} +2 -2
- package/dist/{chunk-OFY2FVXB.mjs → chunk-EGW3RCXD.mjs} +2 -2
- package/dist/chunk-EGW3RCXD.mjs.map +1 -0
- package/dist/{chunk-WEQIEPMT.mjs → chunk-JQGB77SS.mjs} +1 -1
- package/dist/chunk-JQGB77SS.mjs.map +1 -0
- package/dist/chunk-JYN2QSN2.mjs +36 -0
- package/dist/chunk-JYN2QSN2.mjs.map +1 -0
- package/dist/chunk-K2CB2NLY.mjs +1 -0
- package/dist/chunk-KFDS3IPB.mjs +1 -0
- package/dist/{chunk-YLBJMVIX.mjs → chunk-M7MG7ZQT.mjs} +2 -2
- package/dist/chunk-OE6RISJS.mjs +24 -0
- package/dist/chunk-OE6RISJS.mjs.map +1 -0
- package/dist/{chunk-TCO3ZAZW.mjs → chunk-OXZOGFNV.mjs} +1 -1
- package/dist/chunk-OXZOGFNV.mjs.map +1 -0
- package/dist/{chunk-GUNPGSAS.mjs → chunk-UL2V2Z5B.mjs} +12 -12
- package/dist/chunk-UL2V2Z5B.mjs.map +1 -0
- package/dist/chunk-XAFNJELJ.mjs +1 -0
- package/dist/chunk-XAFNJELJ.mjs.map +1 -0
- package/dist/{chunk-ZYTUK4B4.mjs → chunk-YS7HBWOI.mjs} +4 -3
- package/dist/chunk-YS7HBWOI.mjs.map +1 -0
- package/dist/figure/figure.d.ts +22 -0
- package/dist/figure/figure.d.ts.map +1 -0
- package/dist/figure/figure.js +71 -0
- package/dist/figure/figure.js.map +1 -0
- package/dist/figure/figure.mjs +8 -0
- package/dist/figure/figure.mjs.map +1 -0
- package/dist/figure/index.d.ts +3 -0
- package/dist/figure/index.d.ts.map +1 -0
- package/dist/figure/index.js +73 -0
- package/dist/figure/index.js.map +1 -0
- package/dist/figure/index.mjs +9 -0
- package/dist/figure/index.mjs.map +1 -0
- package/dist/form/checkbox/checkbox.js.map +1 -1
- package/dist/form/checkbox/checkbox.mjs +2 -2
- package/dist/form/checkbox/index.js.map +1 -1
- package/dist/form/checkbox/index.mjs +2 -2
- package/dist/form/fieldset/fieldset.d.ts +2 -2
- package/dist/form/fieldset/fieldset.js.map +1 -1
- package/dist/form/fieldset/fieldset.mjs +1 -1
- package/dist/form/fieldset/index.js.map +1 -1
- package/dist/form/fieldset/index.mjs +1 -1
- package/dist/form/index.d.ts +1 -1
- package/dist/form/index.d.ts.map +1 -1
- package/dist/form/index.js +13 -12
- package/dist/form/index.js.map +1 -1
- package/dist/form/index.mjs +17 -17
- package/dist/form/radio-button/index.d.ts +5 -0
- package/dist/form/radio-button/index.d.ts.map +1 -0
- package/dist/form/{radiobutton → radio-button}/index.js +17 -16
- package/dist/form/radio-button/index.js.map +1 -0
- package/dist/form/{radiobutton → radio-button}/index.mjs +6 -6
- package/dist/form/radio-button/index.mjs.map +1 -0
- package/dist/form/{radiobutton/radiobutton.d.ts → radio-button/radio-button.d.ts} +6 -6
- package/dist/form/radio-button/radio-button.d.ts.map +1 -0
- package/dist/form/{radiobutton/radiobutton.js → radio-button/radio-button.js} +17 -16
- package/dist/form/radio-button/radio-button.js.map +1 -0
- package/dist/form/radio-button/radio-button.mjs +13 -0
- package/dist/form/radio-button/radio-button.mjs.map +1 -0
- package/dist/form/{radiobutton/radiogroup.d.ts → radio-button/radio-group.d.ts} +7 -7
- package/dist/form/radio-button/radio-group.d.ts.map +1 -0
- package/dist/form/{radiobutton/radiogroup.js → radio-button/radio-group.js} +7 -6
- package/dist/form/radio-button/radio-group.js.map +1 -0
- package/dist/form/{radiobutton/radiogroup.mjs → radio-button/radio-group.mjs} +3 -3
- package/dist/form/radio-button/radio-group.mjs.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +554 -498
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -66
- package/dist/layout/index.mjs +6 -6
- package/dist/navbar/icons.d.ts.map +1 -1
- package/dist/navbar/icons.js +16 -5
- package/dist/navbar/icons.js.map +1 -1
- package/dist/navbar/icons.mjs +1 -1
- package/dist/navbar/index.js +16 -5
- package/dist/navbar/index.js.map +1 -1
- package/dist/navbar/index.mjs +3 -3
- package/dist/navbar/navbar-expandable-menu.js +16 -5
- package/dist/navbar/navbar-expandable-menu.js.map +1 -1
- package/dist/navbar/navbar-expandable-menu.mjs +2 -2
- package/dist/navbar/navbar.js +16 -5
- package/dist/navbar/navbar.js.map +1 -1
- package/dist/navbar/navbar.mjs +3 -3
- package/dist/styled-html/index.js +1 -1
- package/dist/styled-html/index.js.map +1 -1
- package/dist/styled-html/index.mjs +1 -1
- package/dist/styled-html/styled-html.d.ts +9 -1
- package/dist/styled-html/styled-html.d.ts.map +1 -1
- package/dist/styled-html/styled-html.js +1 -1
- package/dist/styled-html/styled-html.js.map +1 -1
- package/dist/styled-html/styled-html.mjs +1 -1
- package/package.json +4 -4
- package/src/accordion/accordion.stories.tsx +8 -113
- package/src/badge/badge.stories.tsx +2 -30
- package/src/badge/badge.tsx +7 -3
- package/src/blockquote/blockquote.stories.tsx +22 -0
- package/src/blockquote/blockquote.tsx +52 -0
- package/src/blockquote/index.tsx +3 -0
- package/src/box/box.stories.tsx +14 -84
- package/src/breadcrumbs/breadcrumbs.stories.tsx +8 -22
- package/src/button/button.stories.tsx +2 -85
- package/src/card/card.stories.tsx +2 -42
- package/src/description-list/description-list.stories.tsx +6 -71
- package/src/figure/figure.stories.tsx +22 -0
- package/src/figure/figure.tsx +36 -0
- package/src/figure/index.tsx +3 -0
- package/src/form/checkbox/checkbox.stories.tsx +5 -80
- package/src/form/date-picker/date-picker.stories.tsx +8 -7
- package/src/form/error-message/error-message.stories.tsx +3 -2
- package/src/form/fieldset/fieldset.stories.tsx +2 -58
- package/src/form/fieldset/fieldset.tsx +2 -2
- package/src/form/index.tsx +1 -1
- package/src/form/input/input.stories.tsx +2 -142
- package/src/form/radio-button/index.tsx +4 -0
- package/src/form/radio-button/radio-button.stories.tsx +26 -0
- package/src/form/{radiobutton/radiobutton.tsx → radio-button/radio-button.tsx} +13 -13
- package/src/form/{radiobutton/radiogroup.stories.tsx → radio-button/radio-group.stories.tsx} +9 -9
- package/src/form/{radiobutton/radiogroup.tsx → radio-button/radio-group.tsx} +7 -6
- package/src/form/select/select.stories.tsx +2 -61
- package/src/form/textarea/textarea.stories.tsx +5 -85
- package/src/help-text/help-text.stories.tsx +20 -0
- package/src/index.ts +2 -0
- package/src/layout/container/container.stories.tsx +18 -14
- package/src/layout/grid/grid.stories.tsx +28 -0
- package/src/layout/stack/stack.stories.tsx +28 -0
- package/src/link/link.stories.tsx +8 -38
- package/src/list/link-list.stories.tsx +25 -27
- package/src/list/list.stories.tsx +11 -48
- package/src/message/message.stories.tsx +8 -65
- package/src/modal/modal.stories.tsx +2 -103
- package/src/navbar/icons.tsx +10 -3
- package/src/navbar/navbar.stories.tsx +23 -62
- package/src/show-more/show-more.stories.tsx +3 -98
- package/src/skeleton/skeleton.stories.tsx +3 -126
- package/src/step-indicator/step-indicator.stories.tsx +2 -31
- package/src/styled-html/styled-html.stories.tsx +22 -155
- package/src/styled-html/styled-html.tsx +12 -2
- package/src/table/table.stories.tsx +43 -0
- package/src/tabs/tabs.stories.tsx +8 -114
- package/src/text/text.stories.tsx +18 -83
- package/src/warning-banner/warning-banner.stories.tsx +2 -23
- package/dist/chunk-2KX7VFN2.mjs +0 -1
- package/dist/chunk-GUNPGSAS.mjs.map +0 -1
- package/dist/chunk-MOU6WBT2.mjs +0 -26
- package/dist/chunk-MOU6WBT2.mjs.map +0 -1
- package/dist/chunk-OFY2FVXB.mjs.map +0 -1
- package/dist/chunk-TCO3ZAZW.mjs.map +0 -1
- package/dist/chunk-WEQIEPMT.mjs.map +0 -1
- package/dist/chunk-ZYTUK4B4.mjs.map +0 -1
- package/dist/form/radiobutton/index.d.ts +0 -5
- package/dist/form/radiobutton/index.d.ts.map +0 -1
- package/dist/form/radiobutton/index.js.map +0 -1
- package/dist/form/radiobutton/radiobutton.d.ts.map +0 -1
- package/dist/form/radiobutton/radiobutton.js.map +0 -1
- package/dist/form/radiobutton/radiobutton.mjs +0 -13
- package/dist/form/radiobutton/radiogroup.d.ts.map +0 -1
- package/dist/form/radiobutton/radiogroup.js.map +0 -1
- package/src/form/radiobutton/index.tsx +0 -4
- package/src/form/radiobutton/radiobutton.stories.tsx +0 -93
- /package/dist/{chunk-2KX7VFN2.mjs.map → blockquote/blockquote.mjs.map} +0 -0
- /package/dist/{form/radiobutton → blockquote}/index.mjs.map +0 -0
- /package/dist/{chunk-YIERXOCG.mjs.map → chunk-6ZO2TMOX.mjs.map} +0 -0
- /package/dist/{chunk-F4EAUOJX.mjs.map → chunk-EAFQ3XQU.mjs.map} +0 -0
- /package/dist/{form/radiobutton/radiobutton.mjs.map → chunk-K2CB2NLY.mjs.map} +0 -0
- /package/dist/{form/radiobutton/radiogroup.mjs.map → chunk-KFDS3IPB.mjs.map} +0 -0
- /package/dist/{chunk-YLBJMVIX.mjs.map → chunk-M7MG7ZQT.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-XAFNJELJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Fieldset
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JQGB77SS.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadProps,
|
|
7
7
|
__spreadValues
|
|
8
8
|
} from "./chunk-YOSPWY5K.mjs";
|
|
9
9
|
|
|
10
|
-
// src/form/
|
|
10
|
+
// src/form/radio-button/radio-group.tsx
|
|
11
11
|
import {
|
|
12
12
|
createContext,
|
|
13
13
|
forwardRef,
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
} from "react";
|
|
16
16
|
import { jsx } from "react/jsx-runtime";
|
|
17
17
|
var RadioGroupContext = createContext({
|
|
18
|
+
name: void 0,
|
|
18
19
|
hasError: false,
|
|
19
20
|
onChange: () => {
|
|
20
21
|
return void 0;
|
|
@@ -31,4 +32,4 @@ export {
|
|
|
31
32
|
useRadioGroupContext,
|
|
32
33
|
RadioGroup
|
|
33
34
|
};
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
//# sourceMappingURL=chunk-YS7HBWOI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/form/radio-button/radio-group.tsx"],"sourcesContent":["import {\n type ChangeEventHandler,\n createContext,\n forwardRef,\n type ReactNode,\n useContext,\n} from \"react\";\nimport { Fieldset, type FieldsetProps } from \"../fieldset\";\nimport type { RadioButtonProps } from \"./radio-button\";\n\nexport interface RadioGroupProps extends Omit<FieldsetProps, \"onChange\"> {\n children: ReactNode;\n /** Will be passed to all Radio buttons within the radio group */\n name?: RadioButtonProps[\"name\"];\n /** If you want the group to be controlled, you can pass the selected value here */\n value?: RadioButtonProps[\"value\"];\n /**\n * Error message is passed to the internal Fieldset, and will also give contained Radio buttons\n * error styling and aria to indicate invalid state.\n */\n errorMessage?: ReactNode;\n /** Will be passed to all Radio buttons within the radio group */\n onChange?: ChangeEventHandler<HTMLInputElement> | undefined;\n}\n\ntype RadioGroupContextProps = {\n hasError: boolean;\n} & Pick<RadioGroupProps, \"name\" | \"value\" | \"onChange\">;\n\nconst RadioGroupContext = createContext<RadioGroupContextProps>({\n name: undefined,\n hasError: false,\n onChange: () => {\n return undefined;\n },\n});\n\nexport const useRadioGroupContext = () => useContext(RadioGroupContext);\n\nexport const RadioGroup = forwardRef<HTMLFieldSetElement, RadioGroupProps>(function RadioGroup(\n { name, value, errorMessage, onChange, children, ...rest },\n ref,\n) {\n return (\n <RadioGroupContext.Provider value={{ name, value, hasError: Boolean(errorMessage), onChange }}>\n <Fieldset errorMessage={errorMessage} {...rest} ref={ref}>\n {children}\n </Fieldset>\n </RadioGroupContext.Provider>\n );\n});\n\nRadioGroup.displayName = \"RadioGroup\";\n"],"mappings":";;;;;;;;;;AAAA;AAAA,EAEE;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAuCD;AAhBN,IAAM,oBAAoB,cAAsC;AAAA,EAC9D,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU,MAAM;AACd,WAAO;AAAA,EACT;AACF,CAAC;AAEM,IAAM,uBAAuB,MAAM,WAAW,iBAAiB;AAE/D,IAAM,aAAa,WAAiD,SAASA,YAClF,IACA,KACA;AAFA,eAAE,QAAM,OAAO,cAAc,UAAU,SAxCzC,IAwCE,IAAoD,iBAApD,IAAoD,CAAlD,QAAM,SAAO,gBAAc,YAAU;AAGvC,SACE,oBAAC,kBAAkB,UAAlB,EAA2B,OAAO,EAAE,MAAM,OAAO,UAAU,QAAQ,YAAY,GAAG,SAAS,GAC1F,8BAAC,yCAAS,gBAAgC,OAAzC,EAA+C,KAC7C,WACH,GACF;AAEJ,CAAC;AAED,WAAW,cAAc;","names":["RadioGroup"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface FigureProps extends React.HTMLAttributes<HTMLQuoteElement> {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
6
|
+
*
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @example
|
|
13
|
+
*
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Figure>
|
|
16
|
+
* <img src="https://placedog.net/500/280" alt="A very good dog" />
|
|
17
|
+
* <figcaption>Dogs are the best</figcaption>
|
|
18
|
+
* </Figure>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const Figure: import("react").ForwardRefExoticComponent<FigureProps & import("react").RefAttributes<HTMLQuoteElement>>;
|
|
22
|
+
//# sourceMappingURL=figure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figure.d.ts","sourceRoot":"","sources":["../../src/figure/figure.tsx"],"names":[],"mappings":";AAIA,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC;IACzE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,0GASlB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
var __export = (target, all) => {
|
|
36
|
+
for (var name in all)
|
|
37
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
38
|
+
};
|
|
39
|
+
var __copyProps = (to, from, except, desc) => {
|
|
40
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
+
for (let key of __getOwnPropNames(from))
|
|
42
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
+
}
|
|
45
|
+
return to;
|
|
46
|
+
};
|
|
47
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
|
+
|
|
49
|
+
// src/figure/figure.tsx
|
|
50
|
+
var figure_exports = {};
|
|
51
|
+
__export(figure_exports, {
|
|
52
|
+
Figure: () => Figure
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(figure_exports);
|
|
55
|
+
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
|
|
56
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
57
|
+
var import_react = require("react");
|
|
58
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
59
|
+
var Figure = (0, import_react.forwardRef)(
|
|
60
|
+
(_a, ref) => {
|
|
61
|
+
var _b = _a, { children, asChild, className } = _b, rest = __objRest(_b, ["children", "asChild", "className"]);
|
|
62
|
+
const Component = asChild ? import_react_slot.Slot : "figure";
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, __spreadProps(__spreadValues({ ref, className: (0, import_typed_classname.clsx)("hds-figure", className) }, rest), { children }));
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
Figure.displayName = "Figure";
|
|
67
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
+
0 && (module.exports = {
|
|
69
|
+
Figure
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=figure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/figure/figure.tsx"],"sourcesContent":["import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { forwardRef } from \"react\";\n\nexport interface FigureProps extends React.HTMLAttributes<HTMLQuoteElement> {\n children?: React.ReactNode;\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\n/**\n * @example\n *\n * ```tsx\n * <Figure>\n * <img src=\"https://placedog.net/500/280\" alt=\"A very good dog\" />\n * <figcaption>Dogs are the best</figcaption>\n * </Figure>\n * ```\n */\nexport const Figure = forwardRef<HTMLQuoteElement, FigureProps>(\n ({ children, asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"figure\";\n return (\n <Component ref={ref} className={clsx(\"hds-figure\", className as undefined)} {...rest}>\n {children}\n </Component>\n );\n },\n);\nFigure.displayName = \"Figure\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAqB;AACrB,wBAAqB;AACrB,mBAA2B;AA2BrB;AAJC,IAAM,aAAS;AAAA,EACpB,CAAC,IAA2C,QAAQ;AAAnD,iBAAE,YAAU,SAAS,UA1BxB,IA0BG,IAAmC,iBAAnC,IAAmC,CAAjC,YAAU,WAAS;AACpB,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE,4CAAC,0CAAU,KAAU,eAAW,6BAAK,cAAc,SAAsB,KAAO,OAA/E,EACE,WACH;AAAA,EAEJ;AACF;AACA,OAAO,cAAc;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/figure/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,mBAAmB,UAAU,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
var __export = (target, all) => {
|
|
36
|
+
for (var name in all)
|
|
37
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
38
|
+
};
|
|
39
|
+
var __copyProps = (to, from, except, desc) => {
|
|
40
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
+
for (let key of __getOwnPropNames(from))
|
|
42
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
+
}
|
|
45
|
+
return to;
|
|
46
|
+
};
|
|
47
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
|
+
|
|
49
|
+
// src/figure/index.tsx
|
|
50
|
+
var figure_exports = {};
|
|
51
|
+
__export(figure_exports, {
|
|
52
|
+
Figure: () => Figure
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(figure_exports);
|
|
55
|
+
|
|
56
|
+
// src/figure/figure.tsx
|
|
57
|
+
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
|
|
58
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
59
|
+
var import_react = require("react");
|
|
60
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
61
|
+
var Figure = (0, import_react.forwardRef)(
|
|
62
|
+
(_a, ref) => {
|
|
63
|
+
var _b = _a, { children, asChild, className } = _b, rest = __objRest(_b, ["children", "asChild", "className"]);
|
|
64
|
+
const Component = asChild ? import_react_slot.Slot : "figure";
|
|
65
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, __spreadProps(__spreadValues({ ref, className: (0, import_typed_classname.clsx)("hds-figure", className) }, rest), { children }));
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
Figure.displayName = "Figure";
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
71
|
+
Figure
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/figure/index.tsx","../../src/figure/figure.tsx"],"sourcesContent":["export { Figure } from \"./figure\";\n\nexport type * from \"./figure\";\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { forwardRef } from \"react\";\n\nexport interface FigureProps extends React.HTMLAttributes<HTMLQuoteElement> {\n children?: React.ReactNode;\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\n/**\n * @example\n *\n * ```tsx\n * <Figure>\n * <img src=\"https://placedog.net/500/280\" alt=\"A very good dog\" />\n * <figcaption>Dogs are the best</figcaption>\n * </Figure>\n * ```\n */\nexport const Figure = forwardRef<HTMLQuoteElement, FigureProps>(\n ({ children, asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"figure\";\n return (\n <Component ref={ref} className={clsx(\"hds-figure\", className as undefined)} {...rest}>\n {children}\n </Component>\n );\n },\n);\nFigure.displayName = \"Figure\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,6BAAqB;AACrB,wBAAqB;AACrB,mBAA2B;AA2BrB;AAJC,IAAM,aAAS;AAAA,EACpB,CAAC,IAA2C,QAAQ;AAAnD,iBAAE,YAAU,SAAS,UA1BxB,IA0BG,IAAmC,iBAAnC,IAAmC,CAAjC,YAAU,WAAS;AACpB,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE,4CAAC,0CAAU,KAAU,eAAW,6BAAK,cAAc,SAAsB,KAAO,OAA/E,EACE,WACH;AAAA,EAEJ;AACF;AACA,OAAO,cAAc;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -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 }, 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
|
|
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 Radio buttons\n * error styling and aria to indicate invalid state.\n *\n * For Radio buttons 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,IAA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EAAE,UAAU,QAAQ,YAAY,EAAE,GAChE,UACH;AAAA,QACA,6CAAC,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,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Checkbox
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-EAFQ3XQU.mjs";
|
|
4
4
|
import "../../chunk-LMF3QGSF.mjs";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-JQGB77SS.mjs";
|
|
6
6
|
import "../../chunk-NSLSA7F7.mjs";
|
|
7
7
|
import "../../chunk-CC5QWW52.mjs";
|
|
8
8
|
import "../../chunk-YOSPWY5K.mjs";
|
|
@@ -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 }, 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
|
|
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 Radio buttons\n * error styling and aria to indicate invalid state.\n *\n * For Radio buttons 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;AACF;AACA,aAAa,cAAc;;;ACxB3B,IAAAC,gBAA6D;AAE7D,IAAAC,0BAAqB;AAqCjB,IAAAC,sBAAA;AAnBJ,IAAM,sBAAkB,6BAAqC,EAAE,UAAU,MAAM,CAAC;AAEzE,IAAM,qBAAqB,UAAM,0BAAW,eAAe;AAE3D,IAAM,eAAW,0BAA+C,SAASC,UAC9E,IASA,KACA;AAVA,eAIe;AAAA,IAHb;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa,KAA+E,CAAC;AAAA,EA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AAK,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,9 +1,9 @@
|
|
|
1
1
|
import "../../chunk-YJOOSTJC.mjs";
|
|
2
2
|
import {
|
|
3
3
|
Checkbox
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-EAFQ3XQU.mjs";
|
|
5
5
|
import "../../chunk-LMF3QGSF.mjs";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-JQGB77SS.mjs";
|
|
7
7
|
import "../../chunk-NSLSA7F7.mjs";
|
|
8
8
|
import "../../chunk-CC5QWW52.mjs";
|
|
9
9
|
import "../../chunk-YOSPWY5K.mjs";
|
|
@@ -3,10 +3,10 @@ export interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElemen
|
|
|
3
3
|
className?: string;
|
|
4
4
|
style?: CSSProperties;
|
|
5
5
|
/**
|
|
6
|
-
* Providing an errorMessage will also give contained Checkboxes or
|
|
6
|
+
* Providing an errorMessage will also give contained Checkboxes or Radio buttons
|
|
7
7
|
* error styling and aria to indicate invalid state.
|
|
8
8
|
*
|
|
9
|
-
* For
|
|
9
|
+
* For Radio buttons you are even better off using RadioGroup.
|
|
10
10
|
*/
|
|
11
11
|
errorMessage?: ReactNode;
|
|
12
12
|
legendProps?: HTMLAttributes<HTMLElement> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/fieldset/fieldset.tsx","../../../src/form/error-message/error-message.tsx"],"sourcesContent":["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
|
|
1
|
+
{"version":3,"sources":["../../../src/form/fieldset/fieldset.tsx","../../../src/form/error-message/error-message.tsx"],"sourcesContent":["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 Radio buttons\n * error styling and aria to indicate invalid state.\n *\n * For Radio buttons 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","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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA6D;AAE7D,IAAAC,0BAAqB;;;ACFrB,6BAAqB;AACrB,mBAA2C;AAWrC;AAHC,IAAM,mBAAe;AAAA,EAC1B,CAAC,IAAsC,QAAQ;AAA9C,iBAAE,YAAU,IAAI,UAVnB,IAUG,IAA8B,iBAA9B,IAA8B,CAA5B,YAAU,MA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AA,EAClD;AAEJ,CAAC;","names":["import_react","import_typed_classname","import_jsx_runtime","Fieldset"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/fieldset/index.tsx","../../../src/form/fieldset/fieldset.tsx","../../../src/form/error-message/error-message.tsx"],"sourcesContent":["export { Fieldset, useFieldsetContext } from \"./fieldset\";\nexport type * from \"./fieldset\";\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
|
|
1
|
+
{"version":3,"sources":["../../../src/form/fieldset/index.tsx","../../../src/form/fieldset/fieldset.tsx","../../../src/form/error-message/error-message.tsx"],"sourcesContent":["export { Fieldset, useFieldsetContext } from \"./fieldset\";\nexport type * from \"./fieldset\";\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 Radio buttons\n * error styling and aria to indicate invalid state.\n *\n * For Radio buttons 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","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;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAA6D;AAE7D,IAAAC,0BAAqB;;;ACFrB,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;A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runtime","Fieldset"]}
|
package/dist/form/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export * from "./date-picker";
|
|
|
3
3
|
export * from "./error-message";
|
|
4
4
|
export * from "./fieldset";
|
|
5
5
|
export * from "./input";
|
|
6
|
-
export * from "./
|
|
6
|
+
export * from "./radio-button";
|
|
7
7
|
export * from "./select";
|
|
8
8
|
export * from "./textarea";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/form/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form/index.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form/index.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
package/dist/form/index.js
CHANGED
|
@@ -64,8 +64,8 @@ __export(form_exports, {
|
|
|
64
64
|
ErrorMessage: () => ErrorMessage,
|
|
65
65
|
Fieldset: () => Fieldset,
|
|
66
66
|
Input: () => Input,
|
|
67
|
+
RadioButton: () => RadioButton,
|
|
67
68
|
RadioGroup: () => RadioGroup,
|
|
68
|
-
Radiobutton: () => Radiobutton,
|
|
69
69
|
Select: () => Select,
|
|
70
70
|
Textarea: () => Textarea,
|
|
71
71
|
useFieldsetContext: () => useFieldsetContext,
|
|
@@ -415,14 +415,15 @@ var Input = (0, import_react7.forwardRef)(function Input2(_a, ref) {
|
|
|
415
415
|
});
|
|
416
416
|
Input.displayName = "Input";
|
|
417
417
|
|
|
418
|
-
// src/form/
|
|
418
|
+
// src/form/radio-button/radio-button.tsx
|
|
419
419
|
var import_react9 = require("react");
|
|
420
420
|
var import_typed_classname7 = require("@postenbring/hedwig-css/typed-classname");
|
|
421
421
|
|
|
422
|
-
// src/form/
|
|
422
|
+
// src/form/radio-button/radio-group.tsx
|
|
423
423
|
var import_react8 = require("react");
|
|
424
424
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
425
425
|
var RadioGroupContext = (0, import_react8.createContext)({
|
|
426
|
+
name: void 0,
|
|
426
427
|
hasError: false,
|
|
427
428
|
onChange: () => {
|
|
428
429
|
return void 0;
|
|
@@ -435,7 +436,7 @@ var RadioGroup = (0, import_react8.forwardRef)(function RadioGroup2(_a, ref) {
|
|
|
435
436
|
});
|
|
436
437
|
RadioGroup.displayName = "RadioGroup";
|
|
437
438
|
|
|
438
|
-
// src/form/
|
|
439
|
+
// src/form/radio-button/radio-button.tsx
|
|
439
440
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
440
441
|
var isChecked = ({
|
|
441
442
|
checked,
|
|
@@ -446,7 +447,7 @@ var isChecked = ({
|
|
|
446
447
|
if (typeof selectedValue !== "undefined") return value === selectedValue;
|
|
447
448
|
return void 0;
|
|
448
449
|
};
|
|
449
|
-
var
|
|
450
|
+
var RadioButton = (0, import_react9.forwardRef)(
|
|
450
451
|
(_a, ref) => {
|
|
451
452
|
var _b = _a, {
|
|
452
453
|
checked,
|
|
@@ -478,10 +479,10 @@ var Radiobutton = (0, import_react9.forwardRef)(
|
|
|
478
479
|
"div",
|
|
479
480
|
{
|
|
480
481
|
className: (0, import_typed_classname7.clsx)(
|
|
481
|
-
"hds-
|
|
482
|
+
"hds-radio-button",
|
|
482
483
|
{
|
|
483
|
-
[`hds-
|
|
484
|
-
"hds-
|
|
484
|
+
[`hds-radio-button--${variant}`]: variant === "bounding-box",
|
|
485
|
+
"hds-radio-button--error": hasError
|
|
485
486
|
},
|
|
486
487
|
className
|
|
487
488
|
),
|
|
@@ -496,8 +497,8 @@ var Radiobutton = (0, import_react9.forwardRef)(
|
|
|
496
497
|
type: "radio"
|
|
497
498
|
})
|
|
498
499
|
),
|
|
499
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "aria-hidden": true, className: "hds-
|
|
500
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "hds-
|
|
500
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "aria-hidden": true, className: "hds-radio-button__checkmark" }),
|
|
501
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "hds-radio-button__title", children: title }) : children
|
|
501
502
|
] }),
|
|
502
503
|
title ? children : null
|
|
503
504
|
]
|
|
@@ -505,7 +506,7 @@ var Radiobutton = (0, import_react9.forwardRef)(
|
|
|
505
506
|
);
|
|
506
507
|
}
|
|
507
508
|
);
|
|
508
|
-
|
|
509
|
+
RadioButton.displayName = "RadioButton";
|
|
509
510
|
|
|
510
511
|
// src/form/select/select.tsx
|
|
511
512
|
var import_react10 = require("react");
|
|
@@ -560,8 +561,8 @@ Textarea.displayName = "Textarea";
|
|
|
560
561
|
ErrorMessage,
|
|
561
562
|
Fieldset,
|
|
562
563
|
Input,
|
|
564
|
+
RadioButton,
|
|
563
565
|
RadioGroup,
|
|
564
|
-
Radiobutton,
|
|
565
566
|
Select,
|
|
566
567
|
Textarea,
|
|
567
568
|
useFieldsetContext,
|