@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,462 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { __makeTemplateObject } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
import { useId, useRef, useState, 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 { forcedColors, reducedMotion } from '../../../lib/styleUtils.mjs';
|
|
9
|
+
|
|
10
|
+
var semantic = tokens.semantic;
|
|
11
|
+
var StyledSliderContainer = /*#__PURE__*/styled.div.withConfig({
|
|
12
|
+
displayName: "Slider__StyledSliderContainer",
|
|
13
|
+
componentId: "sc-6mh2d4-0"
|
|
14
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap:0;\n width: 100%;\n"], ["\n display: flex;\n flex-direction: column;\n gap:0;\n width: 100%;\n"])));
|
|
15
|
+
var StyledLabel = /*#__PURE__*/styled.label.withConfig({
|
|
16
|
+
displayName: "Slider__StyledLabel",
|
|
17
|
+
componentId: "sc-6mh2d4-1"
|
|
18
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font: ", ";\n color: ", ";\n margin-bottom: ", ";\n"], ["\n font: ", ";\n color: ", ";\n margin-bottom: ", ";\n"])), semantic.typography.label, function (_a) {
|
|
19
|
+
var $disabled = _a.$disabled;
|
|
20
|
+
return $disabled ? semantic.color.text.disabled : semantic.color.text["default"];
|
|
21
|
+
}, semantic.space[400]);
|
|
22
|
+
var StyledSliderTrackContainer = /*#__PURE__*/styled.div.withConfig({
|
|
23
|
+
displayName: "Slider__StyledSliderTrackContainer",
|
|
24
|
+
componentId: "sc-6mh2d4-2"
|
|
25
|
+
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n width: 100%;\n height: ", ";\n display: flex;\n align-items: center;\n"], ["\n position: relative;\n width: 100%;\n height: ", ";\n display: flex;\n align-items: center;\n"])), semantic.space[1000]);
|
|
26
|
+
var StyledTrack = /*#__PURE__*/styled.div.withConfig({
|
|
27
|
+
displayName: "Slider__StyledTrack",
|
|
28
|
+
componentId: "sc-6mh2d4-3"
|
|
29
|
+
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: relative;\n width: 100%;\n height: ", ";\n background-color: ", ";\n border-radius: ", ";\n cursor: ", ";\n /* A vertical swipe over the track still scrolls the page */\n touch-action: pan-y;\n /* The thumbs measure their distance apart in cqw (1% of the track's width) */\n container-type: inline-size;\n\n /* Forced colours drop the track's fill, so it gets an edge; the thumb stays centred on it (decision 0038).\n A div gets no system disabled colour, so a disabled track sets GrayText itself. */\n ", " {\n border: ", " solid ", ";\n }\n"], ["\n position: relative;\n width: 100%;\n height: ", ";\n background-color: ", ";\n border-radius: ", ";\n cursor: ", ";\n /* A vertical swipe over the track still scrolls the page */\n touch-action: pan-y;\n /* The thumbs measure their distance apart in cqw (1% of the track's width) */\n container-type: inline-size;\n\n /* Forced colours drop the track's fill, so it gets an edge; the thumb stays centred on it (decision 0038).\n A div gets no system disabled colour, so a disabled track sets GrayText itself. */\n ", " {\n border: ", " solid ", ";\n }\n"])), semantic.space[100], function (_a) {
|
|
30
|
+
var $disabled = _a.$disabled;
|
|
31
|
+
return $disabled ? semantic.color.fill.disabled : tokens.component.track.background;
|
|
32
|
+
}, semantic.radius.full, function (_a) {
|
|
33
|
+
var $disabled = _a.$disabled;
|
|
34
|
+
return $disabled ? 'not-allowed' : 'pointer';
|
|
35
|
+
}, forcedColors, semantic.border.width.thin, function (_a) {
|
|
36
|
+
var $disabled = _a.$disabled;
|
|
37
|
+
return $disabled ? 'GrayText' : 'CanvasText';
|
|
38
|
+
});
|
|
39
|
+
var StyledTrackFill = /*#__PURE__*/styled.div.withConfig({
|
|
40
|
+
displayName: "Slider__StyledTrackFill",
|
|
41
|
+
componentId: "sc-6mh2d4-4"
|
|
42
|
+
})(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n position: absolute;\n height: 100%;\n background-color: ", ";\n border-radius: ", ";\n pointer-events: none;\n\n /* The fill is the value, so it keeps a fill in forced colours (decision 0038) */\n ", " {\n forced-color-adjust: none;\n background-color: ", ";\n }\n"], ["\n position: absolute;\n height: 100%;\n background-color: ", ";\n border-radius: ", ";\n pointer-events: none;\n\n /* The fill is the value, so it keeps a fill in forced colours (decision 0038) */\n ", " {\n forced-color-adjust: none;\n background-color: ", ";\n }\n"])), function (_a) {
|
|
43
|
+
var $disabled = _a.$disabled;
|
|
44
|
+
return $disabled ? semantic.color.icon.disabled : semantic.color.fill.emphasis;
|
|
45
|
+
}, semantic.radius.full, forcedColors, function (_a) {
|
|
46
|
+
var $disabled = _a.$disabled;
|
|
47
|
+
return $disabled ? 'GrayText' : 'Highlight';
|
|
48
|
+
});
|
|
49
|
+
var StyledThumb = /*#__PURE__*/styled.div.withConfig({
|
|
50
|
+
displayName: "Slider__StyledThumb",
|
|
51
|
+
componentId: "sc-6mh2d4-5"
|
|
52
|
+
})(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: absolute;\n width: ", ";\n height: ", ";\n top: calc(-1 * ", ");\n background-color: ", ";\n border: ", " solid ", ";\n border-radius: ", ";\n cursor: ", ";\n /* The thumb takes every touch gesture, so a drag moves the value instead of scrolling */\n touch-action: none;\n transform: translateX(-50%);\n /* left is the thumb's position, set from the value: it glides there, as it always has (decision 0037) */\n transition: left ", " ", ",\n transform ", " ", ",\n box-shadow ", " ", ",\n background-color ", " ", ",\n border-color ", " ", ";\n box-shadow: ", ";\n\n /* The pointer target (WCAG 2.5.8, decision 0039): the thumb keeps its 20px look, and an\n invisible hit area centred on it takes pointer input instead, 24px for a mouse or pen and\n 44px on a touch screen. A range slider's two hit areas stop at the midpoint between the\n thumbs (--slider-reach, set from their positions), so they never overlap and a drag always\n takes the nearer thumb. The thumb itself takes no input, as its body can overlap the other\n thumb's half. */\n pointer-events: none;\n --slider-hit: ", ";\n @media (pointer: coarse) {\n --slider-hit: ", ";\n }\n --slider-hit-half: calc(var(--slider-hit) / 2);\n --slider-hit-start: ", ";\n --slider-hit-end: ", ";\n\n &::before {\n content: '';\n position: absolute;\n top: 50%;\n left: calc(50% - var(--slider-hit-start));\n width: calc(var(--slider-hit-start) + var(--slider-hit-end));\n height: var(--slider-hit);\n transform: translateY(-50%);\n pointer-events: auto;\n }\n\n /* Without container query units the midpoint can't be measured, so the hit areas stay whole\n (where they overlap, the thumb drawn later wins) */\n @supports not (width: 1cqw) {\n &::before {\n left: calc(50% - var(--slider-hit-half));\n width: var(--slider-hit);\n }\n }\n\n ", " {\n transition: none;\n }\n \n &:hover:not([aria-disabled=\"true\"]) {\n transform: translateX(-50%) scale(1.1);\n box-shadow: ", ";\n }\n \n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n \n &:active:not([aria-disabled=\"true\"]) {\n cursor: grabbing;\n transform: translateX(-50%) scale(0.95);\n }\n \n ", "\n"], ["\n position: absolute;\n width: ", ";\n height: ", ";\n top: calc(-1 * ", ");\n background-color: ", ";\n border: ", " solid ", ";\n border-radius: ", ";\n cursor: ", ";\n /* The thumb takes every touch gesture, so a drag moves the value instead of scrolling */\n touch-action: none;\n transform: translateX(-50%);\n /* left is the thumb's position, set from the value: it glides there, as it always has (decision 0037) */\n transition: left ", " ", ",\n transform ", " ", ",\n box-shadow ", " ", ",\n background-color ", " ", ",\n border-color ", " ", ";\n box-shadow: ", ";\n\n /* The pointer target (WCAG 2.5.8, decision 0039): the thumb keeps its 20px look, and an\n invisible hit area centred on it takes pointer input instead, 24px for a mouse or pen and\n 44px on a touch screen. A range slider's two hit areas stop at the midpoint between the\n thumbs (--slider-reach, set from their positions), so they never overlap and a drag always\n takes the nearer thumb. The thumb itself takes no input, as its body can overlap the other\n thumb's half. */\n pointer-events: none;\n --slider-hit: ", ";\n @media (pointer: coarse) {\n --slider-hit: ", ";\n }\n --slider-hit-half: calc(var(--slider-hit) / 2);\n --slider-hit-start: ", ";\n --slider-hit-end: ", ";\n\n &::before {\n content: '';\n position: absolute;\n top: 50%;\n left: calc(50% - var(--slider-hit-start));\n width: calc(var(--slider-hit-start) + var(--slider-hit-end));\n height: var(--slider-hit);\n transform: translateY(-50%);\n pointer-events: auto;\n }\n\n /* Without container query units the midpoint can't be measured, so the hit areas stay whole\n (where they overlap, the thumb drawn later wins) */\n @supports not (width: 1cqw) {\n &::before {\n left: calc(50% - var(--slider-hit-half));\n width: var(--slider-hit);\n }\n }\n\n ", " {\n transition: none;\n }\n \n &:hover:not([aria-disabled=\"true\"]) {\n transform: translateX(-50%) scale(1.1);\n box-shadow: ", ";\n }\n \n &:focus-visible {\n outline: ", ";\n outline-offset: ", ";\n }\n \n &:active:not([aria-disabled=\"true\"]) {\n cursor: grabbing;\n transform: translateX(-50%) scale(0.95);\n }\n \n ", "\n"])), semantic.space[500], semantic.space[500], semantic.space[200], function (_a) {
|
|
53
|
+
var $disabled = _a.$disabled;
|
|
54
|
+
return $disabled ? semantic.color.fill.disabled : tokens.component.slider.thumb.background;
|
|
55
|
+
}, semantic.border.width.thick, function (_a) {
|
|
56
|
+
var $disabled = _a.$disabled;
|
|
57
|
+
return $disabled ? semantic.color.icon.disabled : semantic.color.fill.emphasis;
|
|
58
|
+
}, semantic.radius.full, function (_a) {
|
|
59
|
+
var $disabled = _a.$disabled;
|
|
60
|
+
return $disabled ? 'not-allowed' : 'grab';
|
|
61
|
+
}, semantic.motion.duration.fast, semantic.motion.easing.decelerate, semantic.motion.duration.fast, semantic.motion.easing.decelerate, semantic.motion.duration.fast, semantic.motion.easing.decelerate, semantic.motion.duration.fast, semantic.motion.easing.decelerate, semantic.motion.duration.fast, semantic.motion.easing.decelerate, tokens.component.slider.thumb.shadow["default"], semantic.size.pointerTarget, semantic.size.touchTarget, function (_a) {
|
|
62
|
+
var $range = _a.$range;
|
|
63
|
+
return $range === 'max' ? 'min(var(--slider-hit-half), var(--slider-reach))' : 'var(--slider-hit-half)';
|
|
64
|
+
}, function (_a) {
|
|
65
|
+
var $range = _a.$range;
|
|
66
|
+
return $range === 'min' ? 'min(var(--slider-hit-half), var(--slider-reach))' : 'var(--slider-hit-half)';
|
|
67
|
+
}, reducedMotion, tokens.component.slider.thumb.shadow.hover, semantic.border.focus, semantic.border.focusOffset, function (_a) {
|
|
68
|
+
var $active = _a.$active;
|
|
69
|
+
return $active && "\n transform: translateX(-50%) scale(1.1);\n box-shadow: ".concat(tokens.component.slider.thumb.shadow.active, ";\n ");
|
|
70
|
+
});
|
|
71
|
+
var StyledValueLabel = /*#__PURE__*/styled.div.withConfig({
|
|
72
|
+
displayName: "Slider__StyledValueLabel",
|
|
73
|
+
componentId: "sc-6mh2d4-6"
|
|
74
|
+
})(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n position: absolute;\n top: calc(-1 * ", ");\n left: ", ";\n transform: translateX(-50%);\n padding: ", " ", ";\n background-color: ", ";\n color: ", ";\n font: ", ";\n border-radius: ", ";\n white-space: nowrap;\n pointer-events: none;\n opacity: ", ";\n \n &::after {\n content: '';\n position: absolute;\n top: 100%;\n left: 50%;\n transform: translateX(-50%);\n width: 0;\n height: 0;\n border-left: ", " solid transparent;\n border-right: ", " solid transparent;\n border-top: ", " solid ", ";\n }\n"], ["\n position: absolute;\n top: calc(-1 * ", ");\n left: ", ";\n transform: translateX(-50%);\n padding: ", " ", ";\n background-color: ", ";\n color: ", ";\n font: ", ";\n border-radius: ", ";\n white-space: nowrap;\n pointer-events: none;\n opacity: ", ";\n \n &::after {\n content: '';\n position: absolute;\n top: 100%;\n left: 50%;\n transform: translateX(-50%);\n width: 0;\n height: 0;\n border-left: ", " solid transparent;\n border-right: ", " solid transparent;\n border-top: ", " solid ", ";\n }\n"])), semantic.space[800], semantic.space[200], semantic.space[100], semantic.space[200], semantic.color.fill.emphasis, semantic.color.text.inverse, semantic.typography.caption, semantic.radius.sm, function (_a) {
|
|
75
|
+
var $disabled = _a.$disabled;
|
|
76
|
+
return $disabled ? semantic.opacity.disabled : semantic.opacity.full;
|
|
77
|
+
}, semantic.space[100], semantic.space[100], semantic.space[100], semantic.color.fill.emphasis);
|
|
78
|
+
var StyledMinMaxLabels = /*#__PURE__*/styled.div.withConfig({
|
|
79
|
+
displayName: "Slider__StyledMinMaxLabels",
|
|
80
|
+
componentId: "sc-6mh2d4-7"
|
|
81
|
+
})(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n font: ", ";\n color: ", ";\n margin-top: ", ";\n"], ["\n display: flex;\n justify-content: space-between;\n font: ", ";\n color: ", ";\n margin-top: ", ";\n"
|
|
82
|
+
/**
|
|
83
|
+
* Slider component for single value or range selection
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```tsx
|
|
87
|
+
* // Single value slider
|
|
88
|
+
* <Slider
|
|
89
|
+
* label="Volume"
|
|
90
|
+
* min={0}
|
|
91
|
+
* max={100}
|
|
92
|
+
* value={50}
|
|
93
|
+
* onChange={(value) => console.log(value)}
|
|
94
|
+
* />
|
|
95
|
+
*
|
|
96
|
+
* // Range slider
|
|
97
|
+
* <Slider
|
|
98
|
+
* label="Budget Range"
|
|
99
|
+
* min={0}
|
|
100
|
+
* max={1000}
|
|
101
|
+
* rangeValue={[200, 800]}
|
|
102
|
+
* onRangeChange={(values) => console.log(values)}
|
|
103
|
+
* />
|
|
104
|
+
* ```
|
|
105
|
+
*/])), semantic.typography.body, semantic.color.text.muted, semantic.space[100]);
|
|
106
|
+
/**
|
|
107
|
+
* Slider component for single value or range selection
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```tsx
|
|
111
|
+
* // Single value slider
|
|
112
|
+
* <Slider
|
|
113
|
+
* label="Volume"
|
|
114
|
+
* min={0}
|
|
115
|
+
* max={100}
|
|
116
|
+
* value={50}
|
|
117
|
+
* onChange={(value) => console.log(value)}
|
|
118
|
+
* />
|
|
119
|
+
*
|
|
120
|
+
* // Range slider
|
|
121
|
+
* <Slider
|
|
122
|
+
* label="Budget Range"
|
|
123
|
+
* min={0}
|
|
124
|
+
* max={1000}
|
|
125
|
+
* rangeValue={[200, 800]}
|
|
126
|
+
* onRangeChange={(values) => console.log(values)}
|
|
127
|
+
* />
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
var Slider = function Slider(_a) {
|
|
131
|
+
var _b = _a.min,
|
|
132
|
+
min = _b === void 0 ? 0 : _b,
|
|
133
|
+
_c = _a.max,
|
|
134
|
+
max = _c === void 0 ? 100 : _c,
|
|
135
|
+
_d = _a.step,
|
|
136
|
+
step = _d === void 0 ? 1 : _d,
|
|
137
|
+
controlledValue = _a.value,
|
|
138
|
+
defaultValue = _a.defaultValue,
|
|
139
|
+
controlledRangeValue = _a.rangeValue,
|
|
140
|
+
defaultRangeValue = _a.defaultRangeValue,
|
|
141
|
+
onChange = _a.onChange,
|
|
142
|
+
onRangeChange = _a.onRangeChange,
|
|
143
|
+
_e = _a.disabled,
|
|
144
|
+
disabled = _e === void 0 ? false : _e,
|
|
145
|
+
label = _a.label,
|
|
146
|
+
_f = _a.showValueLabel,
|
|
147
|
+
showValueLabel = _f === void 0 ? true : _f,
|
|
148
|
+
_g = _a.formatValue,
|
|
149
|
+
formatValue = _g === void 0 ? function (val) {
|
|
150
|
+
return val.toString();
|
|
151
|
+
} : _g,
|
|
152
|
+
dataTestId = _a["data-testid"],
|
|
153
|
+
ariaLabel = _a["aria-label"],
|
|
154
|
+
ariaDescribedBy = _a["aria-describedby"];
|
|
155
|
+
var generatedId = useId();
|
|
156
|
+
var trackRef = useRef(null);
|
|
157
|
+
var _h = useState(null),
|
|
158
|
+
activeThumb = _h[0],
|
|
159
|
+
setActiveThumb = _h[1];
|
|
160
|
+
// Removes the document listeners of a drag in progress
|
|
161
|
+
var endDragRef = useRef(null);
|
|
162
|
+
useEffect(function () {
|
|
163
|
+
return function () {
|
|
164
|
+
var _a;
|
|
165
|
+
return (_a = endDragRef.current) === null || _a === void 0 ? void 0 : _a.call(endDragRef);
|
|
166
|
+
};
|
|
167
|
+
}, []);
|
|
168
|
+
// Determine if this is a range slider
|
|
169
|
+
var isRange = controlledRangeValue !== undefined || defaultRangeValue !== undefined || onRangeChange !== undefined;
|
|
170
|
+
// State for single slider
|
|
171
|
+
var _j = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : min),
|
|
172
|
+
internalValue = _j[0],
|
|
173
|
+
setInternalValue = _j[1];
|
|
174
|
+
var currentValue = controlledValue !== null && controlledValue !== void 0 ? controlledValue : internalValue;
|
|
175
|
+
// State for range slider
|
|
176
|
+
var _k = useState(defaultRangeValue !== null && defaultRangeValue !== void 0 ? defaultRangeValue : [min, min + (max - min) / 4]),
|
|
177
|
+
internalRangeValue = _k[0],
|
|
178
|
+
setInternalRangeValue = _k[1];
|
|
179
|
+
var currentRangeValue = controlledRangeValue !== null && controlledRangeValue !== void 0 ? controlledRangeValue : internalRangeValue;
|
|
180
|
+
// Clamp value to min/max and nearest step
|
|
181
|
+
var clampValue = function clampValue(val) {
|
|
182
|
+
var clamped = Math.max(min, Math.min(max, val));
|
|
183
|
+
var stepped = Math.round((clamped - min) / step) * step + min;
|
|
184
|
+
return Math.min(max, stepped);
|
|
185
|
+
};
|
|
186
|
+
// Convert pixel position to value
|
|
187
|
+
var positionToValue = function positionToValue(clientX) {
|
|
188
|
+
if (!trackRef.current) return min;
|
|
189
|
+
var rect = trackRef.current.getBoundingClientRect();
|
|
190
|
+
var percent = (clientX - rect.left) / rect.width;
|
|
191
|
+
var rawValue = min + percent * (max - min);
|
|
192
|
+
return clampValue(rawValue);
|
|
193
|
+
};
|
|
194
|
+
// Convert value to percentage for positioning
|
|
195
|
+
var valueToPercent = function valueToPercent(val) {
|
|
196
|
+
return (val - min) / (max - min) * 100;
|
|
197
|
+
};
|
|
198
|
+
// Handle single slider change
|
|
199
|
+
var handleSingleChange = function handleSingleChange(newValue) {
|
|
200
|
+
var clampedValue = clampValue(newValue);
|
|
201
|
+
setInternalValue(clampedValue);
|
|
202
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(clampedValue);
|
|
203
|
+
};
|
|
204
|
+
// Handle range slider change
|
|
205
|
+
var handleRangeChange = function handleRangeChange(newMin, newMax) {
|
|
206
|
+
var clampedMin = clampValue(newMin);
|
|
207
|
+
var clampedMax = clampValue(newMax);
|
|
208
|
+
// Ensure min <= max
|
|
209
|
+
var orderedMin = Math.min(clampedMin, clampedMax);
|
|
210
|
+
var orderedMax = Math.max(clampedMin, clampedMax);
|
|
211
|
+
setInternalRangeValue([orderedMin, orderedMax]);
|
|
212
|
+
onRangeChange === null || onRangeChange === void 0 ? void 0 : onRangeChange([orderedMin, orderedMax]);
|
|
213
|
+
};
|
|
214
|
+
// Pointer handlers: mouse, touch and pen
|
|
215
|
+
var handleTrackClick = function handleTrackClick(event) {
|
|
216
|
+
if (disabled) return;
|
|
217
|
+
// A click on a thumb (or the end of a drag) leaves the value where the thumb put it
|
|
218
|
+
if (event.target.closest('[role="slider"]')) return;
|
|
219
|
+
var newValue = positionToValue(event.clientX);
|
|
220
|
+
if (isRange) {
|
|
221
|
+
var minVal = currentRangeValue[0],
|
|
222
|
+
maxVal = currentRangeValue[1];
|
|
223
|
+
var distToMin = Math.abs(newValue - minVal);
|
|
224
|
+
var distToMax = Math.abs(newValue - maxVal);
|
|
225
|
+
if (distToMin < distToMax) {
|
|
226
|
+
handleRangeChange(newValue, maxVal);
|
|
227
|
+
} else {
|
|
228
|
+
handleRangeChange(minVal, newValue);
|
|
229
|
+
}
|
|
230
|
+
} else {
|
|
231
|
+
handleSingleChange(newValue);
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
var handleThumbPointerDown = function handleThumbPointerDown(thumb, event) {
|
|
235
|
+
var _a, _b, _c;
|
|
236
|
+
if (disabled) return;
|
|
237
|
+
// Only the primary button drags; a touch or pen contact always counts
|
|
238
|
+
if (event.pointerType === 'mouse' && event.button !== 0) return;
|
|
239
|
+
event.preventDefault();
|
|
240
|
+
(_a = endDragRef.current) === null || _a === void 0 ? void 0 : _a.call(endDragRef);
|
|
241
|
+
setActiveThumb(thumb);
|
|
242
|
+
var pointerId = event.pointerId;
|
|
243
|
+
// Capture keeps the drag on this thumb when the pointer leaves it, or the window
|
|
244
|
+
(_c = (_b = event.currentTarget).setPointerCapture) === null || _c === void 0 ? void 0 : _c.call(_b, pointerId);
|
|
245
|
+
var handlePointerMove = function handlePointerMove(e) {
|
|
246
|
+
if (e.pointerId !== pointerId) return;
|
|
247
|
+
var newValue = positionToValue(e.clientX);
|
|
248
|
+
if (isRange) {
|
|
249
|
+
var minVal = currentRangeValue[0],
|
|
250
|
+
maxVal = currentRangeValue[1];
|
|
251
|
+
if (thumb === 'min') {
|
|
252
|
+
handleRangeChange(newValue, maxVal);
|
|
253
|
+
} else {
|
|
254
|
+
handleRangeChange(minVal, newValue);
|
|
255
|
+
}
|
|
256
|
+
} else {
|
|
257
|
+
handleSingleChange(newValue);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
var endDrag = function endDrag() {
|
|
261
|
+
setActiveThumb(null);
|
|
262
|
+
document.removeEventListener('pointermove', handlePointerMove);
|
|
263
|
+
document.removeEventListener('pointerup', handlePointerEnd);
|
|
264
|
+
document.removeEventListener('pointercancel', handlePointerEnd);
|
|
265
|
+
endDragRef.current = null;
|
|
266
|
+
};
|
|
267
|
+
// pointercancel fires when the browser takes the gesture over, so it ends the drag too
|
|
268
|
+
var handlePointerEnd = function handlePointerEnd(e) {
|
|
269
|
+
if (e.pointerId === pointerId) endDrag();
|
|
270
|
+
};
|
|
271
|
+
document.addEventListener('pointermove', handlePointerMove);
|
|
272
|
+
document.addEventListener('pointerup', handlePointerEnd);
|
|
273
|
+
document.addEventListener('pointercancel', handlePointerEnd);
|
|
274
|
+
endDragRef.current = endDrag;
|
|
275
|
+
};
|
|
276
|
+
// Keyboard navigation
|
|
277
|
+
var handleKeyDown = function handleKeyDown(thumb) {
|
|
278
|
+
return function (event) {
|
|
279
|
+
if (disabled) return;
|
|
280
|
+
var valueChange = 0;
|
|
281
|
+
switch (event.key) {
|
|
282
|
+
case 'ArrowRight':
|
|
283
|
+
case 'ArrowUp':
|
|
284
|
+
valueChange = step;
|
|
285
|
+
event.preventDefault();
|
|
286
|
+
break;
|
|
287
|
+
case 'ArrowLeft':
|
|
288
|
+
case 'ArrowDown':
|
|
289
|
+
valueChange = -step;
|
|
290
|
+
event.preventDefault();
|
|
291
|
+
break;
|
|
292
|
+
case 'PageUp':
|
|
293
|
+
valueChange = step * 10;
|
|
294
|
+
event.preventDefault();
|
|
295
|
+
break;
|
|
296
|
+
case 'PageDown':
|
|
297
|
+
valueChange = -step * 10;
|
|
298
|
+
event.preventDefault();
|
|
299
|
+
break;
|
|
300
|
+
case 'Home':
|
|
301
|
+
if (isRange) {
|
|
302
|
+
var minVal = currentRangeValue[0],
|
|
303
|
+
maxVal = currentRangeValue[1];
|
|
304
|
+
if (thumb === 'min') {
|
|
305
|
+
handleRangeChange(min, maxVal);
|
|
306
|
+
} else {
|
|
307
|
+
handleRangeChange(minVal, min);
|
|
308
|
+
}
|
|
309
|
+
} else {
|
|
310
|
+
handleSingleChange(min);
|
|
311
|
+
}
|
|
312
|
+
event.preventDefault();
|
|
313
|
+
return;
|
|
314
|
+
case 'End':
|
|
315
|
+
if (isRange) {
|
|
316
|
+
var minVal = currentRangeValue[0],
|
|
317
|
+
maxVal = currentRangeValue[1];
|
|
318
|
+
if (thumb === 'min') {
|
|
319
|
+
handleRangeChange(max, maxVal);
|
|
320
|
+
} else {
|
|
321
|
+
handleRangeChange(minVal, max);
|
|
322
|
+
}
|
|
323
|
+
} else {
|
|
324
|
+
handleSingleChange(max);
|
|
325
|
+
}
|
|
326
|
+
event.preventDefault();
|
|
327
|
+
return;
|
|
328
|
+
default:
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (isRange) {
|
|
332
|
+
var minVal = currentRangeValue[0],
|
|
333
|
+
maxVal = currentRangeValue[1];
|
|
334
|
+
if (thumb === 'min') {
|
|
335
|
+
handleRangeChange(minVal + valueChange, maxVal);
|
|
336
|
+
} else {
|
|
337
|
+
handleRangeChange(minVal, maxVal + valueChange);
|
|
338
|
+
}
|
|
339
|
+
} else {
|
|
340
|
+
handleSingleChange(currentValue + valueChange);
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
// Calculate positions
|
|
345
|
+
var singlePercent = valueToPercent(currentValue);
|
|
346
|
+
var _l = [valueToPercent(currentRangeValue[0]), valueToPercent(currentRangeValue[1])],
|
|
347
|
+
minPercent = _l[0],
|
|
348
|
+
maxPercent = _l[1];
|
|
349
|
+
return jsxs(StyledSliderContainer, {
|
|
350
|
+
"data-testid": dataTestId,
|
|
351
|
+
children: [label && jsx(StyledLabel, {
|
|
352
|
+
htmlFor: generatedId,
|
|
353
|
+
"$disabled": disabled,
|
|
354
|
+
children: label
|
|
355
|
+
}), jsx(StyledSliderTrackContainer, {
|
|
356
|
+
children: jsxs(StyledTrack, {
|
|
357
|
+
ref: trackRef,
|
|
358
|
+
onClick: handleTrackClick,
|
|
359
|
+
"$disabled": disabled,
|
|
360
|
+
children: [isRange ? jsx(StyledTrackFill, {
|
|
361
|
+
"$disabled": disabled,
|
|
362
|
+
style: {
|
|
363
|
+
left: "".concat(minPercent, "%"),
|
|
364
|
+
width: "".concat(maxPercent - minPercent, "%")
|
|
365
|
+
}
|
|
366
|
+
}) : jsx(StyledTrackFill, {
|
|
367
|
+
"$disabled": disabled,
|
|
368
|
+
style: {
|
|
369
|
+
left: 0,
|
|
370
|
+
width: "".concat(singlePercent, "%")
|
|
371
|
+
}
|
|
372
|
+
}), isRange ? jsxs(Fragment, {
|
|
373
|
+
children: [jsx(StyledThumb, {
|
|
374
|
+
role: "slider",
|
|
375
|
+
tabIndex: disabled ? -1 : 0,
|
|
376
|
+
"aria-label": ariaLabel ? "".concat(ariaLabel, " minimum") : 'Minimum value',
|
|
377
|
+
"aria-valuemin": min,
|
|
378
|
+
"aria-valuemax": max,
|
|
379
|
+
"aria-valuenow": currentRangeValue[0],
|
|
380
|
+
"aria-valuetext": formatValue(currentRangeValue[0]),
|
|
381
|
+
"aria-disabled": disabled,
|
|
382
|
+
"aria-describedby": ariaDescribedBy,
|
|
383
|
+
"$disabled": disabled,
|
|
384
|
+
"$active": activeThumb === 'min',
|
|
385
|
+
"$range": "min",
|
|
386
|
+
style: {
|
|
387
|
+
left: "".concat(minPercent, "%"),
|
|
388
|
+
'--slider-reach': "".concat((maxPercent - minPercent) / 2, "cqw")
|
|
389
|
+
},
|
|
390
|
+
onPointerDown: function onPointerDown(event) {
|
|
391
|
+
return handleThumbPointerDown('min', event);
|
|
392
|
+
},
|
|
393
|
+
onKeyDown: handleKeyDown('min'),
|
|
394
|
+
children: showValueLabel && jsx(StyledValueLabel, {
|
|
395
|
+
"$disabled": disabled,
|
|
396
|
+
children: formatValue(currentRangeValue[0])
|
|
397
|
+
})
|
|
398
|
+
}), jsx(StyledThumb, {
|
|
399
|
+
role: "slider",
|
|
400
|
+
tabIndex: disabled ? -1 : 0,
|
|
401
|
+
"aria-label": ariaLabel ? "".concat(ariaLabel, " maximum") : 'Maximum value',
|
|
402
|
+
"aria-valuemin": min,
|
|
403
|
+
"aria-valuemax": max,
|
|
404
|
+
"aria-valuenow": currentRangeValue[1],
|
|
405
|
+
"aria-valuetext": formatValue(currentRangeValue[1]),
|
|
406
|
+
"aria-disabled": disabled,
|
|
407
|
+
"aria-describedby": ariaDescribedBy,
|
|
408
|
+
"$disabled": disabled,
|
|
409
|
+
"$active": activeThumb === 'max',
|
|
410
|
+
"$range": "max",
|
|
411
|
+
style: {
|
|
412
|
+
left: "".concat(maxPercent, "%"),
|
|
413
|
+
'--slider-reach': "".concat((maxPercent - minPercent) / 2, "cqw")
|
|
414
|
+
},
|
|
415
|
+
onPointerDown: function onPointerDown(event) {
|
|
416
|
+
return handleThumbPointerDown('max', event);
|
|
417
|
+
},
|
|
418
|
+
onKeyDown: handleKeyDown('max'),
|
|
419
|
+
children: showValueLabel && jsx(StyledValueLabel, {
|
|
420
|
+
"$disabled": disabled,
|
|
421
|
+
children: formatValue(currentRangeValue[1])
|
|
422
|
+
})
|
|
423
|
+
})]
|
|
424
|
+
}) : jsx(StyledThumb, {
|
|
425
|
+
role: "slider",
|
|
426
|
+
tabIndex: disabled ? -1 : 0,
|
|
427
|
+
"aria-label": ariaLabel || label || 'Slider value',
|
|
428
|
+
"aria-valuemin": min,
|
|
429
|
+
"aria-valuemax": max,
|
|
430
|
+
"aria-valuenow": currentValue,
|
|
431
|
+
"aria-valuetext": formatValue(currentValue),
|
|
432
|
+
"aria-disabled": disabled,
|
|
433
|
+
"aria-describedby": ariaDescribedBy,
|
|
434
|
+
"$disabled": disabled,
|
|
435
|
+
"$active": activeThumb === 'single',
|
|
436
|
+
style: {
|
|
437
|
+
left: "".concat(singlePercent, "%")
|
|
438
|
+
},
|
|
439
|
+
onPointerDown: function onPointerDown(event) {
|
|
440
|
+
return handleThumbPointerDown('single', event);
|
|
441
|
+
},
|
|
442
|
+
onKeyDown: handleKeyDown('single'),
|
|
443
|
+
children: showValueLabel && jsx(StyledValueLabel, {
|
|
444
|
+
"$disabled": disabled,
|
|
445
|
+
children: formatValue(currentValue)
|
|
446
|
+
})
|
|
447
|
+
})]
|
|
448
|
+
})
|
|
449
|
+
}), jsxs(StyledMinMaxLabels, {
|
|
450
|
+
children: [jsx("span", {
|
|
451
|
+
children: formatValue(min)
|
|
452
|
+
}), jsx("span", {
|
|
453
|
+
children: formatValue(max)
|
|
454
|
+
})]
|
|
455
|
+
})]
|
|
456
|
+
});
|
|
457
|
+
};
|
|
458
|
+
Slider.displayName = 'Slider';
|
|
459
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|
|
460
|
+
|
|
461
|
+
export { Slider };
|
|
462
|
+
//# sourceMappingURL=Slider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slider.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tab variant options for TabBar.
|
|
3
|
+
* @deprecated TabBar has one look, `underline` (decision 0020). `'default'` and `'pills'` render
|
|
4
|
+
* as `underline`. The type is removed in 3.0.
|
|
5
|
+
*/
|
|
6
|
+
export type TabVariant = 'default' | 'pills' | 'underline';
|
|
7
|
+
/**
|
|
8
|
+
* Individual tab configuration
|
|
9
|
+
*/
|
|
10
|
+
export interface Tab {
|
|
11
|
+
/**
|
|
12
|
+
* Unique identifier for the tab
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
/**
|
|
16
|
+
* Tab label text
|
|
17
|
+
*/
|
|
18
|
+
label: string;
|
|
19
|
+
/**
|
|
20
|
+
* Optional badge count to display
|
|
21
|
+
*/
|
|
22
|
+
badge?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Whether this tab is disabled
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Props for the TabBar component
|
|
31
|
+
*/
|
|
32
|
+
export interface TabBarProps {
|
|
33
|
+
/**
|
|
34
|
+
* Array of tab configurations
|
|
35
|
+
*/
|
|
36
|
+
tabs: Tab[];
|
|
37
|
+
/**
|
|
38
|
+
* Currently active tab ID
|
|
39
|
+
*/
|
|
40
|
+
activeTab: string;
|
|
41
|
+
/**
|
|
42
|
+
* Callback when tab changes
|
|
43
|
+
*/
|
|
44
|
+
onTabChange: (tabId: string) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Visual variant of the tabs.
|
|
47
|
+
* @deprecated TabBar has one look, `underline` (decision 0020). `'default'` and `'pills'` render
|
|
48
|
+
* as `underline`. Remove the prop; it is removed in 3.0.
|
|
49
|
+
* @default 'underline'
|
|
50
|
+
*/
|
|
51
|
+
variant?: TabVariant;
|
|
52
|
+
/**
|
|
53
|
+
* Accessible label for the tab list
|
|
54
|
+
*/
|
|
55
|
+
'aria-label'?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Test identifier for automated testing
|
|
58
|
+
*/
|
|
59
|
+
'data-testid'?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* TabBar component for tabbed navigation
|
|
63
|
+
*
|
|
64
|
+
* Provides accessible tab navigation with an underline style, keyboard support,
|
|
65
|
+
* and optional badge counts. Follows ARIA tablist pattern.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```tsx
|
|
69
|
+
* const [activeTab, setActiveTab] = useState('all')
|
|
70
|
+
*
|
|
71
|
+
* <TabBar
|
|
72
|
+
* tabs={[
|
|
73
|
+
* { id: 'all', label: 'All', badge: 42 },
|
|
74
|
+
* { id: 'pending', label: 'Pending', badge: 5 },
|
|
75
|
+
* { id: 'completed', label: 'Completed' }
|
|
76
|
+
* ]}
|
|
77
|
+
* activeTab={activeTab}
|
|
78
|
+
* onTabChange={setActiveTab}
|
|
79
|
+
* />
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export declare const TabBar: React.FC<TabBarProps>;
|