@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,282 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { useState, useRef, useId, useEffect } from 'react';
|
|
5
|
+
import styled$module from 'styled-components';
|
|
6
|
+
const styled = styled$module.default || styled$module;
|
|
7
|
+
import tokens from '../../../lib/cssTokens.mjs';
|
|
8
|
+
import { Icon } from '../../atoms/Icon/Icon.mjs';
|
|
9
|
+
import { Typography } from '../../atoms/Typography/Typography.mjs';
|
|
10
|
+
import { reducedMotion, interactiveRow } from '../../../lib/styleUtils.mjs';
|
|
11
|
+
|
|
12
|
+
var _a = tokens.semantic,
|
|
13
|
+
border = _a.border,
|
|
14
|
+
elevation = _a.elevation,
|
|
15
|
+
motion = _a.motion,
|
|
16
|
+
space = _a.space,
|
|
17
|
+
_b = tokens.component,
|
|
18
|
+
input = _b.input,
|
|
19
|
+
field = _b.field;
|
|
20
|
+
// Spacing comes from the semantic scales: no component spacing tokens (decision 0022).
|
|
21
|
+
// The trigger and options take their height from size.control.lg as a minimum and centre
|
|
22
|
+
// their content (decision 0034). The small vertical padding only matters when a long
|
|
23
|
+
// label wraps; a single line is shorter than the minimum.
|
|
24
|
+
var controlPaddingX = tokens.semantic.space.inset.lg;
|
|
25
|
+
var controlPaddingY = space[200];
|
|
26
|
+
var controlHeight = tokens.semantic.size.control.lg;
|
|
27
|
+
var duration = motion.duration,
|
|
28
|
+
easing = motion.easing;
|
|
29
|
+
var DropdownContainer = /*#__PURE__*/styled.div.withConfig({
|
|
30
|
+
displayName: "Dropdown__DropdownContainer",
|
|
31
|
+
componentId: "sc-kz07c4-0"
|
|
32
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n width: 100%;\n"], ["\n position: relative;\n width: 100%;\n"])));
|
|
33
|
+
var DropdownTrigger = /*#__PURE__*/styled.button.withConfig({
|
|
34
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
35
|
+
return !prop.startsWith('$');
|
|
36
|
+
},
|
|
37
|
+
displayName: "Dropdown__DropdownTrigger",
|
|
38
|
+
componentId: "sc-kz07c4-1"
|
|
39
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: space-between;\n box-sizing: border-box; /* the min-height includes the border, without relying on a global reset */\n min-height: ", ";\n padding: ", " ", ";\n background-color: ", ";\n border: ", " solid ", ";\n border-radius: ", ";\n font: ", ";\n color: ", ";\n cursor: pointer;\n transition: border-color ", " ", ",\n outline ", " ", ";\n \n &:hover:not(:disabled) {\n border-color: ", ";\n }\n \n &:focus {\n border-color: ", ";\n outline: ", ";\n outline-offset: ", ";\n }\n \n &:disabled {\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n cursor: not-allowed;\n }\n \n ", "\n"], ["\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: space-between;\n box-sizing: border-box; /* the min-height includes the border, without relying on a global reset */\n min-height: ", ";\n padding: ", " ", ";\n background-color: ", ";\n border: ", " solid ", ";\n border-radius: ", ";\n font: ", ";\n color: ", ";\n cursor: pointer;\n transition: border-color ", " ", ",\n outline ", " ", ";\n \n &:hover:not(:disabled) {\n border-color: ", ";\n }\n \n &:focus {\n border-color: ", ";\n outline: ", ";\n outline-offset: ", ";\n }\n \n &:disabled {\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n cursor: not-allowed;\n }\n \n ", "\n"])), controlHeight, controlPaddingY, controlPaddingX, input["default"].backgroundColor, input["default"].borderWidth, function (_a) {
|
|
40
|
+
var $hasError = _a.$hasError;
|
|
41
|
+
return $hasError ? input.error.borderColor : input["default"].borderColor;
|
|
42
|
+
}, input["default"].borderRadius, input["default"].font, input["default"].textColor, duration.moderate, easing.standard, duration.moderate, easing.standard, function (_a) {
|
|
43
|
+
var $hasError = _a.$hasError;
|
|
44
|
+
return $hasError ? input.error.hover.borderColor : input.hover.borderColor;
|
|
45
|
+
}, function (_a) {
|
|
46
|
+
var $hasError = _a.$hasError;
|
|
47
|
+
return $hasError ? input.error.focus.borderColor : input.focus.borderColor;
|
|
48
|
+
}, input.focus.outline, border.focusOffset, input.disabled.backgroundColor, input.disabled.textColor, input.disabled.borderColor, function (_a) {
|
|
49
|
+
var $isOpen = _a.$isOpen,
|
|
50
|
+
$hasError = _a.$hasError;
|
|
51
|
+
return $isOpen && "\n border-color: ".concat($hasError ? input.error.focus.borderColor : input.focus.borderColor, ";\n ");
|
|
52
|
+
});
|
|
53
|
+
var DropdownIcon = /*#__PURE__*/styled.div.withConfig({
|
|
54
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
55
|
+
return !prop.startsWith('$');
|
|
56
|
+
},
|
|
57
|
+
displayName: "Dropdown__DropdownIcon",
|
|
58
|
+
componentId: "sc-kz07c4-2"
|
|
59
|
+
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-left: ", ";\n transition: transform ", " ", ";\n \n ", "\n\n ", " {\n transition: none;\n }\n"], ["\n display: flex;\n align-items: center;\n margin-left: ", ";\n transition: transform ", " ", ";\n \n ", "\n\n ", " {\n transition: none;\n }\n"])), space[200], duration.fast, easing.decelerate, function (_a) {
|
|
60
|
+
var $isOpen = _a.$isOpen;
|
|
61
|
+
return $isOpen && "\n transform: rotate(180deg);\n ";
|
|
62
|
+
}, reducedMotion);
|
|
63
|
+
var DropdownMenu = /*#__PURE__*/styled.div.withConfig({
|
|
64
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
65
|
+
return !prop.startsWith('$');
|
|
66
|
+
},
|
|
67
|
+
displayName: "Dropdown__DropdownMenu",
|
|
68
|
+
componentId: "sc-kz07c4-3"
|
|
69
|
+
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: ", ";\n background-color: ", ";\n /* A decorative outline: elevation separates the menu, and only the trigger is a control edge (decision 0025) */\n border: ", ";\n border-radius: ", ";\n box-shadow: ", ";\n margin-top: ", ";\n overflow: hidden;\n opacity: ", ";\n visibility: ", ";\n transform: ", ";\n transition: opacity ", " ", ",\n visibility ", " ", ",\n transform ", " ", ";\n max-height: ", ";\n overflow-y: auto;\n\n ", " {\n transform: none;\n }\n"], ["\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: ", ";\n background-color: ", ";\n /* A decorative outline: elevation separates the menu, and only the trigger is a control edge (decision 0025) */\n border: ", ";\n border-radius: ", ";\n box-shadow: ", ";\n margin-top: ", ";\n overflow: hidden;\n opacity: ", ";\n visibility: ", ";\n transform: ", ";\n transition: opacity ", " ", ",\n visibility ", " ", ",\n transform ", " ", ";\n max-height: ", ";\n overflow-y: auto;\n\n ", " {\n transform: none;\n }\n"])), tokens.semantic.layer.dropdown, input["default"].backgroundColor, border.emphasis, input["default"].borderRadius, elevation.floating, space[100], function (_a) {
|
|
70
|
+
var $isOpen = _a.$isOpen;
|
|
71
|
+
return $isOpen ? 1 : 0;
|
|
72
|
+
}, function (_a) {
|
|
73
|
+
var $isOpen = _a.$isOpen;
|
|
74
|
+
return $isOpen ? 'visible' : 'hidden';
|
|
75
|
+
}, function (_a) {
|
|
76
|
+
var $isOpen = _a.$isOpen;
|
|
77
|
+
return $isOpen ? 'translateY(0)' : "translateY(calc(-1 * ".concat(tokens.semantic.motion.distance.sm, "))");
|
|
78
|
+
}, duration.fast, easing.decelerate, duration.fast, easing.decelerate, duration.fast, easing.decelerate, tokens.semantic.size.menu.maxHeight, reducedMotion);
|
|
79
|
+
var DropdownOption = /*#__PURE__*/styled.button.withConfig({
|
|
80
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
81
|
+
return !prop.startsWith('$');
|
|
82
|
+
},
|
|
83
|
+
displayName: "Dropdown__DropdownOption",
|
|
84
|
+
componentId: "sc-kz07c4-4"
|
|
85
|
+
})(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: ", ";\n box-sizing: border-box; /* the min-height includes the border, without relying on a global reset */\n min-height: ", ";\n padding: ", " ", ";\n border: none;\n font: ", ";\n color: ", ";\n text-align: left;\n cursor: pointer;\n transition: background-color ", " ", ", color ", " ", ";\n\n /* The shared row states (decisions 0029, 0030): focus shows the hover state in grey; only the\n selected option is light blue, with its text darkening with the fill */\n ", "\n \n &:focus {\n outline: none;\n }\n \n &:not(:last-child) {\n border-bottom: ", ";\n }\n"], ["\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: ", ";\n box-sizing: border-box; /* the min-height includes the border, without relying on a global reset */\n min-height: ", ";\n padding: ", " ", ";\n border: none;\n font: ", ";\n color: ", ";\n text-align: left;\n cursor: pointer;\n transition: background-color ", " ", ", color ", " ", ";\n\n /* The shared row states (decisions 0029, 0030): focus shows the hover state in grey; only the\n selected option is light blue, with its text darkening with the fill */\n ", "\n \n &:focus {\n outline: none;\n }\n \n &:not(:last-child) {\n border-bottom: ", ";\n }\n"])), space[200], controlHeight, controlPaddingY, controlPaddingX, input["default"].font, input["default"].textColor, duration.fast, easing.decelerate, duration.fast, easing.decelerate, function (_a) {
|
|
86
|
+
var $isSelected = _a.$isSelected,
|
|
87
|
+
$isFocused = _a.$isFocused;
|
|
88
|
+
return interactiveRow({
|
|
89
|
+
selected: $isSelected,
|
|
90
|
+
focused: $isFocused
|
|
91
|
+
});
|
|
92
|
+
}, border.emphasis);
|
|
93
|
+
var StyledHelperText = /*#__PURE__*/styled.div.withConfig({
|
|
94
|
+
displayName: "Dropdown__StyledHelperText",
|
|
95
|
+
componentId: "sc-kz07c4-5"
|
|
96
|
+
})(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font: ", ";\n color: ", ";\n margin-top: ", ";\n"], ["\n font: ", ";\n color: ", ";\n margin-top: ", ";\n"])), field.helperText.typography, function (_a) {
|
|
97
|
+
var $hasError = _a.$hasError;
|
|
98
|
+
return $hasError ? field.helperText.colorError : field.helperText.color;
|
|
99
|
+
}, space[200]);
|
|
100
|
+
var Dropdown = function Dropdown(_a) {
|
|
101
|
+
var options = _a.options,
|
|
102
|
+
value = _a.value,
|
|
103
|
+
onChange = _a.onChange,
|
|
104
|
+
_b = _a.placeholder,
|
|
105
|
+
placeholder = _b === void 0 ? 'Select an option' : _b,
|
|
106
|
+
_c = _a.disabled,
|
|
107
|
+
disabled = _c === void 0 ? false : _c,
|
|
108
|
+
className = _a.className,
|
|
109
|
+
label = _a.label,
|
|
110
|
+
helperText = _a.helperText,
|
|
111
|
+
error = _a.error,
|
|
112
|
+
dataTestId = _a["data-testid"];
|
|
113
|
+
var _d = useState(false),
|
|
114
|
+
isOpen = _d[0],
|
|
115
|
+
setIsOpen = _d[1];
|
|
116
|
+
var _e = useState(-1),
|
|
117
|
+
focusedIndex = _e[0],
|
|
118
|
+
setFocusedIndex = _e[1];
|
|
119
|
+
var dropdownRef = useRef(null);
|
|
120
|
+
// Generate unique ID for accessibility (SSR-safe)
|
|
121
|
+
var dropdownId = useId();
|
|
122
|
+
var selectedOption = options.find(function (option) {
|
|
123
|
+
return option.id === value;
|
|
124
|
+
});
|
|
125
|
+
var hasError = Boolean(error);
|
|
126
|
+
var errorId = error ? "".concat(dropdownId, "-error") : undefined;
|
|
127
|
+
var helperId = helperText && !error ? "".concat(dropdownId, "-helper") : undefined;
|
|
128
|
+
var describedBy = [errorId, helperId].filter(Boolean).join(' ') || undefined;
|
|
129
|
+
// Close dropdown when clicking outside
|
|
130
|
+
useEffect(function () {
|
|
131
|
+
var handleClickOutside = function handleClickOutside(event) {
|
|
132
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
133
|
+
setIsOpen(false);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
137
|
+
return function () {
|
|
138
|
+
return document.removeEventListener('mousedown', handleClickOutside);
|
|
139
|
+
};
|
|
140
|
+
}, []);
|
|
141
|
+
// Close dropdown on escape key and handle arrow navigation
|
|
142
|
+
useEffect(function () {
|
|
143
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
144
|
+
if (!isOpen) return;
|
|
145
|
+
switch (event.key) {
|
|
146
|
+
case 'Escape':
|
|
147
|
+
setIsOpen(false);
|
|
148
|
+
setFocusedIndex(-1);
|
|
149
|
+
// Return focus to trigger button
|
|
150
|
+
if (dropdownRef.current) {
|
|
151
|
+
var trigger = dropdownRef.current.querySelector('button');
|
|
152
|
+
trigger === null || trigger === void 0 ? void 0 : trigger.focus();
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
case 'ArrowDown':
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
setFocusedIndex(function (prev) {
|
|
158
|
+
var newIndex = prev < options.length - 1 ? prev + 1 : 0;
|
|
159
|
+
return newIndex;
|
|
160
|
+
});
|
|
161
|
+
break;
|
|
162
|
+
case 'ArrowUp':
|
|
163
|
+
event.preventDefault();
|
|
164
|
+
setFocusedIndex(function (prev) {
|
|
165
|
+
var newIndex = prev > 0 ? prev - 1 : options.length - 1;
|
|
166
|
+
return newIndex;
|
|
167
|
+
});
|
|
168
|
+
break;
|
|
169
|
+
case 'Enter':
|
|
170
|
+
case ' ':
|
|
171
|
+
event.preventDefault();
|
|
172
|
+
if (focusedIndex >= 0 && focusedIndex < options.length) {
|
|
173
|
+
handleOptionClick(options[focusedIndex].id);
|
|
174
|
+
}
|
|
175
|
+
break;
|
|
176
|
+
case 'Home':
|
|
177
|
+
event.preventDefault();
|
|
178
|
+
setFocusedIndex(0);
|
|
179
|
+
break;
|
|
180
|
+
case 'End':
|
|
181
|
+
event.preventDefault();
|
|
182
|
+
setFocusedIndex(options.length - 1);
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
if (isOpen) {
|
|
187
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
188
|
+
return function () {
|
|
189
|
+
return document.removeEventListener('keydown', handleKeyDown);
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
return undefined;
|
|
193
|
+
}, [isOpen, focusedIndex, options]);
|
|
194
|
+
var handleTriggerClick = function handleTriggerClick() {
|
|
195
|
+
if (!disabled) {
|
|
196
|
+
setIsOpen(!isOpen);
|
|
197
|
+
if (!isOpen) {
|
|
198
|
+
// When opening, set focus to the currently selected option or first option
|
|
199
|
+
var selectedIndex = options.findIndex(function (option) {
|
|
200
|
+
return option.id === value;
|
|
201
|
+
});
|
|
202
|
+
setFocusedIndex(selectedIndex >= 0 ? selectedIndex : 0);
|
|
203
|
+
} else {
|
|
204
|
+
// When closing, reset focus
|
|
205
|
+
setFocusedIndex(-1);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
var handleOptionClick = function handleOptionClick(optionId) {
|
|
210
|
+
onChange(optionId);
|
|
211
|
+
setIsOpen(false);
|
|
212
|
+
setFocusedIndex(-1);
|
|
213
|
+
};
|
|
214
|
+
return jsxs(DropdownContainer, {
|
|
215
|
+
ref: dropdownRef,
|
|
216
|
+
className: className,
|
|
217
|
+
"data-testid": dataTestId,
|
|
218
|
+
children: [label && jsx("label", {
|
|
219
|
+
htmlFor: dropdownId,
|
|
220
|
+
style: {
|
|
221
|
+
display: 'block',
|
|
222
|
+
marginBottom: space[200]
|
|
223
|
+
},
|
|
224
|
+
children: jsx(Typography, {
|
|
225
|
+
variant: "label",
|
|
226
|
+
children: label
|
|
227
|
+
})
|
|
228
|
+
}), jsxs(DropdownTrigger, {
|
|
229
|
+
id: dropdownId,
|
|
230
|
+
"$isOpen": isOpen,
|
|
231
|
+
"$hasError": hasError,
|
|
232
|
+
onClick: handleTriggerClick,
|
|
233
|
+
disabled: disabled,
|
|
234
|
+
"aria-expanded": isOpen,
|
|
235
|
+
"aria-haspopup": "listbox",
|
|
236
|
+
"aria-invalid": hasError,
|
|
237
|
+
"aria-describedby": describedBy,
|
|
238
|
+
children: [jsx("span", {
|
|
239
|
+
children: selectedOption ? selectedOption.label : placeholder
|
|
240
|
+
}), jsx(DropdownIcon, {
|
|
241
|
+
"$isOpen": isOpen,
|
|
242
|
+
children: jsx(Icon, {
|
|
243
|
+
name: "arrowDown",
|
|
244
|
+
iconColor: disabled ? 'disabled' : 'subdued'
|
|
245
|
+
})
|
|
246
|
+
})]
|
|
247
|
+
}), jsx(DropdownMenu, {
|
|
248
|
+
"$isOpen": isOpen,
|
|
249
|
+
role: "listbox",
|
|
250
|
+
"aria-labelledby": dropdownId,
|
|
251
|
+
children: options.map(function (option, index) {
|
|
252
|
+
return jsxs(DropdownOption, {
|
|
253
|
+
"$isSelected": option.id === value,
|
|
254
|
+
"$isFocused": index === focusedIndex,
|
|
255
|
+
onClick: function onClick() {
|
|
256
|
+
return handleOptionClick(option.id);
|
|
257
|
+
},
|
|
258
|
+
role: "option",
|
|
259
|
+
"aria-selected": option.id === value,
|
|
260
|
+
children: [option.label, option.id === value && jsx(Icon, {
|
|
261
|
+
name: "check",
|
|
262
|
+
size: "sm",
|
|
263
|
+
iconColor: "inherit"
|
|
264
|
+
})]
|
|
265
|
+
}, option.id);
|
|
266
|
+
})
|
|
267
|
+
}), error && jsx(StyledHelperText, {
|
|
268
|
+
id: errorId,
|
|
269
|
+
role: "alert",
|
|
270
|
+
"aria-live": "polite",
|
|
271
|
+
"$hasError": true,
|
|
272
|
+
children: error
|
|
273
|
+
}), helperText && !error && jsx(StyledHelperText, {
|
|
274
|
+
id: helperId,
|
|
275
|
+
children: helperText
|
|
276
|
+
})]
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
280
|
+
|
|
281
|
+
export { Dropdown };
|
|
282
|
+
//# sourceMappingURL=Dropdown.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropdown.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Dropdown.mjs';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type IconName } from '../../../types/icons.mjs';
|
|
3
|
+
export type EmptyStateIllustration = 'search' | 'transactions' | 'notifications' | 'empty' | 'error' | 'custom';
|
|
4
|
+
export type EmptyStateVariant = 'default' | 'error' | 'success';
|
|
5
|
+
export type EmptyStateSize = 'small' | 'medium' | 'large';
|
|
6
|
+
export interface EmptyStateAction {
|
|
7
|
+
label: string;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
variant?: 'primary' | 'secondary';
|
|
10
|
+
icon?: IconName;
|
|
11
|
+
}
|
|
12
|
+
export interface EmptyStateProps {
|
|
13
|
+
/** Predefined illustration type */
|
|
14
|
+
illustration?: EmptyStateIllustration;
|
|
15
|
+
/** Custom illustration (SVG string or React node) */
|
|
16
|
+
customIllustration?: React.ReactNode;
|
|
17
|
+
/** Main heading */
|
|
18
|
+
title: string;
|
|
19
|
+
/** Descriptive text */
|
|
20
|
+
description: string;
|
|
21
|
+
/** Primary call-to-action */
|
|
22
|
+
action?: EmptyStateAction;
|
|
23
|
+
/** Secondary action */
|
|
24
|
+
secondaryAction?: EmptyStateAction;
|
|
25
|
+
/** Visual variant */
|
|
26
|
+
variant?: EmptyStateVariant;
|
|
27
|
+
/** Size of the component */
|
|
28
|
+
size?: EmptyStateSize;
|
|
29
|
+
/** Data test id for testing */
|
|
30
|
+
'data-testid'?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const EmptyState: React.FC<EmptyStateProps>;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import styled$module from 'styled-components';
|
|
5
|
+
const styled = styled$module.default || styled$module;
|
|
6
|
+
import tokens from '../../../lib/cssTokens.mjs';
|
|
7
|
+
import { Stack } from '../../atoms/Stack/Stack.mjs';
|
|
8
|
+
import { Box } from '../../atoms/Box/Box.mjs';
|
|
9
|
+
import { Typography } from '../../atoms/Typography/Typography.mjs';
|
|
10
|
+
import { Button } from '../../atoms/Button/Button.mjs';
|
|
11
|
+
import { Icon } from '../../atoms/Icon/Icon.mjs';
|
|
12
|
+
|
|
13
|
+
var semantic = tokens.semantic;
|
|
14
|
+
var StyledContainer = /*#__PURE__*/styled.div.withConfig({
|
|
15
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
16
|
+
return !prop.startsWith('$');
|
|
17
|
+
},
|
|
18
|
+
displayName: "EmptyState__StyledContainer",
|
|
19
|
+
componentId: "sc-1u5hxh-0"
|
|
20
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n max-width: ", ";\n margin: 0 auto;\n padding: ", ";\n"], ["\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n max-width: ", ";\n margin: 0 auto;\n padding: ", ";\n"])), tokens.component.emptyState.maxWidth, function (_a) {
|
|
21
|
+
var $size = _a.$size;
|
|
22
|
+
return $size === 'small' ? semantic.space[800] : $size === 'large' ? semantic.space[1400] : semantic.space[1000];
|
|
23
|
+
});
|
|
24
|
+
var StyledIllustration = /*#__PURE__*/styled.div.withConfig({
|
|
25
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
26
|
+
return !prop.startsWith('$');
|
|
27
|
+
},
|
|
28
|
+
displayName: "EmptyState__StyledIllustration",
|
|
29
|
+
componentId: "sc-1u5hxh-1"
|
|
30
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: ", ";\n height: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: ", ";\n color: ", ";\n"], ["\n width: ", ";\n height: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: ", ";\n color: ", ";\n"])), function (_a) {
|
|
31
|
+
var $size = _a.$size;
|
|
32
|
+
return $size === 'small' ? tokens.component.emptyState.illustration.small : $size === 'large' ? tokens.component.emptyState.illustration.large : tokens.component.emptyState.illustration.medium;
|
|
33
|
+
}, function (_a) {
|
|
34
|
+
var $size = _a.$size;
|
|
35
|
+
return $size === 'small' ? tokens.component.emptyState.illustration.small : $size === 'large' ? tokens.component.emptyState.illustration.large : tokens.component.emptyState.illustration.medium;
|
|
36
|
+
}, semantic.space[600], function (_a) {
|
|
37
|
+
var $variant = _a.$variant;
|
|
38
|
+
return $variant === 'error' ? semantic.color.icon.danger : $variant === 'success' ? semantic.color.icon.success : semantic.color.icon.muted;
|
|
39
|
+
});
|
|
40
|
+
var StyledTextContainer = /*#__PURE__*/styled.div.withConfig({
|
|
41
|
+
displayName: "EmptyState__StyledTextContainer",
|
|
42
|
+
componentId: "sc-1u5hxh-2"
|
|
43
|
+
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n max-width: ", ";\n margin-bottom: ", ";\n"], ["\n max-width: ", ";\n margin-bottom: ", ";\n"
|
|
44
|
+
// Map illustration type to icon name
|
|
45
|
+
])), tokens.component.emptyState.text.maxWidth, semantic.space[600]);
|
|
46
|
+
// Map illustration type to icon name
|
|
47
|
+
var illustrationToIcon = {
|
|
48
|
+
search: 'search',
|
|
49
|
+
transactions: 'paper',
|
|
50
|
+
// Placeholder - will use custom icon when available
|
|
51
|
+
notifications: 'bell',
|
|
52
|
+
empty: 'paper',
|
|
53
|
+
error: 'crossCircle'
|
|
54
|
+
};
|
|
55
|
+
var EmptyState = function EmptyState(_a) {
|
|
56
|
+
var _b = _a.illustration,
|
|
57
|
+
illustration = _b === void 0 ? 'empty' : _b,
|
|
58
|
+
customIllustration = _a.customIllustration,
|
|
59
|
+
title = _a.title,
|
|
60
|
+
description = _a.description,
|
|
61
|
+
action = _a.action,
|
|
62
|
+
secondaryAction = _a.secondaryAction,
|
|
63
|
+
_c = _a.variant,
|
|
64
|
+
variant = _c === void 0 ? 'default' : _c,
|
|
65
|
+
_d = _a.size,
|
|
66
|
+
size = _d === void 0 ? 'medium' : _d,
|
|
67
|
+
dataTestId = _a["data-testid"];
|
|
68
|
+
// Determine what to show for illustration
|
|
69
|
+
var renderIllustration = function renderIllustration() {
|
|
70
|
+
if (customIllustration) {
|
|
71
|
+
return customIllustration;
|
|
72
|
+
}
|
|
73
|
+
if (illustration !== 'custom') {
|
|
74
|
+
var iconName = illustrationToIcon[illustration];
|
|
75
|
+
return jsx(Icon, {
|
|
76
|
+
name: iconName,
|
|
77
|
+
size: "2xl"
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
};
|
|
82
|
+
return jsxs(StyledContainer, {
|
|
83
|
+
"$size": size,
|
|
84
|
+
"data-testid": dataTestId,
|
|
85
|
+
role: "status",
|
|
86
|
+
"aria-label": "Empty state: ".concat(title),
|
|
87
|
+
children: [jsx(StyledIllustration, {
|
|
88
|
+
"$size": size,
|
|
89
|
+
"$variant": variant,
|
|
90
|
+
"aria-hidden": "true",
|
|
91
|
+
children: renderIllustration()
|
|
92
|
+
}), jsxs(StyledTextContainer, {
|
|
93
|
+
children: [jsx(Typography, {
|
|
94
|
+
variant: size === 'small' ? 'h4' : size === 'large' ? 'h2' : 'h3',
|
|
95
|
+
color: variant === 'error' ? 'error' : 'default',
|
|
96
|
+
as: size === 'small' ? 'h4' : size === 'large' ? 'h2' : 'h3',
|
|
97
|
+
children: title
|
|
98
|
+
}), jsx("div", {
|
|
99
|
+
style: {
|
|
100
|
+
marginTop: semantic.space[300]
|
|
101
|
+
},
|
|
102
|
+
children: jsx(Typography, {
|
|
103
|
+
variant: "body",
|
|
104
|
+
color: "subdued",
|
|
105
|
+
children: description
|
|
106
|
+
})
|
|
107
|
+
})]
|
|
108
|
+
}), (action || secondaryAction) && jsx(Box, {
|
|
109
|
+
width: "100%",
|
|
110
|
+
maxWidth: tokens.component.emptyState.actions.maxWidth,
|
|
111
|
+
children: jsxs(Stack, {
|
|
112
|
+
direction: "column",
|
|
113
|
+
gap: "sm",
|
|
114
|
+
children: [action && jsx(Button, {
|
|
115
|
+
variant: action.variant || 'primary',
|
|
116
|
+
onClick: action.onClick,
|
|
117
|
+
iconName: action.icon,
|
|
118
|
+
"data-testid": dataTestId ? "".concat(dataTestId, "-primary-action") : undefined,
|
|
119
|
+
children: action.label
|
|
120
|
+
}), secondaryAction && jsx(Button, {
|
|
121
|
+
variant: "naked",
|
|
122
|
+
onClick: secondaryAction.onClick,
|
|
123
|
+
"data-testid": dataTestId ? "".concat(dataTestId, "-secondary-action") : undefined,
|
|
124
|
+
children: secondaryAction.label
|
|
125
|
+
})]
|
|
126
|
+
})
|
|
127
|
+
})]
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
131
|
+
|
|
132
|
+
export { EmptyState };
|
|
133
|
+
//# sourceMappingURL=EmptyState.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmptyState.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type FeatureBlockProps = {
|
|
3
|
+
title: string;
|
|
4
|
+
excerpt: string;
|
|
5
|
+
labels: string[];
|
|
6
|
+
coverImage: string;
|
|
7
|
+
date: string;
|
|
8
|
+
onReadMore?: () => void;
|
|
9
|
+
readMoreHref?: string;
|
|
10
|
+
readMoreText?: string;
|
|
11
|
+
/** Test identifier for automated testing */
|
|
12
|
+
'data-testid'?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const FeatureBlock: React.FC<FeatureBlockProps>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import styled$module from 'styled-components';
|
|
5
|
+
const styled = styled$module.default || styled$module;
|
|
6
|
+
import { Chip } from '../../atoms/Chip/Chip.mjs';
|
|
7
|
+
import '../../atoms/Icon/Icon.mjs';
|
|
8
|
+
import '../../atoms/Chip/shared/ChipBase.mjs';
|
|
9
|
+
import { Button } from '../../atoms/Button/Button.mjs';
|
|
10
|
+
import { Picture } from '../../atoms/Picture/Picture.mjs';
|
|
11
|
+
import { Divider } from '../../atoms/Divider/Divider.mjs';
|
|
12
|
+
import { Stack } from '../../atoms/Stack/Stack.mjs';
|
|
13
|
+
import { Typography } from '../../atoms/Typography/Typography.mjs';
|
|
14
|
+
import { DateFormatter } from '../../atoms/DateFormatter/DateFormatter.mjs';
|
|
15
|
+
import tokens from '../../../lib/cssTokens.mjs';
|
|
16
|
+
|
|
17
|
+
var space = tokens.semantic.space;
|
|
18
|
+
var FeatureBlockStyled = /*#__PURE__*/styled.div.withConfig({
|
|
19
|
+
displayName: "FeatureBlock__FeatureBlockStyled",
|
|
20
|
+
componentId: "sc-1mi4lso-0"
|
|
21
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n @media (min-width: ", ") {\n display: grid;\n grid-template-columns: repeat(12, 1fr);\n }\n\n @media (min-width: ", ") {\n gap: ", ";\n }\n\n /* The image isn't clickable, so it doesn't answer hover (issue 185, P5) */\n img {\n border-radius: ", ";\n }\n\n a {\n text-decoration: none;\n }\n"], ["\n @media (min-width: ", ") {\n display: grid;\n grid-template-columns: repeat(12, 1fr);\n }\n\n @media (min-width: ", ") {\n gap: ", ";\n }\n\n /* The image isn't clickable, so it doesn't answer hover (issue 185, P5) */\n img {\n border-radius: ", ";\n }\n\n a {\n text-decoration: none;\n }\n"])), tokens.semantic.breakpoint.md, tokens.semantic.breakpoint.lg, space[1200], tokens.semantic.radius['2xl']);
|
|
22
|
+
var ImageWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
23
|
+
displayName: "FeatureBlock__ImageWrapper",
|
|
24
|
+
componentId: "sc-1mi4lso-1"
|
|
25
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n grid-column: span 12;\n\n @media (min-width: ", ") {\n grid-column: span 6;\n }\n"], ["\n grid-column: span 12;\n\n @media (min-width: ", ") {\n grid-column: span 6;\n }\n"])), tokens.semantic.breakpoint.lg);
|
|
26
|
+
var ContentSection = /*#__PURE__*/styled.div.withConfig({
|
|
27
|
+
displayName: "FeatureBlock__ContentSection",
|
|
28
|
+
componentId: "sc-1mi4lso-2"
|
|
29
|
+
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n grid-column: span 12;\n margin-top: ", ";\n\n @media (min-width: ", ") {\n grid-column: span 6;\n margin-top: 0;\n padding-right: ", ";\n }\n\n @media (min-width: ", ") {\n padding-right: ", ";\n }\n"], ["\n grid-column: span 12;\n margin-top: ", ";\n\n @media (min-width: ", ") {\n grid-column: span 6;\n margin-top: 0;\n padding-right: ", ";\n }\n\n @media (min-width: ", ") {\n padding-right: ", ";\n }\n"])), space[600], tokens.semantic.breakpoint.lg, space[800], tokens.semantic.breakpoint.xl, space[2400]);
|
|
30
|
+
var ButtonWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
31
|
+
displayName: "FeatureBlock__ButtonWrapper",
|
|
32
|
+
componentId: "sc-1mi4lso-3"
|
|
33
|
+
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n button {\n margin-top: ", ";\n }\n"], ["\n button {\n margin-top: ", ";\n }\n"])), space[400]);
|
|
34
|
+
var ContentWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
35
|
+
displayName: "FeatureBlock__ContentWrapper",
|
|
36
|
+
componentId: "sc-1mi4lso-4"
|
|
37
|
+
})(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n height: 100%;\n"], ["\n display: flex;\n flex-direction: column;\n justify-content: center;\n height: 100%;\n"])));
|
|
38
|
+
var FeatureBlock = function FeatureBlock(_a) {
|
|
39
|
+
var title = _a.title,
|
|
40
|
+
excerpt = _a.excerpt,
|
|
41
|
+
_b = _a.labels,
|
|
42
|
+
labels = _b === void 0 ? [] : _b,
|
|
43
|
+
coverImage = _a.coverImage,
|
|
44
|
+
date = _a.date,
|
|
45
|
+
onReadMore = _a.onReadMore,
|
|
46
|
+
readMoreHref = _a.readMoreHref,
|
|
47
|
+
_c = _a.readMoreText,
|
|
48
|
+
readMoreText = _c === void 0 ? "Read more" : _c,
|
|
49
|
+
dataTestId = _a["data-testid"];
|
|
50
|
+
return jsxs(Fragment, {
|
|
51
|
+
children: [jsxs(FeatureBlockStyled, {
|
|
52
|
+
"data-testid": dataTestId,
|
|
53
|
+
children: [jsx(ImageWrapper, {
|
|
54
|
+
children: jsx(Picture, {
|
|
55
|
+
title: title,
|
|
56
|
+
src: coverImage
|
|
57
|
+
})
|
|
58
|
+
}), jsx(ContentSection, {
|
|
59
|
+
children: jsx(ContentWrapper, {
|
|
60
|
+
children: jsxs(Stack, {
|
|
61
|
+
direction: "column",
|
|
62
|
+
gap: "md",
|
|
63
|
+
children: [jsx(Typography, {
|
|
64
|
+
variant: "h3",
|
|
65
|
+
children: title
|
|
66
|
+
}), jsx(DateFormatter, {
|
|
67
|
+
dateString: date
|
|
68
|
+
}), jsx(Typography, {
|
|
69
|
+
variant: "small",
|
|
70
|
+
children: excerpt
|
|
71
|
+
}), jsx(Stack, {
|
|
72
|
+
direction: "row",
|
|
73
|
+
gap: "xs",
|
|
74
|
+
children: Array.isArray(labels) && labels.map(function (label, index) {
|
|
75
|
+
return jsx(Chip, {
|
|
76
|
+
title: label,
|
|
77
|
+
variant: "default"
|
|
78
|
+
}, index);
|
|
79
|
+
})
|
|
80
|
+
}), (onReadMore || readMoreHref) && jsx(ButtonWrapper, {
|
|
81
|
+
children: readMoreHref ? jsx(Button, {
|
|
82
|
+
purpose: "link",
|
|
83
|
+
url: readMoreHref,
|
|
84
|
+
children: readMoreText
|
|
85
|
+
}) : jsx(Button, {
|
|
86
|
+
onClick: onReadMore,
|
|
87
|
+
children: readMoreText
|
|
88
|
+
})
|
|
89
|
+
})]
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
})]
|
|
93
|
+
}), jsx(Divider, {})]
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
97
|
+
|
|
98
|
+
export { FeatureBlock };
|
|
99
|
+
//# sourceMappingURL=FeatureBlock.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeatureBlock.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FeatureBlock.mjs';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type InlineAlertVariant = 'error' | 'warning' | 'info' | 'success';
|
|
3
|
+
export type InlineAlertSize = 'small' | 'medium';
|
|
4
|
+
export interface InlineAlertProps {
|
|
5
|
+
/**
|
|
6
|
+
* Severity, shown by the icon and the text colour
|
|
7
|
+
* @default 'info'
|
|
8
|
+
*/
|
|
9
|
+
variant?: InlineAlertVariant;
|
|
10
|
+
/**
|
|
11
|
+
* Size on the label scale (decision 0018): small (20px) for dense places such as tables,
|
|
12
|
+
* medium (24px) for forms and content. The message can wrap; the size sets its minimum height.
|
|
13
|
+
* @default 'medium'
|
|
14
|
+
*/
|
|
15
|
+
size?: InlineAlertSize;
|
|
16
|
+
/**
|
|
17
|
+
* The message: short text only (no title, action or dismiss button; use Alert for those).
|
|
18
|
+
* With no message, InlineAlert renders an empty live region and no icon: keep it mounted and
|
|
19
|
+
* set the message to have screen readers announce it reliably.
|
|
20
|
+
*/
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* ARIA live region behaviour, as on Alert
|
|
24
|
+
* - polite: non-urgent announcements
|
|
25
|
+
* - assertive: important, time-sensitive information
|
|
26
|
+
* - off: not announced
|
|
27
|
+
* @default 'polite'
|
|
28
|
+
*/
|
|
29
|
+
ariaLive?: 'polite' | 'assertive' | 'off';
|
|
30
|
+
/**
|
|
31
|
+
* Element id. When the message gives feedback about a control, the control references this
|
|
32
|
+
* id with aria-describedby, so the message is read when the control is focused.
|
|
33
|
+
*/
|
|
34
|
+
id?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Test identifier for automated testing
|
|
37
|
+
*/
|
|
38
|
+
'data-testid'?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* InlineAlert is a short, local message that sits next to what it's about: between paragraphs,
|
|
42
|
+
* below a field or in a table cell (decision 0019). A severity icon and text in the severity
|
|
43
|
+
* colour, with no background or border. For a title, an action or a dismiss button, use Alert.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* <InlineAlert variant="success">Saved</InlineAlert>
|
|
48
|
+
*
|
|
49
|
+
* // Field feedback: the control references the message with aria-describedby
|
|
50
|
+
* <input id="email" aria-describedby="email-error" aria-invalid="true" />
|
|
51
|
+
* <InlineAlert id="email-error" variant="error" size="small">Enter a valid email address</InlineAlert>
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare const InlineAlert: React.FC<InlineAlertProps>;
|