@mattilsynet/design 3.3.10 → 3.4.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.
Files changed (191) hide show
  1. package/mtds/_virtual/_rolldown/runtime.js +17 -0
  2. package/mtds/ai/card.stories.tsx +54 -77
  3. package/mtds/ai/layout.mdx +37 -1
  4. package/mtds/ai/layout.stories.tsx +126 -1
  5. package/mtds/ai/print.mdx +1 -1
  6. package/mtds/ai/print.stories.tsx +1 -2
  7. package/mtds/alert/alert.js +16 -11
  8. package/mtds/alert/alert.js.map +1 -1
  9. package/mtds/analytics/analytics.js +118 -118
  10. package/mtds/analytics/analytics.js.map +1 -1
  11. package/mtds/app/app-observer.js +31 -36
  12. package/mtds/app/app-observer.js.map +1 -1
  13. package/mtds/app/app-toggle.js +12 -26
  14. package/mtds/app/app-toggle.js.map +1 -1
  15. package/mtds/app/app-toggle2.js +6 -11
  16. package/mtds/app/app-toggle2.js.map +1 -1
  17. package/mtds/app/app.js +66 -60
  18. package/mtds/app/app.js.map +1 -1
  19. package/mtds/atlas/atlas-element.js +83 -93
  20. package/mtds/atlas/atlas-element.js.map +1 -1
  21. package/mtds/atlas/atlas-marker.js +63 -52
  22. package/mtds/atlas/atlas-marker.js.map +1 -1
  23. package/mtds/atlas/atlas-matgeo.js +67 -61
  24. package/mtds/atlas/atlas-matgeo.js.map +1 -1
  25. package/mtds/atlas/atlas-wms.js +33 -28
  26. package/mtds/atlas/atlas-wms.js.map +1 -1
  27. package/mtds/atlas/atlas.js +6 -38
  28. package/mtds/atlas/atlas.js.map +1 -1
  29. package/mtds/atlas/atlas2.js +39 -0
  30. package/mtds/atlas/atlas2.js.map +1 -0
  31. package/mtds/atlas/cluster.js +759 -1149
  32. package/mtds/atlas/cluster.js.map +1 -1
  33. package/mtds/atlas.iife.js +3 -4
  34. package/mtds/atlas.js +6 -14
  35. package/mtds/avatar/avatar.js +14 -10
  36. package/mtds/avatar/avatar.js.map +1 -1
  37. package/mtds/badge/badge.js +15 -10
  38. package/mtds/badge/badge.js.map +1 -1
  39. package/mtds/breadcrumbs/breadcrumbs.js +15 -19
  40. package/mtds/breadcrumbs/breadcrumbs.js.map +1 -1
  41. package/mtds/button/button.js +18 -20
  42. package/mtds/button/button.js.map +1 -1
  43. package/mtds/card/card.js +22 -15
  44. package/mtds/card/card.js.map +1 -1
  45. package/mtds/chart/chart-axis.js +33 -21
  46. package/mtds/chart/chart-axis.js.map +1 -1
  47. package/mtds/chart/chart-bars.js +23 -21
  48. package/mtds/chart/chart-bars.js.map +1 -1
  49. package/mtds/chart/chart-element.js +94 -88
  50. package/mtds/chart/chart-element.js.map +1 -1
  51. package/mtds/chart/chart-lines.js +35 -37
  52. package/mtds/chart/chart-lines.js.map +1 -1
  53. package/mtds/chart/chart-pies.js +17 -17
  54. package/mtds/chart/chart-pies.js.map +1 -1
  55. package/mtds/chart/chart.js +6 -52
  56. package/mtds/chart/chart.js.map +1 -1
  57. package/mtds/chart/chart2.js +21 -0
  58. package/mtds/chart/chart2.js.map +1 -0
  59. package/mtds/chip/chip.js +15 -11
  60. package/mtds/chip/chip.js.map +1 -1
  61. package/mtds/deprecations.js +76 -158
  62. package/mtds/deprecations.js.map +1 -1
  63. package/mtds/details/details.js +21 -24
  64. package/mtds/details/details.js.map +1 -1
  65. package/mtds/dialog/dialog.js +17 -21
  66. package/mtds/dialog/dialog.js.map +1 -1
  67. package/mtds/divider/divider.js +15 -20
  68. package/mtds/divider/divider.js.map +1 -1
  69. package/mtds/errorsummary/errorsummary.js +14 -16
  70. package/mtds/errorsummary/errorsummary.js.map +1 -1
  71. package/mtds/external/@turf/boolean-point-in-polygon/dist/esm/index.js +22 -25
  72. package/mtds/external/@turf/boolean-point-in-polygon/dist/esm/index.js.map +1 -1
  73. package/mtds/external/@turf/helpers/dist/esm/index.js +21 -24
  74. package/mtds/external/@turf/helpers/dist/esm/index.js.map +1 -1
  75. package/mtds/external/@turf/invariant/dist/esm/index.js +15 -19
  76. package/mtds/external/@turf/invariant/dist/esm/index.js.map +1 -1
  77. package/mtds/external/@u-elements/u-combobox/dist/u-combobox.js +270 -297
  78. package/mtds/external/@u-elements/u-combobox/dist/u-combobox.js.map +1 -1
  79. package/mtds/external/@u-elements/u-details/dist/u-details.js +75 -101
  80. package/mtds/external/@u-elements/u-details/dist/u-details.js.map +1 -1
  81. package/mtds/external/leaflet/dist/leaflet-src.js +4257 -6151
  82. package/mtds/external/leaflet/dist/leaflet-src.js.map +1 -1
  83. package/mtds/external/leaflet/dist/leaflet.css.js +5 -606
  84. package/mtds/external/leaflet/dist/leaflet.css.js.map +1 -1
  85. package/mtds/external/point-in-polygon-hao/dist/esm/index.js +24 -25
  86. package/mtds/external/point-in-polygon-hao/dist/esm/index.js.map +1 -1
  87. package/mtds/external/robust-predicates/esm/incircle.js +5 -0
  88. package/mtds/external/robust-predicates/esm/incircle.js.map +1 -0
  89. package/mtds/external/robust-predicates/esm/insphere.js +5 -0
  90. package/mtds/external/robust-predicates/esm/insphere.js.map +1 -0
  91. package/mtds/external/robust-predicates/esm/orient2d.js +20 -22
  92. package/mtds/external/robust-predicates/esm/orient2d.js.map +1 -1
  93. package/mtds/external/robust-predicates/esm/orient3d.js +5 -0
  94. package/mtds/external/robust-predicates/esm/orient3d.js.map +1 -0
  95. package/mtds/external/robust-predicates/esm/util.js +20 -28
  96. package/mtds/external/robust-predicates/esm/util.js.map +1 -1
  97. package/mtds/external/robust-predicates/index.js +5 -0
  98. package/mtds/field/field.js +167 -214
  99. package/mtds/field/field.js.map +1 -1
  100. package/mtds/fieldset/fieldset.js +32 -30
  101. package/mtds/fieldset/fieldset.js.map +1 -1
  102. package/mtds/fileupload/fileupload.js +16 -13
  103. package/mtds/fileupload/fileupload.js.map +1 -1
  104. package/mtds/helptext/helptext.js +25 -27
  105. package/mtds/helptext/helptext.js.map +1 -1
  106. package/mtds/identitet/illustrasjons-generator/illustrasjons-generator.d.ts +1 -0
  107. package/mtds/identitet/illustrasjons-generator/index-old-1.d.ts +1 -0
  108. package/mtds/identitet/infografikk-generator/infografikk-generator.d.ts +1 -0
  109. package/mtds/index.iife.js +21 -21
  110. package/mtds/index.js +38 -31
  111. package/mtds/index.js.map +1 -1
  112. package/mtds/input/input.js +33 -47
  113. package/mtds/input/input.js.map +1 -1
  114. package/mtds/law/law-helper.js +106 -95
  115. package/mtds/law/law-helper.js.map +1 -1
  116. package/mtds/law/law.js +15 -10
  117. package/mtds/law/law.js.map +1 -1
  118. package/mtds/layout/layout.js +21 -13
  119. package/mtds/layout/layout.js.map +1 -1
  120. package/mtds/layout/layout.stories.d.ts +1 -0
  121. package/mtds/link/link.js +15 -10
  122. package/mtds/link/link.js.map +1 -1
  123. package/mtds/logo/logo-observer.js +18 -18
  124. package/mtds/logo/logo-observer.js.map +1 -1
  125. package/mtds/logo/logo.js +18 -18
  126. package/mtds/logo/logo.js.map +1 -1
  127. package/mtds/package.js +6 -0
  128. package/mtds/package.js.map +1 -0
  129. package/mtds/package.json.d.ts +112 -0
  130. package/mtds/pagination/pagination.js +46 -60
  131. package/mtds/pagination/pagination.js.map +1 -1
  132. package/mtds/popover/popover-observer.js +15 -15
  133. package/mtds/popover/popover-observer.js.map +1 -1
  134. package/mtds/popover/popover.js +18 -20
  135. package/mtds/popover/popover.js.map +1 -1
  136. package/mtds/print/print.js +15 -10
  137. package/mtds/print/print.js.map +1 -1
  138. package/mtds/print/print.stories.d.ts +0 -1
  139. package/mtds/profilering/epost.d.ts +1 -0
  140. package/mtds/progress/progress.js +15 -13
  141. package/mtds/progress/progress.js.map +1 -1
  142. package/mtds/react-atlas.js +7 -16
  143. package/mtds/react.js +36 -84
  144. package/mtds/skeleton/skeleton.js +15 -11
  145. package/mtds/skeleton/skeleton.js.map +1 -1
  146. package/mtds/spinner/spinner.js +16 -13
  147. package/mtds/spinner/spinner.js.map +1 -1
  148. package/mtds/steps/steps.js +15 -10
  149. package/mtds/steps/steps.js.map +1 -1
  150. package/mtds/styles.css +2 -1
  151. package/mtds/styles.module.js +122 -0
  152. package/mtds/styles.module.js.map +1 -0
  153. package/mtds/table/table-observer.js +23 -28
  154. package/mtds/table/table-observer.js.map +1 -1
  155. package/mtds/table/table.js +88 -60
  156. package/mtds/table/table.js.map +1 -1
  157. package/mtds/tabs/tabs.js +32 -27
  158. package/mtds/tabs/tabs.js.map +1 -1
  159. package/mtds/tag/tag.js +16 -19
  160. package/mtds/tag/tag.js.map +1 -1
  161. package/mtds/tailwind.css +0 -4
  162. package/mtds/toast/toast-helper.js +45 -25
  163. package/mtds/toast/toast-helper.js.map +1 -1
  164. package/mtds/toast/toast-observer.js +18 -18
  165. package/mtds/toast/toast-observer.js.map +1 -1
  166. package/mtds/toast/toast.js +67 -54
  167. package/mtds/toast/toast.js.map +1 -1
  168. package/mtds/togglegroup/togglegroup.js +31 -40
  169. package/mtds/togglegroup/togglegroup.js.map +1 -1
  170. package/mtds/tooltip/tooltip-element.js +12 -25
  171. package/mtds/tooltip/tooltip-element.js.map +1 -1
  172. package/mtds/typography/typography.js +38 -21
  173. package/mtds/typography/typography.js.map +1 -1
  174. package/mtds/utils.js +53 -70
  175. package/mtds/utils.js.map +1 -1
  176. package/mtds/validation/validation-observer.js +40 -47
  177. package/mtds/validation/validation-observer.js.map +1 -1
  178. package/mtds/validation/validation.js +17 -21
  179. package/mtds/validation/validation.js.map +1 -1
  180. package/package.json +9 -9
  181. package/mtds/atlas/atlas.css.js +0 -138
  182. package/mtds/atlas/atlas.css.js.map +0 -1
  183. package/mtds/atlas.js.map +0 -1
  184. package/mtds/chart/chart.css.js +0 -187
  185. package/mtds/chart/chart.css.js.map +0 -1
  186. package/mtds/package.json.js +0 -5
  187. package/mtds/package.json.js.map +0 -1
  188. package/mtds/react-atlas.js.map +0 -1
  189. package/mtds/react.js.map +0 -1
  190. package/mtds/styles.module.css.js +0 -118
  191. package/mtds/styles.module.css.js.map +0 -1
package/mtds/index.js CHANGED
@@ -1,13 +1,12 @@
1
- import "@u-elements/u-progress";
2
- export * from "@digdir/designsystemet-web";
3
- import { UHTMLComboboxElement as d, UHTMLComboboxShadowRoot as w, UHTMLComboboxStyle as H } from "./external/@u-elements/u-combobox/dist/u-combobox.js";
4
- import { UHTMLDetailsElement as T, UHTMLDetailsShadowRoot as U, UHTMLDetailsStyle as b, UHTMLSummaryElement as n } from "./external/@u-elements/u-details/dist/u-details.js";
5
- import { version as C } from "./package.json.js";
6
- import { analytics as h } from "./analytics/analytics.js";
7
- import { toggleAppExpanded as c } from "./app/app-observer.js";
8
- import { fixLawHtml as k, getLawChecked as D, parseLawIds as u, parseLawMeta as R, setLawChecked as v, toggleLawChecked as A } from "./law/law-helper.js";
9
- import * as t from "./styles.module.css.js";
10
- import { toast as _ } from "./toast/toast-helper.js";
1
+ import { __exportAll as e, __reExport as t } from "./_virtual/_rolldown/runtime.js";
2
+ import { UHTMLComboboxElement as n, UHTMLComboboxShadowRoot as r, UHTMLComboboxStyle as i } from "./external/@u-elements/u-combobox/dist/u-combobox.js";
3
+ import { UHTMLDetailsElement as a, UHTMLDetailsShadowRoot as o, UHTMLDetailsStyle as s, UHTMLSummaryElement as c } from "./external/@u-elements/u-details/dist/u-details.js";
4
+ import { version as l } from "./package.js";
5
+ import { styles_module_exports as u } from "./styles.module.js";
6
+ import { analytics as d } from "./analytics/analytics.js";
7
+ import { toggleAppExpanded as f } from "./app/app-observer.js";
8
+ import { fixLawHtml as p, getLawChecked as m, parseLawIds as h, parseLawMeta as g, setLawChecked as _, toggleLawChecked as v } from "./law/law-helper.js";
9
+ import { toast as y } from "./toast/toast-helper.js";
11
10
  import "./chart/chart-element.js";
12
11
  import "./deprecations.js";
13
12
  import "./logo/logo-observer.js";
@@ -16,24 +15,32 @@ import "./table/table-observer.js";
16
15
  import "./toast/toast-observer.js";
17
16
  import "./tooltip/tooltip-element.js";
18
17
  import "./validation/validation-observer.js";
19
- export {
20
- d as UHTMLComboboxElement,
21
- w as UHTMLComboboxShadowRoot,
22
- H as UHTMLComboboxStyle,
23
- T as UHTMLDetailsElement,
24
- U as UHTMLDetailsShadowRoot,
25
- b as UHTMLDetailsStyle,
26
- n as UHTMLSummaryElement,
27
- h as analytics,
28
- k as fixLawHtml,
29
- D as getLawChecked,
30
- u as parseLawIds,
31
- R as parseLawMeta,
32
- v as setLawChecked,
33
- t as styles,
34
- _ as toast,
35
- c as toggleAppExpanded,
36
- A as toggleLawChecked,
37
- C as version
38
- };
39
- //# sourceMappingURL=index.js.map
18
+ import "@u-elements/u-progress";
19
+ export * from "@digdir/designsystemet-web";
20
+ //#region designsystem/index.ts
21
+ var b = /* @__PURE__ */ e({
22
+ UHTMLComboboxElement: () => n,
23
+ UHTMLComboboxShadowRoot: () => r,
24
+ UHTMLComboboxStyle: () => i,
25
+ UHTMLDetailsElement: () => a,
26
+ UHTMLDetailsShadowRoot: () => o,
27
+ UHTMLDetailsStyle: () => s,
28
+ UHTMLSummaryElement: () => c,
29
+ analytics: () => d,
30
+ fixLawHtml: () => p,
31
+ getLawChecked: () => m,
32
+ parseLawIds: () => h,
33
+ parseLawMeta: () => g,
34
+ setLawChecked: () => _,
35
+ styles: () => u,
36
+ toast: () => y,
37
+ toggleAppExpanded: () => f,
38
+ toggleLawChecked: () => v,
39
+ version: () => l
40
+ });
41
+ import * as x from "@digdir/designsystemet-web";
42
+ t(b, x);
43
+ //#endregion
44
+ export { n as UHTMLComboboxElement, r as UHTMLComboboxShadowRoot, i as UHTMLComboboxStyle, a as UHTMLDetailsElement, o as UHTMLDetailsShadowRoot, s as UHTMLDetailsStyle, c as UHTMLSummaryElement, d as analytics, b as designsystem_exports, p as fixLawHtml, m as getLawChecked, h as parseLawIds, g as parseLawMeta, _ as setLawChecked, u as styles, y as toast, f as toggleAppExpanded, v as toggleLawChecked, l as version };
45
+
46
+ //# sourceMappingURL=index.js.map
package/mtds/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../designsystem/index.ts"],"sourcesContent":["// Expose u-progress, which is not used in @digdir/designsystemet-web, but is used by Mattilsynet\nimport \"@u-elements/u-progress\";\n\n// Expose API\nexport * from \"@digdir/designsystemet-web\"; // Import and expose Digdir web functionality\nexport * from \"@u-elements/u-combobox\"; // Kept for backward compatibility\nexport * from \"@u-elements/u-details\"; // Kept for backward compatibility\nexport { version } from \"../package.json\"; // Expose version to make it easier to debug\nexport * from \"./analytics/analytics\";\nexport * from \"./app/app-observer\";\nexport * from \"./law/law-helper\";\nexport * as styles from \"./styles.module.css\";\nexport * from \"./toast/toast-helper\";\n\n// Load behaviors\nimport \"./chart/chart-element\";\nimport \"./deprecations\";\nimport \"./logo/logo-observer\";\nimport \"./popover/popover-observer\";\nimport \"./table/table-observer\";\nimport \"./toast/toast-observer\";\nimport \"./tooltip/tooltip-element\";\nimport \"./validation/validation-observer\";\n\n// Expose types\nexport type Size = \"sm\" | \"md\" | \"lg\";\nexport type HeadingSize = \"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\n"],"mappings":""}
@@ -1,47 +1,33 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import a from "clsx";
3
- import { forwardRef as s } from "react";
4
- import i from "../styles.module.css.js";
5
- const l = s(function({ "data-indeterminate": t, className: e, type: r = "text", ...u }, p) {
6
- return /* @__PURE__ */ n(
7
- "input",
8
- {
9
- className: a(i.input, e),
10
- "data-indeterminate": !!t || void 0,
11
- suppressHydrationWarning: !0,
12
- type: r,
13
- ref: p,
14
- ...u
15
- }
16
- );
17
- }), x = s(
18
- function({ className: t, ...e }, r) {
19
- return /* @__PURE__ */ n(
20
- "select",
21
- {
22
- className: a(i.input, t),
23
- suppressHydrationWarning: !0,
24
- ref: r,
25
- ...e
26
- }
27
- );
28
- }
29
- ), y = s(
30
- function({ className: t, ...e }, r) {
31
- return /* @__PURE__ */ n(
32
- "textarea",
33
- {
34
- className: a(i.input, t),
35
- ref: r,
36
- suppressHydrationWarning: !0,
37
- ...e
38
- }
39
- );
40
- }
41
- );
42
- export {
43
- l as Input,
44
- x as Select,
45
- y as Textarea
46
- };
47
- //# sourceMappingURL=input.js.map
1
+ import e from "../styles.module.js";
2
+ import t from "clsx";
3
+ import { forwardRef as n } from "react";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ //#region designsystem/input/input.tsx
6
+ var i = n(function({ "data-indeterminate": n, className: i, type: a = "text", ...o }, s) {
7
+ return /* @__PURE__ */ r("input", {
8
+ className: t(e.input, i),
9
+ "data-indeterminate": !!n || void 0,
10
+ suppressHydrationWarning: !0,
11
+ type: a,
12
+ ref: s,
13
+ ...o
14
+ });
15
+ }), a = n(function({ className: n, ...i }, a) {
16
+ return /* @__PURE__ */ r("select", {
17
+ className: t(e.input, n),
18
+ suppressHydrationWarning: !0,
19
+ ref: a,
20
+ ...i
21
+ });
22
+ }), o = n(function({ className: n, ...i }, a) {
23
+ return /* @__PURE__ */ r("textarea", {
24
+ className: t(e.input, n),
25
+ ref: a,
26
+ suppressHydrationWarning: !0,
27
+ ...i
28
+ });
29
+ });
30
+ //#endregion
31
+ export { i as Input, a as Select, o as Textarea };
32
+
33
+ //# sourceMappingURL=input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","sources":["../../designsystem/input/input.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type InputProps = React.ComponentPropsWithoutRef<\"input\"> & {\n\t\"data-indeterminate\"?: boolean;\n};\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n\t{ \"data-indeterminate\": indeterminate, className, type = \"text\", ...rest },\n\tref,\n) {\n\treturn (\n\t\t<input\n\t\t\tclassName={clsx(styles.input, className)}\n\t\t\tdata-indeterminate={!!indeterminate || undefined} // Remove attribute if false\n\t\t\tsuppressHydrationWarning // Prevent hydration mismatch for SSR caused by field-observer.ts\n\t\t\ttype={type}\n\t\t\tref={ref}\n\t\t\t{...rest}\n\t\t/>\n\t);\n});\n\nexport type SelectProps = React.ComponentPropsWithoutRef<\"select\">;\nexport const Select = forwardRef<HTMLSelectElement, SelectProps>(\n\tfunction Select({ className, ...rest }, ref) {\n\t\treturn (\n\t\t\t<select\n\t\t\t\tclassName={clsx(styles.input, className)}\n\t\t\t\tsuppressHydrationWarning // Prevent hydration mismatch for SSR caused by field-observer.ts\n\t\t\t\tref={ref}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t);\n\t},\n);\n\nexport type TextareaProps = React.ComponentPropsWithoutRef<\"textarea\">;\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n\tfunction Textarea({ className, ...rest }, ref) {\n\t\treturn (\n\t\t\t<textarea\n\t\t\t\tclassName={clsx(styles.input, className)}\n\t\t\t\tref={ref}\n\t\t\t\tsuppressHydrationWarning // Prevent hydration mismatch for SSR caused by field-observer.ts\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t);\n\t},\n);\n"],"names":["Input","forwardRef","indeterminate","className","type","rest","ref","jsx","clsx","styles","Select","Textarea"],"mappings":";;;;AAOO,MAAMA,IAAQC,EAAyC,SAC7D,EAAE,sBAAsBC,GAAe,WAAAC,GAAW,MAAAC,IAAO,QAAQ,GAAGC,EAAA,GACpEC,GACC;AACD,SACC,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,WAAWC,EAAKC,EAAO,OAAON,CAAS;AAAA,MACvC,sBAAoB,CAAC,CAACD,KAAiB;AAAA,MACvC,0BAAwB;AAAA,MACxB,MAAAE;AAAA,MACA,KAAAE;AAAA,MACC,GAAGD;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC,GAGYK,IAAST;AAAA,EACrB,SAAgB,EAAE,WAAAE,GAAW,GAAGE,EAAA,GAAQC,GAAK;AAC5C,WACC,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,WAAWC,EAAKC,EAAO,OAAON,CAAS;AAAA,QACvC,0BAAwB;AAAA,QACxB,KAAAG;AAAA,QACC,GAAGD;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACD,GAGaM,IAAWV;AAAA,EACvB,SAAkB,EAAE,WAAAE,GAAW,GAAGE,EAAA,GAAQC,GAAK;AAC9C,WACC,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,WAAWC,EAAKC,EAAO,OAAON,CAAS;AAAA,QACvC,KAAAG;AAAA,QACA,0BAAwB;AAAA,QACvB,GAAGD;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACD;"}
1
+ {"version":3,"file":"input.js","names":[],"sources":["../../designsystem/input/input.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type InputProps = React.ComponentPropsWithoutRef<\"input\"> & {\n\t\"data-indeterminate\"?: boolean;\n};\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n\t{ \"data-indeterminate\": indeterminate, className, type = \"text\", ...rest },\n\tref,\n) {\n\treturn (\n\t\t<input\n\t\t\tclassName={clsx(styles.input, className)}\n\t\t\tdata-indeterminate={!!indeterminate || undefined} // Remove attribute if false\n\t\t\tsuppressHydrationWarning // Prevent hydration mismatch for SSR caused by field-observer.ts\n\t\t\ttype={type}\n\t\t\tref={ref}\n\t\t\t{...rest}\n\t\t/>\n\t);\n});\n\nexport type SelectProps = React.ComponentPropsWithoutRef<\"select\">;\nexport const Select = forwardRef<HTMLSelectElement, SelectProps>(\n\tfunction Select({ className, ...rest }, ref) {\n\t\treturn (\n\t\t\t<select\n\t\t\t\tclassName={clsx(styles.input, className)}\n\t\t\t\tsuppressHydrationWarning // Prevent hydration mismatch for SSR caused by field-observer.ts\n\t\t\t\tref={ref}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t);\n\t},\n);\n\nexport type TextareaProps = React.ComponentPropsWithoutRef<\"textarea\">;\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n\tfunction Textarea({ className, ...rest }, ref) {\n\t\treturn (\n\t\t\t<textarea\n\t\t\t\tclassName={clsx(styles.input, className)}\n\t\t\t\tref={ref}\n\t\t\t\tsuppressHydrationWarning // Prevent hydration mismatch for SSR caused by field-observer.ts\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t);\n\t},\n);\n"],"mappings":";;;;;AAOA,IAAa,IAAQ,EAAyC,SAC7D,EAAE,sBAAsB,GAAe,cAAW,UAAO,QAAQ,GAAG,KACpE,GACC;CACD,OACC,kBAAC,SAAD;EACC,WAAW,EAAK,EAAO,OAAO,CAAS;EACvC,sBAAoB,CAAC,CAAC,KAAiB,KAAA;EACvC,0BAAA;EACM;EACD;EACL,GAAI;CACJ,CAAA;AAEH,CAAC,GAGY,IAAS,EACrB,SAAgB,EAAE,cAAW,GAAG,KAAQ,GAAK;CAC5C,OACC,kBAAC,UAAD;EACC,WAAW,EAAK,EAAO,OAAO,CAAS;EACvC,0BAAA;EACK;EACL,GAAI;CACJ,CAAA;AAEH,CACD,GAGa,IAAW,EACvB,SAAkB,EAAE,cAAW,GAAG,KAAQ,GAAK;CAC9C,OACC,kBAAC,YAAD;EACC,WAAW,EAAK,EAAO,OAAO,CAAS;EAClC;EACL,0BAAA;EACA,GAAI;CACJ,CAAA;AAEH,CACD"}
@@ -1,96 +1,107 @@
1
- import { attr as g } from "../utils.js";
2
- const I = /<[^>]+\bid="([^"]+)[^>]+>/gi, _ = /\([^)]{1,4}\).{1,9}\d+\/\d+/i, A = /<(h\d|[^>]+role="heading")[^>]*>(.*?)<\/?(h\d|br|div)/i, v = /kapittel-\d+-ledd-\d+/, L = /<button[^>]+>.*?<\/button>/g, x = /►m\d+/i, p = /<[^>]+>/g, O = /<dt([^>]*class="([^"]+)")?[^>]*>(.*?)<\/dt><dd[^>]*>(.*?)<\/dd>/gis, k = /<(\/?)(article|footer|section)/gi, R = /(src|href)="([^"]+)"/gi, y = /(<li[^>]*)>\s*<div([^>]*>)|<\/div>(<\/li>)/gi, G = /(<li[^>]+data-name="([^"]+)[^>]+>)(\s*<(ul|ol|div)[^>]+>)/gis, m = /(<[^>]+class="[^"]*\bnumberedLegalP\b[^>]+>\s*)(\d+\.)(.*?)(?=<\/?(ul|ol|div)|$)/gis, $ = "https://lovdata.no/", T = "https://www.mattilsynet.no/regelveiledning/?regelverk=", X = {
3
- dokid: { label: "DokumentID", value: "" },
4
- legacyid: { label: "Datokode", value: "" },
5
- refid: { label: "RefID", value: "" },
6
- title: { label: "Tittel", value: "" },
7
- titleshort: { label: "Korttittel", value: "" },
8
- url: { label: "Url", value: "" }
9
- }, E = (n) => Array.from(
10
- Array.isArray(n) ? n : [n],
11
- (t) => t instanceof HTMLButtonElement ? t.value : t
12
- ), N = (n) => Array.from(
13
- n?.querySelectorAll('button[aria-checked="true"]') || [],
14
- (t) => t.value
15
- ), F = (n, t) => {
16
- const a = E(n);
17
- t?.querySelectorAll("button").forEach((e) => {
18
- a.includes(e.value) && g(e, "aria-checked", `${g(e, "aria-checked") !== "true"}`);
19
- });
20
- }, C = (n, t) => {
21
- const a = E(n);
22
- t?.querySelectorAll("button").forEach((e) => {
23
- g(e, "aria-checked", `${a.includes(e.value) || !1}`);
24
- });
25
- }, B = (n, t) => {
26
- const a = S(t);
27
- return E(n).map((e) => h(e, a)).filter((e) => !!e);
28
- }, M = (n) => {
29
- const t = n.slice(0, n.indexOf("</dl>")), a = { ...X };
30
- for (const e of t.matchAll(O)) {
31
- const l = e[2].replace(/-/g, "").toLowerCase();
32
- a[l] = { label: e[3], value: e[4] };
33
- }
34
- return a;
35
- }, S = (n) => n.includes("<main") ? (n.split(/<\/?main[^>]*>/)[1] || "").replace(k, "<$1div").replace(y, "$1$2$3").replace(R, (t, a, e) => `${a}="${e.includes(":") ? "" : $}${e}" ${a === "href" ? 'rel="noopener noreferrer" target="_blank"' : ""}`).replace(m, (t, a, e, l) => `${a}<span class="data-originalId">${e}</span><div class="legalP" id="${i("id", a)}-ledd-0">${l}</div>`).replace(G, (t, a, e, l) => `${a}<span class="data-originalId">${e}</span>${l}`).replace(I, (t, a, e, l) => {
36
- const r = b(t, a, e, l);
37
- return `${t}${r ? `<button type="button" role="checkbox" aria-label="${r}" value="${a}"></button>` : ""}`;
38
- }) : n, h = (n, t) => {
39
- const a = v.test(n), e = n.split("-").map(
40
- (s, o, f) => o % 2 ? U(f.slice(0, o + 1).join("-"), t, a) : null
41
- ).filter((s) => !!s);
42
- if (!e.length) return null;
43
- const l = e.filter(({ guideUrl: s }) => s).pop()?.guideUrl, r = e.filter(({ url: s }) => s).pop(), c = e.filter((s) => s.className === "section" && _.test(s.label)).pop(), d = r ? `${$}${r.url}` : "", u = e.slice(e.indexOf(c || e[0])).map(({ label: s }) => s).join(", ");
44
- return { ...e.slice(-1)[0], path: e, label: u, url: d, guideUrl: l };
45
- }, U = (n, t, a) => {
46
- const e = t.lastIndexOf("<", t.indexOf(` id="${n}"`)), l = t.slice(e, t.indexOf(">", e) + 1), r = i("class", l), c = i("data-lovdata-url", l), d = b(l, n, e, t), [u, s, o] = c.match(/(lov|forskrift)\/([^/]+)/) || [], f = `${s?.slice(0, 3).toUpperCase()}-${o}`;
47
- return {
48
- id: n,
49
- className: r,
50
- guideUrl: c && `${T}${f}_${n}`,
51
- // Recreate "chapterOrParagraphs" format stored in in mattilsynet.no Veiledning
52
- html: D(n, t),
53
- url: c,
54
- label: !a && r === "section" && d?.match(_)?.[0] || d
55
- };
56
- }, i = (n, t) => {
57
- const a = ` ${n.toLowerCase()}="`, e = t.toLowerCase().indexOf(a), l = e + a.length;
58
- return e === -1 ? "" : t.slice(l, t.indexOf('"', l));
59
- }, D = (n, t) => {
60
- const a = t.lastIndexOf("<", t.indexOf(` id="${n}"`)), e = t.length;
61
- let l = a + 1, r = 0;
62
- for (; l && l < e; )
63
- if (l = t.indexOf("<", l) + 1, t[l] !== "/") r++;
64
- else if (--r < 0) break;
65
- const c = t.indexOf(">", l) + 1;
66
- return l ? t.slice(a, c).replace(L, "") : "";
67
- }, b = (n, t, a, e) => w[i("class", n)]?.(n, t, a, e) || "", w = {
68
- numberedLegalP: (n) => `nr. ${i("data-numerator", n)}.`,
69
- section: (n, t, a, e) => e.slice(a).match(A)?.[2]?.replace(p, "")?.replace(x, "").trim() || "",
70
- legalArticle: (n, t, a, e) => {
71
- const l = e.indexOf(">", e.indexOf("legalArticleValue", a));
72
- return e.slice(l + 1, e.indexOf("</span>", l)).replace(p, "").replace("Artikkel", "artikkel");
73
- },
74
- legalP: (n, t) => {
75
- const [a, e, l, r] = t.split("-").reverse();
76
- return `avsnitt ${(e === "nummer" ? 1 : Number(a)) + (r === "nummer" ? 1 : 0)}`;
77
- },
78
- listArticle: (n, t, a, e) => {
79
- const l = t.split("-"), r = ` id="${l.slice(0, -2).join("-")}"`, c = e.lastIndexOf(r, a), d = e.slice(e.indexOf("<ol", c), a), u = i("data-name", n) || "-", s = i("type", d) || "-";
80
- let o = "punkt";
81
- return s === "1" && (o = "tall"), s === "a" && (o = "bokstav"), s === "i" && (o = "romtertall"), `${o} ${u === "-" ? l.pop() : u.replace(p, "")}`;
82
- },
83
- marginIdArticle: (n, t, a, e) => {
84
- const l = e.indexOf(">", e.indexOf("data-marginOriginalId", a));
85
- return `nr. ${e.slice(l + 1, e.indexOf("</span>", l)).replace(p, "")}`;
86
- }
1
+ import { attr as e } from "../utils.js";
2
+ //#region designsystem/law/law-helper.ts
3
+ var t = /<[^>]+\bid="([^"]+)[^>]+>/gi, n = /\([^)]{1,4}\).{1,9}\d+\/\d+/i, r = /<(h\d|[^>]+role="heading")[^>]*>(.*?)<\/?(h\d|br|div)/i, i = /kapittel-\d+-ledd-\d+/, a = /<button[^>]+>.*?<\/button>/g, o = /►m\d+/i, s = /<[^>]+>/g, c = /<dt([^>]*class="([^"]+)")?[^>]*>(.*?)<\/dt><dd[^>]*>(.*?)<\/dd>/gis, l = /<(\/?)(article|footer|section)/gi, u = /(src|href)="([^"]+)"/gi, d = /(<li[^>]*)>\s*<div([^>]*>)|<\/div>(<\/li>)/gi, f = /(<li[^>]+data-name="([^"]+)[^>]+>)(\s*<(ul|ol|div)[^>]+>)/gis, p = /(<[^>]+class="[^"]*\bnumberedLegalP\b[^>]+>\s*)(\d+\.)(.*?)(?=<\/?(ul|ol|div)|$)/gis, m = "https://lovdata.no/", h = "https://www.mattilsynet.no/regelveiledning/?regelverk=", g = {
4
+ dokid: {
5
+ label: "DokumentID",
6
+ value: ""
7
+ },
8
+ legacyid: {
9
+ label: "Datokode",
10
+ value: ""
11
+ },
12
+ refid: {
13
+ label: "RefID",
14
+ value: ""
15
+ },
16
+ title: {
17
+ label: "Tittel",
18
+ value: ""
19
+ },
20
+ titleshort: {
21
+ label: "Korttittel",
22
+ value: ""
23
+ },
24
+ url: {
25
+ label: "Url",
26
+ value: ""
27
+ }
28
+ }, _ = (e) => Array.from(Array.isArray(e) ? e : [e], (e) => e instanceof HTMLButtonElement ? e.value : e), v = (e) => Array.from(e?.querySelectorAll("button[aria-checked=\"true\"]") || [], (e) => e.value), y = (t, n) => {
29
+ let r = _(t);
30
+ n?.querySelectorAll("button").forEach((t) => {
31
+ r.includes(t.value) && e(t, "aria-checked", `${e(t, "aria-checked") !== "true"}`);
32
+ });
33
+ }, b = (t, n) => {
34
+ let r = _(t);
35
+ n?.querySelectorAll("button").forEach((t) => {
36
+ e(t, "aria-checked", `${r.includes(t.value) || !1}`);
37
+ });
38
+ }, x = (e, t) => {
39
+ let n = C(t);
40
+ return _(e).map((e) => w(e, n)).filter((e) => !!e);
41
+ }, S = (e) => {
42
+ let t = e.slice(0, e.indexOf("</dl>")), n = { ...g };
43
+ for (let e of t.matchAll(c)) {
44
+ let t = e[2].replace(/-/g, "").toLowerCase();
45
+ n[t] = {
46
+ label: e[3],
47
+ value: e[4]
48
+ };
49
+ }
50
+ return n;
51
+ }, C = (e) => e.includes("<main") ? (e.split(/<\/?main[^>]*>/)[1] || "").replace(l, "<$1div").replace(d, "$1$2$3").replace(u, (e, t, n) => `${t}="${n.includes(":") ? "" : m}${n}" ${t === "href" ? "rel=\"noopener noreferrer\" target=\"_blank\"" : ""}`).replace(p, (e, t, n, r) => `${t}<span class="data-originalId">${n}</span><div class="legalP" id="${E("id", t)}-ledd-0">${r}</div>`).replace(f, (e, t, n, r) => `${t}<span class="data-originalId">${n}</span>${r}`).replace(t, (e, t, n, r) => {
52
+ let i = O(e, t, n, r);
53
+ return `${e}${i ? `<button type="button" role="checkbox" aria-label="${i}" value="${t}"></button>` : ""}`;
54
+ }) : e, w = (e, t) => {
55
+ let r = i.test(e), a = e.split("-").map((e, n, i) => n % 2 ? T(i.slice(0, n + 1).join("-"), t, r) : null).filter((e) => !!e);
56
+ if (!a.length) return null;
57
+ let o = a.filter(({ guideUrl: e }) => e).pop()?.guideUrl, s = a.filter(({ url: e }) => e).pop(), c = a.filter((e) => e.className === "section" && n.test(e.label)).pop(), l = s ? `${m}${s.url}` : "", u = a.slice(a.indexOf(c || a[0])).map(({ label: e }) => e).join(", ");
58
+ return {
59
+ ...a.slice(-1)[0],
60
+ path: a,
61
+ label: u,
62
+ url: l,
63
+ guideUrl: o
64
+ };
65
+ }, T = (e, t, r) => {
66
+ let i = t.lastIndexOf("<", t.indexOf(` id="${e}"`)), a = t.slice(i, t.indexOf(">", i) + 1), o = E("class", a), s = E("data-lovdata-url", a), c = O(a, e, i, t), [l, u, d] = s.match(/(lov|forskrift)\/([^/]+)/) || [], f = `${u?.slice(0, 3).toUpperCase()}-${d}`;
67
+ return {
68
+ id: e,
69
+ className: o,
70
+ guideUrl: s && `${h}${f}_${e}`,
71
+ html: D(e, t),
72
+ url: s,
73
+ label: !r && o === "section" && c?.match(n)?.[0] || c
74
+ };
75
+ }, E = (e, t) => {
76
+ let n = ` ${e.toLowerCase()}="`, r = t.toLowerCase().indexOf(n), i = r + n.length;
77
+ return r === -1 ? "" : t.slice(i, t.indexOf("\"", i));
78
+ }, D = (e, t) => {
79
+ let n = t.lastIndexOf("<", t.indexOf(` id="${e}"`)), r = t.length, i = n + 1, o = 0;
80
+ for (; i && i < r;) if (i = t.indexOf("<", i) + 1, t[i] !== "/") o++;
81
+ else if (--o < 0) break;
82
+ let s = t.indexOf(">", i) + 1;
83
+ return i ? t.slice(n, s).replace(a, "") : "";
84
+ }, O = (e, t, n, r) => k[E("class", e)]?.(e, t, n, r) || "", k = {
85
+ numberedLegalP: (e) => `nr. ${E("data-numerator", e)}.`,
86
+ section: (e, t, n, i) => ((i.slice(n).match(r)?.[2])?.replace(s, ""))?.replace(o, "").trim() || "",
87
+ legalArticle: (e, t, n, r) => {
88
+ let i = r.indexOf(">", r.indexOf("legalArticleValue", n));
89
+ return r.slice(i + 1, r.indexOf("</span>", i)).replace(s, "").replace("Artikkel", "artikkel");
90
+ },
91
+ legalP: (e, t) => {
92
+ let [n, r, i, a] = t.split("-").reverse();
93
+ return `avsnitt ${(r === "nummer" ? 1 : Number(n)) + +(a === "nummer")}`;
94
+ },
95
+ listArticle: (e, t, n, r) => {
96
+ let i = t.split("-"), a = ` id="${i.slice(0, -2).join("-")}"`, o = r.lastIndexOf(a, n), c = r.slice(r.indexOf("<ol", o), n), l = E("data-name", e) || "-", u = E("type", c) || "-", d = "punkt";
97
+ return u === "1" && (d = "tall"), u === "a" && (d = "bokstav"), u === "i" && (d = "romtertall"), `${d} ${l === "-" ? i.pop() : l.replace(s, "")}`;
98
+ },
99
+ marginIdArticle: (e, t, n, r) => {
100
+ let i = r.indexOf(">", r.indexOf("data-marginOriginalId", n));
101
+ return `nr. ${r.slice(i + 1, r.indexOf("</span>", i)).replace(s, "")}`;
102
+ }
87
103
  };
88
- export {
89
- S as fixLawHtml,
90
- N as getLawChecked,
91
- B as parseLawIds,
92
- M as parseLawMeta,
93
- C as setLawChecked,
94
- F as toggleLawChecked
95
- };
96
- //# sourceMappingURL=law-helper.js.map
104
+ //#endregion
105
+ export { C as fixLawHtml, v as getLawChecked, x as parseLawIds, S as parseLawMeta, b as setLawChecked, y as toggleLawChecked };
106
+
107
+ //# sourceMappingURL=law-helper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"law-helper.js","sources":["../../designsystem/law/law-helper.ts"],"sourcesContent":["import { attr } from \"../utils\";\n\n// NOTE: The law format is documentet in https://api.lovdata.no/xmldocs\nconst REGEX_ID = /<[^>]+\\bid=\"([^\"]+)[^>]+>/gi;\nconst REGEX_FORORDNING = /\\([^)]{1,4}\\).{1,9}\\d+\\/\\d+/i; // Match (EU) 2016/2031, (EF) nr. 2020/1054, (EFF) ..., etc.\nconst REGEX_HEADING = /<(h\\d|[^>]+role=\"heading\")[^>]*>(.*?)<\\/?(h\\d|br|div)/i; // Can be both <h1>-<h6> and or <div> with role=\"heading\" if level 7+\nconst REGEX_KAPITTEL_LEDD = /kapittel-\\d+-ledd-\\d+/; // If ledd is direct child of kapittel, and not has a paragraph in between\nconst REGEX_STRIP_BUTTONS = /<button[^>]+>.*?<\\/button>/g;\nconst REGEX_STRIP_POINTER = /►m\\d+/i;\nconst REGEX_STRIP_TAGS = /<[^>]+>/g;\nconst REGEX_META =\n\t/<dt([^>]*class=\"([^\"]+)\")?[^>]*>(.*?)<\\/dt><dd[^>]*>(.*?)<\\/dd>/gis;\n\nconst REGEX_FIX_TAGS = /<(\\/?)(article|footer|section)/gi;\nconst REGEX_FIX_BASEURL = /(src|href)=\"([^\"]+)\"/gi;\nconst REGEX_FIX_LISTS = /(<li[^>]*)>\\s*<div([^>]*>)|<\\/div>(<\\/li>)/gi;\nconst REGEX_FIX_SPAN_ID =\n\t/(<li[^>]+data-name=\"([^\"]+)[^>]+>)(\\s*<(ul|ol|div)[^>]+>)/gis; // Only create span if no span exists\nconst REGEX_FIX_NUMBEREDLEGALP =\n\t/(<[^>]+class=\"[^\"]*\\bnumberedLegalP\\b[^>]+>\\s*)(\\d+\\.)(.*?)(?=<\\/?(ul|ol|div)|$)/gis;\n\nconst BASE_URL = \"https://lovdata.no/\";\nconst GUIDE_URL = \"https://www.mattilsynet.no/regelveiledning/?regelverk=\";\nconst META_DEFAULT: Record<\n\t\"legacyid\" | \"title\" | \"titleshort\" | \"url\" | (string & {}), // Ensure title and titleShort are always present\n\t{ label: string; value: string }\n> = {\n\tdokid: { label: \"DokumentID\", value: \"\" },\n\tlegacyid: { label: \"Datokode\", value: \"\" },\n\trefid: { label: \"RefID\", value: \"\" },\n\ttitle: { label: \"Tittel\", value: \"\" },\n\ttitleshort: { label: \"Korttittel\", value: \"\" },\n\turl: { label: \"Url\", value: \"\" },\n};\n\ntype Ids = string | string[] | HTMLButtonElement | HTMLButtonElement[];\nconst toIdArray = (ids: Ids): string[] =>\n\tArray.from(Array.isArray(ids) ? ids : [ids], (id) =>\n\t\tid instanceof HTMLButtonElement ? id.value : id,\n\t);\n\nexport const getLawChecked = (lawElement?: HTMLElement | null) =>\n\tArray.from(\n\t\tlawElement?.querySelectorAll(`button[aria-checked=\"true\"]`) || [],\n\t\t(btn) => (btn as HTMLButtonElement).value,\n\t);\n\nexport const toggleLawChecked = (ids: Ids, lawElement?: HTMLElement | null) => {\n\tconst idArray = toIdArray(ids);\n\tlawElement?.querySelectorAll(`button`).forEach((btn) => {\n\t\tif (idArray.includes(btn.value))\n\t\t\tattr(btn, \"aria-checked\", `${attr(btn, \"aria-checked\") !== \"true\"}`);\n\t});\n};\n\nexport const setLawChecked = (ids: Ids, lawElement?: HTMLElement | null) => {\n\tconst idArray = toIdArray(ids);\n\tlawElement?.querySelectorAll(\"button\").forEach((btn) => {\n\t\tattr(btn, \"aria-checked\", `${idArray.includes(btn.value) || false}`);\n\t});\n};\n\nexport const parseLawIds = (ids: string | string[], lawHtml: string) => {\n\tconst html = fixLawHtml(lawHtml);\n\treturn toIdArray(ids)\n\t\t.map((id) => parseLawId(id, html))\n\t\t.filter((unit) => !!unit);\n};\n\nexport const parseLawMeta = (lawHtml: string) => {\n\tconst html = lawHtml.slice(0, lawHtml.indexOf(\"</dl>\"));\n\tconst meta = { ...META_DEFAULT };\n\tfor (const m of html.matchAll(REGEX_META)) {\n\t\tconst key = m[2].replace(/-/g, \"\").toLowerCase();\n\t\tmeta[key] = { label: m[3], value: m[4] };\n\t}\n\treturn meta;\n};\n\nexport const fixLawHtml = (lawHtml: string) => {\n\tif (!lawHtml.includes(\"<main\")) return lawHtml; // Already rendered\n\treturn (lawHtml.split(/<\\/?main[^>]*>/)[1] || \"\") // Only need content in <main>\n\t\t.replace(REGEX_FIX_TAGS, \"<$1div\") // Better for accessibility, must run before other REGEX_FIX\n\t\t.replace(REGEX_FIX_LISTS, \"$1$2$3\") // Merge <li> with inner <div> to reduce unnecessary elements\n\t\t.replace(REGEX_FIX_BASEURL, (_, attr, url) => {\n\t\t\treturn `${attr}=\"${url.includes(\":\") ? \"\" : BASE_URL}${url}\" ${attr === \"href\" ? 'rel=\"noopener noreferrer\" target=\"_blank\"' : \"\"}`;\n\t\t})\n\t\t.replace(REGEX_FIX_NUMBEREDLEGALP, (_, tag, id, ledd) => {\n\t\t\treturn `${tag}<span class=\"data-originalId\">${id}</span><div class=\"legalP\" id=\"${getAttr(\"id\", tag)}-ledd-0\">${ledd}</div>`;\n\t\t})\n\t\t.replace(REGEX_FIX_SPAN_ID, (_, tag, id, child) => {\n\t\t\treturn `${tag}<span class=\"data-originalId\">${id}</span>${child}`;\n\t\t})\n\t\t.replace(REGEX_ID, (tag, id, idx, html) => {\n\t\t\tconst label = getLabel(tag, id, idx, html);\n\t\t\treturn `${tag}${label ? `<button type=\"button\" role=\"checkbox\" aria-label=\"${label}\" value=\"${id}\"></button>` : \"\"}`;\n\t\t});\n};\n\nconst parseLawId = (id: string, html: string) => {\n\tconst isKapitellLedd = REGEX_KAPITTEL_LEDD.test(id);\n\tconst path = id\n\t\t.split(\"-\")\n\t\t.map((_, i, all) =>\n\t\t\ti % 2\n\t\t\t\t? parseLawItem(all.slice(0, i + 1).join(\"-\"), html, isKapitellLedd)\n\t\t\t\t: null,\n\t\t)\n\t\t.filter((unit) => !!unit);\n\n\tif (!path.length) return null;\n\tconst guideUrl = path.filter(({ guideUrl }) => guideUrl).pop()?.guideUrl; // The closest units item might not have an guideUrl\n\tconst closestWithUrl = path.filter(({ url }) => url).pop(); // The closest units item might not have an URL, so we provide the last found URL\n\tconst closestForordning = path\n\t\t.filter((u) => u.className === \"section\" && REGEX_FORORDNING.test(u.label))\n\t\t.pop();\n\n\tconst url = closestWithUrl ? `${BASE_URL}${closestWithUrl.url}` : \"\";\n\tconst label = path\n\t\t.slice(path.indexOf(closestForordning || path[0]))\n\t\t.map(({ label }) => label)\n\t\t.join(\", \");\n\n\treturn { ...path.slice(-1)[0], path, label, url, guideUrl };\n};\n\nconst parseLawItem = (id: string, html: string, isKapitellLedd: boolean) => {\n\tconst idx = html.lastIndexOf(\"<\", html.indexOf(` id=\"${id}\"`));\n\tconst tag = html.slice(idx, html.indexOf(\">\", idx) + 1);\n\tconst className = getAttr(\"class\", tag);\n\tconst url = getAttr(\"data-lovdata-url\", tag);\n\tconst label = getLabel(tag, id, idx, html);\n\tconst [_, type, key] = url.match(/(lov|forskrift)\\/([^/]+)/) || [];\n\tconst legacyId = `${type?.slice(0, 3).toUpperCase()}-${key}`; // Recreate legacyId format from lovdata.no\n\n\treturn {\n\t\tid,\n\t\tclassName,\n\t\tguideUrl: url && `${GUIDE_URL}${legacyId}_${id}`, // Recreate \"chapterOrParagraphs\" format stored in in mattilsynet.no Veiledning\n\t\thtml: getOuterHTML(id, html),\n\t\turl,\n\t\tlabel:\n\t\t\t(!isKapitellLedd &&\n\t\t\t\tclassName === \"section\" &&\n\t\t\t\tlabel?.match(REGEX_FORORDNING)?.[0]) ||\n\t\t\tlabel,\n\t};\n};\n\nconst getAttr = (attr: string, html: string) => {\n\tconst query = ` ${attr.toLowerCase()}=\"`;\n\tconst idx = html.toLowerCase().indexOf(query); // Need to lowercase to sanitize html variations\n\tconst start = idx + query.length;\n\treturn idx === -1 ? \"\" : html.slice(start, html.indexOf('\"', start)); // Using slice for performance\n};\n\nconst getOuterHTML = (id: string, html: string) => {\n\tconst idx = html.lastIndexOf(\"<\", html.indexOf(` id=\"${id}\"`));\n\tconst max = html.length;\n\tlet i = idx + 1; // Using + 1 to get 0 if not found, and to ensure we start searching inside element\n\tlet depth = 0;\n\n\twhile (i && i < max) {\n\t\ti = html.indexOf(\"<\", i) + 1;\n\t\tif (html[i] !== \"/\") depth++;\n\t\telse if (--depth < 0) break;\n\t}\n\tconst end = html.indexOf(\">\", i) + 1;\n\treturn i ? html.slice(idx, end).replace(REGEX_STRIP_BUTTONS, \"\") : \"\";\n};\n\nconst getLabel = (tag: string, id: string, idx: number, html: string): string =>\n\tLABELS[getAttr(\"class\", tag)]?.(tag, id, idx, html) || \"\";\n\nconst LABELS: Record<string, typeof getLabel> = {\n\tnumberedLegalP: (tag) => `nr. ${getAttr(\"data-numerator\", tag)}.`,\n\tsection: (_tag, _id, idx, html) => {\n\t\tconst head = html.slice(idx).match(REGEX_HEADING)?.[2];\n\t\tconst clean = head?.replace(REGEX_STRIP_TAGS, \"\");\n\t\treturn clean?.replace(REGEX_STRIP_POINTER, \"\").trim() || \"\";\n\t},\n\tlegalArticle: (_tag, _id, idx, html) => {\n\t\tconst at = html.indexOf(\">\", html.indexOf(\"legalArticleValue\", idx));\n\t\tconst id = html.slice(at + 1, html.indexOf(\"</span>\", at)); // .legalArticleValue is always a <span>\n\t\treturn id.replace(REGEX_STRIP_TAGS, \"\").replace(\"Artikkel\", \"artikkel\");\n\t},\n\tlegalP: (_tag, id) => {\n\t\tconst [idx, type, _, parent] = id.split(\"-\").reverse(); // If placed inside numberedLegalP, parent is \"nummer\"\n\t\tconst count = type === \"nummer\" ? 1 : Number(idx); // If \"fake\" ledd 1 created by fixNumberedLegalP, type is \"number\"\n\t\treturn `avsnitt ${count + (parent === \"nummer\" ? 1 : 0)}`; // Adjust for numberedLegalP creating fake legalP starting at 1\n\t},\n\tlistArticle: (tag, id, idx, html) => {\n\t\tconst path = id.split(\"-\");\n\t\tconst parentTag = ` id=\"${path.slice(0, -2).join(\"-\")}\"`; // Since lists can be nested, we need to find parent law unit to get correct list\n\t\tconst parentIdx = html.lastIndexOf(parentTag, idx);\n\t\tconst list = html.slice(html.indexOf(\"<ol\", parentIdx), idx); // Find first <ol> after parent element opening tag\n\t\tconst name = getAttr(\"data-name\", tag) || \"-\"; // Name can be empty or dash so allways fallback to dash\n\t\tconst type = getAttr(\"type\", list) || \"-\";\n\n\t\tlet unit = \"punkt\";\n\t\tif (type === \"1\") unit = \"tall\";\n\t\tif (type === \"a\") unit = \"bokstav\";\n\t\tif (type === \"i\") unit = \"romtertall\";\n\t\treturn `${unit} ${name === \"-\" ? path.pop() : name.replace(REGEX_STRIP_TAGS, \"\")}`;\n\t},\n\tmarginIdArticle: (_tag, _id, idx, html) => {\n\t\tconst at = html.indexOf(\">\", html.indexOf(\"data-marginOriginalId\", idx));\n\t\tconst id = html.slice(at + 1, html.indexOf(\"</span>\", at));\n\t\treturn `nr. ${id.replace(REGEX_STRIP_TAGS, \"\")}`;\n\t},\n};\n"],"names":["REGEX_ID","REGEX_FORORDNING","REGEX_HEADING","REGEX_KAPITTEL_LEDD","REGEX_STRIP_BUTTONS","REGEX_STRIP_POINTER","REGEX_STRIP_TAGS","REGEX_META","REGEX_FIX_TAGS","REGEX_FIX_BASEURL","REGEX_FIX_LISTS","REGEX_FIX_SPAN_ID","REGEX_FIX_NUMBEREDLEGALP","BASE_URL","GUIDE_URL","META_DEFAULT","toIdArray","ids","id","getLawChecked","lawElement","btn","toggleLawChecked","idArray","attr","setLawChecked","parseLawIds","lawHtml","html","fixLawHtml","parseLawId","unit","parseLawMeta","meta","m","key","_","url","tag","ledd","getAttr","child","idx","label","getLabel","isKapitellLedd","path","i","all","parseLawItem","guideUrl","closestWithUrl","closestForordning","u","className","type","legacyId","getOuterHTML","query","start","max","depth","end","LABELS","_tag","_id","at","parent","parentTag","parentIdx","list","name"],"mappings":";AAGA,MAAMA,IAAW,+BACXC,IAAmB,gCACnBC,IAAgB,0DAChBC,IAAsB,yBACtBC,IAAsB,+BACtBC,IAAsB,UACtBC,IAAmB,YACnBC,IACL,sE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AAOyC,CAAS,GAAG3B,CAAG,GACrD6B,IAAO/B,EAAQ,aAAaF,CAAG,KAAK,KACpCiB,IAAOf,EAAQ,QAAQ8B,CAAI,KAAK;AAEtC,QAAIvC,IAAO;AACX,WAAIwB,MAAS,QAAKxB,IAAO,SACrBwB,MAAS,QAAKxB,IAAO,YACrBwB,MAAS,QAAKxB,IAAO,eAClB,GAAGA,CAAI,IAAIwC,MAAS,MAAMzB,EAAK,IAAA,IAAQyB,EAAK,QAAQjE,GAAkB,EAAE,CAAC;AAAA,EACjF;AAAA,EACA,iBAAiB,CAAC0D,GAAMC,GAAKvB,GAAKd,MAAS;AAC1C,UAAMsC,IAAKtC,EAAK,QAAQ,KAAKA,EAAK,QAAQ,yBAAyBc,CAAG,CAAC;AAEvE,WAAO,OADId,EAAK,MAAMsC,IAAK,GAAGtC,EAAK,QAAQ,WAAWsC,CAAE,CAAC,EACxC,QAAQ5D,GAAkB,EAAE,CAAC;AAAA,EAC/C;AACD;"}
1
+ {"version":3,"file":"law-helper.js","names":[],"sources":["../../designsystem/law/law-helper.ts"],"sourcesContent":["import { attr } from \"../utils\";\n\n// NOTE: The law format is documentet in https://api.lovdata.no/xmldocs\nconst REGEX_ID = /<[^>]+\\bid=\"([^\"]+)[^>]+>/gi;\nconst REGEX_FORORDNING = /\\([^)]{1,4}\\).{1,9}\\d+\\/\\d+/i; // Match (EU) 2016/2031, (EF) nr. 2020/1054, (EFF) ..., etc.\nconst REGEX_HEADING = /<(h\\d|[^>]+role=\"heading\")[^>]*>(.*?)<\\/?(h\\d|br|div)/i; // Can be both <h1>-<h6> and or <div> with role=\"heading\" if level 7+\nconst REGEX_KAPITTEL_LEDD = /kapittel-\\d+-ledd-\\d+/; // If ledd is direct child of kapittel, and not has a paragraph in between\nconst REGEX_STRIP_BUTTONS = /<button[^>]+>.*?<\\/button>/g;\nconst REGEX_STRIP_POINTER = /►m\\d+/i;\nconst REGEX_STRIP_TAGS = /<[^>]+>/g;\nconst REGEX_META =\n\t/<dt([^>]*class=\"([^\"]+)\")?[^>]*>(.*?)<\\/dt><dd[^>]*>(.*?)<\\/dd>/gis;\n\nconst REGEX_FIX_TAGS = /<(\\/?)(article|footer|section)/gi;\nconst REGEX_FIX_BASEURL = /(src|href)=\"([^\"]+)\"/gi;\nconst REGEX_FIX_LISTS = /(<li[^>]*)>\\s*<div([^>]*>)|<\\/div>(<\\/li>)/gi;\nconst REGEX_FIX_SPAN_ID =\n\t/(<li[^>]+data-name=\"([^\"]+)[^>]+>)(\\s*<(ul|ol|div)[^>]+>)/gis; // Only create span if no span exists\nconst REGEX_FIX_NUMBEREDLEGALP =\n\t/(<[^>]+class=\"[^\"]*\\bnumberedLegalP\\b[^>]+>\\s*)(\\d+\\.)(.*?)(?=<\\/?(ul|ol|div)|$)/gis;\n\nconst BASE_URL = \"https://lovdata.no/\";\nconst GUIDE_URL = \"https://www.mattilsynet.no/regelveiledning/?regelverk=\";\nconst META_DEFAULT: Record<\n\t\"legacyid\" | \"title\" | \"titleshort\" | \"url\" | (string & {}), // Ensure title and titleShort are always present\n\t{ label: string; value: string }\n> = {\n\tdokid: { label: \"DokumentID\", value: \"\" },\n\tlegacyid: { label: \"Datokode\", value: \"\" },\n\trefid: { label: \"RefID\", value: \"\" },\n\ttitle: { label: \"Tittel\", value: \"\" },\n\ttitleshort: { label: \"Korttittel\", value: \"\" },\n\turl: { label: \"Url\", value: \"\" },\n};\n\ntype Ids = string | string[] | HTMLButtonElement | HTMLButtonElement[];\nconst toIdArray = (ids: Ids): string[] =>\n\tArray.from(Array.isArray(ids) ? ids : [ids], (id) =>\n\t\tid instanceof HTMLButtonElement ? id.value : id,\n\t);\n\nexport const getLawChecked = (lawElement?: HTMLElement | null) =>\n\tArray.from(\n\t\tlawElement?.querySelectorAll(`button[aria-checked=\"true\"]`) || [],\n\t\t(btn) => (btn as HTMLButtonElement).value,\n\t);\n\nexport const toggleLawChecked = (ids: Ids, lawElement?: HTMLElement | null) => {\n\tconst idArray = toIdArray(ids);\n\tlawElement?.querySelectorAll(`button`).forEach((btn) => {\n\t\tif (idArray.includes(btn.value))\n\t\t\tattr(btn, \"aria-checked\", `${attr(btn, \"aria-checked\") !== \"true\"}`);\n\t});\n};\n\nexport const setLawChecked = (ids: Ids, lawElement?: HTMLElement | null) => {\n\tconst idArray = toIdArray(ids);\n\tlawElement?.querySelectorAll(\"button\").forEach((btn) => {\n\t\tattr(btn, \"aria-checked\", `${idArray.includes(btn.value) || false}`);\n\t});\n};\n\nexport const parseLawIds = (ids: string | string[], lawHtml: string) => {\n\tconst html = fixLawHtml(lawHtml);\n\treturn toIdArray(ids)\n\t\t.map((id) => parseLawId(id, html))\n\t\t.filter((unit) => !!unit);\n};\n\nexport const parseLawMeta = (lawHtml: string) => {\n\tconst html = lawHtml.slice(0, lawHtml.indexOf(\"</dl>\"));\n\tconst meta = { ...META_DEFAULT };\n\tfor (const m of html.matchAll(REGEX_META)) {\n\t\tconst key = m[2].replace(/-/g, \"\").toLowerCase();\n\t\tmeta[key] = { label: m[3], value: m[4] };\n\t}\n\treturn meta;\n};\n\nexport const fixLawHtml = (lawHtml: string) => {\n\tif (!lawHtml.includes(\"<main\")) return lawHtml; // Already rendered\n\treturn (lawHtml.split(/<\\/?main[^>]*>/)[1] || \"\") // Only need content in <main>\n\t\t.replace(REGEX_FIX_TAGS, \"<$1div\") // Better for accessibility, must run before other REGEX_FIX\n\t\t.replace(REGEX_FIX_LISTS, \"$1$2$3\") // Merge <li> with inner <div> to reduce unnecessary elements\n\t\t.replace(REGEX_FIX_BASEURL, (_, attr, url) => {\n\t\t\treturn `${attr}=\"${url.includes(\":\") ? \"\" : BASE_URL}${url}\" ${attr === \"href\" ? 'rel=\"noopener noreferrer\" target=\"_blank\"' : \"\"}`;\n\t\t})\n\t\t.replace(REGEX_FIX_NUMBEREDLEGALP, (_, tag, id, ledd) => {\n\t\t\treturn `${tag}<span class=\"data-originalId\">${id}</span><div class=\"legalP\" id=\"${getAttr(\"id\", tag)}-ledd-0\">${ledd}</div>`;\n\t\t})\n\t\t.replace(REGEX_FIX_SPAN_ID, (_, tag, id, child) => {\n\t\t\treturn `${tag}<span class=\"data-originalId\">${id}</span>${child}`;\n\t\t})\n\t\t.replace(REGEX_ID, (tag, id, idx, html) => {\n\t\t\tconst label = getLabel(tag, id, idx, html);\n\t\t\treturn `${tag}${label ? `<button type=\"button\" role=\"checkbox\" aria-label=\"${label}\" value=\"${id}\"></button>` : \"\"}`;\n\t\t});\n};\n\nconst parseLawId = (id: string, html: string) => {\n\tconst isKapitellLedd = REGEX_KAPITTEL_LEDD.test(id);\n\tconst path = id\n\t\t.split(\"-\")\n\t\t.map((_, i, all) =>\n\t\t\ti % 2\n\t\t\t\t? parseLawItem(all.slice(0, i + 1).join(\"-\"), html, isKapitellLedd)\n\t\t\t\t: null,\n\t\t)\n\t\t.filter((unit) => !!unit);\n\n\tif (!path.length) return null;\n\tconst guideUrl = path.filter(({ guideUrl }) => guideUrl).pop()?.guideUrl; // The closest units item might not have an guideUrl\n\tconst closestWithUrl = path.filter(({ url }) => url).pop(); // The closest units item might not have an URL, so we provide the last found URL\n\tconst closestForordning = path\n\t\t.filter((u) => u.className === \"section\" && REGEX_FORORDNING.test(u.label))\n\t\t.pop();\n\n\tconst url = closestWithUrl ? `${BASE_URL}${closestWithUrl.url}` : \"\";\n\tconst label = path\n\t\t.slice(path.indexOf(closestForordning || path[0]))\n\t\t.map(({ label }) => label)\n\t\t.join(\", \");\n\n\treturn { ...path.slice(-1)[0], path, label, url, guideUrl };\n};\n\nconst parseLawItem = (id: string, html: string, isKapitellLedd: boolean) => {\n\tconst idx = html.lastIndexOf(\"<\", html.indexOf(` id=\"${id}\"`));\n\tconst tag = html.slice(idx, html.indexOf(\">\", idx) + 1);\n\tconst className = getAttr(\"class\", tag);\n\tconst url = getAttr(\"data-lovdata-url\", tag);\n\tconst label = getLabel(tag, id, idx, html);\n\tconst [_, type, key] = url.match(/(lov|forskrift)\\/([^/]+)/) || [];\n\tconst legacyId = `${type?.slice(0, 3).toUpperCase()}-${key}`; // Recreate legacyId format from lovdata.no\n\n\treturn {\n\t\tid,\n\t\tclassName,\n\t\tguideUrl: url && `${GUIDE_URL}${legacyId}_${id}`, // Recreate \"chapterOrParagraphs\" format stored in in mattilsynet.no Veiledning\n\t\thtml: getOuterHTML(id, html),\n\t\turl,\n\t\tlabel:\n\t\t\t(!isKapitellLedd &&\n\t\t\t\tclassName === \"section\" &&\n\t\t\t\tlabel?.match(REGEX_FORORDNING)?.[0]) ||\n\t\t\tlabel,\n\t};\n};\n\nconst getAttr = (attr: string, html: string) => {\n\tconst query = ` ${attr.toLowerCase()}=\"`;\n\tconst idx = html.toLowerCase().indexOf(query); // Need to lowercase to sanitize html variations\n\tconst start = idx + query.length;\n\treturn idx === -1 ? \"\" : html.slice(start, html.indexOf('\"', start)); // Using slice for performance\n};\n\nconst getOuterHTML = (id: string, html: string) => {\n\tconst idx = html.lastIndexOf(\"<\", html.indexOf(` id=\"${id}\"`));\n\tconst max = html.length;\n\tlet i = idx + 1; // Using + 1 to get 0 if not found, and to ensure we start searching inside element\n\tlet depth = 0;\n\n\twhile (i && i < max) {\n\t\ti = html.indexOf(\"<\", i) + 1;\n\t\tif (html[i] !== \"/\") depth++;\n\t\telse if (--depth < 0) break;\n\t}\n\tconst end = html.indexOf(\">\", i) + 1;\n\treturn i ? html.slice(idx, end).replace(REGEX_STRIP_BUTTONS, \"\") : \"\";\n};\n\nconst getLabel = (tag: string, id: string, idx: number, html: string): string =>\n\tLABELS[getAttr(\"class\", tag)]?.(tag, id, idx, html) || \"\";\n\nconst LABELS: Record<string, typeof getLabel> = {\n\tnumberedLegalP: (tag) => `nr. ${getAttr(\"data-numerator\", tag)}.`,\n\tsection: (_tag, _id, idx, html) => {\n\t\tconst head = html.slice(idx).match(REGEX_HEADING)?.[2];\n\t\tconst clean = head?.replace(REGEX_STRIP_TAGS, \"\");\n\t\treturn clean?.replace(REGEX_STRIP_POINTER, \"\").trim() || \"\";\n\t},\n\tlegalArticle: (_tag, _id, idx, html) => {\n\t\tconst at = html.indexOf(\">\", html.indexOf(\"legalArticleValue\", idx));\n\t\tconst id = html.slice(at + 1, html.indexOf(\"</span>\", at)); // .legalArticleValue is always a <span>\n\t\treturn id.replace(REGEX_STRIP_TAGS, \"\").replace(\"Artikkel\", \"artikkel\");\n\t},\n\tlegalP: (_tag, id) => {\n\t\tconst [idx, type, _, parent] = id.split(\"-\").reverse(); // If placed inside numberedLegalP, parent is \"nummer\"\n\t\tconst count = type === \"nummer\" ? 1 : Number(idx); // If \"fake\" ledd 1 created by fixNumberedLegalP, type is \"number\"\n\t\treturn `avsnitt ${count + (parent === \"nummer\" ? 1 : 0)}`; // Adjust for numberedLegalP creating fake legalP starting at 1\n\t},\n\tlistArticle: (tag, id, idx, html) => {\n\t\tconst path = id.split(\"-\");\n\t\tconst parentTag = ` id=\"${path.slice(0, -2).join(\"-\")}\"`; // Since lists can be nested, we need to find parent law unit to get correct list\n\t\tconst parentIdx = html.lastIndexOf(parentTag, idx);\n\t\tconst list = html.slice(html.indexOf(\"<ol\", parentIdx), idx); // Find first <ol> after parent element opening tag\n\t\tconst name = getAttr(\"data-name\", tag) || \"-\"; // Name can be empty or dash so allways fallback to dash\n\t\tconst type = getAttr(\"type\", list) || \"-\";\n\n\t\tlet unit = \"punkt\";\n\t\tif (type === \"1\") unit = \"tall\";\n\t\tif (type === \"a\") unit = \"bokstav\";\n\t\tif (type === \"i\") unit = \"romtertall\";\n\t\treturn `${unit} ${name === \"-\" ? path.pop() : name.replace(REGEX_STRIP_TAGS, \"\")}`;\n\t},\n\tmarginIdArticle: (_tag, _id, idx, html) => {\n\t\tconst at = html.indexOf(\">\", html.indexOf(\"data-marginOriginalId\", idx));\n\t\tconst id = html.slice(at + 1, html.indexOf(\"</span>\", at));\n\t\treturn `nr. ${id.replace(REGEX_STRIP_TAGS, \"\")}`;\n\t},\n};\n"],"mappings":";;AAGA,IAAM,IAAW,+BACX,IAAmB,gCACnB,IAAgB,0D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E;CACA,SAAS,GAAM,MAAO;EACrB,IAAM,CAAC,GAAK,GAAM,GAAG,KAAU,EAAG,MAAM,GAAG,CAAC,CAAC,QAAQ;EAErD,OAAO,YADO,MAAS,WAAW,IAAI,OAAO,CAAG,KACrB,QAAW;CACvC;CACA,cAAc,GAAK,GAAI,GAAK,MAAS;EACpC,IAAM,IAAO,EAAG,MAAM,GAAG,GACnB,IAAY,QAAQ,EAAK,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK,GAAG,EAAE,IAChD,IAAY,EAAK,YAAY,GAAW,CAAG,GAC3C,IAAO,EAAK,MAAM,EAAK,QAAQ,OAAO,CAAS,GAAG,CAAG,GACrD,IAAO,EAAQ,aAAa,CAAG,KAAK,KACpC,IAAO,EAAQ,QAAQ,CAAI,KAAK,KAElC,IAAO;EAIX,OAHI,MAAS,QAAK,IAAO,SACrB,MAAS,QAAK,IAAO,YACrB,MAAS,QAAK,IAAO,eAClB,GAAG,EAAK,GAAG,MAAS,MAAM,EAAK,IAAI,IAAI,EAAK,QAAQ,GAAkB,EAAE;CAChF;CACA,kBAAkB,GAAM,GAAK,GAAK,MAAS;EAC1C,IAAM,IAAK,EAAK,QAAQ,KAAK,EAAK,QAAQ,yBAAyB,CAAG,CAAC;EAEvE,OAAO,OADI,EAAK,MAAM,IAAK,GAAG,EAAK,QAAQ,WAAW,CAAE,CAC1C,CAAA,CAAG,QAAQ,GAAkB,EAAE;CAC9C;AACD"}
package/mtds/law/law.js CHANGED
@@ -1,11 +1,16 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import f from "clsx";
3
- import { forwardRef as s } from "react";
4
- import a from "../styles.module.css.js";
5
- const n = s(function({ className: r, ...o }, m) {
6
- return /* @__PURE__ */ t("div", { className: f(a.law, r), ref: m, ...o });
1
+ import e from "../styles.module.js";
2
+ import t from "clsx";
3
+ import { forwardRef as n } from "react";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ //#region designsystem/law/law.tsx
6
+ var i = n(function({ className: n, ...i }, a) {
7
+ return /* @__PURE__ */ r("div", {
8
+ className: t(e.law, n),
9
+ ref: a,
10
+ ...i
11
+ });
7
12
  });
8
- export {
9
- n as Law
10
- };
11
- //# sourceMappingURL=law.js.map
13
+ //#endregion
14
+ export { i as Law };
15
+
16
+ //# sourceMappingURL=law.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"law.js","sources":["../../designsystem/law/law.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type LawProps = React.ComponentPropsWithoutRef<\"div\"> & {\n\t\"data-variant\"?: \"view\" | \"readonly\";\n};\n\nexport const Law = forwardRef<HTMLDivElement, LawProps>(function Law(\n\t{ className, ...rest },\n\tref,\n) {\n\treturn <div className={clsx(styles.law, className)} ref={ref} {...rest} />;\n});\n"],"names":["Law","forwardRef","className","rest","ref","jsx","clsx","styles"],"mappings":";;;;AAQO,MAAMA,IAAMC,EAAqC,SACvD,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAChBC,GACC;AACD,SAAO,gBAAAC,EAAC,OAAA,EAAI,WAAWC,EAAKC,EAAO,KAAKL,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAA,CAAM;AACzE,CAAC;"}
1
+ {"version":3,"file":"law.js","names":[],"sources":["../../designsystem/law/law.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\nimport styles from \"../styles.module.css\";\n\nexport type LawProps = React.ComponentPropsWithoutRef<\"div\"> & {\n\t\"data-variant\"?: \"view\" | \"readonly\";\n};\n\nexport const Law = forwardRef<HTMLDivElement, LawProps>(function Law(\n\t{ className, ...rest },\n\tref,\n) {\n\treturn <div className={clsx(styles.law, className)} ref={ref} {...rest} />;\n});\n"],"mappings":";;;;;AAQA,IAAa,IAAM,EAAqC,SACvD,EAAE,cAAW,GAAG,KAChB,GACC;CACD,OAAO,kBAAC,OAAD;EAAK,WAAW,EAAK,EAAO,KAAK,CAAS;EAAQ;EAAK,GAAI;CAAO,CAAA;AAC1E,CAAC"}
@@ -1,14 +1,22 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import e from "clsx";
3
- import { forwardRef as m } from "react";
4
- import n from "../styles.module.css.js";
5
- const g = m(function({ as: r, className: o, ...t }, s) {
6
- return /* @__PURE__ */ i(r || "div", { className: e(n.flex, o), ref: s, ...t });
7
- }), p = m(function({ as: r, className: o, ...t }, s) {
8
- return /* @__PURE__ */ i(r || "div", { className: e(n.grid, o), ref: s, ...t });
1
+ import e from "../styles.module.js";
2
+ import t from "clsx";
3
+ import { forwardRef as n } from "react";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ //#region designsystem/layout/layout.tsx
6
+ var i = n(function({ as: n, className: i, ...a }, o) {
7
+ return /* @__PURE__ */ r(n || "div", {
8
+ className: t(e.flex, i),
9
+ ref: o,
10
+ ...a
11
+ });
12
+ }), a = n(function({ as: n, className: i, ...a }, o) {
13
+ return /* @__PURE__ */ r(n || "div", {
14
+ className: t(e.grid, i),
15
+ ref: o,
16
+ ...a
17
+ });
9
18
  });
10
- export {
11
- g as Flex,
12
- p as Grid
13
- };
14
- //# sourceMappingURL=layout.js.map
19
+ //#endregion
20
+ export { i as Flex, a as Grid };
21
+
22
+ //# sourceMappingURL=layout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.js","sources":["../../designsystem/layout/layout.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n\tSizes,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\ntype GapOld = \"none\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\ntype SharedProps = {\n\t\"data-align\"?: \"normal\" | \"stretch\" | \"start\" | \"center\" | \"end\";\n\t\"data-align-content\"?:\n\t\t| \"start\"\n\t\t| \"center\"\n\t\t| \"end\"\n\t\t| \"space-between\"\n\t\t| \"space-around\"\n\t\t| \"space-evenly\";\n\t\"data-center\"?: \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\n\t\"data-gap\"?: Sizes | GapOld;\n\t\"data-row-gap\"?: Sizes;\n\t\"data-column-gap\"?: Sizes;\n\t\"data-nowrap\"?: boolean;\n\t\"data-justify\"?:\n\t\t| \"start\"\n\t\t| \"center\"\n\t\t| \"end\"\n\t\t| \"space-between\"\n\t\t| \"space-around\"\n\t\t| \"space-evenly\";\n\t\"data-fixed\"?: boolean;\n\t\"data-items\"?:\n\t\t| \"auto\"\n\t\t| \"full\"\n\t\t| \"25\"\n\t\t| \"50\"\n\t\t| \"75\"\n\t\t| \"100\"\n\t\t| \"125\"\n\t\t| \"150\"\n\t\t| \"175\"\n\t\t| \"200\"\n\t\t| \"225\"\n\t\t| \"250\"\n\t\t| \"275\"\n\t\t| \"300\"\n\t\t| \"325\"\n\t\t| \"350\"\n\t\t| \"375\"\n\t\t| \"400\"\n\t\t| \"425\"\n\t\t| \"450\"\n\t\t| \"475\"\n\t\t| \"500\"\n\t\t| \"525\"\n\t\t| \"550\"\n\t\t| \"575\"\n\t\t| \"600\"\n\t\t| 25\n\t\t| 50\n\t\t| 75\n\t\t| 100\n\t\t| 125\n\t\t| 150\n\t\t| 175\n\t\t| 200\n\t\t| 225\n\t\t| 250\n\t\t| 275\n\t\t| 300\n\t\t| 325\n\t\t| 350\n\t\t| 375\n\t\t| 400\n\t\t| 425\n\t\t| 450\n\t\t| 475\n\t\t| 500\n\t\t| 525\n\t\t| 550\n\t\t| 575\n\t\t| 600;\n};\n\n/**\n * Flex\n */\nexport type FlexProps<As extends React.ElementType = \"div\"> =\n\tPolymorphicComponentPropWithRef<As, SharedProps>;\n\ntype FlexComponent = <As extends React.ElementType = \"div\">(\n\tprops: FlexProps<As>,\n) => JSX.Element;\n\nexport const Flex: FlexComponent = forwardRef<null>(function Flex<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: FlexProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn <Tag className={clsx(styles.flex, className)} ref={ref} {...rest} />;\n}) as FlexComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\n/**\n * Grid\n */\nexport type GridProps<As extends React.ElementType = \"div\"> =\n\tPolymorphicComponentPropWithRef<As, SharedProps>;\n\ntype GridComponent = <As extends React.ElementType = \"div\">(\n\tprops: GridProps<As>,\n) => JSX.Element;\n\nexport const Grid: GridComponent = forwardRef<null>(function Grid<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: GridProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn <Tag className={clsx(styles.grid, className)} ref={ref} {...rest} />;\n}) as GridComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"names":["Flex","forwardRef","as","className","rest","ref","jsx","clsx","styles","Grid"],"mappings":";;;;AAgGO,MAAMA,IAAsBC,EAAiB,SAElD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAA,GAAuBC,GAA0B;AAGtE,SAAO,gBAAAC,EAFKJ,KAAM,OAEV,EAAI,WAAWK,EAAKC,EAAO,MAAML,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAA,CAAM;AAC1E,CAAC,GAYYK,IAAsBR,EAAiB,SAElD,EAAE,IAAAC,GAAI,WAAAC,GAAW,GAAGC,EAAA,GAAuBC,GAA0B;AAGtE,SAAO,gBAAAC,EAFKJ,KAAM,OAEV,EAAI,WAAWK,EAAKC,EAAO,MAAML,CAAS,GAAG,KAAAE,GAAW,GAAGD,EAAA,CAAM;AAC1E,CAAC;"}
1
+ {"version":3,"file":"layout.js","names":[],"sources":["../../designsystem/layout/layout.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, type JSX } from \"react\";\nimport type {\n\tPolymorphicComponentPropWithRef,\n\tPolymorphicRef,\n\tSizes,\n} from \"../react-types\";\nimport styles from \"../styles.module.css\";\n\ntype GapOld = \"none\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\ntype SharedProps = {\n\t\"data-align\"?: \"normal\" | \"stretch\" | \"start\" | \"center\" | \"end\";\n\t\"data-align-content\"?:\n\t\t| \"start\"\n\t\t| \"center\"\n\t\t| \"end\"\n\t\t| \"space-between\"\n\t\t| \"space-around\"\n\t\t| \"space-evenly\";\n\t\"data-center\"?: \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\n\t\"data-gap\"?: Sizes | GapOld;\n\t\"data-row-gap\"?: Sizes;\n\t\"data-column-gap\"?: Sizes;\n\t\"data-nowrap\"?: boolean;\n\t\"data-justify\"?:\n\t\t| \"start\"\n\t\t| \"center\"\n\t\t| \"end\"\n\t\t| \"space-between\"\n\t\t| \"space-around\"\n\t\t| \"space-evenly\";\n\t\"data-fixed\"?: boolean;\n\t\"data-items\"?:\n\t\t| \"auto\"\n\t\t| \"full\"\n\t\t| \"25\"\n\t\t| \"50\"\n\t\t| \"75\"\n\t\t| \"100\"\n\t\t| \"125\"\n\t\t| \"150\"\n\t\t| \"175\"\n\t\t| \"200\"\n\t\t| \"225\"\n\t\t| \"250\"\n\t\t| \"275\"\n\t\t| \"300\"\n\t\t| \"325\"\n\t\t| \"350\"\n\t\t| \"375\"\n\t\t| \"400\"\n\t\t| \"425\"\n\t\t| \"450\"\n\t\t| \"475\"\n\t\t| \"500\"\n\t\t| \"525\"\n\t\t| \"550\"\n\t\t| \"575\"\n\t\t| \"600\"\n\t\t| 25\n\t\t| 50\n\t\t| 75\n\t\t| 100\n\t\t| 125\n\t\t| 150\n\t\t| 175\n\t\t| 200\n\t\t| 225\n\t\t| 250\n\t\t| 275\n\t\t| 300\n\t\t| 325\n\t\t| 350\n\t\t| 375\n\t\t| 400\n\t\t| 425\n\t\t| 450\n\t\t| 475\n\t\t| 500\n\t\t| 525\n\t\t| 550\n\t\t| 575\n\t\t| 600;\n};\n\n/**\n * Flex\n */\nexport type FlexProps<As extends React.ElementType = \"div\"> =\n\tPolymorphicComponentPropWithRef<As, SharedProps>;\n\ntype FlexComponent = <As extends React.ElementType = \"div\">(\n\tprops: FlexProps<As>,\n) => JSX.Element;\n\nexport const Flex: FlexComponent = forwardRef<null>(function Flex<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: FlexProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn <Tag className={clsx(styles.flex, className)} ref={ref} {...rest} />;\n}) as FlexComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n\n/**\n * Grid\n */\nexport type GridProps<As extends React.ElementType = \"div\"> =\n\tPolymorphicComponentPropWithRef<As, SharedProps>;\n\ntype GridComponent = <As extends React.ElementType = \"div\">(\n\tprops: GridProps<As>,\n) => JSX.Element;\n\nexport const Grid: GridComponent = forwardRef<null>(function Grid<\n\tAs extends React.ElementType = \"div\",\n>({ as, className, ...rest }: GridProps<As>, ref?: PolymorphicRef<As>) {\n\tconst Tag = as || \"div\";\n\n\treturn <Tag className={clsx(styles.grid, className)} ref={ref} {...rest} />;\n}) as GridComponent; // Needed to tell Typescript this does not return ReactNode but acutally JSX.Element\n"],"mappings":";;;;;AAgGA,IAAa,IAAsB,EAAiB,SAElD,EAAE,OAAI,cAAW,GAAG,KAAuB,GAA0B;CAGtE,OAAO,kBAFK,KAAM,OAEX;EAAK,WAAW,EAAK,EAAO,MAAM,CAAS;EAAQ;EAAK,GAAI;CAAO,CAAA;AAC3E,CAAC,GAYY,IAAsB,EAAiB,SAElD,EAAE,OAAI,cAAW,GAAG,KAAuB,GAA0B;CAGtE,OAAO,kBAFK,KAAM,OAEX;EAAK,WAAW,EAAK,EAAO,MAAM,CAAS;EAAQ;EAAK,GAAI;CAAO,CAAA;AAC3E,CAAC"}
@@ -20,3 +20,4 @@ export declare const ItemFixed: Story;
20
20
  export declare const Align: Story;
21
21
  export declare const Justify: Story;
22
22
  export declare const AlignContent: Story;
23
+ export declare const BreakCard: Story;