@common-origin/design-system 2.19.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 +169 -169
- 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/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 +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/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.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 +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 -1466
- package/dist/styles/icons.json.mjs.map +1 -0
- package/dist/styles/tokens.d.mts +3174 -0
- package/dist/styles/tokens.json.mjs +1454 -0
- package/dist/{tokens/index.esm.js.map → styles/tokens.json.mjs.map} +1 -1
- package/dist/tokens/{index.esm.js → index.mjs} +1 -1
- package/dist/tokens/index.mjs.map +1 -0
- package/dist/tokens/styles/tokens.d.mts +3174 -0
- package/dist/tokens/tokens.d.mts +4 -0
- package/dist/tokens/types/tokens.d.mts +6 -0
- 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.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,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,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AAA,EAAAV,iBAAiB;iBAChBV,QAAQ,IAAIY,SAAS;IAAA,YAAA,EACpBJ,WAAW,IAAII,SAAS;AACpCd,IAAAA,OAAO,EAAEU,WAAW,GAAGK,WAAW,GAAGD,SAAS;AAC9CS,IAAAA,SAAS,EAAEP,aAAa;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,G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C7Bf,MAAAA,QAAQ,EAAEA,QAAQ;AAAA,MAAA,WAAA,EACPA,QAAQ;AAAA,MAAA,YAAA,EACPgB,gBAAgB;AAC5Be,MAAAA,QAAQ,EAAE,CAAC;AACE,MAAA,aAAA,EAAA9B,UAAU,GAAG,EAAA,CAAAgB,MAAA,CAAGhB,UAAU,EAAA,QAAA,CAAQ,GAAGoB,SAAS;AAE3D3B,MAAAA,QAAA,EAAA6B,GAAA,CAACE,IAAI,EAAC;AAAAC,QAAAA,IAAI,EAAC,OAAO;AAAC5B,QAAAA,IAAI,EAAC,IAAI;AAAC6B,QAAAA,SAAS,EAAC,SAAA;OAAY,CAAA;AAAA,KAAA,CAEtD,CAAA;AAAA,GAAA,CAAA,CACU,CAAA;AAEjB;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InternalStyledProps } from './types.mjs';
|
|
2
|
+
export declare const StyledChip: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components/dist/types.js").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
|
|
3
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types.js").CSSPropertiesWithVars | undefined;
|
|
4
|
+
}, InternalStyledProps>> & string;
|
|
5
|
+
export declare const IconContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
|
|
6
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types.js").CSSPropertiesWithVars | undefined;
|
|
7
|
+
}> & string;
|
|
8
|
+
export declare const CloseButton: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components/dist/types.js").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
|
|
9
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types.js").CSSPropertiesWithVars | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
$disabled?: boolean;
|
|
12
|
+
}>> & string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject } from '../../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import styled$module from 'styled-components';
|
|
4
|
+
const styled = styled$module.default || styled$module;
|
|
5
|
+
import tokens from '../../../../lib/cssTokens.mjs';
|
|
6
|
+
import { getVariantStyles, sizeStyles } from './utils.mjs';
|
|
7
|
+
import { forcedColorsEdge, forcedColors } from '../../../../lib/styleUtils.mjs';
|
|
8
|
+
|
|
9
|
+
var chip = tokens.component.chip,
|
|
10
|
+
semantic = tokens.semantic;
|
|
11
|
+
// Base styled component using direct prop interpolation like Button
|
|
12
|
+
var StyledChip = /*#__PURE__*/styled.span.withConfig({
|
|
13
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
14
|
+
return !prop.startsWith('$');
|
|
15
|
+
},
|
|
16
|
+
displayName: "ChipBase__StyledChip",
|
|
17
|
+
componentId: "sc-moa6zc-0"
|
|
18
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n height: max-content;\n border-radius: ", ";\n box-sizing: border-box;\n user-select: none;\n white-space: nowrap;\n transition: ", ";\n cursor: ", ";\n \n /* Forced colours: an edge, and GrayText when disabled, since a span gets no system disabled\n colour (decision 0038). Before the variant styles, so a selected chip's Highlight border wins. */\n ", "\n ", "\n\n ", "\n ", "\n \n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n height: max-content;\n border-radius: ", ";\n box-sizing: border-box;\n user-select: none;\n white-space: nowrap;\n transition: ", ";\n cursor: ", ";\n \n /* Forced colours: an edge, and GrayText when disabled, since a span gets no system disabled\n colour (decision 0038). Before the variant styles, so a selected chip's Highlight border wins. */\n ", "\n ", "\n\n ", "\n ", "\n \n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n\n"
|
|
19
|
+
// Icon container for selected indicator or leading icons
|
|
20
|
+
])), chip["default"].borderRadius, semantic.motion.transition.feedback, function (props) {
|
|
21
|
+
return props.$disabled ? 'not-allowed' : props.$clickable ? 'pointer' : 'default';
|
|
22
|
+
}, forcedColorsEdge, function (props) {
|
|
23
|
+
return props.$disabled ? "".concat(forcedColors, " { color: GrayText; }") : '';
|
|
24
|
+
}, getVariantStyles, sizeStyles, chip.focus.outline, semantic.border.focusOffset);
|
|
25
|
+
// Icon container for selected indicator or leading icons
|
|
26
|
+
var IconContainer = /*#__PURE__*/styled.span.withConfig({
|
|
27
|
+
displayName: "ChipBase__IconContainer",
|
|
28
|
+
componentId: "sc-moa6zc-1"
|
|
29
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n margin-right: ", ";\n"], ["\n display: inline-flex;\n align-items: center;\n margin-right: ", ";\n"
|
|
30
|
+
// Close button for dismissible chips
|
|
31
|
+
])), tokens.semantic.space[100]);
|
|
32
|
+
// Close button for dismissible chips
|
|
33
|
+
var CloseButton = /*#__PURE__*/styled.button.withConfig({
|
|
34
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
35
|
+
return !prop.startsWith('$');
|
|
36
|
+
},
|
|
37
|
+
displayName: "ChipBase__CloseButton",
|
|
38
|
+
componentId: "sc-moa6zc-2"
|
|
39
|
+
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n margin-left: ", ";\n background: transparent;\n border: none;\n position: relative;\n width: ", ";\n height: ", ";\n padding: ", ";\n\n /* The pointer target is at least 24 \xD7 24px (WCAG 2.5.8, decision 0039): an invisible hit area\n as tall as the chip, centred on the 20px button. It stays inside the chip and its padding, so\n it can't overlap another target. */\n &::before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: ", ";\n height: ", ";\n transform: translate(-50%, -50%);\n }\n border-radius: ", ";\n cursor: ", ";\n color: inherit;\n transition: ", ";\n \n &:hover:not(:disabled) {\n background-color: ", ";\n }\n \n &:active:not(:disabled) {\n background-color: ", ";\n }\n \n &:disabled {\n color: ", ";\n }\n \n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n border-radius: ", ";\n }\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n margin-left: ", ";\n background: transparent;\n border: none;\n position: relative;\n width: ", ";\n height: ", ";\n padding: ", ";\n\n /* The pointer target is at least 24 \xD7 24px (WCAG 2.5.8, decision 0039): an invisible hit area\n as tall as the chip, centred on the 20px button. It stays inside the chip and its padding, so\n it can't overlap another target. */\n &::before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: ", ";\n height: ", ";\n transform: translate(-50%, -50%);\n }\n border-radius: ", ";\n cursor: ", ";\n color: inherit;\n transition: ", ";\n \n &:hover:not(:disabled) {\n background-color: ", ";\n }\n \n &:active:not(:disabled) {\n background-color: ", ";\n }\n \n &:disabled {\n color: ", ";\n }\n \n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n border-radius: ", ";\n }\n"])), tokens.semantic.space[200], chip.closeButton.size, chip.closeButton.size, tokens.semantic.space[0], semantic.size.label.medium, semantic.size.label.medium, tokens.semantic.radius.xs, function (props) {
|
|
40
|
+
return props.$disabled ? 'not-allowed' : 'pointer';
|
|
41
|
+
}, semantic.motion.transition.feedback, tokens.semantic.color.fill['none-hover'], tokens.semantic.color.fill['none-pressed'], tokens.semantic.color.text.disabled, chip.focus.outline, semantic.border.focusOffset, chip["default"].borderRadius);
|
|
42
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
43
|
+
|
|
44
|
+
export { CloseButton, IconContainer, StyledChip };
|
|
45
|
+
//# sourceMappingURL=ChipBase.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChipBase.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface BaseChipProps {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Ignored, and removed in 3.0. Chips have one size, 24px (decision 0035).
|
|
6
|
+
*/
|
|
7
|
+
size?: 'small' | 'medium';
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
'data-testid'?: string;
|
|
10
|
+
'aria-label'?: string;
|
|
11
|
+
'aria-describedby'?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Visual variants for the static Chip. Only `default` stays in 3.0 (decision 0016):
|
|
15
|
+
* chips are classified by job, not emphasis.
|
|
16
|
+
*/
|
|
17
|
+
export type ChipVariant = 'default'
|
|
18
|
+
/** @deprecated Removed in 3.0. Chips have no emphasis levels; use `default`. */
|
|
19
|
+
| 'emphasis'
|
|
20
|
+
/** @deprecated Removed in 3.0. Use `default`. */
|
|
21
|
+
| 'subtle'
|
|
22
|
+
/** @deprecated Removed in 3.0. For a clickable action use a Button; for a toggle use `BooleanChip` (`FilterChip` in 3.0). */
|
|
23
|
+
| 'interactive';
|
|
24
|
+
export interface InternalStyledProps {
|
|
25
|
+
$variant: ChipVariant;
|
|
26
|
+
$disabled?: boolean;
|
|
27
|
+
$clickable?: boolean;
|
|
28
|
+
$selected?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Legacy Chip variants.
|
|
32
|
+
* @deprecated Removed in 3.0. `light` is the same as `default`; `dark` maps to the deprecated `emphasis`. Use `default`.
|
|
33
|
+
*/
|
|
34
|
+
export type LegacyVariant = 'light' | 'dark';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChipVariant } from './types.mjs';
|
|
2
|
+
interface StyledChipProps {
|
|
3
|
+
$variant: ChipVariant;
|
|
4
|
+
$disabled?: boolean;
|
|
5
|
+
$clickable?: boolean;
|
|
6
|
+
$selected?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const getVariantStyles: ({ $variant, $selected, $clickable, $disabled }: StyledChipProps) => string;
|
|
9
|
+
export declare const sizeStyles: string;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import tokens from '../../../../lib/cssTokens.mjs';
|
|
3
|
+
import { forcedColors } from '../../../../lib/styleUtils.mjs';
|
|
4
|
+
|
|
5
|
+
var chip = tokens.component.chip,
|
|
6
|
+
semantic = tokens.semantic;
|
|
7
|
+
// Helper function to get variant styles matching Button's approach
|
|
8
|
+
var getVariantStyles = function getVariantStyles(_a) {
|
|
9
|
+
var $variant = _a.$variant,
|
|
10
|
+
$selected = _a.$selected,
|
|
11
|
+
$clickable = _a.$clickable,
|
|
12
|
+
$disabled = _a.$disabled;
|
|
13
|
+
// Selected filter and input chips use the light-blue selected treatment (decision 0016).
|
|
14
|
+
// The text darkens with the fill so every state stays at least 4.5:1.
|
|
15
|
+
if ($selected) {
|
|
16
|
+
// A selected disabled chip looks like any disabled chip; the checkmark keeps the
|
|
17
|
+
// selected state visible (#110)
|
|
18
|
+
if ($disabled) {
|
|
19
|
+
var disabled = chip.variants.subtle.disabled;
|
|
20
|
+
return "\n background-color: ".concat(disabled.backgroundColor, ";\n color: ").concat(disabled.textColor, ";\n ");
|
|
21
|
+
}
|
|
22
|
+
var _b = tokens.semantic.color,
|
|
23
|
+
fill = _b.fill,
|
|
24
|
+
text = _b.text;
|
|
25
|
+
var interactiveStates = $clickable;
|
|
26
|
+
return "\n background-color: ".concat(fill['accent-muted'], ";\n color: ").concat(text.accent, ";\n \n &:hover {\n background-color: ").concat(interactiveStates ? fill['accent-muted-hover'] : fill['accent-muted'], ";\n color: ").concat(interactiveStates ? text['accent-hover'] : text.accent, ";\n }\n \n &:active {\n background-color: ").concat(interactiveStates ? fill['accent-muted-pressed'] : fill['accent-muted'], ";\n color: ").concat(interactiveStates ? text['accent-pressed'] : text.accent, ";\n }\n\n /* Forced colours drop the fill, so a selected chip takes the system selection colours\n (decision 0038); its checkmark follows the text colour */\n ").concat(forcedColors, " {\n forced-color-adjust: none;\n background-color: Highlight;\n border-color: Highlight;\n color: HighlightText;\n }\n ");
|
|
27
|
+
}
|
|
28
|
+
switch ($variant) {
|
|
29
|
+
case 'emphasis':
|
|
30
|
+
return "\n background-color: ".concat(chip.variants.emphasis.backgroundColor, ";\n color: ").concat(chip.variants.emphasis.textColor, ";\n \n &:hover {\n background-color: ").concat($disabled ? chip.variants.emphasis.disabled.backgroundColor : $clickable ? chip.variants.emphasis.hover.backgroundColor : chip.variants.emphasis.backgroundColor, ";\n }\n \n &:active {\n background-color: ").concat($disabled ? chip.variants.emphasis.disabled.backgroundColor : $clickable ? chip.variants.emphasis.active.backgroundColor : chip.variants.emphasis.backgroundColor, ";\n }\n \n ").concat($disabled ? "\n background-color: ".concat(chip.variants.emphasis.disabled.backgroundColor, ";\n color: ").concat(chip.variants.emphasis.disabled.textColor, ";\n ") : '', "\n ");
|
|
31
|
+
case 'subtle':
|
|
32
|
+
return "\n background-color: ".concat(chip.variants.subtle.backgroundColor, ";\n color: ").concat(chip.variants.subtle.textColor, ";\n \n &:hover {\n background-color: ").concat($disabled ? chip.variants.subtle.disabled.backgroundColor : $clickable ? chip.variants.subtle.hover.backgroundColor : chip.variants.subtle.backgroundColor, ";\n }\n \n &:active {\n background-color: ").concat($disabled ? chip.variants.subtle.disabled.backgroundColor : $clickable ? chip.variants.subtle.active.backgroundColor : chip.variants.subtle.backgroundColor, ";\n }\n \n ").concat($disabled ? "\n background-color: ".concat(chip.variants.subtle.disabled.backgroundColor, ";\n color: ").concat(chip.variants.subtle.disabled.textColor, ";\n ") : '', "\n ");
|
|
33
|
+
case 'interactive':
|
|
34
|
+
return "\n background-color: ".concat(chip.variants.interactive.backgroundColor, ";\n color: ").concat(chip.variants.interactive.textColor, ";\n \n &:hover {\n background-color: ").concat($disabled ? chip.variants.interactive.disabled.backgroundColor : $clickable ? chip.variants.interactive.hover.backgroundColor : chip.variants.interactive.backgroundColor, ";\n }\n \n &:active {\n background-color: ").concat($disabled ? chip.variants.interactive.disabled.backgroundColor : $clickable ? chip.variants.interactive.active.backgroundColor : chip.variants.interactive.backgroundColor, ";\n }\n \n ").concat($disabled ? "\n background-color: ".concat(chip.variants.interactive.disabled.backgroundColor, ";\n color: ").concat(chip.variants.interactive.disabled.textColor, ";\n ") : '', "\n ");
|
|
35
|
+
case 'default':
|
|
36
|
+
default:
|
|
37
|
+
return "\n background-color: ".concat(chip["default"].backgroundColor, ";\n color: ").concat(chip["default"].textColor, ";\n \n &:hover {\n background-color: ").concat($disabled ? chip.disabled.backgroundColor : $clickable ? chip.hover.backgroundColor : chip["default"].backgroundColor, ";\n }\n \n &:active {\n background-color: ").concat($disabled ? chip.disabled.backgroundColor : $clickable ? chip.active.backgroundColor : chip["default"].backgroundColor, ";\n }\n \n ").concat($disabled ? "\n background-color: ".concat(chip.disabled.backgroundColor, ";\n color: ").concat(chip.disabled.textColor, ";\n ") : '', "\n ");
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
// Chips have one size: 24px from the label scale as a minimum, with the content centred
|
|
41
|
+
// and no vertical padding (decisions 0034 and 0035). Horizontal padding comes from the
|
|
42
|
+
// semantic spacing scale (decision 0022).
|
|
43
|
+
var sizeStyles = "\n font: ".concat(chip.sizes.medium.font, ";\n min-height: ").concat(semantic.size.label.medium, ";\n padding: 0 ").concat(semantic.space.inset.sm, ";\n");
|
|
44
|
+
|
|
45
|
+
export { getVariantStyles, sizeStyles };
|
|
46
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../../../../src/components/atoms/Chip/shared/utils.ts"],"sourcesContent":["import tokens from '../../../../lib/cssTokens'\nimport { forcedColors } from '../../../../lib/styleUtils'\nimport { ChipVariant } from './types'\n\nconst { component: { chip }, semantic } = tokens\n\ninterface StyledChipProps {\n $variant: ChipVariant\n $disabled?: boolean\n $clickable?: boolean\n $selected?: boolean\n}\n\n// Helper function to get variant styles matching Button's approach\nexport const getVariantStyles = ({ $variant, $selected, $clickable, $disabled }: StyledChipProps) => {\n // Selected filter and input chips use the light-blue selected treatment (decision 0016).\n // The text darkens with the fill so every state stays at least 4.5:1.\n if ($selected) {\n // A selected disabled chip looks like any disabled chip; the checkmark keeps the\n // selected state visible (#110)\n if ($disabled) {\n const { disabled } = chip.variants.subtle\n return `\n background-color: ${disabled.backgroundColor};\n color: ${disabled.textColor};\n `\n }\n\n const { fill, text } = tokens.semantic.color\n const interactiveStates = $clickable\n return `\n background-color: ${fill['accent-muted']};\n color: ${text.accent};\n \n &:hover {\n background-color: ${interactiveStates ? fill['accent-muted-hover'] : fill['accent-muted']};\n color: ${interactiveStates ? text['accent-hover'] : text.accent};\n }\n \n &:active {\n background-color: ${interactiveStates ? fill['accent-muted-pressed'] : fill['accent-muted']};\n color: ${interactiveStates ? text['accent-pressed'] : text.accent};\n }\n\n /* Forced colours drop the fill, so a selected chip takes the system selection colours\n (decision 0038); its checkmark follows the text colour */\n ${forcedColors} {\n forced-color-adjust: none;\n background-color: Highlight;\n border-color: Highlight;\n color: HighlightText;\n }\n `\n }\n \n switch ($variant) {\n case 'emphasis':\n return `\n background-color: ${chip.variants.emphasis.backgroundColor};\n color: ${chip.variants.emphasis.textColor};\n \n &:hover {\n background-color: ${$disabled ? chip.variants.emphasis.disabled.backgroundColor : ($clickable ? chip.variants.emphasis.hover.backgroundColor : chip.variants.emphasis.backgroundColor)};\n }\n \n &:active {\n background-color: ${$disabled ? chip.variants.emphasis.disabled.backgroundColor : ($clickable ? chip.variants.emphasis.active.backgroundColor : chip.variants.emphasis.backgroundColor)};\n }\n \n ${$disabled ? `\n background-color: ${chip.variants.emphasis.disabled.backgroundColor};\n color: ${chip.variants.emphasis.disabled.textColor};\n ` : ''}\n `\n case 'subtle':\n return `\n background-color: ${chip.variants.subtle.backgroundColor};\n color: ${chip.variants.subtle.textColor};\n \n &:hover {\n background-color: ${$disabled ? chip.variants.subtle.disabled.backgroundColor : ($clickable ? chip.variants.subtle.hover.backgroundColor : chip.variants.subtle.backgroundColor)};\n }\n \n &:active {\n background-color: ${$disabled ? chip.variants.subtle.disabled.backgroundColor : ($clickable ? chip.variants.subtle.active.backgroundColor : chip.variants.subtle.backgroundColor)};\n }\n \n ${$disabled ? `\n background-color: ${chip.variants.subtle.disabled.backgroundColor};\n color: ${chip.variants.subtle.disabled.textColor};\n ` : ''}\n `\n case 'interactive':\n return `\n background-color: ${chip.variants.interactive.backgroundColor};\n color: ${chip.variants.interactive.textColor};\n \n &:hover {\n background-color: ${$disabled ? chip.variants.interactive.disabled.backgroundColor : ($clickable ? chip.variants.interactive.hover.backgroundColor : chip.variants.interactive.backgroundColor)};\n }\n \n &:active {\n background-color: ${$disabled ? chip.variants.interactive.disabled.backgroundColor : ($clickable ? chip.variants.interactive.active.backgroundColor : chip.variants.interactive.backgroundColor)};\n }\n \n ${$disabled ? `\n background-color: ${chip.variants.interactive.disabled.backgroundColor};\n color: ${chip.variants.interactive.disabled.textColor};\n ` : ''}\n `\n case 'default':\n default:\n return `\n background-color: ${chip.default.backgroundColor};\n color: ${chip.default.textColor};\n \n &:hover {\n background-color: ${$disabled ? chip.disabled.backgroundColor : ($clickable ? chip.hover.backgroundColor : chip.default.backgroundColor)};\n }\n \n &:active {\n background-color: ${$disabled ? chip.disabled.backgroundColor : ($clickable ? chip.active.backgroundColor : chip.default.backgroundColor)};\n }\n \n ${$disabled ? `\n background-color: ${chip.disabled.backgroundColor};\n color: ${chip.disabled.textColor};\n ` : ''}\n `\n }\n}\n\n// Chips have one size: 24px from the label scale as a minimum, with the content centred\n// and no vertical padding (decisions 0034 and 0035). Horizontal padding comes from the\n// semantic spacing scale (decision 0022).\nexport const sizeStyles = `\n font: ${chip.sizes.medium.font};\n min-height: ${semantic.size.label.medium};\n padding: 0 ${semantic.space.inset.sm};\n`\n\n"],"names":["chip","tokens","component","semantic","getVariantStyles","_a","$variant","$selected","$clickable","$disabled","disabled","variants","subtle","concat","backgroundColor","textColor","_b","color","fill","text","interactiveStates","accent","forcedColors","emphasis","hover","active","interactive","sizeStyles","sizes","medium","font","size","label","space","inset","sm"],"mappings":";;;;AAIqB,IAAAA,IAAI,GAAiBC,MAAM,CAAAC,SAAA,CAAAF,IAAvB;EAAIG,QAAQ,GAAKF,MAAM,CAAAE,QAAX,CAAA;AASrC;IACaC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,EAA+D,EAAA;MAA7DC,QAAQ,GAAAD,EAAA,CAAAC,QAAA;IAAEC,SAAS,GAAAF,EAAA,CAAAE,SAAA;IAAEC,UAAU,GAAAH,EAAA,CAAAG,UAAA;IAAEC,SAAS,GAAAJ,EAAA,CAAAI,SAAA,CAAA;AAC3E;AACA;AACA,EAAA,IAAIF,SAAS,EAAE;AACb;AACA;AACA,IAAA,IAAIE,SAAS,EAAE;MACL,IAAAC,QAAQ,GAAKV,IAAI,CAACW,QAAQ,CAACC,MAAM,SAAzB,CAAA;AAChB,MAAA,OAAO,8BAAA,CAAAC,MAAA,CACeH,QAAQ,CAACI,eAAe,+BACnCJ,QAAQ,CAACK,SAAS,EAAA,WAAA,CAC5B,CAAA;AACH,KAAA;AAEM,IAAA,IAAAC,EAAiB,GAAAf,MAAM,CAACE,QAAQ,CAACc,KAAK;MAApCC,IAAI,GAAAF,EAAA,CAAAE,IAAA;MAAEC,IAAI,GAAAH,EAAA,CAAAG,IAA0B,CAAA;IAC5C,IAAMC,iBAAiB,GAAGZ,UAAU,CAAA;IACpC,OAAO,4BACe,CAAAK,MAAA,CAAAK,IAAI,CAAC,cAAc,CAAC,EAC/B,kBAAA,CAAA,CAAAL,MAAA,CAAAM,IAAI,CAACE,MAAM,mEAGED,iBAAiB,GAAGF,IAAI,CAAC,oBAAoB,CAAC,GAAGA,IAAI,CAAC,cAAc,CAAC,EAChF,oBAAA,CAAA,CAAAL,MAAA,CAAAO,iBAAiB,GAA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AAe,GAAIN,UAAU,GAAGR,IAAI,CAACyB,MAAM,CAACX,eAAe,GAAGd,IAAI,CAAA,SAAA,CAAQ,CAACc,eAAgB,EAGzI,kCAAA,CAAA,CAAAD,MAAA,CAAAJ,SAAS,GAAG,wCACQT,IAAI,CAACU,QAAQ,CAACI,eAAe,EAAA,sBAAA,CAAA,CAAAD,MAAA,CACxCb,IAAI,CAACU,QAAQ,CAACK,SAAS,EAAA,aAAA,CACjC,GAAG,EAAE,EAAA,UAAA,CACP,CAAA;AACL,GAAA;AACF,EAAC;AAED;AACA;AACA;IACaY,UAAU,GAAG,YAChB,CAAAd,MAAA,CAAAb,IAAI,CAAC4B,KAAK,CAACC,MAAM,CAACC,IAAI,EAChB,mBAAA,CAAA,CAAAjB,MAAA,CAAAV,QAAQ,CAAC4B,IAAI,CAACC,KAAK,CAACH,MAAM,EAC3B,kBAAA,CAAA,CAAAhB,MAAA,CAAAV,QAAQ,CAAC8B,KAAK,CAACC,KAAK,CAACC,EAAE;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type ContainerProps = {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
'data-testid'?: string;
|
|
5
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
6
|
+
export declare const Container: ({ children, ...props }: ContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject, __rest, __assign } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import styled$module from 'styled-components';
|
|
5
|
+
const styled = styled$module.default || styled$module;
|
|
6
|
+
import { media, breakpoints } from '../../../lib/styleUtils.mjs';
|
|
7
|
+
import tokens from '../../../lib/cssTokens.mjs';
|
|
8
|
+
|
|
9
|
+
var space = tokens.semantic.space;
|
|
10
|
+
var StyledContainer = /*#__PURE__*/styled.div.withConfig({
|
|
11
|
+
displayName: "Container__StyledContainer",
|
|
12
|
+
componentId: "sc-17dbj6n-0"
|
|
13
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n margin-left: auto;\n margin-right: auto;\n padding-left: ", ";\n padding-right: ", ";\n \n ", " {\n max-width: ", ";\n }\n \n ", " {\n max-width: ", ";\n }\n \n ", " {\n max-width: ", ";\n }\n \n ", " {\n max-width: ", ";\n }\n \n ", " {\n max-width: ", ";\n }\n"], ["\n width: 100%;\n margin-left: auto;\n margin-right: auto;\n padding-left: ", ";\n padding-right: ", ";\n \n ", " {\n max-width: ", ";\n }\n \n ", " {\n max-width: ", ";\n }\n \n ", " {\n max-width: ", ";\n }\n \n ", " {\n max-width: ", ";\n }\n \n ", " {\n max-width: ", ";\n }\n"])), space[600], space[600], media.sm, breakpoints.sm, media.md, breakpoints.md, media.lg, breakpoints.lg, media.xl, breakpoints.xl, media['2xl'], breakpoints['2xl']);
|
|
14
|
+
var Container = function Container(_a) {
|
|
15
|
+
var children = _a.children,
|
|
16
|
+
props = __rest(_a, ["children"]);
|
|
17
|
+
return jsx(StyledContainer, __assign({}, props, {
|
|
18
|
+
children: children
|
|
19
|
+
}));
|
|
20
|
+
};
|
|
21
|
+
var templateObject_1;
|
|
22
|
+
|
|
23
|
+
export { Container };
|
|
24
|
+
//# sourceMappingURL=Container.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Container.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Container.mjs';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* How DateFormatter shows a date. `'relative'` is deprecated: it has always behaved exactly like
|
|
4
|
+
* `'smart'`, so use `'smart'`. It keeps working until it is removed in 3.0 (#82).
|
|
5
|
+
*/
|
|
6
|
+
export type DateFormatMode = 'absolute' | 'relative' | 'smart';
|
|
7
|
+
export interface DateFormatterProps {
|
|
8
|
+
/** ISO date string to format */
|
|
9
|
+
dateString: string;
|
|
10
|
+
/** Format pattern (defaults to 'yyyy') */
|
|
11
|
+
formatString?: string;
|
|
12
|
+
/**
|
|
13
|
+
* `'absolute'` always uses `formatString`. `'smart'` shows "Today", "Yesterday" or the day name
|
|
14
|
+
* for dates this week, and formats older dates with `formatString`.
|
|
15
|
+
* `'relative'` is deprecated: it behaves exactly like `'smart'`, so use `'smart'`. It keeps
|
|
16
|
+
* working until it is removed in 3.0 (#82).
|
|
17
|
+
* @default 'absolute'
|
|
18
|
+
*/
|
|
19
|
+
mode?: DateFormatMode;
|
|
20
|
+
/** Optional data-testid for testing */
|
|
21
|
+
'data-testid'?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const DateFormatter: React.FC<DateFormatterProps>;
|