@postenbring/hedwig-react 0.0.64 → 0.0.65
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 +171 -19
- package/dist/_tsup-dts-rollup.d.ts +171 -19
- package/dist/accordion/accordion-content.js +5 -9
- package/dist/accordion/accordion-content.js.map +1 -1
- package/dist/accordion/accordion-content.mjs +1 -1
- package/dist/accordion/accordion-header.js +6 -9
- package/dist/accordion/accordion-header.js.map +1 -1
- package/dist/accordion/accordion-header.mjs +1 -1
- package/dist/accordion/accordion-item.js +2 -7
- package/dist/accordion/accordion-item.js.map +1 -1
- package/dist/accordion/accordion-item.mjs +1 -1
- package/dist/accordion/index.js +13 -25
- package/dist/accordion/index.js.map +1 -1
- package/dist/accordion/index.mjs +4 -4
- package/dist/{chunk-SAGJ5W7M.mjs → chunk-62F4I3MQ.mjs} +3 -8
- package/dist/{chunk-SAGJ5W7M.mjs.map → chunk-62F4I3MQ.mjs.map} +1 -1
- package/dist/{chunk-BYDSISQZ.mjs → chunk-A47QULAK.mjs} +2 -2
- package/dist/{chunk-BYDSISQZ.mjs.map → chunk-A47QULAK.mjs.map} +1 -1
- package/dist/{chunk-2E6XPNPX.mjs → chunk-DEVTAZKG.mjs} +8 -6
- package/dist/chunk-DEVTAZKG.mjs.map +1 -0
- package/dist/chunk-EHUVLDIZ.mjs +121 -0
- package/dist/chunk-EHUVLDIZ.mjs.map +1 -0
- package/dist/{chunk-KRGKVH5J.mjs → chunk-GUB3UCXO.mjs} +6 -10
- package/dist/chunk-GUB3UCXO.mjs.map +1 -0
- package/dist/{chunk-37WVYY6X.mjs → chunk-HXV2UMEV.mjs} +6 -3
- package/dist/chunk-HXV2UMEV.mjs.map +1 -0
- package/dist/chunk-KQITCS3U.mjs +18 -0
- package/dist/chunk-KQITCS3U.mjs.map +1 -0
- package/dist/{chunk-DJRMXOCP.mjs → chunk-LIQ3FB56.mjs} +8 -8
- package/dist/chunk-MUVJAMFN.mjs +104 -0
- package/dist/chunk-MUVJAMFN.mjs.map +1 -0
- package/dist/{chunk-WGVZWX5L.mjs → chunk-RLUXDZ6X.mjs} +14 -4
- package/dist/chunk-RLUXDZ6X.mjs.map +1 -0
- package/dist/{chunk-H3VGHTDC.mjs → chunk-TE5M6GJB.mjs} +2 -2
- package/dist/chunk-TE5M6GJB.mjs.map +1 -0
- package/dist/chunk-U2MRMUB2.mjs +19 -0
- package/dist/chunk-U2MRMUB2.mjs.map +1 -0
- package/dist/{chunk-EJADADIY.mjs → chunk-UWTGHSWT.mjs} +6 -9
- package/dist/chunk-UWTGHSWT.mjs.map +1 -0
- package/dist/{chunk-5MDJP43L.mjs → chunk-VFFIUNR6.mjs} +7 -7
- package/dist/chunk-X7EKQZNU.mjs +76 -0
- package/dist/chunk-X7EKQZNU.mjs.map +1 -0
- package/dist/{chunk-V4NGUB4I.mjs → chunk-XFSZBILE.mjs} +2 -2
- package/dist/chunk-XFSZBILE.mjs.map +1 -0
- package/dist/{chunk-MBBFU4IR.mjs → chunk-XVFQWVHO.mjs} +3 -9
- package/dist/{chunk-MBBFU4IR.mjs.map → chunk-XVFQWVHO.mjs.map} +1 -1
- package/dist/chunk-YWNVB7TY.mjs +1 -0
- package/dist/{chunk-FT5CX2W5.mjs → chunk-YXHXRUFX.mjs} +7 -10
- package/dist/chunk-YXHXRUFX.mjs.map +1 -0
- package/dist/footer/footer.d.mts +7 -0
- package/dist/footer/footer.d.ts +7 -0
- package/dist/footer/footer.js +404 -0
- package/dist/footer/footer.js.map +1 -0
- package/dist/footer/footer.mjs +26 -0
- package/dist/footer/footer.mjs.map +1 -0
- package/dist/footer/index.d.mts +7 -0
- package/dist/footer/index.d.ts +7 -0
- package/dist/footer/index.js +405 -0
- package/dist/footer/index.js.map +1 -0
- package/dist/footer/index.mjs +19 -0
- package/dist/footer/index.mjs.map +1 -0
- package/dist/form/checkbox/checkbox.js +122 -24
- package/dist/form/checkbox/checkbox.js.map +1 -1
- package/dist/form/checkbox/checkbox.mjs +5 -1
- package/dist/form/checkbox/index.js +122 -24
- package/dist/form/checkbox/index.js.map +1 -1
- package/dist/form/checkbox/index.mjs +5 -1
- package/dist/form/fieldset/fieldset.d.mts +1 -0
- package/dist/form/fieldset/fieldset.d.ts +1 -0
- package/dist/form/fieldset/fieldset.js +7 -3
- package/dist/form/fieldset/fieldset.js.map +1 -1
- package/dist/form/fieldset/fieldset.mjs +5 -3
- package/dist/form/fieldset/index.d.mts +1 -0
- package/dist/form/fieldset/index.d.ts +1 -0
- package/dist/form/fieldset/index.js +7 -3
- package/dist/form/fieldset/index.js.map +1 -1
- package/dist/form/fieldset/index.mjs +5 -3
- package/dist/form/index.d.mts +2 -1
- package/dist/form/index.d.ts +2 -1
- package/dist/form/index.js +68 -27
- package/dist/form/index.js.map +1 -1
- package/dist/form/index.mjs +17 -13
- package/dist/form/radiobutton/index.d.mts +1 -1
- package/dist/form/radiobutton/index.d.ts +1 -1
- package/dist/form/radiobutton/index.js +17 -8
- package/dist/form/radiobutton/index.js.map +1 -1
- package/dist/form/radiobutton/index.mjs +7 -5
- package/dist/form/radiobutton/radiobutton.js +13 -6
- package/dist/form/radiobutton/radiobutton.js.map +1 -1
- package/dist/form/radiobutton/radiobutton.mjs +3 -3
- package/dist/form/radiobutton/radiogroup.js +2 -1
- package/dist/form/radiobutton/radiogroup.js.map +1 -1
- package/dist/form/radiobutton/radiogroup.mjs +2 -2
- package/dist/index-no-css.d.mts +10 -1
- package/dist/index-no-css.d.ts +10 -1
- package/dist/index-no-css.js +468 -307
- package/dist/index-no-css.js.map +1 -1
- package/dist/index-no-css.mjs +58 -46
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +468 -307
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -46
- package/dist/index.mjs.map +1 -1
- package/dist/navbar/index.d.mts +1 -0
- package/dist/navbar/index.d.ts +1 -0
- package/dist/navbar/index.js +10 -7
- package/dist/navbar/index.js.map +1 -1
- package/dist/navbar/index.mjs +7 -4
- package/dist/navbar/navbar-expandable-menu.d.mts +1 -0
- package/dist/navbar/navbar-expandable-menu.d.ts +1 -0
- package/dist/navbar/navbar-expandable-menu.js +10 -7
- package/dist/navbar/navbar-expandable-menu.js.map +1 -1
- package/dist/navbar/navbar-expandable-menu.mjs +5 -3
- package/dist/skeleton/index.js +1 -1
- package/dist/skeleton/index.js.map +1 -1
- package/dist/skeleton/index.mjs +1 -1
- package/dist/skeleton/skeleton.js +1 -1
- package/dist/skeleton/skeleton.js.map +1 -1
- package/dist/skeleton/skeleton.mjs +1 -1
- package/dist/tabs/context.d.mts +1 -0
- package/dist/tabs/context.d.ts +1 -0
- package/dist/tabs/context.js +13 -8
- package/dist/tabs/context.js.map +1 -1
- package/dist/tabs/context.mjs +5 -3
- package/dist/tabs/index.js +46 -28
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/index.mjs +5 -5
- package/dist/tabs/tabs-content.js +11 -11
- package/dist/tabs/tabs-content.js.map +1 -1
- package/dist/tabs/tabs-content.mjs +2 -2
- package/dist/tabs/tabs-list.js +43 -16
- package/dist/tabs/tabs-list.js.map +1 -1
- package/dist/tabs/tabs-list.mjs +2 -2
- package/dist/tabs/tabs.js +2 -14
- package/dist/tabs/tabs.js.map +1 -1
- package/dist/tabs/tabs.mjs +2 -2
- package/package.json +3 -3
- package/dist/chunk-2E6XPNPX.mjs.map +0 -1
- package/dist/chunk-33JD5XDW.mjs +0 -14
- package/dist/chunk-33JD5XDW.mjs.map +0 -1
- package/dist/chunk-37WVYY6X.mjs.map +0 -1
- package/dist/chunk-EJADADIY.mjs.map +0 -1
- package/dist/chunk-FT5CX2W5.mjs.map +0 -1
- package/dist/chunk-H3VGHTDC.mjs.map +0 -1
- package/dist/chunk-H4GIHEB2.mjs +0 -1
- package/dist/chunk-KRGKVH5J.mjs.map +0 -1
- package/dist/chunk-PXHYOQPB.mjs +0 -42
- package/dist/chunk-PXHYOQPB.mjs.map +0 -1
- package/dist/chunk-V4NGUB4I.mjs.map +0 -1
- package/dist/chunk-WGVZWX5L.mjs.map +0 -1
- package/dist/chunk-XVZ44NGD.mjs +0 -80
- package/dist/chunk-XVZ44NGD.mjs.map +0 -1
- /package/dist/{chunk-DJRMXOCP.mjs.map → chunk-LIQ3FB56.mjs.map} +0 -0
- /package/dist/{chunk-5MDJP43L.mjs.map → chunk-VFFIUNR6.mjs.map} +0 -0
- /package/dist/{chunk-H4GIHEB2.mjs.map → chunk-YWNVB7TY.mjs.map} +0 -0
package/dist/form/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/form/index.tsx","../../src/form/fieldset/fieldset.tsx","../../src/form/error-message/error-message.tsx","../../src/form/input/input.tsx","../../src/form/input-group/input-group.tsx","../../src/form/select/select.tsx","../../src/form/textarea/textarea.tsx","../../src/form/checkbox/checkbox.tsx","../../src/form/radiobutton/radiobutton.tsx","../../src/form/radiobutton/radiogroup.tsx"],"sourcesContent":["export * from \"./fieldset\";\nexport * from \"./input\";\nexport * from \"./select\";\nexport * from \"./textarea\";\nexport * from \"./checkbox\";\nexport * from \"./radiobutton\";\nexport * from \"./error-message\";\n","import { useId, forwardRef } 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 errorMessage?: ReactNode;\n legendProps?: HTMLAttributes<HTMLElement> & { size: \"default\" | \"large\" };\n legend: ReactNode;\n children: ReactNode;\n}\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 <div className={clsx(\"hds-fieldset__input-wrapper\")}>{children}</div>\n <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage>\n </fieldset>\n );\n});\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport type { ReactNode } from \"react\";\n\nexport interface ErrorMessageProps {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport function ErrorMessage({ children, id, className }: ErrorMessageProps) {\n return (\n <div\n aria-live=\"assertive\"\n className={clsx(\"hds-error-message\", className as undefined)}\n id={id}\n >\n {children}\n </div>\n );\n}\n","import { forwardRef } from \"react\";\nimport type { InputHTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { InputGroup } from \"../input-group\";\nimport type { InputGroupProps } from \"../input-group\";\n\nexport type InputProps = Omit<InputGroupProps & InputHTMLAttributes<HTMLInputElement>, \"children\">;\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n { className, variant, errorMessage, labelProps, label, id, style, disabled, readOnly, ...rest },\n ref,\n) {\n return (\n <InputGroup\n className={clsx(\"hds-input\", className as undefined)}\n disabled={disabled}\n errorMessage={errorMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n readOnly={readOnly}\n style={style}\n variant={variant}\n >\n <input {...rest} disabled={disabled} readOnly={readOnly} ref={ref} />\n </InputGroup>\n );\n});\n\nInput.displayName = \"Input\";\n","import { useId, forwardRef, Children, isValidElement, cloneElement } from \"react\";\nimport type { LabelHTMLAttributes, ReactNode, CSSProperties } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ErrorMessage } from \"../error-message\";\n\ninterface InputProps {\n \"aria-describedby\"?: string;\n \"aria-invalid\"?: boolean;\n id?: string;\n className?: string;\n}\n\nexport interface InputGroupProps {\n id?: string;\n className?: string;\n style?: CSSProperties;\n variant?: \"default\" | \"white\";\n errorMessage?: ReactNode;\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>;\n label: ReactNode;\n disabled?: boolean;\n readOnly?: boolean;\n children: ReactNode;\n}\n\nexport const InputGroup = forwardRef<HTMLDivElement, InputGroupProps>(function InputGroup(\n {\n id,\n className,\n style,\n variant = \"default\",\n errorMessage,\n labelProps: { className: labelClassName, ...labelProps } = {},\n label,\n disabled,\n readOnly,\n children,\n ...rest\n },\n ref,\n) {\n const errorMessageId = useId();\n const inputId = useId();\n\n const renderInput = () => {\n const input = Children.toArray(children)[0];\n\n if (!isValidElement<InputProps>(input)) {\n return;\n }\n\n return cloneElement<InputProps>(input, {\n \"aria-describedby\": errorMessage ? errorMessageId : undefined,\n \"aria-invalid\": errorMessage ? true : undefined,\n id: id ?? inputId,\n ...input.props,\n className: clsx(\"hds-input-group__input\", input.props.className as undefined),\n });\n };\n\n return (\n <div\n className={clsx(\n \"hds-input-group\",\n {\n [`hds-input-group--${variant}`]: variant,\n \"hds-input-group--error\": errorMessage,\n },\n className as undefined,\n )}\n ref={ref}\n style={style}\n {...rest}\n >\n <label\n className={clsx(\"hds-input-group__label\", labelClassName as undefined)}\n {...labelProps}\n htmlFor={id ?? inputId}\n >\n {label}\n </label>\n <div\n className={clsx(\"hds-input-group__input-wrapper\")}\n data-disabled={disabled}\n data-readonly={readOnly}\n >\n {renderInput()}\n </div>\n <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage>\n </div>\n );\n});\n","import { forwardRef } from \"react\";\nimport type { SelectHTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { InputGroup } from \"../input-group\";\nimport type { InputGroupProps } from \"../input-group\";\n\nexport type SelectProps = Omit<\n InputGroupProps & SelectHTMLAttributes<HTMLSelectElement>,\n \"readOnly\"\n>;\n\nexport const Select = forwardRef<HTMLSelectElement, SelectProps>(function Select(\n { className, variant, errorMessage, labelProps, label, id, style, disabled, children, ...rest },\n ref,\n) {\n return (\n <InputGroup\n className={clsx(\"hds-select\", className as undefined)}\n disabled={disabled}\n errorMessage={errorMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n style={style}\n variant={variant}\n >\n <select {...rest} disabled={disabled} ref={ref}>\n {children}\n </select>\n </InputGroup>\n );\n});\n\nSelect.displayName = \"Select\";\n","import { forwardRef } from \"react\";\nimport type { TextareaHTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { InputGroup } from \"../input-group\";\nimport type { InputGroupProps } from \"../input-group\";\n\nexport type TextareaProps = Omit<\n InputGroupProps & TextareaHTMLAttributes<HTMLTextAreaElement>,\n \"children\"\n>;\n\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n { className, variant, errorMessage, labelProps, label, id, style, disabled, readOnly, ...rest },\n ref,\n) {\n return (\n <InputGroup\n className={clsx(\"hds-textarea\", className as undefined)}\n disabled={disabled}\n errorMessage={errorMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n readOnly={readOnly}\n style={style}\n variant={variant}\n >\n <textarea {...rest} disabled={disabled} readOnly={readOnly} ref={ref} />\n </InputGroup>\n );\n});\n\nTextarea.displayName = \"Textarea\";\n","import type { InputHTMLAttributes } from \"react\";\nimport React, { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\n\nexport interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\"> {\n variant?: \"plain\" | \"bounding-box\";\n hasError?: boolean;\n title?: string;\n}\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n ({ variant = \"plain\", hasError, title, children, className, ...rest }, ref) => {\n return (\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 {...rest} aria-invalid={hasError ? true : undefined} ref={ref} type=\"checkbox\" />\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 );\n },\n);\nCheckbox.displayName = \"Checkbox\";\n","import type { InputHTMLAttributes } from \"react\";\nimport React, { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { type RadioGroupProps, useRadioGroupContext } from \"./radiogroup\";\n\nexport interface RadiobuttonProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\"> {\n variant?: \"plain\" | \"bounding-box\";\n hasError?: boolean;\n title?: string;\n}\n\nconst isChecked = ({\n checked,\n selectedValue,\n value,\n}: Pick<RadiobuttonProps, \"checked\" | \"value\"> & {\n selectedValue: RadioGroupProps[\"value\"];\n}) => {\n if (typeof checked !== \"undefined\") return checked;\n if (typeof selectedValue !== \"undefined\") return value === selectedValue;\n return undefined;\n};\n\nexport const Radiobutton = forwardRef<HTMLInputElement, RadiobuttonProps>(\n (\n {\n checked,\n value,\n variant = \"plain\",\n hasError: hasErrorProp,\n title,\n children,\n className,\n ...rest\n },\n ref,\n ) => {\n const { value: selectedValue, hasError: hasErrorContext, ...context } = useRadioGroupContext();\n const hasError = hasErrorContext || hasErrorProp;\n return (\n <div\n className={clsx(\n \"hds-radiobutton\",\n {\n [`hds-radiobutton--${variant}`]: variant === \"bounding-box\",\n \"hds-radiobutton--error\": hasError,\n },\n className as undefined,\n )}\n >\n <label>\n <input\n {...context}\n {...rest}\n checked={isChecked({ checked, selectedValue, value })}\n value={value}\n ref={ref}\n type=\"radio\"\n />\n <span aria-hidden className=\"hds-radiobutton__checkmark\" />\n {title ? <p className=\"hds-radiobutton__title\">{title}</p> : children}\n </label>\n {title ? children : null}\n </div>\n );\n },\n);\n\nRadiobutton.displayName = \"Radiobutton\";\n","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 \"./radiobutton\";\n\nexport interface RadioGroupProps extends Omit<FieldsetProps, \"onChange\"> {\n /** Will be passed to all Radiobuttons 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,\n * and also marks all radiobuttons as invalid\n */\n errorMessage?: ReactNode;\n /** Will be passed to all Radiobuttons 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 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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAkC;AAElC,IAAAA,0BAAqB;;;ACFrB,6BAAqB;AAWjB;AAFG,SAAS,aAAa,EAAE,UAAU,IAAI,UAAU,GAAsB;AAC3E,SACE;AAAA,IA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GAAG,YAAY;AAAA,YAC7C,0BAA0B;AAAA,UAC5B;AAAA,UACA;AAAA,QACF;AAAA,QAEA;AAAA,wDAAC,WACC;AAAA;AAAA,cAAC;AAAA,8DACK,UACA,OAFL;AAAA,gBAGC,SAAS,UAAU,EAAE,SAAS,eAAe,MAAM,CAAC;AAAA,gBACpD;AAAA,gBACA;AAAA,gBACA,MAAK;AAAA;AAAA,YACP;AAAA,YACA,6CAAC,UAAK,eAAW,MAAC,WAAU,8BAA6B;AAAA,YACxD,QAAQ,6CAAC,OAAE,WAAU,0BAA0B,iBAAM,IAAO;AAAA,aAC/D;AAAA,UACC,QAAQ,WAAW;AAAA;AAAA;AAAA,IACtB;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;","names":["import_typed_classname","import_jsx_runtime","Fieldset","import_react","import_typed_classname","import_react","import_typed_classname","import_jsx_runtime","InputGroup","import_jsx_runtime","Input","import_react","import_typed_classname","import_jsx_runtime","Select","import_react","import_typed_classname","import_jsx_runtime","Textarea","import_react","import_typed_classname","import_jsx_runtime","import_react","import_typed_classname","import_react","import_jsx_runtime","RadioGroup","import_jsx_runtime","_a"]}
|
|
1
|
+
{"version":3,"sources":["../../src/form/index.tsx","../../src/form/fieldset/fieldset.tsx","../../src/form/error-message/error-message.tsx","../../src/form/input/input.tsx","../../src/form/input-group/input-group.tsx","../../src/form/select/select.tsx","../../src/form/textarea/textarea.tsx","../../src/form/checkbox/checkbox.tsx","../../src/form/radiobutton/radiobutton.tsx","../../src/form/radiobutton/radiogroup.tsx"],"sourcesContent":["export * from \"./fieldset\";\nexport * from \"./input\";\nexport * from \"./select\";\nexport * from \"./textarea\";\nexport * from \"./checkbox\";\nexport * from \"./radiobutton\";\nexport * from \"./error-message\";\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 <div className={clsx(\"hds-fieldset__input-wrapper\")}>\n <FieldsetContext.Provider value={{ hasError: Boolean(errorMessage) }}>\n {children}\n </FieldsetContext.Provider>\n </div>\n <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage>\n </fieldset>\n );\n});\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport type { ReactNode } from \"react\";\n\nexport interface ErrorMessageProps {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport function ErrorMessage({ children, id, className }: ErrorMessageProps) {\n return (\n <div\n aria-live=\"assertive\"\n className={clsx(\"hds-error-message\", className as undefined)}\n id={id}\n >\n {children}\n </div>\n );\n}\n","import { forwardRef } from \"react\";\nimport type { InputHTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { InputGroup } from \"../input-group\";\nimport type { InputGroupProps } from \"../input-group\";\n\nexport type InputProps = Omit<InputGroupProps & InputHTMLAttributes<HTMLInputElement>, \"children\">;\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n { className, variant, errorMessage, labelProps, label, id, style, disabled, readOnly, ...rest },\n ref,\n) {\n return (\n <InputGroup\n className={clsx(\"hds-input\", className as undefined)}\n disabled={disabled}\n errorMessage={errorMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n readOnly={readOnly}\n style={style}\n variant={variant}\n >\n <input {...rest} disabled={disabled} readOnly={readOnly} ref={ref} />\n </InputGroup>\n );\n});\n\nInput.displayName = \"Input\";\n","import { useId, forwardRef, Children, isValidElement, cloneElement } from \"react\";\nimport type { LabelHTMLAttributes, ReactNode, CSSProperties } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ErrorMessage } from \"../error-message\";\n\ninterface InputProps {\n \"aria-describedby\"?: string;\n \"aria-invalid\"?: boolean;\n id?: string;\n className?: string;\n}\n\nexport interface InputGroupProps {\n id?: string;\n className?: string;\n style?: CSSProperties;\n variant?: \"default\" | \"white\";\n errorMessage?: ReactNode;\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>;\n label: ReactNode;\n disabled?: boolean;\n readOnly?: boolean;\n children: ReactNode;\n}\n\nexport const InputGroup = forwardRef<HTMLDivElement, InputGroupProps>(function InputGroup(\n {\n id,\n className,\n style,\n variant = \"default\",\n errorMessage,\n labelProps: { className: labelClassName, ...labelProps } = {},\n label,\n disabled,\n readOnly,\n children,\n ...rest\n },\n ref,\n) {\n const errorMessageId = useId();\n const inputId = useId();\n\n const renderInput = () => {\n const input = Children.toArray(children)[0];\n\n if (!isValidElement<InputProps>(input)) {\n return;\n }\n\n return cloneElement<InputProps>(input, {\n \"aria-describedby\": errorMessage ? errorMessageId : undefined,\n \"aria-invalid\": errorMessage ? true : undefined,\n id: id ?? inputId,\n ...input.props,\n className: clsx(\"hds-input-group__input\", input.props.className as undefined),\n });\n };\n\n return (\n <div\n className={clsx(\n \"hds-input-group\",\n {\n [`hds-input-group--${variant}`]: variant,\n \"hds-input-group--error\": errorMessage,\n },\n className as undefined,\n )}\n ref={ref}\n style={style}\n {...rest}\n >\n <label\n className={clsx(\"hds-input-group__label\", labelClassName as undefined)}\n {...labelProps}\n htmlFor={id ?? inputId}\n >\n {label}\n </label>\n <div\n className={clsx(\"hds-input-group__input-wrapper\")}\n data-disabled={disabled}\n data-readonly={readOnly}\n >\n {renderInput()}\n </div>\n <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage>\n </div>\n );\n});\n","import { forwardRef } from \"react\";\nimport type { SelectHTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { InputGroup } from \"../input-group\";\nimport type { InputGroupProps } from \"../input-group\";\n\nexport type SelectProps = Omit<\n InputGroupProps & SelectHTMLAttributes<HTMLSelectElement>,\n \"readOnly\"\n>;\n\nexport const Select = forwardRef<HTMLSelectElement, SelectProps>(function Select(\n { className, variant, errorMessage, labelProps, label, id, style, disabled, children, ...rest },\n ref,\n) {\n return (\n <InputGroup\n className={clsx(\"hds-select\", className as undefined)}\n disabled={disabled}\n errorMessage={errorMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n style={style}\n variant={variant}\n >\n <select {...rest} disabled={disabled} ref={ref}>\n {children}\n </select>\n </InputGroup>\n );\n});\n\nSelect.displayName = \"Select\";\n","import { forwardRef } from \"react\";\nimport type { TextareaHTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { InputGroup } from \"../input-group\";\nimport type { InputGroupProps } from \"../input-group\";\n\nexport type TextareaProps = Omit<\n InputGroupProps & TextareaHTMLAttributes<HTMLTextAreaElement>,\n \"children\"\n>;\n\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n { className, variant, errorMessage, labelProps, label, id, style, disabled, readOnly, ...rest },\n ref,\n) {\n return (\n <InputGroup\n className={clsx(\"hds-textarea\", className as undefined)}\n disabled={disabled}\n errorMessage={errorMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n readOnly={readOnly}\n style={style}\n variant={variant}\n >\n <textarea {...rest} disabled={disabled} readOnly={readOnly} ref={ref} />\n </InputGroup>\n );\n});\n\nTextarea.displayName = \"Textarea\";\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 { forwardRef, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { useFieldsetContext } from \"../fieldset\";\nimport { type RadioGroupProps, useRadioGroupContext } from \"./radiogroup\";\n\nexport interface RadiobuttonProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\"> {\n children: ReactNode;\n variant?: \"plain\" | \"bounding-box\";\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 Radiobuttons in the RadioGroup component.\n * When providing an errorMessage to RadioGroup, all contained Radiobuttons will get correct hasError state.\n *\n * You can use this when your Radiobutton is part of a non-HDS fieldset which shows an error message.\n */\n hasError?: boolean;\n title?: string;\n}\n\nconst isChecked = ({\n checked,\n selectedValue,\n value,\n}: Pick<RadiobuttonProps, \"checked\" | \"value\"> & {\n selectedValue: RadioGroupProps[\"value\"];\n}) => {\n if (typeof checked !== \"undefined\") return checked;\n if (typeof selectedValue !== \"undefined\") return value === selectedValue;\n return undefined;\n};\n\nexport const Radiobutton = forwardRef<HTMLInputElement, RadiobuttonProps>(\n (\n {\n checked,\n value,\n variant = \"plain\",\n hasError: hasErrorProp,\n title,\n children,\n className,\n ...rest\n },\n ref,\n ) => {\n const {\n value: selectedValue,\n hasError: hasRadioGroupError,\n ...context\n } = useRadioGroupContext();\n const { hasError: hasFieldsetError } = useFieldsetContext();\n const hasError = hasFieldsetError || hasRadioGroupError || hasErrorProp;\n\n return (\n <div\n className={clsx(\n \"hds-radiobutton\",\n {\n [`hds-radiobutton--${variant}`]: variant === \"bounding-box\",\n \"hds-radiobutton--error\": hasError,\n },\n className as undefined,\n )}\n >\n <label>\n <input\n {...context}\n {...rest}\n checked={isChecked({ checked, selectedValue, value })}\n value={value}\n ref={ref}\n type=\"radio\"\n />\n <span aria-hidden className=\"hds-radiobutton__checkmark\" />\n {title ? <p className=\"hds-radiobutton__title\">{title}</p> : children}\n </label>\n {title ? children : null}\n </div>\n );\n },\n);\n\nRadiobutton.displayName = \"Radiobutton\";\n","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 \"./radiobutton\";\n\nexport interface RadioGroupProps extends Omit<FieldsetProps, \"onChange\"> {\n children: ReactNode;\n /** Will be passed to all Radiobuttons 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 Radiobuttons\n * error styling and aria to indicate invalid state.\n */\n errorMessage?: ReactNode;\n /** Will be passed to all Radiobuttons 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 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 </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ACA,MAAK;AAAA;AAAA,YACP;AAAA,YACA,6CAAC,UAAK,eAAW,MAAC,WAAU,8BAA6B;AAAA,YACxD,QAAQ,6CAAC,OAAE,WAAU,0BAA0B,iBAAM,IAAO;AAAA,aAC/D;AAAA,UACC,QAAQ,WAAW;AAAA;AAAA;AAAA,IACtB;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;","names":["import_typed_classname","import_jsx_runtime","Fieldset","import_react","import_typed_classname","import_react","import_typed_classname","import_jsx_runtime","InputGroup","import_jsx_runtime","Input","import_react","import_typed_classname","import_jsx_runtime","Select","import_react","import_typed_classname","import_jsx_runtime","Textarea","import_react","import_typed_classname","import_jsx_runtime","import_react","import_typed_classname","import_react","import_jsx_runtime","RadioGroup","import_jsx_runtime","_a"]}
|
package/dist/form/index.mjs
CHANGED
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
import "../chunk-T24JZIQO.mjs";
|
|
2
|
+
import "../chunk-AGZHQDCQ.mjs";
|
|
3
|
+
import {
|
|
4
|
+
Textarea
|
|
5
|
+
} from "../chunk-RK6BB3HH.mjs";
|
|
2
6
|
import "../chunk-2KX7VFN2.mjs";
|
|
3
7
|
import {
|
|
4
8
|
Radiobutton
|
|
5
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-RLUXDZ6X.mjs";
|
|
6
10
|
import {
|
|
7
|
-
RadioGroup
|
|
8
|
-
|
|
11
|
+
RadioGroup,
|
|
12
|
+
useRadioGroupContext
|
|
13
|
+
} from "../chunk-XFSZBILE.mjs";
|
|
9
14
|
import "../chunk-BYEJZSG5.mjs";
|
|
10
15
|
import {
|
|
11
16
|
Select
|
|
12
17
|
} from "../chunk-RVJD2UZF.mjs";
|
|
13
|
-
import "../chunk-AGZHQDCQ.mjs";
|
|
14
|
-
import {
|
|
15
|
-
Textarea
|
|
16
|
-
} from "../chunk-RK6BB3HH.mjs";
|
|
17
18
|
import "../chunk-YJOOSTJC.mjs";
|
|
19
|
+
import {
|
|
20
|
+
Checkbox
|
|
21
|
+
} from "../chunk-X7EKQZNU.mjs";
|
|
18
22
|
import "../chunk-LMF3QGSF.mjs";
|
|
19
23
|
import {
|
|
20
|
-
Fieldset
|
|
21
|
-
|
|
24
|
+
Fieldset,
|
|
25
|
+
useFieldsetContext
|
|
26
|
+
} from "../chunk-HXV2UMEV.mjs";
|
|
22
27
|
import "../chunk-7LPYJC6S.mjs";
|
|
23
28
|
import {
|
|
24
29
|
Input
|
|
@@ -29,9 +34,6 @@ import "../chunk-NSLSA7F7.mjs";
|
|
|
29
34
|
import {
|
|
30
35
|
ErrorMessage
|
|
31
36
|
} from "../chunk-IL7576PP.mjs";
|
|
32
|
-
import {
|
|
33
|
-
Checkbox
|
|
34
|
-
} from "../chunk-PXHYOQPB.mjs";
|
|
35
37
|
import "../chunk-R4SQKVDQ.mjs";
|
|
36
38
|
export {
|
|
37
39
|
Checkbox,
|
|
@@ -41,6 +43,8 @@ export {
|
|
|
41
43
|
RadioGroup,
|
|
42
44
|
Radiobutton,
|
|
43
45
|
Select,
|
|
44
|
-
Textarea
|
|
46
|
+
Textarea,
|
|
47
|
+
useFieldsetContext,
|
|
48
|
+
useRadioGroupContext
|
|
45
49
|
};
|
|
46
50
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Radiobutton_alias_3 as Radiobutton } from '../../_tsup-dts-rollup';
|
|
2
2
|
export { RadioGroup_alias_3 as RadioGroup } from '../../_tsup-dts-rollup';
|
|
3
|
+
export { useRadioGroupContext_alias_3 as useRadioGroupContext } from '../../_tsup-dts-rollup';
|
|
3
4
|
export { RadiobuttonProps_alias_3 as RadiobuttonProps } from '../../_tsup-dts-rollup';
|
|
4
5
|
export { RadioGroupProps_alias_3 as RadioGroupProps } from '../../_tsup-dts-rollup';
|
|
5
|
-
export { useRadioGroupContext_alias_3 as useRadioGroupContext } from '../../_tsup-dts-rollup';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Radiobutton_alias_3 as Radiobutton } from '../../_tsup-dts-rollup';
|
|
2
2
|
export { RadioGroup_alias_3 as RadioGroup } from '../../_tsup-dts-rollup';
|
|
3
|
+
export { useRadioGroupContext_alias_3 as useRadioGroupContext } from '../../_tsup-dts-rollup';
|
|
3
4
|
export { RadiobuttonProps_alias_3 as RadiobuttonProps } from '../../_tsup-dts-rollup';
|
|
4
5
|
export { RadioGroupProps_alias_3 as RadioGroupProps } from '../../_tsup-dts-rollup';
|
|
5
|
-
export { useRadioGroupContext_alias_3 as useRadioGroupContext } from '../../_tsup-dts-rollup';
|
|
@@ -50,7 +50,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
50
50
|
var radiobutton_exports = {};
|
|
51
51
|
__export(radiobutton_exports, {
|
|
52
52
|
RadioGroup: () => RadioGroup,
|
|
53
|
-
Radiobutton: () => Radiobutton
|
|
53
|
+
Radiobutton: () => Radiobutton,
|
|
54
|
+
useRadioGroupContext: () => useRadioGroupContext
|
|
54
55
|
});
|
|
55
56
|
module.exports = __toCommonJS(radiobutton_exports);
|
|
56
57
|
|
|
@@ -58,9 +59,6 @@ module.exports = __toCommonJS(radiobutton_exports);
|
|
|
58
59
|
var import_react3 = require("react");
|
|
59
60
|
var import_typed_classname3 = require("@postenbring/hedwig-css/typed-classname");
|
|
60
61
|
|
|
61
|
-
// src/form/radiobutton/radiogroup.tsx
|
|
62
|
-
var import_react2 = require("react");
|
|
63
|
-
|
|
64
62
|
// src/form/fieldset/fieldset.tsx
|
|
65
63
|
var import_react = require("react");
|
|
66
64
|
var import_typed_classname2 = require("@postenbring/hedwig-css/typed-classname");
|
|
@@ -82,6 +80,8 @@ function ErrorMessage({ children, id, className }) {
|
|
|
82
80
|
|
|
83
81
|
// src/form/fieldset/fieldset.tsx
|
|
84
82
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
83
|
+
var FieldsetContext = (0, import_react.createContext)({ hasError: false });
|
|
84
|
+
var useFieldsetContext = () => (0, import_react.useContext)(FieldsetContext);
|
|
85
85
|
var Fieldset = (0, import_react.forwardRef)(function Fieldset2(_a, ref) {
|
|
86
86
|
var _b = _a, {
|
|
87
87
|
className,
|
|
@@ -122,7 +122,7 @@ var Fieldset = (0, import_react.forwardRef)(function Fieldset2(_a, ref) {
|
|
|
122
122
|
children: legend
|
|
123
123
|
})
|
|
124
124
|
),
|
|
125
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: (0, import_typed_classname2.clsx)("hds-fieldset__input-wrapper"), children }),
|
|
125
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: (0, import_typed_classname2.clsx)("hds-fieldset__input-wrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FieldsetContext.Provider, { value: { hasError: Boolean(errorMessage) }, children }) }),
|
|
126
126
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ErrorMessage, { id: errorMessageId, children: errorMessage })
|
|
127
127
|
]
|
|
128
128
|
})
|
|
@@ -130,6 +130,7 @@ var Fieldset = (0, import_react.forwardRef)(function Fieldset2(_a, ref) {
|
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
// src/form/radiobutton/radiogroup.tsx
|
|
133
|
+
var import_react2 = require("react");
|
|
133
134
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
134
135
|
var RadioGroupContext = (0, import_react2.createContext)({
|
|
135
136
|
hasError: false,
|
|
@@ -176,8 +177,15 @@ var Radiobutton = (0, import_react3.forwardRef)(
|
|
|
176
177
|
"children",
|
|
177
178
|
"className"
|
|
178
179
|
]);
|
|
179
|
-
const _a2 = useRadioGroupContext(), {
|
|
180
|
-
|
|
180
|
+
const _a2 = useRadioGroupContext(), {
|
|
181
|
+
value: selectedValue,
|
|
182
|
+
hasError: hasRadioGroupError
|
|
183
|
+
} = _a2, context = __objRest(_a2, [
|
|
184
|
+
"value",
|
|
185
|
+
"hasError"
|
|
186
|
+
]);
|
|
187
|
+
const { hasError: hasFieldsetError } = useFieldsetContext();
|
|
188
|
+
const hasError = hasFieldsetError || hasRadioGroupError || hasErrorProp;
|
|
181
189
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
182
190
|
"div",
|
|
183
191
|
{
|
|
@@ -213,6 +221,7 @@ Radiobutton.displayName = "Radiobutton";
|
|
|
213
221
|
// Annotate the CommonJS export names for ESM import in node:
|
|
214
222
|
0 && (module.exports = {
|
|
215
223
|
RadioGroup,
|
|
216
|
-
Radiobutton
|
|
224
|
+
Radiobutton,
|
|
225
|
+
useRadioGroupContext
|
|
217
226
|
});
|
|
218
227
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/radiobutton/index.tsx","../../../src/form/radiobutton/radiobutton.tsx","../../../src/form/radiobutton/radiogroup.tsx","../../../src/form/fieldset/fieldset.tsx","../../../src/form/error-message/error-message.tsx"],"sourcesContent":["export { Radiobutton } from \"./radiobutton\";\nexport type * from \"./radiobutton\";\nexport { RadioGroup } from \"./radiogroup\";\nexport type * from \"./radiogroup\";\n","import type { InputHTMLAttributes } from \"react\";\nimport React, { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { type RadioGroupProps, useRadioGroupContext } from \"./radiogroup\";\n\nexport interface RadiobuttonProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\"> {\n variant?: \"plain\" | \"bounding-box\";\n hasError?: boolean;\n title?: string;\n}\n\nconst isChecked = ({\n checked,\n selectedValue,\n value,\n}: Pick<RadiobuttonProps, \"checked\" | \"value\"> & {\n selectedValue: RadioGroupProps[\"value\"];\n}) => {\n if (typeof checked !== \"undefined\") return checked;\n if (typeof selectedValue !== \"undefined\") return value === selectedValue;\n return undefined;\n};\n\nexport const Radiobutton = forwardRef<HTMLInputElement, RadiobuttonProps>(\n (\n {\n checked,\n value,\n variant = \"plain\",\n hasError: hasErrorProp,\n title,\n children,\n className,\n ...rest\n },\n ref,\n ) => {\n const { value: selectedValue, hasError: hasErrorContext, ...context } = useRadioGroupContext();\n const hasError = hasErrorContext || hasErrorProp;\n return (\n <div\n className={clsx(\n \"hds-radiobutton\",\n {\n [`hds-radiobutton--${variant}`]: variant === \"bounding-box\",\n \"hds-radiobutton--error\": hasError,\n },\n className as undefined,\n )}\n >\n <label>\n <input\n {...context}\n {...rest}\n checked={isChecked({ checked, selectedValue, value })}\n value={value}\n ref={ref}\n type=\"radio\"\n />\n <span aria-hidden className=\"hds-radiobutton__checkmark\" />\n {title ? <p className=\"hds-radiobutton__title\">{title}</p> : children}\n </label>\n {title ? children : null}\n </div>\n );\n },\n);\n\nRadiobutton.displayName = \"Radiobutton\";\n","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 \"./radiobutton\";\n\nexport interface RadioGroupProps extends Omit<FieldsetProps, \"onChange\"> {\n /** Will be passed to all Radiobuttons 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,\n * and also marks all radiobuttons as invalid\n */\n errorMessage?: ReactNode;\n /** Will be passed to all Radiobuttons 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 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","import { useId, forwardRef } 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 errorMessage?: ReactNode;\n legendProps?: HTMLAttributes<HTMLElement> & { size: \"default\" | \"large\" };\n legend: ReactNode;\n children: ReactNode;\n}\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 <div className={clsx(\"hds-fieldset__input-wrapper\")}>{children}</div>\n <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage>\n </fieldset>\n );\n});\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport type { ReactNode } from \"react\";\n\nexport interface ErrorMessageProps {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport function ErrorMessage({ children, id, className }: ErrorMessageProps) {\n return (\n <div\n aria-live=\"assertive\"\n className={clsx(\"hds-error-message\", className as undefined)}\n id={id}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;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AAAA,QACC,eAAW;AAAA,UACT;AAAA,UACA;AAAA,YACE,CAAC,oBAAoB,OAAO,EAAE,GAAG,YAAY;AAAA,YAC7C,0BAA0B;AAAA,UAC5B;AAAA,UACA;AAAA,QACF;AAAA,QAEA;AAAA,wDAAC,WACC;AAAA;AAAA,cAAC;AAAA,8DACK,UACA,OAFL;AAAA,gBAGC,SAAS,UAAU,EAAE,SAAS,eAAe,MAAM,CAAC;AAAA,gBACpD;AAAA,gBACA;AAAA,gBACA,MAAK;AAAA;AAAA,YACP;AAAA,YACA,6CAAC,UAAK,eAAW,MAAC,WAAU,8BAA6B;AAAA,YACxD,QAAQ,6CAAC,OAAE,WAAU,0BAA0B,iBAAM,IAAO;AAAA,aAC/D;AAAA,UACC,QAAQ,WAAW;AAAA;AAAA;AAAA,IACtB;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;","names":["import_react","import_typed_classname","import_react","import_typed_classname","import_jsx_runtime","Fieldset","import_jsx_runtime","RadioGroup","import_jsx_runtime","_a"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/form/radiobutton/index.tsx","../../../src/form/radiobutton/radiobutton.tsx","../../../src/form/fieldset/fieldset.tsx","../../../src/form/error-message/error-message.tsx","../../../src/form/radiobutton/radiogroup.tsx"],"sourcesContent":["export { Radiobutton } from \"./radiobutton\";\nexport type * from \"./radiobutton\";\nexport { RadioGroup, useRadioGroupContext } from \"./radiogroup\";\nexport type * from \"./radiogroup\";\n","import { forwardRef, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { useFieldsetContext } from \"../fieldset\";\nimport { type RadioGroupProps, useRadioGroupContext } from \"./radiogroup\";\n\nexport interface RadiobuttonProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\"> {\n children: ReactNode;\n variant?: \"plain\" | \"bounding-box\";\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 Radiobuttons in the RadioGroup component.\n * When providing an errorMessage to RadioGroup, all contained Radiobuttons will get correct hasError state.\n *\n * You can use this when your Radiobutton is part of a non-HDS fieldset which shows an error message.\n */\n hasError?: boolean;\n title?: string;\n}\n\nconst isChecked = ({\n checked,\n selectedValue,\n value,\n}: Pick<RadiobuttonProps, \"checked\" | \"value\"> & {\n selectedValue: RadioGroupProps[\"value\"];\n}) => {\n if (typeof checked !== \"undefined\") return checked;\n if (typeof selectedValue !== \"undefined\") return value === selectedValue;\n return undefined;\n};\n\nexport const Radiobutton = forwardRef<HTMLInputElement, RadiobuttonProps>(\n (\n {\n checked,\n value,\n variant = \"plain\",\n hasError: hasErrorProp,\n title,\n children,\n className,\n ...rest\n },\n ref,\n ) => {\n const {\n value: selectedValue,\n hasError: hasRadioGroupError,\n ...context\n } = useRadioGroupContext();\n const { hasError: hasFieldsetError } = useFieldsetContext();\n const hasError = hasFieldsetError || hasRadioGroupError || hasErrorProp;\n\n return (\n <div\n className={clsx(\n \"hds-radiobutton\",\n {\n [`hds-radiobutton--${variant}`]: variant === \"bounding-box\",\n \"hds-radiobutton--error\": hasError,\n },\n className as undefined,\n )}\n >\n <label>\n <input\n {...context}\n {...rest}\n checked={isChecked({ checked, selectedValue, value })}\n value={value}\n ref={ref}\n type=\"radio\"\n />\n <span aria-hidden className=\"hds-radiobutton__checkmark\" />\n {title ? <p className=\"hds-radiobutton__title\">{title}</p> : children}\n </label>\n {title ? children : null}\n </div>\n );\n },\n);\n\nRadiobutton.displayName = \"Radiobutton\";\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 <div className={clsx(\"hds-fieldset__input-wrapper\")}>\n <FieldsetContext.Provider value={{ hasError: Boolean(errorMessage) }}>\n {children}\n </FieldsetContext.Provider>\n </div>\n <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage>\n </fieldset>\n );\n});\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport type { ReactNode } from \"react\";\n\nexport interface ErrorMessageProps {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport function ErrorMessage({ children, id, className }: ErrorMessageProps) {\n return (\n <div\n aria-live=\"assertive\"\n className={clsx(\"hds-error-message\", className as undefined)}\n id={id}\n >\n {children}\n </div>\n );\n}\n","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 \"./radiobutton\";\n\nexport interface RadioGroupProps extends Omit<FieldsetProps, \"onChange\"> {\n children: ReactNode;\n /** Will be passed to all Radiobuttons 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 Radiobuttons\n * error styling and aria to indicate invalid state.\n */\n errorMessage?: ReactNode;\n /** Will be passed to all Radiobuttons 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 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;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAAqE;AACrE,IAAAC,0BAAqB;;;ACDrB,mBAA6D;AAE7D,IAAAC,0BAAqB;;;ACFrB,6BAAqB;AAWjB;AAFG,SAAS,aAAa,EAAE,UAAU,IAAI,UAAU,GAAsB;AAC3E,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,eAAW,6BAAK,qBAAqB,SAAsB;AAAA,MAC3D;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;;;ADoBI,IAAAC,sBAAA;AAnBJ,IAAM,sBAAkB,4BAAqC,EAAE,UAAU,MAAM,C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;AAAA,8DACK,UACA,OAFL;AAAA,gBAGC,SAAS,UAAU,EAAE,SAAS,eAAe,MAAM,CAAC;AAAA,gBACpD;AAAA,gBACA;AAAA,gBACA,MAAK;AAAA;AAAA,YACP;AAAA,YACA,6CAAC,UAAK,eAAW,MAAC,WAAU,8BAA6B;AAAA,YACxD,QAAQ,6CAAC,OAAE,WAAU,0BAA0B,iBAAM,IAAO;AAAA,aAC/D;AAAA,UACC,QAAQ,WAAW;AAAA;AAAA;AAAA,IACtB;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;","names":["import_react","import_typed_classname","import_typed_classname","import_jsx_runtime","Fieldset","import_react","import_jsx_runtime","RadioGroup","import_jsx_runtime","_a"]}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import "../../chunk-2KX7VFN2.mjs";
|
|
2
2
|
import {
|
|
3
3
|
Radiobutton
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-RLUXDZ6X.mjs";
|
|
5
5
|
import {
|
|
6
|
-
RadioGroup
|
|
7
|
-
|
|
6
|
+
RadioGroup,
|
|
7
|
+
useRadioGroupContext
|
|
8
|
+
} from "../../chunk-XFSZBILE.mjs";
|
|
8
9
|
import "../../chunk-LMF3QGSF.mjs";
|
|
9
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-HXV2UMEV.mjs";
|
|
10
11
|
import "../../chunk-NSLSA7F7.mjs";
|
|
11
12
|
import "../../chunk-IL7576PP.mjs";
|
|
12
13
|
import "../../chunk-R4SQKVDQ.mjs";
|
|
13
14
|
export {
|
|
14
15
|
RadioGroup,
|
|
15
|
-
Radiobutton
|
|
16
|
+
Radiobutton,
|
|
17
|
+
useRadioGroupContext
|
|
16
18
|
};
|
|
17
19
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -55,9 +55,6 @@ module.exports = __toCommonJS(radiobutton_exports);
|
|
|
55
55
|
var import_react3 = require("react");
|
|
56
56
|
var import_typed_classname3 = require("@postenbring/hedwig-css/typed-classname");
|
|
57
57
|
|
|
58
|
-
// src/form/radiobutton/radiogroup.tsx
|
|
59
|
-
var import_react2 = require("react");
|
|
60
|
-
|
|
61
58
|
// src/form/fieldset/fieldset.tsx
|
|
62
59
|
var import_react = require("react");
|
|
63
60
|
var import_typed_classname2 = require("@postenbring/hedwig-css/typed-classname");
|
|
@@ -79,6 +76,8 @@ function ErrorMessage({ children, id, className }) {
|
|
|
79
76
|
|
|
80
77
|
// src/form/fieldset/fieldset.tsx
|
|
81
78
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
79
|
+
var FieldsetContext = (0, import_react.createContext)({ hasError: false });
|
|
80
|
+
var useFieldsetContext = () => (0, import_react.useContext)(FieldsetContext);
|
|
82
81
|
var Fieldset = (0, import_react.forwardRef)(function Fieldset2(_a, ref) {
|
|
83
82
|
var _b = _a, {
|
|
84
83
|
className,
|
|
@@ -119,7 +118,7 @@ var Fieldset = (0, import_react.forwardRef)(function Fieldset2(_a, ref) {
|
|
|
119
118
|
children: legend
|
|
120
119
|
})
|
|
121
120
|
),
|
|
122
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: (0, import_typed_classname2.clsx)("hds-fieldset__input-wrapper"), children }),
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: (0, import_typed_classname2.clsx)("hds-fieldset__input-wrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FieldsetContext.Provider, { value: { hasError: Boolean(errorMessage) }, children }) }),
|
|
123
122
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ErrorMessage, { id: errorMessageId, children: errorMessage })
|
|
124
123
|
]
|
|
125
124
|
})
|
|
@@ -127,6 +126,7 @@ var Fieldset = (0, import_react.forwardRef)(function Fieldset2(_a, ref) {
|
|
|
127
126
|
});
|
|
128
127
|
|
|
129
128
|
// src/form/radiobutton/radiogroup.tsx
|
|
129
|
+
var import_react2 = require("react");
|
|
130
130
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
131
131
|
var RadioGroupContext = (0, import_react2.createContext)({
|
|
132
132
|
hasError: false,
|
|
@@ -173,8 +173,15 @@ var Radiobutton = (0, import_react3.forwardRef)(
|
|
|
173
173
|
"children",
|
|
174
174
|
"className"
|
|
175
175
|
]);
|
|
176
|
-
const _a2 = useRadioGroupContext(), {
|
|
177
|
-
|
|
176
|
+
const _a2 = useRadioGroupContext(), {
|
|
177
|
+
value: selectedValue,
|
|
178
|
+
hasError: hasRadioGroupError
|
|
179
|
+
} = _a2, context = __objRest(_a2, [
|
|
180
|
+
"value",
|
|
181
|
+
"hasError"
|
|
182
|
+
]);
|
|
183
|
+
const { hasError: hasFieldsetError } = useFieldsetContext();
|
|
184
|
+
const hasError = hasFieldsetError || hasRadioGroupError || hasErrorProp;
|
|
178
185
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
179
186
|
"div",
|
|
180
187
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/radiobutton/radiobutton.tsx","../../../src/form/radiobutton/radiogroup.tsx","../../../src/form/fieldset/fieldset.tsx","../../../src/form/error-message/error-message.tsx"],"sourcesContent":["import type { InputHTMLAttributes } from \"react\";\nimport React, { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { type RadioGroupProps, useRadioGroupContext } from \"./radiogroup\";\n\nexport interface RadiobuttonProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\"> {\n variant?: \"plain\" | \"bounding-box\";\n hasError?: boolean;\n title?: string;\n}\n\nconst isChecked = ({\n checked,\n selectedValue,\n value,\n}: Pick<RadiobuttonProps, \"checked\" | \"value\"> & {\n selectedValue: RadioGroupProps[\"value\"];\n}) => {\n if (typeof checked !== \"undefined\") return checked;\n if (typeof selectedValue !== \"undefined\") return value === selectedValue;\n return undefined;\n};\n\nexport const Radiobutton = forwardRef<HTMLInputElement, RadiobuttonProps>(\n (\n {\n checked,\n value,\n variant = \"plain\",\n hasError: hasErrorProp,\n title,\n children,\n className,\n ...rest\n },\n ref,\n ) => {\n const { value: selectedValue, hasError: hasErrorContext, ...context } = useRadioGroupContext();\n const hasError = hasErrorContext || hasErrorProp;\n return (\n <div\n className={clsx(\n \"hds-radiobutton\",\n {\n [`hds-radiobutton--${variant}`]: variant === \"bounding-box\",\n \"hds-radiobutton--error\": hasError,\n },\n className as undefined,\n )}\n >\n <label>\n <input\n {...context}\n {...rest}\n checked={isChecked({ checked, selectedValue, value })}\n value={value}\n ref={ref}\n type=\"radio\"\n />\n <span aria-hidden className=\"hds-radiobutton__checkmark\" />\n {title ? <p className=\"hds-radiobutton__title\">{title}</p> : children}\n </label>\n {title ? children : null}\n </div>\n );\n },\n);\n\nRadiobutton.displayName = \"Radiobutton\";\n","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 \"./radiobutton\";\n\nexport interface RadioGroupProps extends Omit<FieldsetProps, \"onChange\"> {\n /** Will be passed to all Radiobuttons 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,\n * and also marks all radiobuttons as invalid\n */\n errorMessage?: ReactNode;\n /** Will be passed to all Radiobuttons 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 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","import { useId, forwardRef } 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 errorMessage?: ReactNode;\n legendProps?: HTMLAttributes<HTMLElement> & { size: \"default\" | \"large\" };\n legend: ReactNode;\n children: ReactNode;\n}\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 <div className={clsx(\"hds-fieldset__input-wrapper\")}>{children}</div>\n <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage>\n </fieldset>\n );\n});\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport type { ReactNode } from \"react\";\n\nexport interface ErrorMessageProps {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport function ErrorMessage({ children, id, className }: ErrorMessageProps) {\n return (\n <div\n aria-live=\"assertive\"\n className={clsx(\"hds-error-message\", className as undefined)}\n id={id}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WAAW,mBAAmB;AACpC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW;AAAA,UACT;AAAA,UACA;AAAA,YACE,CAAC,oBAAoB,OAAO,EAAE,GAAG,YAAY;AAAA,YAC7C,0BAA0B;AAAA,UAC5B;AAAA,UACA;AAAA,QACF;AAAA,QAEA;AAAA,wDAAC,WACC;AAAA;AAAA,cAAC;AAAA,8DACK,UACA,OAFL;AAAA,gBAGC,SAAS,UAAU,EAAE,SAAS,eAAe,MAAM,CAAC;AAAA,gBACpD;AAAA,gBACA;AAAA,gBACA,MAAK;AAAA;AAAA,YACP;AAAA,YACA,6CAAC,UAAK,eAAW,MAAC,WAAU,8BAA6B;AAAA,YACxD,QAAQ,6CAAC,OAAE,WAAU,0BAA0B,iBAAM,IAAO;AAAA,aAC/D;AAAA,UACC,QAAQ,WAAW;AAAA;AAAA;AAAA,IACtB;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;","names":["import_react","import_typed_classname","import_react","import_typed_classname","import_jsx_runtime","Fieldset","import_jsx_runtime","RadioGroup","import_jsx_runtime","_a"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/form/radiobutton/radiobutton.tsx","../../../src/form/fieldset/fieldset.tsx","../../../src/form/error-message/error-message.tsx","../../../src/form/radiobutton/radiogroup.tsx"],"sourcesContent":["import { forwardRef, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { useFieldsetContext } from \"../fieldset\";\nimport { type RadioGroupProps, useRadioGroupContext } from \"./radiogroup\";\n\nexport interface RadiobuttonProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\"> {\n children: ReactNode;\n variant?: \"plain\" | \"bounding-box\";\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 Radiobuttons in the RadioGroup component.\n * When providing an errorMessage to RadioGroup, all contained Radiobuttons will get correct hasError state.\n *\n * You can use this when your Radiobutton is part of a non-HDS fieldset which shows an error message.\n */\n hasError?: boolean;\n title?: string;\n}\n\nconst isChecked = ({\n checked,\n selectedValue,\n value,\n}: Pick<RadiobuttonProps, \"checked\" | \"value\"> & {\n selectedValue: RadioGroupProps[\"value\"];\n}) => {\n if (typeof checked !== \"undefined\") return checked;\n if (typeof selectedValue !== \"undefined\") return value === selectedValue;\n return undefined;\n};\n\nexport const Radiobutton = forwardRef<HTMLInputElement, RadiobuttonProps>(\n (\n {\n checked,\n value,\n variant = \"plain\",\n hasError: hasErrorProp,\n title,\n children,\n className,\n ...rest\n },\n ref,\n ) => {\n const {\n value: selectedValue,\n hasError: hasRadioGroupError,\n ...context\n } = useRadioGroupContext();\n const { hasError: hasFieldsetError } = useFieldsetContext();\n const hasError = hasFieldsetError || hasRadioGroupError || hasErrorProp;\n\n return (\n <div\n className={clsx(\n \"hds-radiobutton\",\n {\n [`hds-radiobutton--${variant}`]: variant === \"bounding-box\",\n \"hds-radiobutton--error\": hasError,\n },\n className as undefined,\n )}\n >\n <label>\n <input\n {...context}\n {...rest}\n checked={isChecked({ checked, selectedValue, value })}\n value={value}\n ref={ref}\n type=\"radio\"\n />\n <span aria-hidden className=\"hds-radiobutton__checkmark\" />\n {title ? <p className=\"hds-radiobutton__title\">{title}</p> : children}\n </label>\n {title ? children : null}\n </div>\n );\n },\n);\n\nRadiobutton.displayName = \"Radiobutton\";\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 <div className={clsx(\"hds-fieldset__input-wrapper\")}>\n <FieldsetContext.Provider value={{ hasError: Boolean(errorMessage) }}>\n {children}\n </FieldsetContext.Provider>\n </div>\n <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage>\n </fieldset>\n );\n});\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport type { ReactNode } from \"react\";\n\nexport interface ErrorMessageProps {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport function ErrorMessage({ children, id, className }: ErrorMessageProps) {\n return (\n <div\n aria-live=\"assertive\"\n className={clsx(\"hds-error-message\", className as undefined)}\n id={id}\n >\n {children}\n </div>\n );\n}\n","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 \"./radiobutton\";\n\nexport interface RadioGroupProps extends Omit<FieldsetProps, \"onChange\"> {\n children: ReactNode;\n /** Will be passed to all Radiobuttons 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 Radiobuttons\n * error styling and aria to indicate invalid state.\n */\n errorMessage?: ReactNode;\n /** Will be passed to all Radiobuttons 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 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;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAAqE;AACrE,IAAAC,0BAAqB;;;ACDrB,mBAA6D;AAE7D,IAAAC,0BAAqB;;;ACFrB,6BAAqB;AAWjB;AAFG,SAAS,aAAa,EAAE,UAAU,IAAI,UAAU,GAAsB;AAC3E,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,eAAW,6BAAK,qBAAqB,SAAsB;AAAA,MAC3D;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;;;ADoBI,IAAAC,sBAAA;AAnBJ,IAAM,sBAAkB,4BAAqC,EAAE,UAAU,MAAM,CAAC;AAEzE,IAAM,qBAAqB,UAAM,yBAAW,eAAe;AAE3D,IAAM,eAAW,yBAA+C,SAASC,UAC9E,IASA,KACA;AAVA,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A;AAAA,gBACA,MAAK;AAAA;AAAA,YACP;AAAA,YACA,6CAAC,UAAK,eAAW,MAAC,WAAU,8BAA6B;AAAA,YACxD,QAAQ,6CAAC,OAAE,WAAU,0BAA0B,iBAAM,IAAO;AAAA,aAC/D;AAAA,UACC,QAAQ,WAAW;AAAA;AAAA;AAAA,IACtB;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;","names":["import_react","import_typed_classname","import_typed_classname","import_jsx_runtime","Fieldset","import_react","import_jsx_runtime","RadioGroup","import_jsx_runtime","_a"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Radiobutton
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-RLUXDZ6X.mjs";
|
|
4
|
+
import "../../chunk-XFSZBILE.mjs";
|
|
5
5
|
import "../../chunk-LMF3QGSF.mjs";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-HXV2UMEV.mjs";
|
|
7
7
|
import "../../chunk-NSLSA7F7.mjs";
|
|
8
8
|
import "../../chunk-IL7576PP.mjs";
|
|
9
9
|
import "../../chunk-R4SQKVDQ.mjs";
|
|
@@ -76,6 +76,7 @@ function ErrorMessage({ children, id, className }) {
|
|
|
76
76
|
|
|
77
77
|
// src/form/fieldset/fieldset.tsx
|
|
78
78
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
79
|
+
var FieldsetContext = (0, import_react.createContext)({ hasError: false });
|
|
79
80
|
var Fieldset = (0, import_react.forwardRef)(function Fieldset2(_a, ref) {
|
|
80
81
|
var _b = _a, {
|
|
81
82
|
className,
|
|
@@ -116,7 +117,7 @@ var Fieldset = (0, import_react.forwardRef)(function Fieldset2(_a, ref) {
|
|
|
116
117
|
children: legend
|
|
117
118
|
})
|
|
118
119
|
),
|
|
119
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: (0, import_typed_classname2.clsx)("hds-fieldset__input-wrapper"), children }),
|
|
120
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: (0, import_typed_classname2.clsx)("hds-fieldset__input-wrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FieldsetContext.Provider, { value: { hasError: Boolean(errorMessage) }, children }) }),
|
|
120
121
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ErrorMessage, { id: errorMessageId, children: errorMessage })
|
|
121
122
|
]
|
|
122
123
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/radiobutton/radiogroup.tsx","../../../src/form/fieldset/fieldset.tsx","../../../src/form/error-message/error-message.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 \"./radiobutton\";\n\nexport interface RadioGroupProps extends Omit<FieldsetProps, \"onChange\"> {\n /** Will be passed to all Radiobuttons 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
|
|
1
|
+
{"version":3,"sources":["../../../src/form/radiobutton/radiogroup.tsx","../../../src/form/fieldset/fieldset.tsx","../../../src/form/error-message/error-message.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 \"./radiobutton\";\n\nexport interface RadioGroupProps extends Omit<FieldsetProps, \"onChange\"> {\n children: ReactNode;\n /** Will be passed to all Radiobuttons 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 Radiobuttons\n * error styling and aria to indicate invalid state.\n */\n errorMessage?: ReactNode;\n /** Will be passed to all Radiobuttons 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 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","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 <div className={clsx(\"hds-fieldset__input-wrapper\")}>\n <FieldsetContext.Provider value={{ hasError: Boolean(errorMessage) }}>\n {children}\n </FieldsetContext.Provider>\n </div>\n <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage>\n </fieldset>\n );\n});\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport type { ReactNode } from \"react\";\n\nexport interface ErrorMessageProps {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport function ErrorMessage({ children, id, className }: ErrorMessageProps) {\n return (\n <div\n aria-live=\"assertive\"\n className={clsx(\"hds-error-message\", className as undefined)}\n id={id}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAMO;;;ACNP,mBAA6D;AAE7D,IAAAC,0BAAqB;;;ACFrB,6BAAqB;AAWjB;AAFG,SAAS,aAAa,EAAE,UAAU,IAAI,UAAU,GAAsB;AAC3E,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,eAAW,6BAAK,qBAAqB,SAAsB;AAAA,MAC3D;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;;;ADoBI,IAAAC,sBAAA;AAnBJ,IAAM,sBAAkB,4BAAqC,EAAE,UAAU,MAAM,CAAC;AAIzE,IAAM,eAAW,yBAA+C,SAASC,UAC9E,IASA,KACA;AAVA,eAIe;AAAA,IAHb;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa,KAA+E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EAA2B,OAAO,EAAE,MAAM,OAAO,UAAU,QAAQ,YAAY,GAAG,SAAS,GAC1F,uDAAC,yCAAS,gBAAgC,OAAzC,EAA+C,KAC7C,WACH,GACF;AAEJ,CAAC;AAED,WAAW,cAAc;","names":["import_react","import_typed_classname","import_jsx_runtime","Fieldset","import_jsx_runtime","RadioGroup"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RadioGroup,
|
|
3
3
|
useRadioGroupContext
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-XFSZBILE.mjs";
|
|
5
5
|
import "../../chunk-LMF3QGSF.mjs";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-HXV2UMEV.mjs";
|
|
7
7
|
import "../../chunk-NSLSA7F7.mjs";
|
|
8
8
|
import "../../chunk-IL7576PP.mjs";
|
|
9
9
|
import "../../chunk-R4SQKVDQ.mjs";
|
package/dist/index-no-css.d.mts
CHANGED
|
@@ -37,6 +37,7 @@ export { CardBodyActionArrow } from './_tsup-dts-rollup';
|
|
|
37
37
|
export { DescriptionList } from './_tsup-dts-rollup';
|
|
38
38
|
export { DescriptionListProps } from './_tsup-dts-rollup';
|
|
39
39
|
export { Fieldset } from './_tsup-dts-rollup';
|
|
40
|
+
export { useFieldsetContext } from './_tsup-dts-rollup';
|
|
40
41
|
export { FieldsetProps } from './_tsup-dts-rollup';
|
|
41
42
|
export { Input } from './_tsup-dts-rollup';
|
|
42
43
|
export { InputProps } from './_tsup-dts-rollup';
|
|
@@ -48,11 +49,18 @@ export { Checkbox } from './_tsup-dts-rollup';
|
|
|
48
49
|
export { CheckboxProps } from './_tsup-dts-rollup';
|
|
49
50
|
export { Radiobutton } from './_tsup-dts-rollup';
|
|
50
51
|
export { RadioGroup } from './_tsup-dts-rollup';
|
|
52
|
+
export { useRadioGroupContext } from './_tsup-dts-rollup';
|
|
51
53
|
export { RadiobuttonProps } from './_tsup-dts-rollup';
|
|
52
54
|
export { RadioGroupProps } from './_tsup-dts-rollup';
|
|
53
|
-
export { useRadioGroupContext } from './_tsup-dts-rollup';
|
|
54
55
|
export { ErrorMessage } from './_tsup-dts-rollup';
|
|
55
56
|
export { ErrorMessageProps } from './_tsup-dts-rollup';
|
|
57
|
+
export { Footer } from './_tsup-dts-rollup';
|
|
58
|
+
export { FooterProps } from './_tsup-dts-rollup';
|
|
59
|
+
export { FooterButtonLinkProps } from './_tsup-dts-rollup';
|
|
60
|
+
export { FooterButtonLink } from './_tsup-dts-rollup';
|
|
61
|
+
export { FooterLogo } from './_tsup-dts-rollup';
|
|
62
|
+
export { FooterLinkSections } from './_tsup-dts-rollup';
|
|
63
|
+
export { FooterLinkSection } from './_tsup-dts-rollup';
|
|
56
64
|
export { Container } from './_tsup-dts-rollup';
|
|
57
65
|
export { ContainerProps } from './_tsup-dts-rollup';
|
|
58
66
|
export { Link } from './_tsup-dts-rollup';
|
|
@@ -70,6 +78,7 @@ export { ModalHeader } from './_tsup-dts-rollup';
|
|
|
70
78
|
export { ModalContent } from './_tsup-dts-rollup';
|
|
71
79
|
export { ModalFooter } from './_tsup-dts-rollup';
|
|
72
80
|
export { Navbar } from './_tsup-dts-rollup';
|
|
81
|
+
export { useNavbarExpendableMenuContext } from './_tsup-dts-rollup';
|
|
73
82
|
export { NavbarProps } from './_tsup-dts-rollup';
|
|
74
83
|
export { NavbarLogo } from './_tsup-dts-rollup';
|
|
75
84
|
export { NavbarLogoAndServiceText } from './_tsup-dts-rollup';
|
package/dist/index-no-css.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export { CardBodyActionArrow } from './_tsup-dts-rollup';
|
|
|
37
37
|
export { DescriptionList } from './_tsup-dts-rollup';
|
|
38
38
|
export { DescriptionListProps } from './_tsup-dts-rollup';
|
|
39
39
|
export { Fieldset } from './_tsup-dts-rollup';
|
|
40
|
+
export { useFieldsetContext } from './_tsup-dts-rollup';
|
|
40
41
|
export { FieldsetProps } from './_tsup-dts-rollup';
|
|
41
42
|
export { Input } from './_tsup-dts-rollup';
|
|
42
43
|
export { InputProps } from './_tsup-dts-rollup';
|
|
@@ -48,11 +49,18 @@ export { Checkbox } from './_tsup-dts-rollup';
|
|
|
48
49
|
export { CheckboxProps } from './_tsup-dts-rollup';
|
|
49
50
|
export { Radiobutton } from './_tsup-dts-rollup';
|
|
50
51
|
export { RadioGroup } from './_tsup-dts-rollup';
|
|
52
|
+
export { useRadioGroupContext } from './_tsup-dts-rollup';
|
|
51
53
|
export { RadiobuttonProps } from './_tsup-dts-rollup';
|
|
52
54
|
export { RadioGroupProps } from './_tsup-dts-rollup';
|
|
53
|
-
export { useRadioGroupContext } from './_tsup-dts-rollup';
|
|
54
55
|
export { ErrorMessage } from './_tsup-dts-rollup';
|
|
55
56
|
export { ErrorMessageProps } from './_tsup-dts-rollup';
|
|
57
|
+
export { Footer } from './_tsup-dts-rollup';
|
|
58
|
+
export { FooterProps } from './_tsup-dts-rollup';
|
|
59
|
+
export { FooterButtonLinkProps } from './_tsup-dts-rollup';
|
|
60
|
+
export { FooterButtonLink } from './_tsup-dts-rollup';
|
|
61
|
+
export { FooterLogo } from './_tsup-dts-rollup';
|
|
62
|
+
export { FooterLinkSections } from './_tsup-dts-rollup';
|
|
63
|
+
export { FooterLinkSection } from './_tsup-dts-rollup';
|
|
56
64
|
export { Container } from './_tsup-dts-rollup';
|
|
57
65
|
export { ContainerProps } from './_tsup-dts-rollup';
|
|
58
66
|
export { Link } from './_tsup-dts-rollup';
|
|
@@ -70,6 +78,7 @@ export { ModalHeader } from './_tsup-dts-rollup';
|
|
|
70
78
|
export { ModalContent } from './_tsup-dts-rollup';
|
|
71
79
|
export { ModalFooter } from './_tsup-dts-rollup';
|
|
72
80
|
export { Navbar } from './_tsup-dts-rollup';
|
|
81
|
+
export { useNavbarExpendableMenuContext } from './_tsup-dts-rollup';
|
|
73
82
|
export { NavbarProps } from './_tsup-dts-rollup';
|
|
74
83
|
export { NavbarLogo } from './_tsup-dts-rollup';
|
|
75
84
|
export { NavbarLogoAndServiceText } from './_tsup-dts-rollup';
|