@common-origin/design-system 2.19.0 → 2.21.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 +1012 -512
- 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/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/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 +5 -0
- package/dist/components/atoms/Chip/index.d.ts +1 -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/utils.d.mts +10 -0
- 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 +21 -0
- package/dist/components/atoms/index.d.ts +1 -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 +92 -0
- package/dist/components/molecules/AgentInput/AgentInput.d.ts +63 -1
- package/dist/components/molecules/AgentInput/AgentInput.mjs +1099 -0
- package/dist/components/molecules/AgentInput/AgentInput.mjs.map +1 -0
- package/dist/components/molecules/AgentInput/agentInputSpeech.d.mts +45 -0
- package/dist/components/molecules/AgentInput/agentInputSpeech.d.ts +2 -0
- package/dist/components/molecules/AgentInput/agentInputSpeech.mjs +53 -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/AgentInput/index.d.ts +1 -1
- 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 +76 -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 +56 -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 +100 -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 +316 -3
- package/dist/data.js.map +1 -1
- package/dist/index.d.mts +3 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/cssTokens.d.mts +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.mjs +37 -0
- package/dist/lib/cssVariables.mjs.map +1 -0
- package/dist/lib/styleUtils.d.mts +42 -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.mjs +122 -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/styles/icons.json +30 -1
- package/dist/{data.esm.js → styles/icons.json.mjs} +33 -1466
- package/dist/styles/icons.json.mjs.map +1 -0
- package/dist/styles/tokens.d.mts +3718 -0
- package/dist/styles/tokens.d.ts +545 -1
- package/dist/styles/tokens.json +284 -2
- package/dist/styles/tokens.json.mjs +1736 -0
- package/dist/{tokens/index.esm.js.map → styles/tokens.json.mjs.map} +1 -1
- package/dist/tokens/index.js +284 -2
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/{index.esm.js → index.mjs} +285 -3
- package/dist/tokens/index.mjs.map +1 -0
- package/dist/tokens/styles/tokens.d.mts +3718 -0
- package/dist/tokens/styles/tokens.d.ts +545 -1
- package/dist/tokens/tokens.d.mts +4 -0
- package/dist/tokens/types/tokens.d.mts +6 -0
- package/dist/tokens.css +242 -0
- package/dist/tokens.css.d.mts +4 -0
- package/dist/types/icons.d.mts +25 -0
- package/dist/types/icons.d.ts +1 -1
- 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.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 +26 -12
- package/dist/client.esm.js +0 -8289
- 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,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;AACD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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;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseChipProps, ChipVariant, LegacyVariant } from './shared/types.mjs';
|
|
3
|
+
export interface ChipProps extends BaseChipProps {
|
|
4
|
+
/**
|
|
5
|
+
* Visual style. Only `default` stays in 3.0. `emphasis`, `subtle`, `interactive`, `light`
|
|
6
|
+
* and `dark` are deprecated and will be removed (decision 0016).
|
|
7
|
+
* @default 'default'
|
|
8
|
+
*/
|
|
9
|
+
variant?: ChipVariant | LegacyVariant;
|
|
10
|
+
/**
|
|
11
|
+
* Click handler.
|
|
12
|
+
* @deprecated Removed in 3.0: the static Chip is not interactive. For a clickable action use a
|
|
13
|
+
* Button; for a toggle use `BooleanChip` (`FilterChip` in 3.0).
|
|
14
|
+
*/
|
|
15
|
+
onClick?: () => void;
|
|
16
|
+
/** Custom ARIA role override */
|
|
17
|
+
role?: string;
|
|
18
|
+
/** Legacy title prop for backward compatibility */
|
|
19
|
+
title?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Chip - a static, non-interactive label for tags, categories and metadata.
|
|
23
|
+
*
|
|
24
|
+
* Chips are classified by job (decision 0016):
|
|
25
|
+
* - Chip: a static label (`default` variant only)
|
|
26
|
+
* - InputChip: a removable value, such as an applied filter (formerly `FilterChip`)
|
|
27
|
+
* - BooleanChip: toggles a filter on and off (becomes `FilterChip` in 3.0)
|
|
28
|
+
*
|
|
29
|
+
* The `emphasis`, `subtle`, `interactive`, `light` and `dark` variants and `onClick` are
|
|
30
|
+
* deprecated and will be removed in 3.0.
|
|
31
|
+
*/
|
|
32
|
+
export declare const Chip: React.FC<ChipProps>;
|
|
33
|
+
export interface LegacyChipProps {
|
|
34
|
+
title: string;
|
|
35
|
+
variant?: LegacyVariant;
|
|
36
|
+
}
|
|
37
|
+
export declare const LegacyChip: React.FC<LegacyChipProps>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __rest, __assign } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { StyledChip } from './shared/ChipBase.mjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Chip - a static, non-interactive label for tags, categories and metadata.
|
|
8
|
+
*
|
|
9
|
+
* Chips are classified by job (decision 0016):
|
|
10
|
+
* - Chip: a static label (`default` variant only)
|
|
11
|
+
* - InputChip: a removable value, such as an applied filter (formerly `FilterChip`)
|
|
12
|
+
* - BooleanChip: toggles a filter on and off (becomes `FilterChip` in 3.0)
|
|
13
|
+
*
|
|
14
|
+
* The `emphasis`, `subtle`, `interactive`, `light` and `dark` variants and `onClick` are
|
|
15
|
+
* deprecated and will be removed in 3.0.
|
|
16
|
+
*/
|
|
17
|
+
var Chip = function Chip(_a) {
|
|
18
|
+
var children = _a.children,
|
|
19
|
+
_b = _a.variant,
|
|
20
|
+
variant = _b === void 0 ? 'default' : _b;
|
|
21
|
+
// Deprecated and ignored: chips have one size (decision 0035)
|
|
22
|
+
_a.size;
|
|
23
|
+
var onClick = _a.onClick,
|
|
24
|
+
_c = _a.disabled,
|
|
25
|
+
disabled = _c === void 0 ? false : _c,
|
|
26
|
+
dataTestId = _a["data-testid"],
|
|
27
|
+
ariaLabel = _a["aria-label"],
|
|
28
|
+
ariaDescribedBy = _a["aria-describedby"],
|
|
29
|
+
role = _a.role,
|
|
30
|
+
title = _a.title,
|
|
31
|
+
props = __rest(_a, ["children", "variant", "size", "onClick", "disabled", 'data-testid', 'aria-label', 'aria-describedby', "role", "title"]);
|
|
32
|
+
var isClickable = Boolean(onClick && !disabled);
|
|
33
|
+
// Map legacy variants to new variants
|
|
34
|
+
var normalizedVariant = variant === 'light' ? 'default' : variant === 'dark' ? 'emphasis' : variant;
|
|
35
|
+
// Support legacy title prop
|
|
36
|
+
var content = children !== undefined ? children : title;
|
|
37
|
+
var handleClick = function handleClick() {
|
|
38
|
+
if (onClick && !disabled) {
|
|
39
|
+
onClick();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
43
|
+
if (isClickable && (event.key === 'Enter' || event.key === ' ')) {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
handleClick();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return jsx(StyledChip, __assign({
|
|
49
|
+
"$variant": normalizedVariant,
|
|
50
|
+
"$disabled": disabled || undefined,
|
|
51
|
+
"$clickable": isClickable || undefined,
|
|
52
|
+
onClick: isClickable ? handleClick : undefined,
|
|
53
|
+
onKeyDown: handleKeyDown,
|
|
54
|
+
tabIndex: isClickable ? 0 : undefined,
|
|
55
|
+
role: role || (isClickable ? 'button' : undefined),
|
|
56
|
+
"aria-label": ariaLabel,
|
|
57
|
+
"aria-describedby": ariaDescribedBy,
|
|
58
|
+
"aria-disabled": disabled ? 'true' : undefined,
|
|
59
|
+
"data-testid": dataTestId
|
|
60
|
+
}, props, {
|
|
61
|
+
children: content
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
var LegacyChip = function LegacyChip(_a) {
|
|
65
|
+
var title = _a.title,
|
|
66
|
+
_b = _a.variant,
|
|
67
|
+
variant = _b === void 0 ? 'light' : _b;
|
|
68
|
+
var newVariant = variant === 'dark' ? 'emphasis' : 'default';
|
|
69
|
+
return jsx(Chip, {
|
|
70
|
+
variant: newVariant,
|
|
71
|
+
children: title
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export { Chip, LegacyChip };
|
|
76
|
+
//# sourceMappingURL=Chip.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chip.mjs","sources":["../../../../src/components/atoms/Chip/Chip.tsx"],"sourcesContent":["import React from 'react'\nimport { BaseChipProps, ChipVariant, LegacyVariant } from './shared/types'\nimport { StyledChip } from './shared/ChipBase'\n\nexport interface ChipProps extends BaseChipProps {\n /**\n * Visual style. Only `default` stays in 3.0. `emphasis`, `subtle`, `interactive`, `light`\n * and `dark` are deprecated and will be removed (decision 0016).\n * @default 'default'\n */\n variant?: ChipVariant | LegacyVariant\n /**\n * Click handler.\n * @deprecated Removed in 3.0: the static Chip is not interactive. For a clickable action use a\n * Button; for a toggle use `BooleanChip` (`FilterChip` in 3.0).\n */\n onClick?: () => void\n /** Custom ARIA role override */\n role?: string\n /** Legacy title prop for backward compatibility */\n title?: string\n}\n\n/**\n * Chip - a static, non-interactive label for tags, categories and metadata.\n *\n * Chips are classified by job (decision 0016):\n * - Chip: a static label (`default` variant only)\n * - InputChip: a removable value, such as an applied filter (formerly `FilterChip`)\n * - BooleanChip: toggles a filter on and off (becomes `FilterChip` in 3.0)\n *\n * The `emphasis`, `subtle`, `interactive`, `light` and `dark` variants and `onClick` are\n * deprecated and will be removed in 3.0.\n */\nexport const Chip: React.FC<ChipProps> = ({\n children,\n variant = 'default',\n // Deprecated and ignored: chips have one size (decision 0035)\n size: _size,\n onClick,\n disabled = false,\n 'data-testid': dataTestId,\n 'aria-label': ariaLabel,\n 'aria-describedby': ariaDescribedBy,\n role,\n title,\n ...props\n}) => {\n const isClickable = Boolean(onClick && !disabled)\n \n // Map legacy variants to new variants\n const normalizedVariant: ChipVariant = \n variant === 'light' ? 'default' :\n variant === 'dark' ? 'emphasis' :\n variant as ChipVariant\n \n // Support legacy title prop\n const content = children !== undefined ? children : title\n \n const handleClick = () => {\n if (onClick && !disabled) {\n onClick()\n }\n }\n \n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (isClickable && (event.key === 'Enter' || event.key === ' ')) {\n event.preventDefault()\n handleClick()\n }\n }\n \n return (\n <StyledChip\n $variant={normalizedVariant}\n $disabled={disabled || undefined}\n $clickable={isClickable || undefined}\n onClick={isClickable ? handleClick : undefined}\n onKeyDown={handleKeyDown}\n tabIndex={isClickable ? 0 : undefined}\n role={role || (isClickable ? 'button' : undefined)}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedBy}\n aria-disabled={disabled ? 'true' : undefined}\n data-testid={dataTestId}\n {...props}\n >\n {content}\n </StyledChip>\n )\n}\n\n// Legacy component for backward compatibility\nexport interface LegacyChipProps {\n title: string\n variant?: LegacyVariant\n}\n\nexport const LegacyChip: React.FC<LegacyChipProps> = ({ title, variant = 'light' }) => {\n const newVariant = variant === 'dark' ? 'emphasis' : 'default'\n return <Chip variant={newVariant}>{title}</Chip>\n}\n"],"names":["Chip","_a","children","_b","variant","size","onClick","_c","disabled","dataTestId","ariaLabel","ariaDescribedBy","role","title","props","__rest","isClickable","Boolean","normalizedVariant","content","undefined","handleClick","handleKeyDown","event","key","preventDefault","_jsx","StyledChip","__assign","onKeyDown","tabIndex","LegacyChip","newVariant"],"mappings":";;;;;AAuBA;;;;;;;;;;AAUG;IACUA,IAAI,GAAwB,SAA5BA,IAAIA,CAAyBC,EAazC,EAAA;AAZC,EAAA,IAAAC,QAAQ,cAAA,CAAA;IACRC,EAAA,GAAAF,EAAA,CAAAG,OAAmB,CAAA;IAAnBA,OAAO,GAAAD,EAAA,KAAA,KAAA,CAAA,GAAG,SAAS,GAAAA,EAAA,CAAA;AACnB,IAAA;IACWF,EAAA,CAAAI,IAAA,CAAA;QACXC,OAAO,GAAAL,EAAA,CAAAK,OAAA,CAAA;IACPC,EAAA,GAAAN,EAAA,CAAAO,QAAgB,CAAA;IAAhBA,QAAQ,GAAGD,EAAA,KAAA,KAAA,CAAA,GAAA,KAAK,GAAAA,EAAA,CAAA;AACDE,IAAAA,UAAU,GAAAR,EAAA,CAAA,aAAA,CAAA,CAAA;AACXS,IA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AACxBQ,IAAAA,QAAQ,EAAEd,WAAW,GAAG,CAAC,GAAGI,SAAS;IACrCR,IAAI,EAAEA,IAAI,KAAKI,WAAW,GAAG,QAAQ,GAAGI,SAAS,CAAC;kBACtCV,SAAS;AAAA,IAAA,kBAAA,EACHC,eAAe;AAAA,IAAA,eAAA,EAClBH,QAAQ,GAAG,MAAM,GAAGY,SAAS;AAAA,IAAA,aAAA,EAC/BX,UAAAA;GACT,EAAAK,KAAK;cAERK,OAAAA;AAAO,GAAA,CAAA,CACG,CAAA;AAEjB,EAAC;IAQYY,UAAU,GAA8B,SAAxCA,UAAUA,CAA+B9B,EAA4B,EAAA;AAA1B,EAAA,IAAAY,KAAK,WAAA;IAAEV,EAAA,GAAAF,EAAA,CAAAG,OAAiB;IAAjBA,OAAO,GAAAD,EAAA,KAAA,KAAA,CAAA,GAAG,OAAO,GAAAA,EAAA,CAAA;EAC9E,IAAM6B,UAAU,GAAG5B,OAAO,KAAK,MAAM,GAAG,UAAU,GAAG,SAAS,CAAA;EAC9D,OAAOsB,GAAA,CAAC1B,IAAI,EAAC;AAAAI,IAAAA,OAAO,EAAE4B,UAAU;AAAA9B,IAAAA,QAAA,EAAGW,KAAAA;AAAK,GAAA,CAAQ,CAAA;AAClD;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type InputChipProps } from './InputChip.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Renamed to `InputChipProps`. In 3.0 `FilterChipProps` becomes the props of the toggle chip.
|
|
4
|
+
*/
|
|
5
|
+
export type FilterChipProps = InputChipProps;
|
|
6
|
+
/**
|
|
7
|
+
* FilterChip - a removable chip with an optional selected state.
|
|
8
|
+
*
|
|
9
|
+
* @deprecated Renamed to `InputChip`; in 3.0 `FilterChip` becomes the toggle chip (today's
|
|
10
|
+
* `BooleanChip`). Replace `FilterChip` with `InputChip` first, then `BooleanChip` with
|
|
11
|
+
* `FilterChip` when you upgrade to 3.0 (decision 0016).
|
|
12
|
+
*/
|
|
13
|
+
export declare const FilterChip: import("react").FC<InputChipProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { InputChip } from './InputChip.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* FilterChip - a removable chip with an optional selected state.
|
|
6
|
+
*
|
|
7
|
+
* @deprecated Renamed to `InputChip`; in 3.0 `FilterChip` becomes the toggle chip (today's
|
|
8
|
+
* `BooleanChip`). Replace `FilterChip` with `InputChip` first, then `BooleanChip` with
|
|
9
|
+
* `FilterChip` when you upgrade to 3.0 (decision 0016).
|
|
10
|
+
*/
|
|
11
|
+
var FilterChip = InputChip;
|
|
12
|
+
|
|
13
|
+
export { FilterChip };
|
|
14
|
+
//# sourceMappingURL=FilterChip.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterChip.mjs","sources":["../../../../src/components/atoms/Chip/FilterChip.tsx"],"sourcesContent":["import { InputChip, type InputChipProps } from './InputChip'\n\n/**\n * @deprecated Renamed to `InputChipProps`. In 3.0 `FilterChipProps` becomes the props of the toggle chip.\n */\nexport type FilterChipProps = InputChipProps\n\n/**\n * FilterChip - a removable chip with an optional selected state.\n *\n * @deprecated Renamed to `InputChip`; in 3.0 `FilterChip` becomes the toggle chip (today's\n * `BooleanChip`). Replace `FilterChip` with `InputChip` first, then `BooleanChip` with\n * `FilterChip` when you upgrade to 3.0 (decision 0016).\n */\nexport const FilterChip = InputChip\n"],"names":["FilterChip","InputChip"],"mappings":";;;AAOA;;;;;;AAMG;AACI,IAAMA,UAAU,GAAGC;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseChipProps } from './shared/types.mjs';
|
|
3
|
+
export interface InputChipProps extends BaseChipProps {
|
|
4
|
+
/** Whether the filter is in selected/applied state */
|
|
5
|
+
selected?: boolean;
|
|
6
|
+
/** Callback function when the chip is dismissed via close button or keyboard */
|
|
7
|
+
onDismiss?: () => void;
|
|
8
|
+
/** Custom ARIA role override */
|
|
9
|
+
role?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* InputChip - A removable value, such as an applied filter, with an optional selected state
|
|
13
|
+
*
|
|
14
|
+
* Use this component to show values the user has entered or applied, such as filters.
|
|
15
|
+
* When selected, displays a checkmark on the light-blue selected treatment (decision 0016).
|
|
16
|
+
* A selected disabled chip uses the disabled colours and keeps its checkmark.
|
|
17
|
+
* Optionally dismissible when onDismiss is provided.
|
|
18
|
+
*
|
|
19
|
+
* Features:
|
|
20
|
+
* - Shows checkmark icon when selected
|
|
21
|
+
* - Light-blue fill and blue text when selected and enabled; disabled colours when disabled
|
|
22
|
+
* - Optional close (×) button when onDismiss is provided
|
|
23
|
+
* - Keyboard dismissal with Delete or Backspace keys (when dismissible)
|
|
24
|
+
* - Non-clickable body (only close button is interactive when present)
|
|
25
|
+
* - Announces as "status" to screen readers
|
|
26
|
+
*/
|
|
27
|
+
export declare const InputChip: React.FC<InputChipProps>;
|
|
@@ -0,0 +1,97 @@
|
|
|
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, CloseButton } from './shared/ChipBase.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* InputChip - A removable value, such as an applied filter, with an optional selected state
|
|
9
|
+
*
|
|
10
|
+
* Use this component to show values the user has entered or applied, such as filters.
|
|
11
|
+
* When selected, displays a checkmark on the light-blue selected treatment (decision 0016).
|
|
12
|
+
* A selected disabled chip uses the disabled colours and keeps its checkmark.
|
|
13
|
+
* Optionally dismissible when onDismiss is provided.
|
|
14
|
+
*
|
|
15
|
+
* Features:
|
|
16
|
+
* - Shows checkmark icon when selected
|
|
17
|
+
* - Light-blue fill and blue text when selected and enabled; disabled colours when disabled
|
|
18
|
+
* - Optional close (×) button when onDismiss is provided
|
|
19
|
+
* - Keyboard dismissal with Delete or Backspace keys (when dismissible)
|
|
20
|
+
* - Non-clickable body (only close button is interactive when present)
|
|
21
|
+
* - Announces as "status" to screen readers
|
|
22
|
+
*/
|
|
23
|
+
var InputChip = function InputChip(_a) {
|
|
24
|
+
var children = _a.children,
|
|
25
|
+
_b = _a.selected,
|
|
26
|
+
selected = _b === void 0 ? false : _b,
|
|
27
|
+
onDismiss = _a.onDismiss;
|
|
28
|
+
// Deprecated and ignored: chips have one size (decision 0035)
|
|
29
|
+
_a.size;
|
|
30
|
+
var _c = _a.disabled,
|
|
31
|
+
disabled = _c === void 0 ? false : _c,
|
|
32
|
+
dataTestId = _a["data-testid"],
|
|
33
|
+
ariaLabel = _a["aria-label"],
|
|
34
|
+
ariaDescribedBy = _a["aria-describedby"],
|
|
35
|
+
role = _a.role,
|
|
36
|
+
props = __rest(_a, ["children", "selected", "onDismiss", "size", "disabled", 'data-testid', 'aria-label', 'aria-describedby', "role"]);
|
|
37
|
+
var isDismissible = Boolean(onDismiss);
|
|
38
|
+
var handleDismiss = function handleDismiss(event) {
|
|
39
|
+
event.stopPropagation(); // Prevent event bubbling
|
|
40
|
+
if (!disabled && onDismiss) {
|
|
41
|
+
onDismiss();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
45
|
+
// Handle dismiss with Delete or Backspace (only when dismissible)
|
|
46
|
+
if (!disabled && isDismissible && onDismiss && (event.key === 'Delete' || event.key === 'Backspace')) {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
onDismiss();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var handleCloseKeyDown = function handleCloseKeyDown(event) {
|
|
52
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
if (!disabled && onDismiss) onDismiss();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
// Generate accessible label for close button
|
|
58
|
+
var closeButtonLabel = typeof children === 'string' ? "Remove ".concat(children) : 'Remove filter';
|
|
59
|
+
return jsxs(StyledChip, __assign({
|
|
60
|
+
"$variant": "subtle",
|
|
61
|
+
"$disabled": disabled || undefined,
|
|
62
|
+
"$clickable": false,
|
|
63
|
+
"$selected": selected,
|
|
64
|
+
onKeyDown: handleKeyDown,
|
|
65
|
+
role: role || 'status',
|
|
66
|
+
"aria-label": ariaLabel,
|
|
67
|
+
"aria-describedby": ariaDescribedBy,
|
|
68
|
+
"aria-disabled": disabled ? 'true' : undefined,
|
|
69
|
+
"data-testid": dataTestId
|
|
70
|
+
}, props, {
|
|
71
|
+
children: [selected && jsx(IconContainer, {
|
|
72
|
+
"aria-hidden": "true",
|
|
73
|
+
children: jsx(Icon, {
|
|
74
|
+
name: "check",
|
|
75
|
+
size: "sm",
|
|
76
|
+
iconColor: "inherit"
|
|
77
|
+
})
|
|
78
|
+
}), children, isDismissible && jsx(CloseButton, {
|
|
79
|
+
type: "button",
|
|
80
|
+
onClick: handleDismiss,
|
|
81
|
+
onKeyDown: handleCloseKeyDown,
|
|
82
|
+
disabled: disabled,
|
|
83
|
+
"$disabled": disabled,
|
|
84
|
+
"aria-label": closeButtonLabel,
|
|
85
|
+
tabIndex: 0,
|
|
86
|
+
"data-testid": dataTestId ? "".concat(dataTestId, "-close") : undefined,
|
|
87
|
+
children: jsx(Icon, {
|
|
88
|
+
name: "close",
|
|
89
|
+
size: "sm",
|
|
90
|
+
iconColor: "inherit"
|
|
91
|
+
})
|
|
92
|
+
})]
|
|
93
|
+
}));
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export { InputChip };
|
|
97
|
+
//# sourceMappingURL=InputChip.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputChip.mjs","sources":["../../../../src/components/atoms/Chip/InputChip.tsx"],"sourcesContent":["import React from 'react'\nimport { Icon } from '../Icon'\nimport { BaseChipProps } from './shared/types'\nimport { StyledChip, IconContainer, CloseButton } from './shared/ChipBase'\n\nexport interface InputChipProps extends BaseChipProps {\n /** Whether the filter is in selected/applied state */\n selected?: boolean\n /** Callback function when the chip is dismissed via close button or keyboard */\n onDismiss?: () => void\n /** Custom ARIA role override */\n role?: string\n}\n\n/**\n * InputChip - A removable value, such as an applied filter, with an optional selected state\n * \n * Use this component to show values the user has entered or applied, such as filters.\n * When selected, displays a checkmark on the light-blue selected treatment (decision 0016).\n * A selected disabled chip uses the disabled colours and keeps its checkmark.\n * Optionally dismissible when onDismiss is provided.\n * \n * Features:\n * - Shows checkmark icon when selected\n * - Light-blue fill and blue text when selected and enabled; disabled colours when disabled\n * - Optional close (×) button when onDismiss is provided\n * - Keyboard dismissal with Delete or Backspace keys (when dismissible)\n * - Non-clickable body (only close button is interactive when present)\n * - Announces as \"status\" to screen readers\n */\nexport const InputChip: React.FC<InputChipProps> = ({\n children,\n selected = false,\n onDismiss,\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 role,\n ...props\n}) => {\n const isDismissible = Boolean(onDismiss)\n \n const handleDismiss = (event: React.MouseEvent) => {\n event.stopPropagation() // Prevent event bubbling\n if (!disabled && onDismiss) {\n onDismiss()\n }\n }\n \n const handleKeyDown = (event: React.KeyboardEvent) => {\n // Handle dismiss with Delete or Backspace (only when dismissible)\n if (!disabled && isDismissible && onDismiss && (event.key === 'Delete' || event.key === 'Backspace')) {\n event.preventDefault()\n onDismiss()\n }\n }\n \n const handleCloseKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n if (!disabled && onDismiss) onDismiss()\n }\n }\n \n // Generate accessible label for close button\n const closeButtonLabel = typeof children === 'string' ? `Remove ${children}` : 'Remove filter'\n \n return (\n <StyledChip\n $variant=\"subtle\"\n $disabled={disabled || undefined}\n $clickable={false}\n $selected={selected}\n onKeyDown={handleKeyDown}\n role={role || 'status'}\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 \n {/* Show close button only when dismissible */}\n {isDismissible && (\n <CloseButton\n type=\"button\"\n onClick={handleDismiss}\n onKeyDown={handleCloseKeyDown}\n disabled={disabled}\n $disabled={disabled}\n aria-label={closeButtonLabel}\n tabIndex={0}\n data-testid={dataTestId ? `${dataTestId}-close` : undefined}\n >\n <Icon name=\"close\" size=\"sm\" iconColor=\"inherit\" />\n </CloseButton>\n )}\n </StyledChip>\n )\n}\n"],"names":["InputChip","_a","children","_b","selected","onDismiss","size","_c","disabled","dataTestId","ariaLabel","ariaDescribedBy","role","props","__rest","isDismissible","Boolean","handleDismiss","event","stopPropagation","handleKeyDown","key","preventDefault","handleCloseKeyDown","closeButtonLabel","concat","_jsxs","StyledChip","__assign","undefined","onKeyDown","_jsx","IconContainer","Icon","name","iconColor","CloseButton","type","onClick","tabIndex"],"mappings":";;;;;;AAcA;;;;;;;;;;;;;;;AAeG;IACUA,SAAS,GAA6B,SAAtCA,SAASA,CAA8BC,EAYnD,EAAA;AAXC,EAAA,IAAAC,QAAQ,GAAAD,EAAA,CAAAC,QAAA,CAAA;IACRC,EAAgB,GAAAF,EAAA,CAAAG,QAAA,CAAA;IAAhBA,QAAQ,GAAAD,EAAA,KAAA,KAAA,CAAA,GAAG,KAAK,GAAAA,EAAA,CAAA;IAChBE,SAAS,GAAAJ,EAAA,CAAAI,SAAA,CAAA;AACT,IAAA;IACWJ,EAAA,CAAAK,IAAA,CAAA;QACXC,EAAA,GAAAN,EAAA,CAAAO,QAAgB,CAAA;IAAhBA,QAAQ,mBAAG,KAAK,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