@mittwald/flow-react-components 1.6.6 → 1.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/component-index.json +1 -1
- package/dist/assets/doc-properties.json +1 -1
- package/dist/js/packages/components/src/components/AvatarStack/AvatarStack.mjs +5 -3
- package/dist/js/packages/components/src/components/AvatarStack/AvatarStack.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Breadcrumb/Breadcrumb.mjs +5 -3
- package/dist/js/packages/components/src/components/Breadcrumb/Breadcrumb.mjs.map +1 -1
- package/dist/js/packages/components/src/components/DonutChart/DonutChart.mjs +5 -3
- package/dist/js/packages/components/src/components/DonutChart/DonutChart.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Flex/Flex.mjs.map +1 -1
- package/dist/js/packages/components/src/components/HeaderNavigation/HeaderNavigation.mjs +5 -3
- package/dist/js/packages/components/src/components/HeaderNavigation/HeaderNavigation.mjs.map +1 -1
- package/dist/js/packages/components/src/components/ImageCropper/ImageCropper.mjs +5 -3
- package/dist/js/packages/components/src/components/ImageCropper/ImageCropper.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Markdown/Markdown.mjs +3 -2
- package/dist/js/packages/components/src/components/Markdown/Markdown.mjs.map +1 -1
- package/dist/js/packages/components/src/components/SkeletonText/SkeletonText.mjs +6 -4
- package/dist/js/packages/components/src/components/SkeletonText/SkeletonText.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Table/Table.mjs +5 -3
- package/dist/js/packages/components/src/components/Table/Table.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Table/components/TableBody/TableBody.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Table/components/TableCell/TableCell.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Table/components/TableColumn/TableColumn.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Table/components/TableFooterRow/TableFooterRow.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Table/components/TableHeader/TableHeader.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Table/components/TableRow/TableRow.mjs.map +1 -1
- package/dist/js/packages/components/src/components/propTypes/index.mjs +8 -0
- package/dist/js/packages/components/src/components/propTypes/index.mjs.map +1 -1
- package/dist/types/components/AvatarStack/AvatarStack.d.ts +4 -3
- package/dist/types/components/Breadcrumb/Breadcrumb.d.ts +4 -3
- package/dist/types/components/DonutChart/DonutChart.d.ts +4 -3
- package/dist/types/components/HeaderNavigation/HeaderNavigation.d.ts +4 -3
- package/dist/types/components/ImageCropper/ImageCropper.d.ts +5 -3
- package/dist/types/components/List/typedList.d.ts +17 -13
- package/dist/types/components/Markdown/Markdown.d.ts +3 -5
- package/dist/types/components/SkeletonText/SkeletonText.d.ts +4 -3
- package/dist/types/components/Table/Table.d.ts +18 -3
- package/dist/types/components/propTypes/index.d.ts +16 -0
- 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 {
|
|
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 {
|
|
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 { 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 {
|
|
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;;
|
|
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
|
package/dist/js/packages/components/src/components/HeaderNavigation/HeaderNavigation.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderNavigation.mjs","names":["styles"],"sources":["../../../../../../../src/components/HeaderNavigation/HeaderNavigation.tsx"],"sourcesContent":["import type { ComponentProps,
|
|
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
|
|
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,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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"}
|
|
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":"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"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
+
import { flowComponent } from "../../lib/componentFactory/flowComponent.mjs";
|
|
3
4
|
import SkeletonText_module_default from "./SkeletonText.module.mjs";
|
|
4
5
|
import clsx from "clsx";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
7
|
// src/components/SkeletonText/SkeletonText.tsx
|
|
7
8
|
/** @flr-generate all */
|
|
8
|
-
var SkeletonText = (props) => {
|
|
9
|
-
const { width, style = {}, className, ...rest } = props;
|
|
9
|
+
var SkeletonText = flowComponent("SkeletonText", (props) => {
|
|
10
|
+
const { width, style = {}, className, ref, ...rest } = props;
|
|
10
11
|
return /* @__PURE__ */ jsx("span", {
|
|
11
12
|
"aria-hidden": true,
|
|
12
13
|
style: {
|
|
@@ -14,9 +15,10 @@ var SkeletonText = (props) => {
|
|
|
14
15
|
...style
|
|
15
16
|
},
|
|
16
17
|
...rest,
|
|
17
|
-
className: clsx(SkeletonText_module_default.skeletonText, className)
|
|
18
|
+
className: clsx(SkeletonText_module_default.skeletonText, className),
|
|
19
|
+
ref
|
|
18
20
|
});
|
|
19
|
-
};
|
|
21
|
+
});
|
|
20
22
|
export { SkeletonText, SkeletonText as default };
|
|
21
23
|
|
|
22
24
|
//# sourceMappingURL=SkeletonText.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkeletonText.mjs","names":["styles"],"sources":["../../../../../../../src/components/SkeletonText/SkeletonText.tsx"],"sourcesContent":["import type { ComponentProps, CSSProperties
|
|
1
|
+
{"version":3,"file":"SkeletonText.mjs","names":["styles"],"sources":["../../../../../../../src/components/SkeletonText/SkeletonText.tsx"],"sourcesContent":["import type { ComponentProps, CSSProperties } from \"react\";\nimport clsx from \"clsx\";\nimport styles from \"./SkeletonText.module.scss\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\n\nexport interface SkeletonTextProps\n extends ComponentProps<\"span\">, FlowComponentProps<HTMLSpanElement> {\n /** The width of the skeleton text. */\n width?: CSSProperties[\"width\"];\n}\n\n/** @flr-generate all */\nexport const SkeletonText = flowComponent(\"SkeletonText\", (props) => {\n const { width, style = {}, className, ref, ...rest } = props;\n return (\n <span\n aria-hidden\n style={{ width, ...style }}\n {...rest}\n className={clsx(styles.skeletonText, className)}\n ref={ref}\n />\n );\n});\n\nexport default SkeletonText;\n"],"mappings":";;;;;;;;AAaA,IAAa,eAAe,cAAc,iBAAiB,UAAU;CACnE,MAAM,EAAE,OAAO,QAAQ,CAAC,GAAG,WAAW,KAAK,GAAG,SAAS;CACvD,OACE,oBAAC,QAAD;EACE,eAAA;EACA,OAAO;GAAE;GAAO,GAAG;EAAM;EACzB,GAAI;EACJ,WAAW,KAAKA,4BAAO,cAAc,SAAS;EACzC;CACN,CAAA;AAEL,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
+
import { flowComponent } from "../../lib/componentFactory/flowComponent.mjs";
|
|
3
4
|
import { useLabelledBySectionHeading } from "../Section/context.mjs";
|
|
4
5
|
import Table_module_default from "./Table.module.mjs";
|
|
5
6
|
import clsx from "clsx";
|
|
@@ -7,12 +8,13 @@ import { jsx } from "react/jsx-runtime";
|
|
|
7
8
|
import * as Aria from "react-aria-components";
|
|
8
9
|
// src/components/Table/Table.tsx
|
|
9
10
|
/** @flr-generate all */
|
|
10
|
-
var Table = (props) => {
|
|
11
|
-
const { children, className, verticalAlign = "top", layout = "auto", minWidth, ...rest } = props;
|
|
11
|
+
var Table = flowComponent("Table", (props) => {
|
|
12
|
+
const { children, className, verticalAlign = "top", layout = "auto", minWidth, ref, ...rest } = props;
|
|
12
13
|
const ariaLabelledBy = useLabelledBySectionHeading(rest);
|
|
13
14
|
const rootClassName = clsx(Table_module_default.table, verticalAlign !== "top" && Table_module_default[`vertical-align-${verticalAlign}`], Table_module_default[`layout-${layout}`], className);
|
|
14
15
|
return /* @__PURE__ */ jsx("div", {
|
|
15
16
|
className: Table_module_default.tableContainer,
|
|
17
|
+
ref,
|
|
16
18
|
children: /* @__PURE__ */ jsx("div", {
|
|
17
19
|
className: Table_module_default.tableScrollArea,
|
|
18
20
|
style: { minWidth },
|
|
@@ -24,7 +26,7 @@ var Table = (props) => {
|
|
|
24
26
|
})
|
|
25
27
|
})
|
|
26
28
|
});
|
|
27
|
-
};
|
|
29
|
+
});
|
|
28
30
|
export { Table, Table as default };
|
|
29
31
|
|
|
30
32
|
//# sourceMappingURL=Table.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.mjs","names":["styles"],"sources":["../../../../../../../src/components/Table/Table.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Table.mjs","names":["styles"],"sources":["../../../../../../../src/components/Table/Table.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"./Table.module.scss\";\nimport { useLabelledBySectionHeading } from \"@/components/Section/context\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\n\nexport type TableProps = Omit<\n Aria.TableProps,\n \"render\" | \"className\" | \"style\"\n> & {\n /** The vertical alignment of the table cells content. */\n verticalAlign?: \"top\" | \"middle\";\n /**\n * The column-sizing algorithm of the table. Use \"fixed\" together with column\n * widths to enforce exact widths. @default \"auto\"\n */\n layout?: \"auto\" | \"fixed\";\n /**\n * The minimum width of the table. Below this width the table scrolls\n * horizontally instead of shrinking its columns.\n */\n minWidth?: number | string;\n /** The elements class name. */\n className?: string;\n} & FlowComponentProps;\n\n/** @flr-generate all */\nexport const Table = flowComponent(\"Table\", (props) => {\n const {\n children,\n className,\n verticalAlign = \"top\",\n layout = \"auto\",\n minWidth,\n ref,\n ...rest\n } = props;\n\n const ariaLabelledBy = useLabelledBySectionHeading(rest);\n\n const rootClassName = clsx(\n styles.table,\n verticalAlign !== \"top\" && styles[`vertical-align-${verticalAlign}`],\n styles[`layout-${layout}`],\n className,\n );\n\n return (\n <div className={styles.tableContainer} ref={ref}>\n <div className={styles.tableScrollArea} style={{ minWidth }}>\n <Aria.Table\n className={rootClassName}\n {...rest}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </Aria.Table>\n </div>\n </div>\n );\n});\n\nexport default Table;\n"],"mappings":";;;;;;;;;;AA4BA,IAAa,QAAQ,cAAc,UAAU,UAAU;CACrD,MAAM,EACJ,UACA,WACA,gBAAgB,OAChB,SAAS,QACT,UACA,KACA,GAAG,SACD;CAEJ,MAAM,iBAAiB,4BAA4B,IAAI;CAEvD,MAAM,gBAAgB,KACpBA,qBAAO,OACP,kBAAkB,SAASA,qBAAO,kBAAkB,kBACpDA,qBAAO,UAAU,WACjB,SACF;CAEA,OACE,oBAAC,OAAD;EAAK,WAAWA,qBAAO;EAAqB;EAC1C,UAAA,oBAAC,OAAD;GAAK,WAAWA,qBAAO;GAAiB,OAAO,EAAE,SAAS;GACxD,UAAA,oBAAC,KAAK,OAAN;IACE,WAAW;IACX,GAAI;IACJ,mBAAiB;IAEhB;GACS,CAAA;EACT,CAAA;CACF,CAAA;AAET,CAAC"}
|
package/dist/js/packages/components/src/components/Table/components/TableBody/TableBody.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableBody.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/Table/components/TableBody/TableBody.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"../../Table.module.scss\";\n\nexport type TableBodyProps = Aria.TableBodyProps<never>;\n\n/** @flr-generate all */\nexport const TableBody: FC<TableBodyProps> = (props) => {\n const { children, className, ...rest } = props;\n\n const rootClassName = clsx(styles.body, className);\n\n return (\n <Aria.TableBody className={rootClassName} {...rest}>\n {children}\n </Aria.TableBody>\n );\n};\n\nexport default TableBody;\n"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"TableBody.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/Table/components/TableBody/TableBody.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"../../Table.module.scss\";\n\nexport type TableBodyProps = Aria.TableBodyProps<never>;\n\n/* Plain FC: technical constraint — react-aria allows render-function children,\n * which the props types of registered components cannot express. */\n/** @flr-generate all */\nexport const TableBody: FC<TableBodyProps> = (props) => {\n const { children, className, ...rest } = props;\n\n const rootClassName = clsx(styles.body, className);\n\n return (\n <Aria.TableBody className={rootClassName} {...rest}>\n {children}\n </Aria.TableBody>\n );\n};\n\nexport default TableBody;\n"],"mappings":";;;;;;;;AAUA,IAAa,aAAiC,UAAU;CACtD,MAAM,EAAE,UAAU,WAAW,GAAG,SAAS;CAEzC,MAAM,gBAAgB,KAAKA,qBAAO,MAAM,SAAS;CAEjD,OACE,oBAAC,KAAK,WAAN;EAAgB,WAAW;EAAe,GAAI;EAC3C;CACa,CAAA;AAEpB"}
|
package/dist/js/packages/components/src/components/Table/components/TableCell/TableCell.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCell.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/Table/components/TableCell/TableCell.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { Suspense } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"../../Table.module.scss\";\nimport { SkeletonText } from \"@/components/SkeletonText\";\nimport { SkeletonRawText } from \"@/components/SkeletonMode/components/SkeletonRawText\";\n\nexport interface TableCellProps\n extends\n Omit<Aria.CellProps, \"children\" | \"style\" | \"render\">,\n PropsWithChildren {\n /**\n * Styles the cell as a row header. Its semantics come from the column: the\n * first column, or the one with `isRowHeader`.\n */\n rowHeader?: boolean;\n /** Horizontal alignment of the cell content @default \"start\" */\n horizontalAlign?: \"start\" | \"center\" | \"end\";\n}\n\n/** @flr-generate all */\nexport const TableCell: FC<TableCellProps> = (props) => {\n const {\n children,\n className,\n rowHeader,\n horizontalAlign = \"start\",\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.cell,\n rowHeader && styles.column,\n horizontalAlign !== \"start\" &&\n styles[`horizontal-align-${horizontalAlign}`],\n className,\n );\n\n return (\n <Aria.Cell className={rootClassName} {...rest}>\n <Suspense fallback={<SkeletonText width=\"100px\" />}>\n <SkeletonRawText>{children}</SkeletonRawText>\n </Suspense>\n </Aria.Cell>\n );\n};\n\nexport default TableCell;\n"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"TableCell.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/Table/components/TableCell/TableCell.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { Suspense } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"../../Table.module.scss\";\nimport { SkeletonText } from \"@/components/SkeletonText\";\nimport { SkeletonRawText } from \"@/components/SkeletonMode/components/SkeletonRawText\";\n\nexport interface TableCellProps\n extends\n Omit<Aria.CellProps, \"children\" | \"style\" | \"render\">,\n PropsWithChildren {\n /**\n * Styles the cell as a row header. Its semantics come from the column: the\n * first column, or the one with `isRowHeader`.\n */\n rowHeader?: boolean;\n /** Horizontal alignment of the cell content @default \"start\" */\n horizontalAlign?: \"start\" | \"center\" | \"end\";\n}\n\n/* Plain FC: rendered once per cell; the factory measurably slows large tables\n * (1,800 cells: mount +8–24 %, re-render +2–10 %). */\n/** @flr-generate all */\nexport const TableCell: FC<TableCellProps> = (props) => {\n const {\n children,\n className,\n rowHeader,\n horizontalAlign = \"start\",\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.cell,\n rowHeader && styles.column,\n horizontalAlign !== \"start\" &&\n styles[`horizontal-align-${horizontalAlign}`],\n className,\n );\n\n return (\n <Aria.Cell className={rootClassName} {...rest}>\n <Suspense fallback={<SkeletonText width=\"100px\" />}>\n <SkeletonRawText>{children}</SkeletonRawText>\n </Suspense>\n </Aria.Cell>\n );\n};\n\nexport default TableCell;\n"],"mappings":";;;;;;;;;;;AAwBA,IAAa,aAAiC,UAAU;CACtD,MAAM,EACJ,UACA,WACA,WACA,kBAAkB,SAClB,GAAG,SACD;CAEJ,MAAM,gBAAgB,KACpBA,qBAAO,MACP,aAAaA,qBAAO,QACpB,oBAAoB,WAClBA,qBAAO,oBAAoB,oBAC7B,SACF;CAEA,OACE,oBAAC,KAAK,MAAN;EAAW,WAAW;EAAe,GAAI;EACvC,UAAA,oBAAC,UAAD;GAAU,UAAU,oBAAC,cAAD,EAAc,OAAM,QAAS,CAAA;GAC/C,UAAA,oBAAC,iBAAD,EAAkB,SAA0B,CAAA;EACpC,CAAA;CACD,CAAA;AAEf"}
|
package/dist/js/packages/components/src/components/Table/components/TableColumn/TableColumn.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableColumn.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/Table/components/TableColumn/TableColumn.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"../../Table.module.scss\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport { SkeletonRawText } from \"@/components/SkeletonMode/components/SkeletonRawText\";\nimport { useIsFirstColumn } from \"@/components/Table/components/TableHeader/context\";\n\nexport interface TableColumnProps\n extends\n Omit<\n Aria.ColumnProps,\n \"children\" | \"width\" | \"minWidth\" | \"maxWidth\" | \"style\"\n >,\n PropsWithChildren {\n /** Horizontal alignment of the cell content @default \"start\" */\n horizontalAlign?: \"start\" | \"center\" | \"end\";\n /** The width of the column. */\n width?: number | string;\n /** The minimum width of the column. */\n minWidth?: number | string;\n}\n\n/** @flr-generate all */\nexport const TableColumn: FC<TableColumnProps> = (props) => {\n const {\n children,\n className,\n horizontalAlign = \"start\",\n width,\n minWidth,\n isRowHeader,\n ...rest\n } = props;\n const isFirstColumn = useIsFirstColumn();\n\n const rootClassName = clsx(\n styles.column,\n horizontalAlign !== \"start\" &&\n styles[`horizontal-align-${horizontalAlign}`],\n className,\n );\n\n const propsContext: PropsContext = { Checkbox: { slot: null } };\n\n return (\n <Aria.Column\n isRowHeader={isRowHeader ?? isFirstColumn ?? true}\n className={rootClassName}\n {...rest}\n style={{ width, minWidth }}\n >\n <PropsContextProvider props={propsContext}>\n <SkeletonRawText>{children}</SkeletonRawText>\n </PropsContextProvider>\n </Aria.Column>\n );\n};\n\nexport default TableColumn;\n"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"TableColumn.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/Table/components/TableColumn/TableColumn.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"../../Table.module.scss\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport { SkeletonRawText } from \"@/components/SkeletonMode/components/SkeletonRawText\";\nimport { useIsFirstColumn } from \"@/components/Table/components/TableHeader/context\";\n\nexport interface TableColumnProps\n extends\n Omit<\n Aria.ColumnProps,\n \"children\" | \"width\" | \"minWidth\" | \"maxWidth\" | \"style\"\n >,\n PropsWithChildren {\n /** Horizontal alignment of the cell content @default \"start\" */\n horizontalAlign?: \"start\" | \"center\" | \"end\";\n /** The width of the column. */\n width?: number | string;\n /** The minimum width of the column. */\n minWidth?: number | string;\n}\n\n/* Plain FC: rendered once per cell; the factory measurably slows large tables\n * (1,800 cells: mount +8–24 %, re-render +2–10 %). */\n/** @flr-generate all */\nexport const TableColumn: FC<TableColumnProps> = (props) => {\n const {\n children,\n className,\n horizontalAlign = \"start\",\n width,\n minWidth,\n isRowHeader,\n ...rest\n } = props;\n const isFirstColumn = useIsFirstColumn();\n\n const rootClassName = clsx(\n styles.column,\n horizontalAlign !== \"start\" &&\n styles[`horizontal-align-${horizontalAlign}`],\n className,\n );\n\n const propsContext: PropsContext = { Checkbox: { slot: null } };\n\n return (\n <Aria.Column\n isRowHeader={isRowHeader ?? isFirstColumn ?? true}\n className={rootClassName}\n {...rest}\n style={{ width, minWidth }}\n >\n <PropsContextProvider props={propsContext}>\n <SkeletonRawText>{children}</SkeletonRawText>\n </PropsContextProvider>\n </Aria.Column>\n );\n};\n\nexport default TableColumn;\n"],"mappings":";;;;;;;;;;;AA0BA,IAAa,eAAqC,UAAU;CAC1D,MAAM,EACJ,UACA,WACA,kBAAkB,SAClB,OACA,UACA,aACA,GAAG,SACD;CACJ,MAAM,gBAAgB,iBAAiB;CAEvC,MAAM,gBAAgB,KACpBA,qBAAO,QACP,oBAAoB,WAClBA,qBAAO,oBAAoB,oBAC7B,SACF;CAEA,MAAM,eAA6B,EAAE,UAAU,EAAE,MAAM,KAAK,EAAE;CAE9D,OACE,oBAAC,KAAK,QAAN;EACE,aAAa,eAAe,iBAAiB;EAC7C,WAAW;EACX,GAAI;EACJ,OAAO;GAAE;GAAO;EAAS;EAEzB,UAAA,oBAAC,sBAAD;GAAsB,OAAO;GAC3B,UAAA,oBAAC,iBAAD,EAAkB,SAA0B,CAAA;EACxB,CAAA;CACX,CAAA;AAEjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableFooterRow.mjs","names":[],"sources":["../../../../../../../../../src/components/Table/components/TableFooterRow/TableFooterRow.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport type { TableRowProps } from \"../TableRow\";\nimport { TableRow } from \"../TableRow\";\n\nexport type TableFooterRowProps = TableRowProps;\n\n/** @flr-generate all */\nexport const TableFooterRow: FC<TableRowProps> = (props) => {\n return <TableRow {...props} footer={true} />;\n};\n\nexport default TableFooterRow;\n"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"TableFooterRow.mjs","names":[],"sources":["../../../../../../../../../src/components/Table/components/TableFooterRow/TableFooterRow.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport type { TableRowProps } from \"../TableRow\";\nimport { TableRow } from \"../TableRow\";\n\nexport type TableFooterRowProps = TableRowProps;\n\n/* Plain FC: technical constraint — react-aria allows render-function children,\n * which the props types of registered components cannot express. */\n/** @flr-generate all */\nexport const TableFooterRow: FC<TableRowProps> = (props) => {\n return <TableRow {...props} footer={true} />;\n};\n\nexport default TableFooterRow;\n"],"mappings":";;;;;;AASA,IAAa,kBAAqC,UAAU;CAC1D,OAAO,oBAAC,UAAD;EAAU,GAAI;EAAO,QAAQ;CAAO,CAAA;AAC7C"}
|
package/dist/js/packages/components/src/components/Table/components/TableHeader/TableHeader.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeader.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/Table/components/TableHeader/TableHeader.tsx"],"sourcesContent":["import { Children, type FC } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"../../Table.module.scss\";\nimport { IsFirstColumnContext } from \"./context\";\n\nexport type TableHeaderProps = Aria.TableHeaderProps<never>;\n\n/** @flr-generate all */\nexport const TableHeader: FC<TableHeaderProps> = (props) => {\n const { children, className, ...rest } = props;\n\n const rootClassName = clsx(styles.header, className);\n\n // Assumes the first child renders a column; a wrapper that renders nothing\n // leaves the table without row header column, and react-aria throws.\n const columns =\n typeof children === \"function\"\n ? children\n : Children.toArray(children).map((column, index) => (\n <IsFirstColumnContext key={index} value={index === 0}>\n {column}\n </IsFirstColumnContext>\n ));\n\n return (\n <Aria.TableHeader className={rootClassName} {...rest}>\n {columns}\n </Aria.TableHeader>\n );\n};\n\nexport default TableHeader;\n"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"TableHeader.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/Table/components/TableHeader/TableHeader.tsx"],"sourcesContent":["import { Children, type FC } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"../../Table.module.scss\";\nimport { IsFirstColumnContext } from \"./context\";\n\nexport type TableHeaderProps = Aria.TableHeaderProps<never>;\n\n/* Plain FC: technical constraint — react-aria allows render-function children,\n * which the props types of registered components cannot express. */\n/** @flr-generate all */\nexport const TableHeader: FC<TableHeaderProps> = (props) => {\n const { children, className, ...rest } = props;\n\n const rootClassName = clsx(styles.header, className);\n\n // Assumes the first child renders a column; a wrapper that renders nothing\n // leaves the table without row header column, and react-aria throws.\n const columns =\n typeof children === \"function\"\n ? children\n : Children.toArray(children).map((column, index) => (\n <IsFirstColumnContext key={index} value={index === 0}>\n {column}\n </IsFirstColumnContext>\n ));\n\n return (\n <Aria.TableHeader className={rootClassName} {...rest}>\n {columns}\n </Aria.TableHeader>\n );\n};\n\nexport default TableHeader;\n"],"mappings":";;;;;;;;;;AAWA,IAAa,eAAqC,UAAU;CAC1D,MAAM,EAAE,UAAU,WAAW,GAAG,SAAS;CAEzC,MAAM,gBAAgB,KAAKA,qBAAO,QAAQ,SAAS;CAInD,MAAM,UACJ,OAAO,aAAa,aAChB,WACA,SAAS,QAAQ,QAAQ,CAAC,CAAC,KAAK,QAAQ,UACtC,oBAAC,sBAAD;EAAkC,OAAO,UAAU;EAChD,UAAA;CACmB,GAFK,KAEL,CACvB;CAEP,OACE,oBAAC,KAAK,aAAN;EAAkB,WAAW;EAAe,GAAI;EAC7C,UAAA;CACe,CAAA;AAEtB"}
|
package/dist/js/packages/components/src/components/Table/components/TableRow/TableRow.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableRow.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/Table/components/TableRow/TableRow.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"../../Table.module.scss\";\n\nexport type TableRowProps = Aria.RowProps<never> & {\n /** @internal */\n footer?: boolean;\n};\n\n/** @flr-generate all */\nexport const TableRow: FC<TableRowProps> = (props) => {\n const { children, className, footer, ...rest } = props;\n\n return (\n <Aria.Row\n className={(props) =>\n clsx(\n styles.row,\n footer && styles.footer,\n typeof className === \"function\" ? className(props) : className,\n )\n }\n {...rest}\n >\n {children}\n </Aria.Row>\n );\n};\n\nexport default TableRow;\n"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"TableRow.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/Table/components/TableRow/TableRow.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"../../Table.module.scss\";\n\nexport type TableRowProps = Aria.RowProps<never> & {\n /** @internal */\n footer?: boolean;\n};\n\n/* Plain FC: technical constraint — react-aria allows render-function children,\n * which the props types of registered components cannot express. */\n/** @flr-generate all */\nexport const TableRow: FC<TableRowProps> = (props) => {\n const { children, className, footer, ...rest } = props;\n\n return (\n <Aria.Row\n className={(props) =>\n clsx(\n styles.row,\n footer && styles.footer,\n typeof className === \"function\" ? className(props) : className,\n )\n }\n {...rest}\n >\n {children}\n </Aria.Row>\n );\n};\n\nexport default TableRow;\n"],"mappings":";;;;;;;;AAaA,IAAa,YAA+B,UAAU;CACpD,MAAM,EAAE,UAAU,WAAW,QAAQ,GAAG,SAAS;CAEjD,OACE,oBAAC,KAAK,KAAN;EACE,YAAY,UACV,KACEA,qBAAO,KACP,UAAUA,qBAAO,QACjB,OAAO,cAAc,aAAa,UAAU,KAAK,IAAI,SACvD;EAEF,GAAI;EAEH;CACO,CAAA;AAEd"}
|