@common-origin/design-system 2.18.0 → 2.20.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 +1122 -785
- package/dist/client.js.map +1 -1
- package/dist/components/atoms/Avatar/Avatar.d.mts +8 -0
- package/dist/components/atoms/Avatar/Avatar.mjs +103 -0
- package/dist/components/atoms/Avatar/Avatar.mjs.map +1 -0
- package/dist/components/atoms/Avatar/index.d.mts +1 -0
- package/dist/components/atoms/Badge/Badge.d.mts +25 -0
- package/dist/components/atoms/Badge/Badge.mjs +98 -0
- package/dist/components/atoms/Badge/Badge.mjs.map +1 -0
- package/dist/components/atoms/Badge/index.d.mts +2 -0
- package/dist/components/atoms/Box/Box.d.mts +62 -0
- package/dist/components/atoms/Box/Box.mjs +246 -0
- package/dist/components/atoms/Box/Box.mjs.map +1 -0
- package/dist/components/atoms/Box/index.d.mts +1 -0
- package/dist/components/atoms/Button/Button.d.mts +40 -0
- package/dist/components/atoms/Button/Button.mjs +208 -0
- package/dist/components/atoms/Button/Button.mjs.map +1 -0
- package/dist/components/atoms/Button/index.d.mts +1 -0
- package/dist/components/atoms/CategoryBadge/CategoryBadge.d.mts +29 -0
- package/dist/components/atoms/CategoryBadge/CategoryBadge.mjs +29 -0
- package/dist/components/atoms/CategoryBadge/CategoryBadge.mjs.map +1 -0
- package/dist/components/atoms/CategoryBadge/index.d.mts +2 -0
- package/dist/components/atoms/CategoryLabel/CategoryLabel.d.mts +69 -0
- package/dist/components/atoms/CategoryLabel/CategoryLabel.mjs +151 -0
- package/dist/components/atoms/CategoryLabel/CategoryLabel.mjs.map +1 -0
- package/dist/components/atoms/CategoryLabel/index.d.mts +2 -0
- package/dist/components/atoms/Chip/BooleanChip.d.mts +28 -0
- package/dist/components/atoms/Chip/BooleanChip.mjs +76 -0
- package/dist/components/atoms/Chip/BooleanChip.mjs.map +1 -0
- package/dist/components/atoms/Chip/Chip.d.mts +37 -0
- package/dist/components/atoms/Chip/Chip.mjs +76 -0
- package/dist/components/atoms/Chip/Chip.mjs.map +1 -0
- package/dist/components/atoms/Chip/FilterChip.d.mts +13 -0
- package/dist/components/atoms/Chip/FilterChip.mjs +14 -0
- package/dist/components/atoms/Chip/FilterChip.mjs.map +1 -0
- package/dist/components/atoms/Chip/InputChip.d.mts +27 -0
- package/dist/components/atoms/Chip/InputChip.mjs +97 -0
- package/dist/components/atoms/Chip/InputChip.mjs.map +1 -0
- package/dist/components/atoms/Chip/index.d.mts +4 -0
- package/dist/components/atoms/Chip/shared/ChipBase.d.mts +12 -0
- package/dist/components/atoms/Chip/shared/ChipBase.mjs +45 -0
- package/dist/components/atoms/Chip/shared/ChipBase.mjs.map +1 -0
- package/dist/components/atoms/Chip/shared/types.d.mts +34 -0
- package/dist/components/atoms/Chip/shared/types.d.ts +3 -1
- package/dist/components/atoms/Chip/shared/utils.d.mts +10 -0
- package/dist/components/atoms/Chip/shared/utils.d.ts +2 -3
- package/dist/components/atoms/Chip/shared/utils.mjs +46 -0
- package/dist/components/atoms/Chip/shared/utils.mjs.map +1 -0
- package/dist/components/atoms/Container/Container.d.mts +6 -0
- package/dist/components/atoms/Container/Container.mjs +24 -0
- package/dist/components/atoms/Container/Container.mjs.map +1 -0
- package/dist/components/atoms/Container/index.d.mts +1 -0
- package/dist/components/atoms/DateFormatter/DateFormatter.d.mts +23 -0
- package/dist/components/atoms/DateFormatter/DateFormatter.mjs +64 -0
- package/dist/components/atoms/DateFormatter/DateFormatter.mjs.map +1 -0
- package/dist/components/atoms/DateFormatter/index.d.mts +1 -0
- package/dist/components/atoms/Divider/Divider.d.mts +30 -0
- package/dist/components/atoms/Divider/Divider.mjs +134 -0
- package/dist/components/atoms/Divider/Divider.mjs.map +1 -0
- package/dist/components/atoms/Divider/index.d.mts +1 -0
- package/dist/components/atoms/Icon/Icon.d.mts +22 -0
- package/dist/components/atoms/Icon/Icon.mjs +95 -0
- package/dist/components/atoms/Icon/Icon.mjs.map +1 -0
- package/dist/components/atoms/Icon/index.d.mts +1 -0
- package/dist/components/atoms/IconButton/IconButton.d.mts +14 -0
- package/dist/components/atoms/IconButton/IconButton.mjs +150 -0
- package/dist/components/atoms/IconButton/IconButton.mjs.map +1 -0
- package/dist/components/atoms/IconButton/index.d.mts +1 -0
- package/dist/components/atoms/MoneyDisplay/MoneyDisplay.d.mts +26 -0
- package/dist/components/atoms/MoneyDisplay/MoneyDisplay.mjs +126 -0
- package/dist/components/atoms/MoneyDisplay/MoneyDisplay.mjs.map +1 -0
- package/dist/components/atoms/MoneyDisplay/index.d.mts +2 -0
- package/dist/components/atoms/Picture/Picture.d.mts +12 -0
- package/dist/components/atoms/Picture/Picture.mjs +65 -0
- package/dist/components/atoms/Picture/Picture.mjs.map +1 -0
- package/dist/components/atoms/Picture/index.d.mts +1 -0
- package/dist/components/atoms/ProgressBar/ProgressBar.d.mts +21 -0
- package/dist/components/atoms/ProgressBar/ProgressBar.mjs +91 -0
- package/dist/components/atoms/ProgressBar/ProgressBar.mjs.map +1 -0
- package/dist/components/atoms/ProgressBar/index.d.mts +2 -0
- package/dist/components/atoms/Stack/Stack.d.mts +16 -0
- package/dist/components/atoms/Stack/Stack.mjs +71 -0
- package/dist/components/atoms/Stack/Stack.mjs.map +1 -0
- package/dist/components/atoms/Stack/index.d.mts +1 -0
- package/dist/components/atoms/StatusBadge/StatusBadge.d.mts +23 -0
- package/dist/components/atoms/StatusBadge/StatusBadge.mjs +18 -0
- package/dist/components/atoms/StatusBadge/StatusBadge.mjs.map +1 -0
- package/dist/components/atoms/StatusBadge/index.d.mts +2 -0
- package/dist/components/atoms/StatusLabel/StatusLabel.d.mts +17 -0
- package/dist/components/atoms/StatusLabel/StatusLabel.mjs +28 -0
- package/dist/components/atoms/StatusLabel/StatusLabel.mjs.map +1 -0
- package/dist/components/atoms/StatusLabel/StatusLabelBase.d.mts +49 -0
- package/dist/components/atoms/StatusLabel/StatusLabelBase.mjs +161 -0
- package/dist/components/atoms/StatusLabel/StatusLabelBase.mjs.map +1 -0
- package/dist/components/atoms/StatusLabel/index.d.mts +2 -0
- package/dist/components/atoms/Tag/Tag.d.mts +36 -0
- package/dist/components/atoms/Tag/Tag.mjs +115 -0
- package/dist/components/atoms/Tag/Tag.mjs.map +1 -0
- package/dist/components/atoms/Tag/index.d.mts +2 -0
- package/dist/components/atoms/Typography/Typography.d.mts +34 -0
- package/dist/components/atoms/Typography/Typography.mjs +139 -0
- package/dist/components/atoms/Typography/Typography.mjs.map +1 -0
- package/dist/components/atoms/Typography/index.d.mts +1 -0
- package/dist/components/atoms/index.d.mts +20 -0
- package/dist/components/index.d.mts +4 -0
- package/dist/components/layout/GridSystem/GridSystem.d.mts +58 -0
- package/dist/components/layout/GridSystem/GridSystem.mjs +221 -0
- package/dist/components/layout/GridSystem/GridSystem.mjs.map +1 -0
- package/dist/components/layout/GridSystem/index.d.mts +1 -0
- package/dist/components/layout/index.d.mts +1 -0
- package/dist/components/molecules/AccountCard/AccountCard.d.mts +44 -0
- package/dist/components/molecules/AccountCard/AccountCard.mjs +191 -0
- package/dist/components/molecules/AccountCard/AccountCard.mjs.map +1 -0
- package/dist/components/molecules/AccountCard/index.d.mts +2 -0
- package/dist/components/molecules/ActionSheet/ActionSheet.d.mts +111 -0
- package/dist/components/molecules/ActionSheet/ActionSheet.mjs +283 -0
- package/dist/components/molecules/ActionSheet/ActionSheet.mjs.map +1 -0
- package/dist/components/molecules/ActionSheet/index.d.mts +2 -0
- package/dist/components/molecules/AgentInput/AgentInput.d.mts +30 -0
- package/dist/components/molecules/AgentInput/AgentInput.mjs +735 -0
- package/dist/components/molecules/AgentInput/AgentInput.mjs.map +1 -0
- package/dist/components/molecules/AgentInput/agentInputSpeech.d.mts +43 -0
- package/dist/components/molecules/AgentInput/agentInputSpeech.mjs +49 -0
- package/dist/components/molecules/AgentInput/agentInputSpeech.mjs.map +1 -0
- package/dist/components/molecules/AgentInput/agentInputStateMachine.d.mts +29 -0
- package/dist/components/molecules/AgentInput/agentInputStateMachine.mjs +55 -0
- package/dist/components/molecules/AgentInput/agentInputStateMachine.mjs.map +1 -0
- package/dist/components/molecules/AgentInput/index.d.mts +3 -0
- package/dist/components/molecules/Alert/Alert.d.mts +68 -0
- package/dist/components/molecules/Alert/Alert.mjs +284 -0
- package/dist/components/molecules/Alert/Alert.mjs.map +1 -0
- package/dist/components/molecules/Alert/index.d.mts +1 -0
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.d.mts +16 -0
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.mjs +74 -0
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.mjs.map +1 -0
- package/dist/components/molecules/Breadcrumbs/index.d.mts +1 -0
- package/dist/components/molecules/CardLarge/CardLarge.d.mts +12 -0
- package/dist/components/molecules/CardLarge/CardLarge.mjs +75 -0
- package/dist/components/molecules/CardLarge/CardLarge.mjs.map +1 -0
- package/dist/components/molecules/CardLarge/index.d.mts +1 -0
- package/dist/components/molecules/CardSmall/CardSmall.d.mts +16 -0
- package/dist/components/molecules/CardSmall/CardSmall.mjs +73 -0
- package/dist/components/molecules/CardSmall/CardSmall.mjs.map +1 -0
- package/dist/components/molecules/CardSmall/index.d.mts +1 -0
- package/dist/components/molecules/Checkbox/Checkbox.d.mts +64 -0
- package/dist/components/molecules/Checkbox/Checkbox.mjs +139 -0
- package/dist/components/molecules/Checkbox/Checkbox.mjs.map +1 -0
- package/dist/components/molecules/Checkbox/SelectableInputBase.d.mts +40 -0
- package/dist/components/molecules/Checkbox/SelectableInputBase.mjs +99 -0
- package/dist/components/molecules/Checkbox/SelectableInputBase.mjs.map +1 -0
- package/dist/components/molecules/Checkbox/index.d.mts +3 -0
- package/dist/components/molecules/ChipGroup/ChipGroup.d.mts +7 -0
- package/dist/components/molecules/ChipGroup/ChipGroup.mjs +54 -0
- package/dist/components/molecules/ChipGroup/ChipGroup.mjs.map +1 -0
- package/dist/components/molecules/ChipGroup/index.d.mts +1 -0
- package/dist/components/molecules/CodeBlock/CodeBlock.d.mts +46 -0
- package/dist/components/molecules/CodeBlock/CodeBlock.mjs +231 -0
- package/dist/components/molecules/CodeBlock/CodeBlock.mjs.map +1 -0
- package/dist/components/molecules/CodeBlock/index.d.mts +1 -0
- package/dist/components/molecules/DateGroup/DateGroup.d.mts +37 -0
- package/dist/components/molecules/DateGroup/DateGroup.mjs +104 -0
- package/dist/components/molecules/DateGroup/DateGroup.mjs.map +1 -0
- package/dist/components/molecules/DateGroup/index.d.mts +2 -0
- package/dist/components/molecules/Dropdown/Dropdown.d.mts +27 -0
- package/dist/components/molecules/Dropdown/Dropdown.mjs +282 -0
- package/dist/components/molecules/Dropdown/Dropdown.mjs.map +1 -0
- package/dist/components/molecules/Dropdown/index.d.mts +1 -0
- package/dist/components/molecules/EmptyState/EmptyState.d.mts +32 -0
- package/dist/components/molecules/EmptyState/EmptyState.mjs +133 -0
- package/dist/components/molecules/EmptyState/EmptyState.mjs.map +1 -0
- package/dist/components/molecules/EmptyState/index.d.mts +2 -0
- package/dist/components/molecules/FeatureBlock/FeatureBlock.d.mts +14 -0
- package/dist/components/molecules/FeatureBlock/FeatureBlock.mjs +99 -0
- package/dist/components/molecules/FeatureBlock/FeatureBlock.mjs.map +1 -0
- package/dist/components/molecules/FeatureBlock/index.d.mts +1 -0
- package/dist/components/molecules/InlineAlert/InlineAlert.d.mts +54 -0
- package/dist/components/molecules/InlineAlert/InlineAlert.mjs +140 -0
- package/dist/components/molecules/InlineAlert/InlineAlert.mjs.map +1 -0
- package/dist/components/molecules/InlineAlert/index.d.mts +2 -0
- package/dist/components/molecules/List/List.d.mts +30 -0
- package/dist/components/molecules/List/List.mjs +45 -0
- package/dist/components/molecules/List/List.mjs.map +1 -0
- package/dist/components/molecules/List/ListContext.d.mts +6 -0
- package/dist/components/molecules/List/ListContext.mjs +11 -0
- package/dist/components/molecules/List/ListContext.mjs.map +1 -0
- package/dist/components/molecules/List/ListItem.d.mts +101 -0
- package/dist/components/molecules/List/ListItem.mjs +224 -0
- package/dist/components/molecules/List/ListItem.mjs.map +1 -0
- package/dist/components/molecules/List/index.d.mts +4 -0
- package/dist/components/molecules/Modal/Modal.d.mts +69 -0
- package/dist/components/molecules/Modal/Modal.mjs +259 -0
- package/dist/components/molecules/Modal/Modal.mjs.map +1 -0
- package/dist/components/molecules/Modal/index.d.mts +2 -0
- package/dist/components/molecules/NumberInput/NumberInput.d.mts +86 -0
- package/dist/components/molecules/NumberInput/NumberInput.mjs +268 -0
- package/dist/components/molecules/NumberInput/NumberInput.mjs.map +1 -0
- package/dist/components/molecules/NumberInput/index.d.mts +2 -0
- package/dist/components/molecules/PageTitle/PageTitle.d.mts +21 -0
- package/dist/components/molecules/PageTitle/PageTitle.mjs +77 -0
- package/dist/components/molecules/PageTitle/PageTitle.mjs.map +1 -0
- package/dist/components/molecules/PageTitle/index.d.mts +1 -0
- package/dist/components/molecules/PasswordField/PasswordField.d.mts +55 -0
- package/dist/components/molecules/PasswordField/PasswordField.mjs +146 -0
- package/dist/components/molecules/PasswordField/PasswordField.mjs.map +1 -0
- package/dist/components/molecules/PasswordField/index.d.mts +2 -0
- package/dist/components/molecules/SearchField/SearchField.d.mts +108 -0
- package/dist/components/molecules/SearchField/SearchField.mjs +340 -0
- package/dist/components/molecules/SearchField/SearchField.mjs.map +1 -0
- package/dist/components/molecules/SearchField/index.d.mts +2 -0
- package/dist/components/molecules/Sheet/Sheet.d.mts +96 -0
- package/dist/components/molecules/Sheet/Sheet.mjs +243 -0
- package/dist/components/molecules/Sheet/Sheet.mjs.map +1 -0
- package/dist/components/molecules/Sheet/index.d.mts +2 -0
- package/dist/components/molecules/Slider/Slider.d.mts +102 -0
- package/dist/components/molecules/Slider/Slider.mjs +462 -0
- package/dist/components/molecules/Slider/Slider.mjs.map +1 -0
- package/dist/components/molecules/Slider/index.d.mts +2 -0
- package/dist/components/molecules/TabBar/TabBar.d.mts +82 -0
- package/dist/components/molecules/TabBar/TabBar.mjs +213 -0
- package/dist/components/molecules/TabBar/TabBar.mjs.map +1 -0
- package/dist/components/molecules/TabBar/index.d.mts +2 -0
- package/dist/components/molecules/TextField/InputBase.d.mts +22 -0
- package/dist/components/molecules/TextField/InputBase.mjs +56 -0
- package/dist/components/molecules/TextField/InputBase.mjs.map +1 -0
- package/dist/components/molecules/TextField/TextField.d.mts +56 -0
- package/dist/components/molecules/TextField/TextField.mjs +115 -0
- package/dist/components/molecules/TextField/TextField.mjs.map +1 -0
- package/dist/components/molecules/TextField/index.d.mts +4 -0
- package/dist/components/molecules/TransactionListItem/TransactionListItem.d.mts +39 -0
- package/dist/components/molecules/TransactionListItem/TransactionListItem.mjs +224 -0
- package/dist/components/molecules/TransactionListItem/TransactionListItem.mjs.map +1 -0
- package/dist/components/molecules/TransactionListItem/index.d.mts +2 -0
- package/dist/components/molecules/index.d.mts +26 -0
- package/dist/data.js +261 -14
- package/dist/data.js.map +1 -1
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +55 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/cssTokens.d.mts +14 -0
- package/dist/lib/cssTokens.d.ts +14 -0
- package/dist/lib/cssTokens.mjs +19 -0
- package/dist/lib/cssTokens.mjs.map +1 -0
- package/dist/lib/cssVariables.d.mts +15 -0
- package/dist/lib/cssVariables.d.ts +15 -0
- package/dist/lib/cssVariables.mjs +37 -0
- package/dist/lib/cssVariables.mjs.map +1 -0
- package/dist/lib/styleUtils.d.mts +42 -0
- package/dist/lib/styleUtils.d.ts +23 -0
- package/dist/lib/styleUtils.mjs +160 -0
- package/dist/lib/styleUtils.mjs.map +1 -0
- package/dist/lib/tokenAliases.d.mts +13 -0
- package/dist/lib/tokenAliases.d.ts +13 -0
- package/dist/lib/tokenAliases.mjs +121 -0
- package/dist/lib/tokenAliases.mjs.map +1 -0
- package/dist/lib/usePresence.d.mts +16 -0
- package/dist/lib/usePresence.mjs +50 -0
- package/dist/lib/usePresence.mjs.map +1 -0
- package/dist/{data.esm.js → styles/icons.json.mjs} +2 -1219
- package/dist/styles/icons.json.mjs.map +1 -0
- package/dist/styles/tokens.d.mts +3174 -0
- package/dist/styles/tokens.d.ts +3174 -0
- package/dist/styles/tokens.json +257 -12
- package/dist/{tokens/index.esm.js → styles/tokens.json.mjs} +259 -20
- package/dist/{tokens/index.esm.js.map → styles/tokens.json.mjs.map} +1 -1
- package/dist/tokens/index.js +261 -14
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/index.mjs +1462 -0
- package/dist/tokens/index.mjs.map +1 -0
- package/dist/tokens/styles/tokens.d.mts +3174 -0
- package/dist/tokens/styles/tokens.d.ts +3174 -0
- package/dist/tokens/tokens.d.mts +4 -0
- package/dist/tokens/types/tokens.d.mts +6 -0
- package/dist/tokens/types/tokens.d.ts +3 -1204
- package/dist/tokens.css +710 -430
- package/dist/tokens.css.d.mts +4 -0
- package/dist/types/icons.d.mts +25 -0
- package/dist/types/icons.mjs +10 -0
- package/dist/types/icons.mjs.map +1 -0
- package/dist/types/index.d.mts +1 -0
- package/dist/types/tokens.d.mts +6 -0
- package/dist/types/tokens.d.ts +3 -1204
- package/dist/types/tokens.mjs +10 -0
- package/dist/types/tokens.mjs.map +1 -0
- package/dist/vendor/tslib/tslib.es6.mjs +99 -0
- package/dist/vendor/tslib/tslib.es6.mjs.map +1 -0
- package/package.json +29 -13
- package/dist/client.esm.js +0 -7952
- package/dist/client.esm.js.map +0 -1
- package/dist/data.esm.js.map +0 -1
- package/dist/index.esm.js +0 -8
- package/dist/index.esm.js.map +0 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject, __rest, __assign } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsx, jsxs, Fragment } 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
|
+
import { forcedColorsEdge } from '../../../lib/styleUtils.mjs';
|
|
9
|
+
|
|
10
|
+
var button = tokens.component.button,
|
|
11
|
+
semantic = tokens.semantic;
|
|
12
|
+
// Height comes from size.control as a minimum and the content is centred, so there is no
|
|
13
|
+
// vertical padding (decision 0034). Horizontal padding comes from the semantic spacing scale:
|
|
14
|
+
// no component spacing tokens (decision 0022)
|
|
15
|
+
var inset = semantic.space.inset;
|
|
16
|
+
var control = semantic.size.control;
|
|
17
|
+
// Base styles shared between button and link
|
|
18
|
+
var baseButtonStyles = "\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: ".concat(tokens.semantic.space[100], ";\n height: max-content;\n cursor: pointer;\n border: none;\n text-decoration: none;\n transition: ").concat(semantic.motion.transition.feedback, ";\n white-space: nowrap;\n user-select: none;\n \n &:focus {\n outline: ").concat(button.focus.outline, ";\n outline-offset: ").concat(semantic.border.focusOffset, ";\n }\n\n &:disabled {\n cursor: not-allowed;\n }\n\n ").concat(forcedColorsEdge, "\n");
|
|
19
|
+
// Dynamic variant styles using component tokens
|
|
20
|
+
var getVariantStyles = function getVariantStyles(_a) {
|
|
21
|
+
var $variant = _a.$variant;
|
|
22
|
+
var variantConfig = {
|
|
23
|
+
primary: {
|
|
24
|
+
bg: button.primary.backgroundColor,
|
|
25
|
+
text: button.primary.textColor,
|
|
26
|
+
hoverBg: button.hover.backgroundColor,
|
|
27
|
+
activeBg: button.active.backgroundColor,
|
|
28
|
+
disabledBg: button.disabled.backgroundColor,
|
|
29
|
+
disabledText: button.disabled.textColor
|
|
30
|
+
},
|
|
31
|
+
secondary: {
|
|
32
|
+
bg: button.variants.secondary.backgroundColor,
|
|
33
|
+
text: button.variants.secondary.textColor,
|
|
34
|
+
hoverBg: button.variants.secondary.hover.backgroundColor,
|
|
35
|
+
activeBg: button.variants.secondary.active.backgroundColor,
|
|
36
|
+
disabledBg: button.variants.secondary.disabled.backgroundColor,
|
|
37
|
+
disabledText: button.variants.secondary.disabled.textColor
|
|
38
|
+
},
|
|
39
|
+
naked: {
|
|
40
|
+
bg: button.variants.naked.backgroundColor,
|
|
41
|
+
text: button.variants.naked.textColor,
|
|
42
|
+
hoverBg: button.variants.naked.hover.backgroundColor,
|
|
43
|
+
activeBg: button.variants.naked.active.backgroundColor,
|
|
44
|
+
disabledBg: button.variants.naked.disabled.backgroundColor,
|
|
45
|
+
disabledText: button.variants.naked.disabled.textColor
|
|
46
|
+
},
|
|
47
|
+
accent: {
|
|
48
|
+
bg: button.variants.accent.backgroundColor,
|
|
49
|
+
text: button.variants.accent.textColor,
|
|
50
|
+
hoverBg: button.variants.accent.hover.backgroundColor,
|
|
51
|
+
activeBg: button.variants.accent.active.backgroundColor,
|
|
52
|
+
disabledBg: button.variants.accent.disabled.backgroundColor,
|
|
53
|
+
disabledText: button.variants.accent.disabled.textColor
|
|
54
|
+
},
|
|
55
|
+
// Deprecated alias for accent; removed in 3.0
|
|
56
|
+
emphasis: {
|
|
57
|
+
bg: button.variants.emphasis.backgroundColor,
|
|
58
|
+
text: button.variants.emphasis.textColor,
|
|
59
|
+
hoverBg: button.variants.emphasis.hover.backgroundColor,
|
|
60
|
+
activeBg: button.variants.emphasis.active.backgroundColor,
|
|
61
|
+
disabledBg: button.variants.emphasis.disabled.backgroundColor,
|
|
62
|
+
disabledText: button.variants.emphasis.disabled.textColor
|
|
63
|
+
},
|
|
64
|
+
danger: {
|
|
65
|
+
bg: button.variants.danger.backgroundColor,
|
|
66
|
+
text: button.variants.danger.textColor,
|
|
67
|
+
hoverBg: button.variants.danger.hover.backgroundColor,
|
|
68
|
+
activeBg: button.variants.danger.active.backgroundColor,
|
|
69
|
+
disabledBg: button.variants.danger.disabled.backgroundColor,
|
|
70
|
+
disabledText: button.variants.danger.disabled.textColor
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var config = variantConfig[$variant];
|
|
74
|
+
return "\n background-color: ".concat(config.bg, ";\n color: ").concat(config.text, ";\n \n &:hover:not(:disabled) {\n background-color: ").concat(config.hoverBg, ";\n }\n\n &:active:not(:disabled) {\n background-color: ").concat(config.activeBg, ";\n }\n\n &:disabled {\n background-color: ").concat(config.disabledBg, ";\n color: ").concat(config.disabledText, ";\n }\n ");
|
|
75
|
+
};
|
|
76
|
+
// Dynamic size styles: font from component tokens, height from size.control (decision 0034)
|
|
77
|
+
var getSizeStyles = function getSizeStyles(_a) {
|
|
78
|
+
var $size = _a.$size;
|
|
79
|
+
switch ($size) {
|
|
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 ");
|
|
82
|
+
case 'medium':
|
|
83
|
+
return "\n font: ".concat(button.sizes.medium.font, ";\n min-height: ").concat(control.md, ";\n padding: 0 ").concat(inset.lg, ";\n ");
|
|
84
|
+
case 'large':
|
|
85
|
+
default:
|
|
86
|
+
return "\n font: ".concat(button.sizes.large.font, ";\n min-height: ").concat(control.lg, ";\n padding: 0 ").concat(inset.lg, ";\n ");
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
var StyledButton = /*#__PURE__*/styled.button.withConfig({
|
|
90
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
91
|
+
return !prop.startsWith('$');
|
|
92
|
+
},
|
|
93
|
+
displayName: "Button__StyledButton",
|
|
94
|
+
componentId: "sc-1eiuum9-0"
|
|
95
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n border-radius: ", ";\n \n ", "\n ", "\n"], ["\n ", "\n border-radius: ", ";\n \n ", "\n ", "\n"])), baseButtonStyles, button.primary.borderRadius, getVariantStyles, getSizeStyles);
|
|
96
|
+
var StyledLink = /*#__PURE__*/styled.a.withConfig({
|
|
97
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
98
|
+
return !prop.startsWith('$');
|
|
99
|
+
},
|
|
100
|
+
displayName: "Button__StyledLink",
|
|
101
|
+
componentId: "sc-1eiuum9-1"
|
|
102
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n border-radius: ", ";\n \n ", "\n ", "\n"], ["\n ", "\n border-radius: ", ";\n \n ", "\n ", "\n"
|
|
103
|
+
// Helper function to get icon size based on button size
|
|
104
|
+
])), baseButtonStyles, button.primary.borderRadius, getVariantStyles, getSizeStyles);
|
|
105
|
+
// Helper function to get icon size based on button size
|
|
106
|
+
var getIconSize = function getIconSize(buttonSize) {
|
|
107
|
+
switch (buttonSize) {
|
|
108
|
+
case 'small':
|
|
109
|
+
return 'xs';
|
|
110
|
+
case 'medium':
|
|
111
|
+
return 'sm';
|
|
112
|
+
case 'large':
|
|
113
|
+
return 'md';
|
|
114
|
+
default:
|
|
115
|
+
return 'md';
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
// Helper function to render button content with optional icon
|
|
119
|
+
var renderButtonContent = function renderButtonContent(children, iconName, size) {
|
|
120
|
+
if (!iconName) return children;
|
|
121
|
+
var iconSize = getIconSize(size);
|
|
122
|
+
return jsxs(Fragment, {
|
|
123
|
+
children: [jsx(Icon, {
|
|
124
|
+
name: iconName,
|
|
125
|
+
size: iconSize,
|
|
126
|
+
iconColor: "inherit"
|
|
127
|
+
}), children]
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
var Button = function Button(_a) {
|
|
131
|
+
var _b = _a.variant,
|
|
132
|
+
variant = _b === void 0 ? "primary" : _b,
|
|
133
|
+
_c = _a.size,
|
|
134
|
+
size = _c === void 0 ? "large" : _c,
|
|
135
|
+
url = _a.url,
|
|
136
|
+
_d = _a.purpose,
|
|
137
|
+
purpose = _d === void 0 ? 'button' : _d,
|
|
138
|
+
children = _a.children,
|
|
139
|
+
target = _a.target,
|
|
140
|
+
iconName = _a.iconName,
|
|
141
|
+
LinkComponent = _a.linkComponent,
|
|
142
|
+
dataTestId = _a["data-testid"],
|
|
143
|
+
rest = __rest(_a, ["variant", "size", "url", "purpose", "children", "target", "iconName", "linkComponent", 'data-testid']);
|
|
144
|
+
// For links with custom link component (e.g., Next.js Link, React Router Link)
|
|
145
|
+
if (purpose === 'link' && url && LinkComponent) {
|
|
146
|
+
// The link component renders the <a>, so anchor attributes (id, aria-*, rel, handlers) go to it
|
|
147
|
+
var linkProps = rest;
|
|
148
|
+
return jsx(LinkComponent, __assign({}, linkProps, {
|
|
149
|
+
href: url,
|
|
150
|
+
target: target,
|
|
151
|
+
children: jsx(StyledLink, {
|
|
152
|
+
as: "span",
|
|
153
|
+
"$variant": variant,
|
|
154
|
+
"$size": size,
|
|
155
|
+
"data-testid": dataTestId,
|
|
156
|
+
children: renderButtonContent(children, iconName, size)
|
|
157
|
+
})
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
// For standard links (external or without custom component)
|
|
161
|
+
if (purpose === 'link' && url) {
|
|
162
|
+
var linkProps = rest;
|
|
163
|
+
return jsx(StyledLink, __assign({}, linkProps, {
|
|
164
|
+
href: url,
|
|
165
|
+
target: target,
|
|
166
|
+
"$variant": variant,
|
|
167
|
+
"$size": size,
|
|
168
|
+
"data-testid": dataTestId,
|
|
169
|
+
children: renderButtonContent(children, iconName, size)
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
// For button with URL (legacy support)
|
|
173
|
+
if (purpose === 'button' && url) {
|
|
174
|
+
var buttonProps_1 = rest;
|
|
175
|
+
var handleClick = function handleClick(e) {
|
|
176
|
+
// Call any existing onClick handler first
|
|
177
|
+
if (buttonProps_1.onClick) {
|
|
178
|
+
buttonProps_1.onClick(e);
|
|
179
|
+
}
|
|
180
|
+
// Handle navigation
|
|
181
|
+
if (url.startsWith('http') || target) {
|
|
182
|
+
window.open(url, target || '_self');
|
|
183
|
+
} else {
|
|
184
|
+
window.location.href = url;
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
return jsx(StyledButton, __assign({}, buttonProps_1, {
|
|
188
|
+
"$variant": variant,
|
|
189
|
+
"$size": size,
|
|
190
|
+
"data-testid": dataTestId,
|
|
191
|
+
onClick: handleClick,
|
|
192
|
+
children: renderButtonContent(children, iconName, size)
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
// Regular button
|
|
196
|
+
var buttonProps = rest;
|
|
197
|
+
return jsx(StyledButton, __assign({
|
|
198
|
+
"$variant": variant,
|
|
199
|
+
"$size": size,
|
|
200
|
+
"data-testid": dataTestId
|
|
201
|
+
}, buttonProps, {
|
|
202
|
+
children: renderButtonContent(children, iconName, size)
|
|
203
|
+
}));
|
|
204
|
+
};
|
|
205
|
+
var templateObject_1, templateObject_2;
|
|
206
|
+
|
|
207
|
+
export { Button };
|
|
208
|
+
//# sourceMappingURL=Button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Button.mjs';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type CategoryLabelProps } from '../CategoryLabel/CategoryLabel.mjs';
|
|
3
|
+
export type { CategoryColor, CategoryVariant } from '../CategoryLabel/CategoryLabel.mjs';
|
|
4
|
+
/**
|
|
5
|
+
* Size options for CategoryBadge
|
|
6
|
+
* @deprecated Use `CategoryLabelSize`: CategoryBadge `small` is CategoryLabel `medium`, and
|
|
7
|
+
* `medium` is `large` (decision 0018).
|
|
8
|
+
*/
|
|
9
|
+
export type CategorySize = 'small' | 'medium';
|
|
10
|
+
/**
|
|
11
|
+
* Props for the CategoryBadge component
|
|
12
|
+
* @deprecated Use `CategoryLabelProps`. CategoryBadge is renamed CategoryLabel and is removed in
|
|
13
|
+
* 3.0 (decision 0018).
|
|
14
|
+
*/
|
|
15
|
+
export interface CategoryBadgeProps extends Omit<CategoryLabelProps, 'size'> {
|
|
16
|
+
/**
|
|
17
|
+
* Size of the badge
|
|
18
|
+
* @default 'medium'
|
|
19
|
+
*/
|
|
20
|
+
size?: CategorySize;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* CategoryBadge displays a category label.
|
|
24
|
+
*
|
|
25
|
+
* @deprecated Renamed to `CategoryLabel` (same `color` and `variant`). Map `size="small"` to
|
|
26
|
+
* `"medium"`, and `size="medium"` (or no size) to `"large"`, CategoryLabel's default.
|
|
27
|
+
* CategoryBadge is removed in 3.0 (decision 0018).
|
|
28
|
+
*/
|
|
29
|
+
export declare const CategoryBadge: React.FC<CategoryBadgeProps>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __rest, __assign } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { CategoryLabel } from '../CategoryLabel/CategoryLabel.mjs';
|
|
5
|
+
|
|
6
|
+
// CategoryBadge sizes on the decision 0018 scale
|
|
7
|
+
var toLabelSize = {
|
|
8
|
+
small: 'medium',
|
|
9
|
+
medium: 'large'
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* CategoryBadge displays a category label.
|
|
13
|
+
*
|
|
14
|
+
* @deprecated Renamed to `CategoryLabel` (same `color` and `variant`). Map `size="small"` to
|
|
15
|
+
* `"medium"`, and `size="medium"` (or no size) to `"large"`, CategoryLabel's default.
|
|
16
|
+
* CategoryBadge is removed in 3.0 (decision 0018).
|
|
17
|
+
*/
|
|
18
|
+
var CategoryBadge = function CategoryBadge(_a) {
|
|
19
|
+
var _b = _a.size,
|
|
20
|
+
size = _b === void 0 ? 'medium' : _b,
|
|
21
|
+
props = __rest(_a, ["size"]);
|
|
22
|
+
return jsx(CategoryLabel, __assign({}, props, {
|
|
23
|
+
size: toLabelSize[size]
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
CategoryBadge.displayName = 'CategoryBadge';
|
|
27
|
+
|
|
28
|
+
export { CategoryBadge };
|
|
29
|
+
//# sourceMappingURL=CategoryBadge.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoryBadge.mjs","sources":["../../../../src/components/atoms/CategoryBadge/CategoryBadge.tsx"],"sourcesContent":["import React from 'react'\nimport { CategoryLabel, type CategoryLabelProps } from '../CategoryLabel/CategoryLabel'\n\nexport type { CategoryColor, CategoryVariant } from '../CategoryLabel/CategoryLabel'\n\n/**\n * Size options for CategoryBadge\n * @deprecated Use `CategoryLabelSize`: CategoryBadge `small` is CategoryLabel `medium`, and\n * `medium` is `large` (decision 0018).\n */\nexport type CategorySize = 'small' | 'medium'\n\n/**\n * Props for the CategoryBadge component\n * @deprecated Use `CategoryLabelProps`. CategoryBadge is renamed CategoryLabel and is removed in\n * 3.0 (decision 0018).\n */\nexport interface CategoryBadgeProps extends Omit<CategoryLabelProps, 'size'> {\n /**\n * Size of the badge\n * @default 'medium'\n */\n size?: CategorySize\n}\n\n// CategoryBadge sizes on the decision 0018 scale\nconst toLabelSize = { small: 'medium', medium: 'large' } as const\n\n/**\n * CategoryBadge displays a category label.\n *\n * @deprecated Renamed to `CategoryLabel` (same `color` and `variant`). Map `size=\"small\"` to\n * `\"medium\"`, and `size=\"medium\"` (or no size) to `\"large\"`, CategoryLabel's default.\n * CategoryBadge is removed in 3.0 (decision 0018).\n */\nexport const CategoryBadge: React.FC<CategoryBadgeProps> = ({ size = 'medium', ...props }) => (\n <CategoryLabel {...props} size={toLabelSize[size]} />\n)\n\nCategoryBadge.displayName = 'CategoryBadge'\n"],"names":["toLabelSize","small","medium","CategoryBadge","_a","_b","size","props","__rest","_jsx","CategoryLabel","__assign","displayName"],"mappings":";;;;;AAyBA;AACA,IAAMA,WAAW,GAAG;AAAEC,EAAAA,KAAK,EAAE,QAAQ;AAAEC,EAAAA,MAAM,EAAE,OAAA;AAAO,CAAW,CAAA;AAEjE;;;;;;AAMG;IACUC,aAAa,GAAiC,SAA9CA,aAAaA,CAAkCC,EAA6B,EAAA;AAA3B,EAAA,IAAAC,EAAA,GAAAD,EAAA,CAAAE,IAAe;IAAfA,IAAI,GAAGD,EAAA,KAAA,KAAA,CAAA,GAAA,QAAQ,KAAA;IAAKE,KAAK,GAA3BC,MAAA,CAAAJ,EAAA,EAAA,CAAA,MAAA,CAA6B,CAAF,CAAA;EAAO,OAC5FK,GAAA,CAACC,aAAa,EAAAC,QAAA,CAAA,EAAA,EAAKJ,KAAK,EAAE;IAAAD,IAAI,EAAEN,WAAW,CAACM,IAAI,CAAA;AAAC,GAAA,CAAA,CAAI,CAAA;EACtD;AAEDH,aAAa,CAACS,WAAW,GAAG,eAAe;;;;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import type { IconName } from '../../../types/icons.mjs';
|
|
3
|
+
/**
|
|
4
|
+
* Category color options for CategoryLabel
|
|
5
|
+
*/
|
|
6
|
+
export type CategoryColor = 'blue' | 'purple' | 'pink' | 'yellow' | 'green' | 'red' | 'orange' | 'gray';
|
|
7
|
+
/**
|
|
8
|
+
* Visual variant options for CategoryLabel
|
|
9
|
+
*/
|
|
10
|
+
export type CategoryVariant = 'filled' | 'outlined' | 'minimal';
|
|
11
|
+
/**
|
|
12
|
+
* Size options for CategoryLabel: medium (24px) or large (32px), on the decision 0018 scale
|
|
13
|
+
*/
|
|
14
|
+
export type CategoryLabelSize = 'medium' | 'large';
|
|
15
|
+
/**
|
|
16
|
+
* Props for the CategoryLabel component
|
|
17
|
+
*/
|
|
18
|
+
export interface CategoryLabelProps {
|
|
19
|
+
/**
|
|
20
|
+
* The category text to display
|
|
21
|
+
*/
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Color scheme for the label
|
|
25
|
+
* @default 'blue'
|
|
26
|
+
*/
|
|
27
|
+
color?: CategoryColor;
|
|
28
|
+
/**
|
|
29
|
+
* Visual variant of the label
|
|
30
|
+
* @default 'filled'
|
|
31
|
+
*/
|
|
32
|
+
variant?: CategoryVariant;
|
|
33
|
+
/**
|
|
34
|
+
* Size: medium (24px) or large (32px)
|
|
35
|
+
* @default 'large'
|
|
36
|
+
*/
|
|
37
|
+
size?: CategoryLabelSize;
|
|
38
|
+
/**
|
|
39
|
+
* Optional icon name to display
|
|
40
|
+
*/
|
|
41
|
+
icon?: IconName;
|
|
42
|
+
/**
|
|
43
|
+
* Test identifier for automated testing
|
|
44
|
+
*/
|
|
45
|
+
'data-testid'?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Accessible label, announced instead of the visible text (for example "Category: Food & Dining").
|
|
48
|
+
* Rendered as visually hidden text, because a plain label has no role that can be named (#78).
|
|
49
|
+
*/
|
|
50
|
+
'aria-label'?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* CategoryLabel colour-codes an item's category, such as a transaction's (decision 0018).
|
|
54
|
+
*
|
|
55
|
+
* A static, chip-like label with 8 category colours, 3 visual variants and an optional icon.
|
|
56
|
+
* Category colours carry no status meaning; for status use StatusLabel.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* <CategoryLabel color="orange" icon="creditCard">
|
|
61
|
+
* Shopping
|
|
62
|
+
* </CategoryLabel>
|
|
63
|
+
*
|
|
64
|
+
* <CategoryLabel color="blue" variant="outlined" size="medium">
|
|
65
|
+
* Travel
|
|
66
|
+
* </CategoryLabel>
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare const CategoryLabel: React.FC<CategoryLabelProps>;
|
|
@@ -0,0 +1,151 @@
|
|
|
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 { Icon } from '../Icon/Icon.mjs';
|
|
7
|
+
import { visuallyHidden } from '../../../lib/styleUtils.mjs';
|
|
8
|
+
import tokens from '../../../lib/cssTokens.mjs';
|
|
9
|
+
|
|
10
|
+
var semantic = tokens.semantic;
|
|
11
|
+
var color = semantic.color;
|
|
12
|
+
var label = tokens.component.badge.label;
|
|
13
|
+
var category = color.category;
|
|
14
|
+
var radius = semantic.radius;
|
|
15
|
+
var space = semantic.space;
|
|
16
|
+
var labelHeight = semantic.size.label;
|
|
17
|
+
// Text on white or the -subtle fill (outlined and minimal), at least 4.5:1 (#115)
|
|
18
|
+
var categoryText = {
|
|
19
|
+
blue: category['blue-text'],
|
|
20
|
+
purple: category['purple-text'],
|
|
21
|
+
pink: category['pink-text'],
|
|
22
|
+
yellow: category['yellow-text'],
|
|
23
|
+
green: category['green-text'],
|
|
24
|
+
red: category['red-text'],
|
|
25
|
+
orange: category['orange-text'],
|
|
26
|
+
gray: category['gray-text']
|
|
27
|
+
};
|
|
28
|
+
var StyledCategoryLabel = /*#__PURE__*/styled.span.withConfig({
|
|
29
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
30
|
+
return !prop.startsWith('$');
|
|
31
|
+
},
|
|
32
|
+
displayName: "CategoryLabel__StyledCategoryLabel",
|
|
33
|
+
componentId: "sc-1jx7bjo-0"
|
|
34
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n box-sizing: border-box; /* the height includes padding and border, without relying on a global reset */\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: ", ";\n white-space: nowrap;\n user-select: none;\n border-style: solid;\n border-width: ", ";\n \n /* Size styles */\n height: ", ";\n padding: ", ";\n font: ", ";\n /* After the font shorthand, which would otherwise reset it */\n font-weight: ", ";\n gap: ", ";\n \n /* Variant + Color styles */\n background-color: ", ";\n \n /* Outlined and minimal text uses the AA text token, not the base colour (issue 115) */\n color: ", ";\n \n border-color: ", ";\n"], ["\n box-sizing: border-box; /* the height includes padding and border, without relying on a global reset */\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: ", ";\n white-space: nowrap;\n user-select: none;\n border-style: solid;\n border-width: ", ";\n \n /* Size styles */\n height: ", ";\n padding: ", ";\n font: ", ";\n /* After the font shorthand, which would otherwise reset it */\n font-weight: ", ";\n gap: ", ";\n \n /* Variant + Color styles */\n background-color: ", ";\n \n /* Outlined and minimal text uses the AA text token, not the base colour (issue 115) */\n color: ", ";\n \n border-color: ", ";\n"
|
|
35
|
+
// The visible content, hidden from assistive technology when an aria-label replaces it.
|
|
36
|
+
// display: contents keeps the root's flex layout and gap.
|
|
37
|
+
])), radius.full, semantic.border.width.thin, function (_a) {
|
|
38
|
+
var $size = _a.$size;
|
|
39
|
+
return labelHeight[$size];
|
|
40
|
+
}, function (_a) {
|
|
41
|
+
var $size = _a.$size;
|
|
42
|
+
return $size === 'medium' ? "".concat(space[100], " ").concat(space[200]) : "".concat(space[200], " ").concat(space[300]);
|
|
43
|
+
}, function (_a) {
|
|
44
|
+
var $size = _a.$size;
|
|
45
|
+
return $size === 'medium' ? label.typography.small : label.typography.medium;
|
|
46
|
+
}, label.fontWeight, space[100], function (_a) {
|
|
47
|
+
var $color = _a.$color,
|
|
48
|
+
$variant = _a.$variant;
|
|
49
|
+
if ($variant === 'filled') {
|
|
50
|
+
return category["".concat($color, "-strong")];
|
|
51
|
+
}
|
|
52
|
+
if ($variant === 'outlined') {
|
|
53
|
+
return 'transparent';
|
|
54
|
+
}
|
|
55
|
+
// minimal
|
|
56
|
+
return category["".concat($color, "-muted")];
|
|
57
|
+
}, function (_a) {
|
|
58
|
+
var $color = _a.$color,
|
|
59
|
+
$variant = _a.$variant;
|
|
60
|
+
if ($variant === 'filled') {
|
|
61
|
+
return color.text.inverse;
|
|
62
|
+
}
|
|
63
|
+
return categoryText[$color];
|
|
64
|
+
}, function (_a) {
|
|
65
|
+
var $color = _a.$color,
|
|
66
|
+
$variant = _a.$variant;
|
|
67
|
+
if ($variant === 'outlined') {
|
|
68
|
+
return category[$color];
|
|
69
|
+
}
|
|
70
|
+
return 'transparent';
|
|
71
|
+
});
|
|
72
|
+
// The visible content, hidden from assistive technology when an aria-label replaces it.
|
|
73
|
+
// display: contents keeps the root's flex layout and gap.
|
|
74
|
+
var VisibleContent = /*#__PURE__*/styled.span.withConfig({
|
|
75
|
+
displayName: "CategoryLabel__VisibleContent",
|
|
76
|
+
componentId: "sc-1jx7bjo-1"
|
|
77
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: contents;\n"], ["\n display: contents;\n"])));
|
|
78
|
+
var HiddenLabel = /*#__PURE__*/styled.span.withConfig({
|
|
79
|
+
displayName: "CategoryLabel__HiddenLabel",
|
|
80
|
+
componentId: "sc-1jx7bjo-2"
|
|
81
|
+
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"
|
|
82
|
+
/**
|
|
83
|
+
* CategoryLabel colour-codes an item's category, such as a transaction's (decision 0018).
|
|
84
|
+
*
|
|
85
|
+
* A static, chip-like label with 8 category colours, 3 visual variants and an optional icon.
|
|
86
|
+
* Category colours carry no status meaning; for status use StatusLabel.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```tsx
|
|
90
|
+
* <CategoryLabel color="orange" icon="creditCard">
|
|
91
|
+
* Shopping
|
|
92
|
+
* </CategoryLabel>
|
|
93
|
+
*
|
|
94
|
+
* <CategoryLabel color="blue" variant="outlined" size="medium">
|
|
95
|
+
* Travel
|
|
96
|
+
* </CategoryLabel>
|
|
97
|
+
* ```
|
|
98
|
+
*/])), visuallyHidden);
|
|
99
|
+
/**
|
|
100
|
+
* CategoryLabel colour-codes an item's category, such as a transaction's (decision 0018).
|
|
101
|
+
*
|
|
102
|
+
* A static, chip-like label with 8 category colours, 3 visual variants and an optional icon.
|
|
103
|
+
* Category colours carry no status meaning; for status use StatusLabel.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```tsx
|
|
107
|
+
* <CategoryLabel color="orange" icon="creditCard">
|
|
108
|
+
* Shopping
|
|
109
|
+
* </CategoryLabel>
|
|
110
|
+
*
|
|
111
|
+
* <CategoryLabel color="blue" variant="outlined" size="medium">
|
|
112
|
+
* Travel
|
|
113
|
+
* </CategoryLabel>
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
var CategoryLabel = function CategoryLabel(_a) {
|
|
117
|
+
var children = _a.children,
|
|
118
|
+
_b = _a.color,
|
|
119
|
+
color = _b === void 0 ? 'blue' : _b,
|
|
120
|
+
_c = _a.variant,
|
|
121
|
+
variant = _c === void 0 ? 'filled' : _c,
|
|
122
|
+
_d = _a.size,
|
|
123
|
+
size = _d === void 0 ? 'large' : _d,
|
|
124
|
+
icon = _a.icon,
|
|
125
|
+
dataTestId = _a["data-testid"],
|
|
126
|
+
ariaLabel = _a["aria-label"];
|
|
127
|
+
var iconSize = size === 'medium' ? 'xs' : 'sm';
|
|
128
|
+
// A blank aria-label is no label at all, so it falls back like a missing one
|
|
129
|
+
var accessibleLabel = (ariaLabel === null || ariaLabel === void 0 ? void 0 : ariaLabel.trim()) ? ariaLabel : undefined;
|
|
130
|
+
return jsxs(StyledCategoryLabel, {
|
|
131
|
+
"$color": color,
|
|
132
|
+
"$variant": variant,
|
|
133
|
+
"$size": size,
|
|
134
|
+
"data-testid": dataTestId,
|
|
135
|
+
children: [jsxs(VisibleContent, {
|
|
136
|
+
"aria-hidden": accessibleLabel ? 'true' : undefined,
|
|
137
|
+
children: [icon && jsx(Icon, {
|
|
138
|
+
name: icon,
|
|
139
|
+
size: iconSize,
|
|
140
|
+
iconColor: variant === 'filled' ? 'inverse' : 'inherit'
|
|
141
|
+
}), children]
|
|
142
|
+
}), accessibleLabel && jsx(HiddenLabel, {
|
|
143
|
+
children: accessibleLabel
|
|
144
|
+
})]
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
CategoryLabel.displayName = 'CategoryLabel';
|
|
148
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
149
|
+
|
|
150
|
+
export { CategoryLabel };
|
|
151
|
+
//# sourceMappingURL=CategoryLabel.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoryLabel.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseChipProps } from './shared/types.mjs';
|
|
3
|
+
/** @deprecated Becomes `FilterChipProps` in 3.0 (decision 0016). */
|
|
4
|
+
export interface BooleanChipProps extends BaseChipProps {
|
|
5
|
+
/** Whether the chip is in selected state */
|
|
6
|
+
selected: boolean;
|
|
7
|
+
/** Callback function when the chip is clicked/toggled */
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* BooleanChip - Toggleable chip for quick filter controls
|
|
12
|
+
*
|
|
13
|
+
* Use this component for multi-select filter controls where users can
|
|
14
|
+
* see which options are active. Common in table filtering patterns where
|
|
15
|
+
* users toggle filters on/off.
|
|
16
|
+
*
|
|
17
|
+
* Features:
|
|
18
|
+
* - Shows checkmark icon when selected
|
|
19
|
+
* - Entire chip is clickable to toggle
|
|
20
|
+
* - Keyboard activation with Space or Enter
|
|
21
|
+
* - Uses checkbox role with aria-checked
|
|
22
|
+
* - Light-blue fill and blue text when selected and enabled; disabled colours when disabled
|
|
23
|
+
*
|
|
24
|
+
* @deprecated Becomes `FilterChip` in 3.0, with the same props. Keep using `BooleanChip`
|
|
25
|
+
* until you upgrade; in 3.0, replace `FilterChip` with `InputChip` first, then
|
|
26
|
+
* `BooleanChip` with `FilterChip` (decision 0016).
|
|
27
|
+
*/
|
|
28
|
+
export declare const BooleanChip: React.FC<BooleanChipProps>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __rest, __assign } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { Icon } from '../Icon/Icon.mjs';
|
|
5
|
+
import { StyledChip, IconContainer } from './shared/ChipBase.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* BooleanChip - Toggleable chip for quick filter controls
|
|
9
|
+
*
|
|
10
|
+
* Use this component for multi-select filter controls where users can
|
|
11
|
+
* see which options are active. Common in table filtering patterns where
|
|
12
|
+
* users toggle filters on/off.
|
|
13
|
+
*
|
|
14
|
+
* Features:
|
|
15
|
+
* - Shows checkmark icon when selected
|
|
16
|
+
* - Entire chip is clickable to toggle
|
|
17
|
+
* - Keyboard activation with Space or Enter
|
|
18
|
+
* - Uses checkbox role with aria-checked
|
|
19
|
+
* - Light-blue fill and blue text when selected and enabled; disabled colours when disabled
|
|
20
|
+
*
|
|
21
|
+
* @deprecated Becomes `FilterChip` in 3.0, with the same props. Keep using `BooleanChip`
|
|
22
|
+
* until you upgrade; in 3.0, replace `FilterChip` with `InputChip` first, then
|
|
23
|
+
* `BooleanChip` with `FilterChip` (decision 0016).
|
|
24
|
+
*/
|
|
25
|
+
var BooleanChip = function BooleanChip(_a) {
|
|
26
|
+
var children = _a.children,
|
|
27
|
+
selected = _a.selected,
|
|
28
|
+
onClick = _a.onClick;
|
|
29
|
+
// Deprecated and ignored: chips have one size (decision 0035)
|
|
30
|
+
_a.size;
|
|
31
|
+
var _b = _a.disabled,
|
|
32
|
+
disabled = _b === void 0 ? false : _b,
|
|
33
|
+
dataTestId = _a["data-testid"],
|
|
34
|
+
ariaLabel = _a["aria-label"],
|
|
35
|
+
ariaDescribedBy = _a["aria-describedby"],
|
|
36
|
+
props = __rest(_a, ["children", "selected", "onClick", "size", "disabled", 'data-testid', 'aria-label', 'aria-describedby']);
|
|
37
|
+
var handleClick = function handleClick() {
|
|
38
|
+
if (!disabled) {
|
|
39
|
+
onClick();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
43
|
+
// Handle activation with Space or Enter
|
|
44
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
45
|
+
event.preventDefault();
|
|
46
|
+
handleClick();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return jsxs(StyledChip, __assign({
|
|
50
|
+
"$variant": "subtle",
|
|
51
|
+
"$disabled": disabled || undefined,
|
|
52
|
+
"$clickable": !disabled,
|
|
53
|
+
"$selected": selected,
|
|
54
|
+
onClick: handleClick,
|
|
55
|
+
onKeyDown: handleKeyDown,
|
|
56
|
+
tabIndex: disabled ? undefined : 0,
|
|
57
|
+
role: "checkbox",
|
|
58
|
+
"aria-checked": selected ? 'true' : 'false',
|
|
59
|
+
"aria-label": ariaLabel,
|
|
60
|
+
"aria-describedby": ariaDescribedBy,
|
|
61
|
+
"aria-disabled": disabled ? 'true' : undefined,
|
|
62
|
+
"data-testid": dataTestId
|
|
63
|
+
}, props, {
|
|
64
|
+
children: [selected && jsx(IconContainer, {
|
|
65
|
+
"aria-hidden": "true",
|
|
66
|
+
children: jsx(Icon, {
|
|
67
|
+
name: "check",
|
|
68
|
+
size: "sm",
|
|
69
|
+
iconColor: "inherit"
|
|
70
|
+
})
|
|
71
|
+
}), children]
|
|
72
|
+
}));
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export { BooleanChip };
|
|
76
|
+
//# sourceMappingURL=BooleanChip.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BooleanChip.mjs","sources":["../../../../src/components/atoms/Chip/BooleanChip.tsx"],"sourcesContent":["import React from 'react'\nimport { Icon } from '../Icon'\nimport { BaseChipProps } from './shared/types'\nimport { StyledChip, IconContainer } from './shared/ChipBase'\n\n/** @deprecated Becomes `FilterChipProps` in 3.0 (decision 0016). */\nexport interface BooleanChipProps extends BaseChipProps {\n /** Whether the chip is in selected state */\n selected: boolean\n /** Callback function when the chip is clicked/toggled */\n onClick: () => void\n}\n\n/**\n * BooleanChip - Toggleable chip for quick filter controls\n * \n * Use this component for multi-select filter controls where users can\n * see which options are active. Common in table filtering patterns where\n * users toggle filters on/off.\n * \n * Features:\n * - Shows checkmark icon when selected\n * - Entire chip is clickable to toggle\n * - Keyboard activation with Space or Enter\n * - Uses checkbox role with aria-checked\n * - Light-blue fill and blue text when selected and enabled; disabled colours when disabled\n *\n * @deprecated Becomes `FilterChip` in 3.0, with the same props. Keep using `BooleanChip`\n * until you upgrade; in 3.0, replace `FilterChip` with `InputChip` first, then\n * `BooleanChip` with `FilterChip` (decision 0016).\n */\nexport const BooleanChip: React.FC<BooleanChipProps> = ({\n children,\n selected,\n onClick,\n // Deprecated and ignored: chips have one size (decision 0035)\n size: _size,\n disabled = false,\n 'data-testid': dataTestId,\n 'aria-label': ariaLabel,\n 'aria-describedby': ariaDescribedBy,\n ...props\n}) => {\n const handleClick = () => {\n if (!disabled) {\n onClick()\n }\n }\n \n const handleKeyDown = (event: React.KeyboardEvent) => {\n // Handle activation with Space or Enter\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n handleClick()\n }\n }\n \n return (\n <StyledChip\n $variant=\"subtle\"\n $disabled={disabled || undefined}\n $clickable={!disabled}\n $selected={selected}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n tabIndex={disabled ? undefined : 0}\n role=\"checkbox\"\n aria-checked={selected ? 'true' : 'false'}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedBy}\n aria-disabled={disabled ? 'true' : undefined}\n data-testid={dataTestId}\n {...props}\n >\n {/* Show selected indicator when selected */}\n {selected && (\n <IconContainer aria-hidden=\"true\">\n <Icon name=\"check\" size=\"sm\" iconColor=\"inherit\" />\n </IconContainer>\n )}\n \n {children}\n </StyledChip>\n )\n}\n"],"names":["BooleanChip","_a","children","selected","onClick","size","_b","disabled","dataTestId","ariaLabel","ariaDescribedBy","props","__rest","handleClick","handleKeyDown","event","key","preventDefault","_jsxs","StyledChip","__assign","undefined","onKeyDown","tabIndex","role","_jsx","IconContainer","Icon","name","iconColor"],"mappings":";;;;;;AAaA;;;;;;;;;;;;;;;;;AAiBG;IACUA,WAAW,GAA+B,SAA1CA,WAAWA,CAAgCC,EAWvD,EAAA;AAVC,EAAA,IAAAC,QAAQ,GAAAD,EAAA,CAAAC,QAAA,CAAA;IACRC,QAAQ,GAAAF,EAAA,CAAAE,QAAA,CAAA;IACRC,OAAO,GAAAH,EAAA,CAAAG,OAAA,CAAA;AACP,IAAA;IACWH,EAAA,CAAAI,IAAA,CAAA;QACXC,EAAgB,GAAAL,EAAA,CAAAM,QAAA,CAAA;IAAhBA,QAAQ,GAAGD,EAAA,KAAA,KAAA,CAAA,GAAA,KAAK,KAAA,CAAA;AACDE,IAAAA,UAAU,oBAAA,CAAA;AACXC,IAAAA,SAAS,mBAAA,CAAA;AACHC,IAAAA,eAAe,yBAAA,CAAA;IAChCC,KAAK,GAV8CC,MAAA,CAAAX,EAAA,EAAA,CAAA,UAAA,EAAA,UAAA,EAAA,SAAA,EAAA,MAAA,EAAA,UAAA,EAAA,aAAA,EAAA,YAAA,EAAA,kBAAA,CAWvD,EADS;AAER,EAAA,IAAMY,WAAW,GAAG,SAAdA,WAAWA,GAAG;IAClB,IAAI,CAACN,QAAQ,EAAE;AACbH,MAAAA,OAAO,EAAE,CAAA;AACX,KAAA;GACD,CAAA;AAED,EAAA,IAAMU,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,KAA0B,EAAA;AAC/C;IACA,IAAIA,KAAK,CAACC,GAAG,KAAK,OAAO,IAAID,KAAK,CAACC,GAAG,KAAK,GAAG,EAAE;MAC9CD,KAAK,CAACE,cAAc,EAAE,CAAA;AACtBJ,MAAAA,WAAW,EAAE,CAAA;AACf,KAAA;GACD,CAAA;AAED,EAAA,OACEK,KAACC,UAAU,EAAAC,QAAA,CAAA;AAAA,IAAA,UAAA,EACA,QAAQ;IACN,WAAA,EAAAb,QAAQ,IAAIc,SAAS;IAAA,YAAA,EACpB,CAACd,QAAQ;AAAA,IAAA,WAAA,EACVJ,QAAQ;AACnBC,IAAAA,OAAO,EAAES,WAAW;AACpBS,IAAAA,SAAS,EAAER,aAAa;AACxBS,IAAAA,QAAQ,EAAEhB,QAAQ,GAAGc,SAAS,GAAG,CAAC;AAClCG,IAAAA,IAAI,EAAC,UAAU;oBACDrB,QAAQ,GAAG,MAAM,GAAG,OAAO;kBAC7BM,SAAS;AAAA,IAAA,kBAAA,EACHC,eAAe;AAClB,IAAA,eAAA,EAAAH,QAAQ,GAAG,MAAM,GAAGc,SAAS;AAAA,IAAA,aAAA,EAC/Bb,UAAAA;GACT,EAAAG,KAAK;eAGRR,QAAQ,IACPsB,GAAA,CAACC,aAAa,EAAA;AAAA,MAAA,aAAA,EAAa,MAAM;AAC/BxB,MAAAA,QAAA,EAAAuB,GAAA,CAACE,IAAI,EAAC;AAAAC,QAAAA,IAAI,EAAC,OAAO;AAACvB,QAAAA,IAAI,EAAC,IAAI;AAACwB,QAAAA,SAAS,EAAC,SAAA;OAAY,CAAA;KAAA,CAEtD,EAEA3B,QAAQ,CAAA;AACE,GAAA,CAAA,CAAA,CAAA;AAEjB;;;;"}
|