@common-origin/design-system 2.20.0 → 2.22.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/dist/client.js +1015 -499
- package/dist/client.js.map +1 -1
- package/dist/components/atoms/AILabel/AILabel.d.mts +30 -0
- package/dist/components/atoms/AILabel/AILabel.d.ts +30 -0
- package/dist/components/atoms/AILabel/AILabel.mjs +94 -0
- package/dist/components/atoms/AILabel/AILabel.mjs.map +1 -0
- package/dist/components/atoms/AILabel/index.d.mts +1 -0
- package/dist/components/atoms/AILabel/index.d.ts +1 -0
- package/dist/components/atoms/Badge/Badge.d.mts +16 -4
- package/dist/components/atoms/Badge/Badge.d.ts +16 -4
- package/dist/components/atoms/Badge/Badge.mjs +4 -5
- package/dist/components/atoms/Badge/index.d.mts +1 -1
- package/dist/components/atoms/Badge/index.d.ts +1 -1
- package/dist/components/atoms/Button/Button.mjs +1 -1
- package/dist/components/atoms/CategoryLabel/CategoryLabel.d.mts +23 -8
- package/dist/components/atoms/CategoryLabel/CategoryLabel.d.ts +23 -8
- package/dist/components/atoms/CategoryLabel/CategoryLabel.mjs +31 -18
- package/dist/components/atoms/CategoryLabel/index.d.mts +1 -1
- package/dist/components/atoms/CategoryLabel/index.d.ts +1 -1
- package/dist/components/atoms/Chip/SuggestionChip.d.mts +24 -0
- package/dist/components/atoms/Chip/SuggestionChip.d.ts +24 -0
- package/dist/components/atoms/Chip/SuggestionChip.mjs +61 -0
- package/dist/components/atoms/Chip/SuggestionChip.mjs.map +1 -0
- package/dist/components/atoms/Chip/index.d.mts +1 -0
- package/dist/components/atoms/Chip/index.d.ts +1 -0
- package/dist/components/atoms/Chip/shared/utils.mjs +1 -1
- package/dist/components/atoms/Chip/shared/utils.mjs.map +1 -1
- package/dist/components/atoms/Icon/Icon.mjs +1 -1
- package/dist/components/atoms/MoneyDisplay/MoneyDisplay.mjs +14 -60
- package/dist/components/atoms/StatusBadge/StatusBadge.d.mts +3 -2
- package/dist/components/atoms/StatusBadge/StatusBadge.d.ts +3 -2
- package/dist/components/atoms/StatusBadge/StatusBadge.mjs +1 -1
- package/dist/components/atoms/StatusBadge/StatusBadge.mjs.map +1 -1
- package/dist/components/atoms/StatusLabel/StatusLabel.d.mts +5 -2
- package/dist/components/atoms/StatusLabel/StatusLabel.d.ts +5 -2
- package/dist/components/atoms/StatusLabel/StatusLabel.mjs +5 -2
- package/dist/components/atoms/StatusLabel/StatusLabel.mjs.map +1 -1
- package/dist/components/atoms/StatusLabel/StatusLabelBase.d.mts +2 -2
- package/dist/components/atoms/StatusLabel/StatusLabelBase.d.ts +2 -2
- package/dist/components/atoms/StatusLabel/StatusLabelBase.mjs +19 -13
- package/dist/components/atoms/StatusLabel/StatusShape.d.mts +4 -0
- package/dist/components/atoms/StatusLabel/StatusShape.d.ts +4 -0
- package/dist/components/atoms/StatusLabel/StatusShape.mjs +31 -0
- package/dist/components/atoms/StatusLabel/StatusShape.mjs.map +1 -0
- package/dist/components/atoms/Typography/Typography.mjs +2 -2
- package/dist/components/atoms/index.d.mts +1 -0
- package/dist/components/atoms/index.d.ts +1 -0
- package/dist/components/molecules/AccountCard/AccountCard.mjs +21 -13
- package/dist/components/molecules/AgentInput/AgentInput.d.mts +63 -1
- package/dist/components/molecules/AgentInput/AgentInput.d.ts +63 -1
- package/dist/components/molecules/AgentInput/AgentInput.mjs +476 -112
- package/dist/components/molecules/AgentInput/agentInputSpeech.d.mts +2 -0
- package/dist/components/molecules/AgentInput/agentInputSpeech.d.ts +2 -0
- package/dist/components/molecules/AgentInput/agentInputSpeech.mjs +5 -1
- package/dist/components/molecules/AgentInput/agentInputSpeech.mjs.map +1 -1
- package/dist/components/molecules/AgentInput/index.d.mts +1 -1
- package/dist/components/molecules/AgentInput/index.d.ts +1 -1
- package/dist/components/molecules/Alert/Alert.d.mts +4 -4
- package/dist/components/molecules/Alert/Alert.d.ts +4 -4
- package/dist/components/molecules/Alert/Alert.mjs +5 -4
- package/dist/components/molecules/CardLarge/CardLarge.mjs +1 -0
- package/dist/components/molecules/ChipGroup/ChipGroup.mjs +2 -0
- package/dist/components/molecules/CodeBlock/CodeBlock.mjs +1 -1
- package/dist/components/molecules/Dropdown/Dropdown.mjs +2 -2
- package/dist/components/molecules/FeatureBlock/FeatureBlock.mjs +1 -0
- package/dist/components/molecules/InlineAlert/InlineAlert.mjs +15 -5
- package/dist/components/molecules/TabBar/TabBar.mjs +3 -3
- package/dist/components/molecules/TransactionListItem/TransactionListItem.d.mts +1 -1
- package/dist/components/molecules/TransactionListItem/TransactionListItem.d.ts +1 -1
- package/dist/components/molecules/TransactionListItem/TransactionListItem.mjs +15 -31
- package/dist/data.js +817 -294
- package/dist/data.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -1
- package/dist/lib/statusShapes.d.mts +2 -0
- package/dist/lib/statusShapes.d.ts +2 -0
- package/dist/lib/statusShapes.mjs +16 -0
- package/dist/lib/statusShapes.mjs.map +1 -0
- package/dist/lib/styleUtils.mjs +2 -2
- package/dist/lib/styleUtils.mjs.map +1 -1
- package/dist/lib/tokenAliases.mjs +16 -10
- package/dist/lib/tokenAliases.mjs.map +1 -1
- package/dist/styles/icons.json +171 -1
- package/dist/styles/icons.json.mjs +185 -3
- package/dist/styles/icons.json.mjs.map +1 -1
- package/dist/styles/tokens.d.mts +957 -123
- package/dist/styles/tokens.d.ts +957 -123
- package/dist/styles/tokens.json +633 -292
- package/dist/styles/tokens.json.mjs +633 -292
- package/dist/styles/tokens.json.mjs.map +1 -1
- package/dist/tokens/index.js +633 -292
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/index.mjs +633 -292
- package/dist/tokens/index.mjs.map +1 -1
- package/dist/tokens/styles/tokens.d.mts +957 -123
- package/dist/tokens/styles/tokens.d.ts +957 -123
- package/dist/tokens.css +499 -212
- package/dist/types/icons.d.mts +1 -1
- package/dist/types/icons.d.ts +1 -1
- package/dist/types/icons.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type AILabelKind = 'suggested' | 'removal';
|
|
3
|
+
export type AILabelSize = 'small' | 'medium';
|
|
4
|
+
export interface AILabelProps {
|
|
5
|
+
/**
|
|
6
|
+
* What the agent proposes for the item: a change or addition ("Suggested"), or its removal
|
|
7
|
+
* ("Will be removed"). The wording is fixed so it reads the same in every product (decision 0046).
|
|
8
|
+
* @default 'suggested'
|
|
9
|
+
*/
|
|
10
|
+
kind?: AILabelKind;
|
|
11
|
+
/**
|
|
12
|
+
* Size on the label scale (decision 0018): small (20px) for dense lists, medium (24px) elsewhere.
|
|
13
|
+
* @default 'medium'
|
|
14
|
+
*/
|
|
15
|
+
size?: AILabelSize;
|
|
16
|
+
/** Test identifier for automated testing */
|
|
17
|
+
'data-testid'?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* AILabel marks content an agent has proposed but the user hasn't accepted (decision 0046): the AI
|
|
21
|
+
* icon and a fixed label in the AI colour, never colour alone (decision 0043). It isn't a status
|
|
22
|
+
* (use StatusLabel) or a category (use CategoryLabel), and it doesn't label AI features in general.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <AILabel /> // "Suggested"
|
|
27
|
+
* <AILabel kind="removal" /> // "Will be removed"
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const AILabel: React.FC<AILabelProps>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type AILabelKind = 'suggested' | 'removal';
|
|
3
|
+
export type AILabelSize = 'small' | 'medium';
|
|
4
|
+
export interface AILabelProps {
|
|
5
|
+
/**
|
|
6
|
+
* What the agent proposes for the item: a change or addition ("Suggested"), or its removal
|
|
7
|
+
* ("Will be removed"). The wording is fixed so it reads the same in every product (decision 0046).
|
|
8
|
+
* @default 'suggested'
|
|
9
|
+
*/
|
|
10
|
+
kind?: AILabelKind;
|
|
11
|
+
/**
|
|
12
|
+
* Size on the label scale (decision 0018): small (20px) for dense lists, medium (24px) elsewhere.
|
|
13
|
+
* @default 'medium'
|
|
14
|
+
*/
|
|
15
|
+
size?: AILabelSize;
|
|
16
|
+
/** Test identifier for automated testing */
|
|
17
|
+
'data-testid'?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* AILabel marks content an agent has proposed but the user hasn't accepted (decision 0046): the AI
|
|
21
|
+
* icon and a fixed label in the AI colour, never colour alone (decision 0043). It isn't a status
|
|
22
|
+
* (use StatusLabel) or a category (use CategoryLabel), and it doesn't label AI features in general.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <AILabel /> // "Suggested"
|
|
27
|
+
* <AILabel kind="removal" /> // "Will be removed"
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const AILabel: React.FC<AILabelProps>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import styled$module from 'styled-components';
|
|
5
|
+
const styled = styled$module.default || styled$module;
|
|
6
|
+
import tokens from '../../../lib/cssTokens.mjs';
|
|
7
|
+
import { Icon } from '../Icon/Icon.mjs';
|
|
8
|
+
|
|
9
|
+
var semantic = tokens.semantic;
|
|
10
|
+
var color = semantic.color,
|
|
11
|
+
typography = semantic.typography,
|
|
12
|
+
size = semantic.size;
|
|
13
|
+
var labels = {
|
|
14
|
+
suggested: 'Suggested',
|
|
15
|
+
removal: 'Will be removed'
|
|
16
|
+
};
|
|
17
|
+
var sizeConfig = {
|
|
18
|
+
small: {
|
|
19
|
+
font: typography.caption,
|
|
20
|
+
gap: semantic.space[100],
|
|
21
|
+
icon: 'xs'
|
|
22
|
+
},
|
|
23
|
+
medium: {
|
|
24
|
+
font: typography.small,
|
|
25
|
+
gap: semantic.space[200],
|
|
26
|
+
icon: 'sm'
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var StyledAILabel = /*#__PURE__*/styled.span.withConfig({
|
|
30
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
31
|
+
return !prop.startsWith('$');
|
|
32
|
+
},
|
|
33
|
+
displayName: "AILabel__StyledAILabel",
|
|
34
|
+
componentId: "sc-qknkn-0"
|
|
35
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n min-height: ", ";\n gap: ", ";\n font: ", ";\n color: ", ";\n white-space: nowrap;\n"], ["\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n min-height: ", ";\n gap: ", ";\n font: ", ";\n color: ", ";\n white-space: nowrap;\n"])), function (_a) {
|
|
36
|
+
var $size = _a.$size;
|
|
37
|
+
return size.label[$size];
|
|
38
|
+
}, function (_a) {
|
|
39
|
+
var $size = _a.$size;
|
|
40
|
+
return sizeConfig[$size].gap;
|
|
41
|
+
}, function (_a) {
|
|
42
|
+
var $size = _a.$size;
|
|
43
|
+
return sizeConfig[$size].font;
|
|
44
|
+
}, color.text.ai);
|
|
45
|
+
var StyledIcon = /*#__PURE__*/styled.span.withConfig({
|
|
46
|
+
displayName: "AILabel__StyledIcon",
|
|
47
|
+
componentId: "sc-qknkn-1"
|
|
48
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: inline-flex;\n color: ", ";\n"], ["\n display: inline-flex;\n color: ", ";\n"
|
|
49
|
+
/**
|
|
50
|
+
* AILabel marks content an agent has proposed but the user hasn't accepted (decision 0046): the AI
|
|
51
|
+
* icon and a fixed label in the AI colour, never colour alone (decision 0043). It isn't a status
|
|
52
|
+
* (use StatusLabel) or a category (use CategoryLabel), and it doesn't label AI features in general.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <AILabel /> // "Suggested"
|
|
57
|
+
* <AILabel kind="removal" /> // "Will be removed"
|
|
58
|
+
* ```
|
|
59
|
+
*/])), color.icon.ai);
|
|
60
|
+
/**
|
|
61
|
+
* AILabel marks content an agent has proposed but the user hasn't accepted (decision 0046): the AI
|
|
62
|
+
* icon and a fixed label in the AI colour, never colour alone (decision 0043). It isn't a status
|
|
63
|
+
* (use StatusLabel) or a category (use CategoryLabel), and it doesn't label AI features in general.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```tsx
|
|
67
|
+
* <AILabel /> // "Suggested"
|
|
68
|
+
* <AILabel kind="removal" /> // "Will be removed"
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
var AILabel = function AILabel(_a) {
|
|
72
|
+
var _b = _a.kind,
|
|
73
|
+
kind = _b === void 0 ? 'suggested' : _b,
|
|
74
|
+
_c = _a.size,
|
|
75
|
+
labelSize = _c === void 0 ? 'medium' : _c,
|
|
76
|
+
dataTestId = _a["data-testid"];
|
|
77
|
+
return jsxs(StyledAILabel, {
|
|
78
|
+
"$size": labelSize,
|
|
79
|
+
"data-testid": dataTestId,
|
|
80
|
+
children: [jsx(StyledIcon, {
|
|
81
|
+
"aria-hidden": "true",
|
|
82
|
+
children: jsx(Icon, {
|
|
83
|
+
name: "ai",
|
|
84
|
+
size: sizeConfig[labelSize].icon,
|
|
85
|
+
iconColor: "inherit"
|
|
86
|
+
})
|
|
87
|
+
}), labels[kind]]
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
AILabel.displayName = 'AILabel';
|
|
91
|
+
var templateObject_1, templateObject_2;
|
|
92
|
+
|
|
93
|
+
export { AILabel };
|
|
94
|
+
//# sourceMappingURL=AILabel.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AILabel.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AILabel.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AILabel';
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Badge variants: `default` and `accent`, plus deprecated aliases of `accent` kept until 3.0.
|
|
4
|
+
*/
|
|
5
|
+
export type BadgeVariant = 'default' | 'accent' | DeprecatedBadgeVariant;
|
|
6
|
+
/**
|
|
7
|
+
* Deprecated Badge variants, each rendered as `accent` until 3.0 (decisions 0029, 0045).
|
|
8
|
+
* @deprecated Use `accent`. For a count of items with a status, use StatusLabel.
|
|
9
|
+
*/
|
|
10
|
+
export type DeprecatedBadgeVariant = 'primary' | 'error' | 'warning' | 'success';
|
|
2
11
|
export interface BadgeProps {
|
|
3
12
|
/** Content to wrap with the badge */
|
|
4
13
|
children: React.ReactNode;
|
|
@@ -7,12 +16,15 @@ export interface BadgeProps {
|
|
|
7
16
|
/** Maximum number to display before showing "99+" */
|
|
8
17
|
max?: number;
|
|
9
18
|
/**
|
|
10
|
-
* Visual variant of the badge.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
19
|
+
* Visual variant of the badge. A badge means new or unread items (decision 0045): `accent` is
|
|
20
|
+
* the blue highlight, and `default` the near-black count. `primary` is a deprecated alias for
|
|
21
|
+
* `accent`, because Button's `primary` is near-black (decision 0029). `error`, `warning` and
|
|
22
|
+
* `success` are deprecated aliases for `accent`: a badge's colour alone can't carry a status, so
|
|
23
|
+
* a count of items with a status uses the status pattern instead ("3 failed" with StatusLabel).
|
|
24
|
+
* All four keep working until they are removed in 3.0.
|
|
13
25
|
* @default 'default'
|
|
14
26
|
*/
|
|
15
|
-
variant?:
|
|
27
|
+
variant?: BadgeVariant;
|
|
16
28
|
/** Show only a dot indicator instead of count */
|
|
17
29
|
dot?: boolean;
|
|
18
30
|
/** Screen reader label for the badge */
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Badge variants: `default` and `accent`, plus deprecated aliases of `accent` kept until 3.0.
|
|
4
|
+
*/
|
|
5
|
+
export type BadgeVariant = 'default' | 'accent' | DeprecatedBadgeVariant;
|
|
6
|
+
/**
|
|
7
|
+
* Deprecated Badge variants, each rendered as `accent` until 3.0 (decisions 0029, 0045).
|
|
8
|
+
* @deprecated Use `accent`. For a count of items with a status, use StatusLabel.
|
|
9
|
+
*/
|
|
10
|
+
export type DeprecatedBadgeVariant = 'primary' | 'error' | 'warning' | 'success';
|
|
2
11
|
export interface BadgeProps {
|
|
3
12
|
/** Content to wrap with the badge */
|
|
4
13
|
children: React.ReactNode;
|
|
@@ -7,12 +16,15 @@ export interface BadgeProps {
|
|
|
7
16
|
/** Maximum number to display before showing "99+" */
|
|
8
17
|
max?: number;
|
|
9
18
|
/**
|
|
10
|
-
* Visual variant of the badge.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
19
|
+
* Visual variant of the badge. A badge means new or unread items (decision 0045): `accent` is
|
|
20
|
+
* the blue highlight, and `default` the near-black count. `primary` is a deprecated alias for
|
|
21
|
+
* `accent`, because Button's `primary` is near-black (decision 0029). `error`, `warning` and
|
|
22
|
+
* `success` are deprecated aliases for `accent`: a badge's colour alone can't carry a status, so
|
|
23
|
+
* a count of items with a status uses the status pattern instead ("3 failed" with StatusLabel).
|
|
24
|
+
* All four keep working until they are removed in 3.0.
|
|
13
25
|
* @default 'default'
|
|
14
26
|
*/
|
|
15
|
-
variant?:
|
|
27
|
+
variant?: BadgeVariant;
|
|
16
28
|
/** Show only a dot indicator instead of count */
|
|
17
29
|
dot?: boolean;
|
|
18
30
|
/** Screen reader label for the badge */
|
|
@@ -37,16 +37,15 @@ var BadgeIndicator = /*#__PURE__*/styled.span.withConfig({
|
|
|
37
37
|
return props.$isDot ? "".concat(forcedColors, " { forced-color-adjust: none; background-color: CanvasText; }") : "".concat(forcedColors, " { border: ").concat(semantic.border.width.thin, " solid currentColor; }");
|
|
38
38
|
}, function (props) {
|
|
39
39
|
switch (props.$variant) {
|
|
40
|
+
// 'primary', 'error', 'warning' and 'success' are deprecated aliases for 'accent', removed in
|
|
41
|
+
// 3.0: 'primary' (#169), and the status colours, because a badge's colour alone can't carry a
|
|
42
|
+
// status (decision 0045, #263)
|
|
40
43
|
case 'accent':
|
|
41
44
|
case 'primary':
|
|
42
|
-
// Deprecated alias for 'accent', removed in 3.0 (#169)
|
|
43
|
-
return "\n background-color: ".concat(color.fill.accent, ";\n color: ").concat(color.text.inverse, ";\n ");
|
|
44
45
|
case 'error':
|
|
45
|
-
return "\n background-color: ".concat(color.fill.danger, ";\n color: ").concat(color.text.inverse, ";\n ");
|
|
46
46
|
case 'warning':
|
|
47
|
-
return "\n background-color: ".concat(color.fill.warning, ";\n color: ").concat(color.text.inverse, ";\n ");
|
|
48
47
|
case 'success':
|
|
49
|
-
return "\n background-color: ".concat(color.fill.
|
|
48
|
+
return "\n background-color: ".concat(color.fill.accent, ";\n color: ").concat(color.text.inverse, ";\n ");
|
|
50
49
|
default:
|
|
51
50
|
return "\n background-color: ".concat(color.fill.emphasis, ";\n color: ").concat(color.text.inverse, ";\n ");
|
|
52
51
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Badge } from './Badge.mjs';
|
|
2
|
-
export type { BadgeProps } from './Badge.mjs';
|
|
2
|
+
export type { BadgeProps, BadgeVariant, DeprecatedBadgeVariant } from './Badge.mjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Badge } from './Badge';
|
|
2
|
-
export type { BadgeProps } from './Badge';
|
|
2
|
+
export type { BadgeProps, BadgeVariant, DeprecatedBadgeVariant } from './Badge';
|
|
@@ -78,7 +78,7 @@ var getSizeStyles = function getSizeStyles(_a) {
|
|
|
78
78
|
var $size = _a.$size;
|
|
79
79
|
switch ($size) {
|
|
80
80
|
case 'small':
|
|
81
|
-
return "\n font: ".concat(button.sizes.small.font, ";\n min-height: ").concat(control.sm, ";\n padding: 0 ").concat(inset.md, ";\n ");
|
|
81
|
+
return "\n font: ".concat(button.sizes.small.font, ";\n font-weight: ").concat(button.sizes.small.fontWeight, ";\n min-height: ").concat(control.sm, ";\n padding: 0 ").concat(inset.md, ";\n ");
|
|
82
82
|
case 'medium':
|
|
83
83
|
return "\n font: ".concat(button.sizes.medium.font, ";\n min-height: ").concat(control.md, ";\n padding: 0 ").concat(inset.lg, ";\n ");
|
|
84
84
|
case 'large':
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import type { IconName } from '../../../types/icons.mjs';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* The category colours: four display colours with no meaning, and grey for "other" (decision 0043).
|
|
5
|
+
* They never mean status; for status use StatusLabel.
|
|
5
6
|
*/
|
|
6
|
-
export type
|
|
7
|
+
export type CategoryDisplayColor = 'olive' | 'periwinkle' | 'rose' | 'magenta' | 'gray';
|
|
8
|
+
/**
|
|
9
|
+
* Deprecated category colour names, each an alias of the nearest display colour until 3.0
|
|
10
|
+
* (decision 0043): blue is periwinkle; purple is magenta; pink, red and orange are rose; yellow and
|
|
11
|
+
* green are olive.
|
|
12
|
+
* @deprecated Use a CategoryDisplayColor: 'olive', 'periwinkle', 'rose', 'magenta' or 'gray'.
|
|
13
|
+
*/
|
|
14
|
+
export type DeprecatedCategoryColor = 'blue' | 'purple' | 'pink' | 'yellow' | 'green' | 'red' | 'orange';
|
|
15
|
+
/**
|
|
16
|
+
* Category color options for CategoryLabel. The old hue names still work, as aliases of the
|
|
17
|
+
* nearest display colour, until 3.0.
|
|
18
|
+
*/
|
|
19
|
+
export type CategoryColor = CategoryDisplayColor | DeprecatedCategoryColor;
|
|
7
20
|
/**
|
|
8
21
|
* Visual variant options for CategoryLabel
|
|
9
22
|
*/
|
|
@@ -21,8 +34,9 @@ export interface CategoryLabelProps {
|
|
|
21
34
|
*/
|
|
22
35
|
children: ReactNode;
|
|
23
36
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
37
|
+
* Category colour: 'olive', 'periwinkle', 'rose', 'magenta' or 'gray'. The old hue names are
|
|
38
|
+
* deprecated aliases (decision 0043).
|
|
39
|
+
* @default 'periwinkle'
|
|
26
40
|
*/
|
|
27
41
|
color?: CategoryColor;
|
|
28
42
|
/**
|
|
@@ -52,16 +66,17 @@ export interface CategoryLabelProps {
|
|
|
52
66
|
/**
|
|
53
67
|
* CategoryLabel colour-codes an item's category, such as a transaction's (decision 0018).
|
|
54
68
|
*
|
|
55
|
-
* A static, chip-like label with
|
|
56
|
-
* Category colours carry no
|
|
69
|
+
* A static, chip-like label with 4 display colours plus grey, 3 visual variants and an optional
|
|
70
|
+
* icon. Category colours carry no meaning (decision 0043); for status use StatusLabel. Beyond five
|
|
71
|
+
* categories, the icon and text tell them apart.
|
|
57
72
|
*
|
|
58
73
|
* @example
|
|
59
74
|
* ```tsx
|
|
60
|
-
* <CategoryLabel color="
|
|
75
|
+
* <CategoryLabel color="rose" icon="creditCard">
|
|
61
76
|
* Shopping
|
|
62
77
|
* </CategoryLabel>
|
|
63
78
|
*
|
|
64
|
-
* <CategoryLabel color="
|
|
79
|
+
* <CategoryLabel color="periwinkle" variant="outlined" size="medium">
|
|
65
80
|
* Travel
|
|
66
81
|
* </CategoryLabel>
|
|
67
82
|
* ```
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import type { IconName } from '../../../types/icons';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* The category colours: four display colours with no meaning, and grey for "other" (decision 0043).
|
|
5
|
+
* They never mean status; for status use StatusLabel.
|
|
5
6
|
*/
|
|
6
|
-
export type
|
|
7
|
+
export type CategoryDisplayColor = 'olive' | 'periwinkle' | 'rose' | 'magenta' | 'gray';
|
|
8
|
+
/**
|
|
9
|
+
* Deprecated category colour names, each an alias of the nearest display colour until 3.0
|
|
10
|
+
* (decision 0043): blue is periwinkle; purple is magenta; pink, red and orange are rose; yellow and
|
|
11
|
+
* green are olive.
|
|
12
|
+
* @deprecated Use a CategoryDisplayColor: 'olive', 'periwinkle', 'rose', 'magenta' or 'gray'.
|
|
13
|
+
*/
|
|
14
|
+
export type DeprecatedCategoryColor = 'blue' | 'purple' | 'pink' | 'yellow' | 'green' | 'red' | 'orange';
|
|
15
|
+
/**
|
|
16
|
+
* Category color options for CategoryLabel. The old hue names still work, as aliases of the
|
|
17
|
+
* nearest display colour, until 3.0.
|
|
18
|
+
*/
|
|
19
|
+
export type CategoryColor = CategoryDisplayColor | DeprecatedCategoryColor;
|
|
7
20
|
/**
|
|
8
21
|
* Visual variant options for CategoryLabel
|
|
9
22
|
*/
|
|
@@ -21,8 +34,9 @@ export interface CategoryLabelProps {
|
|
|
21
34
|
*/
|
|
22
35
|
children: ReactNode;
|
|
23
36
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
37
|
+
* Category colour: 'olive', 'periwinkle', 'rose', 'magenta' or 'gray'. The old hue names are
|
|
38
|
+
* deprecated aliases (decision 0043).
|
|
39
|
+
* @default 'periwinkle'
|
|
26
40
|
*/
|
|
27
41
|
color?: CategoryColor;
|
|
28
42
|
/**
|
|
@@ -52,16 +66,17 @@ export interface CategoryLabelProps {
|
|
|
52
66
|
/**
|
|
53
67
|
* CategoryLabel colour-codes an item's category, such as a transaction's (decision 0018).
|
|
54
68
|
*
|
|
55
|
-
* A static, chip-like label with
|
|
56
|
-
* Category colours carry no
|
|
69
|
+
* A static, chip-like label with 4 display colours plus grey, 3 visual variants and an optional
|
|
70
|
+
* icon. Category colours carry no meaning (decision 0043); for status use StatusLabel. Beyond five
|
|
71
|
+
* categories, the icon and text tell them apart.
|
|
57
72
|
*
|
|
58
73
|
* @example
|
|
59
74
|
* ```tsx
|
|
60
|
-
* <CategoryLabel color="
|
|
75
|
+
* <CategoryLabel color="rose" icon="creditCard">
|
|
61
76
|
* Shopping
|
|
62
77
|
* </CategoryLabel>
|
|
63
78
|
*
|
|
64
|
-
* <CategoryLabel color="
|
|
79
|
+
* <CategoryLabel color="periwinkle" variant="outlined" size="medium">
|
|
65
80
|
* Travel
|
|
66
81
|
* </CategoryLabel>
|
|
67
82
|
* ```
|
|
@@ -14,15 +14,26 @@ var category = color.category;
|
|
|
14
14
|
var radius = semantic.radius;
|
|
15
15
|
var space = semantic.space;
|
|
16
16
|
var labelHeight = semantic.size.label;
|
|
17
|
-
|
|
17
|
+
var displayColor = {
|
|
18
|
+
olive: 'olive',
|
|
19
|
+
periwinkle: 'periwinkle',
|
|
20
|
+
rose: 'rose',
|
|
21
|
+
magenta: 'magenta',
|
|
22
|
+
gray: 'gray',
|
|
23
|
+
blue: 'periwinkle',
|
|
24
|
+
purple: 'magenta',
|
|
25
|
+
pink: 'rose',
|
|
26
|
+
yellow: 'olive',
|
|
27
|
+
green: 'olive',
|
|
28
|
+
red: 'rose',
|
|
29
|
+
orange: 'rose'
|
|
30
|
+
};
|
|
31
|
+
// Text on white or the -muted fill (outlined and minimal), at least 4.5:1 (#115)
|
|
18
32
|
var categoryText = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
green: category['green-text'],
|
|
24
|
-
red: category['red-text'],
|
|
25
|
-
orange: category['orange-text'],
|
|
33
|
+
olive: category['olive-text'],
|
|
34
|
+
periwinkle: category['periwinkle-text'],
|
|
35
|
+
rose: category['rose-text'],
|
|
36
|
+
magenta: category['magenta-text'],
|
|
26
37
|
gray: category['gray-text']
|
|
27
38
|
};
|
|
28
39
|
var StyledCategoryLabel = /*#__PURE__*/styled.span.withConfig({
|
|
@@ -82,16 +93,17 @@ var HiddenLabel = /*#__PURE__*/styled.span.withConfig({
|
|
|
82
93
|
/**
|
|
83
94
|
* CategoryLabel colour-codes an item's category, such as a transaction's (decision 0018).
|
|
84
95
|
*
|
|
85
|
-
* A static, chip-like label with
|
|
86
|
-
* Category colours carry no
|
|
96
|
+
* A static, chip-like label with 4 display colours plus grey, 3 visual variants and an optional
|
|
97
|
+
* icon. Category colours carry no meaning (decision 0043); for status use StatusLabel. Beyond five
|
|
98
|
+
* categories, the icon and text tell them apart.
|
|
87
99
|
*
|
|
88
100
|
* @example
|
|
89
101
|
* ```tsx
|
|
90
|
-
* <CategoryLabel color="
|
|
102
|
+
* <CategoryLabel color="rose" icon="creditCard">
|
|
91
103
|
* Shopping
|
|
92
104
|
* </CategoryLabel>
|
|
93
105
|
*
|
|
94
|
-
* <CategoryLabel color="
|
|
106
|
+
* <CategoryLabel color="periwinkle" variant="outlined" size="medium">
|
|
95
107
|
* Travel
|
|
96
108
|
* </CategoryLabel>
|
|
97
109
|
* ```
|
|
@@ -99,16 +111,17 @@ var HiddenLabel = /*#__PURE__*/styled.span.withConfig({
|
|
|
99
111
|
/**
|
|
100
112
|
* CategoryLabel colour-codes an item's category, such as a transaction's (decision 0018).
|
|
101
113
|
*
|
|
102
|
-
* A static, chip-like label with
|
|
103
|
-
* Category colours carry no
|
|
114
|
+
* A static, chip-like label with 4 display colours plus grey, 3 visual variants and an optional
|
|
115
|
+
* icon. Category colours carry no meaning (decision 0043); for status use StatusLabel. Beyond five
|
|
116
|
+
* categories, the icon and text tell them apart.
|
|
104
117
|
*
|
|
105
118
|
* @example
|
|
106
119
|
* ```tsx
|
|
107
|
-
* <CategoryLabel color="
|
|
120
|
+
* <CategoryLabel color="rose" icon="creditCard">
|
|
108
121
|
* Shopping
|
|
109
122
|
* </CategoryLabel>
|
|
110
123
|
*
|
|
111
|
-
* <CategoryLabel color="
|
|
124
|
+
* <CategoryLabel color="periwinkle" variant="outlined" size="medium">
|
|
112
125
|
* Travel
|
|
113
126
|
* </CategoryLabel>
|
|
114
127
|
* ```
|
|
@@ -116,7 +129,7 @@ var HiddenLabel = /*#__PURE__*/styled.span.withConfig({
|
|
|
116
129
|
var CategoryLabel = function CategoryLabel(_a) {
|
|
117
130
|
var children = _a.children,
|
|
118
131
|
_b = _a.color,
|
|
119
|
-
color = _b === void 0 ? '
|
|
132
|
+
color = _b === void 0 ? 'periwinkle' : _b,
|
|
120
133
|
_c = _a.variant,
|
|
121
134
|
variant = _c === void 0 ? 'filled' : _c,
|
|
122
135
|
_d = _a.size,
|
|
@@ -128,7 +141,7 @@ var CategoryLabel = function CategoryLabel(_a) {
|
|
|
128
141
|
// A blank aria-label is no label at all, so it falls back like a missing one
|
|
129
142
|
var accessibleLabel = (ariaLabel === null || ariaLabel === void 0 ? void 0 : ariaLabel.trim()) ? ariaLabel : undefined;
|
|
130
143
|
return jsxs(StyledCategoryLabel, {
|
|
131
|
-
"$color": color,
|
|
144
|
+
"$color": displayColor[color],
|
|
132
145
|
"$variant": variant,
|
|
133
146
|
"$size": size,
|
|
134
147
|
"data-testid": dataTestId,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { CategoryLabel } from './CategoryLabel.mjs';
|
|
2
|
-
export type { CategoryLabelProps, CategoryColor, CategoryVariant, CategoryLabelSize } from './CategoryLabel.mjs';
|
|
2
|
+
export type { CategoryLabelProps, CategoryColor, CategoryDisplayColor, CategoryVariant, CategoryLabelSize } from './CategoryLabel.mjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { CategoryLabel } from './CategoryLabel';
|
|
2
|
-
export type { CategoryLabelProps, CategoryColor, CategoryVariant, CategoryLabelSize } from './CategoryLabel';
|
|
2
|
+
export type { CategoryLabelProps, CategoryColor, CategoryDisplayColor, CategoryVariant, CategoryLabelSize } from './CategoryLabel';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SuggestionChipProps {
|
|
3
|
+
/** The suggestion. It's also the button's accessible name, so keep it short and self-explanatory. */
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
/** Called when the suggestion is picked. Put its text in the input; never send it (decision 0046). */
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
/** Disables the chip */
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/** Test identifier for automated testing */
|
|
10
|
+
'data-testid'?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* SuggestionChip - Offers text to put in the agent input
|
|
14
|
+
*
|
|
15
|
+
* The Suggestion chip type from decision 0046 (amending 0016): the one chip that acts on click.
|
|
16
|
+
* Picking it fills the input so the user can edit before sending; it never sends or runs a command,
|
|
17
|
+
* which is why it's a chip and not a Button. AgentInput renders these from its `suggestions` prop.
|
|
18
|
+
*
|
|
19
|
+
* Features:
|
|
20
|
+
* - A native button: Enter and Space pick it, and its text is its accessible name
|
|
21
|
+
* - Outlined, with the naked hover and pressed fills; no selected state
|
|
22
|
+
* - One chip height (24px minimum, decision 0035); long text wraps instead of being cut off
|
|
23
|
+
*/
|
|
24
|
+
export declare const SuggestionChip: React.FC<SuggestionChipProps>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SuggestionChipProps {
|
|
3
|
+
/** The suggestion. It's also the button's accessible name, so keep it short and self-explanatory. */
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
/** Called when the suggestion is picked. Put its text in the input; never send it (decision 0046). */
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
/** Disables the chip */
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/** Test identifier for automated testing */
|
|
10
|
+
'data-testid'?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* SuggestionChip - Offers text to put in the agent input
|
|
14
|
+
*
|
|
15
|
+
* The Suggestion chip type from decision 0046 (amending 0016): the one chip that acts on click.
|
|
16
|
+
* Picking it fills the input so the user can edit before sending; it never sends or runs a command,
|
|
17
|
+
* which is why it's a chip and not a Button. AgentInput renders these from its `suggestions` prop.
|
|
18
|
+
*
|
|
19
|
+
* Features:
|
|
20
|
+
* - A native button: Enter and Space pick it, and its text is its accessible name
|
|
21
|
+
* - Outlined, with the naked hover and pressed fills; no selected state
|
|
22
|
+
* - One chip height (24px minimum, decision 0035); long text wraps instead of being cut off
|
|
23
|
+
*/
|
|
24
|
+
export declare const SuggestionChip: React.FC<SuggestionChipProps>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import styled$module from 'styled-components';
|
|
5
|
+
const styled = styled$module.default || styled$module;
|
|
6
|
+
import tokens from '../../../lib/cssTokens.mjs';
|
|
7
|
+
import { forcedColors } from '../../../lib/styleUtils.mjs';
|
|
8
|
+
import { sizeStyles } from './shared/utils.mjs';
|
|
9
|
+
|
|
10
|
+
var chip = tokens.component.chip,
|
|
11
|
+
semantic = tokens.semantic;
|
|
12
|
+
var color = semantic.color;
|
|
13
|
+
// Outlined, with the naked fill ladder on hover and press (decisions 0030, 0046): the edge keeps it
|
|
14
|
+
// visible on white, the page and AgentInput's docked band
|
|
15
|
+
var StyledSuggestionChip = /*#__PURE__*/styled.button.withConfig({
|
|
16
|
+
displayName: "SuggestionChip__StyledSuggestionChip",
|
|
17
|
+
componentId: "sc-1k0njm-0"
|
|
18
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n margin: 0;\n box-sizing: border-box;\n border: ", " solid ", ";\n border-radius: ", ";\n background-color: ", ";\n color: ", ";\n cursor: pointer;\n text-align: start;\n /* A long suggestion wraps inside the chip rather than being cut off (issue 279) */\n white-space: normal;\n overflow-wrap: anywhere;\n transition: ", ";\n ", "\n\n &:hover:not(:disabled) {\n background-color: ", ";\n }\n\n &:active:not(:disabled) {\n background-color: ", ";\n }\n\n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n\n &:disabled {\n border-color: ", ";\n color: ", ";\n cursor: not-allowed;\n }\n\n /* Forced colours: a native button gets ButtonBorder and GrayText; keep the edge (decision 0038) */\n ", " {\n border-color: ButtonBorder;\n\n &:disabled {\n border-color: GrayText;\n }\n }\n"], ["\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n margin: 0;\n box-sizing: border-box;\n border: ", " solid ", ";\n border-radius: ", ";\n background-color: ", ";\n color: ", ";\n cursor: pointer;\n text-align: start;\n /* A long suggestion wraps inside the chip rather than being cut off (issue 279) */\n white-space: normal;\n overflow-wrap: anywhere;\n transition: ", ";\n ", "\n\n &:hover:not(:disabled) {\n background-color: ", ";\n }\n\n &:active:not(:disabled) {\n background-color: ", ";\n }\n\n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n\n &:disabled {\n border-color: ", ";\n color: ", ";\n cursor: not-allowed;\n }\n\n /* Forced colours: a native button gets ButtonBorder and GrayText; keep the edge (decision 0038) */\n ", " {\n border-color: ButtonBorder;\n\n &:disabled {\n border-color: GrayText;\n }\n }\n"
|
|
19
|
+
/**
|
|
20
|
+
* SuggestionChip - Offers text to put in the agent input
|
|
21
|
+
*
|
|
22
|
+
* The Suggestion chip type from decision 0046 (amending 0016): the one chip that acts on click.
|
|
23
|
+
* Picking it fills the input so the user can edit before sending; it never sends or runs a command,
|
|
24
|
+
* which is why it's a chip and not a Button. AgentInput renders these from its `suggestions` prop.
|
|
25
|
+
*
|
|
26
|
+
* Features:
|
|
27
|
+
* - A native button: Enter and Space pick it, and its text is its accessible name
|
|
28
|
+
* - Outlined, with the naked hover and pressed fills; no selected state
|
|
29
|
+
* - One chip height (24px minimum, decision 0035); long text wraps instead of being cut off
|
|
30
|
+
*/])), semantic.border.width.thin, color.border.input, chip["default"].borderRadius, color.fill.none, color.text["default"], semantic.motion.transition.feedback, sizeStyles, color.fill['none-hover'], color.fill['none-pressed'], chip.focus.outline, semantic.border.focusOffset, color.border["default"], color.text.disabled, forcedColors);
|
|
31
|
+
/**
|
|
32
|
+
* SuggestionChip - Offers text to put in the agent input
|
|
33
|
+
*
|
|
34
|
+
* The Suggestion chip type from decision 0046 (amending 0016): the one chip that acts on click.
|
|
35
|
+
* Picking it fills the input so the user can edit before sending; it never sends or runs a command,
|
|
36
|
+
* which is why it's a chip and not a Button. AgentInput renders these from its `suggestions` prop.
|
|
37
|
+
*
|
|
38
|
+
* Features:
|
|
39
|
+
* - A native button: Enter and Space pick it, and its text is its accessible name
|
|
40
|
+
* - Outlined, with the naked hover and pressed fills; no selected state
|
|
41
|
+
* - One chip height (24px minimum, decision 0035); long text wraps instead of being cut off
|
|
42
|
+
*/
|
|
43
|
+
var SuggestionChip = function SuggestionChip(_a) {
|
|
44
|
+
var children = _a.children,
|
|
45
|
+
onClick = _a.onClick,
|
|
46
|
+
_b = _a.disabled,
|
|
47
|
+
disabled = _b === void 0 ? false : _b,
|
|
48
|
+
dataTestId = _a["data-testid"];
|
|
49
|
+
return jsx(StyledSuggestionChip, {
|
|
50
|
+
type: "button",
|
|
51
|
+
onClick: onClick,
|
|
52
|
+
disabled: disabled,
|
|
53
|
+
"data-testid": dataTestId,
|
|
54
|
+
children: children
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
SuggestionChip.displayName = 'SuggestionChip';
|
|
58
|
+
var templateObject_1;
|
|
59
|
+
|
|
60
|
+
export { SuggestionChip };
|
|
61
|
+
//# sourceMappingURL=SuggestionChip.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SuggestionChip.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|