@spark-web/section-header 0.0.0-snapshot-release-20260401034720

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/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # @spark-web/section-header
2
+
3
+ ## 0.0.0-snapshot-release-20260401034720
4
+
5
+ ### Minor Changes
6
+
7
+ - [#782](https://github.com/brighte-labs/spark-web/pull/782)
8
+ [`b2d2761`](https://github.com/brighte-labs/spark-web/commit/b2d276158c169b9d6913707f231851b0ee16f3e3)
9
+ Thanks [@jacobporci-brighte](https://github.com/jacobporci-brighte)! - **tag,
10
+ overflow-menu, highlight-card, description-list, section-header,
11
+ section-card:** add new accreditation component packages
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+ [[`b2d2761`](https://github.com/brighte-labs/spark-web/commit/b2d276158c169b9d6913707f231851b0ee16f3e3)]:
17
+ - @spark-web/tag@0.0.0-snapshot-release-20260401034720
18
+ - @spark-web/overflow-menu@0.0.0-snapshot-release-20260401034720
package/CLAUDE.md ADDED
@@ -0,0 +1,52 @@
1
+ # @spark-web/section-header
2
+
3
+ A header bar for content sections. Supports a heading label, an optional `Tag`
4
+ badge, and an action slot (button, text link, or overflow menu). Returns `null`
5
+ when `label` is omitted.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import { SectionHeader } from '@spark-web/section-header';
11
+
12
+ // With a button action
13
+ <SectionHeader
14
+ label="Documents"
15
+ action={{ type: 'button', label: 'Add', onClick: handleAdd }}
16
+ />
17
+
18
+ // With a tag and overflow menu
19
+ <SectionHeader
20
+ label="Members"
21
+ tag={{ tone: 'positive', children: '3 active' }}
22
+ action={{ type: 'menu', items: menuItems }}
23
+ />
24
+
25
+ // With custom controls
26
+ <SectionHeader label="Settings" controls={<Switch />} />
27
+ ```
28
+
29
+ ## Key props
30
+
31
+ | Prop | Type | Default | Notes |
32
+ | -------------- | -------------------------- | ------- | ---------------------------------------------------------- |
33
+ | `label` | `string` | — | Required to render; component returns null without it |
34
+ | `headingLevel` | `'1' \| '2' \| '3' \| '4'` | `'4'` | Maps to `@spark-web/heading` — level 5+ is not supported |
35
+ | `tag` | `Omit<TagProps, 'data'>` | — | Rendered after the heading |
36
+ | `action` | `SectionHeaderAction` | — | One of: button, link, or menu |
37
+ | `controls` | `ReactNode` | — | Custom content rendered in the action area before `action` |
38
+ | `data` | `DataAttributeMap` | — | Test/analytics attributes |
39
+
40
+ ## SectionHeaderAction discriminated union
41
+
42
+ ```ts
43
+ | { type: 'button'; label: string; onClick: () => void; tone?: ButtonProps['tone']; prominence?: ButtonProps['prominence']; disabled?: boolean; icon?: ReactElement<IconProps> }
44
+ | { type: 'link'; label: string; onClick: () => void }
45
+ | { type: 'menu'; items: OverflowMenuItem[] }
46
+ ```
47
+
48
+ ## Constraints
49
+
50
+ - `headingLevel` only supports `'1'`–`'4'` — `@spark-web/heading` does not
51
+ render level 5+
52
+ - Compose with `SectionCard` to build a full section layout
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # @spark-web/section-header
2
+
3
+ A header component for content sections that supports a label, optional tag
4
+ badge, action buttons/menus, and custom controls.
5
+
6
+ ## Usage
7
+
8
+ ```tsx
9
+ import { SectionHeader } from '@spark-web/section-header';
10
+
11
+ <SectionHeader
12
+ label="Business Details"
13
+ tag={{ children: 'Active', tone: 'positive' }}
14
+ action={{ type: 'button', label: 'Edit', onClick: () => {} }}
15
+ />;
16
+ ```
@@ -0,0 +1,2 @@
1
+ export { SectionHeader } from "./section-header.js";
2
+ export type { SectionHeaderAction, SectionHeaderProps } from "./section-header.js";
@@ -0,0 +1,45 @@
1
+ import type { ButtonProps } from '@spark-web/button';
2
+ import type { IconProps } from '@spark-web/icon';
3
+ import type { OverflowMenuItem } from '@spark-web/overflow-menu';
4
+ import type { TagProps } from '@spark-web/tag';
5
+ import type { DataAttributeMap } from '@spark-web/utils/internal';
6
+ import type { ReactElement, ReactNode } from 'react';
7
+ /**
8
+ * SectionHeader
9
+ *
10
+ * A header component for content sections that supports a label,
11
+ * optional tag badge, action buttons/menus, and custom controls.
12
+ *
13
+ * @see https://spark.brighte.com.au/package/section-header
14
+ */
15
+ export declare function SectionHeader({ label, headingLevel, tag, action, controls, data, }: SectionHeaderProps): import("@emotion/react/jsx-runtime").JSX.Element | null;
16
+ export type SectionHeaderProps = {
17
+ /** The heading label for the section. */
18
+ label?: string;
19
+ /** The heading level. */
20
+ headingLevel?: '1' | '2' | '3' | '4';
21
+ /** An optional tag to display next to the heading. */
22
+ tag?: Omit<TagProps, 'data'>;
23
+ /** An optional action element (button, link, or overflow menu). */
24
+ action?: SectionHeaderAction;
25
+ /** Custom controls to render in the header's action area. */
26
+ controls?: ReactNode;
27
+ /** Sets data attributes on the component. */
28
+ data?: DataAttributeMap;
29
+ };
30
+ export type SectionHeaderAction = {
31
+ type: 'button';
32
+ label: string;
33
+ onClick: () => void;
34
+ disabled?: boolean;
35
+ prominence?: ButtonProps['prominence'];
36
+ icon?: ReactElement<IconProps>;
37
+ tone?: ButtonProps['tone'];
38
+ } | {
39
+ type: 'link';
40
+ label: string;
41
+ onClick: () => void;
42
+ } | {
43
+ type: 'menu';
44
+ items: OverflowMenuItem[];
45
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./declarations/src/index.js";
2
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3Bhcmstd2ViLXNlY3Rpb24taGVhZGVyLmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi9kZWNsYXJhdGlvbnMvc3JjL2luZGV4LmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ==
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
6
+ var react = require('@emotion/react');
7
+ var box = require('@spark-web/box');
8
+ var button = require('@spark-web/button');
9
+ var heading = require('@spark-web/heading');
10
+ var overflowMenu = require('@spark-web/overflow-menu');
11
+ var row = require('@spark-web/row');
12
+ var tag = require('@spark-web/tag');
13
+ var text = require('@spark-web/text');
14
+ var textLink = require('@spark-web/text-link');
15
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
16
+
17
+ ////////////////////////////////////////////////////////////////////////////////
18
+
19
+ /**
20
+ * SectionHeader
21
+ *
22
+ * A header component for content sections that supports a label,
23
+ * optional tag badge, action buttons/menus, and custom controls.
24
+ *
25
+ * @see https://spark.brighte.com.au/package/section-header
26
+ */
27
+ function SectionHeader(_ref) {
28
+ var _action$tone;
29
+ var label = _ref.label,
30
+ _ref$headingLevel = _ref.headingLevel,
31
+ headingLevel = _ref$headingLevel === void 0 ? '4' : _ref$headingLevel,
32
+ tag$1 = _ref.tag,
33
+ action = _ref.action,
34
+ controls = _ref.controls,
35
+ data = _ref.data;
36
+ if (!label) return null;
37
+ return jsxRuntime.jsx(box.Box, {
38
+ data: data,
39
+ background: "neutral",
40
+ borderBottom: "neutral",
41
+ children: label && jsxRuntime.jsxs(box.Box, {
42
+ display: "flex",
43
+ justifyContent: "spaceBetween",
44
+ alignItems: "center",
45
+ marginX: "xlarge",
46
+ marginY: "large",
47
+ height: "small",
48
+ children: [jsxRuntime.jsxs(row.Row, {
49
+ alignY: "center",
50
+ gap: "medium",
51
+ children: [jsxRuntime.jsx(heading.Heading, {
52
+ level: headingLevel,
53
+ children: label
54
+ }), tag$1 && jsxRuntime.jsx(tag.Tag, _objectSpread({}, tag$1))]
55
+ }), (action || controls) && jsxRuntime.jsxs(row.Row, {
56
+ gap: "large",
57
+ alignY: "center",
58
+ css: react.css({
59
+ marginLeft: 'auto'
60
+ }),
61
+ children: [controls, action && jsxRuntime.jsxs(jsxRuntime.Fragment, {
62
+ children: [action.type === 'button' && jsxRuntime.jsx(button.Button, {
63
+ onClick: action.onClick,
64
+ tone: (_action$tone = action.tone) !== null && _action$tone !== void 0 ? _action$tone : 'primary',
65
+ prominence: action.prominence,
66
+ disabled: action.disabled,
67
+ children: action.icon ? [action.icon, action.label] : action.label
68
+ }), action.type === 'link' && jsxRuntime.jsx(text.Text, {
69
+ size: "small",
70
+ children: jsxRuntime.jsx(textLink.TextLinkButton, {
71
+ weight: "regular",
72
+ onClick: action.onClick,
73
+ children: action.label
74
+ })
75
+ }), action.type === 'menu' && jsxRuntime.jsx(overflowMenu.OverflowMenu, {
76
+ items: action.items
77
+ })]
78
+ })]
79
+ })]
80
+ })
81
+ });
82
+ }
83
+
84
+ exports.SectionHeader = SectionHeader;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./spark-web-section-header.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./spark-web-section-header.cjs.dev.js");
7
+ }
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
6
+ var react = require('@emotion/react');
7
+ var box = require('@spark-web/box');
8
+ var button = require('@spark-web/button');
9
+ var heading = require('@spark-web/heading');
10
+ var overflowMenu = require('@spark-web/overflow-menu');
11
+ var row = require('@spark-web/row');
12
+ var tag = require('@spark-web/tag');
13
+ var text = require('@spark-web/text');
14
+ var textLink = require('@spark-web/text-link');
15
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
16
+
17
+ ////////////////////////////////////////////////////////////////////////////////
18
+
19
+ /**
20
+ * SectionHeader
21
+ *
22
+ * A header component for content sections that supports a label,
23
+ * optional tag badge, action buttons/menus, and custom controls.
24
+ *
25
+ * @see https://spark.brighte.com.au/package/section-header
26
+ */
27
+ function SectionHeader(_ref) {
28
+ var _action$tone;
29
+ var label = _ref.label,
30
+ _ref$headingLevel = _ref.headingLevel,
31
+ headingLevel = _ref$headingLevel === void 0 ? '4' : _ref$headingLevel,
32
+ tag$1 = _ref.tag,
33
+ action = _ref.action,
34
+ controls = _ref.controls,
35
+ data = _ref.data;
36
+ if (!label) return null;
37
+ return jsxRuntime.jsx(box.Box, {
38
+ data: data,
39
+ background: "neutral",
40
+ borderBottom: "neutral",
41
+ children: label && jsxRuntime.jsxs(box.Box, {
42
+ display: "flex",
43
+ justifyContent: "spaceBetween",
44
+ alignItems: "center",
45
+ marginX: "xlarge",
46
+ marginY: "large",
47
+ height: "small",
48
+ children: [jsxRuntime.jsxs(row.Row, {
49
+ alignY: "center",
50
+ gap: "medium",
51
+ children: [jsxRuntime.jsx(heading.Heading, {
52
+ level: headingLevel,
53
+ children: label
54
+ }), tag$1 && jsxRuntime.jsx(tag.Tag, _objectSpread({}, tag$1))]
55
+ }), (action || controls) && jsxRuntime.jsxs(row.Row, {
56
+ gap: "large",
57
+ alignY: "center",
58
+ css: react.css({
59
+ marginLeft: 'auto'
60
+ }),
61
+ children: [controls, action && jsxRuntime.jsxs(jsxRuntime.Fragment, {
62
+ children: [action.type === 'button' && jsxRuntime.jsx(button.Button, {
63
+ onClick: action.onClick,
64
+ tone: (_action$tone = action.tone) !== null && _action$tone !== void 0 ? _action$tone : 'primary',
65
+ prominence: action.prominence,
66
+ disabled: action.disabled,
67
+ children: action.icon ? [action.icon, action.label] : action.label
68
+ }), action.type === 'link' && jsxRuntime.jsx(text.Text, {
69
+ size: "small",
70
+ children: jsxRuntime.jsx(textLink.TextLinkButton, {
71
+ weight: "regular",
72
+ onClick: action.onClick,
73
+ children: action.label
74
+ })
75
+ }), action.type === 'menu' && jsxRuntime.jsx(overflowMenu.OverflowMenu, {
76
+ items: action.items
77
+ })]
78
+ })]
79
+ })]
80
+ })
81
+ });
82
+ }
83
+
84
+ exports.SectionHeader = SectionHeader;
@@ -0,0 +1,80 @@
1
+ import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
2
+ import { css } from '@emotion/react';
3
+ import { Box } from '@spark-web/box';
4
+ import { Button } from '@spark-web/button';
5
+ import { Heading } from '@spark-web/heading';
6
+ import { OverflowMenu } from '@spark-web/overflow-menu';
7
+ import { Row } from '@spark-web/row';
8
+ import { Tag } from '@spark-web/tag';
9
+ import { Text } from '@spark-web/text';
10
+ import { TextLinkButton } from '@spark-web/text-link';
11
+ import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
12
+
13
+ ////////////////////////////////////////////////////////////////////////////////
14
+
15
+ /**
16
+ * SectionHeader
17
+ *
18
+ * A header component for content sections that supports a label,
19
+ * optional tag badge, action buttons/menus, and custom controls.
20
+ *
21
+ * @see https://spark.brighte.com.au/package/section-header
22
+ */
23
+ function SectionHeader(_ref) {
24
+ var _action$tone;
25
+ var label = _ref.label,
26
+ _ref$headingLevel = _ref.headingLevel,
27
+ headingLevel = _ref$headingLevel === void 0 ? '4' : _ref$headingLevel,
28
+ tag = _ref.tag,
29
+ action = _ref.action,
30
+ controls = _ref.controls,
31
+ data = _ref.data;
32
+ if (!label) return null;
33
+ return jsx(Box, {
34
+ data: data,
35
+ background: "neutral",
36
+ borderBottom: "neutral",
37
+ children: label && jsxs(Box, {
38
+ display: "flex",
39
+ justifyContent: "spaceBetween",
40
+ alignItems: "center",
41
+ marginX: "xlarge",
42
+ marginY: "large",
43
+ height: "small",
44
+ children: [jsxs(Row, {
45
+ alignY: "center",
46
+ gap: "medium",
47
+ children: [jsx(Heading, {
48
+ level: headingLevel,
49
+ children: label
50
+ }), tag && jsx(Tag, _objectSpread({}, tag))]
51
+ }), (action || controls) && jsxs(Row, {
52
+ gap: "large",
53
+ alignY: "center",
54
+ css: css({
55
+ marginLeft: 'auto'
56
+ }),
57
+ children: [controls, action && jsxs(Fragment, {
58
+ children: [action.type === 'button' && jsx(Button, {
59
+ onClick: action.onClick,
60
+ tone: (_action$tone = action.tone) !== null && _action$tone !== void 0 ? _action$tone : 'primary',
61
+ prominence: action.prominence,
62
+ disabled: action.disabled,
63
+ children: action.icon ? [action.icon, action.label] : action.label
64
+ }), action.type === 'link' && jsx(Text, {
65
+ size: "small",
66
+ children: jsx(TextLinkButton, {
67
+ weight: "regular",
68
+ onClick: action.onClick,
69
+ children: action.label
70
+ })
71
+ }), action.type === 'menu' && jsx(OverflowMenu, {
72
+ items: action.items
73
+ })]
74
+ })]
75
+ })]
76
+ })
77
+ });
78
+ }
79
+
80
+ export { SectionHeader };
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@spark-web/section-header",
3
+ "version": "0.0.0-snapshot-release-20260401034720",
4
+ "homepage": "https://github.com/brighte-labs/spark-web#readme",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/brighte-labs/spark-web.git",
8
+ "directory": "packages/section-header"
9
+ },
10
+ "main": "dist/spark-web-section-header.cjs.js",
11
+ "module": "dist/spark-web-section-header.esm.js",
12
+ "files": [
13
+ "CHANGELOG.md",
14
+ "CLAUDE.md",
15
+ "dist",
16
+ "README.md"
17
+ ],
18
+ "dependencies": {
19
+ "@babel/runtime": "^7.25.0",
20
+ "@emotion/react": "^11.14.0",
21
+ "@spark-web/box": "^6.0.0",
22
+ "@spark-web/button": "^5.1.0",
23
+ "@spark-web/heading": "^5.2.0",
24
+ "@spark-web/overflow-menu": "0.0.0-snapshot-release-20260401034720",
25
+ "@spark-web/row": "^5.1.0",
26
+ "@spark-web/tag": "0.0.0-snapshot-release-20260401034720",
27
+ "@spark-web/text": "^5.3.0",
28
+ "@spark-web/text-link": "^5.4.0",
29
+ "@spark-web/theme": "^5.13.0",
30
+ "@spark-web/utils": "^5.1.0"
31
+ },
32
+ "devDependencies": {
33
+ "@spark-web/icon": "^5.1.0",
34
+ "@types/react": "^19.1.0",
35
+ "react": "^19.1.0"
36
+ },
37
+ "peerDependencies": {
38
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0"
39
+ },
40
+ "engines": {
41
+ "node": ">=14"
42
+ }
43
+ }