@stokr/components-library 4.2.5 → 5.0.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/README.md +147 -118
- package/dist/components/AdminDashboard/Table/Table.styles.d.ts +110 -0
- package/dist/components/AdminDashboard/Table/Table.styles.js +21 -20
- package/dist/components/AgreementItem/AgreementItem.styles.js +1 -1
- package/dist/components/BackButton/BackButton.styles.d.ts +24 -0
- package/dist/components/BackButton/BackButton.styles.js +15 -16
- package/dist/components/Background/Background.styles.d.ts +30 -0
- package/dist/components/Background/Background.styles.js +3 -3
- package/dist/components/BasicTable/BasicTable.d.ts +14 -0
- package/dist/components/BasicTable/BasicTable.js +0 -10
- package/dist/components/BasicTable/BasicTable.styles.d.ts +22 -0
- package/dist/components/BasicTable/BasicTable.styles.js +6 -7
- package/dist/components/BlogPost/BlogPost.js +3 -3
- package/dist/components/BlogPost/BlogPost.styles.d.ts +67 -0
- package/dist/components/BlogPost/BlogPost.styles.js +14 -20
- package/dist/components/Button/Button.styles.d.ts +12 -8
- package/dist/components/Button/Button.styles.js +131 -115
- package/dist/components/Button/GlareButton.d.ts +31 -0
- package/dist/components/Button/GlareButton.js +4 -22
- package/dist/components/Card/Card.styles.d.ts +30 -0
- package/dist/components/Card/Card.styles.js +3 -4
- package/dist/components/CardTabs/CardTabs.styles.js +26 -29
- package/dist/components/ChartLegend/ChartLegend.styles.d.ts +46 -0
- package/dist/components/ChartLegend/ChartLegend.styles.js +4 -5
- package/dist/components/Checkbox/Checkbox.styles.d.ts +0 -1
- package/dist/components/Checkbox/Checkbox.styles.js +10 -12
- package/dist/components/Checklist/ChecklistCard.d.ts +18 -0
- package/dist/components/Checklist/ChecklistCard.js +4 -17
- package/dist/components/Checklist/ChecklistCard.styles.d.ts +17 -0
- package/dist/components/Checklist/ChecklistCard.styles.js +7 -7
- package/dist/components/Chips/Chip.d.ts +18 -0
- package/dist/components/Chips/Chip.js +4 -20
- package/dist/components/Chips/Chip.styles.d.ts +23 -0
- package/dist/components/Chips/Chip.styles.js +3 -6
- package/dist/components/Chips/ChipWrapper.js +2 -2
- package/dist/components/Collapsible/Collapsible.d.ts +4 -10
- package/dist/components/Collapsible/Collapsible.js +14 -6
- package/dist/components/Collapsible/Collapsible.styles.d.ts +1 -3
- package/dist/components/Collapsible/Collapsible.styles.js +19 -36
- package/dist/components/ComponentScroll/ComponentScroll.js +2 -1
- package/dist/components/ComponentScroll/ComponentScroll.styles.d.ts +34 -0
- package/dist/components/ComponentScroll/ComponentScroll.styles.js +15 -12
- package/dist/components/ComponentWrapper/ComponentWrapper.styles.js +11 -13
- package/dist/components/ConfirmModal/ConfirmModal.styles.d.ts +18 -0
- package/dist/components/ConfirmModal/ConfirmModal.styles.js +6 -7
- package/dist/components/Country/CountrySelect.js +20 -15
- package/dist/components/CryptoAddress/ComponentWrap.d.ts +9 -0
- package/dist/components/CryptoAddress/ComponentWrap.js +7 -10
- package/dist/components/CryptoAddress/CryptoAddress.d.ts +45 -0
- package/dist/components/CryptoAddress/CryptoAddress.js +9 -41
- package/dist/components/CryptoAddress/CryptoAddress.styles.d.ts +85 -0
- package/dist/components/CryptoAddress/CryptoAddress.styles.js +21 -22
- package/dist/components/CryptoAddress/RadioWrap.d.ts +21 -0
- package/dist/components/CryptoAddress/RadioWrap.js +1 -16
- package/dist/components/CryptoAddressWrapper/CryptoAddressWrapper.styles.d.ts +30 -0
- package/dist/components/CryptoAddressWrapper/CryptoAddressWrapper.styles.js +19 -11
- package/dist/components/DisplayOnBreakpoint/DisplayOnBreakpoint.d.ts +12 -0
- package/dist/components/DisplayOnBreakpoint/DisplayOnBreakpoint.js +28 -0
- package/dist/components/FAQ/FAQ.js +18 -18
- package/dist/components/FAQ/FAQ.styles.d.ts +5 -12
- package/dist/components/FAQ/FAQ.styles.js +3 -61
- package/dist/components/Form/Form.styles.d.ts +22 -0
- package/dist/components/Form/Form.styles.js +7 -8
- package/dist/components/Grid/Grid.styles.d.ts +49 -0
- package/dist/components/Grid/Grid.styles.js +37 -40
- package/dist/components/IdentityInfo/IdentityInfo.js +1 -2
- package/dist/components/IdentityInfo/IdentityInfo.styles.d.ts +24 -0
- package/dist/components/IdentityInfo/IdentityInfo.styles.js +6 -9
- package/dist/components/InfoBox/InfoBox.d.ts +20 -0
- package/dist/components/InfoBox/InfoBox.js +24 -78
- package/dist/components/InfoIcon/InfoIcon.styles.js +2 -3
- package/dist/components/Input/DatePickerInput.d.ts +24 -0
- package/dist/components/Input/DatePickerInput.js +2 -13
- package/dist/components/Input/DatePickerInput.styles.d.ts +18 -0
- package/dist/components/Input/DatePickerInput.styles.js +27 -24
- package/dist/components/Input/Input.d.ts +0 -3
- package/dist/components/Input/Input.js +3 -5
- package/dist/components/Input/Input.styles.d.ts +1 -4
- package/dist/components/Input/Input.styles.js +24 -77
- package/dist/components/Input/InputPassword.styles.d.ts +32 -0
- package/dist/components/Input/InputPassword.styles.js +11 -12
- package/dist/components/Input/InputWithButton.styles.d.ts +14 -0
- package/dist/components/Input/InputWithButton.styles.js +5 -6
- package/dist/components/Input/MultiSelect.d.ts +60 -0
- package/dist/components/Input/MultiSelect.js +20 -52
- package/dist/components/Input/OtpInput.d.ts +17 -0
- package/dist/components/Input/OtpInput.js +8 -15
- package/dist/components/Input/RangeInput.d.ts +14 -0
- package/dist/components/Input/RangeInput.js +2 -17
- package/dist/components/Input/SearchInput.styles.d.ts +15 -0
- package/dist/components/Input/SearchInput.styles.js +10 -11
- package/dist/components/Input/Select.js +156 -80
- package/dist/components/Input/Select.styles.js +16 -118
- package/dist/components/Input/TableFilterDropdown.d.ts +33 -0
- package/dist/components/Input/TableFilterDropdown.js +6 -39
- package/dist/components/Input/Textarea.styles.d.ts +9 -0
- package/dist/components/Input/Textarea.styles.js +9 -10
- package/dist/components/MaterialIcon/MaterialIcon.d.ts +17 -7
- package/dist/components/MaterialIcon/MaterialIcon.js +14 -3
- package/dist/components/MaterialIcon/requiredIcons.d.ts +1 -1
- package/dist/components/MaterialIcon/requiredIcons.js +0 -2
- package/dist/components/MenuNav/MenuNav.styles.d.ts +6 -0
- package/dist/components/MenuNav/MenuNav.styles.js +3 -0
- package/dist/components/Modal/Modal.styles.js +35 -36
- package/dist/components/Modal/PaymentModal.d.ts +55 -0
- package/dist/components/Modal/PaymentModal.js +11 -13
- package/dist/components/Modal/SideModal.styles.js +13 -14
- package/dist/components/Modal/SideModalParts.js +18 -20
- package/dist/components/Modal/SuccessModal/SuccessModal.styles.d.ts +15 -0
- package/dist/components/Modal/SuccessModal/SuccessModal.styles.js +3 -4
- package/dist/components/NotificationCounter/NotificationCounter.styles.d.ts +8 -0
- package/dist/components/NotificationCounter/NotificationCounter.styles.js +2 -3
- package/dist/components/Number/Number.js +1 -1
- package/dist/components/Number/Number.styles.d.ts +4 -0
- package/dist/components/Number/Number.styles.js +2 -3
- package/dist/components/Pagination/Pagination.styles.d.ts +15 -0
- package/dist/components/Pagination/Pagination.styles.js +12 -11
- package/dist/components/Payment/DetailRows.d.ts +14 -0
- package/dist/components/Payment/DetailRows.js +1 -2
- package/dist/components/Payment/DetailsToggle.d.ts +23 -0
- package/dist/components/Payment/DetailsToggle.js +12 -4
- package/dist/components/Payment/PaymentDetailsCard.d.ts +95 -0
- package/dist/components/Payment/PaymentDetailsCard.js +32 -23
- package/dist/components/Payment/PaymentDisplay.d.ts +59 -0
- package/dist/components/Payment/PaymentDisplay.js +18 -11
- package/dist/components/Payment/PaymentPendingCard.d.ts +39 -0
- package/dist/components/Payment/PaymentPendingCard.js +13 -13
- package/dist/components/Payment/PaymentSuccessCard.d.ts +41 -0
- package/dist/components/Payment/PaymentSuccessCard.js +27 -11
- package/dist/components/Payment/TimerComponent.d.ts +26 -0
- package/dist/components/Payment/TimerComponent.js +6 -7
- package/dist/components/Process/Process.styles.d.ts +11 -0
- package/dist/components/Process/Process.styles.js +22 -19
- package/dist/components/ProfileBadge/ProfileBadge.d.ts +13 -0
- package/dist/components/ProfileBadge/ProfileBadge.js +14 -15
- package/dist/components/ProfileBadge/ProfileBadge.styles.d.ts +10 -0
- package/dist/components/ProfileBadge/ProfileBadge.styles.js +8 -9
- package/dist/components/ProfileBox/ProfileBox.js +3 -3
- package/dist/components/ProfileBox/ProfileBox.styles.d.ts +22 -0
- package/dist/components/ProfileBox/ProfileBox.styles.js +18 -7
- package/dist/components/Radio/Radio.styles.d.ts +23 -0
- package/dist/components/Radio/Radio.styles.js +19 -11
- package/dist/components/RefreshButton/RefreshButton.styles.d.ts +29 -0
- package/dist/components/RefreshButton/RefreshButton.styles.js +5 -6
- package/dist/components/RequestDataBox/RequestDataBox.styles.d.ts +9 -0
- package/dist/components/RequestDataBox/RequestDataBox.styles.js +4 -5
- package/dist/components/Section/Section.d.ts +1 -1
- package/dist/components/Section/Section.js +4 -3
- package/dist/components/Section/Section.styles.d.ts +5 -0
- package/dist/components/Section/Section.styles.js +31 -36
- package/dist/components/SectionTitle/SectionTitle.styles.js +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts +4 -2
- package/dist/components/Skeleton/Skeleton.js +8 -8
- package/dist/components/SmartLink/SmartLink.js +2 -2
- package/dist/components/Snackbar/Snackbar.styles.d.ts +28 -0
- package/dist/components/Snackbar/Snackbar.styles.js +10 -29
- package/dist/components/SpanButton/SpanButton.styles.js +2 -2
- package/dist/components/StatusDot/StatusDot.d.ts +29 -0
- package/dist/components/StatusDot/StatusDot.js +17 -23
- package/dist/components/StatusDot/StatusDot.styles.d.ts +20 -0
- package/dist/components/StatusTag/StatusTag.d.ts +35 -0
- package/dist/components/StatusTag/StatusTag.js +9 -38
- package/dist/components/StatusTag/StatusTag.styles.d.ts +28 -0
- package/dist/components/StatusTag/StatusTag.styles.js +6 -6
- package/dist/components/StepController/StepController.styles.d.ts +23 -0
- package/dist/components/StepController/StepController.styles.js +12 -14
- package/dist/components/StokrLoader/StokrLoader.d.ts +9 -1
- package/dist/components/StokrLoader/StokrLoader.js +50 -19
- package/dist/components/SvgIcons/AdminBadgeSvg.js +1 -0
- package/dist/components/SvgIcons/CapsLockSvg.js +1 -0
- package/dist/components/SvgIcons/LogoSvg.js +1 -11
- package/dist/components/SvgIcons/RefreshSvg.js +1 -0
- package/dist/components/SvgIcons/VerifiedBadge.js +2 -4
- package/dist/components/Switch/Switch.styles.d.ts +20 -0
- package/dist/components/Switch/Switch.styles.js +10 -11
- package/dist/components/Tabs/Tabs.js +2 -2
- package/dist/components/TabsNav/TabsNav.styles.d.ts +25 -0
- package/dist/components/TabsNav/TabsNav.styles.js +8 -9
- package/dist/components/TaxResidenceCard/TaxResidenceCard.js +11 -27
- package/dist/components/TaxResidenceCard/TaxResidenceCard.styles.d.ts +57 -0
- package/dist/components/TaxResidenceCard/TaxResidenceCard.styles.js +25 -107
- package/dist/components/Text/Text.styles.d.ts +17 -1
- package/dist/components/Text/Text.styles.js +50 -25
- package/dist/components/TextLink/TextLink.styles.d.ts +16 -0
- package/dist/components/TextLink/TextLink.styles.js +4 -4
- package/dist/components/Timeline/Timeline.styles.d.ts +41 -0
- package/dist/components/Timeline/Timeline.styles.js +14 -15
- package/dist/components/Timeline/TimelineStep.js +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.js +2 -2
- package/dist/components/Tooltip/Tooltip.styles.js +2 -3
- package/dist/components/breakdown/Breakdown.d.ts +18 -0
- package/dist/components/breakdown/Breakdown.js +7 -7
- package/dist/components/logo/Logo.js +1 -1
- package/dist/design-system/css/base.css +74 -0
- package/dist/design-system/css/index.css +5 -0
- package/dist/design-system/fonts/Inter-LICENSE.txt +93 -0
- package/dist/design-system/fonts/inter-bitcoin-sign.woff2 +0 -0
- package/dist/design-system/fonts/inter-latin-ext.woff2 +0 -0
- package/dist/design-system/fonts/inter-latin.woff2 +0 -0
- package/dist/design-system/fonts/open-sans-latin-ext-italic.woff2 +0 -0
- package/dist/design-system/fonts/open-sans-latin-ext.woff2 +0 -0
- package/dist/design-system/fonts/open-sans-latin-italic.woff2 +0 -0
- package/dist/design-system/fonts/open-sans-latin.woff2 +0 -0
- package/dist/design-system/generated/fonts.css +296 -0
- package/dist/design-system/generated/text-classes.css +198 -0
- package/dist/design-system/generated/text-styles.d.ts +26 -0
- package/dist/design-system/generated/text-styles.js +179 -0
- package/dist/design-system/generated/tokens.css +429 -0
- package/dist/design-system/index.d.ts +9 -0
- package/dist/design-system/stories/foundations.d.ts +31 -0
- package/dist/design-system/stories/foundationsData.d.ts +18 -0
- package/dist/design-system/styled/breakpoint.d.ts +43 -0
- package/dist/design-system/styled/breakpoint.js +27 -0
- package/dist/design-system/styled/build-theme.d.ts +21 -0
- package/dist/design-system/styled/build-theme.js +27 -0
- package/dist/design-system/styled/text.d.ts +3 -0
- package/dist/design-system/styled/text.js +5 -0
- package/dist/design-system/styled/theme.d.ts +6 -0
- package/dist/design-system/tokens/breakpoints.d.ts +17 -0
- package/dist/design-system/tokens/breakpoints.js +16 -0
- package/dist/design-system/tokens/colors.d.ts +92 -0
- package/dist/design-system/tokens/colors.js +98 -0
- package/dist/design-system/tokens/fonts.d.ts +32 -0
- package/dist/design-system/tokens/fonts.js +49 -0
- package/dist/design-system/tokens/index.d.ts +6 -0
- package/dist/design-system/tokens/layout.d.ts +71 -0
- package/dist/design-system/tokens/layout.js +40 -0
- package/dist/design-system/tokens/semantic.d.ts +272 -0
- package/dist/design-system/tokens/semantic.js +76 -0
- package/dist/design-system/tokens/typography.d.ts +38 -0
- package/dist/design-system/tokens/typography.js +120 -0
- package/dist/hooks/useMediaQuery.d.ts +1 -1
- package/dist/index.d.ts +117 -120
- package/dist/index.js +50 -60
- package/dist/static/images/globe.svg.js +5 -0
- package/dist/static/images/numbers/number_eight.svg +1 -1
- package/dist/static/images/numbers/number_eight.svg.js +1 -1
- package/dist/static/images/numbers/number_five.svg +2 -2
- package/dist/static/images/numbers/number_five.svg.js +1 -1
- package/dist/static/images/numbers/number_four.svg +1 -1
- package/dist/static/images/numbers/number_four.svg.js +1 -1
- package/dist/static/images/numbers/number_nine.svg +2 -2
- package/dist/static/images/numbers/number_nine.svg.js +1 -1
- package/dist/static/images/numbers/number_one.svg +2 -2
- package/dist/static/images/numbers/number_one.svg.js +1 -1
- package/dist/static/images/numbers/number_seven.svg +2 -2
- package/dist/static/images/numbers/number_seven.svg.js +1 -1
- package/dist/static/images/numbers/number_six.svg +2 -2
- package/dist/static/images/numbers/number_six.svg.js +1 -1
- package/dist/static/images/numbers/number_three.svg +1 -1
- package/dist/static/images/numbers/number_three.svg.js +1 -1
- package/dist/static/images/numbers/number_two.svg +2 -2
- package/dist/static/images/numbers/number_two.svg.js +1 -1
- package/dist/static/images/numbers/number_zero.svg +1 -1
- package/dist/static/images/numbers/number_zero.svg.js +1 -1
- package/dist/static/images/trash.svg +17 -0
- package/dist/static/images/trash.svg.js +5 -0
- package/dist/utils/customHooks.d.ts +4 -4
- package/dist/utils/customHooks.js +6 -6
- package/package.json +16 -11
- package/dist/components/AddressItem/AddressItem.d.ts +0 -38
- package/dist/components/AddressItem/AddressItem.js +0 -51
- package/dist/components/AddressItem/AddressItem.styles.d.ts +0 -31
- package/dist/components/AddressItem/AddressItem.styles.js +0 -73
- package/dist/components/Country/FlagFor.d.ts +0 -9
- package/dist/components/Country/FlagFor.js +0 -25
- package/dist/components/Country/flagLoaders.d.ts +0 -5
- package/dist/components/Country/flagLoaders.js +0 -270
- package/dist/components/Country/flagStore.d.ts +0 -6
- package/dist/components/Country/flagStore.js +0 -29
- package/dist/components/FAQ/FAQ.d.ts +0 -29
- package/dist/components/Input/Select.d.ts +0 -57
- package/dist/components/Input/Select.styles.d.ts +0 -89
- package/dist/components/PanelCard/PanelCard.d.ts +0 -51
- package/dist/components/PanelCard/PanelCard.js +0 -35
- package/dist/components/PanelCard/PanelCard.styles.d.ts +0 -29
- package/dist/components/PanelCard/PanelCard.styles.js +0 -87
- package/dist/components/StepSidebar/MobileStepProgress.d.ts +0 -12
- package/dist/components/StepSidebar/MobileStepProgress.js +0 -14
- package/dist/components/StepSidebar/MobileStepProgress.styles.d.ts +0 -15
- package/dist/components/StepSidebar/MobileStepProgress.styles.js +0 -42
- package/dist/components/StepSidebar/StepProgress.d.ts +0 -14
- package/dist/components/StepSidebar/StepProgress.js +0 -14
- package/dist/components/StepSidebar/StepProgress.styles.d.ts +0 -30
- package/dist/components/StepSidebar/StepProgress.styles.js +0 -103
- package/dist/components/StepSidebar/StepSidebar.d.ts +0 -36
- package/dist/components/StepSidebar/StepSidebar.js +0 -58
- package/dist/components/StepSidebar/StepSidebar.styles.d.ts +0 -54
- package/dist/components/StepSidebar/StepSidebar.styles.js +0 -175
- package/dist/static/images/address-refreshing.gif.js +0 -4
- package/dist/static/images/process-waiting.gif.js +0 -4
- package/dist/styles/borderedField.d.ts +0 -11
- package/dist/styles/borderedField.js +0 -56
- package/dist/styles/colors.d.ts +0 -68
- package/dist/styles/colors.js +0 -69
- package/dist/styles/elevation.d.ts +0 -13
- package/dist/styles/elevation.js +0 -15
- package/dist/styles/global.js +0 -63
- package/dist/styles/rwd.d.ts +0 -55
- package/dist/styles/rwd.js +0 -79
- package/dist/styles/spacing.d.ts +0 -36
- package/dist/styles/spacing.js +0 -38
- package/dist/styles/theme.d.ts +0 -92
- package/dist/styles/theme.js +0 -36
- package/dist/styles/typography.d.ts +0 -42
- package/dist/styles/typography.js +0 -56
|
@@ -1,81 +1,103 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
3
|
import { Wrapper, Label } from "./Input.styles.js";
|
|
4
|
-
import { MaterialIcon } from "../MaterialIcon/MaterialIcon.js";
|
|
5
4
|
import { OptionCheckbox } from "../Checkbox/OptionCheckbox.js";
|
|
5
|
+
import { useState, useMemo, useRef, useEffect } from "react";
|
|
6
6
|
import CreatableSelect from "react-select/creatable";
|
|
7
7
|
import ReactSelect, { components } from "react-select";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import { borderedControlCss, SelectMenu, SelectedChipsWrapper, SelectedChipsTitle, SelectedChipsList, SelectedChip, SelectedChipLabel, SelectedChipRemove, SelectOption, OptionRow, OptionLabel, SelectMenuList, SelectIcon, SelectContainer, SelectControl, OptionIcon } from "./Select.styles.js";
|
|
12
|
-
import { SelectValueContainer, SelectWrapper } from "./Select.styles.js";
|
|
13
|
-
const renderIcon = (icon, variant) => {
|
|
8
|
+
import { SelectContainer, SelectControl, SelectedChipsWrapper, SelectedChipsTitle, SelectedChipsList, SelectedChip, SelectedChipLabel, SelectedChipRemove, OptionRow, OptionLabel, SelectMenuList, SelectIcon, OptionIcon } from "./Select.styles.js";
|
|
9
|
+
import { SelectMenu, SelectOption, SelectValueContainer, SelectWrapper } from "./Select.styles.js";
|
|
10
|
+
const renderIcon = (icon) => {
|
|
14
11
|
if (!icon) return null;
|
|
15
12
|
if (typeof icon === "string") {
|
|
16
|
-
return /* @__PURE__ */ jsx(OptionIcon, {
|
|
13
|
+
return /* @__PURE__ */ jsx(OptionIcon, { children: /* @__PURE__ */ jsx("img", { src: icon, alt: "" }) });
|
|
17
14
|
}
|
|
18
|
-
return /* @__PURE__ */ jsx(OptionIcon, {
|
|
15
|
+
return /* @__PURE__ */ jsx(OptionIcon, { children: icon });
|
|
19
16
|
};
|
|
20
|
-
const
|
|
21
|
-
const buildBorderedOptionStyle = (_base, state) => asStyle({
|
|
22
|
-
cursor: "pointer",
|
|
23
|
-
padding: "10px 16px",
|
|
24
|
-
fontSize: 14,
|
|
25
|
-
lineHeight: "20px",
|
|
26
|
-
border: 0,
|
|
27
|
-
color: colors.black,
|
|
28
|
-
transition: "background-color 0.12s ease",
|
|
29
|
-
fontWeight: state.isSelected ? 600 : 400,
|
|
30
|
-
backgroundColor: state.isFocused ? colors.grey3 : "transparent"
|
|
31
|
-
});
|
|
32
|
-
const buildOptionStyle = (multiple) => (_base, state) => {
|
|
17
|
+
const buildOptionStyle = (multiple) => (base, state) => {
|
|
33
18
|
if (multiple) {
|
|
34
|
-
return
|
|
19
|
+
return {
|
|
35
20
|
cursor: "pointer",
|
|
36
21
|
padding: "10px 14px",
|
|
37
22
|
fontSize: 13,
|
|
38
23
|
lineHeight: "18px",
|
|
39
24
|
border: 0,
|
|
40
|
-
color: "
|
|
25
|
+
color: "var(--stokr-text-primary)",
|
|
41
26
|
transition: "background-color 0.12s ease",
|
|
42
27
|
fontWeight: state.isSelected ? 600 : 400,
|
|
43
|
-
backgroundColor: state.isSelected ? "
|
|
44
|
-
}
|
|
28
|
+
backgroundColor: state.isSelected ? "var(--stokr-action-secondary-bg)" : state.isFocused ? "var(--stokr-background-surface)" : "transparent"
|
|
29
|
+
};
|
|
45
30
|
}
|
|
46
|
-
return
|
|
47
|
-
...
|
|
31
|
+
return {
|
|
32
|
+
...base,
|
|
48
33
|
cursor: "pointer",
|
|
49
|
-
|
|
50
|
-
|
|
34
|
+
color: "var(--stokr-text-primary)",
|
|
35
|
+
backgroundColor: "transparent",
|
|
36
|
+
fontWeight: state.isSelected || state.isFocused ? "bold" : "normal",
|
|
37
|
+
":active": { backgroundColor: "var(--stokr-action-secondary-bg)" }
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const DropdownIndicator = (props) => /* @__PURE__ */ jsx(components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx(SelectIcon, { isMenuOpen: props.selectProps.menuIsOpen }) });
|
|
41
|
+
DropdownIndicator.propTypes = {
|
|
42
|
+
selectProps: PropTypes.instanceOf(Object).isRequired
|
|
51
43
|
};
|
|
52
|
-
const extrasOf = (props) => props.selectProps;
|
|
53
|
-
const DropdownIndicator = (props) => /* @__PURE__ */ jsx(components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx(SelectIcon, { isMenuOpen: props.selectProps.menuIsOpen, $variant: extrasOf(props).variant }) });
|
|
54
44
|
const ScrollableMenuList = (props) => {
|
|
55
45
|
const { children, selectProps } = props;
|
|
56
46
|
const { maxMenuHeight = 300 } = selectProps;
|
|
57
47
|
return /* @__PURE__ */ jsx(SelectMenuList, { autoHeight: true, autoHeightMax: maxMenuHeight, fullHeight: true, children });
|
|
58
48
|
};
|
|
49
|
+
ScrollableMenuList.propTypes = {
|
|
50
|
+
children: PropTypes.node.isRequired,
|
|
51
|
+
selectProps: PropTypes.instanceOf(Object).isRequired
|
|
52
|
+
};
|
|
59
53
|
const ControlWithDataCy = (props) => {
|
|
60
|
-
const cy =
|
|
54
|
+
const cy = props.selectProps?.dataCy;
|
|
61
55
|
if (!cy) return /* @__PURE__ */ jsx(components.Control, { ...props });
|
|
62
56
|
return /* @__PURE__ */ jsx(components.Control, { ...props, innerProps: { ...props.innerProps, "data-cy": cy } });
|
|
63
57
|
};
|
|
58
|
+
ControlWithDataCy.propTypes = {
|
|
59
|
+
innerProps: PropTypes.instanceOf(Object),
|
|
60
|
+
selectProps: PropTypes.instanceOf(Object).isRequired
|
|
61
|
+
};
|
|
62
|
+
const useScrollIntoViewWhenFocused = (isFocused) => {
|
|
63
|
+
const ref = useRef(null);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (isFocused) ref.current?.scrollIntoView?.({ block: "nearest" });
|
|
66
|
+
}, [isFocused]);
|
|
67
|
+
return ref;
|
|
68
|
+
};
|
|
64
69
|
const SingleOption = (props) => {
|
|
65
|
-
const
|
|
66
|
-
return /* @__PURE__ */ jsx(components.Option, { ...props, children: /* @__PURE__ */ jsxs(OptionRow, { children: [
|
|
67
|
-
renderIcon(props.data?.icon
|
|
70
|
+
const ref = useScrollIntoViewWhenFocused(props.isFocused);
|
|
71
|
+
return /* @__PURE__ */ jsx(components.Option, { ...props, children: /* @__PURE__ */ jsxs(OptionRow, { ref, children: [
|
|
72
|
+
renderIcon(props.data?.icon),
|
|
68
73
|
/* @__PURE__ */ jsx(OptionLabel, { children: props.label })
|
|
69
74
|
] }) });
|
|
70
75
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
SingleOption.propTypes = {
|
|
77
|
+
data: PropTypes.instanceOf(Object),
|
|
78
|
+
label: PropTypes.node,
|
|
79
|
+
isFocused: PropTypes.bool
|
|
80
|
+
};
|
|
81
|
+
const MultiOption = (props) => {
|
|
82
|
+
const ref = useScrollIntoViewWhenFocused(props.isFocused);
|
|
83
|
+
return /* @__PURE__ */ jsx(components.Option, { ...props, children: /* @__PURE__ */ jsx(OptionCheckbox, { checked: props.isSelected, children: /* @__PURE__ */ jsxs(OptionRow, { ref, children: [
|
|
84
|
+
renderIcon(props.data?.icon),
|
|
85
|
+
/* @__PURE__ */ jsx(OptionLabel, { children: props.label })
|
|
86
|
+
] }) }) });
|
|
87
|
+
};
|
|
88
|
+
MultiOption.propTypes = {
|
|
89
|
+
data: PropTypes.instanceOf(Object),
|
|
90
|
+
label: PropTypes.node,
|
|
91
|
+
isSelected: PropTypes.bool,
|
|
92
|
+
isFocused: PropTypes.bool
|
|
93
|
+
};
|
|
75
94
|
const SingleValueWithIcon = (props) => /* @__PURE__ */ jsx(components.SingleValue, { ...props, children: /* @__PURE__ */ jsxs(OptionRow, { children: [
|
|
76
|
-
renderIcon(props.data?.icon
|
|
95
|
+
renderIcon(props.data?.icon),
|
|
77
96
|
/* @__PURE__ */ jsx(OptionLabel, { children: props.data?.label })
|
|
78
97
|
] }) });
|
|
98
|
+
SingleValueWithIcon.propTypes = {
|
|
99
|
+
data: PropTypes.instanceOf(Object).isRequired
|
|
100
|
+
};
|
|
79
101
|
const Select = (props) => {
|
|
80
102
|
const {
|
|
81
103
|
id,
|
|
@@ -96,13 +118,14 @@ const Select = (props) => {
|
|
|
96
118
|
floatingLabel = true,
|
|
97
119
|
formatCreateLabel,
|
|
98
120
|
dataCy,
|
|
99
|
-
variant = "default",
|
|
100
121
|
onChange,
|
|
101
122
|
onBlur,
|
|
102
123
|
onFocus,
|
|
103
124
|
...otherProps
|
|
104
125
|
} = props;
|
|
105
126
|
const [hasFocus, setHasFocus] = useState(false);
|
|
127
|
+
const [inputValue, setInputValue] = useState("");
|
|
128
|
+
const [menuIsOpen, setMenuIsOpen] = useState(false);
|
|
106
129
|
const handleFocus = () => {
|
|
107
130
|
onFocus?.({ name, value });
|
|
108
131
|
setHasFocus(true);
|
|
@@ -122,42 +145,44 @@ const Select = (props) => {
|
|
|
122
145
|
}
|
|
123
146
|
onChange?.({ name, value: selected?.value ?? "" });
|
|
124
147
|
};
|
|
148
|
+
const handleInputChange = (text, { action }) => {
|
|
149
|
+
if (multiple && action === "set-value") return;
|
|
150
|
+
setInputValue(text);
|
|
151
|
+
};
|
|
125
152
|
const removeValue = (val) => {
|
|
126
153
|
if (lockedValues.includes(val)) return;
|
|
127
154
|
const arr = Array.isArray(value) ? value.filter((v) => v !== val) : [];
|
|
128
155
|
onChange?.({ name, value: arr });
|
|
129
156
|
};
|
|
130
157
|
const SelectComponent = creatable ? CreatableSelect : ReactSelect;
|
|
131
|
-
const bordered = variant === "bordered";
|
|
132
|
-
const invalid = Boolean(error && touched);
|
|
133
158
|
const selectStyles = useMemo(
|
|
134
|
-
() =>
|
|
135
|
-
control: (
|
|
159
|
+
() => ({
|
|
160
|
+
control: () => SelectControl,
|
|
136
161
|
menu: (base) => ({
|
|
137
162
|
...base,
|
|
138
|
-
marginTop:
|
|
163
|
+
marginTop: 0,
|
|
139
164
|
zIndex: 1e3,
|
|
140
|
-
|
|
141
|
-
border: BORDERED_BORDER,
|
|
142
|
-
borderRadius: radius.lg,
|
|
143
|
-
boxShadow: "none",
|
|
144
|
-
backgroundColor: colors.white
|
|
165
|
+
backgroundColor: "var(--stokr-background-surface-raised)"
|
|
145
166
|
}),
|
|
146
|
-
option: buildBorderedOptionStyle,
|
|
147
|
-
valueContainer: (base) => ({ ...base, padding: 0 }),
|
|
148
|
-
singleValue: (base) => ({ ...base, margin: 0, color: colors.black }),
|
|
149
|
-
placeholder: (base) => ({ ...base, margin: 0, color: colors.grey2 }),
|
|
150
|
-
input: (base) => ({ ...base, margin: 0, padding: 0, color: colors.black }),
|
|
151
|
-
dropdownIndicator: (base) => ({ ...base, padding: 0, color: colors.black }),
|
|
152
|
-
clearIndicator: (base) => ({ ...base, padding: "0 8px" })
|
|
153
|
-
} : {
|
|
154
|
-
control: () => asStyle(SelectControl),
|
|
155
|
-
menu: (base) => asStyle({ ...base, marginTop: 0, zIndex: 1e3, ...SelectMenu }),
|
|
156
167
|
option: buildOptionStyle(multiple),
|
|
157
|
-
|
|
168
|
+
singleValue: (base, state) => ({
|
|
169
|
+
...base,
|
|
170
|
+
color: state.isDisabled ? "var(--stokr-text-tertiary)" : "var(--stokr-text-primary)"
|
|
171
|
+
}),
|
|
172
|
+
input: (base) => ({ ...base, color: "var(--stokr-text-primary)" }),
|
|
173
|
+
// While open, a multiple select shows who is selected here (see `overview`): readable text, one line.
|
|
174
|
+
placeholder: (base, state) => ({
|
|
175
|
+
...base,
|
|
176
|
+
color: state.isMulti && state.selectProps.menuIsOpen && state.selectProps.value?.length ? "var(--stokr-text-secondary)" : "var(--stokr-text-tertiary)",
|
|
177
|
+
maxWidth: "100%",
|
|
178
|
+
overflow: "hidden",
|
|
179
|
+
whiteSpace: "nowrap",
|
|
180
|
+
textOverflow: "ellipsis"
|
|
181
|
+
}),
|
|
182
|
+
selectContainer: () => SelectContainer,
|
|
158
183
|
valueContainer: (base) => ({ ...base, padding: 0 })
|
|
159
|
-
},
|
|
160
|
-
[multiple
|
|
184
|
+
}),
|
|
185
|
+
[multiple]
|
|
161
186
|
);
|
|
162
187
|
const selectComponents = useMemo(
|
|
163
188
|
() => ({
|
|
@@ -180,15 +205,16 @@ const Select = (props) => {
|
|
|
180
205
|
}
|
|
181
206
|
return options?.find((o) => o.value === value) || null;
|
|
182
207
|
}, [multiple, creatable, value, options]);
|
|
183
|
-
const selectedOptions = multiple ? currentValue : [];
|
|
184
208
|
const hasValue = useMemo(() => {
|
|
185
|
-
if (multiple) return
|
|
209
|
+
if (multiple) return currentValue.length > 0;
|
|
186
210
|
return currentValue != null && currentValue.value !== "";
|
|
187
|
-
}, [multiple, currentValue
|
|
211
|
+
}, [multiple, currentValue]);
|
|
188
212
|
const isLabelUp = floatingLabel ? hasFocus || hasValue : Boolean(label);
|
|
189
|
-
const
|
|
213
|
+
const ownPlaceholder = label ? hasFocus && placeholder ? placeholder : "" : placeholder;
|
|
214
|
+
const overview = multiple && menuIsOpen && currentValue.length > 0 ? `${selectedLabel} (${currentValue.length}): ${currentValue.map((opt) => typeof opt.label === "string" ? opt.label : String(opt.value)).join(", ")}` : null;
|
|
215
|
+
const effectivePlaceholder = overview ?? ownPlaceholder;
|
|
190
216
|
return /* @__PURE__ */ jsxs(Wrapper, { children: [
|
|
191
|
-
label && /* @__PURE__ */ jsx(Label, { isUp: isLabelUp, active: hasFocus, error: error && touched, htmlFor: id,
|
|
217
|
+
label && /* @__PURE__ */ jsx(Label, { isUp: isLabelUp, active: hasFocus, error: error && touched, htmlFor: id, children: label }),
|
|
192
218
|
/* @__PURE__ */ jsx(
|
|
193
219
|
SelectComponent,
|
|
194
220
|
{
|
|
@@ -199,6 +225,16 @@ const Select = (props) => {
|
|
|
199
225
|
value: currentValue,
|
|
200
226
|
placeholder: effectivePlaceholder,
|
|
201
227
|
isMulti: multiple,
|
|
228
|
+
inputValue,
|
|
229
|
+
onInputChange: handleInputChange,
|
|
230
|
+
onMenuOpen: () => {
|
|
231
|
+
setMenuIsOpen(true);
|
|
232
|
+
otherProps.onMenuOpen?.();
|
|
233
|
+
},
|
|
234
|
+
onMenuClose: () => {
|
|
235
|
+
setMenuIsOpen(false);
|
|
236
|
+
otherProps.onMenuClose?.();
|
|
237
|
+
},
|
|
202
238
|
isDisabled: disabled,
|
|
203
239
|
isSearchable: search,
|
|
204
240
|
isClearable: !multiple,
|
|
@@ -212,32 +248,31 @@ const Select = (props) => {
|
|
|
212
248
|
onFocus: handleFocus,
|
|
213
249
|
styles: selectStyles,
|
|
214
250
|
components: selectComponents,
|
|
215
|
-
|
|
251
|
+
dataCy,
|
|
216
252
|
...creatable && {
|
|
217
253
|
formatCreateLabel: formatCreateLabel || ((input) => `Create "${input}"`)
|
|
218
254
|
}
|
|
219
255
|
}
|
|
220
256
|
),
|
|
221
|
-
multiple &&
|
|
222
|
-
/* @__PURE__ */ jsxs(SelectedChipsTitle, {
|
|
257
|
+
multiple && currentValue.length > 0 && /* @__PURE__ */ jsxs(SelectedChipsWrapper, { "data-cy": dataCy ? `${dataCy}-chips` : void 0, children: [
|
|
258
|
+
/* @__PURE__ */ jsxs(SelectedChipsTitle, { children: [
|
|
223
259
|
selectedLabel,
|
|
224
260
|
" (",
|
|
225
|
-
|
|
261
|
+
currentValue.length,
|
|
226
262
|
")"
|
|
227
263
|
] }),
|
|
228
|
-
/* @__PURE__ */ jsx(SelectedChipsList, { children:
|
|
264
|
+
/* @__PURE__ */ jsx(SelectedChipsList, { children: currentValue.map((opt) => {
|
|
229
265
|
const isLocked = lockedValues.includes(opt.value);
|
|
230
|
-
return /* @__PURE__ */ jsxs(SelectedChip, {
|
|
231
|
-
|
|
266
|
+
return /* @__PURE__ */ jsxs(SelectedChip, { children: [
|
|
267
|
+
renderIcon(opt.icon),
|
|
232
268
|
/* @__PURE__ */ jsx(SelectedChipLabel, { children: opt.label }),
|
|
233
269
|
/* @__PURE__ */ jsx(
|
|
234
270
|
SelectedChipRemove,
|
|
235
271
|
{
|
|
236
|
-
$variant: variant,
|
|
237
272
|
onClick: () => removeValue(opt.value),
|
|
238
273
|
"aria-label": `Remove ${typeof opt.label === "string" ? opt.label : opt.value}`,
|
|
239
274
|
disabled: disabled || isLocked,
|
|
240
|
-
children:
|
|
275
|
+
children: "✕"
|
|
241
276
|
}
|
|
242
277
|
)
|
|
243
278
|
] }, opt.key ?? opt.value);
|
|
@@ -245,6 +280,47 @@ const Select = (props) => {
|
|
|
245
280
|
] })
|
|
246
281
|
] });
|
|
247
282
|
};
|
|
283
|
+
Select.propTypes = {
|
|
284
|
+
id: PropTypes.string.isRequired,
|
|
285
|
+
name: PropTypes.string.isRequired,
|
|
286
|
+
label: PropTypes.string,
|
|
287
|
+
/** string|number for single mode, array for multi mode */
|
|
288
|
+
value: PropTypes.oneOfType([
|
|
289
|
+
PropTypes.string,
|
|
290
|
+
PropTypes.number,
|
|
291
|
+
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))
|
|
292
|
+
]),
|
|
293
|
+
options: PropTypes.arrayOf(
|
|
294
|
+
PropTypes.shape({
|
|
295
|
+
key: PropTypes.string,
|
|
296
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
297
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
|
|
298
|
+
/** URL string (rendered as <img>) or a React node (e.g. an SVG flag) shown left of the label */
|
|
299
|
+
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
|
|
300
|
+
})
|
|
301
|
+
).isRequired,
|
|
302
|
+
placeholder: PropTypes.string,
|
|
303
|
+
error: PropTypes.bool,
|
|
304
|
+
touched: PropTypes.bool,
|
|
305
|
+
disabled: PropTypes.bool,
|
|
306
|
+
search: PropTypes.bool,
|
|
307
|
+
creatable: PropTypes.bool,
|
|
308
|
+
/** Multi-select: checkbox options + chips list rendered below the field. */
|
|
309
|
+
multiple: PropTypes.bool,
|
|
310
|
+
/** Multi mode: values that cannot be removed (chip ✕ disabled, can't be deselected). */
|
|
311
|
+
lockedValues: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
|
|
312
|
+
menuHeight: PropTypes.number,
|
|
313
|
+
/** Heading shown above the chips list in multi mode (default: "Selected"). */
|
|
314
|
+
selectedLabel: PropTypes.string,
|
|
315
|
+
/** Input-like floating label behavior: label starts in-field, moves up on focus/value. */
|
|
316
|
+
floatingLabel: PropTypes.bool,
|
|
317
|
+
formatCreateLabel: PropTypes.func,
|
|
318
|
+
onChange: PropTypes.func,
|
|
319
|
+
onBlur: PropTypes.func,
|
|
320
|
+
onFocus: PropTypes.func,
|
|
321
|
+
/** Playwright / autocapture: `data-cy` selector on the react-select control. */
|
|
322
|
+
dataCy: PropTypes.string
|
|
323
|
+
};
|
|
248
324
|
export {
|
|
249
325
|
Select,
|
|
250
326
|
SelectContainer,
|
|
@@ -2,10 +2,6 @@ import styled, { css } from "styled-components";
|
|
|
2
2
|
import { TrackV } from "../ComponentScroll/ComponentScroll.styles.js";
|
|
3
3
|
import stdin_default from "../ComponentScroll/ComponentScroll.js";
|
|
4
4
|
import { glyph } from "../MaterialIcon/glyph.js";
|
|
5
|
-
import { borderedFieldBox, borderedFieldText, borderedFieldFocus, borderedFieldError, borderedFieldDisabled } from "../../styles/borderedField.js";
|
|
6
|
-
import { colors } from "../../styles/colors.js";
|
|
7
|
-
import { space } from "../../styles/spacing.js";
|
|
8
|
-
import { typography } from "../../styles/typography.js";
|
|
9
5
|
const SelectControl = css`
|
|
10
6
|
&&& {
|
|
11
7
|
z-index: 10 !important;
|
|
@@ -23,8 +19,8 @@ const SelectControl = css`
|
|
|
23
19
|
box-shadow: none;
|
|
24
20
|
border: 0;
|
|
25
21
|
border-top: 1px solid transparent;
|
|
26
|
-
border-bottom: 1px solid
|
|
27
|
-
color:
|
|
22
|
+
border-bottom: 1px solid var(--stokr-border-subtle);
|
|
23
|
+
color: var(--stokr-text-primary);
|
|
28
24
|
background-color: transparent;
|
|
29
25
|
transition: border-color 0.2s;
|
|
30
26
|
cursor: pointer;
|
|
@@ -32,7 +28,7 @@ const SelectControl = css`
|
|
|
32
28
|
&:hover {
|
|
33
29
|
box-shadow: none;
|
|
34
30
|
border-top-color: transparent;
|
|
35
|
-
border-bottom-color:
|
|
31
|
+
border-bottom-color: var(--stokr-border-focus);
|
|
36
32
|
}
|
|
37
33
|
|
|
38
34
|
&.active {
|
|
@@ -40,70 +36,14 @@ const SelectControl = css`
|
|
|
40
36
|
}
|
|
41
37
|
}
|
|
42
38
|
`;
|
|
43
|
-
const SelectBorderedControl = css`
|
|
44
|
-
&&& {
|
|
45
|
-
z-index: 10 !important;
|
|
46
|
-
position: relative;
|
|
47
|
-
display: flex;
|
|
48
|
-
align-items: center;
|
|
49
|
-
justify-content: space-between;
|
|
50
|
-
width: 100%;
|
|
51
|
-
cursor: pointer;
|
|
52
|
-
${borderedFieldBox}
|
|
53
|
-
${borderedFieldText}
|
|
54
|
-
|
|
55
|
-
&:hover {
|
|
56
|
-
box-shadow: none;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&.active {
|
|
60
|
-
z-index: 12 !important;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
`;
|
|
64
|
-
const SelectBorderedFocus = css`
|
|
65
|
-
&&& {
|
|
66
|
-
${borderedFieldFocus}
|
|
67
|
-
|
|
68
|
-
&:hover {
|
|
69
|
-
${borderedFieldFocus}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
const SelectBorderedError = css`
|
|
74
|
-
&&& {
|
|
75
|
-
${borderedFieldError}
|
|
76
|
-
|
|
77
|
-
&:hover {
|
|
78
|
-
${borderedFieldError}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
`;
|
|
82
|
-
const SelectBorderedDisabled = css`
|
|
83
|
-
&&& {
|
|
84
|
-
${borderedFieldDisabled}
|
|
85
|
-
}
|
|
86
|
-
`;
|
|
87
|
-
const borderedControlCss = ({
|
|
88
|
-
focused,
|
|
89
|
-
invalid,
|
|
90
|
-
disabled
|
|
91
|
-
}) => [
|
|
92
|
-
[
|
|
93
|
-
SelectBorderedControl,
|
|
94
|
-
focused && SelectBorderedFocus,
|
|
95
|
-
invalid && SelectBorderedError,
|
|
96
|
-
disabled && SelectBorderedDisabled
|
|
97
|
-
].flat(2).filter(Boolean).join("")
|
|
98
|
-
];
|
|
99
39
|
const SelectMenu = css`
|
|
100
40
|
margin-top: -1px;
|
|
101
41
|
border-radius: 0;
|
|
102
42
|
box-shadow: none;
|
|
103
43
|
border: 0;
|
|
104
|
-
border-top: 1px solid
|
|
105
|
-
border-bottom: 1px solid
|
|
106
|
-
background-color:
|
|
44
|
+
border-top: 1px solid var(--stokr-border-subtle) !important;
|
|
45
|
+
border-bottom: 1px solid var(--stokr-border-subtle) !important;
|
|
46
|
+
background-color: var(--stokr-background-surface-raised);
|
|
107
47
|
opacity: 999 !important;
|
|
108
48
|
`;
|
|
109
49
|
const SelectMenuList = styled(stdin_default)`
|
|
@@ -123,7 +63,7 @@ const SelectOption = css`
|
|
|
123
63
|
line-height: 18px;
|
|
124
64
|
border: 0;
|
|
125
65
|
background-color: transparent;
|
|
126
|
-
color:
|
|
66
|
+
color: var(--stokr-text-primary);
|
|
127
67
|
|
|
128
68
|
&:hover {
|
|
129
69
|
background-color: transparent;
|
|
@@ -152,15 +92,11 @@ const SelectIcon = styled.span.withConfig({
|
|
|
152
92
|
font-size: 18px;
|
|
153
93
|
transition: 0.3s transform;
|
|
154
94
|
transform: rotate(0);
|
|
155
|
-
color:
|
|
95
|
+
color: var(--stokr-text-primary);
|
|
156
96
|
|
|
157
97
|
${(props) => props.isMenuOpen && `
|
|
158
98
|
transform: rotate(180deg);
|
|
159
99
|
`}
|
|
160
|
-
|
|
161
|
-
${(props) => props.$variant === "bordered" && `
|
|
162
|
-
font-size: 20px;
|
|
163
|
-
`}
|
|
164
100
|
}
|
|
165
101
|
`;
|
|
166
102
|
const OptionRow = styled.div`
|
|
@@ -186,11 +122,6 @@ const OptionIcon = styled.span`
|
|
|
186
122
|
object-fit: cover;
|
|
187
123
|
display: block;
|
|
188
124
|
}
|
|
189
|
-
|
|
190
|
-
${(props) => props.$variant === "bordered" && `
|
|
191
|
-
width: 24px;
|
|
192
|
-
height: 20px;
|
|
193
|
-
`}
|
|
194
125
|
`;
|
|
195
126
|
const OptionLabel = styled.span`
|
|
196
127
|
flex: 1;
|
|
@@ -200,21 +131,14 @@ const OptionLabel = styled.span`
|
|
|
200
131
|
text-overflow: ellipsis;
|
|
201
132
|
`;
|
|
202
133
|
const SelectedChipsWrapper = styled.div`
|
|
203
|
-
margin-top:
|
|
134
|
+
margin-top: 18px;
|
|
204
135
|
`;
|
|
205
136
|
const SelectedChipsTitle = styled.div`
|
|
206
137
|
font-size: 11px;
|
|
207
138
|
letter-spacing: 1.5px;
|
|
208
139
|
text-transform: uppercase;
|
|
209
|
-
color:
|
|
140
|
+
color: var(--stokr-text-secondary);
|
|
210
141
|
margin-bottom: 8px;
|
|
211
|
-
|
|
212
|
-
${(props) => props.$variant === "bordered" && css`
|
|
213
|
-
margin-bottom: ${space[1]};
|
|
214
|
-
line-height: 16px;
|
|
215
|
-
letter-spacing: 2px;
|
|
216
|
-
color: ${colors.grayBlue};
|
|
217
|
-
`}
|
|
218
142
|
`;
|
|
219
143
|
const SelectedChipsList = styled.div`
|
|
220
144
|
display: flex;
|
|
@@ -226,21 +150,12 @@ const SelectedChip = styled.div`
|
|
|
226
150
|
align-items: center;
|
|
227
151
|
gap: 8px;
|
|
228
152
|
padding: 6px 10px;
|
|
229
|
-
border: 1px solid
|
|
153
|
+
border: 1px solid var(--stokr-border-subtle);
|
|
230
154
|
border-radius: 20px;
|
|
231
|
-
background-color:
|
|
155
|
+
background-color: var(--stokr-background-default);
|
|
232
156
|
font-size: 12px;
|
|
233
157
|
line-height: 16px;
|
|
234
|
-
color:
|
|
235
|
-
|
|
236
|
-
${(props) => props.$variant === "bordered" && css`
|
|
237
|
-
gap: 6px;
|
|
238
|
-
padding: ${space[1]} ${space[2]} ${space[1]} ${space[3]};
|
|
239
|
-
border-color: ${colors.lightGrey};
|
|
240
|
-
border-radius: 48px;
|
|
241
|
-
${typography.labelCta}
|
|
242
|
-
color: ${colors.black};
|
|
243
|
-
`}
|
|
158
|
+
color: var(--stokr-text-primary);
|
|
244
159
|
`;
|
|
245
160
|
const SelectedChipLabel = styled.span`
|
|
246
161
|
white-space: nowrap;
|
|
@@ -254,31 +169,15 @@ const SelectedChipRemove = styled.button.attrs({ type: "button" })`
|
|
|
254
169
|
padding: 0;
|
|
255
170
|
margin: 0 0 0 2px;
|
|
256
171
|
cursor: pointer;
|
|
257
|
-
color:
|
|
172
|
+
color: var(--stokr-text-tertiary);
|
|
258
173
|
font-size: 14px;
|
|
259
174
|
line-height: 1;
|
|
260
175
|
width: 14px;
|
|
261
176
|
height: 14px;
|
|
262
177
|
|
|
263
178
|
&:hover {
|
|
264
|
-
color:
|
|
179
|
+
color: var(--stokr-text-primary);
|
|
265
180
|
}
|
|
266
|
-
|
|
267
|
-
${(props) => props.$variant === "bordered" && css`
|
|
268
|
-
width: 16px;
|
|
269
|
-
height: 16px;
|
|
270
|
-
margin: 0;
|
|
271
|
-
color: ${colors.black};
|
|
272
|
-
|
|
273
|
-
&:hover {
|
|
274
|
-
color: ${colors.black};
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
&:disabled {
|
|
278
|
-
cursor: not-allowed;
|
|
279
|
-
opacity: 0.4;
|
|
280
|
-
}
|
|
281
|
-
`}
|
|
282
181
|
`;
|
|
283
182
|
const SelectWrapper = styled.div.withConfig({
|
|
284
183
|
shouldForwardProp: (props) => !["minWidth", "noMargin"].includes(props)
|
|
@@ -337,6 +236,5 @@ export {
|
|
|
337
236
|
SelectedChipRemove,
|
|
338
237
|
SelectedChipsList,
|
|
339
238
|
SelectedChipsTitle,
|
|
340
|
-
SelectedChipsWrapper
|
|
341
|
-
borderedControlCss
|
|
239
|
+
SelectedChipsWrapper
|
|
342
240
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ComponentType, HTMLAttributes, ReactNode, SVGProps } from 'react';
|
|
2
|
+
export interface TableFilterOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export interface TableFilterDropdownProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
7
|
+
/** Label text displayed next to the filter icon */
|
|
8
|
+
label?: string;
|
|
9
|
+
/** Array of options to display */
|
|
10
|
+
options: TableFilterOption[];
|
|
11
|
+
/** Array of selected values */
|
|
12
|
+
value?: string[];
|
|
13
|
+
/** Callback when selection changes: (newValues) => void */
|
|
14
|
+
onChange?: (newValues: string[]) => void;
|
|
15
|
+
/** Custom icon component (defaults to FilterIcon) */
|
|
16
|
+
icon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
17
|
+
/** Minimum width of the dropdown menu */
|
|
18
|
+
minWidth?: number;
|
|
19
|
+
/** Maximum width of the dropdown menu */
|
|
20
|
+
maxWidth?: number;
|
|
21
|
+
/** Alignment of the dropdown menu */
|
|
22
|
+
menuAlign?: 'left' | 'right';
|
|
23
|
+
/** Top offset for the dropdown menu in pixels (default: 8) */
|
|
24
|
+
menuTop?: number;
|
|
25
|
+
/** Show "Clear all" option at the bottom of the list */
|
|
26
|
+
showClearAll?: boolean;
|
|
27
|
+
/** Custom text for the "Clear all" option */
|
|
28
|
+
clearAllText?: string;
|
|
29
|
+
/** Override default `table-filter-{label}` data-cy on trigger */
|
|
30
|
+
dataCy?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const TableFilterDropdown: ({ label, options, value, onChange, icon: CustomIcon, minWidth, maxWidth, menuAlign, menuTop, showClearAll, clearAllText, dataCy, ...props }: TableFilterDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export default TableFilterDropdown;
|