@molecule/app-collapsible-section-react 4.0.2 → 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-
|
|
6
|
+
Generated: 2026-11-25T00:25:43.797Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-collapsible-section-react
|
|
@@ -145,7 +145,7 @@ Peer dependencies:
|
|
|
145
145
|
|
|
146
146
|
- `@molecule/app-react` ^4.13.0
|
|
147
147
|
- `@molecule/app-ui` ^1.0.1
|
|
148
|
-
- `@molecule/app-ui-react` ^4.
|
|
148
|
+
- `@molecule/app-ui-react` ^4.4.0
|
|
149
149
|
- `react` ^18.0.0 || ^19.0.0
|
|
150
150
|
|
|
151
151
|
### Runtime Dependencies
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapsibleSection.d.ts","sourceRoot":"","sources":["../src/CollapsibleSection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"CollapsibleSection.d.ts","sourceRoot":"","sources":["../src/CollapsibleSection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQ3C,4CAA4C;AAC5C,MAAM,WAAW,uBAAuB;IACtC,6DAA6D;IAC7D,KAAK,EAAE,SAAS,CAAA;IAChB,kCAAkC;IAClC,QAAQ,EAAE,SAAS,CAAA;IACnB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mEAAmE;IACnE,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,2CAA2C;IAC3C,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAA;IAC9C,kDAAkD;IAClD,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,mCAAmC;IACnC,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACzB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,eAAuB,EACvB,gBAAgB,EAChB,KAAK,EACL,OAAO,EAAE,WAAW,EACpB,KAAS,EACT,SAAS,GACV,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CAgDvC;AAED,kCAAkC;AAClC,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,QAAQ,EAAE,SAAS,EAAE,CAAA;IACrB,+CAA+C;IAC/C,YAAY,CAAC,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"}
|
|
@@ -3,6 +3,7 @@ import { useState } from 'react';
|
|
|
3
3
|
import { useTranslation } from '@molecule/app-react';
|
|
4
4
|
import { slot } from '@molecule/app-react/render';
|
|
5
5
|
import { getClassMap } from '@molecule/app-ui';
|
|
6
|
+
import { Box, Pressable, Text } from '@molecule/app-ui-react/elements';
|
|
6
7
|
/**
|
|
7
8
|
* Expandable section with a clickable heading. Lighter-weight than
|
|
8
9
|
* `<Accordion>` — renders a single toggle, not a group of panels.
|
|
@@ -24,7 +25,7 @@ export function CollapsibleSection({ title, children, expanded, defaultExpanded
|
|
|
24
25
|
onExpandedChange?.(next);
|
|
25
26
|
}
|
|
26
27
|
const Heading = `h${level}`;
|
|
27
|
-
return (_jsxs("section",
|
|
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 })] }));
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
30
31
|
* "Show N more" / "Show less" toggle. Simpler than `<CollapsibleSection>`
|
|
@@ -37,7 +38,7 @@ export function ShowMore({ children, initialCount = 3, moreKey = 'showMore.more'
|
|
|
37
38
|
const [expanded, setExpanded] = useState(false);
|
|
38
39
|
const visible = expanded ? children : children.slice(0, initialCount);
|
|
39
40
|
const remaining = Math.max(0, children.length - initialCount);
|
|
40
|
-
return (_jsxs("div",
|
|
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
|
|
41
42
|
? t(lessKey, {}, { defaultValue: 'Show less' })
|
|
42
43
|
: t(moreKey, { remaining }, { defaultValue: `Show ${remaining} more` }) }))] }));
|
|
43
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-collapsible-section-react",
|
|
3
|
-
"version": "4.0
|
|
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",
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@molecule/app-react": "^4.13.0",
|
|
37
37
|
"@molecule/app-ui": "^1.0.1",
|
|
38
|
-
"@molecule/app-ui-react": "^4.
|
|
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.
|
|
43
|
-
"@molecule/app-ui": "1.
|
|
44
|
-
"@molecule/app-ui-react": "4.
|
|
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",
|