@planningcenter/tapestry 4.11.0-rc.0 → 4.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/components/DataTable/DataTable.d.ts +7 -5
  2. package/dist/components/DataTable/DataTable.d.ts.map +1 -1
  3. package/dist/components/DataTable/DataTable.js.map +1 -1
  4. package/dist/components/DataTable/SavedViewsBar.d.ts +5 -2
  5. package/dist/components/DataTable/SavedViewsBar.d.ts.map +1 -1
  6. package/dist/components/DataTable/SavedViewsBar.js +17 -18
  7. package/dist/components/DataTable/SavedViewsBar.js.map +1 -1
  8. package/dist/components/DataTable/savedViews.d.ts +5 -4
  9. package/dist/components/DataTable/savedViews.d.ts.map +1 -1
  10. package/dist/components/DataTable/savedViews.js +4 -3
  11. package/dist/components/DataTable/savedViews.js.map +1 -1
  12. package/dist/components/DataTable/useActiveSavedView.d.ts +7 -0
  13. package/dist/components/DataTable/useActiveSavedView.d.ts.map +1 -0
  14. package/dist/components/DataTable/useActiveSavedView.js +23 -0
  15. package/dist/components/DataTable/useActiveSavedView.js.map +1 -0
  16. package/dist/components/link/IconLink.d.ts +3 -3
  17. package/dist/components/segmented-control/IconSegment.d.ts +1 -1
  18. package/dist/components/segmented-control/Segment.d.ts +1 -1
  19. package/dist/components/segmented-control/SegmentBase.d.ts +1 -1
  20. package/dist/components/sidenav/Sidenav.d.ts.map +1 -1
  21. package/dist/components/sidenav/Sidenav.js +14 -3
  22. package/dist/components/sidenav/Sidenav.js.map +1 -1
  23. package/dist/components/sidenav/SidenavItem.d.ts.map +1 -1
  24. package/dist/components/sidenav/SidenavItem.js +4 -2
  25. package/dist/components/sidenav/SidenavItem.js.map +1 -1
  26. package/dist/components/sidenav/SidenavSection.d.ts +21 -11
  27. package/dist/components/sidenav/SidenavSection.d.ts.map +1 -1
  28. package/dist/components/sidenav/SidenavSection.js +14 -3
  29. package/dist/components/sidenav/SidenavSection.js.map +1 -1
  30. package/dist/components/sidenav/index.js +1 -0
  31. package/dist/components/sidenav/index.js.map +1 -1
  32. package/dist/components/sidenav/private/SidenavResponsiveHeader.d.ts +6 -0
  33. package/dist/components/sidenav/private/SidenavResponsiveHeader.d.ts.map +1 -0
  34. package/dist/components/sidenav/private/SidenavResponsiveHeader.js +12 -0
  35. package/dist/components/sidenav/private/SidenavResponsiveHeader.js.map +1 -0
  36. package/dist/components/sidenav/private/withSlotChildrenAsActions.d.ts +15 -0
  37. package/dist/components/sidenav/private/withSlotChildrenAsActions.d.ts.map +1 -0
  38. package/dist/components/sidenav/private/withSlotChildrenAsActions.js +62 -0
  39. package/dist/components/sidenav/private/withSlotChildrenAsActions.js.map +1 -0
  40. package/dist/index.css +6 -2
  41. package/dist/index.css.map +1 -1
  42. package/dist/reactRender.css +896 -892
  43. package/dist/reactRender.css.map +1 -1
  44. package/dist/reactRenderLegacy.css +896 -892
  45. package/dist/reactRenderLegacy.css.map +1 -1
  46. package/dist/tapestryMount.css +896 -892
  47. package/dist/tapestryMount.css.map +1 -1
  48. package/dist/tapestryMountLegacy.css +896 -892
  49. package/dist/tapestryMountLegacy.css.map +1 -1
  50. package/dist/unstable.css +6 -2
  51. package/dist/unstable.css.map +1 -1
  52. package/package.json +2 -2
@@ -29,6 +29,9 @@ export declare const IconLink: React.ForwardRefExoticComponent<Omit<{
29
29
  target?: React.HTMLAttributeAnchorTarget | undefined;
30
30
  popover?: "" | "auto" | "manual" | undefined;
31
31
  "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined | undefined;
32
+ type?: string | undefined | undefined;
33
+ id?: string | undefined | undefined;
34
+ "aria-expanded"?: (boolean | "true" | "false") | undefined;
32
35
  defaultChecked?: boolean | undefined | undefined;
33
36
  defaultValue?: string | number | readonly string[] | undefined;
34
37
  suppressContentEditableWarning?: boolean | undefined | undefined;
@@ -39,7 +42,6 @@ export declare const IconLink: React.ForwardRefExoticComponent<Omit<{
39
42
  contextMenu?: string | undefined | undefined;
40
43
  draggable?: (boolean | "true" | "false") | undefined;
41
44
  hidden?: boolean | undefined | undefined;
42
- id?: string | undefined | undefined;
43
45
  lang?: string | undefined | undefined;
44
46
  nonce?: string | undefined | undefined;
45
47
  spellCheck?: (boolean | "true" | "false") | undefined;
@@ -89,7 +91,6 @@ export declare const IconLink: React.ForwardRefExoticComponent<Omit<{
89
91
  "aria-disabled"?: (boolean | "true" | "false") | undefined;
90
92
  "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined | undefined;
91
93
  "aria-errormessage"?: string | undefined | undefined;
92
- "aria-expanded"?: (boolean | "true" | "false") | undefined;
93
94
  "aria-flowto"?: string | undefined | undefined;
94
95
  "aria-grabbed"?: (boolean | "true" | "false") | undefined;
95
96
  "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined | undefined;
@@ -287,7 +288,6 @@ export declare const IconLink: React.ForwardRefExoticComponent<Omit<{
287
288
  onTransitionEnd?: React.TransitionEventHandler<HTMLAnchorElement> | undefined;
288
289
  onTransitionEndCapture?: React.TransitionEventHandler<HTMLAnchorElement> | undefined;
289
290
  media?: string | undefined | undefined;
290
- type?: string | undefined | undefined;
291
291
  download?: any;
292
292
  hrefLang?: string | undefined | undefined;
293
293
  ping?: string | undefined | undefined;
@@ -24,5 +24,5 @@ export type IconSegmentElementProps = Omit<ButtonHTMLAttributes<HTMLButtonElemen
24
24
  * @component
25
25
  * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-segmentedcontrol--docs | Storybook Documentation}
26
26
  */
27
- export declare const IconSegment: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children" | "tabIndex" | "role" | "aria-checked" | "onKeyDown" | "onClick" | "type" | keyof IconSegmentProps> & IconSegmentProps & React.RefAttributes<HTMLButtonElement>>;
27
+ export declare const IconSegment: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children" | "type" | "tabIndex" | "role" | "aria-checked" | "onKeyDown" | "onClick" | keyof IconSegmentProps> & IconSegmentProps & React.RefAttributes<HTMLButtonElement>>;
28
28
  //# sourceMappingURL=IconSegment.d.ts.map
@@ -29,5 +29,5 @@ export type SegmentElementProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>,
29
29
  * @component
30
30
  * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-segmentedcontrol--docs | Storybook Documentation}
31
31
  */
32
- export declare const Segment: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children" | "tabIndex" | "role" | "aria-checked" | "onKeyDown" | "onClick" | "type" | keyof SegmentProps> & SegmentProps & React.RefAttributes<HTMLButtonElement>>;
32
+ export declare const Segment: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children" | "type" | "tabIndex" | "role" | "aria-checked" | "onKeyDown" | "onClick" | keyof SegmentProps> & SegmentProps & React.RefAttributes<HTMLButtonElement>>;
33
33
  //# sourceMappingURL=Segment.d.ts.map
@@ -14,5 +14,5 @@ export type SegmentBaseElementProps = Omit<ButtonHTMLAttributes<HTMLButtonElemen
14
14
  * and disabled propagation all live here so the two public components only
15
15
  * differ in what they render inside the button.
16
16
  */
17
- export declare const SegmentBase: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children" | "tabIndex" | "role" | "aria-checked" | "onKeyDown" | "onClick" | "type" | keyof SegmentBaseProps> & SegmentBaseProps & React.RefAttributes<HTMLButtonElement>>;
17
+ export declare const SegmentBase: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children" | "type" | "tabIndex" | "role" | "aria-checked" | "onKeyDown" | "onClick" | keyof SegmentBaseProps> & SegmentBaseProps & React.RefAttributes<HTMLButtonElement>>;
18
18
  //# sourceMappingURL=SegmentBase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sidenav.d.ts","sourceRoot":"","sources":["../../../src/components/sidenav/Sidenav.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,SAAS,GACV,EAAE;IACD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,qBAcA"}
1
+ {"version":3,"file":"Sidenav.d.ts","sourceRoot":"","sources":["../../../src/components/sidenav/Sidenav.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,KAAmB,EACnB,iBAAiB,EACjB,SAAS,EACT,SAAS,GACV,EAAE;IACD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,qBAuBA"}
@@ -1,4 +1,7 @@
1
+ import { useId } from '../../utilities/useId.js';
2
+ import classNames from 'classnames';
1
3
  import React from 'react';
4
+ import { SidenavResponsiveHeader } from './private/SidenavResponsiveHeader.js';
2
5
 
3
6
  /**
4
7
  * The sidenav lets users navigate through subsets of data pertaining to a resource.
@@ -12,9 +15,17 @@ import React from 'react';
12
15
  * @component
13
16
  * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/application-admin-sidenav--docs | Storybook Documentation}
14
17
  */
15
- function Sidenav({ children, label, selectedItemLabel, className, popoverId, }) {
16
- const popoverIdProp = popoverId && popoverId.trim() ? { "popover-id": popoverId } : {};
17
- return (React.createElement("tds-sidenav", { label: label, "selected-item-label": selectedItemLabel, class: className, ...popoverIdProp }, children));
18
+ function Sidenav({ children, label = "Secondary", selectedItemLabel, className, popoverId, }) {
19
+ const id = useId();
20
+ const menuId = `tds-sidenav-menu-${id}`;
21
+ const resolvedPopoverId = popoverId?.trim() || `${menuId}-popover`;
22
+ // `tds-sidenav-collapse` takes the place of Stencil's
23
+ // `tds-popover-container`, so Rails can render the same markup without React.
24
+ return (React.createElement("div", { className: classNames("tds-sidenav", className) },
25
+ React.createElement("nav", { id: menuId, className: "tds-sidenav-nav", "aria-label": label },
26
+ React.createElement(SidenavResponsiveHeader, { label: selectedItemLabel, popoverId: resolvedPopoverId }),
27
+ React.createElement("tds-sidenav-collapse", { id: resolvedPopoverId, class: "tds-sidenav-collapse" },
28
+ React.createElement("div", { className: "tds-sidenav-scroll-container" }, children)))));
18
29
  }
19
30
 
20
31
  export { Sidenav };
@@ -1 +1 @@
1
- {"version":3,"file":"Sidenav.js","sources":["../../../src/components/sidenav/Sidenav.tsx"],"sourcesContent":["import React from \"react\"\n\n/**\n * The sidenav lets users navigate through subsets of data pertaining to a resource.\n * It can be nested under the page header navigation, as secondary navigation.\n *\n * The expected structure of a `Sidenav` is:\n * `<Sidenav> <SidenavSection> <SidenavItem /> </SidenavSection> </Sidenav>`\n *\n * Please refer to each component's documentation for more information on how to use them.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/application-admin-sidenav--docs | Storybook Documentation}\n */\nexport function Sidenav({\n children,\n label,\n selectedItemLabel,\n className,\n popoverId,\n}: {\n /**\n * Default slot used to nest `SidenavSection` components.\n */\n children: React.ReactNode\n className?: string\n /**\n * Label for the sidenav, used for accessibility.\n */\n label?: string\n /**\n * The id of the popover container.\n */\n popoverId?: string\n /**\n * Label displayed in the responsive header of the sidenav.\n */\n selectedItemLabel?: string\n}) {\n const popoverIdProp =\n popoverId && popoverId.trim() ? { \"popover-id\": popoverId } : {}\n\n return (\n <tds-sidenav\n label={label}\n selected-item-label={selectedItemLabel}\n class={className}\n {...popoverIdProp}\n >\n {children}\n </tds-sidenav>\n )\n}\n"],"names":[],"mappings":";;AAEA;;;;;;;;;;;AAWG;AACG,SAAU,OAAO,CAAC,EACtB,QAAQ,EACR,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,SAAS,GAmBV,EAAA;IACC,MAAM,aAAa,GACjB,SAAS,IAAI,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,EAAE;AAElE,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EACE,KAAK,EAAE,KAAK,yBACS,iBAAiB,EACtC,KAAK,EAAE,SAAS,EAAA,GACZ,aAAa,IAEhB,QAAQ,CACG;AAElB;;;;"}
1
+ {"version":3,"file":"Sidenav.js","sources":["../../../src/components/sidenav/Sidenav.tsx"],"sourcesContent":["import { useId } from \"@utilities/useId\"\nimport classnames from \"classnames\"\nimport React from \"react\"\n\nimport { SidenavResponsiveHeader } from \"./private/SidenavResponsiveHeader\"\n\n/**\n * The sidenav lets users navigate through subsets of data pertaining to a resource.\n * It can be nested under the page header navigation, as secondary navigation.\n *\n * The expected structure of a `Sidenav` is:\n * `<Sidenav> <SidenavSection> <SidenavItem /> </SidenavSection> </Sidenav>`\n *\n * Please refer to each component's documentation for more information on how to use them.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/application-admin-sidenav--docs | Storybook Documentation}\n */\nexport function Sidenav({\n children,\n label = \"Secondary\",\n selectedItemLabel,\n className,\n popoverId,\n}: {\n /**\n * Default slot used to nest `SidenavSection` components.\n */\n children: React.ReactNode\n className?: string\n /**\n * Label for the sidenav, used for accessibility.\n */\n label?: string\n /**\n * The id of the popover container.\n */\n popoverId?: string\n /**\n * Label displayed in the responsive header of the sidenav.\n */\n selectedItemLabel?: string\n}) {\n const id = useId()\n const menuId = `tds-sidenav-menu-${id}`\n const resolvedPopoverId = popoverId?.trim() || `${menuId}-popover`\n\n // `tds-sidenav-collapse` takes the place of Stencil's\n // `tds-popover-container`, so Rails can render the same markup without React.\n return (\n <div className={classnames(\"tds-sidenav\", className)}>\n <nav id={menuId} className=\"tds-sidenav-nav\" aria-label={label}>\n <SidenavResponsiveHeader\n label={selectedItemLabel}\n popoverId={resolvedPopoverId}\n />\n <tds-sidenav-collapse\n id={resolvedPopoverId}\n class=\"tds-sidenav-collapse\"\n >\n <div className=\"tds-sidenav-scroll-container\">{children}</div>\n </tds-sidenav-collapse>\n </nav>\n </div>\n )\n}\n"],"names":["classnames"],"mappings":";;;;;AAMA;;;;;;;;;;;AAWG;AACG,SAAU,OAAO,CAAC,EACtB,QAAQ,EACR,KAAK,GAAG,WAAW,EACnB,iBAAiB,EACjB,SAAS,EACT,SAAS,GAmBV,EAAA;AACC,IAAA,MAAM,EAAE,GAAG,KAAK,EAAE;AAClB,IAAA,MAAM,MAAM,GAAG,CAAA,iBAAA,EAAoB,EAAE,EAAE;IACvC,MAAM,iBAAiB,GAAG,SAAS,EAAE,IAAI,EAAE,IAAI,CAAA,EAAG,MAAM,CAAA,QAAA,CAAU;;;IAIlE,QACE,6BAAK,SAAS,EAAEA,UAAU,CAAC,aAAa,EAAE,SAAS,CAAC,EAAA;QAClD,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAC,iBAAiB,gBAAa,KAAK,EAAA;YAC5D,KAAA,CAAA,aAAA,CAAC,uBAAuB,IACtB,KAAK,EAAE,iBAAiB,EACxB,SAAS,EAAE,iBAAiB,EAAA,CAC5B;AACF,YAAA,KAAA,CAAA,aAAA,CAAA,sBAAA,EAAA,EACE,EAAE,EAAE,iBAAiB,EACrB,KAAK,EAAC,sBAAsB,EAAA;gBAE5B,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,8BAA8B,EAAA,EAAE,QAAQ,CAAO,CACzC,CACnB,CACF;AAEV;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SidenavItem.d.ts","sourceRoot":"","sources":["../../../src/components/sidenav/SidenavItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,SAAS,EACT,QAAQ,GACT,EAAE;IACD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,qBAOA"}
1
+ {"version":3,"file":"SidenavItem.d.ts","sourceRoot":"","sources":["../../../src/components/sidenav/SidenavItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,SAAS,EACT,QAAQ,GACT,EAAE;IACD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,qBAQA"}
@@ -1,3 +1,4 @@
1
+ import classNames from 'classnames';
1
2
  import React from 'react';
2
3
 
3
4
  /**
@@ -21,8 +22,9 @@ import React from 'react';
21
22
  * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/application-admin-sidenav--docs | Storybook Documentation}
22
23
  */
23
24
  function SidenavItem({ children, className, selected, }) {
24
- const selectedProps = selected ? { selected: true } : {};
25
- return (React.createElement("tds-sidenav-item", { class: className, ...selectedProps }, children));
25
+ // `tds-sidenav-collapse` sets `aria-current="page"` on the selected item's
26
+ // link or button, so React and Rails render the same markup.
27
+ return (React.createElement("li", { className: classNames("tds-sidenav-item", className, { selected }) }, children));
26
28
  }
27
29
 
28
30
  export { SidenavItem };
@@ -1 +1 @@
1
- {"version":3,"file":"SidenavItem.js","sources":["../../../src/components/sidenav/SidenavItem.tsx"],"sourcesContent":["import React from \"react\"\n\n/**\n * The `SidenavItem` component is used to display a single item in the sidenav.\n *\n * @example\n * ```html\n * <SidenavItem>\n * <a href=\"#\">Home</a>\n * </SidenavItem>\n *\n * <SidenavItem>\n * <button>Foo</button>\n * <SidenavSection subnav>\n * <SidenavItem><a href=\"#\">Nested Link</a></SidenavItem>\n * </SidenavSection>\n * </SidenavItem>\n * ```\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/application-admin-sidenav--docs | Storybook Documentation}\n */\nexport function SidenavItem({\n children,\n className,\n selected,\n}: {\n /**\n * Should be a link or button without any classes or styles applied.\n */\n children: React.ReactNode\n className?: string\n /**\n * Whether the sidenav item is selected.\n */\n selected?: boolean\n}) {\n const selectedProps = selected ? { selected: true } : {}\n return (\n <tds-sidenav-item class={className} {...selectedProps}>\n {children}\n </tds-sidenav-item>\n )\n}\n"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;AAmBG;AACG,SAAU,WAAW,CAAC,EAC1B,QAAQ,EACR,SAAS,EACT,QAAQ,GAWT,EAAA;AACC,IAAA,MAAM,aAAa,GAAG,QAAQ,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE;IACxD,QACE,KAAA,CAAA,aAAA,CAAA,kBAAA,EAAA,EAAkB,KAAK,EAAE,SAAS,EAAA,GAAM,aAAa,EAAA,EAClD,QAAQ,CACQ;AAEvB;;;;"}
1
+ {"version":3,"file":"SidenavItem.js","sources":["../../../src/components/sidenav/SidenavItem.tsx"],"sourcesContent":["import classnames from \"classnames\"\nimport React from \"react\"\n\n/**\n * The `SidenavItem` component is used to display a single item in the sidenav.\n *\n * @example\n * ```html\n * <SidenavItem>\n * <a href=\"#\">Home</a>\n * </SidenavItem>\n *\n * <SidenavItem>\n * <button>Foo</button>\n * <SidenavSection subnav>\n * <SidenavItem><a href=\"#\">Nested Link</a></SidenavItem>\n * </SidenavSection>\n * </SidenavItem>\n * ```\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/application-admin-sidenav--docs | Storybook Documentation}\n */\nexport function SidenavItem({\n children,\n className,\n selected,\n}: {\n /**\n * Should be a link or button without any classes or styles applied.\n */\n children: React.ReactNode\n className?: string\n /**\n * Whether the sidenav item is selected.\n */\n selected?: boolean\n}) {\n // `tds-sidenav-collapse` sets `aria-current=\"page\"` on the selected item's\n // link or button, so React and Rails render the same markup.\n return (\n <li className={classnames(\"tds-sidenav-item\", className, { selected })}>\n {children}\n </li>\n )\n}\n"],"names":["classnames"],"mappings":";;;AAGA;;;;;;;;;;;;;;;;;;;AAmBG;AACG,SAAU,WAAW,CAAC,EAC1B,QAAQ,EACR,SAAS,EACT,QAAQ,GAWT,EAAA;;;AAGC,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAEA,UAAU,CAAC,kBAAkB,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,CAAC,IACnE,QAAQ,CACN;AAET;;;;"}
@@ -1,14 +1,5 @@
1
1
  import React from "react";
2
- /**
3
- * The `SidenavSection` component is used to display a section of the sidenav.
4
- * All `SidenavItem` components should be nested within a `SidenavSection`.
5
- *
6
- * If the `label` prop is provided, it will be used to generate a header for the section, and the section will be labelled by the `aria-labelledby` attribute.
7
- *
8
- * @component
9
- * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/application-admin-sidenav--docs | Storybook Documentation}
10
- */
11
- export declare function SidenavSection({ children, className, label, subnav, }: {
2
+ type SidenavSectionProps = {
12
3
  /**
13
4
  * Default slot used to nest `SidenavItem` components.
14
5
  */
@@ -18,9 +9,28 @@ export declare function SidenavSection({ children, className, label, subnav, }:
18
9
  * Label for the section.
19
10
  */
20
11
  label?: string;
12
+ /**
13
+ * Actions shown next to the section label. Only rendered when `label` is set.
14
+ */
15
+ labelActions?: React.ReactNode;
16
+ /**
17
+ * Actions shown below the section's items.
18
+ */
19
+ sectionActions?: React.ReactNode;
21
20
  /**
22
21
  * Add subnav if this section is a subnav of a SidenavItem.
23
22
  */
24
23
  subnav?: boolean;
25
- }): React.JSX.Element;
24
+ };
25
+ /**
26
+ * The `SidenavSection` component is used to display a section of the sidenav.
27
+ * All `SidenavItem` components should be nested within a `SidenavSection`.
28
+ *
29
+ * If the `label` prop is provided, it will be used to generate a header for the section, and the section will be labelled by the `aria-labelledby` attribute.
30
+ *
31
+ * @component
32
+ * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/application-admin-sidenav--docs | Storybook Documentation}
33
+ */
34
+ export declare function SidenavSection(props: SidenavSectionProps): React.JSX.Element;
35
+ export {};
26
36
  //# sourceMappingURL=SidenavSection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidenavSection.d.ts","sourceRoot":"","sources":["../../../src/components/sidenav/SidenavSection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,SAAS,EACT,KAAK,EACL,MAAM,GACP,EAAE;IACD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,qBAOA"}
1
+ {"version":3,"file":"SidenavSection.d.ts","sourceRoot":"","sources":["../../../src/components/sidenav/SidenavSection.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,KAAK,mBAAmB,GAAG;IACzB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAChC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBAiCxD"}
@@ -1,4 +1,7 @@
1
+ import { useId } from '../../utilities/useId.js';
2
+ import classNames from 'classnames';
1
3
  import React from 'react';
4
+ import { withSlotChildrenAsActions } from './private/withSlotChildrenAsActions.js';
2
5
 
3
6
  /**
4
7
  * The `SidenavSection` component is used to display a section of the sidenav.
@@ -9,9 +12,17 @@ import React from 'react';
9
12
  * @component
10
13
  * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/application-admin-sidenav--docs | Storybook Documentation}
11
14
  */
12
- function SidenavSection({ children, className, label, subnav, }) {
13
- const subnavProps = subnav ? { slot: "subnav" } : {};
14
- return (React.createElement("tds-sidenav-section", { class: className, label: label, ...subnavProps }, children));
15
+ function SidenavSection(props) {
16
+ // Remove in DE-1292, along with withSlotChildrenAsActions.
17
+ const { children, className, label, labelActions, sectionActions, subnav } = withSlotChildrenAsActions(props);
18
+ const id = useId();
19
+ const headerId = `tds-sidenav-section-header-${id}`;
20
+ return (React.createElement("div", { className: classNames("tds-sidenav-section", className), slot: subnav ? "subnav" : undefined },
21
+ label && (React.createElement("div", { className: "tds-sidenav-section-header" },
22
+ React.createElement("h2", { id: headerId }, label),
23
+ labelActions && (React.createElement("div", { className: "tds-sidenav-section-label-actions" }, labelActions)))),
24
+ React.createElement("ul", { className: "tds-sidenav-section-list", "aria-labelledby": label ? headerId : undefined }, children),
25
+ sectionActions && (React.createElement("div", { className: "tds-sidenav-section-actions" }, sectionActions))));
15
26
  }
16
27
 
17
28
  export { SidenavSection };
@@ -1 +1 @@
1
- {"version":3,"file":"SidenavSection.js","sources":["../../../src/components/sidenav/SidenavSection.tsx"],"sourcesContent":["import React from \"react\"\n\n/**\n * The `SidenavSection` component is used to display a section of the sidenav.\n * All `SidenavItem` components should be nested within a `SidenavSection`.\n *\n * If the `label` prop is provided, it will be used to generate a header for the section, and the section will be labelled by the `aria-labelledby` attribute.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/application-admin-sidenav--docs | Storybook Documentation}\n */\nexport function SidenavSection({\n children,\n className,\n label,\n subnav,\n}: {\n /**\n * Default slot used to nest `SidenavItem` components.\n */\n children: React.ReactNode\n className?: string\n /**\n * Label for the section.\n */\n label?: string\n /**\n * Add subnav if this section is a subnav of a SidenavItem.\n */\n subnav?: boolean\n}) {\n const subnavProps = subnav ? { slot: \"subnav\" } : {}\n return (\n <tds-sidenav-section class={className} label={label} {...subnavProps}>\n {children}\n </tds-sidenav-section>\n )\n}\n"],"names":[],"mappings":";;AAEA;;;;;;;;AAQG;AACG,SAAU,cAAc,CAAC,EAC7B,QAAQ,EACR,SAAS,EACT,KAAK,EACL,MAAM,GAeP,EAAA;AACC,IAAA,MAAM,WAAW,GAAG,MAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE;AACpD,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,qBAAA,EAAA,EAAqB,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,KAAM,WAAW,EAAA,EACjE,QAAQ,CACW;AAE1B;;;;"}
1
+ {"version":3,"file":"SidenavSection.js","sources":["../../../src/components/sidenav/SidenavSection.tsx"],"sourcesContent":["import { useId } from \"@utilities/useId\"\nimport classnames from \"classnames\"\nimport React from \"react\"\n\nimport { withSlotChildrenAsActions } from \"./private/withSlotChildrenAsActions\"\n\ntype SidenavSectionProps = {\n /**\n * Default slot used to nest `SidenavItem` components.\n */\n children: React.ReactNode\n className?: string\n /**\n * Label for the section.\n */\n label?: string\n /**\n * Actions shown next to the section label. Only rendered when `label` is set.\n */\n labelActions?: React.ReactNode\n /**\n * Actions shown below the section's items.\n */\n sectionActions?: React.ReactNode\n /**\n * Add subnav if this section is a subnav of a SidenavItem.\n */\n subnav?: boolean\n}\n\n/**\n * The `SidenavSection` component is used to display a section of the sidenav.\n * All `SidenavItem` components should be nested within a `SidenavSection`.\n *\n * If the `label` prop is provided, it will be used to generate a header for the section, and the section will be labelled by the `aria-labelledby` attribute.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/application-admin-sidenav--docs | Storybook Documentation}\n */\nexport function SidenavSection(props: SidenavSectionProps) {\n // Remove in DE-1292, along with withSlotChildrenAsActions.\n const { children, className, label, labelActions, sectionActions, subnav } =\n withSlotChildrenAsActions(props)\n const id = useId()\n const headerId = `tds-sidenav-section-header-${id}`\n\n return (\n <div\n className={classnames(\"tds-sidenav-section\", className)}\n slot={subnav ? \"subnav\" : undefined}\n >\n {label && (\n <div className=\"tds-sidenav-section-header\">\n <h2 id={headerId}>{label}</h2>\n {labelActions && (\n <div className=\"tds-sidenav-section-label-actions\">\n {labelActions}\n </div>\n )}\n </div>\n )}\n <ul\n className=\"tds-sidenav-section-list\"\n aria-labelledby={label ? headerId : undefined}\n >\n {children}\n </ul>\n {sectionActions && (\n <div className=\"tds-sidenav-section-actions\">{sectionActions}</div>\n )}\n </div>\n )\n}\n"],"names":["classnames"],"mappings":";;;;;AA8BA;;;;;;;;AAQG;AACG,SAAU,cAAc,CAAC,KAA0B,EAAA;;AAEvD,IAAA,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,EAAE,GACxE,yBAAyB,CAAC,KAAK,CAAC;AAClC,IAAA,MAAM,EAAE,GAAG,KAAK,EAAE;AAClB,IAAA,MAAM,QAAQ,GAAG,CAAA,2BAAA,EAA8B,EAAE,EAAE;IAEnD,QACE,6BACE,SAAS,EAAEA,UAAU,CAAC,qBAAqB,EAAE,SAAS,CAAC,EACvD,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,EAAA;AAElC,QAAA,KAAK,KACJ,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,4BAA4B,EAAA;AACzC,YAAA,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAI,EAAE,EAAE,QAAQ,EAAA,EAAG,KAAK,CAAM;YAC7B,YAAY,KACX,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,mCAAmC,EAAA,EAC/C,YAAY,CACT,CACP,CACG,CACP;AACD,QAAA,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EACE,SAAS,EAAC,0BAA0B,EAAA,iBAAA,EACnB,KAAK,GAAG,QAAQ,GAAG,SAAS,EAAA,EAE5C,QAAQ,CACN;AACJ,QAAA,cAAc,KACb,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,6BAA6B,EAAA,EAAE,cAAc,CAAO,CACpE,CACG;AAEV;;;;"}
@@ -1,6 +1,7 @@
1
1
  import './tds-sidenav-collapse.js';
2
2
  import { defineSidenavElements } from './defineElements.js';
3
3
  import 'react';
4
+ import 'classnames';
4
5
 
5
6
  defineSidenavElements();
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/sidenav/index.tsx"],"sourcesContent":["import \"./index.css\"\nimport \"./tds-sidenav-collapse\"\n\nimport { defineSidenavElements } from \"./defineElements\"\n\ndefineSidenavElements()\n\nexport { Sidenav } from \"./Sidenav\"\nexport { SidenavItem } from \"./SidenavItem\"\nexport { SidenavSection } from \"./SidenavSection\"\n"],"names":[],"mappings":";;;;AAKA,qBAAqB,EAAE"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/sidenav/index.tsx"],"sourcesContent":["import \"./index.css\"\nimport \"./tds-sidenav-collapse\"\n\nimport { defineSidenavElements } from \"./defineElements\"\n\ndefineSidenavElements()\n\nexport { Sidenav } from \"./Sidenav\"\nexport { SidenavItem } from \"./SidenavItem\"\nexport { SidenavSection } from \"./SidenavSection\"\n"],"names":[],"mappings":";;;;;AAKA,qBAAqB,EAAE"}
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ export declare function SidenavResponsiveHeader({ label, popoverId, }: {
3
+ label?: string;
4
+ popoverId: string;
5
+ }): React.JSX.Element;
6
+ //# sourceMappingURL=SidenavResponsiveHeader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidenavResponsiveHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/sidenav/private/SidenavResponsiveHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,SAAS,GACV,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CAClB,qBA6BA"}
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+
3
+ function SidenavResponsiveHeader({ label, popoverId, }) {
4
+ return (React.createElement("div", { className: "tds-sidenav-responsive-header" },
5
+ label && (React.createElement("h2", { className: "tds-sidenav-responsive-header-label" }, label)),
6
+ React.createElement("button", { type: "button", className: "tds-btn tds-btn--outline-neutral tds-btn--icononly tds-sidenav-responsive-header-toggle", "aria-label": "Menu", "aria-controls": popoverId, popovertarget: popoverId },
7
+ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true" },
8
+ React.createElement("path", { d: "M0 6.91104H16V8.68904H0V6.91104ZM0 13.133H16V11.356H0V13.133ZM0 2.46704V4.24404H16V2.46704H0Z", fill: "currentColor" })))));
9
+ }
10
+
11
+ export { SidenavResponsiveHeader };
12
+ //# sourceMappingURL=SidenavResponsiveHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidenavResponsiveHeader.js","sources":["../../../../src/components/sidenav/private/SidenavResponsiveHeader.tsx"],"sourcesContent":["import React from \"react\"\n\nexport function SidenavResponsiveHeader({\n label,\n popoverId,\n}: {\n label?: string\n popoverId: string\n}) {\n return (\n <div className=\"tds-sidenav-responsive-header\">\n {label && (\n <h2 className=\"tds-sidenav-responsive-header-label\">{label}</h2>\n )}\n <button\n type=\"button\"\n className=\"tds-btn tds-btn--outline-neutral tds-btn--icononly tds-sidenav-responsive-header-toggle\"\n aria-label=\"Menu\"\n aria-controls={popoverId}\n popovertarget={popoverId}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M0 6.91104H16V8.68904H0V6.91104ZM0 13.133H16V11.356H0V13.133ZM0 2.46704V4.24404H16V2.46704H0Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n </div>\n )\n}\n"],"names":[],"mappings":";;SAEgB,uBAAuB,CAAC,EACtC,KAAK,EACL,SAAS,GAIV,EAAA;AACC,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,+BAA+B,EAAA;QAC3C,KAAK,KACJ,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,qCAAqC,EAAA,EAAE,KAAK,CAAM,CACjE;AACD,QAAA,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,yFAAyF,EAAA,YAAA,EACxF,MAAM,EAAA,eAAA,EACF,SAAS,EACxB,aAAa,EAAE,SAAS,EAAA;YAExB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,KAAK,EAAC,4BAA4B,EAClC,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,iBACC,MAAM,EAAA;AAElB,gBAAA,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EACE,CAAC,EAAC,+FAA+F,EACjG,IAAI,EAAC,cAAc,EAAA,CACnB,CACE,CACC,CACL;AAEV;;;;"}
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ type SectionActionProps = {
3
+ children: React.ReactNode;
4
+ labelActions?: React.ReactNode;
5
+ sectionActions?: React.ReactNode;
6
+ };
7
+ /**
8
+ * Backward compatibility for `SidenavSection` children marked with
9
+ * `slot="label-actions"` or `slot="section-actions"`, from when it wrapped the
10
+ * `tds-sidenav-section` web component. Moves them into the `labelActions` and
11
+ * `sectionActions` props. Remove in DE-1292.
12
+ */
13
+ export declare function withSlotChildrenAsActions<P extends SectionActionProps>(props: P): P;
14
+ export {};
15
+ //# sourceMappingURL=withSlotChildrenAsActions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withSlotChildrenAsActions.d.ts","sourceRoot":"","sources":["../../../../src/components/sidenav/private/withSlotChildrenAsActions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACjC,CAAA;AAID;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,kBAAkB,EACpE,KAAK,EAAE,CAAC,GACP,CAAC,CA0BH"}
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+
3
+ let warned = false;
4
+ /**
5
+ * Backward compatibility for `SidenavSection` children marked with
6
+ * `slot="label-actions"` or `slot="section-actions"`, from when it wrapped the
7
+ * `tds-sidenav-section` web component. Moves them into the `labelActions` and
8
+ * `sectionActions` props. Remove in DE-1292.
9
+ */
10
+ function withSlotChildrenAsActions(props) {
11
+ const labelActions = [];
12
+ const sectionActions = [];
13
+ const children = partitionSlotChildren(props.children, {
14
+ labelActions,
15
+ sectionActions,
16
+ });
17
+ if (!labelActions.length && !sectionActions.length)
18
+ return props;
19
+ if (!warned) {
20
+ warned = true;
21
+ console.warn('[tapestry] SidenavSection children with slot="label-actions" or ' +
22
+ 'slot="section-actions" are deprecated and will be removed in the ' +
23
+ "next major version. Pass them as the labelActions and " +
24
+ "sectionActions props instead.");
25
+ }
26
+ return {
27
+ ...props,
28
+ children,
29
+ labelActions: appendActions(props.labelActions, labelActions),
30
+ sectionActions: appendActions(props.sectionActions, sectionActions),
31
+ };
32
+ }
33
+ // Fragments render no DOM, so the web component slotted their children too.
34
+ function partitionSlotChildren(node, slotted, keyPrefix = "") {
35
+ return React.Children.toArray(node).flatMap((child) => {
36
+ if (!React.isValidElement(child))
37
+ return [child];
38
+ if (child.type === React.Fragment) {
39
+ const rest = partitionSlotChildren(child.props.children, slotted, `${keyPrefix}${child.key}`);
40
+ return [React.cloneElement(child, undefined, ...rest)];
41
+ }
42
+ const { slot } = child.props;
43
+ if (slot !== "label-actions" && slot !== "section-actions")
44
+ return [child];
45
+ const keyed = keyPrefix
46
+ ? React.cloneElement(child, { key: `${keyPrefix}${child.key}` })
47
+ : child;
48
+ if (slot === "label-actions")
49
+ slotted.labelActions.push(keyed);
50
+ else
51
+ slotted.sectionActions.push(keyed);
52
+ return [];
53
+ });
54
+ }
55
+ function appendActions(actions, slotted) {
56
+ if (!slotted.length)
57
+ return actions;
58
+ return React.createElement(React.Fragment, null, actions, ...slotted);
59
+ }
60
+
61
+ export { withSlotChildrenAsActions };
62
+ //# sourceMappingURL=withSlotChildrenAsActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withSlotChildrenAsActions.js","sources":["../../../../src/components/sidenav/private/withSlotChildrenAsActions.ts"],"sourcesContent":["import React from \"react\"\n\ntype SectionActionProps = {\n children: React.ReactNode\n labelActions?: React.ReactNode\n sectionActions?: React.ReactNode\n}\n\nlet warned = false\n\n/**\n * Backward compatibility for `SidenavSection` children marked with\n * `slot=\"label-actions\"` or `slot=\"section-actions\"`, from when it wrapped the\n * `tds-sidenav-section` web component. Moves them into the `labelActions` and\n * `sectionActions` props. Remove in DE-1292.\n */\nexport function withSlotChildrenAsActions<P extends SectionActionProps>(\n props: P\n): P {\n const labelActions: React.ReactNode[] = []\n const sectionActions: React.ReactNode[] = []\n const children = partitionSlotChildren(props.children, {\n labelActions,\n sectionActions,\n })\n\n if (!labelActions.length && !sectionActions.length) return props\n\n if (!warned) {\n warned = true\n console.warn(\n '[tapestry] SidenavSection children with slot=\"label-actions\" or ' +\n 'slot=\"section-actions\" are deprecated and will be removed in the ' +\n \"next major version. Pass them as the labelActions and \" +\n \"sectionActions props instead.\"\n )\n }\n\n return {\n ...props,\n children,\n labelActions: appendActions(props.labelActions, labelActions),\n sectionActions: appendActions(props.sectionActions, sectionActions),\n }\n}\n\ntype SlotChildren = {\n labelActions: React.ReactNode[]\n sectionActions: React.ReactNode[]\n}\n\n// Fragments render no DOM, so the web component slotted their children too.\nfunction partitionSlotChildren(\n node: React.ReactNode,\n slotted: SlotChildren,\n keyPrefix = \"\"\n): React.ReactNode[] {\n return React.Children.toArray(node).flatMap((child) => {\n if (\n !React.isValidElement<{ children?: React.ReactNode; slot?: string }>(\n child\n )\n )\n return [child]\n\n if (child.type === React.Fragment) {\n const rest = partitionSlotChildren(\n child.props.children,\n slotted,\n `${keyPrefix}${child.key}`\n )\n return [React.cloneElement(child, undefined, ...rest)]\n }\n\n const { slot } = child.props\n if (slot !== \"label-actions\" && slot !== \"section-actions\") return [child]\n\n const keyed = keyPrefix\n ? React.cloneElement(child, { key: `${keyPrefix}${child.key}` })\n : child\n if (slot === \"label-actions\") slotted.labelActions.push(keyed)\n else slotted.sectionActions.push(keyed)\n return []\n })\n}\n\nfunction appendActions(actions: React.ReactNode, slotted: React.ReactNode[]) {\n if (!slotted.length) return actions\n return React.createElement(React.Fragment, null, actions, ...slotted)\n}\n"],"names":[],"mappings":";;AAQA,IAAI,MAAM,GAAG,KAAK;AAElB;;;;;AAKG;AACG,SAAU,yBAAyB,CACvC,KAAQ,EAAA;IAER,MAAM,YAAY,GAAsB,EAAE;IAC1C,MAAM,cAAc,GAAsB,EAAE;AAC5C,IAAA,MAAM,QAAQ,GAAG,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE;QACrD,YAAY;QACZ,cAAc;AACf,KAAA,CAAC;IAEF,IAAI,CAAC,YAAY,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM;AAAE,QAAA,OAAO,KAAK;IAEhE,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,GAAG,IAAI;QACb,OAAO,CAAC,IAAI,CACV,kEAAkE;YAChE,mEAAmE;YACnE,wDAAwD;AACxD,YAAA,+BAA+B,CAClC;IACH;IAEA,OAAO;AACL,QAAA,GAAG,KAAK;QACR,QAAQ;QACR,YAAY,EAAE,aAAa,CAAC,KAAK,CAAC,YAAY,EAAE,YAAY,CAAC;QAC7D,cAAc,EAAE,aAAa,CAAC,KAAK,CAAC,cAAc,EAAE,cAAc,CAAC;KACpE;AACH;AAOA;AACA,SAAS,qBAAqB,CAC5B,IAAqB,EACrB,OAAqB,EACrB,SAAS,GAAG,EAAE,EAAA;AAEd,IAAA,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,KAAI;AACpD,QAAA,IACE,CAAC,KAAK,CAAC,cAAc,CACnB,KAAK,CACN;YAED,OAAO,CAAC,KAAK,CAAC;QAEhB,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,QAAQ,EAAE;YACjC,MAAM,IAAI,GAAG,qBAAqB,CAChC,KAAK,CAAC,KAAK,CAAC,QAAQ,EACpB,OAAO,EACP,CAAA,EAAG,SAAS,CAAA,EAAG,KAAK,CAAC,GAAG,CAAA,CAAE,CAC3B;AACD,YAAA,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC;QACxD;AAEA,QAAA,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,KAAK;AAC5B,QAAA,IAAI,IAAI,KAAK,eAAe,IAAI,IAAI,KAAK,iBAAiB;YAAE,OAAO,CAAC,KAAK,CAAC;QAE1E,MAAM,KAAK,GAAG;AACZ,cAAE,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,CAAA,EAAG,SAAS,CAAA,EAAG,KAAK,CAAC,GAAG,CAAA,CAAE,EAAE;cAC7D,KAAK;QACT,IAAI,IAAI,KAAK,eAAe;AAAE,YAAA,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;;AACzD,YAAA,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC;AACvC,QAAA,OAAO,EAAE;AACX,IAAA,CAAC,CAAC;AACJ;AAEA,SAAS,aAAa,CAAC,OAAwB,EAAE,OAA0B,EAAA;IACzE,IAAI,CAAC,OAAO,CAAC,MAAM;AAAE,QAAA,OAAO,OAAO;AACnC,IAAA,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;AACvE;;;;"}
package/dist/index.css CHANGED
@@ -1954,12 +1954,12 @@
1954
1954
  padding-top:0;
1955
1955
  }
1956
1956
 
1957
- .tds-sidenav-section-header [slot="label-actions"]{
1957
+ .tds-sidenav-section-header .tds-sidenav-section-label-actions,.tds-sidenav-section-header [slot="label-actions"]{
1958
1958
  display:flex;
1959
1959
  gap:var(--t-spacing-half);
1960
1960
  align-items:center;
1961
1961
  }
1962
-
1962
+ .tds-sidenav-section-actions,
1963
1963
  .tds-sidenav-section [slot="section-actions"]{
1964
1964
  display:flex;
1965
1965
  gap:12px;
@@ -1967,6 +1967,10 @@
1967
1967
  min-height:42px;
1968
1968
  padding:var(--t-spacing-1) 0;
1969
1969
  }
1970
+ .tds-sidenav-section-label-actions > [slot="label-actions"],
1971
+ .tds-sidenav-section-actions > [slot="section-actions"]{
1972
+ display:contents;
1973
+ }
1970
1974
 
1971
1975
  .tds-sidenav-section-list,
1972
1976
  .tds-sidenav-item{