@mittwald/flow-react-components 1.6.0-next.8 → 1.6.0-next.9
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/AccentBox/AccentBox.mjs +3 -2
- package/dist/js/packages/components/src/components/AccentBox/AccentBox.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Accordion/Accordion.mjs +3 -2
- package/dist/js/packages/components/src/components/Accordion/Accordion.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Alert/Alert.mjs +3 -2
- package/dist/js/packages/components/src/components/Alert/Alert.mjs.map +1 -1
- package/dist/js/packages/components/src/components/CartesianChart/components/YAxis/YAxis.mjs +23 -5
- package/dist/js/packages/components/src/components/CartesianChart/components/YAxis/YAxis.mjs.map +1 -1
- package/dist/js/packages/components/src/components/CartesianChart/hooks/useTickLabelWidth.mjs +67 -0
- package/dist/js/packages/components/src/components/CartesianChart/hooks/useTickLabelWidth.mjs.map +1 -0
- package/dist/js/packages/components/src/components/Heading/Heading.mjs +2 -0
- package/dist/js/packages/components/src/components/Heading/Heading.mjs.map +1 -1
- package/dist/js/packages/components/src/components/IllustratedMessage/IllustratedMessage.mjs +3 -2
- package/dist/js/packages/components/src/components/IllustratedMessage/IllustratedMessage.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Label/Label.mjs +0 -4
- package/dist/js/packages/components/src/components/Label/Label.mjs.map +1 -1
- package/dist/js/packages/components/src/components/List/components/Items/views/GridList/GridList.mjs +3 -0
- package/dist/js/packages/components/src/components/List/components/Items/views/GridList/GridList.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Overlay/components/OverlayContent.mjs +2 -1
- package/dist/js/packages/components/src/components/Overlay/components/OverlayContent.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Popover/components/PopoverContent/PopoverContent.mjs +4 -2
- package/dist/js/packages/components/src/components/Popover/components/PopoverContent/PopoverContent.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Section/Section.mjs +9 -5
- package/dist/js/packages/components/src/components/Section/Section.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Section/components/SectionHeader/SectionHeader.mjs +0 -4
- package/dist/js/packages/components/src/components/Section/components/SectionHeader/SectionHeader.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Section/context.mjs +47 -0
- package/dist/js/packages/components/src/components/Section/context.mjs.map +1 -0
- package/dist/js/packages/components/src/components/Table/Table.mjs +3 -0
- package/dist/js/packages/components/src/components/Table/Table.mjs.map +1 -1
- package/dist/types/components/CartesianChart/hooks/useTickLabelWidth.d.ts +1 -0
- package/dist/types/components/Section/context.d.ts +28 -0
- package/package.json +10 -10
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* */
|
|
3
3
|
import { PropsContextProvider } from "../../lib/propsContext/components/PropsContextProvider.mjs";
|
|
4
4
|
import { flowComponent } from "../../lib/componentFactory/flowComponent.mjs";
|
|
5
|
+
import { SectionHeadingProvider, useSectionHeading } from "./context.mjs";
|
|
5
6
|
import Section_module_default from "./Section.module.mjs";
|
|
6
7
|
import ContextMenuSectionView from "../../views/ContextMenuSectionView.mjs";
|
|
7
8
|
import clsx from "clsx";
|
|
@@ -12,6 +13,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
12
13
|
var Section = flowComponent("Section", (props) => {
|
|
13
14
|
const { children, className, ref, renderContextMenuSection, hideSeparator, ...rest } = props;
|
|
14
15
|
const headingId = useId();
|
|
16
|
+
const sectionHeading = useSectionHeading(headingId);
|
|
15
17
|
if (!children) return null;
|
|
16
18
|
if (renderContextMenuSection) return /* @__PURE__ */ jsx(ContextMenuSectionView, {
|
|
17
19
|
ref,
|
|
@@ -24,16 +26,18 @@ var Section = flowComponent("Section", (props) => {
|
|
|
24
26
|
id: headingId,
|
|
25
27
|
className: Section_module_default.heading
|
|
26
28
|
},
|
|
27
|
-
Header: { renderSectionHeader: true }
|
|
28
|
-
List: { "aria-labelledby": headingId }
|
|
29
|
+
Header: { renderSectionHeader: true }
|
|
29
30
|
};
|
|
30
31
|
return /* @__PURE__ */ jsx("section", {
|
|
31
32
|
...rest,
|
|
32
33
|
className: rootClassName,
|
|
33
34
|
ref,
|
|
34
|
-
children: /* @__PURE__ */ jsx(
|
|
35
|
-
|
|
36
|
-
children
|
|
35
|
+
children: /* @__PURE__ */ jsx(SectionHeadingProvider, {
|
|
36
|
+
value: sectionHeading,
|
|
37
|
+
children: /* @__PURE__ */ jsx(PropsContextProvider, {
|
|
38
|
+
props: propsContext,
|
|
39
|
+
children
|
|
40
|
+
})
|
|
37
41
|
})
|
|
38
42
|
});
|
|
39
43
|
}, { type: "layout" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Section.mjs","names":["styles"],"sources":["../../../../../../../src/components/Section/Section.tsx"],"sourcesContent":["import type { ComponentProps, PropsWithChildren } from \"react\";\nimport { useId } from \"react\";\nimport styles from \"./Section.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport ContextMenuSectionView from \"@/views/ContextMenuSectionView\";\n\nexport interface SectionProps\n extends\n PropsWithChildren<ComponentProps<\"section\">>,\n FlowComponentProps<HTMLElement> {\n /** @internal */\n renderContextMenuSection?: boolean;\n /** @internal */\n hideSeparator?: boolean;\n}\n\n/** @flr-generate all */\nexport const Section = flowComponent(\n \"Section\",\n (props) => {\n const {\n children,\n className,\n ref,\n renderContextMenuSection,\n hideSeparator,\n ...rest\n } = props;\n\n const headingId = useId();\n\n if (!children) {\n return null;\n }\n\n if (renderContextMenuSection) {\n return (\n <ContextMenuSectionView ref={ref as never}>\n {children}\n </ContextMenuSectionView>\n );\n }\n\n const rootClassName = clsx(\n styles.section,\n hideSeparator && styles.hideSeparator,\n className,\n );\n\n const propsContext: PropsContext = {\n Heading: {\n level: 2,\n id: headingId,\n className: styles.heading,\n },\n Header: {\n renderSectionHeader: true,\n },\n
|
|
1
|
+
{"version":3,"file":"Section.mjs","names":["styles"],"sources":["../../../../../../../src/components/Section/Section.tsx"],"sourcesContent":["import type { ComponentProps, PropsWithChildren } from \"react\";\nimport { useId } from \"react\";\nimport styles from \"./Section.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport ContextMenuSectionView from \"@/views/ContextMenuSectionView\";\nimport { SectionHeadingProvider, useSectionHeading } from \"./context\";\n\nexport interface SectionProps\n extends\n PropsWithChildren<ComponentProps<\"section\">>,\n FlowComponentProps<HTMLElement> {\n /** @internal */\n renderContextMenuSection?: boolean;\n /** @internal */\n hideSeparator?: boolean;\n}\n\n/** @flr-generate all */\nexport const Section = flowComponent(\n \"Section\",\n (props) => {\n const {\n children,\n className,\n ref,\n renderContextMenuSection,\n hideSeparator,\n ...rest\n } = props;\n\n const headingId = useId();\n const sectionHeading = useSectionHeading(headingId);\n\n if (!children) {\n return null;\n }\n\n if (renderContextMenuSection) {\n return (\n <ContextMenuSectionView ref={ref as never}>\n {children}\n </ContextMenuSectionView>\n );\n }\n\n const rootClassName = clsx(\n styles.section,\n hideSeparator && styles.hideSeparator,\n className,\n );\n\n const propsContext: PropsContext = {\n Heading: {\n level: 2,\n id: headingId,\n className: styles.heading,\n },\n Header: {\n renderSectionHeader: true,\n },\n };\n\n return (\n <section {...rest} className={rootClassName} ref={ref}>\n <SectionHeadingProvider value={sectionHeading}>\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n </SectionHeadingProvider>\n </section>\n );\n },\n {\n type: \"layout\",\n },\n);\n\nexport default Section;\n"],"mappings":";;;;;;;;;;;;AAsBA,IAAa,UAAU,cACrB,YACC,UAAU;CACT,MAAM,EACJ,UACA,WACA,KACA,0BACA,eACA,GAAG,SACD;CAEJ,MAAM,YAAY,MAAM;CACxB,MAAM,iBAAiB,kBAAkB,SAAS;CAElD,IAAI,CAAC,UACH,OAAO;CAGT,IAAI,0BACF,OACE,oBAAC,wBAAD;EAA6B;EAC1B;CACqB,CAAA;CAI5B,MAAM,gBAAgB,KACpBA,uBAAO,SACP,iBAAiBA,uBAAO,eACxB,SACF;CAEA,MAAM,eAA6B;EACjC,SAAS;GACP,OAAO;GACP,IAAI;GACJ,WAAWA,uBAAO;EACpB;EACA,QAAQ,EACN,qBAAqB,KACvB;CACF;CAEA,OACE,oBAAC,WAAD;EAAS,GAAI;EAAM,WAAW;EAAoB;EAChD,UAAA,oBAAC,wBAAD;GAAwB,OAAO;GAC7B,UAAA,oBAAC,sBAAD;IAAsB,OAAO;IAC1B;GACmB,CAAA;EACA,CAAA;CACjB,CAAA;AAEb,GACA,EACE,MAAM,SACR,CACF"}
|
|
@@ -40,10 +40,6 @@ var SectionHeader = flowComponent("SectionHeader", (props) => {
|
|
|
40
40
|
tunnel: actionsTunnel,
|
|
41
41
|
Button: { size: "s" }
|
|
42
42
|
},
|
|
43
|
-
Action: {
|
|
44
|
-
tunnel: actionsTunnel,
|
|
45
|
-
Button: { tunnel: null }
|
|
46
|
-
},
|
|
47
43
|
Heading: { level: 2 },
|
|
48
44
|
Link: { tunnel: actionsTunnel }
|
|
49
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionHeader.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/Section/components/SectionHeader/SectionHeader.tsx"],"sourcesContent":["import type { FC, PropsWithChildren, RefAttributes } from \"react\";\nimport styles from \"./SectionHeader.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport {\n overlayTriggersTunneledTo,\n PropsContextProvider,\n} from \"@/lib/propsContext\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\n\nexport type SectionHeaderProps = PropsWithChildren &\n PropsWithClassName &\n RefAttributes<HTMLHeadingElement>;\n\nexport const SectionHeader: FC<SectionHeaderProps> = flowComponent(\n \"SectionHeader\",\n (props) => {\n const { children, className, ref } = props;\n\n const rootClassName = clsx(styles.sectionHeader, className);\n\n const actionsTunnel = {\n id: \"actions\",\n component: \"SectionHeader\",\n } as const;\n\n const propsContext: PropsContext = {\n ...overlayTriggersTunneledTo(actionsTunnel),\n Switch: {\n labelPosition: \"leading\",\n tunnel: actionsTunnel,\n },\n Button: {\n size: \"s\",\n tunnel: actionsTunnel,\n },\n ActionGroup: {\n preserveOrder: true,\n size: \"s\",\n tunnel: actionsTunnel,\n Button: {\n tunnel: null,\n },\n Switch: {\n tunnel: null,\n },\n Link: {\n size: \"m\",\n tunnel: null,\n },\n },\n FileField: {\n tunnel: actionsTunnel,\n Button: { size: \"s\" },\n },\n
|
|
1
|
+
{"version":3,"file":"SectionHeader.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/Section/components/SectionHeader/SectionHeader.tsx"],"sourcesContent":["import type { FC, PropsWithChildren, RefAttributes } from \"react\";\nimport styles from \"./SectionHeader.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport {\n overlayTriggersTunneledTo,\n PropsContextProvider,\n} from \"@/lib/propsContext\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\n\nexport type SectionHeaderProps = PropsWithChildren &\n PropsWithClassName &\n RefAttributes<HTMLHeadingElement>;\n\nexport const SectionHeader: FC<SectionHeaderProps> = flowComponent(\n \"SectionHeader\",\n (props) => {\n const { children, className, ref } = props;\n\n const rootClassName = clsx(styles.sectionHeader, className);\n\n const actionsTunnel = {\n id: \"actions\",\n component: \"SectionHeader\",\n } as const;\n\n const propsContext: PropsContext = {\n ...overlayTriggersTunneledTo(actionsTunnel),\n Switch: {\n labelPosition: \"leading\",\n tunnel: actionsTunnel,\n },\n Button: {\n size: \"s\",\n tunnel: actionsTunnel,\n },\n ActionGroup: {\n preserveOrder: true,\n size: \"s\",\n tunnel: actionsTunnel,\n Button: {\n tunnel: null,\n },\n Switch: {\n tunnel: null,\n },\n Link: {\n size: \"m\",\n tunnel: null,\n },\n },\n FileField: {\n tunnel: actionsTunnel,\n Button: { size: \"s\" },\n },\n Heading: {\n level: 2,\n },\n Link: {\n tunnel: actionsTunnel,\n },\n };\n\n return (\n <header ref={ref} className={rootClassName}>\n <PropsContextProvider props={propsContext}>\n {children}\n <div className={styles.actions}>\n <UiComponentTunnelExit id=\"actions\" component=\"SectionHeader\" />\n </div>\n </PropsContextProvider>\n </header>\n );\n },\n {\n type: \"layout\",\n },\n);\n\nexport default SectionHeader;\n"],"mappings":";;;;;;;;;;AAgBA,IAAa,gBAAwC,cACnD,kBACC,UAAU;CACT,MAAM,EAAE,UAAU,WAAW,QAAQ;CAErC,MAAM,gBAAgB,KAAKA,6BAAO,eAAe,SAAS;CAE1D,MAAM,gBAAgB;EACpB,IAAI;EACJ,WAAW;CACb;CAEA,MAAM,eAA6B;EACjC,GAAG,0BAA0B,aAAa;EAC1C,QAAQ;GACN,eAAe;GACf,QAAQ;EACV;EACA,QAAQ;GACN,MAAM;GACN,QAAQ;EACV;EACA,aAAa;GACX,eAAe;GACf,MAAM;GACN,QAAQ;GACR,QAAQ,EACN,QAAQ,KACV;GACA,QAAQ,EACN,QAAQ,KACV;GACA,MAAM;IACJ,MAAM;IACN,QAAQ;GACV;EACF;EACA,WAAW;GACT,QAAQ;GACR,QAAQ,EAAE,MAAM,IAAI;EACtB;EACA,SAAS,EACP,OAAO,EACT;EACA,MAAM,EACJ,QAAQ,cACV;CACF;CAEA,OACE,oBAAC,UAAD;EAAa;EAAK,WAAW;EAC3B,UAAA,qBAAC,sBAAD;GAAsB,OAAO;GAA7B,UAAA,CACG,UACD,oBAAC,OAAD;IAAK,WAAWA,6BAAO;IACrB,UAAA,oBAAC,uBAAD;KAAuB,IAAG;KAAU,WAAU;IAAiB,CAAA;GAC5D,CAAA,CACe;;CAChB,CAAA;AAEZ,GACA,EACE,MAAM,SACR,CACF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
import { createContext, createElement, useCallback, useContext, useLayoutEffect, useMemo, useState } from "react";
|
|
4
|
+
//#region src/components/Section/context.ts
|
|
5
|
+
var sectionHeadingContext = createContext(void 0);
|
|
6
|
+
/** The heading state a `Section` provides for the given heading id. */
|
|
7
|
+
var useSectionHeading = (id) => {
|
|
8
|
+
const [renderedCount, setRenderedCount] = useState(0);
|
|
9
|
+
const register = useCallback(() => {
|
|
10
|
+
setRenderedCount((count) => count + 1);
|
|
11
|
+
return () => setRenderedCount((count) => count - 1);
|
|
12
|
+
}, []);
|
|
13
|
+
return useMemo(() => ({
|
|
14
|
+
id,
|
|
15
|
+
isRendered: renderedCount > 0,
|
|
16
|
+
register
|
|
17
|
+
}), [
|
|
18
|
+
id,
|
|
19
|
+
renderedCount,
|
|
20
|
+
register
|
|
21
|
+
]);
|
|
22
|
+
};
|
|
23
|
+
var SectionHeadingProvider = sectionHeadingContext.Provider;
|
|
24
|
+
/**
|
|
25
|
+
* Ends the surrounding `Section`'s heading scope, for content that has a
|
|
26
|
+
* heading of its own (`Accordion`, `Alert`, an overlay, …).
|
|
27
|
+
*/
|
|
28
|
+
var SectionHeadingReset = ({ children }) => createElement(sectionHeadingContext.Provider, { value: void 0 }, children);
|
|
29
|
+
/** Marks the section heading as rendered while a heading carries its id. */
|
|
30
|
+
var useRegisterSectionHeading = (id) => {
|
|
31
|
+
const sectionHeading = useContext(sectionHeadingContext);
|
|
32
|
+
const register = sectionHeading && id === sectionHeading.id ? sectionHeading.register : void 0;
|
|
33
|
+
useLayoutEffect(() => register?.(), [register]);
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The `aria-labelledby` of a grid or table: its own label, else the heading of
|
|
37
|
+
* the surrounding `Section` once that heading renders.
|
|
38
|
+
*/
|
|
39
|
+
var useLabelledBySectionHeading = (props) => {
|
|
40
|
+
const sectionHeading = useContext(sectionHeadingContext);
|
|
41
|
+
if (props["aria-labelledby"] || props["aria-label"]) return props["aria-labelledby"];
|
|
42
|
+
return sectionHeading?.isRendered ? sectionHeading.id : void 0;
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
export { SectionHeadingProvider, SectionHeadingReset, useLabelledBySectionHeading, useRegisterSectionHeading, useSectionHeading };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=context.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.mjs","names":[],"sources":["../../../../../../../src/components/Section/context.ts"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport {\n createContext,\n createElement,\n useCallback,\n useContext,\n useLayoutEffect,\n useMemo,\n useState,\n} from \"react\";\n\ninterface SectionHeading {\n /** The id the surrounding `Section` gives its heading. */\n id: string;\n /** Whether a heading currently renders with that id. */\n isRendered: boolean;\n /** Called by a heading that renders with the id; returns the cleanup. */\n register: () => () => void;\n}\n\nconst sectionHeadingContext = createContext<SectionHeading | undefined>(\n undefined,\n);\n\n/** The heading state a `Section` provides for the given heading id. */\nexport const useSectionHeading = (id: string): SectionHeading => {\n const [renderedCount, setRenderedCount] = useState(0);\n\n const register = useCallback(() => {\n setRenderedCount((count) => count + 1);\n return () => setRenderedCount((count) => count - 1);\n }, []);\n\n return useMemo(\n () => ({ id, isRendered: renderedCount > 0, register }),\n [id, renderedCount, register],\n );\n};\n\nexport const SectionHeadingProvider = sectionHeadingContext.Provider;\n\n/**\n * Ends the surrounding `Section`'s heading scope, for content that has a\n * heading of its own (`Accordion`, `Alert`, an overlay, …).\n */\nexport const SectionHeadingReset: FC<PropsWithChildren> = ({ children }) =>\n createElement(sectionHeadingContext.Provider, { value: undefined }, children);\n\n/** Marks the section heading as rendered while a heading carries its id. */\nexport const useRegisterSectionHeading = (id: string | undefined) => {\n const sectionHeading = useContext(sectionHeadingContext);\n const register =\n sectionHeading && id === sectionHeading.id\n ? sectionHeading.register\n : undefined;\n\n useLayoutEffect(() => register?.(), [register]);\n};\n\n/**\n * The `aria-labelledby` of a grid or table: its own label, else the heading of\n * the surrounding `Section` once that heading renders.\n */\nexport const useLabelledBySectionHeading = (props: {\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n}): string | undefined => {\n const sectionHeading = useContext(sectionHeadingContext);\n\n if (props[\"aria-labelledby\"] || props[\"aria-label\"]) {\n return props[\"aria-labelledby\"];\n }\n\n return sectionHeading?.isRendered ? sectionHeading.id : undefined;\n};\n"],"mappings":";;;;AAoBA,IAAM,wBAAwB,cAC5B,KAAA,CACF;;AAGA,IAAa,qBAAqB,OAA+B;CAC/D,MAAM,CAAC,eAAe,oBAAoB,SAAS,CAAC;CAEpD,MAAM,WAAW,kBAAkB;EACjC,kBAAkB,UAAU,QAAQ,CAAC;EACrC,aAAa,kBAAkB,UAAU,QAAQ,CAAC;CACpD,GAAG,CAAC,CAAC;CAEL,OAAO,eACE;EAAE;EAAI,YAAY,gBAAgB;EAAG;CAAS,IACrD;EAAC;EAAI;EAAe;CAAQ,CAC9B;AACF;AAEA,IAAa,yBAAyB,sBAAsB;;;;;AAM5D,IAAa,uBAA8C,EAAE,eAC3D,cAAc,sBAAsB,UAAU,EAAE,OAAO,KAAA,EAAU,GAAG,QAAQ;;AAG9E,IAAa,6BAA6B,OAA2B;CACnE,MAAM,iBAAiB,WAAW,qBAAqB;CACvD,MAAM,WACJ,kBAAkB,OAAO,eAAe,KACpC,eAAe,WACf,KAAA;CAEN,sBAAsB,WAAW,GAAG,CAAC,QAAQ,CAAC;AAChD;;;;;AAMA,IAAa,+BAA+B,UAGlB;CACxB,MAAM,iBAAiB,WAAW,qBAAqB;CAEvD,IAAI,MAAM,sBAAsB,MAAM,eACpC,OAAO,MAAM;CAGf,OAAO,gBAAgB,aAAa,eAAe,KAAK,KAAA;AAC1D"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
+
import { useLabelledBySectionHeading } from "../Section/context.mjs";
|
|
3
4
|
import Table_module_default from "./Table.module.mjs";
|
|
4
5
|
import clsx from "clsx";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -8,6 +9,7 @@ import * as Aria from "react-aria-components";
|
|
|
8
9
|
/** @flr-generate all */
|
|
9
10
|
var Table = (props) => {
|
|
10
11
|
const { children, className, verticalAlign = "top", layout = "auto", minWidth, ...rest } = props;
|
|
12
|
+
const ariaLabelledBy = useLabelledBySectionHeading(rest);
|
|
11
13
|
const rootClassName = clsx(Table_module_default.table, verticalAlign !== "top" && Table_module_default[`vertical-align-${verticalAlign}`], Table_module_default[`layout-${layout}`], className);
|
|
12
14
|
return /* @__PURE__ */ jsx("div", {
|
|
13
15
|
className: Table_module_default.tableContainer,
|
|
@@ -17,6 +19,7 @@ var Table = (props) => {
|
|
|
17
19
|
children: /* @__PURE__ */ jsx(Aria.Table, {
|
|
18
20
|
className: rootClassName,
|
|
19
21
|
...rest,
|
|
22
|
+
"aria-labelledby": ariaLabelledBy,
|
|
20
23
|
children
|
|
21
24
|
})
|
|
22
25
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.mjs","names":["styles"],"sources":["../../../../../../../src/components/Table/Table.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 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};\n\n/** @flr-generate all */\nexport const Table: FC<TableProps> = (props) => {\n const {\n children,\n className,\n verticalAlign = \"top\",\n layout = \"auto\",\n minWidth,\n ...rest\n } = props;\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}>\n <div className={styles.tableScrollArea} style={{ minWidth }}>\n <Aria.Table
|
|
1
|
+
{"version":3,"file":"Table.mjs","names":["styles"],"sources":["../../../../../../../src/components/Table/Table.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"./Table.module.scss\";\nimport { useLabelledBySectionHeading } from \"@/components/Section/context\";\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};\n\n/** @flr-generate all */\nexport const Table: FC<TableProps> = (props) => {\n const {\n children,\n className,\n verticalAlign = \"top\",\n layout = \"auto\",\n minWidth,\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}>\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":";;;;;;;;;AA2BA,IAAa,SAAyB,UAAU;CAC9C,MAAM,EACJ,UACA,WACA,gBAAgB,OAChB,SAAS,QACT,UACA,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;EACrB,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
interface SectionHeading {
|
|
3
|
+
/** The id the surrounding `Section` gives its heading. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Whether a heading currently renders with that id. */
|
|
6
|
+
isRendered: boolean;
|
|
7
|
+
/** Called by a heading that renders with the id; returns the cleanup. */
|
|
8
|
+
register: () => () => void;
|
|
9
|
+
}
|
|
10
|
+
/** The heading state a `Section` provides for the given heading id. */
|
|
11
|
+
export declare const useSectionHeading: (id: string) => SectionHeading;
|
|
12
|
+
export declare const SectionHeadingProvider: import('react').Provider<SectionHeading | undefined>;
|
|
13
|
+
/**
|
|
14
|
+
* Ends the surrounding `Section`'s heading scope, for content that has a
|
|
15
|
+
* heading of its own (`Accordion`, `Alert`, an overlay, …).
|
|
16
|
+
*/
|
|
17
|
+
export declare const SectionHeadingReset: FC<PropsWithChildren>;
|
|
18
|
+
/** Marks the section heading as rendered while a heading carries its id. */
|
|
19
|
+
export declare const useRegisterSectionHeading: (id: string | undefined) => void;
|
|
20
|
+
/**
|
|
21
|
+
* The `aria-labelledby` of a grid or table: its own label, else the heading of
|
|
22
|
+
* the surrounding `Section` once that heading renders.
|
|
23
|
+
*/
|
|
24
|
+
export declare const useLabelledBySectionHeading: (props: {
|
|
25
|
+
"aria-label"?: string;
|
|
26
|
+
"aria-labelledby"?: string;
|
|
27
|
+
}) => string | undefined;
|
|
28
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-react-components",
|
|
3
|
-
"version": "1.6.0-next.
|
|
3
|
+
"version": "1.6.0-next.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React implementation of Flow, mittwald’s design system",
|
|
6
6
|
"homepage": "https://flow.mittwald.de",
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
"@internationalized/string-compiler": "^3.4.1",
|
|
85
85
|
"@lezer/common": "^1.5.2",
|
|
86
86
|
"@lezer/highlight": "^1.2.3",
|
|
87
|
-
"@mittwald/flow-icons": "^1.6.0-next.
|
|
87
|
+
"@mittwald/flow-icons": "^1.6.0-next.9",
|
|
88
88
|
"@mittwald/password-tools-js": "^3.0.0",
|
|
89
|
-
"@mittwald/react-tunnel": "^1.6.0-next.
|
|
89
|
+
"@mittwald/react-tunnel": "^1.6.0-next.9",
|
|
90
90
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
91
91
|
"@react-aria/form": "^3.2.1",
|
|
92
92
|
"@react-aria/i18n": "^3.13.1",
|
|
@@ -139,13 +139,13 @@
|
|
|
139
139
|
"@internationalized/date": "^3.12.3",
|
|
140
140
|
"@lezer/generator": "^1.8.0",
|
|
141
141
|
"@lezer/lr": "^1.4.10",
|
|
142
|
-
"@mittwald/flow-components-base": "1.6.0-next.
|
|
143
|
-
"@mittwald/flow-core": "1.6.0-next.
|
|
144
|
-
"@mittwald/flow-design-tokens": "1.6.0-next.
|
|
145
|
-
"@mittwald/flow-icons-base": "1.6.0-next.
|
|
142
|
+
"@mittwald/flow-components-base": "1.6.0-next.9",
|
|
143
|
+
"@mittwald/flow-core": "1.6.0-next.9",
|
|
144
|
+
"@mittwald/flow-design-tokens": "1.6.0-next.9",
|
|
145
|
+
"@mittwald/flow-icons-base": "1.6.0-next.9",
|
|
146
146
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
147
147
|
"@mittwald/remote-dom-react": "1.2.2-mittwald.10",
|
|
148
|
-
"@mittwald/typescript-config": "1.6.0-next.
|
|
148
|
+
"@mittwald/typescript-config": "1.6.0-next.9",
|
|
149
149
|
"@nx/storybook": "^22.7.6",
|
|
150
150
|
"@storybook/addon-a11y": "^10.5.10",
|
|
151
151
|
"@storybook/addon-actions": "^9.0.8",
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
},
|
|
200
200
|
"peerDependencies": {
|
|
201
201
|
"@internationalized/date": "^3.12.2",
|
|
202
|
-
"@mittwald/flow-icons-pro": "1.6.0-next.
|
|
202
|
+
"@mittwald/flow-icons-pro": "1.6.0-next.9",
|
|
203
203
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
204
204
|
"next": "^16.2.3",
|
|
205
205
|
"react": "^19.2.0",
|
|
@@ -223,5 +223,5 @@
|
|
|
223
223
|
"browserslist": [
|
|
224
224
|
"baseline widely available"
|
|
225
225
|
],
|
|
226
|
-
"gitHead": "
|
|
226
|
+
"gitHead": "0655846db24c4140226ba5ea46101d4f52866826"
|
|
227
227
|
}
|