@molecule/app-collapsible-section-react 4.0.1 → 4.1.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.
package/README.md CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-11-12T04:40:04.161Z
6
+ Generated: 2026-11-25T00:25:43.797Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-collapsible-section-react
@@ -112,7 +112,7 @@ function CollapsibleSection({
112
112
  defaultExpanded = false,
113
113
  onExpandedChange,
114
114
  badge,
115
- actions,
115
+ actions: actionsProp,
116
116
  level = 3,
117
117
  className,
118
118
  }: CollapsibleSectionProps): JSX.Element
@@ -143,9 +143,9 @@ function ShowMore({
143
143
 
144
144
  Peer dependencies:
145
145
 
146
- - `@molecule/app-react` ^4.0.0
146
+ - `@molecule/app-react` ^4.13.0
147
147
  - `@molecule/app-ui` ^1.0.1
148
- - `@molecule/app-ui-react` ^4.0.0
148
+ - `@molecule/app-ui-react` ^4.4.0
149
149
  - `react` ^18.0.0 || ^19.0.0
150
150
 
151
151
  ### Runtime Dependencies
@@ -28,7 +28,7 @@ export interface CollapsibleSectionProps {
28
28
  * sidebar, FAQ rows, disclosure in settings.
29
29
  * @param props - Component props (see {@link CollapsibleSectionProps}).
30
30
  */
31
- export declare function CollapsibleSection({ title, children, expanded, defaultExpanded, onExpandedChange, badge, actions, level, className, }: CollapsibleSectionProps): JSX.Element;
31
+ export declare function CollapsibleSection({ title, children, expanded, defaultExpanded, onExpandedChange, badge, actions: actionsProp, level, className, }: CollapsibleSectionProps): JSX.Element;
32
32
  /** Props for {@link ShowMore}. */
33
33
  export interface ShowMoreProps {
34
34
  /** Items before truncation. */
@@ -1 +1 @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AAC,EAAE,MAAM,CAAA;IACrB,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,YAAgB,EAChB,OAAyB,EACzB,OAAyB,EACzB,SAAS,GACV,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,CAuB7B"}
@@ -1,7 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import { useTranslation } from '@molecule/app-react';
4
+ import { slot } from '@molecule/app-react/render';
4
5
  import { getClassMap } from '@molecule/app-ui';
6
+ import { Box, Pressable, Text } from '@molecule/app-ui-react/elements';
5
7
  /**
6
8
  * Expandable section with a clickable heading. Lighter-weight than
7
9
  * `<Accordion>` — renders a single toggle, not a group of panels.
@@ -10,7 +12,8 @@ import { getClassMap } from '@molecule/app-ui';
10
12
  * sidebar, FAQ rows, disclosure in settings.
11
13
  * @param props - Component props (see {@link CollapsibleSectionProps}).
12
14
  */
13
- export function CollapsibleSection({ title, children, expanded, defaultExpanded = false, onExpandedChange, badge, actions, level = 3, className, }) {
15
+ export function CollapsibleSection({ title, children, expanded, defaultExpanded = false, onExpandedChange, badge, actions: actionsProp, level = 3, className, }) {
16
+ const actions = slot(actionsProp);
14
17
  const cm = getClassMap();
15
18
  const [internal, setInternal] = useState(defaultExpanded);
16
19
  const isOpen = expanded ?? internal;
@@ -22,7 +25,7 @@ export function CollapsibleSection({ title, children, expanded, defaultExpanded
22
25
  onExpandedChange?.(next);
23
26
  }
24
27
  const Heading = `h${level}`;
25
- return (_jsxs("section", { className: cm.cn(cm.stack(2), className), children: [_jsx(Heading, { children: _jsxs("span", { className: cm.cn(cm.flex({ align: 'center', justify: 'between', gap: 'sm' }), cm.w('full'), cm.sp('py', 2), cm.textSize('sm'), cm.fontWeight('semibold')), children: [_jsxs("button", { type: "button", onClick: toggle, "aria-expanded": isOpen, className: cm.flex({ align: 'center', gap: 'sm' }), children: [_jsx("span", { "aria-hidden": true, children: isOpen ? '▾' : '▸' }), _jsx("span", { children: title }), badge] }), actions && _jsx("span", { children: actions })] }) }), isOpen && _jsx("div", { children: children })] }));
28
+ return (_jsxs(Box, { as: "section", className: cm.cn(cm.stack(2), className), children: [_jsx(Text, { as: Heading, children: _jsxs(Box, { as: "span", className: cm.cn(cm.flex({ align: 'center', justify: 'between', gap: 'sm' }), cm.w('full'), cm.sp('py', 2), cm.textSize('sm'), cm.fontWeight('semibold')), children: [_jsxs(Pressable, { as: "button", type: "button", onClick: toggle, "aria-expanded": isOpen, className: cm.flex({ align: 'center', gap: 'sm' }), children: [_jsx(Text, { as: "span", "aria-hidden": true, children: isOpen ? '▾' : '▸' }), _jsx(Text, { as: "span", children: title }), badge] }), actions && _jsx(Box, { as: "span", children: actions })] }) }), isOpen && _jsx(Box, { as: "div", children: children })] }));
26
29
  }
27
30
  /**
28
31
  * "Show N more" / "Show less" toggle. Simpler than `<CollapsibleSection>`
@@ -35,7 +38,7 @@ export function ShowMore({ children, initialCount = 3, moreKey = 'showMore.more'
35
38
  const [expanded, setExpanded] = useState(false);
36
39
  const visible = expanded ? children : children.slice(0, initialCount);
37
40
  const remaining = Math.max(0, children.length - initialCount);
38
- return (_jsxs("div", { className: cm.cn(cm.stack(2), className), children: [visible, remaining > 0 && (_jsx("button", { type: "button", onClick: () => setExpanded((x) => !x), className: cm.cn(cm.textSize('sm'), cm.fontWeight('semibold'), cm.link), children: expanded
41
+ return (_jsxs(Box, { as: "div", className: cm.cn(cm.stack(2), className), children: [visible, remaining > 0 && (_jsx(Pressable, { as: "button", type: "button", onClick: () => setExpanded((x) => !x), className: cm.cn(cm.textSize('sm'), cm.fontWeight('semibold'), cm.link), children: expanded
39
42
  ? t(lessKey, {}, { defaultValue: 'Show less' })
40
43
  : t(moreKey, { remaining }, { defaultValue: `Show ${remaining} more` }) }))] }));
41
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-collapsible-section-react",
3
- "version": "4.0.1",
3
+ "version": "4.1.0",
4
4
  "description": "Expandable section with optional \"show more / show less\" and count",
5
5
  "homepage": "https://www.molecule.dev/packages/app-collapsible-section-react",
6
6
  "type": "module",
@@ -33,15 +33,15 @@
33
33
  "directory": "packages/app/features/collapsible-section-react"
34
34
  },
35
35
  "peerDependencies": {
36
- "@molecule/app-react": "^4.0.0",
36
+ "@molecule/app-react": "^4.13.0",
37
37
  "@molecule/app-ui": "^1.0.1",
38
- "@molecule/app-ui-react": "^4.0.0",
38
+ "@molecule/app-ui-react": "^4.4.0",
39
39
  "react": "^18.0.0 || ^19.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@molecule/app-react": "4.7.2",
43
- "@molecule/app-ui": "1.4.0",
44
- "@molecule/app-ui-react": "4.1.5",
42
+ "@molecule/app-react": "4.17.0",
43
+ "@molecule/app-ui": "1.13.0",
44
+ "@molecule/app-ui-react": "4.11.0",
45
45
  "@types/node": "26.6.5",
46
46
  "@types/react": "19.3.0",
47
47
  "@types/react-dom": "19.3.0",