@postenbring/hedwig-react 4.2.0 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-J2DJ6ELO.mjs → chunk-62VLFCXX.mjs} +2 -2
- package/dist/{chunk-GIFDGUFW.mjs → chunk-DMRQEQQK.mjs} +2 -2
- package/dist/{chunk-4K54KSRB.mjs → chunk-DNCWDWK2.mjs} +5 -5
- package/dist/{chunk-7REW23LO.mjs → chunk-F23MNQCK.mjs} +4 -8
- package/dist/chunk-F23MNQCK.mjs.map +1 -0
- package/dist/chunk-JGQTAIEP.mjs +67 -0
- package/dist/chunk-JGQTAIEP.mjs.map +1 -0
- package/dist/{chunk-BUFV457A.mjs → chunk-JKKH77UC.mjs} +3 -3
- package/dist/{chunk-NMW3IWZ4.mjs → chunk-OQD4GKOS.mjs} +2 -2
- package/dist/{chunk-6O5AEAIL.mjs → chunk-RGZSYJFL.mjs} +2 -2
- package/dist/chunk-RJ763KDH.mjs +21 -0
- package/dist/chunk-RJ763KDH.mjs.map +1 -0
- package/dist/{chunk-OHPDYPZ5.mjs → chunk-SQNGMF3D.mjs} +5 -5
- package/dist/{chunk-77UAHNU6.mjs → chunk-VNH7CZJ4.mjs} +2 -2
- package/dist/{chunk-54HLJVAF.mjs → chunk-WMSOBRKN.mjs} +2 -2
- package/dist/form/checkbox/checkbox.js +3 -6
- package/dist/form/checkbox/checkbox.js.map +1 -1
- package/dist/form/checkbox/checkbox.mjs +5 -5
- package/dist/form/checkbox/index.js +3 -6
- package/dist/form/checkbox/index.js.map +1 -1
- package/dist/form/checkbox/index.mjs +5 -5
- package/dist/form/date-picker/date-picker.js +3 -6
- package/dist/form/date-picker/date-picker.js.map +1 -1
- package/dist/form/date-picker/date-picker.mjs +4 -4
- package/dist/form/date-picker/index.js +3 -6
- package/dist/form/date-picker/index.js.map +1 -1
- package/dist/form/date-picker/index.mjs +4 -4
- package/dist/form/error-message/error-message.js +3 -6
- package/dist/form/error-message/error-message.js.map +1 -1
- package/dist/form/error-message/error-message.mjs +2 -2
- package/dist/form/error-message/index.js +3 -6
- package/dist/form/error-message/index.js.map +1 -1
- package/dist/form/error-message/index.mjs +2 -2
- package/dist/form/error-summary/error-summary.mjs +1 -1
- package/dist/form/error-summary/index.mjs +1 -1
- package/dist/form/fieldset/fieldset.js +3 -6
- package/dist/form/fieldset/fieldset.js.map +1 -1
- package/dist/form/fieldset/fieldset.mjs +4 -4
- package/dist/form/fieldset/index.js +3 -6
- package/dist/form/fieldset/index.js.map +1 -1
- package/dist/form/fieldset/index.mjs +6 -6
- package/dist/form/index.js +51 -60
- package/dist/form/index.js.map +1 -1
- package/dist/form/index.mjs +20 -20
- package/dist/form/input/index.js +3 -6
- package/dist/form/input/index.js.map +1 -1
- package/dist/form/input/index.mjs +4 -4
- package/dist/form/input/input.js +3 -6
- package/dist/form/input/input.js.map +1 -1
- package/dist/form/input/input.mjs +4 -4
- package/dist/form/input-group/index.js +3 -6
- package/dist/form/input-group/index.js.map +1 -1
- package/dist/form/input-group/index.mjs +3 -3
- package/dist/form/input-group/input-group.js +3 -6
- package/dist/form/input-group/input-group.js.map +1 -1
- package/dist/form/input-group/input-group.mjs +3 -3
- package/dist/form/radio-button/index.js +3 -6
- package/dist/form/radio-button/index.js.map +1 -1
- package/dist/form/radio-button/index.mjs +6 -6
- package/dist/form/radio-button/radio-button.js +3 -6
- package/dist/form/radio-button/radio-button.js.map +1 -1
- package/dist/form/radio-button/radio-button.mjs +6 -6
- package/dist/form/radio-button/radio-group.js +3 -6
- package/dist/form/radio-button/radio-group.js.map +1 -1
- package/dist/form/radio-button/radio-group.mjs +5 -5
- package/dist/form/search-wrapper/index.js +6 -17
- package/dist/form/search-wrapper/index.js.map +1 -1
- package/dist/form/search-wrapper/index.mjs +1 -1
- package/dist/form/search-wrapper/search-wrapper.d.ts +2 -5
- package/dist/form/search-wrapper/search-wrapper.d.ts.map +1 -1
- package/dist/form/search-wrapper/search-wrapper.js +6 -17
- package/dist/form/search-wrapper/search-wrapper.js.map +1 -1
- package/dist/form/search-wrapper/search-wrapper.mjs +1 -1
- package/dist/form/select/index.js +45 -46
- package/dist/form/select/index.js.map +1 -1
- package/dist/form/select/index.mjs +4 -4
- package/dist/form/select/select.d.ts.map +1 -1
- package/dist/form/select/select.js +45 -46
- package/dist/form/select/select.js.map +1 -1
- package/dist/form/select/select.mjs +4 -4
- package/dist/form/textarea/index.js +3 -6
- package/dist/form/textarea/index.js.map +1 -1
- package/dist/form/textarea/index.mjs +4 -4
- package/dist/form/textarea/textarea.js +3 -6
- package/dist/form/textarea/textarea.js.map +1 -1
- package/dist/form/textarea/textarea.mjs +4 -4
- package/dist/form/validation-message/index.js +3 -9
- package/dist/form/validation-message/index.js.map +1 -1
- package/dist/form/validation-message/index.mjs +1 -1
- package/dist/form/validation-message/validation-message.d.ts +2 -4
- package/dist/form/validation-message/validation-message.d.ts.map +1 -1
- package/dist/form/validation-message/validation-message.js +3 -9
- package/dist/form/validation-message/validation-message.js.map +1 -1
- package/dist/form/validation-message/validation-message.mjs +1 -1
- package/dist/index.js +51 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -36
- package/package.json +2 -2
- package/src/form/search-wrapper/search-wrapper.tsx +7 -22
- package/src/form/select/select.tsx +21 -21
- package/src/form/validation-message/validation-message.tsx +4 -9
- package/dist/chunk-7REW23LO.mjs.map +0 -1
- package/dist/chunk-D7L7OLFL.mjs +0 -65
- package/dist/chunk-D7L7OLFL.mjs.map +0 -1
- package/dist/chunk-ZIVURWHY.mjs +0 -30
- package/dist/chunk-ZIVURWHY.mjs.map +0 -1
- /package/dist/{chunk-J2DJ6ELO.mjs.map → chunk-62VLFCXX.mjs.map} +0 -0
- /package/dist/{chunk-GIFDGUFW.mjs.map → chunk-DMRQEQQK.mjs.map} +0 -0
- /package/dist/{chunk-4K54KSRB.mjs.map → chunk-DNCWDWK2.mjs.map} +0 -0
- /package/dist/{chunk-BUFV457A.mjs.map → chunk-JKKH77UC.mjs.map} +0 -0
- /package/dist/{chunk-NMW3IWZ4.mjs.map → chunk-OQD4GKOS.mjs.map} +0 -0
- /package/dist/{chunk-6O5AEAIL.mjs.map → chunk-RGZSYJFL.mjs.map} +0 -0
- /package/dist/{chunk-OHPDYPZ5.mjs.map → chunk-SQNGMF3D.mjs.map} +0 -0
- /package/dist/{chunk-77UAHNU6.mjs.map → chunk-VNH7CZJ4.mjs.map} +0 -0
- /package/dist/{chunk-54HLJVAF.mjs.map → chunk-WMSOBRKN.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/radio-button/radio-button.tsx","../../../src/form/radio-button/radio-group.tsx","../../../src/form/fieldset/fieldset-description.tsx","../../../src/form/fieldset/fieldset.tsx","../../../src/form/validation-message/validation-message.tsx","../../../src/utils/utils.ts","../../../src/form/fieldset/fieldset-legend.tsx"],"sourcesContent":["import { forwardRef, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { useRadioGroupContext } from \"./radio-group\";\n\nexport interface RadioButtonProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\" | \"size\"> {\n children: ReactNode;\n variant?: \"plain\" | \"bounding-box\";\n title?: string;\n size?: \"small\" | \"\";\n}\n\nconst isChecked = ({\n checked,\n selectedValue,\n value,\n}: Pick<RadioButtonProps, \"checked\" | \"value\"> & {\n selectedValue: RadioButtonProps[\"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 ({ checked, value, variant = \"plain\", title, children, className, size = \"\", ...rest }, ref) => {\n const { value: selectedValue, size: groupSize, ...context } = useRadioGroupContext();\n const effectiveSize = size || groupSize;\n\n return (\n <div\n className={clsx(\n \"hds-radio-button\",\n {\n [`hds-radio-button--${variant}`]: variant === \"bounding-box\",\n [`hds-radio-button--${effectiveSize}`]: effectiveSize === \"small\",\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-radio-button__checkmark\" />\n {title ? <p className=\"hds-radio-button__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 InputHTMLAttributes,\n type ReactNode,\n useContext,\n} from \"react\";\nimport { FieldsetDescription } from \"../fieldset/fieldset-description\";\nimport { Fieldset, type FieldsetProps } from \"../fieldset\";\nimport { FieldsetLegend } from \"../fieldset/fieldset-legend\";\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?: InputHTMLAttributes<HTMLInputElement>[\"name\"];\n /** If you want the group to be controlled, you can pass the selected value here */\n value?: InputHTMLAttributes<HTMLInputElement>[\"value\"];\n /** Will be passed to all Radio buttons within the radio group */\n onChange?: ChangeEventHandler<HTMLInputElement> | undefined;\n}\n\ntype RadioGroupContextProps = Pick<RadioGroupProps, \"name\" | \"value\" | \"onChange\" | \"size\">;\n\nconst RadioGroupContext = createContext<RadioGroupContextProps>({\n name: undefined,\n onChange: () => undefined,\n size: undefined,\n});\n\nexport const useRadioGroupContext = () => useContext(RadioGroupContext);\n\nexport const RadioGroup = forwardRef<HTMLFieldSetElement, RadioGroupProps>(function RadioGroup(\n { name, value, onChange, children, size, ...rest },\n ref,\n) {\n return (\n <RadioGroupContext.Provider value={{ name, value, onChange, size }}>\n <Fieldset size={size} {...rest} ref={ref}>\n {children}\n </Fieldset>\n </RadioGroupContext.Provider>\n );\n}) as RadioGroupType;\n\ntype RadioGroupType = ReturnType<typeof forwardRef<HTMLFieldSetElement, RadioGroupProps>> & {\n Description: typeof FieldsetDescription;\n Legend: typeof FieldsetLegend;\n};\n\nRadioGroup.Description = FieldsetDescription;\nRadioGroup.Legend = FieldsetLegend;\n\nRadioGroup.displayName = \"RadioGroup\";\n","import { forwardRef, type HTMLAttributes } from \"react\";\n\nexport type FieldsetDescriptionProps = HTMLAttributes<HTMLParagraphElement>;\n\n/**\n * FieldsetDescription component, used to display a description for a fieldset.\n *\n * @example\n * <FieldsetDescription>\n * Gi en kort beskrivelse i begge feltene\n * </FieldsetDescription>\n */\nexport const FieldsetDescription = forwardRef<HTMLParagraphElement, FieldsetDescriptionProps>(\n function FieldsetDescription(rest, ref) {\n return <p className=\"hds-fieldset__description\" ref={ref} {...rest} />;\n },\n);\n","import {\n Children,\n cloneElement,\n isValidElement,\n useId,\n forwardRef,\n createContext,\n useContext,\n} from \"react\";\nimport type {\n FieldsetHTMLAttributes,\n ReactElement,\n ReactNode,\n CSSProperties,\n ComponentProps,\n} from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { getValidationMessageValue } from \"../../utils\";\nimport { FieldsetDescription } from \"./fieldset-description\";\nimport { FieldsetLegend } from \"./fieldset-legend\";\n\ntype FieldsetLegendProps = ComponentProps<typeof FieldsetLegend>;\n\nexport interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement> {\n className?: string;\n style?: CSSProperties;\n \"data-color\"?: \"info\" | \"success\" | \"warning\" | \"error\";\n validationMessage?: ReactNode | { value: ReactNode };\n validationMessageProps?: Partial<ValidationMessageProps>;\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\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n /**\n * @deprecated Pass props directly to <Fieldset.Legend> instead.\n */\n legendProps?: FieldsetLegendProps;\n /**\n * @deprecated Use <Fieldset.Legend>...</Fieldset.Legend> instead.\n */\n legend?: ReactNode;\n size?: \"small\" | \"\";\n children: ReactNode;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n}\n\n/** @deprecated Will no longer be needed */\nconst FieldsetContext = createContext<{ hasError: boolean; size: \"small\" | \"\" }>({\n hasError: false,\n size: \"\",\n});\n\n/** @deprecated Will no longer be needed */\nexport const useFieldsetContext = () => useContext(FieldsetContext);\n\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(function Fieldset(\n {\n className,\n style,\n \"data-color\": dataColor = undefined,\n validationMessage,\n validationMessageProps,\n errorMessage,\n errorMessageProps,\n legendProps,\n legend,\n size = \"\",\n children,\n ...rest\n },\n ref,\n) {\n const validationMessageId = useId();\n const validationColor = errorMessage ? \"error\" : dataColor;\n const validationMessageValue = getValidationMessageValue(validationMessage, errorMessage);\n const childArray = Children.toArray(children);\n const legendChild = childArray.find(\n (child): child is ReactElement<FieldsetLegendProps> =>\n isValidElement<FieldsetLegendProps>(child) && child.type === FieldsetLegend,\n );\n const contentChildren = legendChild\n ? childArray.filter((child) => child !== legendChild)\n : childArray;\n let renderedLegend = null;\n\n if (legendChild) {\n renderedLegend = cloneElement(legendChild, {\n ...legendProps,\n ...legendChild.props,\n className: clsx(\n legendProps?.className as undefined,\n legendChild.props.className as undefined,\n ),\n });\n } else if (legend !== undefined) {\n renderedLegend = <FieldsetLegend {...legendProps}>{legend}</FieldsetLegend>;\n }\n\n return (\n <fieldset\n aria-describedby={validationMessageValue ? validationMessageId : undefined}\n aria-invalid={errorMessage ? true : undefined}\n className={clsx(\"hds-fieldset\", { [`hds-fieldset--${size}`]: size }, className as undefined)}\n data-color={validationColor}\n ref={ref}\n style={style}\n {...rest}\n >\n {renderedLegend}\n <FieldsetContext.Provider value={{ hasError: Boolean(errorMessage), size }}>\n {contentChildren}\n </FieldsetContext.Provider>\n <ValidationMessage\n id={validationMessageId}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </fieldset>\n );\n}) as FieldsetType;\n\ntype FieldsetType = ReturnType<typeof forwardRef<HTMLFieldSetElement, FieldsetProps>> & {\n Description: typeof FieldsetDescription;\n Legend: typeof FieldsetLegend;\n};\n\nFieldset.Description = FieldsetDescription;\nFieldset.Legend = FieldsetLegend;\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nexport interface ValidationMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport const ValidationMessage = forwardRef<HTMLDivElement, ValidationMessageProps>(\n ({ children, id, className, ...rest }, ref) => (\n <div\n aria-live=\"polite\"\n className={clsx(\"hds-validation-message\", className as undefined)}\n id={id}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n ),\n);\nValidationMessage.displayName = \"ValidationMessage\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\nimport type { ReactNode } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\nexport function getValidationMessageValue(\n validationMessage?: ReactNode | { value: ReactNode },\n errorMessage?: ReactNode,\n): ReactNode {\n if (validationMessage) {\n if (typeof validationMessage === \"object\" && \"value\" in validationMessage) {\n return validationMessage.value;\n }\n\n return validationMessage;\n }\n\n return errorMessage;\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n","import { forwardRef, type HTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\n\n/**\n * FieldsetLegend component, used to display a legend for a fieldset.\n *\n * @example\n * <FieldsetLegend>Skriv inn dine svar</FieldsetLegend>\n */\nexport const FieldsetLegend = forwardRef<HTMLLegendElement, HTMLAttributes<HTMLLegendElement>>(\n function FieldsetLegend({ className, ...rest }, ref) {\n return (\n <legend\n className={clsx(\"hds-fieldset__legend\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\n\nFieldsetLegend.displayName = \"Fieldset.Legend\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAAqE;AACrE,IAAAC,0BAAqB;;;ACDrB,IAAAC,gBAOO;;;ACPP,mBAAgD;AAcrC;AAFJ,IAAM,0BAAsB;AAAA,EACjC,SAASC,qBAAoB,MAAM,KAAK;AACtC,WAAO,4CAAC,sBAAE,WAAU,6BAA4B,OAAc,KAAM;AAAA,EACtE;AACF;;;AChBA,IAAAC,gBAQO;AAQP,IAAAC,0BAAqB;;;AChBrB,6BAAqB;AACrB,IAAAC,gBAA2C;AAUvC,IAAAC,sBAAA;AAFG,IAAM,wBAAoB;AAAA,EAC/B,CAAC,IAAsC,QAAK;AAA3C,iBAAE,YAAU,IAAI,UAVnB,IAUG,IAA8B,iBAA9B,IAA8B,CAA5B,YAAU,MA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,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,+BAA8B;AAAA,YACzD,QAAQ,6CAAC,OAAE,WAAU,2BAA2B,iBAAM,IAAO;AAAA,aAChE;AAAA,UACC,QAAQ,WAAW;AAAA;AAAA;AAAA,IACtB;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;","names":["import_react","import_typed_classname","import_react","FieldsetDescription","import_react","import_typed_classname","import_react","import_jsx_runtime","import_react","import_react","import_typed_classname","import_jsx_runtime","FieldsetLegend","import_jsx_runtime","Fieldset","import_jsx_runtime","RadioGroup","import_jsx_runtime","_a"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/form/radio-button/radio-button.tsx","../../../src/form/radio-button/radio-group.tsx","../../../src/form/fieldset/fieldset-description.tsx","../../../src/form/fieldset/fieldset.tsx","../../../src/form/validation-message/validation-message.tsx","../../../src/utils/utils.ts","../../../src/form/fieldset/fieldset-legend.tsx"],"sourcesContent":["import { forwardRef, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { useRadioGroupContext } from \"./radio-group\";\n\nexport interface RadioButtonProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\" | \"size\"> {\n children: ReactNode;\n variant?: \"plain\" | \"bounding-box\";\n title?: string;\n size?: \"small\" | \"\";\n}\n\nconst isChecked = ({\n checked,\n selectedValue,\n value,\n}: Pick<RadioButtonProps, \"checked\" | \"value\"> & {\n selectedValue: RadioButtonProps[\"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 ({ checked, value, variant = \"plain\", title, children, className, size = \"\", ...rest }, ref) => {\n const { value: selectedValue, size: groupSize, ...context } = useRadioGroupContext();\n const effectiveSize = size || groupSize;\n\n return (\n <div\n className={clsx(\n \"hds-radio-button\",\n {\n [`hds-radio-button--${variant}`]: variant === \"bounding-box\",\n [`hds-radio-button--${effectiveSize}`]: effectiveSize === \"small\",\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-radio-button__checkmark\" />\n {title ? <p className=\"hds-radio-button__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 InputHTMLAttributes,\n type ReactNode,\n useContext,\n} from \"react\";\nimport { FieldsetDescription } from \"../fieldset/fieldset-description\";\nimport { Fieldset, type FieldsetProps } from \"../fieldset\";\nimport { FieldsetLegend } from \"../fieldset/fieldset-legend\";\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?: InputHTMLAttributes<HTMLInputElement>[\"name\"];\n /** If you want the group to be controlled, you can pass the selected value here */\n value?: InputHTMLAttributes<HTMLInputElement>[\"value\"];\n /** Will be passed to all Radio buttons within the radio group */\n onChange?: ChangeEventHandler<HTMLInputElement> | undefined;\n}\n\ntype RadioGroupContextProps = Pick<RadioGroupProps, \"name\" | \"value\" | \"onChange\" | \"size\">;\n\nconst RadioGroupContext = createContext<RadioGroupContextProps>({\n name: undefined,\n onChange: () => undefined,\n size: undefined,\n});\n\nexport const useRadioGroupContext = () => useContext(RadioGroupContext);\n\nexport const RadioGroup = forwardRef<HTMLFieldSetElement, RadioGroupProps>(function RadioGroup(\n { name, value, onChange, children, size, ...rest },\n ref,\n) {\n return (\n <RadioGroupContext.Provider value={{ name, value, onChange, size }}>\n <Fieldset size={size} {...rest} ref={ref}>\n {children}\n </Fieldset>\n </RadioGroupContext.Provider>\n );\n}) as RadioGroupType;\n\ntype RadioGroupType = ReturnType<typeof forwardRef<HTMLFieldSetElement, RadioGroupProps>> & {\n Description: typeof FieldsetDescription;\n Legend: typeof FieldsetLegend;\n};\n\nRadioGroup.Description = FieldsetDescription;\nRadioGroup.Legend = FieldsetLegend;\n\nRadioGroup.displayName = \"RadioGroup\";\n","import { forwardRef, type HTMLAttributes } from \"react\";\n\nexport type FieldsetDescriptionProps = HTMLAttributes<HTMLParagraphElement>;\n\n/**\n * FieldsetDescription component, used to display a description for a fieldset.\n *\n * @example\n * <FieldsetDescription>\n * Gi en kort beskrivelse i begge feltene\n * </FieldsetDescription>\n */\nexport const FieldsetDescription = forwardRef<HTMLParagraphElement, FieldsetDescriptionProps>(\n function FieldsetDescription(rest, ref) {\n return <p className=\"hds-fieldset__description\" ref={ref} {...rest} />;\n },\n);\n","import {\n Children,\n cloneElement,\n isValidElement,\n useId,\n forwardRef,\n createContext,\n useContext,\n} from \"react\";\nimport type {\n FieldsetHTMLAttributes,\n ReactElement,\n ReactNode,\n CSSProperties,\n ComponentProps,\n} from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { getValidationMessageValue } from \"../../utils\";\nimport { FieldsetDescription } from \"./fieldset-description\";\nimport { FieldsetLegend } from \"./fieldset-legend\";\n\ntype FieldsetLegendProps = ComponentProps<typeof FieldsetLegend>;\n\nexport interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement> {\n className?: string;\n style?: CSSProperties;\n \"data-color\"?: \"info\" | \"success\" | \"warning\" | \"error\";\n validationMessage?: ReactNode | { value: ReactNode };\n validationMessageProps?: Partial<ValidationMessageProps>;\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\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n /**\n * @deprecated Pass props directly to <Fieldset.Legend> instead.\n */\n legendProps?: FieldsetLegendProps;\n /**\n * @deprecated Use <Fieldset.Legend>...</Fieldset.Legend> instead.\n */\n legend?: ReactNode;\n size?: \"small\" | \"\";\n children: ReactNode;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n}\n\n/** @deprecated Will no longer be needed */\nconst FieldsetContext = createContext<{ hasError: boolean; size: \"small\" | \"\" }>({\n hasError: false,\n size: \"\",\n});\n\n/** @deprecated Will no longer be needed */\nexport const useFieldsetContext = () => useContext(FieldsetContext);\n\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(function Fieldset(\n {\n className,\n style,\n \"data-color\": dataColor = undefined,\n validationMessage,\n validationMessageProps,\n errorMessage,\n errorMessageProps,\n legendProps,\n legend,\n size = \"\",\n children,\n ...rest\n },\n ref,\n) {\n const validationMessageId = useId();\n const validationColor = errorMessage ? \"error\" : dataColor;\n const validationMessageValue = getValidationMessageValue(validationMessage, errorMessage);\n const childArray = Children.toArray(children);\n const legendChild = childArray.find(\n (child): child is ReactElement<FieldsetLegendProps> =>\n isValidElement<FieldsetLegendProps>(child) && child.type === FieldsetLegend,\n );\n const contentChildren = legendChild\n ? childArray.filter((child) => child !== legendChild)\n : childArray;\n let renderedLegend = null;\n\n if (legendChild) {\n renderedLegend = cloneElement(legendChild, {\n ...legendProps,\n ...legendChild.props,\n className: clsx(\n legendProps?.className as undefined,\n legendChild.props.className as undefined,\n ),\n });\n } else if (legend !== undefined) {\n renderedLegend = <FieldsetLegend {...legendProps}>{legend}</FieldsetLegend>;\n }\n\n return (\n <fieldset\n aria-describedby={validationMessageValue ? validationMessageId : undefined}\n aria-invalid={errorMessage ? true : undefined}\n className={clsx(\"hds-fieldset\", { [`hds-fieldset--${size}`]: size }, className as undefined)}\n data-color={validationColor}\n ref={ref}\n style={style}\n {...rest}\n >\n {renderedLegend}\n <FieldsetContext.Provider value={{ hasError: Boolean(errorMessage), size }}>\n {contentChildren}\n </FieldsetContext.Provider>\n <ValidationMessage\n id={validationMessageId}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </fieldset>\n );\n}) as FieldsetType;\n\ntype FieldsetType = ReturnType<typeof forwardRef<HTMLFieldSetElement, FieldsetProps>> & {\n Description: typeof FieldsetDescription;\n Legend: typeof FieldsetLegend;\n};\n\nFieldset.Description = FieldsetDescription;\nFieldset.Legend = FieldsetLegend;\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\n\nexport interface ValidationMessageProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n}\n\nexport const ValidationMessage = forwardRef<HTMLDivElement, ValidationMessageProps>(\n ({ className, ...rest }, ref) => (\n <div\n aria-live=\"polite\"\n className={clsx(\"hds-validation-message\", className as undefined)}\n ref={ref}\n {...rest}\n />\n ),\n);\nValidationMessage.displayName = \"ValidationMessage\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\nimport type { ReactNode } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\nexport function getValidationMessageValue(\n validationMessage?: ReactNode | { value: ReactNode },\n errorMessage?: ReactNode,\n): ReactNode {\n if (validationMessage) {\n if (typeof validationMessage === \"object\" && \"value\" in validationMessage) {\n return validationMessage.value;\n }\n\n return validationMessage;\n }\n\n return errorMessage;\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n","import { forwardRef, type HTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\n\n/**\n * FieldsetLegend component, used to display a legend for a fieldset.\n *\n * @example\n * <FieldsetLegend>Skriv inn dine svar</FieldsetLegend>\n */\nexport const FieldsetLegend = forwardRef<HTMLLegendElement, HTMLAttributes<HTMLLegendElement>>(\n function FieldsetLegend({ className, ...rest }, ref) {\n return (\n <legend\n className={clsx(\"hds-fieldset__legend\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\n\nFieldsetLegend.displayName = \"Fieldset.Legend\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAAqE;AACrE,IAAAC,0BAAqB;;;ACDrB,IAAAC,gBAOO;;;ACPP,mBAAgD;AAcrC;AAFJ,IAAM,0BAAsB;AAAA,EACjC,SAASC,qBAAoB,MAAM,KAAK;AACtC,WAAO,4CAAC,sBAAE,WAAU,6BAA4B,OAAc,KAAM;AAAA,EACtE;AACF;;;AChBA,IAAAC,gBAQO;AAQP,IAAAC,0BAAqB;;;AChBrB,6BAAqB;AACrB,IAAAC,gBAAgD;AAQ5C,IAAAC,sBAAA;AAFG,IAAM,wBAAoB;AAAA,EAC/B,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C,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,+BAA8B;AAAA,YACzD,QAAQ,6CAAC,OAAE,WAAU,2BAA2B,iBAAM,IAAO;AAAA,aAChE;AAAA,UACC,QAAQ,WAAW;AAAA;AAAA;AAAA,IACtB;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;","names":["import_react","import_typed_classname","import_react","FieldsetDescription","import_react","import_typed_classname","import_react","import_jsx_runtime","import_react","import_react","import_typed_classname","import_jsx_runtime","FieldsetLegend","import_jsx_runtime","Fieldset","import_jsx_runtime","RadioGroup","import_jsx_runtime","_a"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RadioButton
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-WMSOBRKN.mjs";
|
|
4
|
+
import "../../chunk-SQNGMF3D.mjs";
|
|
5
5
|
import "../../chunk-CSIXGT7P.mjs";
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-D2XZT2RA.mjs";
|
|
6
|
+
import "../../chunk-DNCWDWK2.mjs";
|
|
8
7
|
import "../../chunk-CD4LCDK3.mjs";
|
|
9
8
|
import "../../chunk-NSLSA7F7.mjs";
|
|
10
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-VNH7CZJ4.mjs";
|
|
11
10
|
import "../../chunk-5M6MEYM7.mjs";
|
|
12
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-F23MNQCK.mjs";
|
|
12
|
+
import "../../chunk-D2XZT2RA.mjs";
|
|
13
13
|
import "../../chunk-CYDWEPFL.mjs";
|
|
14
14
|
import "../../chunk-KPNAC2WN.mjs";
|
|
15
15
|
import "../../chunk-3V4GFS46.mjs";
|
|
@@ -84,17 +84,14 @@ var import_react2 = require("react");
|
|
|
84
84
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
85
85
|
var ValidationMessage = (0, import_react2.forwardRef)(
|
|
86
86
|
(_a, ref) => {
|
|
87
|
-
var _b = _a, {
|
|
87
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
|
88
88
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
89
89
|
"div",
|
|
90
|
-
|
|
90
|
+
__spreadValues({
|
|
91
91
|
"aria-live": "polite",
|
|
92
92
|
className: (0, import_typed_classname.clsx)("hds-validation-message", className),
|
|
93
|
-
id,
|
|
94
93
|
ref
|
|
95
|
-
}, rest)
|
|
96
|
-
children
|
|
97
|
-
})
|
|
94
|
+
}, rest)
|
|
98
95
|
);
|
|
99
96
|
}
|
|
100
97
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/radio-button/radio-group.tsx","../../../src/form/fieldset/fieldset-description.tsx","../../../src/form/fieldset/fieldset.tsx","../../../src/form/validation-message/validation-message.tsx","../../../src/utils/utils.ts","../../../src/form/fieldset/fieldset-legend.tsx"],"sourcesContent":["import {\n type ChangeEventHandler,\n createContext,\n forwardRef,\n type InputHTMLAttributes,\n type ReactNode,\n useContext,\n} from \"react\";\nimport { FieldsetDescription } from \"../fieldset/fieldset-description\";\nimport { Fieldset, type FieldsetProps } from \"../fieldset\";\nimport { FieldsetLegend } from \"../fieldset/fieldset-legend\";\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?: InputHTMLAttributes<HTMLInputElement>[\"name\"];\n /** If you want the group to be controlled, you can pass the selected value here */\n value?: InputHTMLAttributes<HTMLInputElement>[\"value\"];\n /** Will be passed to all Radio buttons within the radio group */\n onChange?: ChangeEventHandler<HTMLInputElement> | undefined;\n}\n\ntype RadioGroupContextProps = Pick<RadioGroupProps, \"name\" | \"value\" | \"onChange\" | \"size\">;\n\nconst RadioGroupContext = createContext<RadioGroupContextProps>({\n name: undefined,\n onChange: () => undefined,\n size: undefined,\n});\n\nexport const useRadioGroupContext = () => useContext(RadioGroupContext);\n\nexport const RadioGroup = forwardRef<HTMLFieldSetElement, RadioGroupProps>(function RadioGroup(\n { name, value, onChange, children, size, ...rest },\n ref,\n) {\n return (\n <RadioGroupContext.Provider value={{ name, value, onChange, size }}>\n <Fieldset size={size} {...rest} ref={ref}>\n {children}\n </Fieldset>\n </RadioGroupContext.Provider>\n );\n}) as RadioGroupType;\n\ntype RadioGroupType = ReturnType<typeof forwardRef<HTMLFieldSetElement, RadioGroupProps>> & {\n Description: typeof FieldsetDescription;\n Legend: typeof FieldsetLegend;\n};\n\nRadioGroup.Description = FieldsetDescription;\nRadioGroup.Legend = FieldsetLegend;\n\nRadioGroup.displayName = \"RadioGroup\";\n","import { forwardRef, type HTMLAttributes } from \"react\";\n\nexport type FieldsetDescriptionProps = HTMLAttributes<HTMLParagraphElement>;\n\n/**\n * FieldsetDescription component, used to display a description for a fieldset.\n *\n * @example\n * <FieldsetDescription>\n * Gi en kort beskrivelse i begge feltene\n * </FieldsetDescription>\n */\nexport const FieldsetDescription = forwardRef<HTMLParagraphElement, FieldsetDescriptionProps>(\n function FieldsetDescription(rest, ref) {\n return <p className=\"hds-fieldset__description\" ref={ref} {...rest} />;\n },\n);\n","import {\n Children,\n cloneElement,\n isValidElement,\n useId,\n forwardRef,\n createContext,\n useContext,\n} from \"react\";\nimport type {\n FieldsetHTMLAttributes,\n ReactElement,\n ReactNode,\n CSSProperties,\n ComponentProps,\n} from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { getValidationMessageValue } from \"../../utils\";\nimport { FieldsetDescription } from \"./fieldset-description\";\nimport { FieldsetLegend } from \"./fieldset-legend\";\n\ntype FieldsetLegendProps = ComponentProps<typeof FieldsetLegend>;\n\nexport interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement> {\n className?: string;\n style?: CSSProperties;\n \"data-color\"?: \"info\" | \"success\" | \"warning\" | \"error\";\n validationMessage?: ReactNode | { value: ReactNode };\n validationMessageProps?: Partial<ValidationMessageProps>;\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\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n /**\n * @deprecated Pass props directly to <Fieldset.Legend> instead.\n */\n legendProps?: FieldsetLegendProps;\n /**\n * @deprecated Use <Fieldset.Legend>...</Fieldset.Legend> instead.\n */\n legend?: ReactNode;\n size?: \"small\" | \"\";\n children: ReactNode;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n}\n\n/** @deprecated Will no longer be needed */\nconst FieldsetContext = createContext<{ hasError: boolean; size: \"small\" | \"\" }>({\n hasError: false,\n size: \"\",\n});\n\n/** @deprecated Will no longer be needed */\nexport const useFieldsetContext = () => useContext(FieldsetContext);\n\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(function Fieldset(\n {\n className,\n style,\n \"data-color\": dataColor = undefined,\n validationMessage,\n validationMessageProps,\n errorMessage,\n errorMessageProps,\n legendProps,\n legend,\n size = \"\",\n children,\n ...rest\n },\n ref,\n) {\n const validationMessageId = useId();\n const validationColor = errorMessage ? \"error\" : dataColor;\n const validationMessageValue = getValidationMessageValue(validationMessage, errorMessage);\n const childArray = Children.toArray(children);\n const legendChild = childArray.find(\n (child): child is ReactElement<FieldsetLegendProps> =>\n isValidElement<FieldsetLegendProps>(child) && child.type === FieldsetLegend,\n );\n const contentChildren = legendChild\n ? childArray.filter((child) => child !== legendChild)\n : childArray;\n let renderedLegend = null;\n\n if (legendChild) {\n renderedLegend = cloneElement(legendChild, {\n ...legendProps,\n ...legendChild.props,\n className: clsx(\n legendProps?.className as undefined,\n legendChild.props.className as undefined,\n ),\n });\n } else if (legend !== undefined) {\n renderedLegend = <FieldsetLegend {...legendProps}>{legend}</FieldsetLegend>;\n }\n\n return (\n <fieldset\n aria-describedby={validationMessageValue ? validationMessageId : undefined}\n aria-invalid={errorMessage ? true : undefined}\n className={clsx(\"hds-fieldset\", { [`hds-fieldset--${size}`]: size }, className as undefined)}\n data-color={validationColor}\n ref={ref}\n style={style}\n {...rest}\n >\n {renderedLegend}\n <FieldsetContext.Provider value={{ hasError: Boolean(errorMessage), size }}>\n {contentChildren}\n </FieldsetContext.Provider>\n <ValidationMessage\n id={validationMessageId}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </fieldset>\n );\n}) as FieldsetType;\n\ntype FieldsetType = ReturnType<typeof forwardRef<HTMLFieldSetElement, FieldsetProps>> & {\n Description: typeof FieldsetDescription;\n Legend: typeof FieldsetLegend;\n};\n\nFieldset.Description = FieldsetDescription;\nFieldset.Legend = FieldsetLegend;\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nexport interface ValidationMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport const ValidationMessage = forwardRef<HTMLDivElement, ValidationMessageProps>(\n ({ children, id, className, ...rest }, ref) => (\n <div\n aria-live=\"polite\"\n className={clsx(\"hds-validation-message\", className as undefined)}\n id={id}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n ),\n);\nValidationMessage.displayName = \"ValidationMessage\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\nimport type { ReactNode } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\nexport function getValidationMessageValue(\n validationMessage?: ReactNode | { value: ReactNode },\n errorMessage?: ReactNode,\n): ReactNode {\n if (validationMessage) {\n if (typeof validationMessage === \"object\" && \"value\" in validationMessage) {\n return validationMessage.value;\n }\n\n return validationMessage;\n }\n\n return errorMessage;\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n","import { forwardRef, type HTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\n\n/**\n * FieldsetLegend component, used to display a legend for a fieldset.\n *\n * @example\n * <FieldsetLegend>Skriv inn dine svar</FieldsetLegend>\n */\nexport const FieldsetLegend = forwardRef<HTMLLegendElement, HTMLAttributes<HTMLLegendElement>>(\n function FieldsetLegend({ className, ...rest }, ref) {\n return (\n <legend\n className={clsx(\"hds-fieldset__legend\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\n\nFieldsetLegend.displayName = \"Fieldset.Legend\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;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Y;AAAA,MACZ;AAAA,MACA;AAAA,OACI,OAPL;AAAA,MASE;AAAA;AAAA,QACD,6CAAC,gBAAgB,UAAhB,EAAyB,OAAO,EAAE,UAAU,QAAQ,YAAY,GAAG,KAAK,GACtE,2BACH;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,IAAI;AAAA,aACC,0DAA0B,oBAFhC;AAAA,YAIE;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;AAOD,SAAS,cAAc;AACvB,SAAS,SAAS;;;AFlGZ,IAAAC,sBAAA;AAdN,IAAM,wBAAoB,6BAAsC;AAAA,EAC9D,MAAM;AAAA,EACN,UAAU,MAAM;AAAA,EAChB,MAAM;AACR,CAAC;AAEM,IAAM,uBAAuB,UAAM,0BAAW,iBAAiB;AAE/D,IAAM,iBAAa,0BAAiD,SAASC,YAClF,IACA,KACA;AAFA,eAAE,QAAM,OAAO,UAAU,UAAU,KAjCrC,IAiCE,IAA4C,iBAA5C,IAA4C,CAA1C,QAAM,SAAO,YAAU,YAAU;AAGnC,SACE,6CAAC,kBAAkB,UAAlB,EAA2B,OAAO,EAAE,MAAM,OAAO,UAAU,KAAK,GAC/D,uDAAC,yCAAS,QAAgB,OAAzB,EAA+B,KAC7B,WACH,GACF;AAEJ,CAAC;AAOD,WAAW,cAAc;AACzB,WAAW,SAAS;AAEpB,WAAW,cAAc;","names":["import_react","FieldsetDescription","import_react","import_typed_classname","import_react","import_jsx_runtime","import_react","import_react","import_typed_classname","import_jsx_runtime","FieldsetLegend","import_jsx_runtime","Fieldset","import_jsx_runtime","RadioGroup"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/form/radio-button/radio-group.tsx","../../../src/form/fieldset/fieldset-description.tsx","../../../src/form/fieldset/fieldset.tsx","../../../src/form/validation-message/validation-message.tsx","../../../src/utils/utils.ts","../../../src/form/fieldset/fieldset-legend.tsx"],"sourcesContent":["import {\n type ChangeEventHandler,\n createContext,\n forwardRef,\n type InputHTMLAttributes,\n type ReactNode,\n useContext,\n} from \"react\";\nimport { FieldsetDescription } from \"../fieldset/fieldset-description\";\nimport { Fieldset, type FieldsetProps } from \"../fieldset\";\nimport { FieldsetLegend } from \"../fieldset/fieldset-legend\";\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?: InputHTMLAttributes<HTMLInputElement>[\"name\"];\n /** If you want the group to be controlled, you can pass the selected value here */\n value?: InputHTMLAttributes<HTMLInputElement>[\"value\"];\n /** Will be passed to all Radio buttons within the radio group */\n onChange?: ChangeEventHandler<HTMLInputElement> | undefined;\n}\n\ntype RadioGroupContextProps = Pick<RadioGroupProps, \"name\" | \"value\" | \"onChange\" | \"size\">;\n\nconst RadioGroupContext = createContext<RadioGroupContextProps>({\n name: undefined,\n onChange: () => undefined,\n size: undefined,\n});\n\nexport const useRadioGroupContext = () => useContext(RadioGroupContext);\n\nexport const RadioGroup = forwardRef<HTMLFieldSetElement, RadioGroupProps>(function RadioGroup(\n { name, value, onChange, children, size, ...rest },\n ref,\n) {\n return (\n <RadioGroupContext.Provider value={{ name, value, onChange, size }}>\n <Fieldset size={size} {...rest} ref={ref}>\n {children}\n </Fieldset>\n </RadioGroupContext.Provider>\n );\n}) as RadioGroupType;\n\ntype RadioGroupType = ReturnType<typeof forwardRef<HTMLFieldSetElement, RadioGroupProps>> & {\n Description: typeof FieldsetDescription;\n Legend: typeof FieldsetLegend;\n};\n\nRadioGroup.Description = FieldsetDescription;\nRadioGroup.Legend = FieldsetLegend;\n\nRadioGroup.displayName = \"RadioGroup\";\n","import { forwardRef, type HTMLAttributes } from \"react\";\n\nexport type FieldsetDescriptionProps = HTMLAttributes<HTMLParagraphElement>;\n\n/**\n * FieldsetDescription component, used to display a description for a fieldset.\n *\n * @example\n * <FieldsetDescription>\n * Gi en kort beskrivelse i begge feltene\n * </FieldsetDescription>\n */\nexport const FieldsetDescription = forwardRef<HTMLParagraphElement, FieldsetDescriptionProps>(\n function FieldsetDescription(rest, ref) {\n return <p className=\"hds-fieldset__description\" ref={ref} {...rest} />;\n },\n);\n","import {\n Children,\n cloneElement,\n isValidElement,\n useId,\n forwardRef,\n createContext,\n useContext,\n} from \"react\";\nimport type {\n FieldsetHTMLAttributes,\n ReactElement,\n ReactNode,\n CSSProperties,\n ComponentProps,\n} from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { getValidationMessageValue } from \"../../utils\";\nimport { FieldsetDescription } from \"./fieldset-description\";\nimport { FieldsetLegend } from \"./fieldset-legend\";\n\ntype FieldsetLegendProps = ComponentProps<typeof FieldsetLegend>;\n\nexport interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement> {\n className?: string;\n style?: CSSProperties;\n \"data-color\"?: \"info\" | \"success\" | \"warning\" | \"error\";\n validationMessage?: ReactNode | { value: ReactNode };\n validationMessageProps?: Partial<ValidationMessageProps>;\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\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n /**\n * @deprecated Pass props directly to <Fieldset.Legend> instead.\n */\n legendProps?: FieldsetLegendProps;\n /**\n * @deprecated Use <Fieldset.Legend>...</Fieldset.Legend> instead.\n */\n legend?: ReactNode;\n size?: \"small\" | \"\";\n children: ReactNode;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n}\n\n/** @deprecated Will no longer be needed */\nconst FieldsetContext = createContext<{ hasError: boolean; size: \"small\" | \"\" }>({\n hasError: false,\n size: \"\",\n});\n\n/** @deprecated Will no longer be needed */\nexport const useFieldsetContext = () => useContext(FieldsetContext);\n\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(function Fieldset(\n {\n className,\n style,\n \"data-color\": dataColor = undefined,\n validationMessage,\n validationMessageProps,\n errorMessage,\n errorMessageProps,\n legendProps,\n legend,\n size = \"\",\n children,\n ...rest\n },\n ref,\n) {\n const validationMessageId = useId();\n const validationColor = errorMessage ? \"error\" : dataColor;\n const validationMessageValue = getValidationMessageValue(validationMessage, errorMessage);\n const childArray = Children.toArray(children);\n const legendChild = childArray.find(\n (child): child is ReactElement<FieldsetLegendProps> =>\n isValidElement<FieldsetLegendProps>(child) && child.type === FieldsetLegend,\n );\n const contentChildren = legendChild\n ? childArray.filter((child) => child !== legendChild)\n : childArray;\n let renderedLegend = null;\n\n if (legendChild) {\n renderedLegend = cloneElement(legendChild, {\n ...legendProps,\n ...legendChild.props,\n className: clsx(\n legendProps?.className as undefined,\n legendChild.props.className as undefined,\n ),\n });\n } else if (legend !== undefined) {\n renderedLegend = <FieldsetLegend {...legendProps}>{legend}</FieldsetLegend>;\n }\n\n return (\n <fieldset\n aria-describedby={validationMessageValue ? validationMessageId : undefined}\n aria-invalid={errorMessage ? true : undefined}\n className={clsx(\"hds-fieldset\", { [`hds-fieldset--${size}`]: size }, className as undefined)}\n data-color={validationColor}\n ref={ref}\n style={style}\n {...rest}\n >\n {renderedLegend}\n <FieldsetContext.Provider value={{ hasError: Boolean(errorMessage), size }}>\n {contentChildren}\n </FieldsetContext.Provider>\n <ValidationMessage\n id={validationMessageId}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </fieldset>\n );\n}) as FieldsetType;\n\ntype FieldsetType = ReturnType<typeof forwardRef<HTMLFieldSetElement, FieldsetProps>> & {\n Description: typeof FieldsetDescription;\n Legend: typeof FieldsetLegend;\n};\n\nFieldset.Description = FieldsetDescription;\nFieldset.Legend = FieldsetLegend;\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\n\nexport interface ValidationMessageProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n}\n\nexport const ValidationMessage = forwardRef<HTMLDivElement, ValidationMessageProps>(\n ({ className, ...rest }, ref) => (\n <div\n aria-live=\"polite\"\n className={clsx(\"hds-validation-message\", className as undefined)}\n ref={ref}\n {...rest}\n />\n ),\n);\nValidationMessage.displayName = \"ValidationMessage\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\nimport type { ReactNode } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\nexport function getValidationMessageValue(\n validationMessage?: ReactNode | { value: ReactNode },\n errorMessage?: ReactNode,\n): ReactNode {\n if (validationMessage) {\n if (typeof validationMessage === \"object\" && \"value\" in validationMessage) {\n return validationMessage.value;\n }\n\n return validationMessage;\n }\n\n return errorMessage;\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n","import { forwardRef, type HTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\n\n/**\n * FieldsetLegend component, used to display a legend for a fieldset.\n *\n * @example\n * <FieldsetLegend>Skriv inn dine svar</FieldsetLegend>\n */\nexport const FieldsetLegend = forwardRef<HTMLLegendElement, HTMLAttributes<HTMLLegendElement>>(\n function FieldsetLegend({ className, ...rest }, ref) {\n return (\n <legend\n className={clsx(\"hds-fieldset__legend\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\n\nFieldsetLegend.displayName = \"Fieldset.Legend\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAOO;;;ACPP,mBAAgD;AAcrC;AAFJ,IAAM,0BAAsB;AAAA,EACjC,SAASC,qBAAoB,MAAM,KAAK;AACtC,WAAO,4CAAC,sBAAE,WAAU,6BAA4B,OAAc,KAAM;AAAA,EACtE;AACF;;;AChBA,IAAAC,gBAQO;AAQP,IAAAC,0BAAqB;;;AChBrB,6BAAqB;AACrB,IAAAC,gBAAgD;AAQ5C,IAAAC,sBAAA;AAFG,IAAM,wBAAoB;AAAA,EAC/B,CAAC,IAAwB,QAAK;AAA7B,iBAAE,YARL,IAQG,IAAgB,iBAAhB,IAAgB,CAAd;AACD;AAAA,MAAC;AAAA;AAAA,QACC,aAAU;AAAA,QACV,eAAW,6BAAK,0BAA0B,SAAsB;AAAA,QAChE;AAAA,SACI;AAAA,IACN;AAAA;AAEJ;AACA,kBAAkB,cAAc;;;ACjBhC,YAAuB;AACvB,IAAAC,gBAA0D;AAmEnD,SAAS,0BACd,mBACA,cACW;AACX,MAAI,mBAAmB;AACrB,QAAI,OAAO,sBAAsB,YAAY,WAAW,mBAAmB;AACzE,aAAO,kBAAkB;AAAA,IAC3B;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAkDA,IAAM,wBAAiC,OAAO,sBAAQ,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK;;;ACnIxE,IAAAC,gBAAgD;AACh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A,IACF,EAAC;AAAA,EACH,WAAW,WAAW,QAAW;AAC/B,qBAAiB,6CAAC,iDAAmB,cAAnB,EAAiC,mBAAO;AAAA,EAC5D;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,oBAAkB,yBAAyB,sBAAsB;AAAA,MACjE,gBAAc,eAAe,OAAO;AAAA,MACpC,eAAW,8BAAK,gBAAgB,EAAE,CAAC,iBAAiB,IAAI,EAAE,GAAG,KAAK,GAAG,SAAsB;AAAA,MAC3F,cAAY;AAAA,MACZ;AAAA,MACA;AAAA,OACI,OAPL;AAAA,MASE;AAAA;AAAA,QACD,6CAAC,gBAAgB,UAAhB,EAAyB,OAAO,EAAE,UAAU,QAAQ,YAAY,GAAG,KAAK,GACtE,2BACH;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,IAAI;AAAA,aACC,0DAA0B,oBAFhC;AAAA,YAIE;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;AAOD,SAAS,cAAc;AACvB,SAAS,SAAS;;;AFlGZ,IAAAC,sBAAA;AAdN,IAAM,wBAAoB,6BAAsC;AAAA,EAC9D,MAAM;AAAA,EACN,UAAU,MAAM;AAAA,EAChB,MAAM;AACR,CAAC;AAEM,IAAM,uBAAuB,UAAM,0BAAW,iBAAiB;AAE/D,IAAM,iBAAa,0BAAiD,SAASC,YAClF,IACA,KACA;AAFA,eAAE,QAAM,OAAO,UAAU,UAAU,KAjCrC,IAiCE,IAA4C,iBAA5C,IAA4C,CAA1C,QAAM,SAAO,YAAU,YAAU;AAGnC,SACE,6CAAC,kBAAkB,UAAlB,EAA2B,OAAO,EAAE,MAAM,OAAO,UAAU,KAAK,GAC/D,uDAAC,yCAAS,QAAgB,OAAzB,EAA+B,KAC7B,WACH,GACF;AAEJ,CAAC;AAOD,WAAW,cAAc;AACzB,WAAW,SAAS;AAEpB,WAAW,cAAc;","names":["import_react","FieldsetDescription","import_react","import_typed_classname","import_react","import_jsx_runtime","import_react","import_react","import_typed_classname","import_jsx_runtime","FieldsetLegend","import_jsx_runtime","Fieldset","import_jsx_runtime","RadioGroup"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RadioGroup,
|
|
3
3
|
useRadioGroupContext
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-SQNGMF3D.mjs";
|
|
5
5
|
import "../../chunk-CSIXGT7P.mjs";
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-D2XZT2RA.mjs";
|
|
6
|
+
import "../../chunk-DNCWDWK2.mjs";
|
|
8
7
|
import "../../chunk-CD4LCDK3.mjs";
|
|
9
8
|
import "../../chunk-NSLSA7F7.mjs";
|
|
10
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-VNH7CZJ4.mjs";
|
|
11
10
|
import "../../chunk-5M6MEYM7.mjs";
|
|
12
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-F23MNQCK.mjs";
|
|
12
|
+
import "../../chunk-D2XZT2RA.mjs";
|
|
13
13
|
import "../../chunk-CYDWEPFL.mjs";
|
|
14
14
|
import "../../chunk-KPNAC2WN.mjs";
|
|
15
15
|
import "../../chunk-3V4GFS46.mjs";
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
5
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
@@ -19,7 +17,6 @@ var __spreadValues = (a, b) => {
|
|
|
19
17
|
}
|
|
20
18
|
return a;
|
|
21
19
|
};
|
|
22
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
20
|
var __objRest = (source, exclude) => {
|
|
24
21
|
var target = {};
|
|
25
22
|
for (var prop in source)
|
|
@@ -57,20 +54,12 @@ module.exports = __toCommonJS(search_wrapper_exports);
|
|
|
57
54
|
var import_react = require("react");
|
|
58
55
|
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
|
|
59
56
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
60
|
-
var SearchWrapper = (0, import_react.forwardRef)(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"div",
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
className: (0, import_typed_classname.clsx)("hds-search-wrapper", className),
|
|
67
|
-
ref,
|
|
68
|
-
style
|
|
69
|
-
}, rest), {
|
|
70
|
-
children
|
|
71
|
-
})
|
|
72
|
-
);
|
|
73
|
-
});
|
|
57
|
+
var SearchWrapper = (0, import_react.forwardRef)(
|
|
58
|
+
(_a, ref) => {
|
|
59
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", __spreadValues({ className: (0, import_typed_classname.clsx)("hds-search-wrapper", className), ref }, rest));
|
|
61
|
+
}
|
|
62
|
+
);
|
|
74
63
|
SearchWrapper.displayName = "SearchWrapper";
|
|
75
64
|
// Annotate the CommonJS export names for ESM import in node:
|
|
76
65
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/search-wrapper/index.tsx","../../../src/form/search-wrapper/search-wrapper.tsx"],"sourcesContent":["export { SearchWrapper } from \"./search-wrapper\";\nexport type * from \"./search-wrapper\";\n","import { forwardRef
|
|
1
|
+
{"version":3,"sources":["../../../src/form/search-wrapper/index.tsx","../../../src/form/search-wrapper/search-wrapper.tsx"],"sourcesContent":["export { SearchWrapper } from \"./search-wrapper\";\nexport type * from \"./search-wrapper\";\n","import { forwardRef, type HTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\n\nexport interface SearchWrapperProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n}\n\nexport const SearchWrapper = forwardRef<HTMLDivElement, SearchWrapperProps>(\n ({ className, ...rest }, ref) => (\n <div className={clsx(\"hds-search-wrapper\", className as undefined)} ref={ref} {...rest} />\n ),\n);\n\nSearchWrapper.displayName = \"SearchWrapper\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAgD;AAChD,6BAAqB;AAQjB;AAFG,IAAM,oBAAgB;AAAA,EAC3B,CAAC,IAAwB,QAAK;AAA7B,iBAAE,YARL,IAQG,IAAgB,iBAAhB,IAAgB,CAAd;AACD,uDAAC,wBAAI,eAAW,6BAAK,sBAAsB,SAAsB,GAAG,OAAc,KAAM;AAAA;AAE5F;AAEA,cAAc,cAAc;","names":[]}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
export interface SearchWrapperProps {
|
|
3
|
-
id?: string;
|
|
1
|
+
import { type HTMLAttributes } from "react";
|
|
2
|
+
export interface SearchWrapperProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
3
|
className?: string;
|
|
5
|
-
style?: CSSProperties;
|
|
6
|
-
children: ReactNode;
|
|
7
4
|
}
|
|
8
5
|
export declare const SearchWrapper: import("react").ForwardRefExoticComponent<SearchWrapperProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
6
|
//# sourceMappingURL=search-wrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-wrapper.d.ts","sourceRoot":"","sources":["../../../src/form/search-wrapper/search-wrapper.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search-wrapper.d.ts","sourceRoot":"","sources":["../../../src/form/search-wrapper/search-wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAGxD,MAAM,WAAW,kBAAmB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,aAAa,+GAIzB,CAAC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
5
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
@@ -19,7 +17,6 @@ var __spreadValues = (a, b) => {
|
|
|
19
17
|
}
|
|
20
18
|
return a;
|
|
21
19
|
};
|
|
22
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
20
|
var __objRest = (source, exclude) => {
|
|
24
21
|
var target = {};
|
|
25
22
|
for (var prop in source)
|
|
@@ -55,20 +52,12 @@ module.exports = __toCommonJS(search_wrapper_exports);
|
|
|
55
52
|
var import_react = require("react");
|
|
56
53
|
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
|
|
57
54
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
58
|
-
var SearchWrapper = (0, import_react.forwardRef)(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"div",
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
className: (0, import_typed_classname.clsx)("hds-search-wrapper", className),
|
|
65
|
-
ref,
|
|
66
|
-
style
|
|
67
|
-
}, rest), {
|
|
68
|
-
children
|
|
69
|
-
})
|
|
70
|
-
);
|
|
71
|
-
});
|
|
55
|
+
var SearchWrapper = (0, import_react.forwardRef)(
|
|
56
|
+
(_a, ref) => {
|
|
57
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
|
58
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", __spreadValues({ className: (0, import_typed_classname.clsx)("hds-search-wrapper", className), ref }, rest));
|
|
59
|
+
}
|
|
60
|
+
);
|
|
72
61
|
SearchWrapper.displayName = "SearchWrapper";
|
|
73
62
|
// Annotate the CommonJS export names for ESM import in node:
|
|
74
63
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/search-wrapper/search-wrapper.tsx"],"sourcesContent":["import { forwardRef
|
|
1
|
+
{"version":3,"sources":["../../../src/form/search-wrapper/search-wrapper.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\n\nexport interface SearchWrapperProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n}\n\nexport const SearchWrapper = forwardRef<HTMLDivElement, SearchWrapperProps>(\n ({ className, ...rest }, ref) => (\n <div className={clsx(\"hds-search-wrapper\", className as undefined)} ref={ref} {...rest} />\n ),\n);\n\nSearchWrapper.displayName = \"SearchWrapper\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgD;AAChD,6BAAqB;AAQjB;AAFG,IAAM,oBAAgB;AAAA,EAC3B,CAAC,IAAwB,QAAK;AAA7B,iBAAE,YARL,IAQG,IAAgB,iBAAhB,IAAgB,CAAd;AACD,uDAAC,wBAAI,eAAW,6BAAK,sBAAsB,SAAsB,GAAG,OAAc,KAAM;AAAA;AAE5F;AAEA,cAAc,cAAc;","names":[]}
|
|
@@ -77,17 +77,14 @@ var import_react = require("react");
|
|
|
77
77
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
78
78
|
var ValidationMessage = (0, import_react.forwardRef)(
|
|
79
79
|
(_a, ref) => {
|
|
80
|
-
var _b = _a, {
|
|
80
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
|
81
81
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
82
82
|
"div",
|
|
83
|
-
|
|
83
|
+
__spreadValues({
|
|
84
84
|
"aria-live": "polite",
|
|
85
85
|
className: (0, import_typed_classname.clsx)("hds-validation-message", className),
|
|
86
|
-
id,
|
|
87
86
|
ref
|
|
88
|
-
}, rest)
|
|
89
|
-
children
|
|
90
|
-
})
|
|
87
|
+
}, rest)
|
|
91
88
|
);
|
|
92
89
|
}
|
|
93
90
|
);
|
|
@@ -213,52 +210,54 @@ var InputGroup = (0, import_react3.forwardRef)(function InputGroup2(_a, ref) {
|
|
|
213
210
|
|
|
214
211
|
// src/form/select/select.tsx
|
|
215
212
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
216
|
-
var Select = (0, import_react4.forwardRef)(
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
validationMessageProps,
|
|
222
|
-
errorMessage,
|
|
223
|
-
labelProps,
|
|
224
|
-
label,
|
|
225
|
-
id,
|
|
226
|
-
style,
|
|
227
|
-
disabled,
|
|
228
|
-
"data-color": dataColor,
|
|
229
|
-
children
|
|
230
|
-
} = _b, rest = __objRest(_b, [
|
|
231
|
-
"className",
|
|
232
|
-
"size",
|
|
233
|
-
"validationMessage",
|
|
234
|
-
"validationMessageProps",
|
|
235
|
-
"errorMessage",
|
|
236
|
-
"labelProps",
|
|
237
|
-
"label",
|
|
238
|
-
"id",
|
|
239
|
-
"style",
|
|
240
|
-
"disabled",
|
|
241
|
-
"data-color",
|
|
242
|
-
"children"
|
|
243
|
-
]);
|
|
244
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
245
|
-
InputGroup,
|
|
246
|
-
{
|
|
247
|
-
className: (0, import_typed_classname3.clsx)("hds-select", className),
|
|
248
|
-
disabled,
|
|
213
|
+
var Select = (0, import_react4.forwardRef)(
|
|
214
|
+
(_a, ref) => {
|
|
215
|
+
var _b = _a, {
|
|
216
|
+
className,
|
|
217
|
+
size,
|
|
249
218
|
validationMessage,
|
|
250
219
|
validationMessageProps,
|
|
251
220
|
errorMessage,
|
|
252
|
-
id,
|
|
253
|
-
label,
|
|
254
221
|
labelProps,
|
|
222
|
+
label,
|
|
223
|
+
id,
|
|
255
224
|
style,
|
|
256
|
-
|
|
225
|
+
disabled,
|
|
257
226
|
"data-color": dataColor,
|
|
258
|
-
children
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
227
|
+
children
|
|
228
|
+
} = _b, rest = __objRest(_b, [
|
|
229
|
+
"className",
|
|
230
|
+
"size",
|
|
231
|
+
"validationMessage",
|
|
232
|
+
"validationMessageProps",
|
|
233
|
+
"errorMessage",
|
|
234
|
+
"labelProps",
|
|
235
|
+
"label",
|
|
236
|
+
"id",
|
|
237
|
+
"style",
|
|
238
|
+
"disabled",
|
|
239
|
+
"data-color",
|
|
240
|
+
"children"
|
|
241
|
+
]);
|
|
242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
243
|
+
InputGroup,
|
|
244
|
+
{
|
|
245
|
+
className: (0, import_typed_classname3.clsx)("hds-select", className),
|
|
246
|
+
disabled,
|
|
247
|
+
validationMessage,
|
|
248
|
+
validationMessageProps,
|
|
249
|
+
errorMessage,
|
|
250
|
+
id,
|
|
251
|
+
label,
|
|
252
|
+
labelProps,
|
|
253
|
+
style,
|
|
254
|
+
size,
|
|
255
|
+
"data-color": dataColor,
|
|
256
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("select", __spreadProps(__spreadValues({ disabled, ref }, rest), { children }))
|
|
257
|
+
}
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
);
|
|
262
261
|
Select.displayName = "Select";
|
|
263
262
|
// Annotate the CommonJS export names for ESM import in node:
|
|
264
263
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/select/index.tsx","../../../src/form/select/select.tsx","../../../src/form/input-group/input-group.tsx","../../../src/form/validation-message/validation-message.tsx","../../../src/utils/utils.ts"],"sourcesContent":["export { Select } from \"./select\";\nexport type * from \"./select\";\n","import { forwardRef, type ReactNode, 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 & Omit<SelectHTMLAttributes<HTMLSelectElement>, \"size\">,\n \"readOnly\" | \"children\"\n> & { children: ReactNode };\n\nexport const Select = forwardRef<HTMLSelectElement, SelectProps>(function Select(\n {\n className,\n size,\n validationMessage,\n validationMessageProps,\n errorMessage,\n labelProps,\n label,\n id,\n style,\n disabled,\n \"data-color\": dataColor,\n children,\n ...rest\n },\n ref,\n) {\n return (\n <InputGroup\n className={clsx(\"hds-select\", className as undefined)}\n disabled={disabled}\n validationMessage={validationMessage}\n validationMessageProps={validationMessageProps}\n errorMessage={errorMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n style={style}\n size={size}\n data-color={dataColor}\n >\n <select disabled={disabled} ref={ref} {...rest}>\n {children}\n </select>\n </InputGroup>\n );\n});\n\nSelect.displayName = \"Select\";\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 { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { getValidationMessageValue } from \"../../utils\";\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 \"data-color\"?: \"info\" | \"success\" | \"warning\" | \"error\";\n size?: \"large\" | \"small\";\n validationMessage?: ReactNode | { value: ReactNode };\n validationMessageProps?: Partial<ValidationMessageProps>;\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>;\n label?: ReactNode;\n disabled?: boolean;\n readOnly?: boolean;\n /**\n * `children` must be either a single input element or a render function.\n *\n * If you use a render function, make sure you spread the input props to the appropriate element.\n */\n children: Exclude<ReactNode, Iterable<ReactNode>> | ((inputProps: InputProps) => ReactNode);\n}\n\nexport const InputGroup = forwardRef<HTMLDivElement, InputGroupProps>(function InputGroup(\n {\n id,\n className,\n style,\n \"data-color\": dataColor = undefined,\n size = \"large\",\n validationMessage,\n validationMessageProps,\n errorMessage,\n errorMessageProps,\n labelProps: { className: labelClassName, ...labelProps } = {},\n label,\n disabled,\n readOnly,\n children,\n ...rest\n },\n ref,\n) {\n const validationMessageId = useId();\n const inputId = useId();\n const validationColor = errorMessage ? \"error\" : dataColor;\n const validationMessageValue = getValidationMessageValue(validationMessage, errorMessage);\n\n const renderInput = () => {\n const inputProps: InputProps = {\n \"aria-describedby\": validationMessage ? validationMessageId : undefined,\n \"aria-invalid\": errorMessage ? true : undefined,\n id: id ?? inputId,\n className: clsx(\"hds-input-group__input\"),\n };\n\n if (typeof children === \"function\") {\n return children(inputProps);\n }\n\n const input: ReactNode = Children.toArray(children)[0];\n\n if (!isValidElement<InputProps>(input)) {\n return;\n }\n\n return cloneElement<InputProps>(input, {\n ...inputProps,\n ...input.props,\n className: `${inputProps.className} ${input.props.className ?? \"\"}`,\n });\n };\n\n return (\n <div\n className={clsx(\n \"hds-input-group\",\n {\n [`hds-input-group--${size}`]: size,\n },\n className as undefined,\n )}\n ref={ref}\n style={style}\n data-color={validationColor}\n {...rest}\n >\n {label !== null && label !== undefined && label !== false && (\n <label\n className={clsx(\"hds-input-group__label\", labelClassName as undefined)}\n {...labelProps}\n htmlFor={id ?? inputId}\n >\n {label}\n </label>\n )}\n <div\n className={clsx(\"hds-input-group__input-wrapper\")}\n data-disabled={disabled}\n data-readonly={readOnly}\n >\n {renderInput()}\n </div>\n <ValidationMessage\n id={validationMessageId}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </div>\n );\n});\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nexport interface ValidationMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport const ValidationMessage = forwardRef<HTMLDivElement, ValidationMessageProps>(\n ({ children, id, className, ...rest }, ref) => (\n <div\n aria-live=\"polite\"\n className={clsx(\"hds-validation-message\", className as undefined)}\n id={id}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n ),\n);\nValidationMessage.displayName = \"ValidationMessage\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\nimport type { ReactNode } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\nexport function getValidationMessageValue(\n validationMessage?: ReactNode | { value: ReactNode },\n errorMessage?: ReactNode,\n): ReactNode {\n if (validationMessage) {\n if (typeof validationMessage === \"object\" && \"value\" in validationMessage) {\n return validationMessage.value;\n }\n\n return validationMessage;\n }\n\n return errorMessage;\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAAsE;AACtE,IAAAC,0BAAqB;;;ACDrB,IAAAC,gBAA0E;AAE1E,IAAAC,0BAAqB;;;ACFrB,6BAAqB;AACrB,mBAA2C;AAUvC;AAFG,IAAM,wBAAoB;AAAA,EAC/B,CAAC,IAAsC,QAAK;AAA3C,iBAAE,YAAU,IAAI,UAVnB,IAUG,IAA8B,iBAA9B,IAA8B,CAA5B,YAAU,MAAI;AACf;AAAA,MAAC;AAAA;AAAA,QACC,aAAU;AAAA,QACV,eAAW,6BAAK,0BAA0B,SAAsB;AAAA,QAChE;AAAA,QACA;AAAA,SACI,OALL;AAAA,QAOE;AAAA;AAAA,IACH;AAAA;AAEJ;AACA,kBAAkB,cAAc;;;ACtBhC,YAAuB;AACvB,IAAAC,gBAA0D;AAmEnD,SAAS,0BACd,mBACA,cACW;AACX,MAAI,mBAAmB;AACrB,QAAI,OAAO,sBAAsB,YAAY,WAAW,mBAAmB;AACzE,aAAO,kBAAkB;AAAA,IAC3B;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAkDA,IAAM,wBAAiC,OAAO,sBAAQ,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK;;;AF1CpE,IAAAC,sBAAA;AAnDG,IAAM,iBAAa,0BAA4C,SAASC,YAC7E,IAiBA,KACA;AAlBA,eAUc;AAAA,IATZ;AAAA,IACA;AAA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AED,OAAO,cAAc;","names":["import_react","import_typed_classname","import_react","import_typed_classname","import_react","import_jsx_runtime","InputGroup","_a","import_jsx_runtime","Select"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/form/select/index.tsx","../../../src/form/select/select.tsx","../../../src/form/input-group/input-group.tsx","../../../src/form/validation-message/validation-message.tsx","../../../src/utils/utils.ts"],"sourcesContent":["export { Select } from \"./select\";\nexport type * from \"./select\";\n","import { forwardRef, type ReactNode, 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 & Omit<SelectHTMLAttributes<HTMLSelectElement>, \"size\">,\n \"readOnly\" | \"children\"\n> & { children: ReactNode };\n\nexport const Select = forwardRef<HTMLSelectElement, SelectProps>(\n (\n {\n className,\n size,\n validationMessage,\n validationMessageProps,\n errorMessage,\n labelProps,\n label,\n id,\n style,\n disabled,\n \"data-color\": dataColor,\n children,\n ...rest\n },\n ref,\n ) => (\n <InputGroup\n className={clsx(\"hds-select\", className as undefined)}\n disabled={disabled}\n validationMessage={validationMessage}\n validationMessageProps={validationMessageProps}\n errorMessage={errorMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n style={style}\n size={size}\n data-color={dataColor}\n >\n <select disabled={disabled} ref={ref} {...rest}>\n {children}\n </select>\n </InputGroup>\n ),\n);\n\nSelect.displayName = \"Select\";\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 { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { getValidationMessageValue } from \"../../utils\";\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 \"data-color\"?: \"info\" | \"success\" | \"warning\" | \"error\";\n size?: \"large\" | \"small\";\n validationMessage?: ReactNode | { value: ReactNode };\n validationMessageProps?: Partial<ValidationMessageProps>;\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>;\n label?: ReactNode;\n disabled?: boolean;\n readOnly?: boolean;\n /**\n * `children` must be either a single input element or a render function.\n *\n * If you use a render function, make sure you spread the input props to the appropriate element.\n */\n children: Exclude<ReactNode, Iterable<ReactNode>> | ((inputProps: InputProps) => ReactNode);\n}\n\nexport const InputGroup = forwardRef<HTMLDivElement, InputGroupProps>(function InputGroup(\n {\n id,\n className,\n style,\n \"data-color\": dataColor = undefined,\n size = \"large\",\n validationMessage,\n validationMessageProps,\n errorMessage,\n errorMessageProps,\n labelProps: { className: labelClassName, ...labelProps } = {},\n label,\n disabled,\n readOnly,\n children,\n ...rest\n },\n ref,\n) {\n const validationMessageId = useId();\n const inputId = useId();\n const validationColor = errorMessage ? \"error\" : dataColor;\n const validationMessageValue = getValidationMessageValue(validationMessage, errorMessage);\n\n const renderInput = () => {\n const inputProps: InputProps = {\n \"aria-describedby\": validationMessage ? validationMessageId : undefined,\n \"aria-invalid\": errorMessage ? true : undefined,\n id: id ?? inputId,\n className: clsx(\"hds-input-group__input\"),\n };\n\n if (typeof children === \"function\") {\n return children(inputProps);\n }\n\n const input: ReactNode = Children.toArray(children)[0];\n\n if (!isValidElement<InputProps>(input)) {\n return;\n }\n\n return cloneElement<InputProps>(input, {\n ...inputProps,\n ...input.props,\n className: `${inputProps.className} ${input.props.className ?? \"\"}`,\n });\n };\n\n return (\n <div\n className={clsx(\n \"hds-input-group\",\n {\n [`hds-input-group--${size}`]: size,\n },\n className as undefined,\n )}\n ref={ref}\n style={style}\n data-color={validationColor}\n {...rest}\n >\n {label !== null && label !== undefined && label !== false && (\n <label\n className={clsx(\"hds-input-group__label\", labelClassName as undefined)}\n {...labelProps}\n htmlFor={id ?? inputId}\n >\n {label}\n </label>\n )}\n <div\n className={clsx(\"hds-input-group__input-wrapper\")}\n data-disabled={disabled}\n data-readonly={readOnly}\n >\n {renderInput()}\n </div>\n <ValidationMessage\n id={validationMessageId}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </div>\n );\n});\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\n\nexport interface ValidationMessageProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n}\n\nexport const ValidationMessage = forwardRef<HTMLDivElement, ValidationMessageProps>(\n ({ className, ...rest }, ref) => (\n <div\n aria-live=\"polite\"\n className={clsx(\"hds-validation-message\", className as undefined)}\n ref={ref}\n {...rest}\n />\n ),\n);\nValidationMessage.displayName = \"ValidationMessage\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\nimport type { ReactNode } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\nexport function getValidationMessageValue(\n validationMessage?: ReactNode | { value: ReactNode },\n errorMessage?: ReactNode,\n): ReactNode {\n if (validationMessage) {\n if (typeof validationMessage === \"object\" && \"value\" in validationMessage) {\n return validationMessage.value;\n }\n\n return validationMessage;\n }\n\n return errorMessage;\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAAsE;AACtE,IAAAC,0BAAqB;;;ACDrB,IAAAC,gBAA0E;AAE1E,IAAAC,0BAAqB;;;ACFrB,6BAAqB;AACrB,mBAAgD;AAQ5C;AAFG,IAAM,wBAAoB;AAAA,EAC/B,CAAC,IAAwB,QAAK;AAA7B,iBAAE,YARL,IAQG,IAAgB,iBAAhB,IAAgB,CAAd;AACD;AAAA,MAAC;AAAA;AAAA,QACC,aAAU;AAAA,QACV,eAAW,6BAAK,0BAA0B,SAAsB;AAAA,QAChE;AAAA,SACI;AAAA,IACN;AAAA;AAEJ;AACA,kBAAkB,cAAc;;;ACjBhC,YAAuB;AACvB,IAAAC,gBAA0D;AAmEnD,SAAS,0BACd,mBACA,cACW;AACX,MAAI,mBAAmB;AACrB,QAAI,OAAO,sBAAsB,YAAY,WAAW,mBAAmB;AACzE,aAAO,kBAAkB;AAAA,IAC3B;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAkDA,IAAM,wBAAiC,OAAO,sBAAQ,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK;;;AF1CpE,IAAAC,sBAAA;AAnDG,IAAM,iBAAa,0BAA4C,SAASC,YAC7E,IAiBA,KACA;AAlBA,eAUc;AAAA,IATZ;AAAA,IACA;AAAA,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cAAc;","names":["import_react","import_typed_classname","import_react","import_typed_classname","import_react","import_jsx_runtime","InputGroup","_a","import_jsx_runtime"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "../../chunk-BYEJZSG5.mjs";
|
|
2
2
|
import {
|
|
3
3
|
Select
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-JGQTAIEP.mjs";
|
|
5
5
|
import "../../chunk-Y5SUMFYJ.mjs";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-DMRQEQQK.mjs";
|
|
7
7
|
import "../../chunk-NSLSA7F7.mjs";
|
|
8
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-VNH7CZJ4.mjs";
|
|
9
9
|
import "../../chunk-5M6MEYM7.mjs";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-F23MNQCK.mjs";
|
|
11
11
|
import "../../chunk-CYDWEPFL.mjs";
|
|
12
12
|
import "../../chunk-KPNAC2WN.mjs";
|
|
13
13
|
import "../../chunk-3V4GFS46.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/form/select/select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAG9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,MAAM,WAAW,GAAG,IAAI,CAC5B,eAAe,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,EACvE,UAAU,GAAG,UAAU,CACxB,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,CAAC;AAE5B,eAAO,MAAM,MAAM;cAFH,SAAS;
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/form/select/select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAG9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,MAAM,WAAW,GAAG,IAAI,CAC5B,eAAe,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,EACvE,UAAU,GAAG,UAAU,CACxB,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,CAAC;AAE5B,eAAO,MAAM,MAAM;cAFH,SAAS;qDAuCxB,CAAC"}
|