@spark-web/tag 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 +11 -0
- package/CLAUDE.md +35 -0
- package/README.md +15 -0
- package/dist/declarations/src/index.d.ts +2 -0
- package/dist/declarations/src/tag.d.ts +24 -0
- package/dist/spark-web-tag.cjs.d.ts +2 -0
- package/dist/spark-web-tag.cjs.dev.js +71 -0
- package/dist/spark-web-tag.cjs.js +7 -0
- package/dist/spark-web-tag.cjs.prod.js +71 -0
- package/dist/spark-web-tag.esm.js +67 -0
- package/package.json +36 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @spark-web/tag
|
|
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
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @spark-web/tag
|
|
2
|
+
|
|
3
|
+
A label pill component used to categorize or organize items. Unlike `Badge`
|
|
4
|
+
(which shows status with an indicator dot), `Tag` is a standalone label with an
|
|
5
|
+
optional icon.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Tag } from '@spark-web/tag';
|
|
11
|
+
|
|
12
|
+
<Tag tone="positive">Verified</Tag>
|
|
13
|
+
<Tag tone="caution" icon={<WarningIcon />}>Pending</Tag>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Key props
|
|
17
|
+
|
|
18
|
+
| Prop | Type | Default | Notes |
|
|
19
|
+
| ---------- | -------------------------------------------------------------------------- | ---------- | ------------------------------------ |
|
|
20
|
+
| `tone` | `'accent' \| 'caution' \| 'critical' \| 'info' \| 'neutral' \| 'positive'` | `'accent'` | Controls background and icon color |
|
|
21
|
+
| `icon` | `ReactElement` | — | Rendered at 12×12px before the label |
|
|
22
|
+
| `children` | `string \| ReactElement` | required | The label text |
|
|
23
|
+
| `data` | `DataAttributeMap` | — | Test/analytics attributes |
|
|
24
|
+
|
|
25
|
+
## Constraints
|
|
26
|
+
|
|
27
|
+
- Renders `display: inline-flex` — does not stretch to fill a container
|
|
28
|
+
- Icon color is derived from `theme.color.status[tone]` — always use theme
|
|
29
|
+
tones, never raw colors
|
|
30
|
+
- Text is always `nowrap` — avoid long labels
|
|
31
|
+
|
|
32
|
+
## Used by
|
|
33
|
+
|
|
34
|
+
- `SectionHeader` renders a `Tag` via its `tag` prop (pass
|
|
35
|
+
`Omit<TagProps, 'data'>`)
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @spark-web/tag
|
|
2
|
+
|
|
3
|
+
A label component used to categorize or organize items.
|
|
4
|
+
|
|
5
|
+
Unlike Badge which shows status with an indicator dot, Tag displays a simple
|
|
6
|
+
label pill with an optional icon.
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { Tag } from '@spark-web/tag';
|
|
12
|
+
|
|
13
|
+
<Tag tone="accent">Active</Tag>
|
|
14
|
+
<Tag tone="positive" icon={<CheckCircleIcon size="xxsmall" />}>Verified</Tag>
|
|
15
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DataAttributeMap } from '@spark-web/utils/internal';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Tag
|
|
5
|
+
*
|
|
6
|
+
* A label component used to categorize or organize items. Unlike Badge which
|
|
7
|
+
* shows status with an indicator dot, Tag displays a simple label pill with
|
|
8
|
+
* an optional icon.
|
|
9
|
+
*
|
|
10
|
+
* @see https://spark.brighte.com.au/package/tag
|
|
11
|
+
*/
|
|
12
|
+
export declare function Tag({ children, data, icon, tone }: TagProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
13
|
+
export type TagProps = {
|
|
14
|
+
/** The content of the tag — a string or a single React element (e.g. styled text). */
|
|
15
|
+
children: string | ReactElement;
|
|
16
|
+
/** Sets data attributes on the component. */
|
|
17
|
+
data?: DataAttributeMap;
|
|
18
|
+
/** An optional icon element to display before the label. */
|
|
19
|
+
icon?: ReactElement;
|
|
20
|
+
/** The tone of the tag. */
|
|
21
|
+
tone?: TagTone;
|
|
22
|
+
};
|
|
23
|
+
/** The available tone options for the Tag component. */
|
|
24
|
+
export type TagTone = 'accent' | 'caution' | 'critical' | 'info' | 'neutral' | 'positive';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export * from "./declarations/src/index.js";
|
|
2
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3Bhcmstd2ViLXRhZy5janMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4vZGVjbGFyYXRpb25zL3NyYy9pbmRleC5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var react = require('@emotion/react');
|
|
6
|
+
var box = require('@spark-web/box');
|
|
7
|
+
var text = require('@spark-web/text');
|
|
8
|
+
var theme = require('@spark-web/theme');
|
|
9
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
10
|
+
|
|
11
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
12
|
+
|
|
13
|
+
var toneToBackground = {
|
|
14
|
+
accent: 'accentMuted',
|
|
15
|
+
caution: 'cautionMuted',
|
|
16
|
+
critical: 'criticalMuted',
|
|
17
|
+
info: 'infoMuted',
|
|
18
|
+
neutral: 'neutralLow',
|
|
19
|
+
positive: 'positiveMuted'
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Tag
|
|
24
|
+
*
|
|
25
|
+
* A label component used to categorize or organize items. Unlike Badge which
|
|
26
|
+
* shows status with an indicator dot, Tag displays a simple label pill with
|
|
27
|
+
* an optional icon.
|
|
28
|
+
*
|
|
29
|
+
* @see https://spark.brighte.com.au/package/tag
|
|
30
|
+
*/
|
|
31
|
+
function Tag(_ref) {
|
|
32
|
+
var children = _ref.children,
|
|
33
|
+
data = _ref.data,
|
|
34
|
+
icon = _ref.icon,
|
|
35
|
+
_ref$tone = _ref.tone,
|
|
36
|
+
tone = _ref$tone === void 0 ? 'accent' : _ref$tone;
|
|
37
|
+
var theme$1 = theme.useTheme();
|
|
38
|
+
var iconColor = theme$1.color.status[tone];
|
|
39
|
+
return jsxRuntime.jsxs(box.Box, {
|
|
40
|
+
data: data,
|
|
41
|
+
display: "inline-flex",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
background: toneToBackground[tone],
|
|
44
|
+
borderRadius: "full",
|
|
45
|
+
gap: "xxsmall",
|
|
46
|
+
paddingY: "xsmall",
|
|
47
|
+
paddingX: "medium",
|
|
48
|
+
children: [icon && jsxRuntime.jsx(box.Box, {
|
|
49
|
+
display: "flex",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
"aria-hidden": "true",
|
|
52
|
+
flexShrink: 0,
|
|
53
|
+
css: react.css({
|
|
54
|
+
color: iconColor,
|
|
55
|
+
'& svg': {
|
|
56
|
+
height: 12,
|
|
57
|
+
width: 12
|
|
58
|
+
}
|
|
59
|
+
}),
|
|
60
|
+
children: icon
|
|
61
|
+
}), jsxRuntime.jsx(text.Text, {
|
|
62
|
+
overflowStrategy: "nowrap",
|
|
63
|
+
size: "xsmall",
|
|
64
|
+
children: children
|
|
65
|
+
})]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** The available tone options for the Tag component. */
|
|
70
|
+
|
|
71
|
+
exports.Tag = Tag;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var react = require('@emotion/react');
|
|
6
|
+
var box = require('@spark-web/box');
|
|
7
|
+
var text = require('@spark-web/text');
|
|
8
|
+
var theme = require('@spark-web/theme');
|
|
9
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
10
|
+
|
|
11
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
12
|
+
|
|
13
|
+
var toneToBackground = {
|
|
14
|
+
accent: 'accentMuted',
|
|
15
|
+
caution: 'cautionMuted',
|
|
16
|
+
critical: 'criticalMuted',
|
|
17
|
+
info: 'infoMuted',
|
|
18
|
+
neutral: 'neutralLow',
|
|
19
|
+
positive: 'positiveMuted'
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Tag
|
|
24
|
+
*
|
|
25
|
+
* A label component used to categorize or organize items. Unlike Badge which
|
|
26
|
+
* shows status with an indicator dot, Tag displays a simple label pill with
|
|
27
|
+
* an optional icon.
|
|
28
|
+
*
|
|
29
|
+
* @see https://spark.brighte.com.au/package/tag
|
|
30
|
+
*/
|
|
31
|
+
function Tag(_ref) {
|
|
32
|
+
var children = _ref.children,
|
|
33
|
+
data = _ref.data,
|
|
34
|
+
icon = _ref.icon,
|
|
35
|
+
_ref$tone = _ref.tone,
|
|
36
|
+
tone = _ref$tone === void 0 ? 'accent' : _ref$tone;
|
|
37
|
+
var theme$1 = theme.useTheme();
|
|
38
|
+
var iconColor = theme$1.color.status[tone];
|
|
39
|
+
return jsxRuntime.jsxs(box.Box, {
|
|
40
|
+
data: data,
|
|
41
|
+
display: "inline-flex",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
background: toneToBackground[tone],
|
|
44
|
+
borderRadius: "full",
|
|
45
|
+
gap: "xxsmall",
|
|
46
|
+
paddingY: "xsmall",
|
|
47
|
+
paddingX: "medium",
|
|
48
|
+
children: [icon && jsxRuntime.jsx(box.Box, {
|
|
49
|
+
display: "flex",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
"aria-hidden": "true",
|
|
52
|
+
flexShrink: 0,
|
|
53
|
+
css: react.css({
|
|
54
|
+
color: iconColor,
|
|
55
|
+
'& svg': {
|
|
56
|
+
height: 12,
|
|
57
|
+
width: 12
|
|
58
|
+
}
|
|
59
|
+
}),
|
|
60
|
+
children: icon
|
|
61
|
+
}), jsxRuntime.jsx(text.Text, {
|
|
62
|
+
overflowStrategy: "nowrap",
|
|
63
|
+
size: "xsmall",
|
|
64
|
+
children: children
|
|
65
|
+
})]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** The available tone options for the Tag component. */
|
|
70
|
+
|
|
71
|
+
exports.Tag = Tag;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import { Box } from '@spark-web/box';
|
|
3
|
+
import { Text } from '@spark-web/text';
|
|
4
|
+
import { useTheme } from '@spark-web/theme';
|
|
5
|
+
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
8
|
+
|
|
9
|
+
var toneToBackground = {
|
|
10
|
+
accent: 'accentMuted',
|
|
11
|
+
caution: 'cautionMuted',
|
|
12
|
+
critical: 'criticalMuted',
|
|
13
|
+
info: 'infoMuted',
|
|
14
|
+
neutral: 'neutralLow',
|
|
15
|
+
positive: 'positiveMuted'
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Tag
|
|
20
|
+
*
|
|
21
|
+
* A label component used to categorize or organize items. Unlike Badge which
|
|
22
|
+
* shows status with an indicator dot, Tag displays a simple label pill with
|
|
23
|
+
* an optional icon.
|
|
24
|
+
*
|
|
25
|
+
* @see https://spark.brighte.com.au/package/tag
|
|
26
|
+
*/
|
|
27
|
+
function Tag(_ref) {
|
|
28
|
+
var children = _ref.children,
|
|
29
|
+
data = _ref.data,
|
|
30
|
+
icon = _ref.icon,
|
|
31
|
+
_ref$tone = _ref.tone,
|
|
32
|
+
tone = _ref$tone === void 0 ? 'accent' : _ref$tone;
|
|
33
|
+
var theme = useTheme();
|
|
34
|
+
var iconColor = theme.color.status[tone];
|
|
35
|
+
return jsxs(Box, {
|
|
36
|
+
data: data,
|
|
37
|
+
display: "inline-flex",
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
background: toneToBackground[tone],
|
|
40
|
+
borderRadius: "full",
|
|
41
|
+
gap: "xxsmall",
|
|
42
|
+
paddingY: "xsmall",
|
|
43
|
+
paddingX: "medium",
|
|
44
|
+
children: [icon && jsx(Box, {
|
|
45
|
+
display: "flex",
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
"aria-hidden": "true",
|
|
48
|
+
flexShrink: 0,
|
|
49
|
+
css: css({
|
|
50
|
+
color: iconColor,
|
|
51
|
+
'& svg': {
|
|
52
|
+
height: 12,
|
|
53
|
+
width: 12
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
children: icon
|
|
57
|
+
}), jsx(Text, {
|
|
58
|
+
overflowStrategy: "nowrap",
|
|
59
|
+
size: "xsmall",
|
|
60
|
+
children: children
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** The available tone options for the Tag component. */
|
|
66
|
+
|
|
67
|
+
export { Tag };
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@spark-web/tag",
|
|
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/tag"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/spark-web-tag.cjs.js",
|
|
11
|
+
"module": "dist/spark-web-tag.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/text": "^5.3.0",
|
|
23
|
+
"@spark-web/theme": "^5.13.0",
|
|
24
|
+
"@spark-web/utils": "^5.1.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/react": "^19.1.0",
|
|
28
|
+
"react": "^19.1.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=14"
|
|
35
|
+
}
|
|
36
|
+
}
|