@mittwald/flow-react-components 1.7.0-next.3 → 1.7.0-next.5

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 (54) hide show
  1. package/AGENTS.md +6 -7
  2. package/MIGRATION.md +56 -0
  3. package/dist/assets/component-index.json +1 -1
  4. package/dist/assets/doc-properties.json +1 -1
  5. package/dist/js/packages/components/src/components/AvatarStack/AvatarStack.mjs +5 -3
  6. package/dist/js/packages/components/src/components/AvatarStack/AvatarStack.mjs.map +1 -1
  7. package/dist/js/packages/components/src/components/Breadcrumb/Breadcrumb.mjs +5 -3
  8. package/dist/js/packages/components/src/components/Breadcrumb/Breadcrumb.mjs.map +1 -1
  9. package/dist/js/packages/components/src/components/CodeBlock/CodeBlock.mjs +6 -3
  10. package/dist/js/packages/components/src/components/CodeBlock/CodeBlock.mjs.map +1 -1
  11. package/dist/js/packages/components/src/components/DonutChart/DonutChart.mjs +5 -3
  12. package/dist/js/packages/components/src/components/DonutChart/DonutChart.mjs.map +1 -1
  13. package/dist/js/packages/components/src/components/Flex/Flex.mjs.map +1 -1
  14. package/dist/js/packages/components/src/components/HeaderNavigation/HeaderNavigation.mjs +5 -3
  15. package/dist/js/packages/components/src/components/HeaderNavigation/HeaderNavigation.mjs.map +1 -1
  16. package/dist/js/packages/components/src/components/ImageCropper/ImageCropper.mjs +5 -3
  17. package/dist/js/packages/components/src/components/ImageCropper/ImageCropper.mjs.map +1 -1
  18. package/dist/js/packages/components/src/components/Legend/Legend.mjs +5 -3
  19. package/dist/js/packages/components/src/components/Legend/Legend.mjs.map +1 -1
  20. package/dist/js/packages/components/src/components/List/model/item/ItemView.mjs.map +1 -1
  21. package/dist/js/packages/components/src/components/Markdown/Markdown.mjs +3 -2
  22. package/dist/js/packages/components/src/components/Markdown/Markdown.mjs.map +1 -1
  23. package/dist/js/packages/components/src/components/OverlayTrigger/components/DialogTrigger/DialogTrigger.mjs +1 -4
  24. package/dist/js/packages/components/src/components/OverlayTrigger/components/DialogTrigger/DialogTrigger.mjs.map +1 -1
  25. package/dist/js/packages/components/src/components/Section/context.mjs +13 -2
  26. package/dist/js/packages/components/src/components/Section/context.mjs.map +1 -1
  27. package/dist/js/packages/components/src/components/SkeletonText/SkeletonText.mjs +6 -4
  28. package/dist/js/packages/components/src/components/SkeletonText/SkeletonText.mjs.map +1 -1
  29. package/dist/js/packages/components/src/components/Table/Table.mjs +5 -3
  30. package/dist/js/packages/components/src/components/Table/Table.mjs.map +1 -1
  31. package/dist/js/packages/components/src/components/Table/components/TableBody/TableBody.mjs.map +1 -1
  32. package/dist/js/packages/components/src/components/Table/components/TableCell/TableCell.mjs.map +1 -1
  33. package/dist/js/packages/components/src/components/Table/components/TableColumn/TableColumn.mjs.map +1 -1
  34. package/dist/js/packages/components/src/components/Table/components/TableFooterRow/TableFooterRow.mjs.map +1 -1
  35. package/dist/js/packages/components/src/components/Table/components/TableHeader/TableHeader.mjs.map +1 -1
  36. package/dist/js/packages/components/src/components/Table/components/TableRow/TableRow.mjs.map +1 -1
  37. package/dist/js/packages/components/src/components/propTypes/index.mjs +10 -0
  38. package/dist/js/packages/components/src/components/propTypes/index.mjs.map +1 -1
  39. package/dist/types/components/AvatarStack/AvatarStack.d.ts +4 -3
  40. package/dist/types/components/Breadcrumb/Breadcrumb.d.ts +4 -3
  41. package/dist/types/components/CodeBlock/CodeBlock.d.ts +4 -3
  42. package/dist/types/components/DonutChart/DonutChart.d.ts +4 -3
  43. package/dist/types/components/HeaderNavigation/HeaderNavigation.d.ts +4 -3
  44. package/dist/types/components/ImageCropper/ImageCropper.d.ts +5 -3
  45. package/dist/types/components/Legend/Legend.d.ts +5 -3
  46. package/dist/types/components/List/model/item/ItemView.d.ts +5 -2
  47. package/dist/types/components/List/typedList.d.ts +17 -13
  48. package/dist/types/components/Markdown/Markdown.d.ts +3 -5
  49. package/dist/types/components/OverlayTrigger/components/DialogTrigger/DialogTrigger.d.ts +1 -4
  50. package/dist/types/components/Section/context.d.ts +4 -0
  51. package/dist/types/components/SkeletonText/SkeletonText.d.ts +4 -3
  52. package/dist/types/components/Table/Table.d.ts +18 -3
  53. package/dist/types/components/propTypes/index.d.ts +20 -0
  54. package/package.json +10 -10
@@ -1,6 +1,7 @@
1
1
  "use client"
2
2
  /* */
3
3
  import { PropsContextProvider } from "../../lib/propsContext/components/PropsContextProvider.mjs";
4
+ import { flowComponent } from "../../lib/componentFactory/flowComponent.mjs";
4
5
  import { Wrap } from "../Wrap/Wrap.mjs";
5
6
  import { useLocalizedStringFormatter } from "../TranslationProvider/useLocalizedStringFormatter.mjs";
6
7
  import { Button } from "../Button/Button.mjs";
@@ -12,8 +13,8 @@ import { Children } from "react";
12
13
  import { jsx, jsxs } from "react/jsx-runtime";
13
14
  // src/components/AvatarStack/AvatarStack.tsx
14
15
  /** @flr-generate all */
15
- var AvatarStack = (props) => {
16
- const { className, children, totalCount = 0, size = "m", onCountPress } = props;
16
+ var AvatarStack = flowComponent("AvatarStack", (props) => {
17
+ const { className, children, totalCount = 0, size = "m", onCountPress, ref } = props;
17
18
  const stringFormatter = useLocalizedStringFormatter(__locale_default, "AvatarStack");
18
19
  const additionalItemsCount = totalCount - Children.toArray(children).length;
19
20
  const rootClassName = clsx(AvatarStack_module_default.avatarStack, AvatarStack_module_default[`size-${size}`], className);
@@ -27,6 +28,7 @@ var AvatarStack = (props) => {
27
28
  return /* @__PURE__ */ jsx(PropsContextProvider, {
28
29
  props: propsContext,
29
30
  children: /* @__PURE__ */ jsxs("div", {
31
+ ref,
30
32
  className: rootClassName,
31
33
  children: [children, additionalItemsCount > 0 && /* @__PURE__ */ jsx(Wrap, {
32
34
  if: onCountPress,
@@ -41,7 +43,7 @@ var AvatarStack = (props) => {
41
43
  })]
42
44
  })
43
45
  });
44
- };
46
+ });
45
47
  export { AvatarStack, AvatarStack as default };
46
48
 
47
49
  //# sourceMappingURL=AvatarStack.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"AvatarStack.mjs","names":["locales","styles"],"sources":["../../../../../../../src/components/AvatarStack/AvatarStack.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { Children } from \"react\";\nimport clsx from \"clsx\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport styles from \"./AvatarStack.module.scss\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { Button } from \"@/components/Button\";\nimport { Avatar } from \"@/components/Avatar\";\nimport { Wrap } from \"@/components/Wrap\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider\";\n\nexport interface AvatarStackProps\n extends PropsWithClassName, PropsWithChildren {\n /**\n * The total count of items, as avatars should only be displayed for the first\n * view\n */\n totalCount?: number;\n /** The onPress action of the additional items count element */\n onCountPress?: () => void;\n /** The size of the avatars inside the stack. @default \"m\" */\n size?: \"xs\" | \"s\" | \"m\" | \"l\";\n}\n\n/** @flr-generate all */\nexport const AvatarStack: FC<AvatarStackProps> = (props) => {\n const {\n className,\n children,\n totalCount = 0,\n size = \"m\",\n onCountPress,\n } = props;\n\n const stringFormatter = useLocalizedStringFormatter(locales, \"AvatarStack\");\n\n const avatarCount = Children.toArray(children).length;\n\n const additionalItemsCount = totalCount - avatarCount;\n\n const rootClassName = clsx(\n styles.avatarStack,\n styles[`size-${size}`],\n className,\n );\n\n const propsContext: PropsContext = {\n Avatar: { className: styles.avatar, size },\n Button: {\n className: styles.avatar,\n },\n };\n\n return (\n <PropsContextProvider props={propsContext}>\n <div className={rootClassName}>\n {children}\n {additionalItemsCount > 0 && (\n <Wrap if={onCountPress}>\n <Button onPress={onCountPress}>\n <Avatar\n size={size}\n label={stringFormatter.format(\"additionalItems\", {\n count: additionalItemsCount,\n })}\n >\n +{additionalItemsCount}\n </Avatar>\n </Button>\n </Wrap>\n )}\n </div>\n </PropsContextProvider>\n );\n};\n\nexport default AvatarStack;\n"],"mappings":";;;;;;;;;;;;;;AA2BA,IAAa,eAAqC,UAAU;CAC1D,MAAM,EACJ,WACA,UACA,aAAa,GACb,OAAO,KACP,iBACE;CAEJ,MAAM,kBAAkB,4BAA4BA,kBAAS,aAAa;CAI1E,MAAM,uBAAuB,aAFT,SAAS,QAAQ,QAAQ,CAAC,CAAC;CAI/C,MAAM,gBAAgB,KACpBC,2BAAO,aACPA,2BAAO,QAAQ,SACf,SACF;CAEA,MAAM,eAA6B;EACjC,QAAQ;GAAE,WAAWA,2BAAO;GAAQ;EAAK;EACzC,QAAQ,EACN,WAAWA,2BAAO,OACpB;CACF;CAEA,OACE,oBAAC,sBAAD;EAAsB,OAAO;EAC3B,UAAA,qBAAC,OAAD;GAAK,WAAW;GAAhB,UAAA,CACG,UACA,uBAAuB,KACtB,oBAAC,MAAD;IAAM,IAAI;IACR,UAAA,oBAAC,QAAD;KAAQ,SAAS;KACf,UAAA,qBAAC,QAAD;MACQ;MACN,OAAO,gBAAgB,OAAO,mBAAmB,EAC/C,OAAO,qBACT,CAAC;MAJH,UAAA,CAKC,KACG,oBACI;;IACF,CAAA;GACJ,CAAA,CAEL;;CACe,CAAA;AAE1B"}
1
+ {"version":3,"file":"AvatarStack.mjs","names":["locales","styles"],"sources":["../../../../../../../src/components/AvatarStack/AvatarStack.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport { Children } from \"react\";\nimport clsx from \"clsx\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport styles from \"./AvatarStack.module.scss\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { Button } from \"@/components/Button\";\nimport { Avatar } from \"@/components/Avatar\";\nimport { Wrap } from \"@/components/Wrap\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\n\nexport interface AvatarStackProps\n extends PropsWithClassName, PropsWithChildren, FlowComponentProps {\n /**\n * The total count of items, as avatars should only be displayed for the first\n * view\n */\n totalCount?: number;\n /** The onPress action of the additional items count element */\n onCountPress?: () => void;\n /** The size of the avatars inside the stack. @default \"m\" */\n size?: \"xs\" | \"s\" | \"m\" | \"l\";\n}\n\n/** @flr-generate all */\nexport const AvatarStack = flowComponent(\"AvatarStack\", (props) => {\n const {\n className,\n children,\n totalCount = 0,\n size = \"m\",\n onCountPress,\n ref,\n } = props;\n\n const stringFormatter = useLocalizedStringFormatter(locales, \"AvatarStack\");\n\n const avatarCount = Children.toArray(children).length;\n\n const additionalItemsCount = totalCount - avatarCount;\n\n const rootClassName = clsx(\n styles.avatarStack,\n styles[`size-${size}`],\n className,\n );\n\n const propsContext: PropsContext = {\n Avatar: { className: styles.avatar, size },\n Button: {\n className: styles.avatar,\n },\n };\n\n return (\n <PropsContextProvider props={propsContext}>\n <div ref={ref} className={rootClassName}>\n {children}\n {additionalItemsCount > 0 && (\n <Wrap if={onCountPress}>\n <Button onPress={onCountPress}>\n <Avatar\n size={size}\n label={stringFormatter.format(\"additionalItems\", {\n count: additionalItemsCount,\n })}\n >\n +{additionalItemsCount}\n </Avatar>\n </Button>\n </Wrap>\n )}\n </div>\n </PropsContextProvider>\n );\n});\n\nexport default AvatarStack;\n"],"mappings":";;;;;;;;;;;;;;;AA6BA,IAAa,cAAc,cAAc,gBAAgB,UAAU;CACjE,MAAM,EACJ,WACA,UACA,aAAa,GACb,OAAO,KACP,cACA,QACE;CAEJ,MAAM,kBAAkB,4BAA4BA,kBAAS,aAAa;CAI1E,MAAM,uBAAuB,aAFT,SAAS,QAAQ,QAAQ,CAAC,CAAC;CAI/C,MAAM,gBAAgB,KACpBC,2BAAO,aACPA,2BAAO,QAAQ,SACf,SACF;CAEA,MAAM,eAA6B;EACjC,QAAQ;GAAE,WAAWA,2BAAO;GAAQ;EAAK;EACzC,QAAQ,EACN,WAAWA,2BAAO,OACpB;CACF;CAEA,OACE,oBAAC,sBAAD;EAAsB,OAAO;EAC3B,UAAA,qBAAC,OAAD;GAAU;GAAK,WAAW;GAA1B,UAAA,CACG,UACA,uBAAuB,KACtB,oBAAC,MAAD;IAAM,IAAI;IACR,UAAA,oBAAC,QAAD;KAAQ,SAAS;KACf,UAAA,qBAAC,QAAD;MACQ;MACN,OAAO,gBAAgB,OAAO,mBAAmB,EAC/C,OAAO,qBACT,CAAC;MAJH,UAAA,CAKC,KACG,oBACI;;IACF,CAAA;GACJ,CAAA,CAEL;;CACe,CAAA;AAE1B,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use client"
2
2
  /* */
3
3
  import { PropsContextProvider } from "../../lib/propsContext/components/PropsContextProvider.mjs";
4
+ import { flowComponent } from "../../lib/componentFactory/flowComponent.mjs";
4
5
  import { isAlphaColor } from "../../lib/types/props.mjs";
5
6
  import { useSkeletonMode } from "../SkeletonMode/skeletonModeContext.mjs";
6
7
  import Breadcrumb_module_default from "./Breadcrumb.module.mjs";
@@ -10,8 +11,8 @@ import { jsx } from "react/jsx-runtime";
10
11
  import * as Aria from "react-aria-components";
11
12
  // src/components/Breadcrumb/Breadcrumb.tsx
12
13
  /** @flr-generate all */
13
- var Breadcrumb = (props) => {
14
- const { children, className, color = "default", size = "m", ...rest } = props;
14
+ var Breadcrumb = flowComponent("Breadcrumb", (props) => {
15
+ const { children, className, color = "default", size = "m", ref, ...rest } = props;
15
16
  const isSkeleton = useSkeletonMode();
16
17
  const rootClassName = clsx(Breadcrumb_module_default.breadcrumb, isAlphaColor(color) && Breadcrumb_module_default[color], size === "s" && Breadcrumb_module_default["size-s"], isSkeleton && Breadcrumb_module_default.skeleton, className);
17
18
  const propsContext = { Link: {
@@ -21,13 +22,14 @@ var Breadcrumb = (props) => {
21
22
  } };
22
23
  return /* @__PURE__ */ jsx(Aria.Breadcrumbs, {
23
24
  ...rest,
25
+ ref,
24
26
  className: rootClassName,
25
27
  children: /* @__PURE__ */ jsx(PropsContextProvider, {
26
28
  props: propsContext,
27
29
  children
28
30
  })
29
31
  });
30
- };
32
+ });
31
33
  export { Breadcrumb, Breadcrumb as default };
32
34
 
33
35
  //# sourceMappingURL=Breadcrumb.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumb.mjs","names":["styles"],"sources":["../../../../../../../src/components/Breadcrumb/Breadcrumb.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"./Breadcrumb.module.scss\";\nimport clsx from \"clsx\";\nimport type { BreadcrumbItemProps } from \"./components/BreadcrumbItem\";\nimport { BreadcrumbItem } from \"./components/BreadcrumbItem\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { type AlphaColor, isAlphaColor } from \"@/lib/types/props\";\nimport { useSkeletonMode } from \"@/components/SkeletonMode/skeletonModeContext\";\n\nexport interface BreadcrumbProps\n extends\n Omit<Aria.BreadcrumbsProps<BreadcrumbItemProps>, \"children\">,\n PropsWithChildren {\n /** The color of the breadcrumb. @default \"default\" */\n color?: \"default\" | AlphaColor;\n /** The size of the element. @default \"m\" */\n size?: \"s\" | \"m\";\n}\n\n/** @flr-generate all */\nexport const Breadcrumb: FC<BreadcrumbProps> = (props) => {\n const { children, className, color = \"default\", size = \"m\", ...rest } = props;\n\n const isSkeleton = useSkeletonMode();\n\n const rootClassName = clsx(\n styles.breadcrumb,\n isAlphaColor(color) && styles[color],\n size === \"s\" && styles[\"size-s\"],\n isSkeleton && styles.skeleton,\n className,\n );\n\n const propsContext: PropsContext = {\n Link: {\n unstyled: true,\n className: styles.link,\n wrapWith: <BreadcrumbItem />,\n },\n };\n\n return (\n <Aria.Breadcrumbs {...rest} className={rootClassName}>\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n </Aria.Breadcrumbs>\n );\n};\n\nexport default Breadcrumb;\n"],"mappings":";;;;;;;;;;;;AAsBA,IAAa,cAAmC,UAAU;CACxD,MAAM,EAAE,UAAU,WAAW,QAAQ,WAAW,OAAO,KAAK,GAAG,SAAS;CAExE,MAAM,aAAa,gBAAgB;CAEnC,MAAM,gBAAgB,KACpBA,0BAAO,YACP,aAAa,KAAK,KAAKA,0BAAO,QAC9B,SAAS,OAAOA,0BAAO,WACvB,cAAcA,0BAAO,UACrB,SACF;CAEA,MAAM,eAA6B,EACjC,MAAM;EACJ,UAAU;EACV,WAAWA,0BAAO;EAClB,UAAU,oBAAC,gBAAD,CAAiB,CAAA;CAC7B,EACF;CAEA,OACE,oBAAC,KAAK,aAAN;EAAkB,GAAI;EAAM,WAAW;EACrC,UAAA,oBAAC,sBAAD;GAAsB,OAAO;GAC1B;EACmB,CAAA;CACN,CAAA;AAEtB"}
1
+ {"version":3,"file":"Breadcrumb.mjs","names":["styles"],"sources":["../../../../../../../src/components/Breadcrumb/Breadcrumb.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"./Breadcrumb.module.scss\";\nimport clsx from \"clsx\";\nimport type { BreadcrumbItemProps } from \"./components/BreadcrumbItem\";\nimport { BreadcrumbItem } from \"./components/BreadcrumbItem\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { type AlphaColor, isAlphaColor } from \"@/lib/types/props\";\nimport { useSkeletonMode } from \"@/components/SkeletonMode/skeletonModeContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\n\nexport interface BreadcrumbProps\n extends\n Omit<Aria.BreadcrumbsProps<BreadcrumbItemProps>, \"children\">,\n PropsWithChildren,\n FlowComponentProps<HTMLOListElement> {\n /** The color of the breadcrumb. @default \"default\" */\n color?: \"default\" | AlphaColor;\n /** The size of the element. @default \"m\" */\n size?: \"s\" | \"m\";\n}\n\n/** @flr-generate all */\nexport const Breadcrumb = flowComponent(\"Breadcrumb\", (props) => {\n const {\n children,\n className,\n color = \"default\",\n size = \"m\",\n ref,\n ...rest\n } = props;\n\n const isSkeleton = useSkeletonMode();\n\n const rootClassName = clsx(\n styles.breadcrumb,\n isAlphaColor(color) && styles[color],\n size === \"s\" && styles[\"size-s\"],\n isSkeleton && styles.skeleton,\n className,\n );\n\n const propsContext: PropsContext = {\n Link: {\n unstyled: true,\n className: styles.link,\n wrapWith: <BreadcrumbItem />,\n },\n };\n\n return (\n <Aria.Breadcrumbs {...rest} ref={ref} className={rootClassName}>\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n </Aria.Breadcrumbs>\n );\n});\n\nexport default Breadcrumb;\n"],"mappings":";;;;;;;;;;;;;AAyBA,IAAa,aAAa,cAAc,eAAe,UAAU;CAC/D,MAAM,EACJ,UACA,WACA,QAAQ,WACR,OAAO,KACP,KACA,GAAG,SACD;CAEJ,MAAM,aAAa,gBAAgB;CAEnC,MAAM,gBAAgB,KACpBA,0BAAO,YACP,aAAa,KAAK,KAAKA,0BAAO,QAC9B,SAAS,OAAOA,0BAAO,WACvB,cAAcA,0BAAO,UACrB,SACF;CAEA,MAAM,eAA6B,EACjC,MAAM;EACJ,UAAU;EACV,WAAWA,0BAAO;EAClB,UAAU,oBAAC,gBAAD,CAAiB,CAAA;CAC7B,EACF;CAEA,OACE,oBAAC,KAAK,aAAN;EAAkB,GAAI;EAAW;EAAK,WAAW;EAC/C,UAAA,oBAAC,sBAAD;GAAsB,OAAO;GAC1B;EACmB,CAAA;CACN,CAAA;AAEtB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  "use client"
2
2
  /* */
3
+ import { flowComponent } from "../../lib/componentFactory/flowComponent.mjs";
3
4
  import { SkeletonModeReset, useSkeletonMode } from "../SkeletonMode/skeletonModeContext.mjs";
4
5
  import { useLocalizedStringFormatter } from "../TranslationProvider/useLocalizedStringFormatter.mjs";
5
6
  import { Button } from "../Button/Button.mjs";
@@ -12,8 +13,8 @@ import { jsx } from "react/jsx-runtime";
12
13
  import { flushSync } from "react-dom";
13
14
  // src/components/CodeBlock/CodeBlock.tsx
14
15
  /** @flr-generate all */
15
- var CodeBlock = (props) => {
16
- const { code, className, copyable = false, showLineNumbers = false, children, truncateLines = false, ...rest } = props;
16
+ var CodeBlock = flowComponent("CodeBlock", (props) => {
17
+ const { code, className, copyable = false, showLineNumbers = false, children, truncateLines = false, ref, ...rest } = props;
17
18
  const [folded, setFolded] = useState(truncateLines !== false);
18
19
  const [maxHeight, setMaxHeight] = useState();
19
20
  const [expandedHeight, setExpandedHeight] = useState();
@@ -23,6 +24,7 @@ var CodeBlock = (props) => {
23
24
  const baseClassName = clsx(CodeBlock_module_default.codeBlock, isSkeleton && CodeBlock_module_default.skeleton);
24
25
  const id = useId();
25
26
  if (!code) return /* @__PURE__ */ jsx("div", {
27
+ ref,
26
28
  className: clsx(baseClassName, CodeBlock_module_default.withChildren, className),
27
29
  inert: isSkeleton || void 0,
28
30
  children: /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx("code", { children: /* @__PURE__ */ jsx(SkeletonModeReset, { children }) }) })
@@ -48,6 +50,7 @@ var CodeBlock = (props) => {
48
50
  }
49
51
  };
50
52
  return /* @__PURE__ */ jsx("div", {
53
+ ref,
51
54
  className: clsx(baseClassName, maxHeight && CodeBlock_module_default.truncated, folded && CodeBlock_module_default.folded, className),
52
55
  style: heightVariables,
53
56
  onTransitionEnd: (event) => {
@@ -87,7 +90,7 @@ var CodeBlock = (props) => {
87
90
  })
88
91
  }) })
89
92
  });
90
- };
93
+ });
91
94
  export { CodeBlock, CodeBlock as default };
92
95
 
93
96
  //# sourceMappingURL=CodeBlock.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlock.mjs","names":["locales","styles"],"sources":["../../../../../../../src/components/CodeBlock/CodeBlock.tsx"],"sourcesContent":["import {\n type FC,\n type PropsWithChildren,\n useId,\n useRef,\n useState,\n} from \"react\";\nimport { flushSync } from \"react-dom\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport styles from \"./CodeBlock.module.scss\";\nimport { CodeEditor, type CodeEditorProps } from \"@/components/CodeEditor\";\nimport { Button } from \"@/components/Button\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider\";\nimport locales from \"./locales/*.locale.json\";\nimport {\n SkeletonModeReset,\n useSkeletonMode,\n} from \"@/components/SkeletonMode/skeletonModeContext\";\n\nexport interface CodeBlockProps\n extends\n PropsWithClassName,\n PropsWithChildren,\n Partial<\n Pick<CodeEditorProps, \"language\" | \"showLineNumbers\" | \"copyable\">\n > {\n /** The code displayed in the block. */\n code?: string;\n /**\n * Controls truncation of long code blocks. `false` disables it, `true`\n * truncates after 8 lines, and a number sets the maximum line count.\n *\n * @default false\n */\n truncateLines?: boolean | number;\n}\n\n/** @flr-generate all */\nexport const CodeBlock: FC<CodeBlockProps> = (props) => {\n const {\n code,\n className,\n copyable = false,\n showLineNumbers = false,\n children,\n truncateLines = false,\n ...rest\n } = props;\n\n const [folded, setFolded] = useState(truncateLines !== false);\n const [maxHeight, setMaxHeight] = useState<number>();\n /* The full height, only while the toggle animates to or from it. */\n const [expandedHeight, setExpandedHeight] = useState<number>();\n const editorRef = useRef<HTMLElement>(null);\n\n const stringFormatter = useLocalizedStringFormatter(locales, \"CodeBlock\");\n const isSkeleton = useSkeletonMode();\n\n const baseClassName = clsx(styles.codeBlock, isSkeleton && styles.skeleton);\n\n const id = useId();\n\n if (!code) {\n return (\n <div\n className={clsx(baseClassName, styles.withChildren, className)}\n inert={isSkeleton || undefined}\n >\n {/* Deliberately class-less: a `flow--` class would make the global\n reset's `font: inherit` apply and replace the UA monospace\n metrics. See CodeBlock.module.scss. */}\n <pre>\n <code>\n <SkeletonModeReset>{children}</SkeletonModeReset>\n </code>\n </pre>\n </div>\n );\n }\n\n const heightVariables: React.CSSProperties = {\n ...(maxHeight ? { \"--max-height\": `${maxHeight}px` } : {}),\n ...(expandedHeight\n ? { \"--expanded-max-height\": `${expandedHeight}px` }\n : {}),\n };\n\n /* A height transition needs a length on both ends – `none` does not\n interpolate. So the full height is measured for the transition and\n released once it ended, and code that changes later is not clipped. */\n const toggleFolded = () => {\n const editor = editorRef.current;\n\n if (!editor) {\n setFolded((folded) => !folded);\n return;\n }\n\n const animates = getComputedStyle(editor)\n .transitionDuration.split(\",\")\n .some((duration) => parseFloat(duration) > 0);\n\n if (folded) {\n setExpandedHeight(animates ? editor.scrollHeight : undefined);\n setFolded(false);\n } else {\n flushSync(() => setExpandedHeight(editor.scrollHeight));\n // Applies the start height before the folded one replaces it.\n editor.getBoundingClientRect();\n setFolded(true);\n }\n };\n\n return (\n <div\n className={clsx(\n baseClassName,\n maxHeight && styles.truncated,\n folded && styles.folded,\n className,\n )}\n style={heightVariables}\n onTransitionEnd={(event) => {\n if (event.propertyName === \"max-height\") {\n setExpandedHeight(undefined);\n }\n }}\n inert={isSkeleton || undefined}\n >\n {/* The code block is one skeleton surface in the size of its code, so\n the editor inside renders for real, but invisibly. */}\n <SkeletonModeReset>\n <CodeEditor\n {...rest}\n value={code}\n editable={false}\n copyable={copyable}\n showLineNumbers={showLineNumbers}\n showLinterMarkers={false}\n showCodeFolding={false}\n showActiveLineMarker={false}\n isReadOnly\n onCreateEditor={(view) => {\n editorRef.current = view.dom;\n\n if (!truncateLines) {\n return;\n }\n\n const lineHeight = 20;\n const padding = 12;\n\n const visibleLines =\n typeof truncateLines === \"number\" ? truncateLines : 8;\n\n const totalLines = view.state.doc.lines;\n\n if (totalLines > visibleLines)\n setMaxHeight(lineHeight * visibleLines + padding);\n }}\n id={id}\n >\n {truncateLines && maxHeight && (\n <div className={clsx(styles.buttonContainer)}>\n <Button\n variant=\"plain\"\n color=\"secondary\"\n size=\"s\"\n onPress={toggleFolded}\n aria-expanded={!folded}\n aria-controls={id}\n >\n {stringFormatter.format(folded ? \"showMore\" : \"showLess\")}\n </Button>\n </div>\n )}\n </CodeEditor>\n </SkeletonModeReset>\n </div>\n );\n};\n\nexport default CodeBlock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AAO,sBAAsB;GAC7B,UAAU,IAAI;EAChB;CACF;CAEA,OACE,oBAAC,OAAD;EACE,WAAW,KACT,eACA,aAAaA,yBAAO,WACpB,UAAUA,yBAAO,QACjB,SACF;EACA,OAAO;EACP,kBAAkB,UAAU;GAC1B,IAAI,MAAM,iBAAiB,cACzB,kBAAkB,KAAA,CAAS;EAE/B;EACA,OAAO,cAAc,KAAA;EAIrB,UAAA,oBAAC,mBAAD,EAAA,UACE,oBAAC,YAAD;GACE,GAAI;GACJ,OAAO;GACP,UAAU;GACA;GACO;GACjB,mBAAmB;GACnB,iBAAiB;GACjB,sBAAsB;GACtB,YAAA;GACA,iBAAiB,SAAS;IACxB,UAAU,UAAU,KAAK;IAEzB,IAAI,CAAC,eACH;IAGF,MAAM,aAAa;IACnB,MAAM,UAAU;IAEhB,MAAM,eACJ,OAAO,kBAAkB,WAAW,gBAAgB;IAItD,IAFmB,KAAK,MAAM,IAAI,QAEjB,cACf,aAAa,aAAa,eAAe,OAAO;GACpD;GACI;GAEH,UAAA,iBAAiB,aAChB,oBAAC,OAAD;IAAK,WAAW,KAAKA,yBAAO,eAAe;IACzC,UAAA,oBAAC,QAAD;KACE,SAAQ;KACR,OAAM;KACN,MAAK;KACL,SAAS;KACT,iBAAe,CAAC;KAChB,iBAAe;KAEd,UAAA,gBAAgB,OAAO,SAAS,aAAa,UAAU;IAClD,CAAA;GACL,CAAA;EAEG,CAAA,EACK,CAAA;CAChB,CAAA;AAET"}
1
+ {"version":3,"file":"CodeBlock.mjs","names":["locales","styles"],"sources":["../../../../../../../src/components/CodeBlock/CodeBlock.tsx"],"sourcesContent":["import { type PropsWithChildren, useId, useRef, useState } from \"react\";\nimport { flushSync } from \"react-dom\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport styles from \"./CodeBlock.module.scss\";\nimport { CodeEditor, type CodeEditorProps } from \"@/components/CodeEditor\";\nimport { Button } from \"@/components/Button\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider\";\nimport locales from \"./locales/*.locale.json\";\nimport {\n SkeletonModeReset,\n useSkeletonMode,\n} from \"@/components/SkeletonMode/skeletonModeContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\n\nexport interface CodeBlockProps\n extends\n PropsWithClassName,\n PropsWithChildren,\n FlowComponentProps,\n Partial<\n Pick<CodeEditorProps, \"language\" | \"showLineNumbers\" | \"copyable\">\n > {\n /** The code displayed in the block. */\n code?: string;\n /**\n * Controls truncation of long code blocks. `false` disables it, `true`\n * truncates after 8 lines, and a number sets the maximum line count.\n *\n * @default false\n */\n truncateLines?: boolean | number;\n}\n\n/** @flr-generate all */\nexport const CodeBlock = flowComponent(\"CodeBlock\", (props) => {\n const {\n code,\n className,\n copyable = false,\n showLineNumbers = false,\n children,\n truncateLines = false,\n ref,\n ...rest\n } = props;\n\n const [folded, setFolded] = useState(truncateLines !== false);\n const [maxHeight, setMaxHeight] = useState<number>();\n /* The full height, only while the toggle animates to or from it. */\n const [expandedHeight, setExpandedHeight] = useState<number>();\n const editorRef = useRef<HTMLElement>(null);\n\n const stringFormatter = useLocalizedStringFormatter(locales, \"CodeBlock\");\n const isSkeleton = useSkeletonMode();\n\n const baseClassName = clsx(styles.codeBlock, isSkeleton && styles.skeleton);\n\n const id = useId();\n\n if (!code) {\n return (\n <div\n ref={ref}\n className={clsx(baseClassName, styles.withChildren, className)}\n inert={isSkeleton || undefined}\n >\n {/* Deliberately class-less: a `flow--` class would make the global\n reset's `font: inherit` apply and replace the UA monospace\n metrics. See CodeBlock.module.scss. */}\n <pre>\n <code>\n <SkeletonModeReset>{children}</SkeletonModeReset>\n </code>\n </pre>\n </div>\n );\n }\n\n const heightVariables: React.CSSProperties = {\n ...(maxHeight ? { \"--max-height\": `${maxHeight}px` } : {}),\n ...(expandedHeight\n ? { \"--expanded-max-height\": `${expandedHeight}px` }\n : {}),\n };\n\n /* A height transition needs a length on both ends – `none` does not\n interpolate. So the full height is measured for the transition and\n released once it ended, and code that changes later is not clipped. */\n const toggleFolded = () => {\n const editor = editorRef.current;\n\n if (!editor) {\n setFolded((folded) => !folded);\n return;\n }\n\n const animates = getComputedStyle(editor)\n .transitionDuration.split(\",\")\n .some((duration) => parseFloat(duration) > 0);\n\n if (folded) {\n setExpandedHeight(animates ? editor.scrollHeight : undefined);\n setFolded(false);\n } else {\n flushSync(() => setExpandedHeight(editor.scrollHeight));\n // Applies the start height before the folded one replaces it.\n editor.getBoundingClientRect();\n setFolded(true);\n }\n };\n\n return (\n <div\n ref={ref}\n className={clsx(\n baseClassName,\n maxHeight && styles.truncated,\n folded && styles.folded,\n className,\n )}\n style={heightVariables}\n onTransitionEnd={(event) => {\n if (event.propertyName === \"max-height\") {\n setExpandedHeight(undefined);\n }\n }}\n inert={isSkeleton || undefined}\n >\n {/* The code block is one skeleton surface in the size of its code, so\n the editor inside renders for real, but invisibly. */}\n <SkeletonModeReset>\n <CodeEditor\n {...rest}\n value={code}\n editable={false}\n copyable={copyable}\n showLineNumbers={showLineNumbers}\n showLinterMarkers={false}\n showCodeFolding={false}\n showActiveLineMarker={false}\n isReadOnly\n onCreateEditor={(view) => {\n editorRef.current = view.dom;\n\n if (!truncateLines) {\n return;\n }\n\n const lineHeight = 20;\n const padding = 12;\n\n const visibleLines =\n typeof truncateLines === \"number\" ? truncateLines : 8;\n\n const totalLines = view.state.doc.lines;\n\n if (totalLines > visibleLines)\n setMaxHeight(lineHeight * visibleLines + padding);\n }}\n id={id}\n >\n {truncateLines && maxHeight && (\n <div className={clsx(styles.buttonContainer)}>\n <Button\n variant=\"plain\"\n color=\"secondary\"\n size=\"s\"\n onPress={toggleFolded}\n aria-expanded={!folded}\n aria-controls={id}\n >\n {stringFormatter.format(folded ? \"showMore\" : \"showLess\")}\n </Button>\n </div>\n )}\n </CodeEditor>\n </SkeletonModeReset>\n </div>\n );\n});\n\nexport default CodeBlock;\n"],"mappings":";;;;;;;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,OAAO,sBAAsB;GAC7B,UAAU,IAAI;EAChB;CACF;CAEA,OACE,oBAAC,OAAD;EACO;EACL,WAAW,KACT,eACA,aAAaA,yBAAO,WACpB,UAAUA,yBAAO,QACjB,SACF;EACA,OAAO;EACP,kBAAkB,UAAU;GAC1B,IAAI,MAAM,iBAAiB,cACzB,kBAAkB,KAAA,CAAS;EAE/B;EACA,OAAO,cAAc,KAAA;EAIrB,UAAA,oBAAC,mBAAD,EAAA,UACE,oBAAC,YAAD;GACE,GAAI;GACJ,OAAO;GACP,UAAU;GACA;GACO;GACjB,mBAAmB;GACnB,iBAAiB;GACjB,sBAAsB;GACtB,YAAA;GACA,iBAAiB,SAAS;IACxB,UAAU,UAAU,KAAK;IAEzB,IAAI,CAAC,eACH;IAGF,MAAM,aAAa;IACnB,MAAM,UAAU;IAEhB,MAAM,eACJ,OAAO,kBAAkB,WAAW,gBAAgB;IAItD,IAFmB,KAAK,MAAM,IAAI,QAEjB,cACf,aAAa,aAAa,eAAe,OAAO;GACpD;GACI;GAEH,UAAA,iBAAiB,aAChB,oBAAC,OAAD;IAAK,WAAW,KAAKA,yBAAO,eAAe;IACzC,UAAA,oBAAC,QAAD;KACE,SAAQ;KACR,OAAM;KACN,MAAK;KACL,SAAS;KACT,iBAAe,CAAC;KAChB,iBAAe;KAEd,UAAA,gBAAgB,OAAO,SAAS,aAAa,UAAU;IAClD,CAAA;GACL,CAAA;EAEG,CAAA,EACK,CAAA;CAChB,CAAA;AAET,CAAC"}
@@ -1,5 +1,6 @@
1
1
  "use client"
2
2
  /* */
3
+ import { flowComponent } from "../../lib/componentFactory/flowComponent.mjs";
3
4
  import { useSkeletonMode } from "../SkeletonMode/skeletonModeContext.mjs";
4
5
  import { Wrap } from "../Wrap/Wrap.mjs";
5
6
  import DonutChart_module_default from "./DonutChart.module.mjs";
@@ -11,8 +12,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
11
12
  import * as Aria from "react-aria-components";
12
13
  // src/components/DonutChart/DonutChart.tsx
13
14
  /** @flr-generate all */
14
- var DonutChart = (props) => {
15
- const { size = "m", status = "info", className, value, segments, maxValue, formatOptions, showLegend = true, legendPosition = "right", children, ...rest } = props;
15
+ var DonutChart = flowComponent("DonutChart", (props) => {
16
+ const { size = "m", status = "info", className, value, segments, maxValue, formatOptions, showLegend = true, legendPosition = "right", children, ref, ...rest } = props;
16
17
  const rootClassName = clsx(DonutChart_module_default.donutChart, size === "l" && DonutChart_module_default["size-l"], DonutChart_module_default[status], className);
17
18
  const segmentsTotalValue = segments ? segments.map((s) => s.value).reduce((a, b) => a + b, 0) : void 0;
18
19
  const isSkeleton = useSkeletonMode();
@@ -31,6 +32,7 @@ var DonutChart = (props) => {
31
32
  className: rootClassName,
32
33
  value: displayedValue,
33
34
  ...rest,
35
+ ref,
34
36
  children: [/* @__PURE__ */ jsx(Donut, {
35
37
  value: displayedValue,
36
38
  segments,
@@ -53,7 +55,7 @@ var DonutChart = (props) => {
53
55
  })]
54
56
  })
55
57
  });
56
- };
58
+ });
57
59
  export { DonutChart, DonutChart as default };
58
60
 
59
61
  //# sourceMappingURL=DonutChart.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"DonutChart.mjs","names":["styles"],"sources":["../../../../../../../src/components/DonutChart/DonutChart.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"./DonutChart.module.scss\";\nimport type { CategoricalWithCustomColor } from \"@/lib/tokens/CategoricalColors\";\nimport { DonutChartValue } from \"@/components/DonutChart/components/DonutChartValue\";\nimport { Donut, getDonutSize } from \"@/components/DonutChart/components/Donut\";\nimport { Wrap } from \"@/components/Wrap\";\nimport { DonutChartLegend } from \"@/components/DonutChart/components/DonutChartLegend\";\nimport type { Status } from \"@/lib/types/props\";\nimport { useSkeletonMode } from \"@/components/SkeletonMode/skeletonModeContext\";\n\nexport interface DonutChartSegment {\n value: number;\n title: string;\n color?: CategoricalWithCustomColor;\n valueText?: string;\n}\n\nexport interface DonutChartProps\n extends\n Omit<Aria.ProgressBarProps, \"children\" | \"valueLabel\">,\n PropsWithChildren {\n /** The status the donut chart is colored by. */\n status?: Exclude<Status, \"unavailable\">;\n /** The size variant of the donut chart. @default \"m\" */\n size?: \"m\" | \"l\";\n /** Divides the fill of the donut chart into segments */\n segments?: DonutChartSegment[];\n /** Whether the legend component is shown when segments are used. @default true */\n showLegend?: boolean;\n /** The position of the legend. @default \"right\" */\n legendPosition?: \"top\" | \"left\" | \"bottom\" | \"right\";\n}\n\n/** @flr-generate all */\nexport const DonutChart: FC<DonutChartProps> = (props) => {\n const {\n size = \"m\",\n status = \"info\",\n className,\n value,\n segments,\n maxValue,\n formatOptions,\n showLegend = true,\n legendPosition = \"right\",\n children,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.donutChart,\n size === \"l\" && styles[\"size-l\"],\n styles[status],\n className,\n );\n\n const segmentsTotalValue = segments\n ? segments.map((s) => s.value).reduce((a, b) => a + b, 0)\n : undefined;\n\n const isSkeleton = useSkeletonMode();\n const donutSize = getDonutSize(size);\n\n const displayedValue = segmentsTotalValue ?? value;\n\n /* No svg: the donut is one round surface in its size. The legend follows\n the skeleton rules of its items. */\n const skeletonDonut = (\n <span\n className={clsx(styles.donutChart, styles.skeleton, className)}\n style={{ width: donutSize, height: donutSize }}\n aria-hidden\n inert\n />\n );\n\n const donut = (\n <Aria.ProgressBar\n className={rootClassName}\n value={displayedValue}\n {...rest}\n >\n <Donut\n value={displayedValue}\n segments={segments}\n size={size}\n maxValue={maxValue}\n />\n <DonutChartValue value={displayedValue} formatOptions={formatOptions}>\n {children}\n </DonutChartValue>\n </Aria.ProgressBar>\n );\n\n return (\n <Wrap if={showLegend && segments}>\n <div className={clsx(styles.donutChartContainer, styles[legendPosition])}>\n {isSkeleton ? skeletonDonut : donut}\n\n {showLegend && segments && (\n <DonutChartLegend\n showLegend={showLegend}\n segments={segments}\n formatOptions={formatOptions}\n />\n )}\n </div>\n </Wrap>\n );\n};\n\nexport default DonutChart;\n"],"mappings":";;;;;;;;;;;;;AAoCA,IAAa,cAAmC,UAAU;CACxD,MAAM,EACJ,OAAO,KACP,SAAS,QACT,WACA,OACA,UACA,UACA,eACA,aAAa,MACb,iBAAiB,SACjB,UACA,GAAG,SACD;CAEJ,MAAM,gBAAgB,KACpBA,0BAAO,YACP,SAAS,OAAOA,0BAAO,WACvBA,0BAAO,SACP,SACF;CAEA,MAAM,qBAAqB,WACvB,SAAS,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,QAAQ,GAAG,MAAM,IAAI,GAAG,CAAC,IACtD,KAAA;CAEJ,MAAM,aAAa,gBAAgB;CACnC,MAAM,YAAY,aAAa,IAAI;CAEnC,MAAM,iBAAiB,sBAAsB;CAI7C,MAAM,gBACJ,oBAAC,QAAD;EACE,WAAW,KAAKA,0BAAO,YAAYA,0BAAO,UAAU,SAAS;EAC7D,OAAO;GAAE,OAAO;GAAW,QAAQ;EAAU;EAC7C,eAAA;EACA,OAAA;CACD,CAAA;CAGH,MAAM,QACJ,qBAAC,KAAK,aAAN;EACE,WAAW;EACX,OAAO;EACP,GAAI;EAHN,UAAA,CAKE,oBAAC,OAAD;GACE,OAAO;GACG;GACJ;GACI;EACX,CAAA,GACD,oBAAC,iBAAD;GAAiB,OAAO;GAA+B;GACpD;EACc,CAAA,CACD;;CAGpB,OACE,oBAAC,MAAD;EAAM,IAAI,cAAc;EACtB,UAAA,qBAAC,OAAD;GAAK,WAAW,KAAKA,0BAAO,qBAAqBA,0BAAO,eAAe;GAAvE,UAAA,CACG,aAAa,gBAAgB,OAE7B,cAAc,YACb,oBAAC,kBAAD;IACc;IACF;IACK;GAChB,CAAA,CAEA;;CACD,CAAA;AAEV"}
1
+ {"version":3,"file":"DonutChart.mjs","names":["styles"],"sources":["../../../../../../../src/components/DonutChart/DonutChart.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"./DonutChart.module.scss\";\nimport type { CategoricalWithCustomColor } from \"@/lib/tokens/CategoricalColors\";\nimport { DonutChartValue } from \"@/components/DonutChart/components/DonutChartValue\";\nimport { Donut, getDonutSize } from \"@/components/DonutChart/components/Donut\";\nimport { Wrap } from \"@/components/Wrap\";\nimport { DonutChartLegend } from \"@/components/DonutChart/components/DonutChartLegend\";\nimport type { Status } from \"@/lib/types/props\";\nimport { useSkeletonMode } from \"@/components/SkeletonMode/skeletonModeContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\n\nexport interface DonutChartSegment {\n value: number;\n title: string;\n color?: CategoricalWithCustomColor;\n valueText?: string;\n}\n\nexport interface DonutChartProps\n extends\n Omit<Aria.ProgressBarProps, \"children\" | \"valueLabel\">,\n PropsWithChildren,\n FlowComponentProps {\n /** The status the donut chart is colored by. */\n status?: Exclude<Status, \"unavailable\">;\n /** The size variant of the donut chart. @default \"m\" */\n size?: \"m\" | \"l\";\n /** Divides the fill of the donut chart into segments */\n segments?: DonutChartSegment[];\n /** Whether the legend component is shown when segments are used. @default true */\n showLegend?: boolean;\n /** The position of the legend. @default \"right\" */\n legendPosition?: \"top\" | \"left\" | \"bottom\" | \"right\";\n}\n\n/** @flr-generate all */\nexport const DonutChart = flowComponent(\"DonutChart\", (props) => {\n const {\n size = \"m\",\n status = \"info\",\n className,\n value,\n segments,\n maxValue,\n formatOptions,\n showLegend = true,\n legendPosition = \"right\",\n children,\n ref,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.donutChart,\n size === \"l\" && styles[\"size-l\"],\n styles[status],\n className,\n );\n\n const segmentsTotalValue = segments\n ? segments.map((s) => s.value).reduce((a, b) => a + b, 0)\n : undefined;\n\n const isSkeleton = useSkeletonMode();\n const donutSize = getDonutSize(size);\n\n const displayedValue = segmentsTotalValue ?? value;\n\n /* No svg: the donut is one round surface in its size. The legend follows\n the skeleton rules of its items. */\n const skeletonDonut = (\n <span\n className={clsx(styles.donutChart, styles.skeleton, className)}\n style={{ width: donutSize, height: donutSize }}\n aria-hidden\n inert\n />\n );\n\n const donut = (\n <Aria.ProgressBar\n className={rootClassName}\n value={displayedValue}\n {...rest}\n ref={ref}\n >\n <Donut\n value={displayedValue}\n segments={segments}\n size={size}\n maxValue={maxValue}\n />\n <DonutChartValue value={displayedValue} formatOptions={formatOptions}>\n {children}\n </DonutChartValue>\n </Aria.ProgressBar>\n );\n\n return (\n <Wrap if={showLegend && segments}>\n <div className={clsx(styles.donutChartContainer, styles[legendPosition])}>\n {isSkeleton ? skeletonDonut : donut}\n\n {showLegend && segments && (\n <DonutChartLegend\n showLegend={showLegend}\n segments={segments}\n formatOptions={formatOptions}\n />\n )}\n </div>\n </Wrap>\n );\n});\n\nexport default DonutChart;\n"],"mappings":";;;;;;;;;;;;;;AAuCA,IAAa,aAAa,cAAc,eAAe,UAAU;CAC/D,MAAM,EACJ,OAAO,KACP,SAAS,QACT,WACA,OACA,UACA,UACA,eACA,aAAa,MACb,iBAAiB,SACjB,UACA,KACA,GAAG,SACD;CAEJ,MAAM,gBAAgB,KACpBA,0BAAO,YACP,SAAS,OAAOA,0BAAO,WACvBA,0BAAO,SACP,SACF;CAEA,MAAM,qBAAqB,WACvB,SAAS,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,QAAQ,GAAG,MAAM,IAAI,GAAG,CAAC,IACtD,KAAA;CAEJ,MAAM,aAAa,gBAAgB;CACnC,MAAM,YAAY,aAAa,IAAI;CAEnC,MAAM,iBAAiB,sBAAsB;CAI7C,MAAM,gBACJ,oBAAC,QAAD;EACE,WAAW,KAAKA,0BAAO,YAAYA,0BAAO,UAAU,SAAS;EAC7D,OAAO;GAAE,OAAO;GAAW,QAAQ;EAAU;EAC7C,eAAA;EACA,OAAA;CACD,CAAA;CAGH,MAAM,QACJ,qBAAC,KAAK,aAAN;EACE,WAAW;EACX,OAAO;EACP,GAAI;EACC;EAJP,UAAA,CAME,oBAAC,OAAD;GACE,OAAO;GACG;GACJ;GACI;EACX,CAAA,GACD,oBAAC,iBAAD;GAAiB,OAAO;GAA+B;GACpD;EACc,CAAA,CACD;;CAGpB,OACE,oBAAC,MAAD;EAAM,IAAI,cAAc;EACtB,UAAA,qBAAC,OAAD;GAAK,WAAW,KAAKA,0BAAO,qBAAqBA,0BAAO,eAAe;GAAvE,UAAA,CACG,aAAa,gBAAgB,OAE7B,cAAc,YACb,oBAAC,kBAAD;IACc;IACF;IACK;GAChB,CAAA,CAEA;;CACD,CAAA;AAEV,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Flex.mjs","names":["styles","Element"],"sources":["../../../../../../../src/components/Flex/Flex.tsx"],"sourcesContent":["import type { CSSProperties, FC, PropsWithChildren } from \"react\";\nimport type {\n PropsWithClassName,\n PropsWithElementType,\n} from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport styles from \"./Flex.module.scss\";\n\nexport interface FlexProps\n extends\n PropsWithChildren,\n PropsWithClassName,\n PropsWithElementType<\n | \"div\"\n | \"aside\"\n | \"ul\"\n | \"li\"\n | \"ol\"\n | \"section\"\n | \"main\"\n | \"span\"\n | \"p\"\n | \"footer\"\n | \"header\"\n > {\n /** The flexDirection value of the element. @default \"row\" */\n direction?: CSSProperties[\"flexDirection\"];\n /** The alignItems value of the element. @default \"start\" */\n align?: \"start\" | \"end\" | \"center\" | \"stretch\" | \"baseline\";\n /** The justifyContent value of the element. @default \"start\" */\n justify?: CSSProperties[\"justifyContent\"];\n /** The gap size of the element. */\n gap?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** The columnGap size of the element. */\n columnGap?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** The rowGap size of the element. */\n rowGap?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** Whether the element should grow. */\n grow?: boolean;\n /** The flexWrap value of the element. @default \"nowrap\" */\n wrap?: CSSProperties[\"flexWrap\"];\n /** The padding of the element. */\n padding?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** The padding top and bottom of the element. Takes precedence over `padding`. */\n paddingBlock?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** The padding left and right of the element. Takes precedence over `padding`. */\n paddingInline?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** The padding top of the element. */\n paddingTop?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** The padding bottom of the element. */\n paddingBottom?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** The padding left of the element. */\n paddingLeft?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** The padding right of the element. */\n paddingRight?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n}\n\ntype FlexSize = \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n\nconst sizeVariable = (size: FlexSize | undefined) =>\n size && `var(--size-px--${size})`;\n\n/** @flr-generate all */\nexport const Flex: FC<FlexProps> = (props) => {\n const {\n children,\n className,\n direction = \"row\",\n align,\n justify,\n gap,\n columnGap,\n rowGap,\n grow,\n wrap = \"nowrap\",\n padding,\n paddingBlock,\n paddingInline,\n paddingTop,\n paddingBottom,\n paddingLeft,\n paddingRight,\n elementType = \"div\",\n ...restProps\n } = props;\n\n const columnGapSize = columnGap ?? gap;\n const rowGapSize = rowGap ?? gap;\n const paddingTopSize = paddingTop ?? paddingBlock ?? padding;\n const paddingBottomSize = paddingBottom ?? paddingBlock ?? padding;\n const paddingLeftSize = paddingLeft ?? paddingInline ?? padding;\n const paddingRightSize = paddingRight ?? paddingInline ?? padding;\n\n const rootClassName = clsx(\n styles.flex,\n align && styles.align,\n justify && styles.justify,\n grow && styles.grow,\n columnGapSize && styles[\"column-gap\"],\n rowGapSize && styles[\"row-gap\"],\n paddingTopSize && styles[\"padding-top\"],\n paddingBottomSize && styles[\"padding-bottom\"],\n paddingLeftSize && styles[\"padding-left\"],\n paddingRightSize && styles[\"padding-right\"],\n className,\n );\n\n const style: CSSProperties = {\n \"--flex--direction\": direction,\n \"--flex--wrap\": wrap,\n \"--flex--align\":\n align === \"end\" ? \"flex-end\" : align === \"start\" ? \"flex-start\" : align,\n \"--flex--justify\": justify,\n \"--flex--column-gap\": sizeVariable(columnGapSize),\n \"--flex--row-gap\": sizeVariable(rowGapSize),\n \"--flex--padding-top\": sizeVariable(paddingTopSize),\n \"--flex--padding-bottom\": sizeVariable(paddingBottomSize),\n \"--flex--padding-left\": sizeVariable(paddingLeftSize),\n \"--flex--padding-right\": sizeVariable(paddingRightSize),\n };\n\n const Element = elementType;\n\n return (\n <Element {...restProps} className={rootClassName} style={style}>\n {children}\n </Element>\n );\n};\nexport default Flex;\n"],"mappings":";;;;;;AA2DA,IAAM,gBAAgB,SACpB,QAAQ,kBAAkB,KAAK;;AAGjC,IAAa,QAAuB,UAAU;CAC5C,MAAM,EACJ,UACA,WACA,YAAY,OACZ,OACA,SACA,KACA,WACA,QACA,MACA,OAAO,UACP,SACA,cACA,eACA,YACA,eACA,aACA,cACA,cAAc,OACd,GAAG,cACD;CAEJ,MAAM,gBAAgB,aAAa;CACnC,MAAM,aAAa,UAAU;CAC7B,MAAM,iBAAiB,cAAc,gBAAgB;CACrD,MAAM,oBAAoB,iBAAiB,gBAAgB;CAC3D,MAAM,kBAAkB,eAAe,iBAAiB;CACxD,MAAM,mBAAmB,gBAAgB,iBAAiB;CAE1D,MAAM,gBAAgB,KACpBA,oBAAO,MACP,SAASA,oBAAO,OAChB,WAAWA,oBAAO,SAClB,QAAQA,oBAAO,MACf,iBAAiBA,oBAAO,eACxB,cAAcA,oBAAO,YACrB,kBAAkBA,oBAAO,gBACzB,qBAAqBA,oBAAO,mBAC5B,mBAAmBA,oBAAO,iBAC1B,oBAAoBA,oBAAO,kBAC3B,SACF;CAEA,MAAM,QAAuB;EAC3B,qBAAqB;EACrB,gBAAgB;EAChB,iBACE,UAAU,QAAQ,aAAa,UAAU,UAAU,eAAe;EACpE,mBAAmB;EACnB,sBAAsB,aAAa,aAAa;EAChD,mBAAmB,aAAa,UAAU;EAC1C,uBAAuB,aAAa,cAAc;EAClD,0BAA0B,aAAa,iBAAiB;EACxD,wBAAwB,aAAa,eAAe;EACpD,yBAAyB,aAAa,gBAAgB;CACxD;CAIA,OACE,oBAACC,aAAD;EAAS,GAAI;EAAW,WAAW;EAAsB;EACtD;CACM,CAAA;AAEb"}
1
+ {"version":3,"file":"Flex.mjs","names":["styles","Element"],"sources":["../../../../../../../src/components/Flex/Flex.tsx"],"sourcesContent":["import type { CSSProperties, FC, PropsWithChildren } from \"react\";\nimport type {\n PropsWithClassName,\n PropsWithElementType,\n} from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport styles from \"./Flex.module.scss\";\n\nexport interface FlexProps\n extends\n PropsWithChildren,\n PropsWithClassName,\n PropsWithElementType<\n | \"div\"\n | \"aside\"\n | \"ul\"\n | \"li\"\n | \"ol\"\n | \"section\"\n | \"main\"\n | \"span\"\n | \"p\"\n | \"footer\"\n | \"header\"\n > {\n /** The flexDirection value of the element. @default \"row\" */\n direction?: CSSProperties[\"flexDirection\"];\n /** The alignItems value of the element. @default \"start\" */\n align?: \"start\" | \"end\" | \"center\" | \"stretch\" | \"baseline\";\n /** The justifyContent value of the element. @default \"start\" */\n justify?: CSSProperties[\"justifyContent\"];\n /** The gap size of the element. */\n gap?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** The columnGap size of the element. */\n columnGap?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** The rowGap size of the element. */\n rowGap?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** Whether the element should grow. */\n grow?: boolean;\n /** The flexWrap value of the element. @default \"nowrap\" */\n wrap?: CSSProperties[\"flexWrap\"];\n /** The padding of the element. */\n padding?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** The padding top and bottom of the element. Takes precedence over `padding`. */\n paddingBlock?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** The padding left and right of the element. Takes precedence over `padding`. */\n paddingInline?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** The padding top of the element. */\n paddingTop?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** The padding bottom of the element. */\n paddingBottom?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** The padding left of the element. */\n paddingLeft?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n /** The padding right of the element. */\n paddingRight?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n}\n\ntype FlexSize = \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n\nconst sizeVariable = (size: FlexSize | undefined) =>\n size && `var(--size-px--${size})`;\n\n/* Plain FC: rendered once per layout box, often once per table cell; the\n * factory measurably slows large trees (1,800 cells with a Flex each: mount\n * +2–45 %, re-render up to +9 %). */\n/** @flr-generate all */\nexport const Flex: FC<FlexProps> = (props) => {\n const {\n children,\n className,\n direction = \"row\",\n align,\n justify,\n gap,\n columnGap,\n rowGap,\n grow,\n wrap = \"nowrap\",\n padding,\n paddingBlock,\n paddingInline,\n paddingTop,\n paddingBottom,\n paddingLeft,\n paddingRight,\n elementType = \"div\",\n ...restProps\n } = props;\n\n const columnGapSize = columnGap ?? gap;\n const rowGapSize = rowGap ?? gap;\n const paddingTopSize = paddingTop ?? paddingBlock ?? padding;\n const paddingBottomSize = paddingBottom ?? paddingBlock ?? padding;\n const paddingLeftSize = paddingLeft ?? paddingInline ?? padding;\n const paddingRightSize = paddingRight ?? paddingInline ?? padding;\n\n const rootClassName = clsx(\n styles.flex,\n align && styles.align,\n justify && styles.justify,\n grow && styles.grow,\n columnGapSize && styles[\"column-gap\"],\n rowGapSize && styles[\"row-gap\"],\n paddingTopSize && styles[\"padding-top\"],\n paddingBottomSize && styles[\"padding-bottom\"],\n paddingLeftSize && styles[\"padding-left\"],\n paddingRightSize && styles[\"padding-right\"],\n className,\n );\n\n const style: CSSProperties = {\n \"--flex--direction\": direction,\n \"--flex--wrap\": wrap,\n \"--flex--align\":\n align === \"end\" ? \"flex-end\" : align === \"start\" ? \"flex-start\" : align,\n \"--flex--justify\": justify,\n \"--flex--column-gap\": sizeVariable(columnGapSize),\n \"--flex--row-gap\": sizeVariable(rowGapSize),\n \"--flex--padding-top\": sizeVariable(paddingTopSize),\n \"--flex--padding-bottom\": sizeVariable(paddingBottomSize),\n \"--flex--padding-left\": sizeVariable(paddingLeftSize),\n \"--flex--padding-right\": sizeVariable(paddingRightSize),\n };\n\n const Element = elementType;\n\n return (\n <Element {...restProps} className={rootClassName} style={style}>\n {children}\n </Element>\n );\n};\nexport default Flex;\n"],"mappings":";;;;;;AA2DA,IAAM,gBAAgB,SACpB,QAAQ,kBAAkB,KAAK;;AAMjC,IAAa,QAAuB,UAAU;CAC5C,MAAM,EACJ,UACA,WACA,YAAY,OACZ,OACA,SACA,KACA,WACA,QACA,MACA,OAAO,UACP,SACA,cACA,eACA,YACA,eACA,aACA,cACA,cAAc,OACd,GAAG,cACD;CAEJ,MAAM,gBAAgB,aAAa;CACnC,MAAM,aAAa,UAAU;CAC7B,MAAM,iBAAiB,cAAc,gBAAgB;CACrD,MAAM,oBAAoB,iBAAiB,gBAAgB;CAC3D,MAAM,kBAAkB,eAAe,iBAAiB;CACxD,MAAM,mBAAmB,gBAAgB,iBAAiB;CAE1D,MAAM,gBAAgB,KACpBA,oBAAO,MACP,SAASA,oBAAO,OAChB,WAAWA,oBAAO,SAClB,QAAQA,oBAAO,MACf,iBAAiBA,oBAAO,eACxB,cAAcA,oBAAO,YACrB,kBAAkBA,oBAAO,gBACzB,qBAAqBA,oBAAO,mBAC5B,mBAAmBA,oBAAO,iBAC1B,oBAAoBA,oBAAO,kBAC3B,SACF;CAEA,MAAM,QAAuB;EAC3B,qBAAqB;EACrB,gBAAgB;EAChB,iBACE,UAAU,QAAQ,aAAa,UAAU,UAAU,eAAe;EACpE,mBAAmB;EACnB,sBAAsB,aAAa,aAAa;EAChD,mBAAmB,aAAa,UAAU;EAC1C,uBAAuB,aAAa,cAAc;EAClD,0BAA0B,aAAa,iBAAiB;EACxD,wBAAwB,aAAa,eAAe;EACpD,yBAAyB,aAAa,gBAAgB;CACxD;CAIA,OACE,oBAACC,aAAD;EAAS,GAAI;EAAW,WAAW;EAAsB;EACtD;CACM,CAAA;AAEb"}
@@ -1,6 +1,7 @@
1
1
  "use client"
2
2
  /* */
3
3
  import { PropsContextProvider } from "../../lib/propsContext/components/PropsContextProvider.mjs";
4
+ import { flowComponent } from "../../lib/componentFactory/flowComponent.mjs";
4
5
  import dynamic from "../../lib/propsContext/dynamicProps/dynamic.mjs";
5
6
  import { containsTextChild } from "../../lib/react/remote.mjs";
6
7
  import { isAlphaColor } from "../../lib/types/props.mjs";
@@ -10,8 +11,8 @@ import clsx from "clsx";
10
11
  import { jsx } from "react/jsx-runtime";
11
12
  // src/components/HeaderNavigation/HeaderNavigation.tsx
12
13
  /** @flr-generate all */
13
- var HeaderNavigation = (props) => {
14
- const { children, className, color = "default", ...rest } = props;
14
+ var HeaderNavigation = flowComponent("HeaderNavigation", (props) => {
15
+ const { children, className, color = "default", ref, ...rest } = props;
15
16
  const rootClassName = clsx(HeaderNavigation_module_default.headerNavigation, isAlphaColor(color) && HeaderNavigation_module_default[color], className);
16
17
  const buttonPropsContext = {
17
18
  className: HeaderNavigation_module_default.button,
@@ -41,6 +42,7 @@ var HeaderNavigation = (props) => {
41
42
  return /* @__PURE__ */ jsx("nav", {
42
43
  className: rootClassName,
43
44
  role: "navigation",
45
+ ref,
44
46
  ...rest,
45
47
  children: /* @__PURE__ */ jsx("ul", {
46
48
  className: HeaderNavigation_module_default.list,
@@ -50,7 +52,7 @@ var HeaderNavigation = (props) => {
50
52
  })
51
53
  })
52
54
  });
53
- };
55
+ });
54
56
  export { HeaderNavigation, HeaderNavigation as default };
55
57
 
56
58
  //# sourceMappingURL=HeaderNavigation.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderNavigation.mjs","names":["styles"],"sources":["../../../../../../../src/components/HeaderNavigation/HeaderNavigation.tsx"],"sourcesContent":["import type { ComponentProps, FC, PropsWithChildren } from \"react\";\nimport {\n dynamic,\n type PropsContext,\n PropsContextProvider,\n} from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport styles from \"./HeaderNavigation.module.scss\";\nimport {\n type AlphaColor,\n isAlphaColor,\n type PropsWithClassName,\n} from \"@/lib/types/props\";\nimport { Text } from \"@/components/Text\";\nimport { containsTextChild } from \"@/lib/react/remote\";\n\nexport interface HeaderNavigationProps\n extends PropsWithChildren<ComponentProps<\"nav\">>, PropsWithClassName {\n /** The color of the header navigation. @default \"default\" */\n color?: \"default\" | AlphaColor;\n}\n\n/** @flr-generate all */\nexport const HeaderNavigation: FC<HeaderNavigationProps> = (props) => {\n const { children, className, color = \"default\", ...rest } = props;\n\n const rootClassName = clsx(\n styles.headerNavigation,\n isAlphaColor(color) && styles[color],\n className,\n );\n\n const buttonPropsContext = {\n className: styles.button,\n color: isAlphaColor(color) ? color : \"secondary\",\n variant: \"plain\",\n } as const;\n\n const propsContext: PropsContext = {\n Link: {\n wrapWith: <li className={styles.item} />,\n className: styles.link,\n unstyled: true,\n /**\n * `Text` clears the props context, so a link combined with a button must\n * not get it — the button would lose the context of `Link`.\n */\n children: dynamic((props) =>\n containsTextChild(props.children) ? (\n <Text emulateBoldWidth>{props.children}</Text>\n ) : (\n props.children\n ),\n ),\n Button: buttonPropsContext,\n },\n Button: {\n ...buttonPropsContext,\n wrapWith: <li className={styles.item} />,\n },\n };\n\n return (\n <nav className={rootClassName} role=\"navigation\" {...rest}>\n <ul className={styles.list}>\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n </ul>\n </nav>\n );\n};\n\nexport default HeaderNavigation;\n"],"mappings":";;;;;;;;;;;;AAuBA,IAAa,oBAA+C,UAAU;CACpE,MAAM,EAAE,UAAU,WAAW,QAAQ,WAAW,GAAG,SAAS;CAE5D,MAAM,gBAAgB,KACpBA,gCAAO,kBACP,aAAa,KAAK,KAAKA,gCAAO,QAC9B,SACF;CAEA,MAAM,qBAAqB;EACzB,WAAWA,gCAAO;EAClB,OAAO,aAAa,KAAK,IAAI,QAAQ;EACrC,SAAS;CACX;CAEA,MAAM,eAA6B;EACjC,MAAM;GACJ,UAAU,oBAAC,MAAD,EAAI,WAAWA,gCAAO,KAAO,CAAA;GACvC,WAAWA,gCAAO;GAClB,UAAU;;;;;GAKV,UAAU,SAAS,UACjB,kBAAkB,MAAM,QAAQ,IAC9B,oBAAC,MAAD;IAAM,kBAAA;IAAkB,UAAA,MAAM;GAAe,CAAA,IAE7C,MAAM,QAEV;GACA,QAAQ;EACV;EACA,QAAQ;GACN,GAAG;GACH,UAAU,oBAAC,MAAD,EAAI,WAAWA,gCAAO,KAAO,CAAA;EACzC;CACF;CAEA,OACE,oBAAC,OAAD;EAAK,WAAW;EAAe,MAAK;EAAa,GAAI;EACnD,UAAA,oBAAC,MAAD;GAAI,WAAWA,gCAAO;GACpB,UAAA,oBAAC,sBAAD;IAAsB,OAAO;IAC1B;GACmB,CAAA;EACpB,CAAA;CACD,CAAA;AAET"}
1
+ {"version":3,"file":"HeaderNavigation.mjs","names":["styles"],"sources":["../../../../../../../src/components/HeaderNavigation/HeaderNavigation.tsx"],"sourcesContent":["import type { ComponentProps, PropsWithChildren } from \"react\";\nimport {\n dynamic,\n type PropsContext,\n PropsContextProvider,\n} from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport styles from \"./HeaderNavigation.module.scss\";\nimport {\n type AlphaColor,\n isAlphaColor,\n type PropsWithClassName,\n} from \"@/lib/types/props\";\nimport { Text } from \"@/components/Text\";\nimport { containsTextChild } from \"@/lib/react/remote\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\n\nexport interface HeaderNavigationProps\n extends\n PropsWithChildren<ComponentProps<\"nav\">>,\n PropsWithClassName,\n FlowComponentProps<HTMLElement> {\n /** The color of the header navigation. @default \"default\" */\n color?: \"default\" | AlphaColor;\n}\n\n/** @flr-generate all */\nexport const HeaderNavigation = flowComponent(\"HeaderNavigation\", (props) => {\n const { children, className, color = \"default\", ref, ...rest } = props;\n\n const rootClassName = clsx(\n styles.headerNavigation,\n isAlphaColor(color) && styles[color],\n className,\n );\n\n const buttonPropsContext = {\n className: styles.button,\n color: isAlphaColor(color) ? color : \"secondary\",\n variant: \"plain\",\n } as const;\n\n const propsContext: PropsContext = {\n Link: {\n wrapWith: <li className={styles.item} />,\n className: styles.link,\n unstyled: true,\n /**\n * `Text` clears the props context, so a link combined with a button must\n * not get it — the button would lose the context of `Link`.\n */\n children: dynamic((props) =>\n containsTextChild(props.children) ? (\n <Text emulateBoldWidth>{props.children}</Text>\n ) : (\n props.children\n ),\n ),\n Button: buttonPropsContext,\n },\n Button: {\n ...buttonPropsContext,\n wrapWith: <li className={styles.item} />,\n },\n };\n\n return (\n <nav className={rootClassName} role=\"navigation\" ref={ref} {...rest}>\n <ul className={styles.list}>\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n </ul>\n </nav>\n );\n});\n\nexport default HeaderNavigation;\n"],"mappings":";;;;;;;;;;;;;AA4BA,IAAa,mBAAmB,cAAc,qBAAqB,UAAU;CAC3E,MAAM,EAAE,UAAU,WAAW,QAAQ,WAAW,KAAK,GAAG,SAAS;CAEjE,MAAM,gBAAgB,KACpBA,gCAAO,kBACP,aAAa,KAAK,KAAKA,gCAAO,QAC9B,SACF;CAEA,MAAM,qBAAqB;EACzB,WAAWA,gCAAO;EAClB,OAAO,aAAa,KAAK,IAAI,QAAQ;EACrC,SAAS;CACX;CAEA,MAAM,eAA6B;EACjC,MAAM;GACJ,UAAU,oBAAC,MAAD,EAAI,WAAWA,gCAAO,KAAO,CAAA;GACvC,WAAWA,gCAAO;GAClB,UAAU;;;;;GAKV,UAAU,SAAS,UACjB,kBAAkB,MAAM,QAAQ,IAC9B,oBAAC,MAAD;IAAM,kBAAA;IAAkB,UAAA,MAAM;GAAe,CAAA,IAE7C,MAAM,QAEV;GACA,QAAQ;EACV;EACA,QAAQ;GACN,GAAG;GACH,UAAU,oBAAC,MAAD,EAAI,WAAWA,gCAAO,KAAO,CAAA;EACzC;CACF;CAEA,OACE,oBAAC,OAAD;EAAK,WAAW;EAAe,MAAK;EAAkB;EAAK,GAAI;EAC7D,UAAA,oBAAC,MAAD;GAAI,WAAWA,gCAAO;GACpB,UAAA,oBAAC,sBAAD;IAAsB,OAAO;IAC1B;GACmB,CAAA;EACpB,CAAA;CACD,CAAA;AAET,CAAC"}
@@ -1,5 +1,6 @@
1
1
  "use client"
2
2
  /* */
3
+ import { flowComponent } from "../../lib/componentFactory/flowComponent.mjs";
3
4
  import { SkeletonModeReset, useSkeletonMode } from "../SkeletonMode/skeletonModeContext.mjs";
4
5
  import { IconDanger } from "../Icon/components/icons/IconDanger.mjs";
5
6
  import { useLocalizedStringFormatter } from "../TranslationProvider/useLocalizedStringFormatter.mjs";
@@ -20,8 +21,8 @@ import { useDebouncedCallback } from "use-debounce";
20
21
  * @flr-generate all
21
22
  * @flowStatus new
22
23
  */
23
- var ImageCropper = (props) => {
24
- const { image, className, onCropComplete, onError, errorView, width = 300, height = 300, aspectRatio, ...rest } = props;
24
+ var ImageCropper = flowComponent("ImageCropper", (props) => {
25
+ const { image, className, onCropComplete, onError, errorView, width = 300, height = 300, aspectRatio, ref, ...rest } = props;
25
26
  const imageSrc = useImageSrc(image);
26
27
  const [mediaLoaded, setMediaLoaded] = useState(false);
27
28
  const [error, setError] = useState();
@@ -86,6 +87,7 @@ var ImageCropper = (props) => {
86
87
  ...rest
87
88
  });
88
89
  return /* @__PURE__ */ jsx("div", {
90
+ ref,
89
91
  className: rootClassName,
90
92
  style: { width },
91
93
  inert: isSkeleton || void 0,
@@ -103,7 +105,7 @@ var ImageCropper = (props) => {
103
105
  "aria-label": stringFormatter.format("zoom")
104
106
  })] })
105
107
  });
106
- };
108
+ });
107
109
  export { ImageCropper, ImageCropper as default };
108
110
 
109
111
  //# sourceMappingURL=ImageCropper.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ImageCropper.mjs","names":["locales","styles"],"sources":["../../../../../../../src/components/ImageCropper/ImageCropper.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type FC,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport Cropper, { type Area, type CropperProps } from \"react-easy-crop\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport styles from \"./ImageCropper.module.scss\";\nimport { Slider } from \"@/components/Slider\";\nimport { getCroppedImageFile } from \"@/components/ImageCropper/lib/getCroppedImageFile\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider/useLocalizedStringFormatter\";\nimport locales from \"./locales/*.locale.json\";\nimport { useImageSrc } from \"@/lib/hooks/useImageSrc\";\nimport { useDebouncedCallback } from \"use-debounce\";\nimport { IllustratedMessage } from \"@/components/IllustratedMessage\";\nimport { IconDanger } from \"@/components/Icon/components/icons\";\nimport { Text } from \"@/components/Text\";\nimport {\n SkeletonModeReset,\n useSkeletonMode,\n} from \"@/components/SkeletonMode/skeletonModeContext\";\n\n/** Why an {@link ImageCropper} cannot work with the given image. */\nexport interface ImageCropperError {\n /**\n * `\"load\"` — the image itself could not be loaded. `\"crop\"` — the image is\n * displayed, but reading it into a canvas to produce the cropped file failed\n * (a cross-origin image without CORS headers, for example).\n */\n reason: \"load\" | \"crop\";\n /** Technical message, meant for logging — not for display. */\n message: string;\n}\n\nexport interface ImageCropperProps\n extends PropsWithClassName, Partial<Pick<CropperProps, \"cropShape\">> {\n /** The image file to crop. */\n image?: File | string;\n /** Callback on crop complete. */\n onCropComplete?: (croppedImage: File) => void;\n /**\n * Callback when the image cannot be cropped, because it failed to load or\n * could not be read.\n */\n onError?: (error: ImageCropperError) => void;\n /**\n * View that is shown instead of the cropper when the image cannot be cropped.\n * Defaults to a localized error message.\n */\n errorView?: ReactNode;\n /** The width of the component. @default 300 */\n width?: CSSProperties[\"width\"];\n /** The height of the component. @default 300 */\n height?: CSSProperties[\"height\"];\n /** The aspect ratio of the crop shape. */\n aspectRatio?: number;\n}\n\n/**\n * @flr-generate all\n * @flowStatus new\n */\nexport const ImageCropper: FC<ImageCropperProps> = (props) => {\n const {\n image,\n className,\n onCropComplete,\n onError,\n errorView,\n width = 300,\n height = 300,\n aspectRatio,\n ...rest\n } = props;\n\n const imageSrc = useImageSrc(image);\n\n const [mediaLoaded, setMediaLoaded] = useState(false);\n const [error, setError] = useState<ImageCropperError>();\n const [crop, setCrop] = useState({ x: 0, y: 0 });\n const [zoom, setZoom] = useState(1);\n\n /** Reports every image at most once, no matter how many crops fail on it. */\n const errorReported = useRef(false);\n\n const stringFormatter = useLocalizedStringFormatter(locales, \"ImageCropper\");\n const isSkeleton = useSkeletonMode();\n\n const rootClassName = clsx(\n styles.imageCropper,\n isSkeleton && styles.skeleton,\n className,\n );\n\n const reportError = (\n reason: ImageCropperError[\"reason\"],\n message: string,\n ): void => {\n if (errorReported.current) {\n return;\n }\n errorReported.current = true;\n\n const imageCropperError: ImageCropperError = { reason, message };\n setError(imageCropperError);\n onError?.(imageCropperError);\n };\n\n const debouncedCropComplete = useDebouncedCallback(\n async (croppedAreaPixels: Area) => {\n if (!croppedAreaPixels) {\n return;\n }\n\n let croppedImageFile: File;\n\n try {\n croppedImageFile = await getCroppedImageFile(\n imageSrc,\n image ?? \"\",\n croppedAreaPixels,\n );\n } catch (cause) {\n reportError(\n \"crop\",\n cause instanceof Error ? cause.message : String(cause),\n );\n return;\n }\n\n onCropComplete?.(croppedImageFile);\n },\n 500,\n {\n leading: true,\n },\n );\n\n useEffect(() => {\n setMediaLoaded(false);\n setError(undefined);\n errorReported.current = false;\n }, [imageSrc]);\n\n const defaultErrorView = (\n <IllustratedMessage color=\"danger\">\n <IconDanger />\n <Text>{stringFormatter.format(\"error.text\")}</Text>\n </IllustratedMessage>\n );\n\n const errorElement = error ? (errorView ?? defaultErrorView) : undefined;\n\n const errorContainer = (\n <div className={styles.errorViewContainer}>{errorElement}</div>\n );\n\n const cropper = (\n <Cropper\n style={{\n containerStyle: {\n borderRadius: \"calc(var(--image-cropper--corner-radius) - 1px)\",\n },\n }}\n aspect={aspectRatio}\n crop={crop}\n image={imageSrc}\n onCropChange={setCrop}\n zoom={zoom}\n onZoomChange={setZoom}\n mediaProps={{\n onError: () =>\n reportError(\"load\", `Failed to load image \"${imageSrc}\"`),\n }}\n onMediaLoaded={() => setMediaLoaded(true)}\n onCropComplete={(_, croppedAreaPixels) => {\n if (mediaLoaded) {\n debouncedCropComplete(croppedAreaPixels);\n }\n }}\n {...rest}\n />\n );\n\n return (\n <div\n className={rootClassName}\n style={{ width }}\n inert={isSkeleton || undefined}\n >\n <SkeletonModeReset>\n <div className={styles.cropperContainer} style={{ height }}>\n {/* The skeleton is one surface in the size of cropper and slider.\n It mounts no cropper, so the image is not loaded. */}\n {!isSkeleton && (errorElement ? errorContainer : cropper)}\n </div>\n {!errorElement && (\n <Slider\n minValue={1}\n maxValue={3}\n step={0.01}\n value={zoom}\n sliderOnly\n onChange={(zoom) => setZoom(zoom as number)}\n aria-label={stringFormatter.format(\"zoom\")}\n />\n )}\n </SkeletonModeReset>\n </div>\n );\n};\n\nexport default ImageCropper;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkEA,IAAa,gBAAuC,UAAU;CAC5D,MAAM,EACJ,OACA,WACA,gBACA,SACA,WACA,QAAQ,KACR,SAAS,KACT,aACA,GAAG,SACD;CAEJ,MAAM,WAAW,YAAY,KAAK;CAElC,MAAM,CAAC,aAAa,kBAAkB,SAAS,KAAK;CACpD,MAAM,CAAC,OAAO,YAAY,SAA4B;CACtD,MAAM,CAAC,MAAM,WAAW,SAAS;EAAE,GAAG;EAAG,GAAG;CAAE,CAAC;CAC/C,MAAM,CAAC,MAAM,WAAW,SAAS,CAAC;;CAGlC,MAAM,gB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AG,sBAAsB;GACxC,IAAI,aACF,sBAAsB,iBAAiB;EAE3C;EACA,GAAI;CACL,CAAA;CAGH,OACE,oBAAC,OAAD;EACE,WAAW;EACX,OAAO,EAAE,MAAM;EACf,OAAO,cAAc,KAAA;EAErB,UAAA,qBAAC,mBAAD,EAAA,UAAA,CACE,oBAAC,OAAD;GAAK,WAAWA,4BAAO;GAAkB,OAAO,EAAE,OAAO;GAGtD,UAAA,CAAC,eAAe,eAAe,iBAAiB;EAC9C,CAAA,GACJ,CAAC,gBACA,oBAAC,QAAD;GACE,UAAU;GACV,UAAU;GACV,MAAM;GACN,OAAO;GACP,YAAA;GACA,WAAW,SAAS,QAAQ,IAAc;GAC1C,cAAY,gBAAgB,OAAO,MAAM;EAC1C,CAAA,CAEc,EAAA,CAAA;CAChB,CAAA;AAET"}
1
+ {"version":3,"file":"ImageCropper.mjs","names":["locales","styles"],"sources":["../../../../../../../src/components/ImageCropper/ImageCropper.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport Cropper, { type Area, type CropperProps } from \"react-easy-crop\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport clsx from \"clsx\";\nimport styles from \"./ImageCropper.module.scss\";\nimport { Slider } from \"@/components/Slider\";\nimport { getCroppedImageFile } from \"@/components/ImageCropper/lib/getCroppedImageFile\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider/useLocalizedStringFormatter\";\nimport locales from \"./locales/*.locale.json\";\nimport { useImageSrc } from \"@/lib/hooks/useImageSrc\";\nimport { useDebouncedCallback } from \"use-debounce\";\nimport { IllustratedMessage } from \"@/components/IllustratedMessage\";\nimport { IconDanger } from \"@/components/Icon/components/icons\";\nimport { Text } from \"@/components/Text\";\nimport {\n SkeletonModeReset,\n useSkeletonMode,\n} from \"@/components/SkeletonMode/skeletonModeContext\";\n\n/** Why an {@link ImageCropper} cannot work with the given image. */\nexport interface ImageCropperError {\n /**\n * `\"load\"` — the image itself could not be loaded. `\"crop\"` — the image is\n * displayed, but reading it into a canvas to produce the cropped file failed\n * (a cross-origin image without CORS headers, for example).\n */\n reason: \"load\" | \"crop\";\n /** Technical message, meant for logging — not for display. */\n message: string;\n}\n\nexport interface ImageCropperProps\n extends\n PropsWithClassName,\n FlowComponentProps,\n Partial<Pick<CropperProps, \"cropShape\">> {\n /** The image file to crop. */\n image?: File | string;\n /** Callback on crop complete. */\n onCropComplete?: (croppedImage: File) => void;\n /**\n * Callback when the image cannot be cropped, because it failed to load or\n * could not be read.\n */\n onError?: (error: ImageCropperError) => void;\n /**\n * View that is shown instead of the cropper when the image cannot be cropped.\n * Defaults to a localized error message.\n */\n errorView?: ReactNode;\n /** The width of the component. @default 300 */\n width?: CSSProperties[\"width\"];\n /** The height of the component. @default 300 */\n height?: CSSProperties[\"height\"];\n /** The aspect ratio of the crop shape. */\n aspectRatio?: number;\n children?: never;\n}\n\n/**\n * @flr-generate all\n * @flowStatus new\n */\nexport const ImageCropper = flowComponent(\"ImageCropper\", (props) => {\n const {\n image,\n className,\n onCropComplete,\n onError,\n errorView,\n width = 300,\n height = 300,\n aspectRatio,\n ref,\n ...rest\n } = props;\n\n const imageSrc = useImageSrc(image);\n\n const [mediaLoaded, setMediaLoaded] = useState(false);\n const [error, setError] = useState<ImageCropperError>();\n const [crop, setCrop] = useState({ x: 0, y: 0 });\n const [zoom, setZoom] = useState(1);\n\n /** Reports every image at most once, no matter how many crops fail on it. */\n const errorReported = useRef(false);\n\n const stringFormatter = useLocalizedStringFormatter(locales, \"ImageCropper\");\n const isSkeleton = useSkeletonMode();\n\n const rootClassName = clsx(\n styles.imageCropper,\n isSkeleton && styles.skeleton,\n className,\n );\n\n const reportError = (\n reason: ImageCropperError[\"reason\"],\n message: string,\n ): void => {\n if (errorReported.current) {\n return;\n }\n errorReported.current = true;\n\n const imageCropperError: ImageCropperError = { reason, message };\n setError(imageCropperError);\n onError?.(imageCropperError);\n };\n\n const debouncedCropComplete = useDebouncedCallback(\n async (croppedAreaPixels: Area) => {\n if (!croppedAreaPixels) {\n return;\n }\n\n let croppedImageFile: File;\n\n try {\n croppedImageFile = await getCroppedImageFile(\n imageSrc,\n image ?? \"\",\n croppedAreaPixels,\n );\n } catch (cause) {\n reportError(\n \"crop\",\n cause instanceof Error ? cause.message : String(cause),\n );\n return;\n }\n\n onCropComplete?.(croppedImageFile);\n },\n 500,\n {\n leading: true,\n },\n );\n\n useEffect(() => {\n setMediaLoaded(false);\n setError(undefined);\n errorReported.current = false;\n }, [imageSrc]);\n\n const defaultErrorView = (\n <IllustratedMessage color=\"danger\">\n <IconDanger />\n <Text>{stringFormatter.format(\"error.text\")}</Text>\n </IllustratedMessage>\n );\n\n const errorElement = error ? (errorView ?? defaultErrorView) : undefined;\n\n const errorContainer = (\n <div className={styles.errorViewContainer}>{errorElement}</div>\n );\n\n const cropper = (\n <Cropper\n style={{\n containerStyle: {\n borderRadius: \"calc(var(--image-cropper--corner-radius) - 1px)\",\n },\n }}\n aspect={aspectRatio}\n crop={crop}\n image={imageSrc}\n onCropChange={setCrop}\n zoom={zoom}\n onZoomChange={setZoom}\n mediaProps={{\n onError: () =>\n reportError(\"load\", `Failed to load image \"${imageSrc}\"`),\n }}\n onMediaLoaded={() => setMediaLoaded(true)}\n onCropComplete={(_, croppedAreaPixels) => {\n if (mediaLoaded) {\n debouncedCropComplete(croppedAreaPixels);\n }\n }}\n {...rest}\n />\n );\n\n return (\n <div\n ref={ref}\n className={rootClassName}\n style={{ width }}\n inert={isSkeleton || undefined}\n >\n <SkeletonModeReset>\n <div className={styles.cropperContainer} style={{ height }}>\n {/* The skeleton is one surface in the size of cropper and slider.\n It mounts no cropper, so the image is not loaded. */}\n {!isSkeleton && (errorElement ? errorContainer : cropper)}\n </div>\n {!errorElement && (\n <Slider\n minValue={1}\n maxValue={3}\n step={0.01}\n value={zoom}\n sliderOnly\n onChange={(zoom) => setZoom(zoom as number)}\n aria-label={stringFormatter.format(\"zoom\")}\n />\n )}\n </SkeletonModeReset>\n </div>\n );\n});\n\nexport default ImageCropper;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuEA,IAAa,eAAe,cAAc,iBAAiB,UAAU;CACnE,MAAM,EACJ,OACA,WACA,gBACA,SACA,WACA,QAAQ,KACR,SAAS,KACT,aACA,KACA,GAAG,SACD;CAEJ,MAAM,WAAW,YAAY,KAAK;CAElC,MAAM,CAAC,aAAa,kBAAkB,SAAS,KAAK;CACpD,MAAM,CAAC,OAAO,YAAY,SAA4B;CACtD,MAAM,CAAC,MAAM,WAAW,SAAS;EAAE,GAAG;EAAG,GAAG;CAAE,CAAC;CAC/C,MAAM,CAAC,MAAM,WAAW,SAAS,CAAC;;CAGlC,MAAM,gBAAgB,OAAO,KAAK;CAElC,MAAM,kBAAkB,4BAA4BA,kBAAS,cAAc;CAC3E,MAAM,aAAa,gBAAgB;CAEnC,MAAM,gBAAgB,KACpBC,4BAAO,cACP,cAAcA,4BAAO,UACrB,SACF;CAEA,MAAM,eACJ,QACA,YACS;EACT,IAAI,cAAc,SAChB;EAEF,cAAc,UAAU;EAExB,MAAM,oBAAuC;GAAE;GAAQ;EAAQ;EAC/D,SAAS,iBAAiB;EAC1B,UAAU,iBAAiB;CAC7B;CAEA,MAAM,wBAAwB,qBAC5B,OAAO,sBAA4B;EACjC,IAAI,CAAC,mBACH;EAGF,IAAI;EAEJ,IAAI;GACF,mBAAmB,MAAM,oBACvB,UACA,SAAS,IACT,iBACF;EACF,SAAS,OAAO;GACd,YACE,QACA,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CACvD;GACA;EACF;EAEA,iBAAiB,gBAAgB;CACnC,GACA,KACA,EACE,SAAS,KACX,CACF;CAEA,gBAAgB;EACd,eAAe,KAAK;EACpB,SAAS,KAAA,CAAS;EAClB,cAAc,UAAU;CAC1B,GAAG,CAAC,QAAQ,CAAC;CAEb,MAAM,mBACJ,qBAAC,oBAAD;EAAoB,OAAM;EAA1B,UAAA,CACE,oBAAC,YAAD,CAAa,CAAA,GACb,oBAAC,MAAD,EAAA,UAAO,gBAAgB,OAAO,YAAY,EAAQ,CAAA,CAChC;;CAGtB,MAAM,eAAe,QAAS,aAAa,mBAAoB,KAAA;CAE/D,MAAM,iBACJ,oBAAC,OAAD;EAAK,WAAWA,4BAAO;EAAqB,UAAA;CAAkB,CAAA;CAGhE,MAAM,UACJ,oBAAC,SAAD;EACE,OAAO,EACL,gBAAgB,EACd,cAAc,kDAChB,EACF;EACA,QAAQ;EACF;EACN,OAAO;EACP,cAAc;EACR;EACN,cAAc;EACd,YAAY,EACV,eACE,YAAY,QAAQ,yBAAyB,SAAS,EAAE,EAC5D;EACA,qBAAqB,eAAe,IAAI;EACxC,iBAAiB,GAAG,sBAAsB;GACxC,IAAI,aACF,sBAAsB,iBAAiB;EAE3C;EACA,GAAI;CACL,CAAA;CAGH,OACE,oBAAC,OAAD;EACO;EACL,WAAW;EACX,OAAO,EAAE,MAAM;EACf,OAAO,cAAc,KAAA;EAErB,UAAA,qBAAC,mBAAD,EAAA,UAAA,CACE,oBAAC,OAAD;GAAK,WAAWA,4BAAO;GAAkB,OAAO,EAAE,OAAO;GAGtD,UAAA,CAAC,eAAe,eAAe,iBAAiB;EAC9C,CAAA,GACJ,CAAC,gBACA,oBAAC,QAAD;GACE,UAAU;GACV,UAAU;GACV,MAAM;GACN,OAAO;GACP,YAAA;GACA,WAAW,SAAS,QAAQ,IAAc;GAC1C,cAAY,gBAAgB,OAAO,MAAM;EAC1C,CAAA,CAEc,EAAA,CAAA;CAChB,CAAA;AAET,CAAC"}
@@ -1,19 +1,21 @@
1
1
  "use client"
2
2
  /* */
3
+ import { flowComponent } from "../../lib/componentFactory/flowComponent.mjs";
3
4
  import Legend_module_default from "./Legend.module.mjs";
4
5
  import clsx from "clsx";
5
6
  import { jsx } from "react/jsx-runtime";
6
7
  // src/components/Legend/Legend.tsx
7
8
  /** @flr-generate all */
8
- var Legend = (props) => {
9
- const { children, className, ...rest } = props;
9
+ var Legend = flowComponent("Legend", (props) => {
10
+ const { children, className, ref, ...rest } = props;
10
11
  const rootClassName = clsx(Legend_module_default.legend, className);
11
12
  return /* @__PURE__ */ jsx("ul", {
13
+ ref,
12
14
  className: rootClassName,
13
15
  ...rest,
14
16
  children
15
17
  });
16
- };
18
+ }, { type: "layout" });
17
19
  export { Legend, Legend as default };
18
20
 
19
21
  //# sourceMappingURL=Legend.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Legend.mjs","names":["styles"],"sources":["../../../../../../../src/components/Legend/Legend.tsx"],"sourcesContent":["import type { PropsWithClassName } from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport type { FC, PropsWithChildren } from \"react\";\nimport styles from \"./Legend.module.scss\";\n\nexport type LegendProps = PropsWithChildren & PropsWithClassName;\n\n/** @flr-generate all */\nexport const Legend: FC<LegendProps> = (props) => {\n const { children, className, ...rest } = props;\n\n const rootClassName = clsx(styles.legend, className);\n\n return (\n <ul className={rootClassName} {...rest}>\n {children}\n </ul>\n );\n};\n\nexport default Legend;\n"],"mappings":";;;;;;;AAQA,IAAa,UAA2B,UAAU;CAChD,MAAM,EAAE,UAAU,WAAW,GAAG,SAAS;CAEzC,MAAM,gBAAgB,KAAKA,sBAAO,QAAQ,SAAS;CAEnD,OACE,oBAAC,MAAD;EAAI,WAAW;EAAe,GAAI;EAC/B;CACC,CAAA;AAER"}
1
+ {"version":3,"file":"Legend.mjs","names":["styles"],"sources":["../../../../../../../src/components/Legend/Legend.tsx"],"sourcesContent":["import type { PropsWithClassName } from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport type { PropsWithChildren } from \"react\";\nimport styles from \"./Legend.module.scss\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\n\nexport interface LegendProps\n extends\n PropsWithChildren,\n PropsWithClassName,\n FlowComponentProps<HTMLUListElement> {}\n\n/** @flr-generate all */\nexport const Legend = flowComponent(\n \"Legend\",\n (props) => {\n const { children, className, ref, ...rest } = props;\n\n const rootClassName = clsx(styles.legend, className);\n\n return (\n <ul ref={ref} className={rootClassName} {...rest}>\n {children}\n </ul>\n );\n },\n /* Outer `Text` props contexts (e.g. the content color of `AccentBox`) keep\n reaching the item texts. */\n { type: \"layout\" },\n);\n\nexport default Legend;\n"],"mappings":";;;;;;;;AAcA,IAAa,SAAS,cACpB,WACC,UAAU;CACT,MAAM,EAAE,UAAU,WAAW,KAAK,GAAG,SAAS;CAE9C,MAAM,gBAAgB,KAAKA,sBAAO,QAAQ,SAAS;CAEnD,OACE,oBAAC,MAAD;EAAS;EAAK,WAAW;EAAe,GAAI;EACzC;CACC,CAAA;AAER,GAGA,EAAE,MAAM,SAAS,CACnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ItemView.mjs","names":[],"sources":["../../../../../../../../../src/components/List/model/item/ItemView.ts"],"sourcesContent":["import type {\n DependencyList,\n HTMLAttributeAnchorTarget,\n ReactElement,\n ReactNode,\n} from \"react\";\nimport { createElement } from \"react\";\nimport type { RenderItemFn } from \"@/components/List/model/item/types\";\nimport type List from \"@/components/List/model/List\";\nimport { isShallowEqual } from \"remeda\";\n\nexport interface ItemViewShape<T> {\n /**\n * Runs on every render of the list to tell whether the item changed, so it\n * should be cheap and pure.\n */\n textValue?: (data: T) => string;\n /**\n * Runs on every render of the list to tell whether the item changed, so it\n * should be cheap and pure.\n */\n href?: (data: T) => string;\n target?: HTMLAttributeAnchorTarget;\n defaultExpanded?: (data: T) => boolean;\n renderFn?: RenderItemFn<T>;\n /** @deprecated Use loadingView instead */\n fallback?: ReactElement;\n loadingView?: ReactElement;\n showList?: boolean;\n showTiles?: boolean;\n tileMaxWidth?: number;\n /**\n * Everything the render function reads besides the item's data.\n *\n * With `renderDependencies`, an item re-renders only when its data or one of\n * these values changes. The render function's identity no longer counts, so a\n * function written inline in JSX keeps the item from re-rendering on every\n * render of its parent. List every value it reads from outside the item,\n * including state read through the `list` argument — one left out keeps the\n * item on the value it last rendered.\n *\n * Without it, an item re-renders whenever its render function changes\n * identity, which an inline function does on every render of its parent.\n */\n renderDependencies?: DependencyList;\n /**\n * @deprecated Use `renderDependencies` instead. `dependencies` only adds to\n * the render function's identity, so an inline render function still\n * re-renders the item on every render of its parent.\n */\n dependencies?: DependencyList;\n}\n\nexport class ItemView<T> {\n public readonly list: List<T>;\n public readonly textValue?: (data: T) => string;\n public readonly href?: (data: T) => string;\n public readonly target?: HTMLAttributeAnchorTarget;\n public readonly defaultExpanded?: (data: T) => boolean;\n public readonly loadingView?: ReactElement;\n public readonly showTiles?: boolean;\n public readonly showList?: boolean;\n public readonly tileMaxWidth: number;\n public readonly renderDependencies?: DependencyList;\n public readonly dependencies?: DependencyList;\n private readonly renderFn?: RenderItemFn<T>;\n private lastComparison?: { other: ItemView<T>; result: boolean };\n\n public constructor(list: List<T>, shape: ItemViewShape<T> = {}) {\n const {\n fallback,\n loadingView = fallback,\n textValue,\n href,\n target,\n defaultExpanded,\n renderFn,\n showTiles,\n showList = true,\n tileMaxWidth = 230,\n renderDependencies,\n dependencies,\n } = shape;\n this.list = list;\n this.textValue = textValue;\n this.renderFn = renderFn;\n this.href = href;\n this.target = target;\n this.defaultExpanded = defaultExpanded;\n this.loadingView = loadingView;\n this.showTiles = showTiles;\n this.showList = showList;\n this.tileMaxWidth = tileMaxWidth;\n this.renderDependencies = renderDependencies;\n this.dependencies = dependencies;\n }\n\n private static fallbackRenderItemFn: RenderItemFn<never> = (item) =>\n createElement(\"pre\", undefined, JSON.stringify(item));\n\n /**\n * Whether `other` would render the item holding `data` identically. The\n * render function counts by its `renderDependencies` where given, otherwise\n * by its identity and the deprecated `dependencies`. `textValue` and `href`\n * count by what they return for `data`, so inline functions do not re-render\n * the item. `defaultExpanded` is read on mount only, so it does not count at\n * all.\n */\n public rendersSameFor(other: ItemView<T> | undefined, data: T): boolean {\n return (\n !!other &&\n this.rendersSameContentAs(other) &&\n this.textValue?.(data) === other.textValue?.(data) &&\n this.href?.(data) === other.href?.(data) &&\n this.target === other.target\n );\n }\n\n // Every item of a render shares one item view, so the result is cached for\n // the last `other`.\n private rendersSameContentAs(other: ItemView<T>): boolean {\n if (this.lastComparison?.other !== other) {\n this.lastComparison = {\n other,\n result:\n this.renderDependencies || other.renderDependencies\n ? isShallowEqual(this.renderDependencies, other.renderDependencies)\n : this.renderFn === other.renderFn &&\n isShallowEqual(this.dependencies, other.dependencies),\n };\n }\n return this.lastComparison.result;\n }\n\n public render(data: T): ReactNode {\n const renderFn = (this.renderFn ??\n ItemView.fallbackRenderItemFn) as RenderItemFn<T>;\n return renderFn(data as never, this.list);\n }\n}\n"],"mappings":";;;;;AAqDA,IAAa,WAAb,MAAa,SAAY;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAmB,MAAe,QAA0B,CAAC,GAAG;EAC9D,MAAM,EACJ,UACA,cAAc,UACd,WACA,MACA,QACA,iBACA,UACA,WACA,WAAW,MACX,eAAe,KACf,oBACA,iBACE;EACJ,KAAK,OAAO;EACZ,KAAK,YAAY;EACjB,KAAK,WAAW;EAChB,KAAK,OAAO;EACZ,KAAK,SAAS;EACd,KAAK,kBAAkB;EACvB,KAAK,cAAc;EACnB,KAAK,YAAY;EACjB,KAAK,WAAW;EAChB,KAAK,eAAe;EACpB,KAAK,qBAAqB;EAC1B,KAAK,eAAe;CACtB;CAEA,OAAe,wBAA6C,SAC1D,cAAc,OAAO,KAAA,GAAW,KAAK,UAAU,IAAI,CAAC;;;;;;;;;CAUtD,eAAsB,OAAgC,MAAkB;EACtE,OACE,CAAC,CAAC,SACF,KAAK,qBAAqB,KAAK,KAC/B,KAAK,YAAY,IAAI,MAAM,MAAM,YAAY,IAAI,KACjD,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,IAAI,KACvC,KAAK,WAAW,MAAM;CAE1B;CAIA,qBAA6B,OAA6B;EACxD,IAAI,KAAK,gBAAgB,UAAU,OACjC,KAAK,iBAAiB;GACpB;GACA,QACE,KAAK,sBAAsB,MAAM,qBAC7B,eAAe,KAAK,oBAAoB,MAAM,kBAAkB,IAChE,KAAK,aAAa,MAAM,YACxB,eAAe,KAAK,cAAc,MAAM,YAAY;EAC5D;EAEF,OAAO,KAAK,eAAe;CAC7B;CAEA,OAAc,MAAoB;EAGhC,QAFkB,KAAK,YACrB,SAAS,qBAAA,CACK,MAAe,KAAK,IAAI;CAC1C;AACF"}
1
+ {"version":3,"file":"ItemView.mjs","names":[],"sources":["../../../../../../../../../src/components/List/model/item/ItemView.ts"],"sourcesContent":["import type {\n DependencyList,\n HTMLAttributeAnchorTarget,\n ReactElement,\n ReactNode,\n} from \"react\";\nimport { createElement } from \"react\";\nimport type { RenderItemFn } from \"@/components/List/model/item/types\";\nimport type List from \"@/components/List/model/List\";\nimport { isShallowEqual } from \"remeda\";\n\nexport interface ItemViewShape<T> {\n /**\n * Runs on every render of the list to tell whether the item changed, so it\n * should be cheap and pure. It runs outside the item's render, so it must not\n * call hooks — call them in the component rendering the list instead.\n */\n textValue?: (data: T) => string;\n /**\n * Runs on every render of the list to tell whether the item changed, so it\n * should be cheap and pure. It runs outside the item's render, so it must not\n * call hooks — call them in the component rendering the list instead.\n */\n href?: (data: T) => string;\n target?: HTMLAttributeAnchorTarget;\n /** Read when the item mounts. Must not call hooks. */\n defaultExpanded?: (data: T) => boolean;\n renderFn?: RenderItemFn<T>;\n /** @deprecated Use loadingView instead */\n fallback?: ReactElement;\n loadingView?: ReactElement;\n showList?: boolean;\n showTiles?: boolean;\n tileMaxWidth?: number;\n /**\n * Everything the render function reads besides the item's data.\n *\n * With `renderDependencies`, an item re-renders only when its data or one of\n * these values changes. The render function's identity no longer counts, so a\n * function written inline in JSX keeps the item from re-rendering on every\n * render of its parent. List every value it reads from outside the item,\n * including state read through the `list` argument — one left out keeps the\n * item on the value it last rendered.\n *\n * Without it, an item re-renders whenever its render function changes\n * identity, which an inline function does on every render of its parent.\n */\n renderDependencies?: DependencyList;\n /**\n * @deprecated Use `renderDependencies` instead. `dependencies` only adds to\n * the render function's identity, so an inline render function still\n * re-renders the item on every render of its parent.\n */\n dependencies?: DependencyList;\n}\n\nexport class ItemView<T> {\n public readonly list: List<T>;\n public readonly textValue?: (data: T) => string;\n public readonly href?: (data: T) => string;\n public readonly target?: HTMLAttributeAnchorTarget;\n public readonly defaultExpanded?: (data: T) => boolean;\n public readonly loadingView?: ReactElement;\n public readonly showTiles?: boolean;\n public readonly showList?: boolean;\n public readonly tileMaxWidth: number;\n public readonly renderDependencies?: DependencyList;\n public readonly dependencies?: DependencyList;\n private readonly renderFn?: RenderItemFn<T>;\n private lastComparison?: { other: ItemView<T>; result: boolean };\n\n public constructor(list: List<T>, shape: ItemViewShape<T> = {}) {\n const {\n fallback,\n loadingView = fallback,\n textValue,\n href,\n target,\n defaultExpanded,\n renderFn,\n showTiles,\n showList = true,\n tileMaxWidth = 230,\n renderDependencies,\n dependencies,\n } = shape;\n this.list = list;\n this.textValue = textValue;\n this.renderFn = renderFn;\n this.href = href;\n this.target = target;\n this.defaultExpanded = defaultExpanded;\n this.loadingView = loadingView;\n this.showTiles = showTiles;\n this.showList = showList;\n this.tileMaxWidth = tileMaxWidth;\n this.renderDependencies = renderDependencies;\n this.dependencies = dependencies;\n }\n\n private static fallbackRenderItemFn: RenderItemFn<never> = (item) =>\n createElement(\"pre\", undefined, JSON.stringify(item));\n\n /**\n * Whether `other` would render the item holding `data` identically. The\n * render function counts by its `renderDependencies` where given, otherwise\n * by its identity and the deprecated `dependencies`. `textValue` and `href`\n * count by what they return for `data`, so inline functions do not re-render\n * the item. `defaultExpanded` is read on mount only, so it does not count at\n * all.\n */\n public rendersSameFor(other: ItemView<T> | undefined, data: T): boolean {\n return (\n !!other &&\n this.rendersSameContentAs(other) &&\n this.textValue?.(data) === other.textValue?.(data) &&\n this.href?.(data) === other.href?.(data) &&\n this.target === other.target\n );\n }\n\n // Every item of a render shares one item view, so the result is cached for\n // the last `other`.\n private rendersSameContentAs(other: ItemView<T>): boolean {\n if (this.lastComparison?.other !== other) {\n this.lastComparison = {\n other,\n result:\n this.renderDependencies || other.renderDependencies\n ? isShallowEqual(this.renderDependencies, other.renderDependencies)\n : this.renderFn === other.renderFn &&\n isShallowEqual(this.dependencies, other.dependencies),\n };\n }\n return this.lastComparison.result;\n }\n\n public render(data: T): ReactNode {\n const renderFn = (this.renderFn ??\n ItemView.fallbackRenderItemFn) as RenderItemFn<T>;\n return renderFn(data as never, this.list);\n }\n}\n"],"mappings":";;;;;AAwDA,IAAa,WAAb,MAAa,SAAY;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAmB,MAAe,QAA0B,CAAC,GAAG;EAC9D,MAAM,EACJ,UACA,cAAc,UACd,WACA,MACA,QACA,iBACA,UACA,WACA,WAAW,MACX,eAAe,KACf,oBACA,iBACE;EACJ,KAAK,OAAO;EACZ,KAAK,YAAY;EACjB,KAAK,WAAW;EAChB,KAAK,OAAO;EACZ,KAAK,SAAS;EACd,KAAK,kBAAkB;EACvB,KAAK,cAAc;EACnB,KAAK,YAAY;EACjB,KAAK,WAAW;EAChB,KAAK,eAAe;EACpB,KAAK,qBAAqB;EAC1B,KAAK,eAAe;CACtB;CAEA,OAAe,wBAA6C,SAC1D,cAAc,OAAO,KAAA,GAAW,KAAK,UAAU,IAAI,CAAC;;;;;;;;;CAUtD,eAAsB,OAAgC,MAAkB;EACtE,OACE,CAAC,CAAC,SACF,KAAK,qBAAqB,KAAK,KAC/B,KAAK,YAAY,IAAI,MAAM,MAAM,YAAY,IAAI,KACjD,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,IAAI,KACvC,KAAK,WAAW,MAAM;CAE1B;CAIA,qBAA6B,OAA6B;EACxD,IAAI,KAAK,gBAAgB,UAAU,OACjC,KAAK,iBAAiB;GACpB;GACA,QACE,KAAK,sBAAsB,MAAM,qBAC7B,eAAe,KAAK,oBAAoB,MAAM,kBAAkB,IAChE,KAAK,aAAa,MAAM,YACxB,eAAe,KAAK,cAAc,MAAM,YAAY;EAC5D;EAEF,OAAO,KAAK,eAAe;CAC7B;CAEA,OAAc,MAAoB;EAGhC,QAFkB,KAAK,YACrB,SAAS,qBAAA,CACK,MAAe,KAAK,IAAI;CAC1C;AACF"}
@@ -1,5 +1,6 @@
1
1
  "use client"
2
2
  /* */
3
+ import { flowComponent } from "../../lib/componentFactory/flowComponent.mjs";
3
4
  import { extractTextFromFirstChild } from "../../lib/react/remote.mjs";
4
5
  import { useSkeletonMode } from "../SkeletonMode/skeletonModeContext.mjs";
5
6
  import { Text } from "../Text/Text.mjs";
@@ -22,7 +23,7 @@ import remarkGfm from "remark-gfm";
22
23
  * @flr-generate all
23
24
  * @flr-ignore-props components
24
25
  */
25
- var Markdown = (props) => {
26
+ var Markdown = flowComponent("Markdown", (props) => {
26
27
  const { children, color = "default", className, headingOffset = 0, disableImages = false, components: customComponents, ref, allowElement, allowedElements, disallowedElements, rehypePlugins, remarkPlugins, remarkRehypeOptions, skipHtml, unwrapDisallowed, urlTransform, ...rest } = props;
27
28
  const isSkeleton = useSkeletonMode();
28
29
  const clobberPrefix = `user-content-${useId().replace(/[^\w-]/g, "")}-`;
@@ -150,7 +151,7 @@ var Markdown = (props) => {
150
151
  children: textContent
151
152
  })
152
153
  });
153
- };
154
+ });
154
155
  export { Markdown, Markdown as default };
155
156
 
156
157
  //# sourceMappingURL=Markdown.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Markdown.mjs","names":["styles"],"sources":["../../../../../../../src/components/Markdown/Markdown.tsx"],"sourcesContent":["import { CodeBlock } from \"@/components/CodeBlock\";\nimport { Heading } from \"@/components/Heading\";\nimport { InlineCode } from \"@/components/InlineCode\";\nimport { Link } from \"@/components/Link\";\nimport { Separator } from \"@/components/Separator\";\nimport { Text } from \"@/components/Text\";\nimport type { CSSProperties, FC, Ref } from \"react\";\nimport { Children, isValidElement, useId, useMemo } from \"react\";\nimport type { Components, Options } from \"react-markdown\";\nimport ReactMarkdown from \"react-markdown\";\nimport styles from \"./Markdown.module.scss\";\nimport { extractTextFromFirstChild } from \"@/lib/react/remote\";\nimport type { AlphaColor, PropsWithClassName } from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport remarkGfm from \"remark-gfm\";\nimport { getHeadingLevelWithOffset } from \"@/components/Markdown/lib/getHeadingLevelWithOffset\";\nimport { isExternalHref } from \"@/components/Markdown/lib/isExternalHref\";\nimport type { CodeEditorLanguage } from \"@/components/CodeEditor/languages\";\nimport {\n SkeletonBlockText,\n SkeletonInlineContent,\n} from \"@/components/Markdown/components/SkeletonBlocks\";\nimport { useSkeletonMode } from \"@/components/SkeletonMode/skeletonModeContext\";\n\nexport interface MarkdownProps\n extends PropsWithClassName, Omit<Options, \"components\"> {\n /** The color schema of the markdown component. @default \"default\" */\n color?: \"default\" | AlphaColor;\n /** Shifts all heading levels by the given offset. @default 0 */\n headingOffset?: number;\n /** Whether images are left out of the rendered markdown. @default false */\n disableImages?: boolean;\n /** Allows overriding markdown element renderers from outside. */\n components?: Components;\n /** @internal */\n style?: CSSProperties;\n /** A ref to the elements root. */\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * @flr-generate all\n * @flr-ignore-props components\n */\nexport const Markdown: FC<MarkdownProps> = (props) => {\n const {\n children,\n color = \"default\",\n className,\n headingOffset = 0,\n disableImages = false,\n components: customComponents,\n ref,\n allowElement,\n allowedElements,\n disallowedElements,\n rehypePlugins,\n remarkPlugins,\n remarkRehypeOptions,\n skipHtml,\n unwrapDisallowed,\n urlTransform,\n ...rest\n } = props;\n\n const isSkeleton = useSkeletonMode();\n /* Footnote ids are per document, so two instances on one page would share\n them and a back link would jump into the other one. */\n const clobberPrefix = `user-content-${useId().replace(/[^\\w-]/g, \"\")}-`;\n\n /* react-markdown uses the renderers as element types: new ones on every\n render would remount the whole tree. */\n const defaultComponents = useMemo<Components>(\n () => ({\n /* GFM footnotes link through `id` (the back link's target), `aria-label`\n and `aria-describedby`. */\n a: (props) => (\n <Link\n id={props.id}\n aria-label={props[\"aria-label\"]}\n aria-describedby={props[\"aria-describedby\"]}\n target={isExternalHref(props.href) ? \"_blank\" : undefined}\n color={color}\n href={props.href}\n >\n {props.children}\n </Link>\n ),\n p: (props) => (\n <Text elementType=\"p\" color={color}>\n {props.children}\n </Text>\n ),\n code: (props) => <InlineCode color={color}>{props.children}</InlineCode>,\n h1: (props) => (\n <Heading\n id={props.id}\n level={getHeadingLevelWithOffset(1, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n h2: (props) => (\n <Heading\n id={props.id}\n level={getHeadingLevelWithOffset(2, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n h3: (props) => (\n <Heading\n id={props.id}\n level={getHeadingLevelWithOffset(3, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n h4: (props) => (\n <Heading\n id={props.id}\n level={getHeadingLevelWithOffset(4, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n h5: (props) => (\n <Heading\n id={props.id}\n level={getHeadingLevelWithOffset(5, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n h6: (props) => (\n <Heading\n id={props.id}\n level={getHeadingLevelWithOffset(6, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n hr: () => <Separator />,\n pre: (props) => {\n const preElementContent = Children.toArray(props.children)[0];\n\n return (\n <CodeBlock\n copyable={false}\n language={\n isValidElement<{ className?: string }>(preElementContent) &&\n preElementContent.props.className\n ? (preElementContent.props.className.replace(\n \"language-\",\n \"\",\n ) as CodeEditorLanguage)\n : undefined\n }\n code={String(\n isValidElement<{ children: string }>(preElementContent)\n ? preElementContent.props.children\n : preElementContent,\n ).trim()}\n />\n );\n },\n ul: ({ node: ignoredNode, ...props }) => (\n <SkeletonBlockText color={color}>\n <ul {...props} />\n </SkeletonBlockText>\n ),\n ol: ({ node: ignoredNode, ...props }) => (\n <SkeletonBlockText color={color}>\n <ol {...props} />\n </SkeletonBlockText>\n ),\n li: ({ node: ignoredNode, children, ...props }) => (\n <li {...props}>\n <SkeletonInlineContent>{children}</SkeletonInlineContent>\n </li>\n ),\n /* A table cannot shrink below its content, so the box around it scrolls\n instead of the table overflowing the markdown. */\n table: ({ node: ignoredNode, ...props }) => (\n <div className={styles.tableContainer}>\n <table {...props} />\n </div>\n ),\n th: ({ node: ignoredNode, children, ...props }) => (\n <th {...props}>\n <SkeletonInlineContent>{children}</SkeletonInlineContent>\n </th>\n ),\n td: ({ node: ignoredNode, children, ...props }) => (\n <td {...props}>\n <SkeletonInlineContent>{children}</SkeletonInlineContent>\n </td>\n ),\n /* A text bar resets the mode for its content, so the image reads it\n from here. A skeleton issues no request. */\n img: ({ node: ignoredNode, ...props }) =>\n isSkeleton ? null : <img {...props} />,\n blockquote: (props) => (\n <SkeletonBlockText color={color}>\n <blockquote>{props.children}</blockquote>\n </SkeletonBlockText>\n ),\n }),\n [color, headingOffset, isSkeleton],\n );\n\n const textContent = extractTextFromFirstChild(children);\n const mergedComponents = useMemo<Components>(\n () => ({\n ...defaultComponents,\n ...customComponents,\n }),\n [defaultComponents, customComponents],\n );\n\n return (\n <div className={clsx(styles.markdown, className)} {...rest} ref={ref}>\n <ReactMarkdown\n allowElement={(element, index, parent) =>\n !(disableImages && element.tagName === \"img\") &&\n (allowElement?.(element, index, parent) ?? true)\n }\n allowedElements={allowedElements}\n disallowedElements={disallowedElements}\n rehypePlugins={rehypePlugins}\n remarkPlugins={remarkPlugins ?? [remarkGfm]}\n remarkRehypeOptions={{ clobberPrefix, ...remarkRehypeOptions }}\n skipHtml={skipHtml}\n unwrapDisallowed={unwrapDisallowed}\n urlTransform={urlTransform}\n components={mergedComponents}\n >\n {textContent}\n </ReactMarkdown>\n </div>\n );\n};\n\nexport default Markdown;\n"],"mappings":";;;;;;;;;;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CAAA;EAIN,MAAM,EAAE,MAAM,aAAa,GAAG,YAC5B,aAAa,OAAO,oBAAC,OAAD,EAAK,GAAI,MAAQ,CAAA;EACvC,aAAa,UACX,oBAAC,mBAAD;GAA0B;GACxB,UAAA,oBAAC,cAAD,EAAA,UAAa,MAAM,SAAqB,CAAA;EACvB,CAAA;CAEvB,IACA;EAAC;EAAO;EAAe;CAAU,CACnC;CAEA,MAAM,cAAc,0BAA0B,QAAQ;CACtD,MAAM,mBAAmB,eAChB;EACL,GAAG;EACH,GAAG;CACL,IACA,CAAC,mBAAmB,gBAAgB,CACtC;CAEA,OACE,oBAAC,OAAD;EAAK,WAAW,KAAKA,wBAAO,UAAU,SAAS;EAAG,GAAI;EAAW;EAC/D,UAAA,oBAAC,eAAD;GACE,eAAe,SAAS,OAAO,WAC7B,EAAE,iBAAiB,QAAQ,YAAY,WACtC,eAAe,SAAS,OAAO,MAAM,KAAK;GAE5B;GACG;GACL;GACf,eAAe,iBAAiB,CAAC,SAAS;GAC1C,qBAAqB;IAAE;IAAe,GAAG;GAAoB;GACnD;GACQ;GACJ;GACd,YAAY;GAEX,UAAA;EACY,CAAA;CACZ,CAAA;AAET"}
1
+ {"version":3,"file":"Markdown.mjs","names":["styles"],"sources":["../../../../../../../src/components/Markdown/Markdown.tsx"],"sourcesContent":["import { CodeBlock } from \"@/components/CodeBlock\";\nimport { Heading } from \"@/components/Heading\";\nimport { InlineCode } from \"@/components/InlineCode\";\nimport { Link } from \"@/components/Link\";\nimport { Separator } from \"@/components/Separator\";\nimport { Text } from \"@/components/Text\";\nimport type { CSSProperties } from \"react\";\nimport { Children, isValidElement, useId, useMemo } from \"react\";\nimport type { Components, Options } from \"react-markdown\";\nimport ReactMarkdown from \"react-markdown\";\nimport styles from \"./Markdown.module.scss\";\nimport { extractTextFromFirstChild } from \"@/lib/react/remote\";\nimport type { AlphaColor, PropsWithClassName } from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport remarkGfm from \"remark-gfm\";\nimport { getHeadingLevelWithOffset } from \"@/components/Markdown/lib/getHeadingLevelWithOffset\";\nimport { isExternalHref } from \"@/components/Markdown/lib/isExternalHref\";\nimport type { CodeEditorLanguage } from \"@/components/CodeEditor/languages\";\nimport {\n SkeletonBlockText,\n SkeletonInlineContent,\n} from \"@/components/Markdown/components/SkeletonBlocks\";\nimport { useSkeletonMode } from \"@/components/SkeletonMode/skeletonModeContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\n\nexport interface MarkdownProps\n extends PropsWithClassName, Omit<Options, \"components\">, FlowComponentProps {\n /** The color schema of the markdown component. @default \"default\" */\n color?: \"default\" | AlphaColor;\n /** Shifts all heading levels by the given offset. @default 0 */\n headingOffset?: number;\n /** Whether images are left out of the rendered markdown. @default false */\n disableImages?: boolean;\n /** Allows overriding markdown element renderers from outside. */\n components?: Components;\n /** @internal */\n style?: CSSProperties;\n}\n\n/**\n * @flr-generate all\n * @flr-ignore-props components\n */\nexport const Markdown = flowComponent(\"Markdown\", (props) => {\n const {\n children,\n color = \"default\",\n className,\n headingOffset = 0,\n disableImages = false,\n components: customComponents,\n ref,\n allowElement,\n allowedElements,\n disallowedElements,\n rehypePlugins,\n remarkPlugins,\n remarkRehypeOptions,\n skipHtml,\n unwrapDisallowed,\n urlTransform,\n ...rest\n } = props;\n\n const isSkeleton = useSkeletonMode();\n /* Footnote ids are per document, so two instances on one page would share\n them and a back link would jump into the other one. */\n const clobberPrefix = `user-content-${useId().replace(/[^\\w-]/g, \"\")}-`;\n\n /* react-markdown uses the renderers as element types: new ones on every\n render would remount the whole tree. */\n const defaultComponents = useMemo<Components>(\n () => ({\n /* GFM footnotes link through `id` (the back link's target), `aria-label`\n and `aria-describedby`. */\n a: (props) => (\n <Link\n id={props.id}\n aria-label={props[\"aria-label\"]}\n aria-describedby={props[\"aria-describedby\"]}\n target={isExternalHref(props.href) ? \"_blank\" : undefined}\n color={color}\n href={props.href}\n >\n {props.children}\n </Link>\n ),\n p: (props) => (\n <Text elementType=\"p\" color={color}>\n {props.children}\n </Text>\n ),\n code: (props) => <InlineCode color={color}>{props.children}</InlineCode>,\n h1: (props) => (\n <Heading\n id={props.id}\n level={getHeadingLevelWithOffset(1, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n h2: (props) => (\n <Heading\n id={props.id}\n level={getHeadingLevelWithOffset(2, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n h3: (props) => (\n <Heading\n id={props.id}\n level={getHeadingLevelWithOffset(3, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n h4: (props) => (\n <Heading\n id={props.id}\n level={getHeadingLevelWithOffset(4, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n h5: (props) => (\n <Heading\n id={props.id}\n level={getHeadingLevelWithOffset(5, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n h6: (props) => (\n <Heading\n id={props.id}\n level={getHeadingLevelWithOffset(6, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n hr: () => <Separator />,\n pre: (props) => {\n const preElementContent = Children.toArray(props.children)[0];\n\n return (\n <CodeBlock\n copyable={false}\n language={\n isValidElement<{ className?: string }>(preElementContent) &&\n preElementContent.props.className\n ? (preElementContent.props.className.replace(\n \"language-\",\n \"\",\n ) as CodeEditorLanguage)\n : undefined\n }\n code={String(\n isValidElement<{ children: string }>(preElementContent)\n ? preElementContent.props.children\n : preElementContent,\n ).trim()}\n />\n );\n },\n ul: ({ node: ignoredNode, ...props }) => (\n <SkeletonBlockText color={color}>\n <ul {...props} />\n </SkeletonBlockText>\n ),\n ol: ({ node: ignoredNode, ...props }) => (\n <SkeletonBlockText color={color}>\n <ol {...props} />\n </SkeletonBlockText>\n ),\n li: ({ node: ignoredNode, children, ...props }) => (\n <li {...props}>\n <SkeletonInlineContent>{children}</SkeletonInlineContent>\n </li>\n ),\n /* A table cannot shrink below its content, so the box around it scrolls\n instead of the table overflowing the markdown. */\n table: ({ node: ignoredNode, ...props }) => (\n <div className={styles.tableContainer}>\n <table {...props} />\n </div>\n ),\n th: ({ node: ignoredNode, children, ...props }) => (\n <th {...props}>\n <SkeletonInlineContent>{children}</SkeletonInlineContent>\n </th>\n ),\n td: ({ node: ignoredNode, children, ...props }) => (\n <td {...props}>\n <SkeletonInlineContent>{children}</SkeletonInlineContent>\n </td>\n ),\n /* A text bar resets the mode for its content, so the image reads it\n from here. A skeleton issues no request. */\n img: ({ node: ignoredNode, ...props }) =>\n isSkeleton ? null : <img {...props} />,\n blockquote: (props) => (\n <SkeletonBlockText color={color}>\n <blockquote>{props.children}</blockquote>\n </SkeletonBlockText>\n ),\n }),\n [color, headingOffset, isSkeleton],\n );\n\n const textContent = extractTextFromFirstChild(children);\n const mergedComponents = useMemo<Components>(\n () => ({\n ...defaultComponents,\n ...customComponents,\n }),\n [defaultComponents, customComponents],\n );\n\n return (\n <div className={clsx(styles.markdown, className)} {...rest} ref={ref}>\n <ReactMarkdown\n allowElement={(element, index, parent) =>\n !(disableImages && element.tagName === \"img\") &&\n (allowElement?.(element, index, parent) ?? true)\n }\n allowedElements={allowedElements}\n disallowedElements={disallowedElements}\n rehypePlugins={rehypePlugins}\n remarkPlugins={remarkPlugins ?? [remarkGfm]}\n remarkRehypeOptions={{ clobberPrefix, ...remarkRehypeOptions }}\n skipHtml={skipHtml}\n unwrapDisallowed={unwrapDisallowed}\n urlTransform={urlTransform}\n components={mergedComponents}\n >\n {textContent}\n </ReactMarkdown>\n </div>\n );\n});\n\nexport default Markdown;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAa,WAAW,cAAc,aAAa,UAAU;CAC3D,MAAM,EACJ,UACA,QAAQ,WACR,WACA,gBAAgB,GAChB,gBAAgB,OAChB,YAAY,kBACZ,KACA,cACA,iBACA,oBACA,eACA,eACA,qBACA,UACA,kBACA,cACA,GAAG,SACD;CAEJ,MAAM,aAAa,g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EvB,IACA;EAAC;EAAO;EAAe;CAAU,CACnC;CAEA,MAAM,cAAc,0BAA0B,QAAQ;CACtD,MAAM,mBAAmB,eAChB;EACL,GAAG;EACH,GAAG;CACL,IACA,CAAC,mBAAmB,gBAAgB,CACtC;CAEA,OACE,oBAAC,OAAD;EAAK,WAAW,KAAKA,wBAAO,UAAU,SAAS;EAAG,GAAI;EAAW;EAC/D,UAAA,oBAAC,eAAD;GACE,eAAe,SAAS,OAAO,WAC7B,EAAE,iBAAiB,QAAQ,YAAY,WACtC,eAAe,SAAS,OAAO,MAAM,KAAK;GAE5B;GACG;GACL;GACf,eAAe,iBAAiB,CAAC,SAAS;GAC1C,qBAAqB;IAAE;IAAe,GAAG;GAAoB;GACnD;GACQ;GACJ;GACd,YAAY;GAEX,UAAA;EACY,CAAA;CACZ,CAAA;AAET,CAAC"}
@@ -6,10 +6,7 @@ import { jsx } from "react/jsx-runtime";
6
6
  import * as Aria from "react-aria-components";
7
7
  // src/components/OverlayTrigger/components/DialogTrigger/DialogTrigger.tsx
8
8
  var propsContext = { Button: { tunnel: null } };
9
- /**
10
- * @flr-generate all
11
- * @flr-provider
12
- */
9
+ /** @flr-generate all */
13
10
  var DialogTrigger = flowComponent("DialogTrigger", (props) => {
14
11
  const { children, ...rest } = props;
15
12
  return /* @__PURE__ */ jsx(Aria.DialogTrigger, {