@mattilsynet/design 2.2.24 → 2.2.26

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.
Files changed (198) hide show
  1. package/mtds/alert/alert.js +9 -8
  2. package/mtds/alert/alert.js.map +1 -1
  3. package/mtds/analytics/analytics.d.ts +1 -1
  4. package/mtds/analytics/analytics.js +165 -101
  5. package/mtds/analytics/analytics.js.map +1 -1
  6. package/mtds/app/app-observer.js +73 -27
  7. package/mtds/app/app-observer.js.map +1 -1
  8. package/mtds/app/app-toggle.js +2 -24
  9. package/mtds/app/app-toggle.js.map +1 -1
  10. package/mtds/app/app-toggle2.js +16 -10
  11. package/mtds/app/app-toggle2.js.map +1 -1
  12. package/mtds/app/app.d.ts +5 -5
  13. package/mtds/app/app.js +36 -32
  14. package/mtds/app/app.js.map +1 -1
  15. package/mtds/atlas/atlas-element.d.ts +9 -14
  16. package/mtds/atlas/atlas-element.js +98 -76
  17. package/mtds/atlas/atlas-element.js.map +1 -1
  18. package/mtds/atlas/atlas-marker.d.ts +20 -0
  19. package/mtds/atlas/atlas-marker.js +73 -0
  20. package/mtds/atlas/atlas-marker.js.map +1 -0
  21. package/mtds/atlas/atlas-matgeo.d.ts +37 -0
  22. package/mtds/atlas/atlas-matgeo.js +93 -0
  23. package/mtds/atlas/atlas-matgeo.js.map +1 -0
  24. package/mtds/atlas/atlas-wms.d.ts +17 -0
  25. package/mtds/atlas/atlas-wms.js +39 -0
  26. package/mtds/atlas/atlas-wms.js.map +1 -0
  27. package/mtds/atlas/atlas.css.js +80 -94
  28. package/mtds/atlas/atlas.css.js.map +1 -1
  29. package/mtds/atlas/atlas.d.ts +51 -0
  30. package/mtds/atlas/atlas.js +38 -0
  31. package/mtds/atlas/atlas.js.map +1 -0
  32. package/mtds/atlas/atlas.stories.d.ts +6 -1
  33. package/mtds/atlas/cluster.js +1576 -697
  34. package/mtds/atlas/cluster.js.map +1 -1
  35. package/mtds/atlas.iife.js +84 -98
  36. package/mtds/atlas.js +10 -4
  37. package/mtds/atlas.js.map +1 -1
  38. package/mtds/avatar/avatar.js +8 -8
  39. package/mtds/avatar/avatar.js.map +1 -1
  40. package/mtds/badge/badge.d.ts +2 -2
  41. package/mtds/badge/badge.js +7 -7
  42. package/mtds/badge/badge.js.map +1 -1
  43. package/mtds/breadcrumbs/breadcrumbs-observer.js +10 -9
  44. package/mtds/breadcrumbs/breadcrumbs-observer.js.map +1 -1
  45. package/mtds/breadcrumbs/breadcrumbs.js +14 -13
  46. package/mtds/breadcrumbs/breadcrumbs.js.map +1 -1
  47. package/mtds/button/button.js +16 -14
  48. package/mtds/button/button.js.map +1 -1
  49. package/mtds/card/card.js +14 -12
  50. package/mtds/card/card.js.map +1 -1
  51. package/mtds/chart/chart-axis.js +27 -15
  52. package/mtds/chart/chart-axis.js.map +1 -1
  53. package/mtds/chart/chart-bars.js +15 -13
  54. package/mtds/chart/chart-bars.js.map +1 -1
  55. package/mtds/chart/chart-element.d.ts +5 -0
  56. package/mtds/chart/chart-element.js +83 -48
  57. package/mtds/chart/chart-element.js.map +1 -1
  58. package/mtds/chart/chart-lines.js +54 -32
  59. package/mtds/chart/chart-lines.js.map +1 -1
  60. package/mtds/chart/chart-pies.js +34 -14
  61. package/mtds/chart/chart-pies.js.map +1 -1
  62. package/mtds/chart/chart.css.js +2 -2
  63. package/mtds/chart/chart.css.js.map +1 -1
  64. package/mtds/chart/chart.d.ts +3 -4
  65. package/mtds/chart/chart.js +12 -12
  66. package/mtds/chart/chart.js.map +1 -1
  67. package/mtds/chip/chip.js +8 -8
  68. package/mtds/chip/chip.js.map +1 -1
  69. package/mtds/details/details.d.ts +3 -3
  70. package/mtds/details/details.js +14 -12
  71. package/mtds/details/details.js.map +1 -1
  72. package/mtds/dialog/dialog-observer.js +35 -22
  73. package/mtds/dialog/dialog-observer.js.map +1 -1
  74. package/mtds/dialog/dialog.d.ts +2 -2
  75. package/mtds/dialog/dialog.js +12 -12
  76. package/mtds/dialog/dialog.js.map +1 -1
  77. package/mtds/divider/divider.d.ts +2 -2
  78. package/mtds/divider/divider.js +10 -10
  79. package/mtds/divider/divider.js.map +1 -1
  80. package/mtds/errorsummary/errorsummary-observer.js +11 -8
  81. package/mtds/errorsummary/errorsummary-observer.js.map +1 -1
  82. package/mtds/errorsummary/errorsummary.d.ts +1 -1
  83. package/mtds/errorsummary/errorsummary.js +11 -11
  84. package/mtds/errorsummary/errorsummary.js.map +1 -1
  85. package/mtds/external/@turf/boolean-point-in-polygon/dist/esm/index.js +35 -0
  86. package/mtds/external/@turf/boolean-point-in-polygon/dist/esm/index.js.map +1 -0
  87. package/mtds/external/@turf/helpers/dist/esm/index.js +40 -0
  88. package/mtds/external/@turf/helpers/dist/esm/index.js.map +1 -0
  89. package/mtds/external/@turf/invariant/dist/esm/index.js +28 -0
  90. package/mtds/external/@turf/invariant/dist/esm/index.js.map +1 -0
  91. package/mtds/external/leaflet/dist/leaflet-src.js +6006 -3098
  92. package/mtds/external/leaflet/dist/leaflet-src.js.map +1 -1
  93. package/mtds/external/leaflet/dist/leaflet.css.js +2 -2
  94. package/mtds/external/leaflet/dist/leaflet.css.js.map +1 -1
  95. package/mtds/external/point-in-polygon-hao/dist/esm/index.js +56 -0
  96. package/mtds/external/point-in-polygon-hao/dist/esm/index.js.map +1 -0
  97. package/mtds/external/robust-predicates/esm/orient2d.js +168 -0
  98. package/mtds/external/robust-predicates/esm/orient2d.js.map +1 -0
  99. package/mtds/external/robust-predicates/esm/util.js +91 -0
  100. package/mtds/external/robust-predicates/esm/util.js.map +1 -0
  101. package/mtds/field/field-observer.js +114 -62
  102. package/mtds/field/field-observer.js.map +1 -1
  103. package/mtds/field/field.d.ts +6 -6
  104. package/mtds/field/field.js +166 -133
  105. package/mtds/field/field.js.map +1 -1
  106. package/mtds/field/field.stories.d.ts +2 -0
  107. package/mtds/fieldset/fieldset-observer.js +24 -14
  108. package/mtds/fieldset/fieldset-observer.js.map +1 -1
  109. package/mtds/fieldset/fieldset.d.ts +1 -1
  110. package/mtds/fieldset/fieldset.js +11 -11
  111. package/mtds/fieldset/fieldset.js.map +1 -1
  112. package/mtds/fileupload/fileupload.js +9 -8
  113. package/mtds/fileupload/fileupload.js.map +1 -1
  114. package/mtds/helptext/helptext.d.ts +1 -1
  115. package/mtds/helptext/helptext.js +15 -15
  116. package/mtds/helptext/helptext.js.map +1 -1
  117. package/mtds/index.iife.js +9 -9
  118. package/mtds/index.js +26 -24
  119. package/mtds/input/input.d.ts +3 -3
  120. package/mtds/input/input.js +22 -20
  121. package/mtds/input/input.js.map +1 -1
  122. package/mtds/law/law-helper.d.ts +6 -2
  123. package/mtds/law/law-helper.js +145 -63
  124. package/mtds/law/law-helper.js.map +1 -1
  125. package/mtds/law/law.d.ts +6 -2
  126. package/mtds/law/law.js +6 -6
  127. package/mtds/law/law.js.map +1 -1
  128. package/mtds/law/law.stories.d.ts +1 -0
  129. package/mtds/layout/layout.js +13 -10
  130. package/mtds/layout/layout.js.map +1 -1
  131. package/mtds/link/link.js +8 -7
  132. package/mtds/link/link.js.map +1 -1
  133. package/mtds/logo/logo-observer.js +18 -12
  134. package/mtds/logo/logo-observer.js.map +1 -1
  135. package/mtds/logo/logo.js +8 -8
  136. package/mtds/logo/logo.js.map +1 -1
  137. package/mtds/package.json.js +2 -2
  138. package/mtds/pagination/pagination-helper.js +17 -11
  139. package/mtds/pagination/pagination-helper.js.map +1 -1
  140. package/mtds/pagination/pagination.d.ts +1 -1
  141. package/mtds/pagination/pagination.js +30 -30
  142. package/mtds/pagination/pagination.js.map +1 -1
  143. package/mtds/popover/popover-observer.js +47 -28
  144. package/mtds/popover/popover-observer.js.map +1 -1
  145. package/mtds/popover/popover.js +13 -11
  146. package/mtds/popover/popover.js.map +1 -1
  147. package/mtds/progress/progress.d.ts +1 -1
  148. package/mtds/progress/progress.js +8 -8
  149. package/mtds/progress/progress.js.map +1 -1
  150. package/mtds/react-atlas.d.ts +1 -0
  151. package/mtds/react-atlas.js +15 -0
  152. package/mtds/react-atlas.js.map +1 -0
  153. package/mtds/react-types.d.ts +3 -0
  154. package/mtds/react.js +79 -79
  155. package/mtds/skeleton/skeleton.js +8 -8
  156. package/mtds/skeleton/skeleton.js.map +1 -1
  157. package/mtds/spinner/spinner.d.ts +2 -2
  158. package/mtds/spinner/spinner.js +8 -8
  159. package/mtds/spinner/spinner.js.map +1 -1
  160. package/mtds/steps/steps.d.ts +2 -2
  161. package/mtds/steps/steps.js +7 -7
  162. package/mtds/steps/steps.js.map +1 -1
  163. package/mtds/styles.css +4586 -1
  164. package/mtds/styles.module.css.js +167 -112
  165. package/mtds/styles.module.css.js.map +1 -1
  166. package/mtds/table/table-observer.js +22 -19
  167. package/mtds/table/table-observer.js.map +1 -1
  168. package/mtds/table/table.d.ts +4 -4
  169. package/mtds/table/table.js +18 -16
  170. package/mtds/table/table.js.map +1 -1
  171. package/mtds/tabs/tabs.d.ts +4 -4
  172. package/mtds/tabs/tabs.js +25 -21
  173. package/mtds/tabs/tabs.js.map +1 -1
  174. package/mtds/tag/tag.js +8 -8
  175. package/mtds/tag/tag.js.map +1 -1
  176. package/mtds/tailwind.css +24 -6
  177. package/mtds/toast/toast-helper.js +35 -20
  178. package/mtds/toast/toast-helper.js.map +1 -1
  179. package/mtds/toast/toast-observer.js +30 -15
  180. package/mtds/toast/toast-observer.js.map +1 -1
  181. package/mtds/toast/toast.js +45 -37
  182. package/mtds/toast/toast.js.map +1 -1
  183. package/mtds/togglegroup/togglegroup-observer.js +15 -10
  184. package/mtds/togglegroup/togglegroup-observer.js.map +1 -1
  185. package/mtds/togglegroup/togglegroup.d.ts +3 -3
  186. package/mtds/togglegroup/togglegroup.js +20 -18
  187. package/mtds/togglegroup/togglegroup.js.map +1 -1
  188. package/mtds/tooltip/tooltip-observer.js +48 -32
  189. package/mtds/tooltip/tooltip-observer.js.map +1 -1
  190. package/mtds/typography/typography.js +28 -19
  191. package/mtds/typography/typography.js.map +1 -1
  192. package/mtds/utils.d.ts +12 -3
  193. package/mtds/utils.js +133 -81
  194. package/mtds/utils.js.map +1 -1
  195. package/mtds/validation/validation.d.ts +1 -1
  196. package/mtds/validation/validation.js +12 -12
  197. package/mtds/validation/validation.js.map +1 -1
  198. package/package.json +16 -10
@@ -1 +1 @@
1
- {"version":3,"file":"field.js","sources":["../../designsystem/field/field.tsx"],"sourcesContent":["\"use client\";\nimport type { Placement } from \"@floating-ui/dom\";\nimport type {\n\tReactUcombobox,\n\tUHTMLComboboxElement,\n} from \"@u-elements/u-combobox\";\nimport clsx from \"clsx\";\nimport type { JSX } from \"react\";\nimport { forwardRef, useEffect, useImperativeHandle, useRef } from \"react\";\nimport { HelpText } from \"../helptext/helptext\";\nimport { Input, type InputProps } from \"../input/input\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\nimport { toCustomElementProps } from \"../utils\";\nimport { Validation } from \"../validation/validation\";\n\ntype FieldBaseProps = {\n\t\"data-validation\"?: \"form\" | \"false\" | false;\n\tcount?: number;\n\tdescription?: React.ReactNode;\n\terror?: React.ReactNode; // Kept for backwards compatibility\n\thelpText?: React.ReactNode;\n\thelpTextLabel?: string;\n\tlabel?: React.ReactNode;\n\toptions?: string[] | FieldComboboxSelected;\n\tprefix?: string;\n\treadOnly?: boolean; // Allow readoOnly also on <select>\n\tsuffix?: string;\n\tvalidation?: React.ReactNode;\n};\n\nexport type FieldProps<As extends React.ElementType = \"div\"> =\n\tPolymorphicComponentPropWithRef<As, FieldBaseProps>;\n\ntype FieldComponent = <As extends React.ElementType = \"div\">(\n\tprops: FieldProps<As>,\n) => JSX.Element;\n\nconst toOption = (\n\to: FieldComboboxSelected[number] | string,\n): FieldComboboxSelected[number] =>\n\ttypeof o === \"string\" ? { label: o, value: o } : o;\n\nexport const FieldComp: FieldComponent = forwardRef<null>(function Field<\n\tAs extends React.ElementType = \"div\",\n>(\n\t{\n\t\t\"data-size\": size,\n\t\t\"data-validation\": validationType,\n\t\tas,\n\t\tclassName,\n\t\tcount,\n\t\tdescription,\n\t\terror,\n\t\thelpText,\n\t\thelpTextLabel,\n\t\tlabel,\n\t\tprefix,\n\t\tstyle,\n\t\tsuffix,\n\t\tvalidation: validationContent,\n\t\t...rest\n\t}: FieldProps<As>,\n\tref?: PolymorphicRef<As>,\n) {\n\tconst Tag = as || \"div\";\n\tconst affixes = !!suffix || !!prefix;\n\tconst validation = validationContent || error; // error kept for backwards compatibility\n\tconst shared = {\n\t\t\"data-size\": size,\n\t\t\"data-validation\": validationType,\n\t\tclassName: clsx(styles.field, className),\n\t\tstyle,\n\t};\n\n\t// Render options if select\n\tif (as === \"select\" && !rest.children)\n\t\tObject.assign(rest, {\n\t\t\toptions: undefined, // Ensure options is not passed to DOM\n\t\t\tchildren: (\n\t\t\t\t<>\n\t\t\t\t\t{(rest.options as FieldBaseProps[\"options\"])\n\t\t\t\t\t\t?.map(toOption)\n\t\t\t\t\t\t.map(({ label, value }) => (\n\t\t\t\t\t\t\t<option key={value} value={value}>\n\t\t\t\t\t\t\t\t{label}\n\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t))}\n\t\t\t\t</>\n\t\t\t),\n\t\t});\n\n\t// Using suppressHydrationWarning to avoid Next.js vs field-observer.ts hydration conflict\n\treturn as ? (\n\t\t<div {...shared}>\n\t\t\t{!!label && <label suppressHydrationWarning>{label}</label>}\n\t\t\t{!!helpText && <HelpText aria-label={helpTextLabel}>{helpText}</HelpText>}\n\t\t\t{!!description && <p suppressHydrationWarning>{description}</p>}\n\t\t\t{affixes ? (\n\t\t\t\t<FieldAffixes>\n\t\t\t\t\t{!!prefix && <span>{prefix}</span>}\n\t\t\t\t\t<Tag\n\t\t\t\t\t\tclassName={styles.input}\n\t\t\t\t\t\tsuppressHydrationWarning\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\t{...rest}\n\t\t\t\t\t/>\n\t\t\t\t\t{!!suffix && <span>{suffix}</span>}\n\t\t\t\t</FieldAffixes>\n\t\t\t) : (\n\t\t\t\t<Tag\n\t\t\t\t\tclassName={typeof as === \"string\" ? styles.input : undefined}\n\t\t\t\t\tsuppressHydrationWarning\n\t\t\t\t\tref={ref}\n\t\t\t\t\t{...rest}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{!!validation && (\n\t\t\t\t<Validation hidden={validationType === \"form\"}>{validation}</Validation>\n\t\t\t)}\n\t\t\t{!!count && <p suppressHydrationWarning data-count={count} />}\n\t\t</div>\n\t) : (\n\t\t<div ref={ref} {...shared} {...rest} />\n\t);\n}) as FieldComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\nexport type FieldAffixProps = React.ComponentPropsWithoutRef<\"div\">;\nconst FieldAffixes = forwardRef<HTMLDivElement, FieldAffixProps>(\n\tfunction FieldAffixes({ className, ...rest }, ref) {\n\t\treturn (\n\t\t\t<div className={clsx(styles.affixes, className)} ref={ref} {...rest} />\n\t\t);\n\t},\n);\n\nexport type FieldDatalistProps = React.ComponentPropsWithoutRef<\"datalist\"> & {\n\t\"data-nofilter\"?: boolean;\n\t\"data-position\"?: Placement;\n};\n\nconst FieldDatalist = forwardRef<HTMLDataListElement, FieldDatalistProps>(\n\tfunction FieldDatalist({ \"data-nofilter\": filter, ...rest }, ref) {\n\t\treturn (\n\t\t\t<u-datalist\n\t\t\t\tdata-nofilter={!!filter || undefined} // Ensure data-nofilter is set correctly\n\t\t\t\tref={ref}\n\t\t\t\t{...toCustomElementProps(rest)}\n\t\t\t/>\n\t\t);\n\t},\n);\n\nexport type FieldOptionProps = React.ComponentPropsWithoutRef<\"option\">;\nconst FieldOption = forwardRef<HTMLOptionElement, FieldOptionProps>(\n\tfunction FieldOption(props, ref) {\n\t\treturn <u-option ref={ref} {...toCustomElementProps(props)} />;\n\t},\n);\n\nexport type FieldComboboxSelected = {\n\tlabel: string;\n\tvalue: string;\n\tchildren?: React.ReactNode;\n}[];\nexport type FieldComboboxProps = Omit<\n\tReactUcombobox,\n\t\"onChange\" | \"onInput\"\n> & {\n\t\"data-creatable\"?: boolean;\n\t\"data-multiple\"?: boolean;\n\tonAfterChange?: (e: CustomEvent<HTMLDataElement>) => void; // deprecated\n\tonAfterSelect?: (e: CustomEvent<HTMLDataElement>) => void; // Custom event to handle before change\n\tonBeforeChange?: (e: CustomEvent<HTMLDataElement>) => void; // deprecated\n\tonBeforeMatch?: (e: CustomEvent<HTMLOptionElement>) => void; // Custom event to handle before change\n\tonBeforeSelect?: (e: CustomEvent<HTMLDataElement>) => void; // Custom event to handle before change\n\tonSelectedChange?: (selected: FieldComboboxSelected) => void; // Allow onChange to be a function that returns void\n\toptions?: FieldComboboxSelected;\n\tselected?: FieldComboboxSelected; // Allow value to be a string or an array of strings for multiple select\n} & Pick<\n\t\tInputProps,\n\t\t| \"disabled\"\n\t\t| \"name\"\n\t\t| \"onChange\"\n\t\t| \"onInput\"\n\t\t| \"placeholder\"\n\t\t| \"readOnly\"\n\t\t| \"type\"\n\t\t| \"value\"\n\t> & // Allow input props to be passed down\n\tPick<FieldDatalistProps, \"data-position\" | \"data-nofilter\">; // Allow datalist props to be passed down\n\nconst FieldCombobox = forwardRef<UHTMLComboboxElement, FieldComboboxProps>(\n\tfunction FieldCombobox(\n\t\t{\n\t\t\t\"aria-required\": required,\n\t\t\t\"data-position\": position,\n\t\t\t\"data-nofilter\": nofilter,\n\t\t\t\"data-multiple\": multiple,\n\t\t\tonAfterChange,\n\t\t\tonAfterSelect,\n\t\t\tonBeforeChange,\n\t\t\tonBeforeMatch,\n\t\t\tonBeforeSelect,\n\t\t\tonSelectedChange,\n\t\t\tchildren,\n\t\t\tdisabled,\n\t\t\tname,\n\t\t\toptions,\n\t\t\tplaceholder,\n\t\t\treadOnly,\n\t\t\tselected,\n\t\t\ttype,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) {\n\t\tconst innerRef = useRef<UHTMLComboboxElement>(null);\n\t\tconst onSelected = useRef(onSelectedChange);\n\t\tonSelected.current = onSelectedChange; // Sync the latest onSelectedChange function\n\n\t\t// Deprecated props\n\t\tif (onAfterChange) {\n\t\t\tonAfterSelect = onAfterChange;\n\t\t\tconsole.warn(\n\t\t\t\t`Combobox onAfterChange is deprecated, use onAfterSelect instead.`,\n\t\t\t);\n\t\t}\n\t\tif (onBeforeChange) {\n\t\t\tonBeforeSelect = onBeforeChange;\n\t\t\tconsole.warn(\n\t\t\t\t`Combobox onBeforeChange is deprecated, use onBeforeSelect instead.`,\n\t\t\t);\n\t\t}\n\n\t\t// Using useEffect for React 18 and lower compatibility\n\t\tuseImperativeHandle(ref, () => innerRef.current as UHTMLComboboxElement); // Forward innerRef\n\t\tuseEffect(() => {\n\t\t\tconst self = innerRef.current;\n\t\t\tconst handleChange = (event: CustomEvent<HTMLDataElement>) => {\n\t\t\t\tconst handleSelected = onSelected.current;\n\t\t\t\tif (!onSelected) return; // No onSelectedChange function provided, let u-combobox handle it\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst { isConnected: remove, textContent, value } = event.detail;\n\t\t\t\tconst label = textContent?.trim() || \"\";\n\t\t\t\tconst prev = selected || [];\n\n\t\t\t\tif (remove) handleSelected?.(prev.filter((i) => i.value !== value));\n\t\t\t\telse if (multiple) handleSelected?.([...prev, { value, label }]);\n\t\t\t\telse handleSelected?.([{ value, label }]);\n\t\t\t};\n\n\t\t\tself?.addEventListener(\"comboboxbeforeselect\", handleChange);\n\t\t\treturn () =>\n\t\t\t\tself?.removeEventListener(\"comboboxbeforeselect\", handleChange);\n\t\t}, [multiple, selected]);\n\n\t\treturn (\n\t\t\t<u-combobox\n\t\t\t\tdata-multiple={multiple || undefined}\n\t\t\t\t{...toCustomElementProps({\n\t\t\t\t\toncomboboxbeforeselect: onBeforeSelect,\n\t\t\t\t\toncomboboxbeforematch: onBeforeMatch,\n\t\t\t\t\toncomboboxafterselect: onAfterSelect,\n\t\t\t\t\tref: innerRef,\n\t\t\t\t\t...props,\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t{selected?.map(({ children, label, value }) => (\n\t\t\t\t\t<data key={value} value={value} suppressHydrationWarning>\n\t\t\t\t\t\t{children ?? label}\n\t\t\t\t\t</data>\n\t\t\t\t))}\n\t\t\t\t{children || (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\taria-required={required}\n\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\tname={name}\n\t\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\ttype={type}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<del {...toCustomElementProps({ \"aria-label\": \"Fjern tekst\" })} />\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t{!!options && (\n\t\t\t\t\t<FieldDatalist data-nofilter={nofilter} data-position={position}>\n\t\t\t\t\t\t{options.map(toOption).map(({ children, label, value }) => (\n\t\t\t\t\t\t\t<FieldOption key={value} value={value} label={label}>\n\t\t\t\t\t\t\t\t{children ?? label}\n\t\t\t\t\t\t\t</FieldOption>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</FieldDatalist>\n\t\t\t\t)}\n\t\t\t</u-combobox>\n\t\t);\n\t},\n);\n\nexport type FieldLabelProps = React.ComponentPropsWithoutRef<\"label\">;\nexport const Field = Object.assign(FieldComp, {\n\tAffixes: FieldAffixes,\n\tCombobox: FieldCombobox,\n\tDatalist: FieldDatalist,\n\tOption: FieldOption,\n\tLabel: forwardRef<HTMLLabelElement, FieldLabelProps>(\n\t\tfunction FieldLabel(rest, ref) {\n\t\t\treturn <label suppressHydrationWarning ref={ref} {...rest} />;\n\t\t},\n\t),\n});\n"],"names":["toOption","FieldComp","forwardRef","size","validationType","as","className","count","description","error","helpText","helpTextLabel","label","prefix","style","suffix","validationContent","rest","ref","Tag","affixes","validation","shared","clsx","styles","value","jsx","jsxs","HelpText","FieldAffixes","Validation","FieldDatalist","filter","toCustomElementProps","FieldOption","props","FieldCombobox","required","position","nofilter","multiple","onAfterChange","onAfterSelect","onBeforeChange","onBeforeMatch","onBeforeSelect","onSelectedChange","children","disabled","name","options","placeholder","readOnly","selected","type","innerRef","useRef","onSelected","useImperativeHandle","useEffect","self","handleChange","event","handleSelected","remove","textContent","prev","i","Fragment","Input","Field"],"mappings":";;;;;;;;AAyCA,MAAMA,IAAW,CAChB,MAEA,OAAO,KAAM,WAAW,EAAE,OAAO,GAAG,OAAO,EAAA,IAAM,GAErCC,IAA4BC,EAAiB,SAGzD;AAAA,EACC,aAAaC;AAAA,EACb,mBAAmBC;AAAA,EACnB,IAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,YAAYC;AAAA,EACZ,GAAGC;AACJ,GACAC,GACC;AACD,QAAMC,IAAMd,KAAM,OACZe,IAAU,CAAC,CAACL,KAAU,CAAC,CAACF,GACxBQ,IAAaL,KAAqBP,GAClCa,IAAS;AAAA,IACd,aAAanB;AAAA,IACb,mBAAmBC;AAAA,IACnB,WAAWmB,EAAKC,EAAO,OAAOlB,CAAS;AAAA,IACvC,OAAAQ;AAAA,EAAA;AAID,SAAIT,MAAO,YAAY,CAACY,EAAK,YAC5B,OAAO,OAAOA,GAAM;AAAA,IACnB,SAAS;AAAA;AAAA,IACT,iCAEI,UAAAA,EAAK,SACJ,IAAIjB,CAAQ,EACb,IAAI,CAAC,EAAE,OAAAY,GAAO,OAAAa,EAAA,MACd,gBAAAC,EAAC,UAAA,EAAmB,OAAAD,GAClB,UAAAb,EAAAA,GADWa,CAEb,CACA,EAAA,CACH;AAAA,EAAA,CAED,GAGKpB,IACN,gBAAAsB,EAAC,OAAA,EAAK,GAAGL,GACP,UAAA;AAAA,IAAA,CAAC,CAACV,KAAS,gBAAAc,EAAC,SAAA,EAAM,0BAAwB,IAAE,UAAAd,GA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,GAAU,iBAAeD,GACrD,UAAAY,EAAQ,IAAIlD,CAAQ,EAAE,IAAI,CAAC,EAAE,UAAA+C,GAAU,OAAAnC,GAAO,OAAAa,EAAA,MAC9C,gBAAAC,EAACQ,GAAA,EAAwB,OAAAT,GAAc,OAAAb,GACrC,UAAAmC,KAAYnC,EAAA,GADIa,CAElB,CACA,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIJ;AACD,GAGa6C,KAAQ,OAAO,OAAOrE,GAAW;AAAA,EAC7C,SAAS4B;AAAA,EACT,UAAUO;AAAA,EACV,UAAUL;AAAA,EACV,QAAQG;AAAA,EACR,OAAOhC;AAAA,IACN,SAAoBe,GAAMC,GAAK;AAC9B,+BAAQ,SAAA,EAAM,0BAAwB,IAAC,KAAAA,GAAW,GAAGD,GAAM;AAAA,IAC5D;AAAA,EAAA;AAEF,CAAC;"}
1
+ {"version":3,"file":"field.js","sources":["../../designsystem/field/field.tsx"],"sourcesContent":["\"use client\";\nimport type { Placement } from \"@floating-ui/dom\";\nimport type {\n\tReactUcombobox,\n\tUHTMLComboboxElement,\n} from \"@u-elements/u-combobox\";\nimport clsx from \"clsx\";\nimport type { JSX } from \"react\";\nimport { forwardRef, useEffect, useImperativeHandle, useRef } from \"react\";\nimport { HelpText } from \"../helptext/helptext\";\nimport { Input, type InputProps } from \"../input/input\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\nimport { toCustomElementProps } from \"../utils\";\nimport { Validation } from \"../validation/validation\";\n\ntype FieldBaseProps = {\n\t\"data-validation\"?: \"form\" | \"false\" | false;\n\tcount?: number;\n\tdescription?: React.ReactNode;\n\terror?: React.ReactNode; // Kept for backwards compatibility\n\thelpText?: React.ReactNode;\n\thelpTextLabel?: string;\n\tlabel?: React.ReactNode;\n\toptions?: string[] | FieldComboboxSelected;\n\tprefix?: string;\n\treadOnly?: boolean; // Allow readoOnly also on <select>\n\tsuffix?: string;\n\tvalidation?: React.ReactNode;\n};\n\nexport type FieldProps<As extends React.ElementType = \"div\"> =\n\tPolymorphicComponentPropWithRef<As, FieldBaseProps>;\n\ntype FieldComponent = <As extends React.ElementType = \"div\">(\n\tprops: FieldProps<As>,\n) => JSX.Element;\n\nconst toOption = (\n\to: FieldComboboxSelected[number] | string,\n): FieldComboboxSelected[number] =>\n\ttypeof o === \"string\" ? { label: o, value: o } : o;\n\nexport const FieldComp: FieldComponent = forwardRef<null>(function Field<\n\tAs extends React.ElementType = \"div\",\n>(\n\t{\n\t\t\"data-size\": size,\n\t\t\"data-validation\": validationType,\n\t\tas,\n\t\tclassName,\n\t\tcount,\n\t\tdescription,\n\t\terror,\n\t\thelpText,\n\t\thelpTextLabel,\n\t\tlabel,\n\t\tprefix,\n\t\tstyle,\n\t\tsuffix,\n\t\tvalidation: validationContent,\n\t\t...rest\n\t}: FieldProps<As>,\n\tref?: PolymorphicRef<As>,\n) {\n\tconst Tag = as || \"div\";\n\tconst affixes = !!suffix || !!prefix;\n\tconst validation = validationContent || error; // error kept for backwards compatibility\n\tconst shared = {\n\t\t\"data-size\": size,\n\t\t\"data-validation\": validationType,\n\t\tclassName: clsx(styles.field, className),\n\t\tstyle,\n\t};\n\n\t// Render options if select\n\tif (as === \"select\" && !rest.children)\n\t\tObject.assign(rest, {\n\t\t\toptions: undefined, // Ensure options is not passed to DOM\n\t\t\tchildren: (\n\t\t\t\t<>\n\t\t\t\t\t{(rest.options as FieldBaseProps[\"options\"])\n\t\t\t\t\t\t?.map(toOption)\n\t\t\t\t\t\t.map(({ label, value }) => (\n\t\t\t\t\t\t\t<option key={value} value={value}>\n\t\t\t\t\t\t\t\t{label}\n\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t))}\n\t\t\t\t</>\n\t\t\t),\n\t\t});\n\n\t// Using suppressHydrationWarning to avoid Next.js vs field-observer.ts hydration conflict\n\treturn as ? (\n\t\t<div {...shared}>\n\t\t\t{!!label && <label suppressHydrationWarning>{label}</label>}\n\t\t\t{!!helpText && <HelpText aria-label={helpTextLabel}>{helpText}</HelpText>}\n\t\t\t{!!description && <p suppressHydrationWarning>{description}</p>}\n\t\t\t{affixes ? (\n\t\t\t\t<FieldAffixes>\n\t\t\t\t\t{!!prefix && <span>{prefix}</span>}\n\t\t\t\t\t<Tag\n\t\t\t\t\t\tclassName={styles.input}\n\t\t\t\t\t\tsuppressHydrationWarning\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\t{...rest}\n\t\t\t\t\t/>\n\t\t\t\t\t{!!suffix && <span>{suffix}</span>}\n\t\t\t\t</FieldAffixes>\n\t\t\t) : (\n\t\t\t\t<Tag\n\t\t\t\t\tclassName={typeof as === \"string\" ? styles.input : undefined}\n\t\t\t\t\tsuppressHydrationWarning\n\t\t\t\t\tref={ref}\n\t\t\t\t\t{...rest}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{!!validation && (\n\t\t\t\t<Validation hidden={validationType === \"form\"}>{validation}</Validation>\n\t\t\t)}\n\t\t\t{!!count && <p suppressHydrationWarning data-count={count} />}\n\t\t</div>\n\t) : (\n\t\t<div ref={ref} {...shared} {...rest} />\n\t);\n}) as FieldComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\nexport type FieldAffixProps = React.ComponentPropsWithoutRef<\"div\">;\nconst FieldAffixes = forwardRef<HTMLDivElement, FieldAffixProps>(\n\tfunction FieldAffixes({ className, ...rest }, ref) {\n\t\treturn (\n\t\t\t<div className={clsx(styles.affixes, className)} ref={ref} {...rest} />\n\t\t);\n\t},\n);\n\nexport type FieldDatalistProps = React.ComponentPropsWithoutRef<\"datalist\"> & {\n\t\"data-nofilter\"?: boolean;\n\t\"data-position\"?: Placement;\n};\n\nconst FieldDatalist = forwardRef<HTMLDataListElement, FieldDatalistProps>(\n\tfunction FieldDatalist({ \"data-nofilter\": filter, ...rest }, ref) {\n\t\treturn (\n\t\t\t<u-datalist\n\t\t\t\tdata-nofilter={!!filter || undefined} // Ensure data-nofilter is set correctly\n\t\t\t\tref={ref}\n\t\t\t\t{...toCustomElementProps(rest)}\n\t\t\t/>\n\t\t);\n\t},\n);\n\nexport type FieldOptionProps = React.ComponentPropsWithoutRef<\"option\">;\nconst FieldOption = forwardRef<HTMLOptionElement, FieldOptionProps>(\n\tfunction FieldOption(props, ref) {\n\t\treturn <u-option ref={ref} {...toCustomElementProps(props)} />;\n\t},\n);\n\nexport type FieldComboboxSelected = {\n\tlabel: string;\n\tvalue: string;\n\tchildren?: React.ReactNode;\n}[];\nexport type FieldComboboxProps = Omit<\n\tReactUcombobox,\n\t\"onChange\" | \"onInput\"\n> & {\n\t\"data-creatable\"?: boolean;\n\t\"data-multiple\"?: boolean;\n\tonAfterChange?: (e: CustomEvent<HTMLDataElement>) => void; // deprecated\n\tonAfterSelect?: (e: CustomEvent<HTMLDataElement>) => void; // Custom event to handle before change\n\tonBeforeChange?: (e: CustomEvent<HTMLDataElement>) => void; // deprecated\n\tonBeforeMatch?: (e: CustomEvent<HTMLOptionElement>) => void; // Custom event to handle before change\n\tonBeforeSelect?: (e: CustomEvent<HTMLDataElement>) => void; // Custom event to handle before change\n\tonSelectedChange?: (selected: FieldComboboxSelected) => void; // Allow onChange to be a function that returns void\n\toptions?: FieldComboboxSelected;\n\tselected?: FieldComboboxSelected; // Allow value to be a string or an array of strings for multiple select\n} & Pick<\n\t\tInputProps,\n\t\t| \"disabled\"\n\t\t| \"name\"\n\t\t| \"onChange\"\n\t\t| \"onInput\"\n\t\t| \"placeholder\"\n\t\t| \"readOnly\"\n\t\t| \"type\"\n\t\t| \"value\"\n\t> & // Allow input props to be passed down\n\tPick<FieldDatalistProps, \"data-position\" | \"data-nofilter\">; // Allow datalist props to be passed down\n\nconst FieldCombobox = forwardRef<UHTMLComboboxElement, FieldComboboxProps>(\n\tfunction FieldCombobox(\n\t\t{\n\t\t\t\"aria-required\": required,\n\t\t\t\"data-position\": position,\n\t\t\t\"data-nofilter\": nofilter,\n\t\t\t\"data-multiple\": multiple,\n\t\t\tonAfterChange,\n\t\t\tonAfterSelect,\n\t\t\tonBeforeChange,\n\t\t\tonBeforeMatch,\n\t\t\tonBeforeSelect,\n\t\t\tonSelectedChange,\n\t\t\tonInput,\n\t\t\tonChange,\n\t\t\tchildren,\n\t\t\tdisabled,\n\t\t\tname,\n\t\t\toptions,\n\t\t\tplaceholder,\n\t\t\treadOnly,\n\t\t\tselected,\n\t\t\ttype,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) {\n\t\tconst innerRef = useRef<UHTMLComboboxElement>(null);\n\t\tconst onSelected = useRef(onSelectedChange);\n\t\tonSelected.current = onSelectedChange; // Sync the latest onSelectedChange function\n\n\t\t// Deprecated props\n\t\tif (onAfterChange) {\n\t\t\tonAfterSelect = onAfterChange;\n\t\t\tconsole.warn(\n\t\t\t\t`Combobox onAfterChange is deprecated, use onAfterSelect instead.`,\n\t\t\t);\n\t\t}\n\t\tif (onBeforeChange) {\n\t\t\tonBeforeSelect = onBeforeChange;\n\t\t\tconsole.warn(\n\t\t\t\t`Combobox onBeforeChange is deprecated, use onBeforeSelect instead.`,\n\t\t\t);\n\t\t}\n\n\t\t// Using useEffect for React 18 and lower compatibility\n\t\tuseImperativeHandle(ref, () => innerRef.current as UHTMLComboboxElement); // Forward innerRef\n\t\tuseEffect(() => {\n\t\t\tconst self = innerRef.current;\n\t\t\tconst handleChange = (event: CustomEvent<HTMLDataElement>) => {\n\t\t\t\tconst handleSelected = onSelected.current;\n\t\t\t\tif (!onSelected) return; // No onSelectedChange function provided, let u-combobox handle it\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst { isConnected: remove, textContent, value } = event.detail;\n\t\t\t\tconst label = textContent?.trim() || \"\";\n\t\t\t\tconst prev = selected || [];\n\n\t\t\t\tif (remove) handleSelected?.(prev.filter((i) => i.value !== value));\n\t\t\t\telse if (multiple) handleSelected?.([...prev, { value, label }]);\n\t\t\t\telse handleSelected?.([{ value, label }]);\n\t\t\t};\n\n\t\t\tself?.addEventListener(\"comboboxbeforeselect\", handleChange);\n\t\t\treturn () =>\n\t\t\t\tself?.removeEventListener(\"comboboxbeforeselect\", handleChange);\n\t\t}, [multiple, selected]);\n\n\t\treturn (\n\t\t\t<u-combobox\n\t\t\t\tdata-multiple={multiple || undefined}\n\t\t\t\t{...toCustomElementProps({\n\t\t\t\t\toncomboboxbeforeselect: onBeforeSelect,\n\t\t\t\t\toncomboboxbeforematch: onBeforeMatch,\n\t\t\t\t\toncomboboxafterselect: onAfterSelect,\n\t\t\t\t\tref: innerRef,\n\t\t\t\t\t...props,\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t{selected?.map(({ children, label, value }) => (\n\t\t\t\t\t<data key={value} value={value} suppressHydrationWarning>\n\t\t\t\t\t\t{children ?? label}\n\t\t\t\t\t</data>\n\t\t\t\t))}\n\t\t\t\t{children || (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\taria-required={required}\n\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\tname={name}\n\t\t\t\t\t\t\tonInput={onInput}\n\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\ttype={type}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<del {...toCustomElementProps({ \"aria-label\": \"Fjern tekst\" })} />\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t{!!options && (\n\t\t\t\t\t<FieldDatalist data-nofilter={nofilter} data-position={position}>\n\t\t\t\t\t\t{options.map(toOption).map(({ children, label, value }) => (\n\t\t\t\t\t\t\t<FieldOption key={value} value={value} label={label}>\n\t\t\t\t\t\t\t\t{children ?? label}\n\t\t\t\t\t\t\t</FieldOption>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</FieldDatalist>\n\t\t\t\t)}\n\t\t\t</u-combobox>\n\t\t);\n\t},\n);\n\nexport type FieldLabelProps = React.ComponentPropsWithoutRef<\"label\">;\nexport const Field = Object.assign(FieldComp, {\n\tAffixes: FieldAffixes,\n\tCombobox: FieldCombobox,\n\tDatalist: FieldDatalist,\n\tOption: FieldOption,\n\tLabel: forwardRef<HTMLLabelElement, FieldLabelProps>(\n\t\tfunction FieldLabel(rest, ref) {\n\t\t\treturn <label suppressHydrationWarning ref={ref} {...rest} />;\n\t\t},\n\t),\n});\n"],"names":["Field","label","FieldAffixes","FieldDatalist","FieldOption","FieldCombobox","children"],"mappings":";;;;;;;;AAyCA,MAAM,WAAW,CAChB,MAEA,OAAO,MAAM,WAAW,EAAE,OAAO,GAAG,OAAO,EAAA,IAAM;AAE3C,MAAM,YAA4B,WAAiB,SAASA,OAGlE;AAAA,EACC,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACJ,GACA,KACC;AACD,QAAM,MAAM,MAAM;AAClB,QAAM,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC;AAC9B,QAAM,aAAa,qBAAqB;AACxC,QAAM,SAAS;AAAA,IACd,aAAa;AAAA,IACb,mBAAmB;AAAA,IACnB,WAAW,KAAK,OAAO,OAAO,SAAS;AAAA,IACvC;AAAA,EAAA;AAID,MAAI,OAAO,YAAY,CAAC,KAAK;AAC5B,WAAO,OAAO,MAAM;AAAA,MACnB,SAAS;AAAA;AAAA,MACT,0CAEI,UAAA,KAAK,SACJ,IAAI,QAAQ,EACb,IAAI,CAAC,EAAE,OAAAC,QAAO,MAAA,MACd,oBAAC,UAAA,EAAmB,OAClB,UAAAA,OAAAA,GADW,KAEb,CACA,EAAA,CACH;AAAA,IAAA,CAED;AAGF,SAAO,KACN,qBAAC,OAAA,EAAK,GAAG,QACP,UAAA;AAAA,IAAA,CAAC,CAAC,SAAS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T,UAAU;AAAA,EACV,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,OAAO;AAAA,IACN,SAAS,WAAW,MAAM,KAAK;AAC9B,iCAAQ,SAAA,EAAM,0BAAwB,MAAC,KAAW,GAAG,MAAM;AAAA,IAC5D;AAAA,EAAA;AAEF,CAAC;"}
@@ -152,10 +152,12 @@ export declare const WithCharacterCount: Story;
152
152
  export declare const WithCustomDescriptionTag: Story;
153
153
  export declare const WithCombobox: Story;
154
154
  export declare const WithComboboxMultiple: Story;
155
+ export declare const WithComboboxCreatable: Story;
155
156
  export declare const WithComboboxAPI: Story;
156
157
  export declare const WithComboboxCustomFilter: Story;
157
158
  export declare const ReactWithCombobox: Story;
158
159
  export declare const ReactWithComboboxWithChildren: Story;
159
160
  export declare const ReactWithComboboxMultiple: Story;
161
+ export declare const ReactWithComboboxCreatable: Story;
160
162
  export declare const ReactWithComboboxLong: Story;
161
163
  export declare const ReactWithCombobxCustomFilter: Story;
@@ -1,20 +1,30 @@
1
- import a from "../styles.module.css.js";
2
- import { IS_BROWSER as d, onLoaded as r, onMutation as f, attr as s, useId as u, isInputLike as I } from "../utils.js";
3
- const m = a.fieldset.split(" ")[0], S = a.validation.split(" ")[0], l = "aria-describedby", p = "aria-invalid", E = d ? document.getElementsByClassName(m) : [];
4
- function A() {
1
+ import styles from "../styles.module.css.js";
2
+ import { isBrowser, onLoaded, onMutation, attr, useId, isInputLike } from "../utils.js";
3
+ const CSS_FIELDSET = styles.fieldset.split(" ")[0];
4
+ const CSS_VALIDATION = styles.validation.split(" ")[0];
5
+ const ARIA_DESC = "aria-describedby";
6
+ const ARIA_INVALID = "aria-invalid";
7
+ const FIELDSETS = isBrowser() ? document.getElementsByClassName(CSS_FIELDSET) : [];
8
+ function handleFieldsetMutation() {
5
9
  setTimeout(() => {
6
- for (const i of E)
7
- if (i.isConnected) {
8
- const o = [];
9
- let e = null, n = !0;
10
- for (const t of i.getElementsByTagName("*"))
11
- t.classList.contains(S) ? (n = s(t, "data-color") === "success" || !t.clientHeight, e = u(t)) : I(t) && o.push(t);
12
- for (const t of o) {
13
- const c = s(t, l)?.replace(e || "#", "");
14
- s(t, l, `${e || ""} ${c || ""}`.trim()), s(t, p, `${!n}`);
10
+ for (const fieldset of FIELDSETS)
11
+ if (fieldset.isConnected) {
12
+ const inputs = [];
13
+ let validId = null;
14
+ let valid = true;
15
+ for (const el of fieldset.getElementsByTagName("*")) {
16
+ if (el.classList.contains(CSS_VALIDATION)) {
17
+ valid = attr(el, "data-color") === "success" || !el.clientHeight;
18
+ validId = useId(el);
19
+ } else if (isInputLike(el)) inputs.push(el);
20
+ }
21
+ for (const input of inputs) {
22
+ const desc = attr(input, ARIA_DESC)?.replace(validId || "#", "");
23
+ attr(input, ARIA_DESC, `${validId || ""} ${desc || ""}`.trim());
24
+ attr(input, ARIA_INVALID, `${!valid}`);
15
25
  }
16
26
  }
17
27
  });
18
28
  }
19
- r(() => [f(A, "class")]);
29
+ onLoaded(() => [onMutation(handleFieldsetMutation, "class")]);
20
30
  //# sourceMappingURL=fieldset-observer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fieldset-observer.js","sources":["../../designsystem/fieldset/fieldset-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport {\n\tattr,\n\tIS_BROWSER,\n\tisInputLike,\n\tonLoaded,\n\tonMutation,\n\tuseId,\n} from \"../utils\";\n\nconst CSS_FIELDSET = styles.fieldset.split(\" \")[0];\nconst CSS_VALIDATION = styles.validation.split(\" \")[0];\nconst ARIA_DESC = \"aria-describedby\";\nconst ARIA_INVALID = \"aria-invalid\";\nconst FIELDSETS = IS_BROWSER\n\t? document.getElementsByClassName(CSS_FIELDSET)\n\t: [];\n\n// Using setTimeout to ensure it runs after field-observer\nfunction handleFieldsetMutation() {\n\tsetTimeout(() => {\n\t\tfor (const fieldset of FIELDSETS)\n\t\t\tif (fieldset.isConnected) {\n\t\t\t\tconst inputs: HTMLInputElement[] = [];\n\t\t\t\tlet validId: string | null = null;\n\t\t\t\tlet valid = true;\n\n\t\t\t\tfor (const el of fieldset.getElementsByTagName(\"*\")) {\n\t\t\t\t\tif (el.classList.contains(CSS_VALIDATION)) {\n\t\t\t\t\t\tvalid = attr(el, \"data-color\") === \"success\" || !el.clientHeight; // Only set invalid if Validation is visible\n\t\t\t\t\t\tvalidId = useId(el);\n\t\t\t\t\t} else if (isInputLike(el)) inputs.push(el);\n\t\t\t\t}\n\n\t\t\t\tfor (const input of inputs) {\n\t\t\t\t\tconst desc = attr(input, ARIA_DESC)?.replace(validId || \"#\", \"\");\n\n\t\t\t\t\tattr(input, ARIA_DESC, `${validId || \"\"} ${desc || \"\"}`.trim());\n\t\t\t\t\tattr(input, ARIA_INVALID, `${!valid}`);\n\t\t\t\t}\n\t\t\t}\n\t});\n}\n\nonLoaded(() => [onMutation(handleFieldsetMutation, \"class\")]);\n"],"names":["CSS_FIELDSET","styles","CSS_VALIDATION","ARIA_DESC","ARIA_INVALID","FIELDSETS","IS_BROWSER","handleFieldsetMutation","fieldset","inputs","validId","valid","el","attr","useId","isInputLike","input","desc","onLoaded","onMutation"],"mappings":";;AAUA,MAAMA,IAAeC,EAAO,SAAS,MAAM,GAAG,EAAE,CAAC,GAC3CC,IAAiBD,EAAO,WAAW,MAAM,GAAG,EAAE,CAAC,GAC/CE,IAAY,oBACZC,IAAe,gBACfC,IAAYC,IACf,SAAS,uBAAuBN,CAAY,IAC5C,CAAA;AAGH,SAASO,IAAyB;AACjC,aAAW,MAAM;AAChB,eAAWC,KAAYH;AACtB,UAAIG,EAAS,aAAa;AACzB,cAAMC,IAA6B,CAAA;AACnC,YAAIC,IAAyB,MACzBC,IAAQ;AAEZ,mBAAWC,KAAMJ,EAAS,qBAAqB,GAAG;AACjD,UAAII,EAAG,UAAU,SAASV,CAAc,KACvCS,IAAQE,EAAKD,GAAI,YAAY,MAAM,aAAa,CAACA,EAAG,cACpDF,IAAUI,EAAMF,CAAE,KACRG,EAAYH,CAAE,KAAGH,EAAO,KAAKG,CAAE;AAG3C,mBAAWI,KAASP,GAAQ;AAC3B,gBAAMQ,IAAOJ,EAAKG,GAAOb,CAAS,GAAG,QAAQO,KAAW,KAAK,EAAE;AAE/D,UAAAG,EAAKG,GAAOb,GAAW,GAAGO,KAAW,EAAE,IAAIO,KAAQ,EAAE,GAAG,KAAA,CAAM,GAC9DJ,EAAKG,GAAOZ,GAAc,GAAG,CAACO,CAAK,EAAE;AAAA,QACtC;AAAA,MACD;AAAA,EACF,CAAC;AACF;AAEAO,EAAS,MAAM,CAACC,EAAWZ,GAAwB,OAAO,CAAC,CAAC;"}
1
+ {"version":3,"file":"fieldset-observer.js","sources":["../../designsystem/fieldset/fieldset-observer.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport {\n\tattr,\n\tisBrowser,\n\tisInputLike,\n\tonLoaded,\n\tonMutation,\n\tuseId,\n} from \"../utils\";\n\nconst CSS_FIELDSET = styles.fieldset.split(\" \")[0];\nconst CSS_VALIDATION = styles.validation.split(\" \")[0];\nconst ARIA_DESC = \"aria-describedby\";\nconst ARIA_INVALID = \"aria-invalid\";\nconst FIELDSETS = isBrowser()\n\t? document.getElementsByClassName(CSS_FIELDSET)\n\t: [];\n\n// Using setTimeout to ensure it runs after field-observer\nfunction handleFieldsetMutation() {\n\tsetTimeout(() => {\n\t\tfor (const fieldset of FIELDSETS)\n\t\t\tif (fieldset.isConnected) {\n\t\t\t\tconst inputs: HTMLInputElement[] = [];\n\t\t\t\tlet validId: string | null = null;\n\t\t\t\tlet valid = true;\n\n\t\t\t\tfor (const el of fieldset.getElementsByTagName(\"*\")) {\n\t\t\t\t\tif (el.classList.contains(CSS_VALIDATION)) {\n\t\t\t\t\t\tvalid = attr(el, \"data-color\") === \"success\" || !el.clientHeight; // Only set invalid if Validation is visible\n\t\t\t\t\t\tvalidId = useId(el);\n\t\t\t\t\t} else if (isInputLike(el)) inputs.push(el);\n\t\t\t\t}\n\n\t\t\t\tfor (const input of inputs) {\n\t\t\t\t\tconst desc = attr(input, ARIA_DESC)?.replace(validId || \"#\", \"\");\n\n\t\t\t\t\tattr(input, ARIA_DESC, `${validId || \"\"} ${desc || \"\"}`.trim());\n\t\t\t\t\tattr(input, ARIA_INVALID, `${!valid}`);\n\t\t\t\t}\n\t\t\t}\n\t});\n}\n\nonLoaded(() => [onMutation(handleFieldsetMutation, \"class\")]);\n"],"names":[],"mappings":";;AAUA,MAAM,eAAe,OAAO,SAAS,MAAM,GAAG,EAAE,CAAC;AACjD,MAAM,iBAAiB,OAAO,WAAW,MAAM,GAAG,EAAE,CAAC;AACrD,MAAM,YAAY;AAClB,MAAM,eAAe;AACrB,MAAM,YAAY,UAAA,IACf,SAAS,uBAAuB,YAAY,IAC5C,CAAA;AAGH,SAAS,yBAAyB;AACjC,aAAW,MAAM;AAChB,eAAW,YAAY;AACtB,UAAI,SAAS,aAAa;AACzB,cAAM,SAA6B,CAAA;AACnC,YAAI,UAAyB;AAC7B,YAAI,QAAQ;AAEZ,mBAAW,MAAM,SAAS,qBAAqB,GAAG,GAAG;AACpD,cAAI,GAAG,UAAU,SAAS,cAAc,GAAG;AAC1C,oBAAQ,KAAK,IAAI,YAAY,MAAM,aAAa,CAAC,GAAG;AACpD,sBAAU,MAAM,EAAE;AAAA,UACnB,WAAW,YAAY,EAAE,EAAG,QAAO,KAAK,EAAE;AAAA,QAC3C;AAEA,mBAAW,SAAS,QAAQ;AAC3B,gBAAM,OAAO,KAAK,OAAO,SAAS,GAAG,QAAQ,WAAW,KAAK,EAAE;AAE/D,eAAK,OAAO,WAAW,GAAG,WAAW,EAAE,IAAI,QAAQ,EAAE,GAAG,KAAA,CAAM;AAC9D,eAAK,OAAO,cAAc,GAAG,CAAC,KAAK,EAAE;AAAA,QACtC;AAAA,MACD;AAAA,EACF,CAAC;AACF;AAEA,SAAS,MAAM,CAAC,WAAW,wBAAwB,OAAO,CAAC,CAAC;"}
@@ -1,2 +1,2 @@
1
1
  export type FieldsetProps = React.ComponentPropsWithoutRef<"fieldset">;
2
- export declare const Fieldset: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, "ref"> & React.RefAttributes<HTMLFieldSetElement>>;
2
+ export declare const Fieldset: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, "ref"> & import('react').RefAttributes<HTMLFieldSetElement>>;
@@ -1,20 +1,20 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import s from "clsx";
3
- import { forwardRef as f } from "react";
4
- import i from "../styles.module.css.js";
5
- const n = f(
6
- function({ className: e, ...r }, t) {
7
- return /* @__PURE__ */ o(
1
+ import { jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import { forwardRef } from "react";
4
+ import styles from "../styles.module.css.js";
5
+ const Fieldset = forwardRef(
6
+ function Fieldset2({ className, ...rest }, ref) {
7
+ return /* @__PURE__ */ jsx(
8
8
  "fieldset",
9
9
  {
10
- className: s(i.fieldset, e),
11
- ref: t,
12
- ...r
10
+ className: clsx(styles.fieldset, className),
11
+ ref,
12
+ ...rest
13
13
  }
14
14
  );
15
15
  }
16
16
  );
17
17
  export {
18
- n as Fieldset
18
+ Fieldset
19
19
  };
20
20
  //# sourceMappingURL=fieldset.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fieldset.js","sources":["../../designsystem/fieldset/fieldset.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type FieldsetProps = React.ComponentPropsWithoutRef<\"fieldset\">;\n\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(\n\tfunction Fieldset({ className, ...rest }, ref) {\n\t\treturn (\n\t\t\t<fieldset\n\t\t\t\tclassName={clsx(styles.fieldset, className)}\n\t\t\t\tref={ref}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t);\n\t},\n);\n"],"names":["Fieldset","forwardRef","className","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAMO,MAAMA,IAAWC;AAAA,EACvB,SAAkB,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAAQC,GAAK;AAC9C,WACC,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,WAAWC,EAAKC,EAAO,UAAUL,CAAS;AAAA,QAC1C,KAAAE;AAAA,QACC,GAAGD;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACD;"}
1
+ {"version":3,"file":"fieldset.js","sources":["../../designsystem/fieldset/fieldset.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type FieldsetProps = React.ComponentPropsWithoutRef<\"fieldset\">;\n\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(\n\tfunction Fieldset({ className, ...rest }, ref) {\n\t\treturn (\n\t\t\t<fieldset\n\t\t\t\tclassName={clsx(styles.fieldset, className)}\n\t\t\t\tref={ref}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t);\n\t},\n);\n"],"names":["Fieldset"],"mappings":";;;;AAMO,MAAM,WAAW;AAAA,EACvB,SAASA,UAAS,EAAE,WAAW,GAAG,KAAA,GAAQ,KAAK;AAC9C,WACC;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,WAAW,KAAK,OAAO,UAAU,SAAS;AAAA,QAC1C;AAAA,QACC,GAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACD;"}
@@ -1,13 +1,14 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import e from "clsx";
3
- import { forwardRef as m } from "react";
4
- import f from "../styles.module.css.js";
5
- const d = m(
6
- function({ as: o, className: r, ...l }, t) {
7
- return /* @__PURE__ */ a(o || "label", { className: e(f.fileupload, r), ref: t, ...l });
1
+ import { jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import { forwardRef } from "react";
4
+ import styles from "../styles.module.css.js";
5
+ const Fileupload = forwardRef(
6
+ function Fileupload2({ as, className, ...rest }, ref) {
7
+ const Tag = as || "label";
8
+ return /* @__PURE__ */ jsx(Tag, { className: clsx(styles.fileupload, className), ref, ...rest });
8
9
  }
9
10
  );
10
11
  export {
11
- d as Fileupload
12
+ Fileupload
12
13
  };
13
14
  //# sourceMappingURL=fileupload.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fileupload.js","sources":["../../designsystem/fileupload/fileupload.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\nexport type FileuploadProps<As extends React.ElementType = \"label\"> =\n\tPolymorphicComponentPropWithRef<As>;\n\ntype FileuploadComponent = <As extends React.ElementType = \"label\">(\n\tprops: FileuploadProps<As>,\n) => JSX.Element;\n\nexport const Fileupload: FileuploadComponent = forwardRef<null>(\n\tfunction Fileupload<As extends React.ElementType = \"label\">(\n\t\t{ as, className, ...rest }: FileuploadProps<As>,\n\t\tref?: PolymorphicRef<As>,\n\t) {\n\t\tconst Tag = as || \"label\";\n\n\t\treturn (\n\t\t\t<Tag className={clsx(styles.fileupload, className)} ref={ref} {...rest} />\n\t\t);\n\t},\n) as FileuploadComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Fileupload","forwardRef","as","className","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAeO,MAAMA,IAAkCC;AAAA,EAC9C,SACC,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAA,GACpBC,GACC;AAGD,WACC,gBAAAC,EAHWJ,KAAM,SAGhB,EAAI,WAAWK,EAAKC,EAAO,YAAYL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAA,CAAM;AAAA,EAE1E;AACD;"}
1
+ {"version":3,"file":"fileupload.js","sources":["../../designsystem/fileupload/fileupload.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\nexport type FileuploadProps<As extends React.ElementType = \"label\"> =\n\tPolymorphicComponentPropWithRef<As>;\n\ntype FileuploadComponent = <As extends React.ElementType = \"label\">(\n\tprops: FileuploadProps<As>,\n) => JSX.Element;\n\nexport const Fileupload: FileuploadComponent = forwardRef<null>(\n\tfunction Fileupload<As extends React.ElementType = \"label\">(\n\t\t{ as, className, ...rest }: FileuploadProps<As>,\n\t\tref?: PolymorphicRef<As>,\n\t) {\n\t\tconst Tag = as || \"label\";\n\n\t\treturn (\n\t\t\t<Tag className={clsx(styles.fileupload, className)} ref={ref} {...rest} />\n\t\t);\n\t},\n) as FileuploadComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Fileupload"],"mappings":";;;;AAeO,MAAM,aAAkC;AAAA,EAC9C,SAASA,YACR,EAAE,IAAI,WAAW,GAAG,KAAA,GACpB,KACC;AACD,UAAM,MAAM,MAAM;AAElB,WACC,oBAAC,KAAA,EAAI,WAAW,KAAK,OAAO,YAAY,SAAS,GAAG,KAAW,GAAG,KAAA,CAAM;AAAA,EAE1E;AACD;"}
@@ -1,2 +1,2 @@
1
1
  export type HelpTextProps = React.ComponentPropsWithoutRef<"button">;
2
- export declare const HelpText: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
2
+ export declare const HelpText: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
@@ -1,27 +1,27 @@
1
- import { jsxs as l, Fragment as m, jsx as o } from "react/jsx-runtime";
2
- import i from "clsx";
3
- import { forwardRef as n, useId as c } from "react";
4
- import t from "../styles.module.css.js";
5
- const b = n(
6
- function({ className: r, children: p, ...s }, a) {
7
- const e = c();
8
- return /* @__PURE__ */ l(m, { children: [
9
- /* @__PURE__ */ o(
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import { forwardRef, useId } from "react";
4
+ import styles from "../styles.module.css.js";
5
+ const HelpText = forwardRef(
6
+ function HelpText2({ className, children, ...rest }, ref) {
7
+ const popoverId = useId();
8
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
9
+ /* @__PURE__ */ jsx(
10
10
  "button",
11
11
  {
12
12
  "aria-label": "Hjelptekst",
13
- className: i(t.helptext, r),
14
- popoverTarget: e,
15
- ref: a,
13
+ className: clsx(styles.helptext, className),
14
+ popoverTarget: popoverId,
15
+ ref,
16
16
  type: "button",
17
- ...s
17
+ ...rest
18
18
  }
19
19
  ),
20
- /* @__PURE__ */ o("div", { className: t.popover, id: e, popover: "auto", children: p })
20
+ /* @__PURE__ */ jsx("div", { className: styles.popover, id: popoverId, popover: "auto", children })
21
21
  ] });
22
22
  }
23
23
  );
24
24
  export {
25
- b as HelpText
25
+ HelpText
26
26
  };
27
27
  //# sourceMappingURL=helptext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helptext.js","sources":["../../designsystem/helptext/helptext.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, useId } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type HelpTextProps = React.ComponentPropsWithoutRef<\"button\">;\n\nexport const HelpText = forwardRef<HTMLButtonElement, HelpTextProps>(\n\tfunction HelpText({ className, children, ...rest }, ref) {\n\t\tconst popoverId = useId();\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<button\n\t\t\t\t\taria-label=\"Hjelptekst\"\n\t\t\t\t\tclassName={clsx(styles.helptext, className)}\n\t\t\t\t\tpopoverTarget={popoverId}\n\t\t\t\t\tref={ref}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t{...rest}\n\t\t\t\t/>\n\t\t\t\t<div className={styles.popover} id={popoverId} popover=\"auto\">\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t},\n);\n"],"names":["HelpText","forwardRef","className","children","rest","ref","popoverId","useId","jsxs","Fragment","jsx","clsx","styles"],"mappings":";;;;AAMO,MAAMA,IAAWC;AAAA,EACvB,SAAkB,EAAE,WAAAC,GAAW,UAAAC,GAAU,GAAGC,EAAA,GAAQC,GAAK;AACxD,UAAMC,IAAYC,EAAA;AAClB,WACC,gBAAAC,EAAAC,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACA,cAAW;AAAA,UACX,WAAWC,EAAKC,EAAO,UAAUV,CAAS;AAAA,UAC1C,eAAeI;AAAA,UACf,KAAAD;AAAA,UACA,MAAK;AAAA,UACJ,GAAGD;AAAA,QAAA;AAAA,MAAA;AAAA,MAEL,gBAAAM,EAAC,SAAI,WAAWE,EAAO,SAAS,IAAIN,GAAW,SAAQ,QACrD,UAAAH,EAAA,CACF;AAAA,IAAA,GACD;AAAA,EAEF;AACD;"}
1
+ {"version":3,"file":"helptext.js","sources":["../../designsystem/helptext/helptext.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, useId } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type HelpTextProps = React.ComponentPropsWithoutRef<\"button\">;\n\nexport const HelpText = forwardRef<HTMLButtonElement, HelpTextProps>(\n\tfunction HelpText({ className, children, ...rest }, ref) {\n\t\tconst popoverId = useId();\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<button\n\t\t\t\t\taria-label=\"Hjelptekst\"\n\t\t\t\t\tclassName={clsx(styles.helptext, className)}\n\t\t\t\t\tpopoverTarget={popoverId}\n\t\t\t\t\tref={ref}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t{...rest}\n\t\t\t\t/>\n\t\t\t\t<div className={styles.popover} id={popoverId} popover=\"auto\">\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t},\n);\n"],"names":["HelpText"],"mappings":";;;;AAMO,MAAM,WAAW;AAAA,EACvB,SAASA,UAAS,EAAE,WAAW,UAAU,GAAG,KAAA,GAAQ,KAAK;AACxD,UAAM,YAAY,MAAA;AAClB,WACC,qBAAA,UAAA,EACC,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACA,cAAW;AAAA,UACX,WAAW,KAAK,OAAO,UAAU,SAAS;AAAA,UAC1C,eAAe;AAAA,UACf;AAAA,UACA,MAAK;AAAA,UACJ,GAAG;AAAA,QAAA;AAAA,MAAA;AAAA,MAEL,oBAAC,SAAI,WAAW,OAAO,SAAS,IAAI,WAAW,SAAQ,QACrD,SAAA,CACF;AAAA,IAAA,GACD;AAAA,EAEF;AACD;"}