@transferwise/components 46.47.0 → 46.49.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/build/accordion/AccordionItem/AccordionItem.js.map +1 -1
- package/build/accordion/AccordionItem/AccordionItem.mjs.map +1 -1
- package/build/actionOption/ActionOption.js +4 -2
- package/build/actionOption/ActionOption.js.map +1 -1
- package/build/actionOption/ActionOption.mjs +4 -2
- package/build/actionOption/ActionOption.mjs.map +1 -1
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs.map +1 -1
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs.map +1 -1
- package/build/button/legacyUtils/legacyUtils.js.map +1 -1
- package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
- package/build/carousel/Carousel.js.map +1 -1
- package/build/carousel/Carousel.mjs.map +1 -1
- package/build/chips/Chip.js.map +1 -1
- package/build/chips/Chip.mjs.map +1 -1
- package/build/chips/Chips.js.map +1 -1
- package/build/chips/Chips.mjs.map +1 -1
- package/build/common/bottomSheet/BottomSheet.js.map +1 -1
- package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
- package/build/common/deviceDetection/deviceDetection.js.map +1 -1
- package/build/common/deviceDetection/deviceDetection.mjs.map +1 -1
- package/build/common/panel/Panel.js.map +1 -1
- package/build/common/panel/Panel.mjs.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.js +3 -1
- package/build/common/responsivePanel/ResponsivePanel.js.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.mjs +3 -1
- package/build/common/responsivePanel/ResponsivePanel.mjs.map +1 -1
- package/build/dateInput/DateInput.js.map +1 -1
- package/build/dateInput/DateInput.mjs.map +1 -1
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/dateLookup/dateHeader/DateHeader.js.map +1 -1
- package/build/dateLookup/dateHeader/DateHeader.mjs.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.js.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.mjs.map +1 -1
- package/build/decision/Decision.js.map +1 -1
- package/build/decision/Decision.mjs.map +1 -1
- package/build/display/Display.js.map +1 -1
- package/build/display/Display.mjs.map +1 -1
- package/build/emphasis/EmphasisHtmlTransformer.js.map +1 -1
- package/build/emphasis/EmphasisHtmlTransformer.mjs.map +1 -1
- package/build/i18n/en.json +2 -0
- package/build/i18n/en.json.js +2 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +2 -0
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs +1 -0
- package/build/index.mjs.map +1 -1
- package/build/inlineAlert/InlineAlert.js.map +1 -1
- package/build/inlineAlert/InlineAlert.mjs.map +1 -1
- package/build/inputs/InputGroup.js.map +1 -1
- package/build/inputs/InputGroup.mjs.map +1 -1
- package/build/inputs/contexts.js.map +1 -1
- package/build/inputs/contexts.mjs.map +1 -1
- package/build/link/Link.js.map +1 -1
- package/build/link/Link.mjs.map +1 -1
- package/build/loader/Loader.js.map +1 -1
- package/build/loader/Loader.mjs.map +1 -1
- package/build/logo/Logo.js.map +1 -1
- package/build/logo/Logo.mjs.map +1 -1
- package/build/main.css +44 -0
- package/build/markdown/Markdown.js.map +1 -1
- package/build/markdown/Markdown.mjs.map +1 -1
- package/build/modal/Modal.js.map +1 -1
- package/build/modal/Modal.mjs.map +1 -1
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/moneyInput/currencyFormatting.js.map +1 -1
- package/build/moneyInput/currencyFormatting.mjs.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
- package/build/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.js.map +1 -1
- package/build/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.mjs.map +1 -1
- package/build/popover/Popover.js.map +1 -1
- package/build/popover/Popover.mjs.map +1 -1
- package/build/processIndicator/ProcessIndicator.js.map +1 -1
- package/build/processIndicator/ProcessIndicator.mjs.map +1 -1
- package/build/progressBar/ProgressBar.js.map +1 -1
- package/build/progressBar/ProgressBar.mjs.map +1 -1
- package/build/promoCard/PromoCard.js.map +1 -1
- package/build/promoCard/PromoCard.mjs.map +1 -1
- package/build/provider/Provider.js.map +1 -1
- package/build/provider/Provider.mjs.map +1 -1
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs.map +1 -1
- package/build/select/option/Option.js.map +1 -1
- package/build/select/option/Option.mjs.map +1 -1
- package/build/select/searchBox/SearchBox.js.map +1 -1
- package/build/select/searchBox/SearchBox.mjs.map +1 -1
- package/build/selectOption/SelectOption.js +115 -0
- package/build/selectOption/SelectOption.js.map +1 -0
- package/build/selectOption/SelectOption.messages.js +15 -0
- package/build/selectOption/SelectOption.messages.js.map +1 -0
- package/build/selectOption/SelectOption.messages.mjs +13 -0
- package/build/selectOption/SelectOption.messages.mjs.map +1 -0
- package/build/selectOption/SelectOption.mjs +109 -0
- package/build/selectOption/SelectOption.mjs.map +1 -0
- package/build/slidingPanel/SlidingPanel.js.map +1 -1
- package/build/slidingPanel/SlidingPanel.mjs.map +1 -1
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/stepper/Stepper.js.map +1 -1
- package/build/stepper/Stepper.mjs.map +1 -1
- package/build/stepper/deviceDetection.js.map +1 -1
- package/build/stepper/deviceDetection.mjs.map +1 -1
- package/build/styles/main.css +44 -0
- package/build/styles/selectOption/SelectOption.css +44 -0
- package/build/tabs/Tabs.js.map +1 -1
- package/build/tabs/Tabs.mjs.map +1 -1
- package/build/title/Title.js.map +1 -1
- package/build/title/Title.mjs.map +1 -1
- package/build/tooltip/Tooltip.js.map +1 -1
- package/build/tooltip/Tooltip.mjs.map +1 -1
- package/build/typeahead/Typeahead.js.map +1 -1
- package/build/typeahead/Typeahead.mjs.map +1 -1
- package/build/typeahead/typeaheadInput/TypeaheadInput.js.map +1 -1
- package/build/typeahead/typeaheadInput/TypeaheadInput.mjs.map +1 -1
- package/build/types/actionOption/ActionOption.d.ts +2 -1
- package/build/types/actionOption/ActionOption.d.ts.map +1 -1
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/selectOption/SelectOption.d.ts +21 -0
- package/build/types/selectOption/SelectOption.d.ts.map +1 -0
- package/build/types/selectOption/SelectOption.messages.d.ts +12 -0
- package/build/types/selectOption/SelectOption.messages.d.ts.map +1 -0
- package/build/types/selectOption/index.d.ts +3 -0
- package/build/types/selectOption/index.d.ts.map +1 -0
- package/build/upload/steps/uploadImageStep/uploadImageStep.js.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs.map +1 -1
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.mjs.map +1 -1
- package/build/utilities/cssValueWithUnit.js.map +1 -1
- package/build/utilities/cssValueWithUnit.mjs.map +1 -1
- package/package.json +30 -31
- package/src/actionOption/ActionOption.tsx +3 -0
- package/src/common/responsivePanel/ResponsivePanel.tsx +2 -0
- package/src/i18n/en.json +2 -0
- package/src/index.ts +2 -0
- package/src/main.css +44 -0
- package/src/main.less +1 -0
- package/src/selectOption/SelectOption.css +44 -0
- package/src/selectOption/SelectOption.less +40 -0
- package/src/selectOption/SelectOption.messages.ts +12 -0
- package/src/selectOption/SelectOption.spec.tsx +83 -0
- package/src/selectOption/SelectOption.story.tsx +278 -0
- package/src/selectOption/SelectOption.tsx +151 -0
- package/src/selectOption/index.ts +2 -0
- package/src/ssr.spec.js +1 -0
- package/src/test-utils/Parameters.d.ts +1 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var classNames = require('classnames');
|
|
5
|
+
var Option = require('../common/Option/Option.js');
|
|
6
|
+
var Section = require('../section/Section.js');
|
|
7
|
+
var Header = require('../header/Header.js');
|
|
8
|
+
var NavigationOption = require('../navigationOption/NavigationOption.js');
|
|
9
|
+
var NavigationOptionsList = require('../navigationOptionsList/NavigationOptionsList.js');
|
|
10
|
+
var contexts = require('../inputs/contexts.js');
|
|
11
|
+
var SelectOption_messages = require('./SelectOption.messages.js');
|
|
12
|
+
var reactIntl = require('react-intl');
|
|
13
|
+
var useScreenSize = require('../common/hooks/useScreenSize.js');
|
|
14
|
+
var icons = require('@transferwise/icons');
|
|
15
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
16
|
+
var breakpoint = require('../common/propsValues/breakpoint.js');
|
|
17
|
+
var ResponsivePanel = require('../common/responsivePanel/ResponsivePanel.js');
|
|
18
|
+
var position = require('../common/propsValues/position.js');
|
|
19
|
+
|
|
20
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
|
+
|
|
22
|
+
var classNames__default = /*#__PURE__*/_interopDefault(classNames);
|
|
23
|
+
|
|
24
|
+
function SelectOption({
|
|
25
|
+
selected = undefined,
|
|
26
|
+
options,
|
|
27
|
+
onChange,
|
|
28
|
+
placeholder,
|
|
29
|
+
disabled,
|
|
30
|
+
...props
|
|
31
|
+
}) {
|
|
32
|
+
const intl = reactIntl.useIntl();
|
|
33
|
+
const rootRef = React.useRef(null);
|
|
34
|
+
const [showOptions, setShowOptions] = React.useState(false);
|
|
35
|
+
const hasSelected = selected !== undefined;
|
|
36
|
+
const isLargeScreen = useScreenSize.useScreenSize(breakpoint.Breakpoint.SMALL);
|
|
37
|
+
const inputAttributes = contexts.useInputAttributes();
|
|
38
|
+
const ariaLabelledBy = props['aria-labelledby'] ?? inputAttributes?.['aria-labelledby'];
|
|
39
|
+
function handleOnClick(showOptionsStatus) {
|
|
40
|
+
return () => {
|
|
41
|
+
setShowOptions(showOptionsStatus);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function handleOnChange(data) {
|
|
45
|
+
return () => {
|
|
46
|
+
setShowOptions(false);
|
|
47
|
+
onChange(data);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function getOptions(isLargeScreen = false) {
|
|
51
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
52
|
+
className: classNames__default.default({
|
|
53
|
+
'np-select-option-list': isLargeScreen
|
|
54
|
+
}),
|
|
55
|
+
children: options.map((optionsSection, index) => /*#__PURE__*/jsxRuntime.jsxs(Section, {
|
|
56
|
+
className: classNames__default.default({
|
|
57
|
+
'p-x-2 p-y-1': isLargeScreen
|
|
58
|
+
}),
|
|
59
|
+
children: [optionsSection.title && /*#__PURE__*/jsxRuntime.jsx(Header.Header, {
|
|
60
|
+
title: optionsSection.title
|
|
61
|
+
}), /*#__PURE__*/jsxRuntime.jsx(NavigationOptionsList, {
|
|
62
|
+
children: optionsSection.options.map((option, index) => {
|
|
63
|
+
return /*#__PURE__*/jsxRuntime.jsx(NavigationOption, {
|
|
64
|
+
isContainerAligned: !isLargeScreen,
|
|
65
|
+
showMediaCircle: true,
|
|
66
|
+
showMediaAtAllSizes: true,
|
|
67
|
+
onClick: handleOnChange(option),
|
|
68
|
+
...option
|
|
69
|
+
}, index);
|
|
70
|
+
})
|
|
71
|
+
})]
|
|
72
|
+
}, index))
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
76
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Option, {
|
|
77
|
+
ref: rootRef,
|
|
78
|
+
as: "div",
|
|
79
|
+
showMediaAtAllSizes: true,
|
|
80
|
+
disabled: disabled,
|
|
81
|
+
decision: false,
|
|
82
|
+
media: hasSelected ? selected.media : placeholder.media ?? /*#__PURE__*/jsxRuntime.jsx(icons.Plus, {
|
|
83
|
+
size: 24
|
|
84
|
+
}),
|
|
85
|
+
title: (hasSelected ? selected : placeholder).title,
|
|
86
|
+
content: (hasSelected ? selected : placeholder).content,
|
|
87
|
+
className: classNames__default.default('np-select-option', 'clickable', hasSelected ? 'np-select-option-selected' : 'np-select-option-placeholder', props.className),
|
|
88
|
+
button: /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
89
|
+
...inputAttributes,
|
|
90
|
+
type: "button",
|
|
91
|
+
disabled: disabled,
|
|
92
|
+
"aria-labelledby": ariaLabelledBy,
|
|
93
|
+
"aria-haspopup": "dialog",
|
|
94
|
+
"aria-expanded": showOptions,
|
|
95
|
+
className: hasSelected ? 'btn-unstyled' : 'np-action-btn',
|
|
96
|
+
"aria-label": hasSelected ? undefined : props['aria-label'],
|
|
97
|
+
onClick: handleOnClick(true),
|
|
98
|
+
children: hasSelected ? /*#__PURE__*/jsxRuntime.jsx(icons.ChevronDown, {
|
|
99
|
+
title: intl.formatMessage(SelectOption_messages.selectedActionLabel)
|
|
100
|
+
}) : placeholder.actionLabel || intl.formatMessage(SelectOption_messages.actionLabel)
|
|
101
|
+
})
|
|
102
|
+
}), /*#__PURE__*/jsxRuntime.jsx(ResponsivePanel, {
|
|
103
|
+
anchorWidth: true,
|
|
104
|
+
altAxis: true,
|
|
105
|
+
anchorRef: rootRef,
|
|
106
|
+
open: showOptions,
|
|
107
|
+
position: position.Position.BOTTOM,
|
|
108
|
+
onClose: handleOnClick(false),
|
|
109
|
+
children: getOptions(isLargeScreen)
|
|
110
|
+
})]
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
module.exports = SelectOption;
|
|
115
|
+
//# sourceMappingURL=SelectOption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectOption.js","sources":["../../src/selectOption/SelectOption.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { ActionButtonProps } from '../actionButton';\nimport classNames from 'classnames';\nimport Option from '../common/Option';\nimport type { OptionProps } from '../common/Option/Option';\nimport { Breakpoint, Position } from '../common';\nimport Section from '../section';\nimport Header from '../header';\nimport { HeaderProps } from '../header/Header';\nimport NavigationOption from '../navigationOption';\nimport NavigationOptionsList from '../navigationOptionsList';\nimport { useInputAttributes } from '../inputs/contexts';\nimport messages from './SelectOption.messages';\nimport { useIntl } from 'react-intl';\nimport ResponsivePanel from '../common/responsivePanel';\nimport { useScreenSize } from '../common/hooks/useScreenSize';\nimport { ChevronDown, Plus } from '@transferwise/icons';\n\nexport type SelectOptiopsSection<T = unknown> = {\n title?: HeaderProps['title'];\n options: SelectOptionValue<T>[];\n};\n\nexport type SelectOptionValue<T = unknown> = Pick<\n OptionProps,\n 'media' | 'title' | 'content' | 'disabled'\n> & {\n value?: T;\n};\n\nexport type SelectOptionPlaceholder = Pick<OptionProps, 'media' | 'title' | 'content'> & {\n actionLabel?: ActionButtonProps['children'];\n};\n\nexport type SelectOptionProps<T = unknown> = {\n onChange: (selected: SelectOptionValue<T>) => void;\n selected?: SelectOptionValue<T>;\n options: SelectOptiopsSection<T>[];\n placeholder: SelectOptionPlaceholder;\n} & Omit<\n OptionProps,\n 'as' | 'title' | 'media' | 'content' | 'onClick' | 'onChange' | 'showMediaAtAllSizes' | 'decision'\n>;\n\nexport default function SelectOption<T>({\n selected = undefined,\n options,\n onChange,\n placeholder,\n disabled,\n ...props\n}: SelectOptionProps<T>) {\n const intl = useIntl();\n const rootRef = useRef(null);\n const [showOptions, setShowOptions] = useState(false);\n\n const hasSelected = selected !== undefined;\n const isLargeScreen = useScreenSize(Breakpoint.SMALL);\n\n const inputAttributes = useInputAttributes();\n const ariaLabelledBy = props['aria-labelledby'] ?? inputAttributes?.['aria-labelledby'];\n\n function handleOnClick(showOptionsStatus: boolean) {\n return () => {\n setShowOptions(showOptionsStatus);\n };\n }\n\n function handleOnChange(data: SelectOptionValue<T>) {\n return () => {\n setShowOptions(false);\n onChange(data);\n };\n }\n\n function getOptions(isLargeScreen = false) {\n return (\n <div className={classNames({ 'np-select-option-list': isLargeScreen })}>\n {options.map((optionsSection, index) => (\n <Section key={index} className={classNames({ 'p-x-2 p-y-1': isLargeScreen })}>\n {optionsSection.title && <Header title={optionsSection.title} />}\n <NavigationOptionsList>\n {optionsSection.options.map((option, index) => {\n return (\n <NavigationOption\n key={index}\n isContainerAligned={!isLargeScreen}\n showMediaCircle\n showMediaAtAllSizes\n onClick={handleOnChange(option)}\n {...option}\n />\n );\n })}\n </NavigationOptionsList>\n </Section>\n ))}\n </div>\n );\n }\n\n return (\n <>\n <Option\n ref={rootRef}\n as=\"div\"\n showMediaAtAllSizes\n disabled={disabled}\n decision={false}\n media={hasSelected ? selected.media : placeholder.media ?? <Plus size={24} />}\n title={(hasSelected ? selected : placeholder).title}\n content={(hasSelected ? selected : placeholder).content}\n className={classNames(\n 'np-select-option',\n 'clickable',\n hasSelected ? 'np-select-option-selected' : 'np-select-option-placeholder',\n props.className,\n )}\n button={\n <button\n {...inputAttributes}\n type=\"button\"\n disabled={disabled}\n aria-labelledby={ariaLabelledBy}\n aria-haspopup=\"dialog\"\n aria-expanded={showOptions}\n className={hasSelected ? 'btn-unstyled' : 'np-action-btn'}\n aria-label={hasSelected ? undefined : props['aria-label']}\n onClick={handleOnClick(true)}\n >\n {hasSelected ? (\n <ChevronDown title={intl.formatMessage(messages.selectedActionLabel)} />\n ) : (\n placeholder.actionLabel || intl.formatMessage(messages.actionLabel)\n )}\n </button>\n }\n />\n <ResponsivePanel\n anchorWidth\n altAxis\n anchorRef={rootRef}\n open={showOptions}\n position={Position.BOTTOM}\n onClose={handleOnClick(false)}\n >\n {getOptions(isLargeScreen)}\n </ResponsivePanel>\n </>\n );\n}\n"],"names":["SelectOption","selected","undefined","options","onChange","placeholder","disabled","props","intl","useIntl","rootRef","useRef","showOptions","setShowOptions","useState","hasSelected","isLargeScreen","useScreenSize","Breakpoint","SMALL","inputAttributes","useInputAttributes","ariaLabelledBy","handleOnClick","showOptionsStatus","handleOnChange","data","getOptions","_jsx","className","classNames","children","map","optionsSection","index","_jsxs","Section","title","Header","NavigationOptionsList","option","NavigationOption","isContainerAligned","showMediaCircle","showMediaAtAllSizes","onClick","_Fragment","Option","ref","as","decision","media","Plus","size","content","button","type","ChevronDown","formatMessage","messages","selectedActionLabel","actionLabel","ResponsivePanel","anchorWidth","altAxis","anchorRef","open","position","Position","BOTTOM","onClose"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA4CwB,SAAAA,YAAYA,CAAI;AACtCC,EAAAA,QAAQ,GAAGC,SAAS;EACpBC,OAAO;EACPC,QAAQ;EACRC,WAAW;EACXC,QAAQ;EACR,GAAGC,KAAAA;AACkB,CAAA,EAAA;AACrB,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE,CAAA;AACtB,EAAA,MAAMC,OAAO,GAAGC,YAAM,CAAC,IAAI,CAAC,CAAA;EAC5B,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGC,cAAQ,CAAC,KAAK,CAAC,CAAA;AAErD,EAAA,MAAMC,WAAW,GAAGd,QAAQ,KAAKC,SAAS,CAAA;AAC1C,EAAA,MAAMc,aAAa,GAAGC,2BAAa,CAACC,qBAAU,CAACC,KAAK,CAAC,CAAA;AAErD,EAAA,MAAMC,eAAe,GAAGC,2BAAkB,EAAE,CAAA;EAC5C,MAAMC,cAAc,GAAGf,KAAK,CAAC,iBAAiB,CAAC,IAAIa,eAAe,GAAG,iBAAiB,CAAC,CAAA;EAEvF,SAASG,aAAaA,CAACC,iBAA0B,EAAA;AAC/C,IAAA,OAAO,MAAK;MACVX,cAAc,CAACW,iBAAiB,CAAC,CAAA;KAClC,CAAA;AACH,GAAA;EAEA,SAASC,cAAcA,CAACC,IAA0B,EAAA;AAChD,IAAA,OAAO,MAAK;MACVb,cAAc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ACC,qBAAQ,CAACE,WAAW,CAAA;OAE9D,CAAA;AACT,KAEH,CAAA,eAAAjC,cAAA,CAACkC,eAAe,EAAA;MACdC,WAAW,EAAA,IAAA;MACXC,OAAO,EAAA,IAAA;AACPC,MAAAA,SAAS,EAAEvD,OAAQ;AACnBwD,MAAAA,IAAI,EAAEtD,WAAY;MAClBuD,QAAQ,EAAEC,iBAAQ,CAACC,MAAO;AAC1BC,MAAAA,OAAO,EAAE/C,aAAa,CAAC,KAAK,CAAE;MAAAQ,QAAA,EAE7BJ,UAAU,CAACX,aAAa,CAAA;AAAC,KACX,CACnB,CAAA;AAAA,GAAA,CAAG,CAAA;AAEP;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var reactIntl = require('react-intl');
|
|
4
|
+
|
|
5
|
+
var messages = reactIntl.defineMessages({
|
|
6
|
+
actionLabel: {
|
|
7
|
+
id: "neptune.SelectOption.action.label"
|
|
8
|
+
},
|
|
9
|
+
selectedActionLabel: {
|
|
10
|
+
id: "neptune.SelectOption.selected.action.label"
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
module.exports = messages;
|
|
15
|
+
//# sourceMappingURL=SelectOption.messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectOption.messages.js","sources":["../../src/selectOption/SelectOption.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n actionLabel: {\n id: 'neptune.SelectOption.action.label',\n defaultMessage: 'Choose',\n },\n selectedActionLabel: {\n id: 'neptune.SelectOption.selected.action.label',\n defaultMessage: 'Change chosen option',\n },\n});\n"],"names":["defineMessages","actionLabel","id","selectedActionLabel"],"mappings":";;;;AAEA,eAAeA,wBAAc,CAAC;AAC5BC,EAAAA,WAAW,EAAE;IACXC,EAAE,EAAA,mCAAA;GAEH;AACDC,EAAAA,mBAAmB,EAAE;IACnBD,EAAE,EAAA,4CAAA;AAEH,GAAA;AACF,CAAA,CAAC;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl';
|
|
2
|
+
|
|
3
|
+
var messages = defineMessages({
|
|
4
|
+
actionLabel: {
|
|
5
|
+
id: "neptune.SelectOption.action.label"
|
|
6
|
+
},
|
|
7
|
+
selectedActionLabel: {
|
|
8
|
+
id: "neptune.SelectOption.selected.action.label"
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export { messages as default };
|
|
13
|
+
//# sourceMappingURL=SelectOption.messages.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectOption.messages.mjs","sources":["../../src/selectOption/SelectOption.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n actionLabel: {\n id: 'neptune.SelectOption.action.label',\n defaultMessage: 'Choose',\n },\n selectedActionLabel: {\n id: 'neptune.SelectOption.selected.action.label',\n defaultMessage: 'Change chosen option',\n },\n});\n"],"names":["defineMessages","actionLabel","id","selectedActionLabel"],"mappings":";;AAEA,eAAeA,cAAc,CAAC;AAC5BC,EAAAA,WAAW,EAAE;IACXC,EAAE,EAAA,mCAAA;GAEH;AACDC,EAAAA,mBAAmB,EAAE;IACnBD,EAAE,EAAA,4CAAA;AAEH,GAAA;AACF,CAAA,CAAC;;;;"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { useRef, useState } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import Option from '../common/Option/Option.mjs';
|
|
4
|
+
import Section from '../section/Section.mjs';
|
|
5
|
+
import { Header } from '../header/Header.mjs';
|
|
6
|
+
import NavigationOption from '../navigationOption/NavigationOption.mjs';
|
|
7
|
+
import NavigationOptionList from '../navigationOptionsList/NavigationOptionsList.mjs';
|
|
8
|
+
import { useInputAttributes } from '../inputs/contexts.mjs';
|
|
9
|
+
import messages from './SelectOption.messages.mjs';
|
|
10
|
+
import { useIntl } from 'react-intl';
|
|
11
|
+
import { useScreenSize } from '../common/hooks/useScreenSize.mjs';
|
|
12
|
+
import { Plus, ChevronDown } from '@transferwise/icons';
|
|
13
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
14
|
+
import { Breakpoint } from '../common/propsValues/breakpoint.mjs';
|
|
15
|
+
import ResponsivePanel from '../common/responsivePanel/ResponsivePanel.mjs';
|
|
16
|
+
import { Position } from '../common/propsValues/position.mjs';
|
|
17
|
+
|
|
18
|
+
function SelectOption({
|
|
19
|
+
selected = undefined,
|
|
20
|
+
options,
|
|
21
|
+
onChange,
|
|
22
|
+
placeholder,
|
|
23
|
+
disabled,
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
26
|
+
const intl = useIntl();
|
|
27
|
+
const rootRef = useRef(null);
|
|
28
|
+
const [showOptions, setShowOptions] = useState(false);
|
|
29
|
+
const hasSelected = selected !== undefined;
|
|
30
|
+
const isLargeScreen = useScreenSize(Breakpoint.SMALL);
|
|
31
|
+
const inputAttributes = useInputAttributes();
|
|
32
|
+
const ariaLabelledBy = props['aria-labelledby'] ?? inputAttributes?.['aria-labelledby'];
|
|
33
|
+
function handleOnClick(showOptionsStatus) {
|
|
34
|
+
return () => {
|
|
35
|
+
setShowOptions(showOptionsStatus);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function handleOnChange(data) {
|
|
39
|
+
return () => {
|
|
40
|
+
setShowOptions(false);
|
|
41
|
+
onChange(data);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function getOptions(isLargeScreen = false) {
|
|
45
|
+
return /*#__PURE__*/jsx("div", {
|
|
46
|
+
className: classNames({
|
|
47
|
+
'np-select-option-list': isLargeScreen
|
|
48
|
+
}),
|
|
49
|
+
children: options.map((optionsSection, index) => /*#__PURE__*/jsxs(Section, {
|
|
50
|
+
className: classNames({
|
|
51
|
+
'p-x-2 p-y-1': isLargeScreen
|
|
52
|
+
}),
|
|
53
|
+
children: [optionsSection.title && /*#__PURE__*/jsx(Header, {
|
|
54
|
+
title: optionsSection.title
|
|
55
|
+
}), /*#__PURE__*/jsx(NavigationOptionList, {
|
|
56
|
+
children: optionsSection.options.map((option, index) => {
|
|
57
|
+
return /*#__PURE__*/jsx(NavigationOption, {
|
|
58
|
+
isContainerAligned: !isLargeScreen,
|
|
59
|
+
showMediaCircle: true,
|
|
60
|
+
showMediaAtAllSizes: true,
|
|
61
|
+
onClick: handleOnChange(option),
|
|
62
|
+
...option
|
|
63
|
+
}, index);
|
|
64
|
+
})
|
|
65
|
+
})]
|
|
66
|
+
}, index))
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
70
|
+
children: [/*#__PURE__*/jsx(Option, {
|
|
71
|
+
ref: rootRef,
|
|
72
|
+
as: "div",
|
|
73
|
+
showMediaAtAllSizes: true,
|
|
74
|
+
disabled: disabled,
|
|
75
|
+
decision: false,
|
|
76
|
+
media: hasSelected ? selected.media : placeholder.media ?? /*#__PURE__*/jsx(Plus, {
|
|
77
|
+
size: 24
|
|
78
|
+
}),
|
|
79
|
+
title: (hasSelected ? selected : placeholder).title,
|
|
80
|
+
content: (hasSelected ? selected : placeholder).content,
|
|
81
|
+
className: classNames('np-select-option', 'clickable', hasSelected ? 'np-select-option-selected' : 'np-select-option-placeholder', props.className),
|
|
82
|
+
button: /*#__PURE__*/jsx("button", {
|
|
83
|
+
...inputAttributes,
|
|
84
|
+
type: "button",
|
|
85
|
+
disabled: disabled,
|
|
86
|
+
"aria-labelledby": ariaLabelledBy,
|
|
87
|
+
"aria-haspopup": "dialog",
|
|
88
|
+
"aria-expanded": showOptions,
|
|
89
|
+
className: hasSelected ? 'btn-unstyled' : 'np-action-btn',
|
|
90
|
+
"aria-label": hasSelected ? undefined : props['aria-label'],
|
|
91
|
+
onClick: handleOnClick(true),
|
|
92
|
+
children: hasSelected ? /*#__PURE__*/jsx(ChevronDown, {
|
|
93
|
+
title: intl.formatMessage(messages.selectedActionLabel)
|
|
94
|
+
}) : placeholder.actionLabel || intl.formatMessage(messages.actionLabel)
|
|
95
|
+
})
|
|
96
|
+
}), /*#__PURE__*/jsx(ResponsivePanel, {
|
|
97
|
+
anchorWidth: true,
|
|
98
|
+
altAxis: true,
|
|
99
|
+
anchorRef: rootRef,
|
|
100
|
+
open: showOptions,
|
|
101
|
+
position: Position.BOTTOM,
|
|
102
|
+
onClose: handleOnClick(false),
|
|
103
|
+
children: getOptions(isLargeScreen)
|
|
104
|
+
})]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export { SelectOption as default };
|
|
109
|
+
//# sourceMappingURL=SelectOption.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectOption.mjs","sources":["../../src/selectOption/SelectOption.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { ActionButtonProps } from '../actionButton';\nimport classNames from 'classnames';\nimport Option from '../common/Option';\nimport type { OptionProps } from '../common/Option/Option';\nimport { Breakpoint, Position } from '../common';\nimport Section from '../section';\nimport Header from '../header';\nimport { HeaderProps } from '../header/Header';\nimport NavigationOption from '../navigationOption';\nimport NavigationOptionsList from '../navigationOptionsList';\nimport { useInputAttributes } from '../inputs/contexts';\nimport messages from './SelectOption.messages';\nimport { useIntl } from 'react-intl';\nimport ResponsivePanel from '../common/responsivePanel';\nimport { useScreenSize } from '../common/hooks/useScreenSize';\nimport { ChevronDown, Plus } from '@transferwise/icons';\n\nexport type SelectOptiopsSection<T = unknown> = {\n title?: HeaderProps['title'];\n options: SelectOptionValue<T>[];\n};\n\nexport type SelectOptionValue<T = unknown> = Pick<\n OptionProps,\n 'media' | 'title' | 'content' | 'disabled'\n> & {\n value?: T;\n};\n\nexport type SelectOptionPlaceholder = Pick<OptionProps, 'media' | 'title' | 'content'> & {\n actionLabel?: ActionButtonProps['children'];\n};\n\nexport type SelectOptionProps<T = unknown> = {\n onChange: (selected: SelectOptionValue<T>) => void;\n selected?: SelectOptionValue<T>;\n options: SelectOptiopsSection<T>[];\n placeholder: SelectOptionPlaceholder;\n} & Omit<\n OptionProps,\n 'as' | 'title' | 'media' | 'content' | 'onClick' | 'onChange' | 'showMediaAtAllSizes' | 'decision'\n>;\n\nexport default function SelectOption<T>({\n selected = undefined,\n options,\n onChange,\n placeholder,\n disabled,\n ...props\n}: SelectOptionProps<T>) {\n const intl = useIntl();\n const rootRef = useRef(null);\n const [showOptions, setShowOptions] = useState(false);\n\n const hasSelected = selected !== undefined;\n const isLargeScreen = useScreenSize(Breakpoint.SMALL);\n\n const inputAttributes = useInputAttributes();\n const ariaLabelledBy = props['aria-labelledby'] ?? inputAttributes?.['aria-labelledby'];\n\n function handleOnClick(showOptionsStatus: boolean) {\n return () => {\n setShowOptions(showOptionsStatus);\n };\n }\n\n function handleOnChange(data: SelectOptionValue<T>) {\n return () => {\n setShowOptions(false);\n onChange(data);\n };\n }\n\n function getOptions(isLargeScreen = false) {\n return (\n <div className={classNames({ 'np-select-option-list': isLargeScreen })}>\n {options.map((optionsSection, index) => (\n <Section key={index} className={classNames({ 'p-x-2 p-y-1': isLargeScreen })}>\n {optionsSection.title && <Header title={optionsSection.title} />}\n <NavigationOptionsList>\n {optionsSection.options.map((option, index) => {\n return (\n <NavigationOption\n key={index}\n isContainerAligned={!isLargeScreen}\n showMediaCircle\n showMediaAtAllSizes\n onClick={handleOnChange(option)}\n {...option}\n />\n );\n })}\n </NavigationOptionsList>\n </Section>\n ))}\n </div>\n );\n }\n\n return (\n <>\n <Option\n ref={rootRef}\n as=\"div\"\n showMediaAtAllSizes\n disabled={disabled}\n decision={false}\n media={hasSelected ? selected.media : placeholder.media ?? <Plus size={24} />}\n title={(hasSelected ? selected : placeholder).title}\n content={(hasSelected ? selected : placeholder).content}\n className={classNames(\n 'np-select-option',\n 'clickable',\n hasSelected ? 'np-select-option-selected' : 'np-select-option-placeholder',\n props.className,\n )}\n button={\n <button\n {...inputAttributes}\n type=\"button\"\n disabled={disabled}\n aria-labelledby={ariaLabelledBy}\n aria-haspopup=\"dialog\"\n aria-expanded={showOptions}\n className={hasSelected ? 'btn-unstyled' : 'np-action-btn'}\n aria-label={hasSelected ? undefined : props['aria-label']}\n onClick={handleOnClick(true)}\n >\n {hasSelected ? (\n <ChevronDown title={intl.formatMessage(messages.selectedActionLabel)} />\n ) : (\n placeholder.actionLabel || intl.formatMessage(messages.actionLabel)\n )}\n </button>\n }\n />\n <ResponsivePanel\n anchorWidth\n altAxis\n anchorRef={rootRef}\n open={showOptions}\n position={Position.BOTTOM}\n onClose={handleOnClick(false)}\n >\n {getOptions(isLargeScreen)}\n </ResponsivePanel>\n </>\n );\n}\n"],"names":["SelectOption","selected","undefined","options","onChange","placeholder","disabled","props","intl","useIntl","rootRef","useRef","showOptions","setShowOptions","useState","hasSelected","isLargeScreen","useScreenSize","Breakpoint","SMALL","inputAttributes","useInputAttributes","ariaLabelledBy","handleOnClick","showOptionsStatus","handleOnChange","data","getOptions","_jsx","className","classNames","children","map","optionsSection","index","_jsxs","Section","title","Header","NavigationOptionsList","option","NavigationOption","isContainerAligned","showMediaCircle","showMediaAtAllSizes","onClick","_Fragment","Option","ref","as","decision","media","Plus","size","content","button","type","ChevronDown","formatMessage","messages","selectedActionLabel","actionLabel","ResponsivePanel","anchorWidth","altAxis","anchorRef","open","position","Position","BOTTOM","onClose"],"mappings":";;;;;;;;;;;;;;;;;AA4CwB,SAAAA,YAAYA,CAAI;AACtCC,EAAAA,QAAQ,GAAGC,SAAS;EACpBC,OAAO;EACPC,QAAQ;EACRC,WAAW;EACXC,QAAQ;EACR,GAAGC,KAAAA;AACkB,CAAA,EAAA;AACrB,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE,CAAA;AACtB,EAAA,MAAMC,OAAO,GAAGC,MAAM,CAAC,IAAI,CAAC,CAAA;EAC5B,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGC,QAAQ,CAAC,KAAK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Ae;AAChC,QAAA,eAAA,EAAc,QAAQ;AACtB,QAAA,eAAA,EAAeV,WAAY;AAC3BiB,QAAAA,SAAS,EAAEd,WAAW,GAAG,cAAc,GAAG,eAAgB;AAC1D,QAAA,YAAA,EAAYA,WAAW,GAAGb,SAAS,GAAGK,KAAK,CAAC,YAAY,CAAE;AAC1DsC,QAAAA,OAAO,EAAEtB,aAAa,CAAC,IAAI,CAAE;AAAAQ,QAAAA,QAAA,EAE5BhB,WAAW,gBACVa,GAAA,CAAC6B,WAAW,EAAA;AAACpB,UAAAA,KAAK,EAAE7B,IAAI,CAACkD,aAAa,CAACC,QAAQ,CAACC,mBAAmB,CAAA;AAAE,SAAA,CAAG,GAExEvD,WAAW,CAACwD,WAAW,IAAIrD,IAAI,CAACkD,aAAa,CAACC,QAAQ,CAACE,WAAW,CAAA;OAE9D,CAAA;AACT,KAEH,CAAA,eAAAjC,GAAA,CAACkC,eAAe,EAAA;MACdC,WAAW,EAAA,IAAA;MACXC,OAAO,EAAA,IAAA;AACPC,MAAAA,SAAS,EAAEvD,OAAQ;AACnBwD,MAAAA,IAAI,EAAEtD,WAAY;MAClBuD,QAAQ,EAAEC,QAAQ,CAACC,MAAO;AAC1BC,MAAAA,OAAO,EAAE/C,aAAa,CAAC,KAAK,CAAE;MAAAQ,QAAA,EAE7BJ,UAAU,CAACX,aAAa,CAAA;AAAC,KACX,CACnB,CAAA;AAAA,GAAA,CAAG,CAAA;AAEP;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlidingPanel.js","sources":["../../src/slidingPanel/SlidingPanel.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { forwardRef, useImperativeHandle, useRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\n\nimport { Position } from '../common';\n\nexport const EXIT_ANIMATION = 350;\n\nexport interface SlidingPanelProps\n extends Pick<React.ComponentPropsWithRef<'div'>, 'ref' | 'className' | 'children'> {\n position?: `${Position.TOP | Position.RIGHT | Position.BOTTOM | Position.LEFT}`;\n open: boolean;\n showSlidingPanelBorder?: boolean;\n slidingPanelPositionFixed?: boolean;\n testId?: string;\n}\n\nconst SlidingPanel = forwardRef(\n (\n {\n position = 'left',\n open,\n showSlidingPanelBorder,\n slidingPanelPositionFixed,\n className,\n children,\n testId,\n ...rest\n }: Omit<SlidingPanelProps, 'ref'>,\n reference: React.ForwardedRef<HTMLDivElement | null>,\n ) => {\n const localReference = useRef<HTMLDivElement>(null as never);\n useImperativeHandle(reference, () => localReference.current, []);\n\n return (\n <CSSTransition\n {...rest}\n key={`sliding-panel--open-${position}`}\n nodeRef={localReference}\n in={open}\n // Wait for animation to finish before unmount.\n timeout={{ enter: 0, exit: EXIT_ANIMATION }}\n classNames=\"sliding-panel\"\n appear\n unmountOnExit\n >\n <div\n ref={localReference}\n data-testid={testId}\n className={classNames(\n 'sliding-panel',\n `sliding-panel--open-${position}`,\n showSlidingPanelBorder && `sliding-panel--border-${position}`,\n slidingPanelPositionFixed && 'sliding-panel--fixed',\n className,\n )}\n >\n {children}\n </div>\n </CSSTransition>\n );\n },\n);\n\nexport default SlidingPanel;\n"],"names":["EXIT_ANIMATION","SlidingPanel","forwardRef","position","open","showSlidingPanelBorder","slidingPanelPositionFixed","className","children","testId","rest","reference","localReference","useRef","useImperativeHandle","current","_createElement","CSSTransition","key","nodeRef","in","timeout","enter","exit","classNames","appear","unmountOnExit","_jsx","ref"],"mappings":";;;;;;;;;;;;;AAMO,MAAMA,cAAc,GAAG,IAAG;AAWjC,MAAMC,YAAY,gBAAGC,gBAAU,CAC7B,CACE;AACEC,EAAAA,QAAQ,GAAG,MAAM;EACjBC,IAAI;EACJC,sBAAsB;EACtBC,yBAAyB;EACzBC,SAAS;EACTC,QAAQ;EACRC,MAAM;EACN,GAAGC,IAAAA;AAC4B,CAAA,EACjCC,SAAoD,KAClD;AACF,EAAA,MAAMC,cAAc,GAAGC,YAAM,CAAiB,IAAa,CAAC,CAAA;EAC5DC,yBAAmB,CAACH,SAAS,EAAE,MAAMC,cAAc,CAACG,OAAO,EAAE,EAAE,CAAC,CAAA;EAEhE,oBACEC,mBAAA,CAACC,kCAAa,EAAA;AAAA,IAAA,GACRP,IAAI;IACRQ,GAAG,
|
|
1
|
+
{"version":3,"file":"SlidingPanel.js","sources":["../../src/slidingPanel/SlidingPanel.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { forwardRef, useImperativeHandle, useRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\n\nimport { Position } from '../common';\n\nexport const EXIT_ANIMATION = 350;\n\nexport interface SlidingPanelProps\n extends Pick<React.ComponentPropsWithRef<'div'>, 'ref' | 'className' | 'children'> {\n position?: `${Position.TOP | Position.RIGHT | Position.BOTTOM | Position.LEFT}`;\n open: boolean;\n showSlidingPanelBorder?: boolean;\n slidingPanelPositionFixed?: boolean;\n testId?: string;\n}\n\nconst SlidingPanel = forwardRef(\n (\n {\n position = 'left',\n open,\n showSlidingPanelBorder,\n slidingPanelPositionFixed,\n className,\n children,\n testId,\n ...rest\n }: Omit<SlidingPanelProps, 'ref'>,\n reference: React.ForwardedRef<HTMLDivElement | null>,\n ) => {\n const localReference = useRef<HTMLDivElement>(null as never);\n useImperativeHandle(reference, () => localReference.current, []);\n\n return (\n <CSSTransition\n {...rest}\n key={`sliding-panel--open-${position}`}\n nodeRef={localReference}\n in={open}\n // Wait for animation to finish before unmount.\n timeout={{ enter: 0, exit: EXIT_ANIMATION }}\n classNames=\"sliding-panel\"\n appear\n unmountOnExit\n >\n <div\n ref={localReference}\n data-testid={testId}\n className={classNames(\n 'sliding-panel',\n `sliding-panel--open-${position}`,\n showSlidingPanelBorder && `sliding-panel--border-${position}`,\n slidingPanelPositionFixed && 'sliding-panel--fixed',\n className,\n )}\n >\n {children}\n </div>\n </CSSTransition>\n );\n },\n);\n\nexport default SlidingPanel;\n"],"names":["EXIT_ANIMATION","SlidingPanel","forwardRef","position","open","showSlidingPanelBorder","slidingPanelPositionFixed","className","children","testId","rest","reference","localReference","useRef","useImperativeHandle","current","_createElement","CSSTransition","key","nodeRef","in","timeout","enter","exit","classNames","appear","unmountOnExit","_jsx","ref"],"mappings":";;;;;;;;;;;;;AAMO,MAAMA,cAAc,GAAG,IAAG;AAWjC,MAAMC,YAAY,gBAAGC,gBAAU,CAC7B,CACE;AACEC,EAAAA,QAAQ,GAAG,MAAM;EACjBC,IAAI;EACJC,sBAAsB;EACtBC,yBAAyB;EACzBC,SAAS;EACTC,QAAQ;EACRC,MAAM;EACN,GAAGC,IAAAA;AAC4B,CAAA,EACjCC,SAAoD,KAClD;AACF,EAAA,MAAMC,cAAc,GAAGC,YAAM,CAAiB,IAAa,CAAC,CAAA;EAC5DC,yBAAmB,CAACH,SAAS,EAAE,MAAMC,cAAc,CAACG,OAAO,EAAE,EAAE,CAAC,CAAA;EAEhE,oBACEC,mBAAA,CAACC,kCAAa,EAAA;AAAA,IAAA,GACRP,IAAI;IACRQ,GAAG,EAAE,CAAuBf,oBAAAA,EAAAA,QAAQ,CAAG,CAAA;AACvCgB,IAAAA,OAAO,EAAEP,cAAe;AACxBQ,IAAAA,EAAE,EAAEhB,IAAAA;AACJ;AAAA;AACAiB,IAAAA,OAAO,EAAE;AAAEC,MAAAA,KAAK,EAAE,CAAC;AAAEC,MAAAA,IAAI,EAAEvB,cAAAA;KAAiB;AAC5CwB,IAAAA,UAAU,EAAC,eAAe;IAC1BC,MAAM,EAAA,IAAA;IACNC,aAAa,EAAA,IAAA;AAAA,GAAA,eAEbC,cAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,GAAG,EAAEhB,cAAe;AACpB,IAAA,aAAA,EAAaH,MAAO;IACpBF,SAAS,EAAEiB,2BAAU,CACnB,eAAe,EACf,CAAuBrB,oBAAAA,EAAAA,QAAQ,EAAE,EACjCE,sBAAsB,IAAI,CAAyBF,sBAAAA,EAAAA,QAAQ,EAAE,EAC7DG,yBAAyB,IAAI,sBAAsB,EACnDC,SAAS,CACT;AAAAC,IAAAA,QAAA,EAEDA,QAAAA;AAAQ,GACN,CACQ,CAAC,CAAA;AAEpB,CAAC;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlidingPanel.mjs","sources":["../../src/slidingPanel/SlidingPanel.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { forwardRef, useImperativeHandle, useRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\n\nimport { Position } from '../common';\n\nexport const EXIT_ANIMATION = 350;\n\nexport interface SlidingPanelProps\n extends Pick<React.ComponentPropsWithRef<'div'>, 'ref' | 'className' | 'children'> {\n position?: `${Position.TOP | Position.RIGHT | Position.BOTTOM | Position.LEFT}`;\n open: boolean;\n showSlidingPanelBorder?: boolean;\n slidingPanelPositionFixed?: boolean;\n testId?: string;\n}\n\nconst SlidingPanel = forwardRef(\n (\n {\n position = 'left',\n open,\n showSlidingPanelBorder,\n slidingPanelPositionFixed,\n className,\n children,\n testId,\n ...rest\n }: Omit<SlidingPanelProps, 'ref'>,\n reference: React.ForwardedRef<HTMLDivElement | null>,\n ) => {\n const localReference = useRef<HTMLDivElement>(null as never);\n useImperativeHandle(reference, () => localReference.current, []);\n\n return (\n <CSSTransition\n {...rest}\n key={`sliding-panel--open-${position}`}\n nodeRef={localReference}\n in={open}\n // Wait for animation to finish before unmount.\n timeout={{ enter: 0, exit: EXIT_ANIMATION }}\n classNames=\"sliding-panel\"\n appear\n unmountOnExit\n >\n <div\n ref={localReference}\n data-testid={testId}\n className={classNames(\n 'sliding-panel',\n `sliding-panel--open-${position}`,\n showSlidingPanelBorder && `sliding-panel--border-${position}`,\n slidingPanelPositionFixed && 'sliding-panel--fixed',\n className,\n )}\n >\n {children}\n </div>\n </CSSTransition>\n );\n },\n);\n\nexport default SlidingPanel;\n"],"names":["EXIT_ANIMATION","SlidingPanel","forwardRef","position","open","showSlidingPanelBorder","slidingPanelPositionFixed","className","children","testId","rest","reference","localReference","useRef","useImperativeHandle","current","_createElement","CSSTransition","key","nodeRef","in","timeout","enter","exit","classNames","appear","unmountOnExit","_jsx","ref"],"mappings":";;;;;AAMO,MAAMA,cAAc,GAAG,IAAG;AAWjC,MAAMC,YAAY,gBAAGC,UAAU,CAC7B,CACE;AACEC,EAAAA,QAAQ,GAAG,MAAM;EACjBC,IAAI;EACJC,sBAAsB;EACtBC,yBAAyB;EACzBC,SAAS;EACTC,QAAQ;EACRC,MAAM;EACN,GAAGC,IAAAA;AAC4B,CAAA,EACjCC,SAAoD,KAClD;AACF,EAAA,MAAMC,cAAc,GAAGC,MAAM,CAAiB,IAAa,CAAC,CAAA;EAC5DC,mBAAmB,CAACH,SAAS,EAAE,MAAMC,cAAc,CAACG,OAAO,EAAE,EAAE,CAAC,CAAA;EAEhE,oBACEC,aAAA,CAACC,aAAa,EAAA;AAAA,IAAA,GACRP,IAAI;IACRQ,GAAG,
|
|
1
|
+
{"version":3,"file":"SlidingPanel.mjs","sources":["../../src/slidingPanel/SlidingPanel.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { forwardRef, useImperativeHandle, useRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\n\nimport { Position } from '../common';\n\nexport const EXIT_ANIMATION = 350;\n\nexport interface SlidingPanelProps\n extends Pick<React.ComponentPropsWithRef<'div'>, 'ref' | 'className' | 'children'> {\n position?: `${Position.TOP | Position.RIGHT | Position.BOTTOM | Position.LEFT}`;\n open: boolean;\n showSlidingPanelBorder?: boolean;\n slidingPanelPositionFixed?: boolean;\n testId?: string;\n}\n\nconst SlidingPanel = forwardRef(\n (\n {\n position = 'left',\n open,\n showSlidingPanelBorder,\n slidingPanelPositionFixed,\n className,\n children,\n testId,\n ...rest\n }: Omit<SlidingPanelProps, 'ref'>,\n reference: React.ForwardedRef<HTMLDivElement | null>,\n ) => {\n const localReference = useRef<HTMLDivElement>(null as never);\n useImperativeHandle(reference, () => localReference.current, []);\n\n return (\n <CSSTransition\n {...rest}\n key={`sliding-panel--open-${position}`}\n nodeRef={localReference}\n in={open}\n // Wait for animation to finish before unmount.\n timeout={{ enter: 0, exit: EXIT_ANIMATION }}\n classNames=\"sliding-panel\"\n appear\n unmountOnExit\n >\n <div\n ref={localReference}\n data-testid={testId}\n className={classNames(\n 'sliding-panel',\n `sliding-panel--open-${position}`,\n showSlidingPanelBorder && `sliding-panel--border-${position}`,\n slidingPanelPositionFixed && 'sliding-panel--fixed',\n className,\n )}\n >\n {children}\n </div>\n </CSSTransition>\n );\n },\n);\n\nexport default SlidingPanel;\n"],"names":["EXIT_ANIMATION","SlidingPanel","forwardRef","position","open","showSlidingPanelBorder","slidingPanelPositionFixed","className","children","testId","rest","reference","localReference","useRef","useImperativeHandle","current","_createElement","CSSTransition","key","nodeRef","in","timeout","enter","exit","classNames","appear","unmountOnExit","_jsx","ref"],"mappings":";;;;;AAMO,MAAMA,cAAc,GAAG,IAAG;AAWjC,MAAMC,YAAY,gBAAGC,UAAU,CAC7B,CACE;AACEC,EAAAA,QAAQ,GAAG,MAAM;EACjBC,IAAI;EACJC,sBAAsB;EACtBC,yBAAyB;EACzBC,SAAS;EACTC,QAAQ;EACRC,MAAM;EACN,GAAGC,IAAAA;AAC4B,CAAA,EACjCC,SAAoD,KAClD;AACF,EAAA,MAAMC,cAAc,GAAGC,MAAM,CAAiB,IAAa,CAAC,CAAA;EAC5DC,mBAAmB,CAACH,SAAS,EAAE,MAAMC,cAAc,CAACG,OAAO,EAAE,EAAE,CAAC,CAAA;EAEhE,oBACEC,aAAA,CAACC,aAAa,EAAA;AAAA,IAAA,GACRP,IAAI;IACRQ,GAAG,EAAE,CAAuBf,oBAAAA,EAAAA,QAAQ,CAAG,CAAA;AACvCgB,IAAAA,OAAO,EAAEP,cAAe;AACxBQ,IAAAA,EAAE,EAAEhB,IAAAA;AACJ;AAAA;AACAiB,IAAAA,OAAO,EAAE;AAAEC,MAAAA,KAAK,EAAE,CAAC;AAAEC,MAAAA,IAAI,EAAEvB,cAAAA;KAAiB;AAC5CwB,IAAAA,UAAU,EAAC,eAAe;IAC1BC,MAAM,EAAA,IAAA;IACNC,aAAa,EAAA,IAAA;AAAA,GAAA,eAEbC,GAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,GAAG,EAAEhB,cAAe;AACpB,IAAA,aAAA,EAAaH,MAAO;IACpBF,SAAS,EAAEiB,UAAU,CACnB,eAAe,EACf,CAAuBrB,oBAAAA,EAAAA,QAAQ,EAAE,EACjCE,sBAAsB,IAAI,CAAyBF,sBAAAA,EAAAA,QAAQ,EAAE,EAC7DG,yBAAyB,IAAI,sBAAsB,EACnDC,SAAS,CACT;AAAAC,IAAAA,QAAA,EAEDA,QAAAA;AAAQ,GACN,CACQ,CAAC,CAAA;AAEpB,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusIcon.js","sources":["../../src/statusIcon/StatusIcon.tsx"],"sourcesContent":["import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';\nimport classNames from 'classnames';\n\nimport { SizeSmall, SizeMedium, SizeLarge, Sentiment } from '../common';\n\nexport type StatusIconProps = {\n sentiment: `${Sentiment}`;\n size: SizeSmall | SizeMedium | SizeLarge;\n};\n\nconst iconTypeMap = {\n positive: Check,\n neutral: Info,\n warning: Alert,\n negative: Cross,\n pending: ClockBorderless,\n info: Info,\n error: Cross,\n success: Check,\n} satisfies Record<`${Sentiment}`, React.ElementType>;\n\nconst StatusIcon = ({ sentiment = 'neutral', size = 'md' }: StatusIconProps) => {\n const Icon = iconTypeMap[sentiment];\n const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';\n\n return (\n <span\n data-testid=\"status-icon\"\n className={classNames('status-circle', `status-circle-${size}`, sentiment)}\n >\n <Icon className={classNames('status-icon', iconColor)} />\n </span>\n );\n};\n\nexport default StatusIcon;\n"],"names":["iconTypeMap","positive","Check","neutral","Info","warning","Alert","negative","Cross","pending","ClockBorderless","info","error","success","StatusIcon","sentiment","size","Icon","iconColor","_jsx","className","classNames","children"],"mappings":";;;;;;;;;;AAUA,MAAMA,WAAW,GAAG;AAClBC,EAAAA,QAAQ,EAAEC,WAAK;AACfC,EAAAA,OAAO,EAAEC,UAAI;AACbC,EAAAA,OAAO,EAAEC,WAAK;AACdC,EAAAA,QAAQ,EAAEC,WAAK;AACfC,EAAAA,OAAO,EAAEC,qBAAe;AACxBC,EAAAA,IAAI,EAAEP,UAAI;AACVQ,EAAAA,KAAK,EAAEJ,WAAK;AACZK,EAAAA,OAAO,EAAEX,WAAAA;CAC0C,CAAA;AAE/CY,MAAAA,UAAU,GAAGA,CAAC;AAAEC,EAAAA,SAAS,GAAG,SAAS;AAAEC,EAAAA,IAAI,GAAG,IAAA;AAAI,CAAmB,KAAI;AAC7E,EAAA,MAAMC,IAAI,GAAGjB,WAAW,CAACe,SAAS,CAAC,CAAA;AACnC,EAAA,MAAMG,SAAS,GAAGH,SAAS,KAAK,SAAS,IAAIA,SAAS,KAAK,SAAS,GAAG,MAAM,GAAG,OAAO,CAAA;AAEvF,EAAA,oBACEI,cAAA,CAAA,MAAA,EAAA;AACE,IAAA,aAAA,EAAY,aAAa;IACzBC,SAAS,EAAEC,2BAAU,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"StatusIcon.js","sources":["../../src/statusIcon/StatusIcon.tsx"],"sourcesContent":["import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';\nimport classNames from 'classnames';\n\nimport { SizeSmall, SizeMedium, SizeLarge, Sentiment } from '../common';\n\nexport type StatusIconProps = {\n sentiment: `${Sentiment}`;\n size: SizeSmall | SizeMedium | SizeLarge;\n};\n\nconst iconTypeMap = {\n positive: Check,\n neutral: Info,\n warning: Alert,\n negative: Cross,\n pending: ClockBorderless,\n info: Info,\n error: Cross,\n success: Check,\n} satisfies Record<`${Sentiment}`, React.ElementType>;\n\nconst StatusIcon = ({ sentiment = 'neutral', size = 'md' }: StatusIconProps) => {\n const Icon = iconTypeMap[sentiment];\n const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';\n\n return (\n <span\n data-testid=\"status-icon\"\n className={classNames('status-circle', `status-circle-${size}`, sentiment)}\n >\n <Icon className={classNames('status-icon', iconColor)} />\n </span>\n );\n};\n\nexport default StatusIcon;\n"],"names":["iconTypeMap","positive","Check","neutral","Info","warning","Alert","negative","Cross","pending","ClockBorderless","info","error","success","StatusIcon","sentiment","size","Icon","iconColor","_jsx","className","classNames","children"],"mappings":";;;;;;;;;;AAUA,MAAMA,WAAW,GAAG;AAClBC,EAAAA,QAAQ,EAAEC,WAAK;AACfC,EAAAA,OAAO,EAAEC,UAAI;AACbC,EAAAA,OAAO,EAAEC,WAAK;AACdC,EAAAA,QAAQ,EAAEC,WAAK;AACfC,EAAAA,OAAO,EAAEC,qBAAe;AACxBC,EAAAA,IAAI,EAAEP,UAAI;AACVQ,EAAAA,KAAK,EAAEJ,WAAK;AACZK,EAAAA,OAAO,EAAEX,WAAAA;CAC0C,CAAA;AAE/CY,MAAAA,UAAU,GAAGA,CAAC;AAAEC,EAAAA,SAAS,GAAG,SAAS;AAAEC,EAAAA,IAAI,GAAG,IAAA;AAAI,CAAmB,KAAI;AAC7E,EAAA,MAAMC,IAAI,GAAGjB,WAAW,CAACe,SAAS,CAAC,CAAA;AACnC,EAAA,MAAMG,SAAS,GAAGH,SAAS,KAAK,SAAS,IAAIA,SAAS,KAAK,SAAS,GAAG,MAAM,GAAG,OAAO,CAAA;AAEvF,EAAA,oBACEI,cAAA,CAAA,MAAA,EAAA;AACE,IAAA,aAAA,EAAY,aAAa;IACzBC,SAAS,EAAEC,2BAAU,CAAC,eAAe,EAAE,iBAAiBL,IAAI,CAAA,CAAE,EAAED,SAAS,CAAE;IAAAO,QAAA,eAE3EH,cAAA,CAACF,IAAI,EAAA;AAACG,MAAAA,SAAS,EAAEC,2BAAU,CAAC,aAAa,EAAEH,SAAS,CAAA;KACtD,CAAA;AAAA,GAAM,CAAC,CAAA;AAEX;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusIcon.mjs","sources":["../../src/statusIcon/StatusIcon.tsx"],"sourcesContent":["import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';\nimport classNames from 'classnames';\n\nimport { SizeSmall, SizeMedium, SizeLarge, Sentiment } from '../common';\n\nexport type StatusIconProps = {\n sentiment: `${Sentiment}`;\n size: SizeSmall | SizeMedium | SizeLarge;\n};\n\nconst iconTypeMap = {\n positive: Check,\n neutral: Info,\n warning: Alert,\n negative: Cross,\n pending: ClockBorderless,\n info: Info,\n error: Cross,\n success: Check,\n} satisfies Record<`${Sentiment}`, React.ElementType>;\n\nconst StatusIcon = ({ sentiment = 'neutral', size = 'md' }: StatusIconProps) => {\n const Icon = iconTypeMap[sentiment];\n const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';\n\n return (\n <span\n data-testid=\"status-icon\"\n className={classNames('status-circle', `status-circle-${size}`, sentiment)}\n >\n <Icon className={classNames('status-icon', iconColor)} />\n </span>\n );\n};\n\nexport default StatusIcon;\n"],"names":["iconTypeMap","positive","Check","neutral","Info","warning","Alert","negative","Cross","pending","ClockBorderless","info","error","success","StatusIcon","sentiment","size","Icon","iconColor","_jsx","className","classNames","children"],"mappings":";;;;AAUA,MAAMA,WAAW,GAAG;AAClBC,EAAAA,QAAQ,EAAEC,KAAK;AACfC,EAAAA,OAAO,EAAEC,IAAI;AACbC,EAAAA,OAAO,EAAEC,KAAK;AACdC,EAAAA,QAAQ,EAAEC,KAAK;AACfC,EAAAA,OAAO,EAAEC,eAAe;AACxBC,EAAAA,IAAI,EAAEP,IAAI;AACVQ,EAAAA,KAAK,EAAEJ,KAAK;AACZK,EAAAA,OAAO,EAAEX,KAAAA;CAC0C,CAAA;AAE/CY,MAAAA,UAAU,GAAGA,CAAC;AAAEC,EAAAA,SAAS,GAAG,SAAS;AAAEC,EAAAA,IAAI,GAAG,IAAA;AAAI,CAAmB,KAAI;AAC7E,EAAA,MAAMC,IAAI,GAAGjB,WAAW,CAACe,SAAS,CAAC,CAAA;AACnC,EAAA,MAAMG,SAAS,GAAGH,SAAS,KAAK,SAAS,IAAIA,SAAS,KAAK,SAAS,GAAG,MAAM,GAAG,OAAO,CAAA;AAEvF,EAAA,oBACEI,GAAA,CAAA,MAAA,EAAA;AACE,IAAA,aAAA,EAAY,aAAa;IACzBC,SAAS,EAAEC,UAAU,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"StatusIcon.mjs","sources":["../../src/statusIcon/StatusIcon.tsx"],"sourcesContent":["import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';\nimport classNames from 'classnames';\n\nimport { SizeSmall, SizeMedium, SizeLarge, Sentiment } from '../common';\n\nexport type StatusIconProps = {\n sentiment: `${Sentiment}`;\n size: SizeSmall | SizeMedium | SizeLarge;\n};\n\nconst iconTypeMap = {\n positive: Check,\n neutral: Info,\n warning: Alert,\n negative: Cross,\n pending: ClockBorderless,\n info: Info,\n error: Cross,\n success: Check,\n} satisfies Record<`${Sentiment}`, React.ElementType>;\n\nconst StatusIcon = ({ sentiment = 'neutral', size = 'md' }: StatusIconProps) => {\n const Icon = iconTypeMap[sentiment];\n const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';\n\n return (\n <span\n data-testid=\"status-icon\"\n className={classNames('status-circle', `status-circle-${size}`, sentiment)}\n >\n <Icon className={classNames('status-icon', iconColor)} />\n </span>\n );\n};\n\nexport default StatusIcon;\n"],"names":["iconTypeMap","positive","Check","neutral","Info","warning","Alert","negative","Cross","pending","ClockBorderless","info","error","success","StatusIcon","sentiment","size","Icon","iconColor","_jsx","className","classNames","children"],"mappings":";;;;AAUA,MAAMA,WAAW,GAAG;AAClBC,EAAAA,QAAQ,EAAEC,KAAK;AACfC,EAAAA,OAAO,EAAEC,IAAI;AACbC,EAAAA,OAAO,EAAEC,KAAK;AACdC,EAAAA,QAAQ,EAAEC,KAAK;AACfC,EAAAA,OAAO,EAAEC,eAAe;AACxBC,EAAAA,IAAI,EAAEP,IAAI;AACVQ,EAAAA,KAAK,EAAEJ,KAAK;AACZK,EAAAA,OAAO,EAAEX,KAAAA;CAC0C,CAAA;AAE/CY,MAAAA,UAAU,GAAGA,CAAC;AAAEC,EAAAA,SAAS,GAAG,SAAS;AAAEC,EAAAA,IAAI,GAAG,IAAA;AAAI,CAAmB,KAAI;AAC7E,EAAA,MAAMC,IAAI,GAAGjB,WAAW,CAACe,SAAS,CAAC,CAAA;AACnC,EAAA,MAAMG,SAAS,GAAGH,SAAS,KAAK,SAAS,IAAIA,SAAS,KAAK,SAAS,GAAG,MAAM,GAAG,OAAO,CAAA;AAEvF,EAAA,oBACEI,GAAA,CAAA,MAAA,EAAA;AACE,IAAA,aAAA,EAAY,aAAa;IACzBC,SAAS,EAAEC,UAAU,CAAC,eAAe,EAAE,iBAAiBL,IAAI,CAAA,CAAE,EAAED,SAAS,CAAE;IAAAO,QAAA,eAE3EH,GAAA,CAACF,IAAI,EAAA;AAACG,MAAAA,SAAS,EAAEC,UAAU,CAAC,aAAa,EAAEH,SAAS,CAAA;KACtD,CAAA;AAAA,GAAM,CAAC,CAAA;AAEX;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stepper.js","sources":["../../src/stepper/Stepper.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport * as React from 'react';\n\nimport { Position } from '../common';\nimport { useDirection } from '../common/hooks';\nimport Tooltip from '../tooltip';\n\nimport { isTouchDevice } from './deviceDetection';\n\nfunction clamp(from: number, to: number, value: number) {\n return Math.max(Math.min(to, value), from);\n}\n\nexport interface Step {\n label: React.ReactNode;\n onClick?: () => void;\n hoverLabel?: React.ReactNode;\n}\n\nexport interface StepperProps {\n steps: readonly Step[];\n activeStep?: number;\n className?: string;\n}\n\n/* eslint-disable react/no-array-index-key */\nconst Stepper = ({ steps, activeStep = 0, className }: StepperProps) => {\n const { isRTL } = useDirection();\n\n if (steps.length === 0) {\n return null;\n }\n\n const activeStepIndex = clamp(0, steps.length - 1, activeStep);\n const stepPercentage = 1 / (steps.length - 1);\n const percentageCompleted = activeStepIndex / (steps.length - 1);\n\n const renderStep = (step: Step, index: number) => {\n const active = index === activeStepIndex;\n const clickable = step.onClick && !active;\n\n const labelButton = clickable ? (\n <button\n type=\"button\"\n className=\"btn-unstyled tw-stepper__step-label\"\n onClick={() => clickable && step.onClick?.()}\n >\n <small>{step.label}</small>\n </button>\n ) : (\n <span className=\"tw-stepper__step-label\">{step.label}</span>\n );\n return (\n <li\n key={index}\n className={classNames(\n 'hidden-xs',\n 'tw-stepper__step',\n active ? 'np-text-body-default-bold tw-stepper__step--active' : 'np-text-body-default',\n clickable && 'tw-stepper__step--clickable',\n step.hoverLabel && 'tw-stepper__step--has-tooltip',\n )}\n aria-current={active ? 'step' : false}\n style={\n isRTL\n ? { right: `${index * stepPercentage * 100}%` }\n : { left: `${index * stepPercentage * 100}%` }\n }\n >\n {step.hoverLabel && !isTouchDevice() ? (\n <Tooltip position={Position.BOTTOM} label={step.hoverLabel}>\n {labelButton}\n </Tooltip>\n ) : (\n labelButton\n )}\n </li>\n );\n };\n\n return (\n <div className={classNames('tw-stepper', className)}>\n <div className=\"progress\">\n <div className=\"progress-bar\" style={{ width: `${percentageCompleted * 100}%` }} />\n </div>\n <ul className=\"tw-stepper-steps p-t-1 m-b-0\">{steps.map(renderStep)}</ul>\n </div>\n );\n};\n/* eslint-enable react/no-array-index-key */\n\nexport default Stepper;\n"],"names":["clamp","from","to","value","Math","max","min","Stepper","steps","activeStep","className","isRTL","useDirection","length","activeStepIndex","stepPercentage","percentageCompleted","renderStep","step","index","active","clickable","onClick","labelButton","_jsx","type","children","label","classNames","hoverLabel","style","right","left","isTouchDevice","Tooltip","position","Position","BOTTOM","_jsxs","width","map"],"mappings":";;;;;;;;;;;;;;AASA,SAASA,KAAKA,CAACC,IAAY,EAAEC,EAAU,EAAEC,KAAa,EAAA;AACpD,EAAA,OAAOC,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,GAAG,CAACJ,EAAE,EAAEC,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AAI,CAACS,KAAAA;AAAK,KAAO,CAC5D,CAAA;AACD,IAAA,oBACEH,cAAA,CAAA,IAAA,EAAA;MAEEd,SAAS,EAAEkB,2BAAU,CACnB,WAAW,EACX,kBAAkB,EAClBR,MAAM,GAAG,oDAAoD,GAAG,sBAAsB,EACtFC,SAAS,IAAI,6BAA6B,EAC1CH,IAAI,CAACW,UAAU,IAAI,+BAA+B,CAClD;AACF,MAAA,cAAA,EAAcT,MAAM,GAAG,MAAM,GAAG,KAAM;MACtCU,KAAK,EACHnB,KAAK,GACD;AAAEoB,QAAAA,KAAK,EAAE,CAAGZ,EAAAA,KAAK,GAAGJ,cAAc,GAAG,GAAG,CAAA,CAAA,CAAA;AAAK,OAAA,GAC7C;AAAEiB,QAAAA,IAAI,
|
|
1
|
+
{"version":3,"file":"Stepper.js","sources":["../../src/stepper/Stepper.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport * as React from 'react';\n\nimport { Position } from '../common';\nimport { useDirection } from '../common/hooks';\nimport Tooltip from '../tooltip';\n\nimport { isTouchDevice } from './deviceDetection';\n\nfunction clamp(from: number, to: number, value: number) {\n return Math.max(Math.min(to, value), from);\n}\n\nexport interface Step {\n label: React.ReactNode;\n onClick?: () => void;\n hoverLabel?: React.ReactNode;\n}\n\nexport interface StepperProps {\n steps: readonly Step[];\n activeStep?: number;\n className?: string;\n}\n\n/* eslint-disable react/no-array-index-key */\nconst Stepper = ({ steps, activeStep = 0, className }: StepperProps) => {\n const { isRTL } = useDirection();\n\n if (steps.length === 0) {\n return null;\n }\n\n const activeStepIndex = clamp(0, steps.length - 1, activeStep);\n const stepPercentage = 1 / (steps.length - 1);\n const percentageCompleted = activeStepIndex / (steps.length - 1);\n\n const renderStep = (step: Step, index: number) => {\n const active = index === activeStepIndex;\n const clickable = step.onClick && !active;\n\n const labelButton = clickable ? (\n <button\n type=\"button\"\n className=\"btn-unstyled tw-stepper__step-label\"\n onClick={() => clickable && step.onClick?.()}\n >\n <small>{step.label}</small>\n </button>\n ) : (\n <span className=\"tw-stepper__step-label\">{step.label}</span>\n );\n return (\n <li\n key={index}\n className={classNames(\n 'hidden-xs',\n 'tw-stepper__step',\n active ? 'np-text-body-default-bold tw-stepper__step--active' : 'np-text-body-default',\n clickable && 'tw-stepper__step--clickable',\n step.hoverLabel && 'tw-stepper__step--has-tooltip',\n )}\n aria-current={active ? 'step' : false}\n style={\n isRTL\n ? { right: `${index * stepPercentage * 100}%` }\n : { left: `${index * stepPercentage * 100}%` }\n }\n >\n {step.hoverLabel && !isTouchDevice() ? (\n <Tooltip position={Position.BOTTOM} label={step.hoverLabel}>\n {labelButton}\n </Tooltip>\n ) : (\n labelButton\n )}\n </li>\n );\n };\n\n return (\n <div className={classNames('tw-stepper', className)}>\n <div className=\"progress\">\n <div className=\"progress-bar\" style={{ width: `${percentageCompleted * 100}%` }} />\n </div>\n <ul className=\"tw-stepper-steps p-t-1 m-b-0\">{steps.map(renderStep)}</ul>\n </div>\n );\n};\n/* eslint-enable react/no-array-index-key */\n\nexport default Stepper;\n"],"names":["clamp","from","to","value","Math","max","min","Stepper","steps","activeStep","className","isRTL","useDirection","length","activeStepIndex","stepPercentage","percentageCompleted","renderStep","step","index","active","clickable","onClick","labelButton","_jsx","type","children","label","classNames","hoverLabel","style","right","left","isTouchDevice","Tooltip","position","Position","BOTTOM","_jsxs","width","map"],"mappings":";;;;;;;;;;;;;;AASA,SAASA,KAAKA,CAACC,IAAY,EAAEC,EAAU,EAAEC,KAAa,EAAA;AACpD,EAAA,OAAOC,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,GAAG,CAACJ,EAAE,EAAEC,KAAK,CAAC,EAAEF,IAAI,CAAC,CAAA;AAC5C,CAAA;AAcA;AACMM,MAAAA,OAAO,GAAGA,CAAC;EAAEC,KAAK;AAAEC,EAAAA,UAAU,GAAG,CAAC;AAAEC,EAAAA,SAAAA;AAAS,CAAgB,KAAI;EACrE,MAAM;AAAEC,IAAAA,KAAAA;GAAO,GAAGC,yBAAY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EV;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stepper.mjs","sources":["../../src/stepper/Stepper.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport * as React from 'react';\n\nimport { Position } from '../common';\nimport { useDirection } from '../common/hooks';\nimport Tooltip from '../tooltip';\n\nimport { isTouchDevice } from './deviceDetection';\n\nfunction clamp(from: number, to: number, value: number) {\n return Math.max(Math.min(to, value), from);\n}\n\nexport interface Step {\n label: React.ReactNode;\n onClick?: () => void;\n hoverLabel?: React.ReactNode;\n}\n\nexport interface StepperProps {\n steps: readonly Step[];\n activeStep?: number;\n className?: string;\n}\n\n/* eslint-disable react/no-array-index-key */\nconst Stepper = ({ steps, activeStep = 0, className }: StepperProps) => {\n const { isRTL } = useDirection();\n\n if (steps.length === 0) {\n return null;\n }\n\n const activeStepIndex = clamp(0, steps.length - 1, activeStep);\n const stepPercentage = 1 / (steps.length - 1);\n const percentageCompleted = activeStepIndex / (steps.length - 1);\n\n const renderStep = (step: Step, index: number) => {\n const active = index === activeStepIndex;\n const clickable = step.onClick && !active;\n\n const labelButton = clickable ? (\n <button\n type=\"button\"\n className=\"btn-unstyled tw-stepper__step-label\"\n onClick={() => clickable && step.onClick?.()}\n >\n <small>{step.label}</small>\n </button>\n ) : (\n <span className=\"tw-stepper__step-label\">{step.label}</span>\n );\n return (\n <li\n key={index}\n className={classNames(\n 'hidden-xs',\n 'tw-stepper__step',\n active ? 'np-text-body-default-bold tw-stepper__step--active' : 'np-text-body-default',\n clickable && 'tw-stepper__step--clickable',\n step.hoverLabel && 'tw-stepper__step--has-tooltip',\n )}\n aria-current={active ? 'step' : false}\n style={\n isRTL\n ? { right: `${index * stepPercentage * 100}%` }\n : { left: `${index * stepPercentage * 100}%` }\n }\n >\n {step.hoverLabel && !isTouchDevice() ? (\n <Tooltip position={Position.BOTTOM} label={step.hoverLabel}>\n {labelButton}\n </Tooltip>\n ) : (\n labelButton\n )}\n </li>\n );\n };\n\n return (\n <div className={classNames('tw-stepper', className)}>\n <div className=\"progress\">\n <div className=\"progress-bar\" style={{ width: `${percentageCompleted * 100}%` }} />\n </div>\n <ul className=\"tw-stepper-steps p-t-1 m-b-0\">{steps.map(renderStep)}</ul>\n </div>\n );\n};\n/* eslint-enable react/no-array-index-key */\n\nexport default Stepper;\n"],"names":["clamp","from","to","value","Math","max","min","Stepper","steps","activeStep","className","isRTL","useDirection","length","activeStepIndex","stepPercentage","percentageCompleted","renderStep","step","index","active","clickable","onClick","labelButton","_jsx","type","children","label","classNames","hoverLabel","style","right","left","isTouchDevice","Tooltip","position","Position","BOTTOM","_jsxs","width","map"],"mappings":";;;;;;;;AASA,SAASA,KAAKA,CAACC,IAAY,EAAEC,EAAU,EAAEC,KAAa,EAAA;AACpD,EAAA,OAAOC,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,GAAG,CAACJ,EAAE,EAAEC,KAAK,CAAC,EAAEF,IAAI,CAAC,CAAA;AAC5C,CAAA;AAcA;AACMM,MAAAA,OAAO,GAAGA,CAAC;EAAEC,KAAK;AAAEC,EAAAA,UAAU,GAAG,CAAC;AAAEC,EAAAA,SAAAA;AAAS,CAAgB,KAAI;EACrE,MAAM;AAAEC,IAAAA,KAAAA;GAAO,GAAGC,YAAY,EAAE,CAAA;AAEhC,EAAA,IAAIJ,KAAK,CAACK,MAAM,KAAK,CAAC,EAAE;AACtB,IAAA,OAAO,IAAI,CAAA;AACb,GAAA;AAEA,EAAA,MAAMC,eAAe,GAAGd,KAAK,CAAC,CAAC,EAAEQ,KAAK,CAACK,MAAM,GAAG,CAAC,EAAEJ,UAAU,CAAC,CAAA;EAC9D,MAAMM,cAAc,GAAG,CAAC,IAAIP,KAAK,CAACK,MAAM,GAAG,CAAC,CAAC,CAAA;EAC7C,MAAMG,mBAAmB,GAAGF,eAAe,IAAIN,KAAK,CAACK,MAAM,GAAG,CAAC,CAAC,CAAA;AAEhE,EAAA,MAAMI,UAAU,GAAGA,CAACC,IAAU,EAAEC,KAAa,KAAI;AAC/C,IAAA,MAAMC,MAAM,GAAGD,KAAK,KAAKL,eAAe,CAAA;AACxC,IAAA,MAAMO,SAAS,GAAGH,IAAI,CAACI,OAAO,IAAI,CAACF,MAAM,CAAA;AAEzC,IAAA,MAAMG,WAAW,GAAGF,SAAS,gBAC3BG,GAAA,CAAA,QAAA,EAAA;AACEC,MAAAA,IAAI,EAAC,QAAQ;AACbf,MAAAA,SAAS,EAAC,qCAAqC;MAC/CY,OAAO,EAAEA,MAAMD,SAAS,IAAIH,IAAI,CAACI,OAAO,IAAK;AAAAI,MAAAA,QAAA,eAE7CF,GAAA,CAAA,OAAA,EAAA;QAAAE,QAAA,EAAQR,IAAI,CAACS,KAAAA;OAAa,CAAA;KACpB,CAAC,gBAETH,GAAA,CAAA,MAAA,EAAA;AAAMd,MAAAA,SAAS,EAAC,wBAAwB;MAAAgB,QAAA,EAAER,IAAI,CAACS,KAAAA;AAAK,KAAO,CAC5D,CAAA;AACD,IAAA,oBACEH,GAAA,CAAA,IAAA,EAAA;MAEEd,SAAS,EAAEkB,UAAU,CACnB,WAAW,EACX,kBAAkB,EAClBR,MAAM,GAAG,oDAAoD,GAAG,sBAAsB,EACtFC,SAAS,IAAI,6BAA6B,EAC1CH,IAAI,CAACW,UAAU,IAAI,+BAA+B,CAClD;AACF,MAAA,cAAA,EAAcT,MAAM,GAAG,MAAM,GAAG,KAAM;MACtCU,KAAK,EACHnB,KAAK,GACD;AAAEoB,QAAAA,KAAK,EAAE,CAAGZ,EAAAA,KAAK,GAAGJ,cAAc,GAAG,GAAG,CAAA,CAAA,CAAA;AAAK,OAAA,GAC7C;AAAEiB,QAAAA,IAAI,
|
|
1
|
+
{"version":3,"file":"Stepper.mjs","sources":["../../src/stepper/Stepper.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport * as React from 'react';\n\nimport { Position } from '../common';\nimport { useDirection } from '../common/hooks';\nimport Tooltip from '../tooltip';\n\nimport { isTouchDevice } from './deviceDetection';\n\nfunction clamp(from: number, to: number, value: number) {\n return Math.max(Math.min(to, value), from);\n}\n\nexport interface Step {\n label: React.ReactNode;\n onClick?: () => void;\n hoverLabel?: React.ReactNode;\n}\n\nexport interface StepperProps {\n steps: readonly Step[];\n activeStep?: number;\n className?: string;\n}\n\n/* eslint-disable react/no-array-index-key */\nconst Stepper = ({ steps, activeStep = 0, className }: StepperProps) => {\n const { isRTL } = useDirection();\n\n if (steps.length === 0) {\n return null;\n }\n\n const activeStepIndex = clamp(0, steps.length - 1, activeStep);\n const stepPercentage = 1 / (steps.length - 1);\n const percentageCompleted = activeStepIndex / (steps.length - 1);\n\n const renderStep = (step: Step, index: number) => {\n const active = index === activeStepIndex;\n const clickable = step.onClick && !active;\n\n const labelButton = clickable ? (\n <button\n type=\"button\"\n className=\"btn-unstyled tw-stepper__step-label\"\n onClick={() => clickable && step.onClick?.()}\n >\n <small>{step.label}</small>\n </button>\n ) : (\n <span className=\"tw-stepper__step-label\">{step.label}</span>\n );\n return (\n <li\n key={index}\n className={classNames(\n 'hidden-xs',\n 'tw-stepper__step',\n active ? 'np-text-body-default-bold tw-stepper__step--active' : 'np-text-body-default',\n clickable && 'tw-stepper__step--clickable',\n step.hoverLabel && 'tw-stepper__step--has-tooltip',\n )}\n aria-current={active ? 'step' : false}\n style={\n isRTL\n ? { right: `${index * stepPercentage * 100}%` }\n : { left: `${index * stepPercentage * 100}%` }\n }\n >\n {step.hoverLabel && !isTouchDevice() ? (\n <Tooltip position={Position.BOTTOM} label={step.hoverLabel}>\n {labelButton}\n </Tooltip>\n ) : (\n labelButton\n )}\n </li>\n );\n };\n\n return (\n <div className={classNames('tw-stepper', className)}>\n <div className=\"progress\">\n <div className=\"progress-bar\" style={{ width: `${percentageCompleted * 100}%` }} />\n </div>\n <ul className=\"tw-stepper-steps p-t-1 m-b-0\">{steps.map(renderStep)}</ul>\n </div>\n );\n};\n/* eslint-enable react/no-array-index-key */\n\nexport default Stepper;\n"],"names":["clamp","from","to","value","Math","max","min","Stepper","steps","activeStep","className","isRTL","useDirection","length","activeStepIndex","stepPercentage","percentageCompleted","renderStep","step","index","active","clickable","onClick","labelButton","_jsx","type","children","label","classNames","hoverLabel","style","right","left","isTouchDevice","Tooltip","position","Position","BOTTOM","_jsxs","width","map"],"mappings":";;;;;;;;AASA,SAASA,KAAKA,CAACC,IAAY,EAAEC,EAAU,EAAEC,KAAa,EAAA;AACpD,EAAA,OAAOC,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,GAAG,CAACJ,EAAE,EAAEC,KAAK,CAAC,EAAEF,IAAI,CAAC,CAAA;AAC5C,CAAA;AAcA;AACMM,MAAAA,OAAO,GAAGA,CAAC;EAAEC,KAAK;AAAEC,EAAAA,UAAU,GAAG,CAAC;AAAEC,EAAAA,SAAAA;AAAS,CAAgB,KAAI;EACrE,MAAM;AAAEC,IAAAA,KAAAA;GAAO,GAAGC,YAAY,EAAE,CAAA;AAEhC,EAAA,IAAIJ,KAAK,CAACK,MAAM,KAAK,CAAC,EAAE;AACtB,IAAA,OAAO,IAAI,CAAA;AACb,GAAA;AAEA,EAAA,MAAMC,eAAe,GAAGd,KAAK,CAAC,CAAC,EAAEQ,KAAK,CAACK,MAAM,GAAG,CAAC,EAAEJ,UAAU,CAAC,CAAA;EAC9D,MAAMM,cAAc,GAAG,CAAC,IAAIP,KAAK,CAACK,MAAM,GAAG,CAAC,CAAC,CAAA;EAC7C,MAAMG,mBAAmB,GAAGF,eAAe,IAAIN,KAAK,CAACK,MAAM,GAAG,CAAC,CAAC,CAAA;AAEhE,EAAA,MAAMI,UAAU,GAAGA,CAACC,IAAU,EAAEC,KAAa,KAAI;AAC/C,IAAA,MAAMC,MAAM,GAAGD,KAAK,KAAKL,eAAe,CAAA;AACxC,IAAA,MAAMO,SAAS,GAAGH,IAAI,CAACI,OAAO,IAAI,CAACF,MAAM,CAAA;AAEzC,IAAA,MAAMG,WAAW,GAAGF,SAAS,gBAC3BG,GAAA,CAAA,QAAA,EAAA;AACEC,MAAAA,IAAI,E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EkB,UAAU,CAAC,YAAY,EAAElB,SAAS,CAAE;AAAAgB,IAAAA,QAAA,gBAClDF,GAAA,CAAA,KAAA,EAAA;AAAKd,MAAAA,SAAS,EAAC,UAAU;AAAAgB,MAAAA,QAAA,eACvBF,GAAA,CAAA,KAAA,EAAA;AAAKd,QAAAA,SAAS,EAAC,cAAc;AAACoB,QAAAA,KAAK,EAAE;AAAES,UAAAA,KAAK,EAAE,CAAA,EAAGvB,mBAAmB,GAAG,GAAG,CAAA,CAAA,CAAA;AAAG,SAAA;OAC/E,CAAA;KAAK,CACL,eAAAQ,GAAA,CAAA,IAAA,EAAA;AAAId,MAAAA,SAAS,EAAC,8BAA8B;AAAAgB,MAAAA,QAAA,EAAElB,KAAK,CAACgC,GAAG,CAACvB,UAAU,CAAA;AAAC,KAAK,CAC1E,CAAA;AAAA,GAAK,CAAC,CAAA;AAEV;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceDetection.js","sources":["../../src/stepper/deviceDetection.js"],"sourcesContent":["function supportsTouchEvents() {\n const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;\n const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;\n const documentTouchIsDefined =\n typeof window !== 'undefined' &&\n window.DocumentTouch &&\n document instanceof window.DocumentTouch;\n\n return !!(onTouchStartIsDefined || maxTouchPointsIsDefined || documentTouchIsDefined);\n}\n\nfunction userAgentSuggestsTouchDevice() {\n const sampleTouchDevices = [\n 'android',\n 'iemobile',\n 'iphone',\n 'ipad',\n 'ipod',\n 'blackberry',\n 'bada',\n ];\n const matchString = sampleTouchDevices.map((device) => `(${device})`).join('|');\n const regex = new RegExp(matchString, 'gi');\n return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);\n}\n// Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.\n// Only use this for small vanity changes where it still works either way.\nexport function isTouchDevice() {\n return supportsTouchEvents() || userAgentSuggestsTouchDevice();\n}\n"],"names":["supportsTouchEvents","onTouchStartIsDefined","window","ontouchstart","undefined","maxTouchPointsIsDefined","navigator","maxTouchPoints","documentTouchIsDefined","DocumentTouch","document","userAgentSuggestsTouchDevice","sampleTouchDevices","matchString","map","device","join","regex","RegExp","userAgent","match","isTouchDevice"],"mappings":";;AAAA,SAASA,mBAAmBA,GAAG;EAC7B,MAAMC,qBAAqB,GAAG,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,YAAY,KAAKC,SAAS,CAAA;EAChG,MAAMC,uBAAuB,GAAG,OAAOC,SAAS,KAAK,WAAW,IAAIA,SAAS,CAACC,cAAc,CAAA;AAC5F,EAAA,MAAMC,sBAAsB,GAC1B,OAAON,MAAM,KAAK,WAAW,IAC7BA,MAAM,CAACO,aAAa,IACpBC,QAAQ,YAAYR,MAAM,CAACO,aAAa,CAAA;AAE1C,EAAA,OAAO,CAAC,EAAER,qBAAqB,IAAII,uBAAuB,IAAIG,sBAAsB,CAAC,CAAA;AACvF,CAAA;AAEA,SAASG,4BAA4BA,GAAG;AACtC,EAAA,MAAMC,kBAAkB,GAAG,CACzB,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,MAAM,EACN,YAAY,EACZ,MAAM,CACP,CAAA;AACD,EAAA,MAAMC,WAAW,GAAGD,kBAAkB,CAACE,GAAG,CAAEC,MAAM,
|
|
1
|
+
{"version":3,"file":"deviceDetection.js","sources":["../../src/stepper/deviceDetection.js"],"sourcesContent":["function supportsTouchEvents() {\n const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;\n const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;\n const documentTouchIsDefined =\n typeof window !== 'undefined' &&\n window.DocumentTouch &&\n document instanceof window.DocumentTouch;\n\n return !!(onTouchStartIsDefined || maxTouchPointsIsDefined || documentTouchIsDefined);\n}\n\nfunction userAgentSuggestsTouchDevice() {\n const sampleTouchDevices = [\n 'android',\n 'iemobile',\n 'iphone',\n 'ipad',\n 'ipod',\n 'blackberry',\n 'bada',\n ];\n const matchString = sampleTouchDevices.map((device) => `(${device})`).join('|');\n const regex = new RegExp(matchString, 'gi');\n return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);\n}\n// Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.\n// Only use this for small vanity changes where it still works either way.\nexport function isTouchDevice() {\n return supportsTouchEvents() || userAgentSuggestsTouchDevice();\n}\n"],"names":["supportsTouchEvents","onTouchStartIsDefined","window","ontouchstart","undefined","maxTouchPointsIsDefined","navigator","maxTouchPoints","documentTouchIsDefined","DocumentTouch","document","userAgentSuggestsTouchDevice","sampleTouchDevices","matchString","map","device","join","regex","RegExp","userAgent","match","isTouchDevice"],"mappings":";;AAAA,SAASA,mBAAmBA,GAAG;EAC7B,MAAMC,qBAAqB,GAAG,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,YAAY,KAAKC,SAAS,CAAA;EAChG,MAAMC,uBAAuB,GAAG,OAAOC,SAAS,KAAK,WAAW,IAAIA,SAAS,CAACC,cAAc,CAAA;AAC5F,EAAA,MAAMC,sBAAsB,GAC1B,OAAON,MAAM,KAAK,WAAW,IAC7BA,MAAM,CAACO,aAAa,IACpBC,QAAQ,YAAYR,MAAM,CAACO,aAAa,CAAA;AAE1C,EAAA,OAAO,CAAC,EAAER,qBAAqB,IAAII,uBAAuB,IAAIG,sBAAsB,CAAC,CAAA;AACvF,CAAA;AAEA,SAASG,4BAA4BA,GAAG;AACtC,EAAA,MAAMC,kBAAkB,GAAG,CACzB,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,MAAM,EACN,YAAY,EACZ,MAAM,CACP,CAAA;AACD,EAAA,MAAMC,WAAW,GAAGD,kBAAkB,CAACE,GAAG,CAAEC,MAAM,IAAK,CAAIA,CAAAA,EAAAA,MAAM,GAAG,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAA;EAC/E,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,WAAW,EAAE,IAAI,CAAC,CAAA;AAC3C,EAAA,OAAO,OAAOP,SAAS,KAAK,WAAW,IAAI,CAAC,CAACA,SAAS,CAACa,SAAS,CAACC,KAAK,CAACH,KAAK,CAAC,CAAA;AAC/E,CAAA;AACA;AACA;AACO,SAASI,aAAaA,GAAG;AAC9B,EAAA,OAAOrB,mBAAmB,EAAE,IAAIW,4BAA4B,EAAE,CAAA;AAChE;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceDetection.mjs","sources":["../../src/stepper/deviceDetection.js"],"sourcesContent":["function supportsTouchEvents() {\n const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;\n const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;\n const documentTouchIsDefined =\n typeof window !== 'undefined' &&\n window.DocumentTouch &&\n document instanceof window.DocumentTouch;\n\n return !!(onTouchStartIsDefined || maxTouchPointsIsDefined || documentTouchIsDefined);\n}\n\nfunction userAgentSuggestsTouchDevice() {\n const sampleTouchDevices = [\n 'android',\n 'iemobile',\n 'iphone',\n 'ipad',\n 'ipod',\n 'blackberry',\n 'bada',\n ];\n const matchString = sampleTouchDevices.map((device) => `(${device})`).join('|');\n const regex = new RegExp(matchString, 'gi');\n return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);\n}\n// Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.\n// Only use this for small vanity changes where it still works either way.\nexport function isTouchDevice() {\n return supportsTouchEvents() || userAgentSuggestsTouchDevice();\n}\n"],"names":["supportsTouchEvents","onTouchStartIsDefined","window","ontouchstart","undefined","maxTouchPointsIsDefined","navigator","maxTouchPoints","documentTouchIsDefined","DocumentTouch","document","userAgentSuggestsTouchDevice","sampleTouchDevices","matchString","map","device","join","regex","RegExp","userAgent","match","isTouchDevice"],"mappings":"AAAA,SAASA,mBAAmBA,GAAG;EAC7B,MAAMC,qBAAqB,GAAG,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,YAAY,KAAKC,SAAS,CAAA;EAChG,MAAMC,uBAAuB,GAAG,OAAOC,SAAS,KAAK,WAAW,IAAIA,SAAS,CAACC,cAAc,CAAA;AAC5F,EAAA,MAAMC,sBAAsB,GAC1B,OAAON,MAAM,KAAK,WAAW,IAC7BA,MAAM,CAACO,aAAa,IACpBC,QAAQ,YAAYR,MAAM,CAACO,aAAa,CAAA;AAE1C,EAAA,OAAO,CAAC,EAAER,qBAAqB,IAAII,uBAAuB,IAAIG,sBAAsB,CAAC,CAAA;AACvF,CAAA;AAEA,SAASG,4BAA4BA,GAAG;AACtC,EAAA,MAAMC,kBAAkB,GAAG,CACzB,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,MAAM,EACN,YAAY,EACZ,MAAM,CACP,CAAA;AACD,EAAA,MAAMC,WAAW,GAAGD,kBAAkB,CAACE,GAAG,CAAEC,MAAM,
|
|
1
|
+
{"version":3,"file":"deviceDetection.mjs","sources":["../../src/stepper/deviceDetection.js"],"sourcesContent":["function supportsTouchEvents() {\n const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;\n const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;\n const documentTouchIsDefined =\n typeof window !== 'undefined' &&\n window.DocumentTouch &&\n document instanceof window.DocumentTouch;\n\n return !!(onTouchStartIsDefined || maxTouchPointsIsDefined || documentTouchIsDefined);\n}\n\nfunction userAgentSuggestsTouchDevice() {\n const sampleTouchDevices = [\n 'android',\n 'iemobile',\n 'iphone',\n 'ipad',\n 'ipod',\n 'blackberry',\n 'bada',\n ];\n const matchString = sampleTouchDevices.map((device) => `(${device})`).join('|');\n const regex = new RegExp(matchString, 'gi');\n return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);\n}\n// Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.\n// Only use this for small vanity changes where it still works either way.\nexport function isTouchDevice() {\n return supportsTouchEvents() || userAgentSuggestsTouchDevice();\n}\n"],"names":["supportsTouchEvents","onTouchStartIsDefined","window","ontouchstart","undefined","maxTouchPointsIsDefined","navigator","maxTouchPoints","documentTouchIsDefined","DocumentTouch","document","userAgentSuggestsTouchDevice","sampleTouchDevices","matchString","map","device","join","regex","RegExp","userAgent","match","isTouchDevice"],"mappings":"AAAA,SAASA,mBAAmBA,GAAG;EAC7B,MAAMC,qBAAqB,GAAG,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,YAAY,KAAKC,SAAS,CAAA;EAChG,MAAMC,uBAAuB,GAAG,OAAOC,SAAS,KAAK,WAAW,IAAIA,SAAS,CAACC,cAAc,CAAA;AAC5F,EAAA,MAAMC,sBAAsB,GAC1B,OAAON,MAAM,KAAK,WAAW,IAC7BA,MAAM,CAACO,aAAa,IACpBC,QAAQ,YAAYR,MAAM,CAACO,aAAa,CAAA;AAE1C,EAAA,OAAO,CAAC,EAAER,qBAAqB,IAAII,uBAAuB,IAAIG,sBAAsB,CAAC,CAAA;AACvF,CAAA;AAEA,SAASG,4BAA4BA,GAAG;AACtC,EAAA,MAAMC,kBAAkB,GAAG,CACzB,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,MAAM,EACN,YAAY,EACZ,MAAM,CACP,CAAA;AACD,EAAA,MAAMC,WAAW,GAAGD,kBAAkB,CAACE,GAAG,CAAEC,MAAM,IAAK,CAAIA,CAAAA,EAAAA,MAAM,GAAG,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAA;EAC/E,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,WAAW,EAAE,IAAI,CAAC,CAAA;AAC3C,EAAA,OAAO,OAAOP,SAAS,KAAK,WAAW,IAAI,CAAC,CAACA,SAAS,CAACa,SAAS,CAACC,KAAK,CAACH,KAAK,CAAC,CAAA;AAC/E,CAAA;AACA;AACA;AACO,SAASI,aAAaA,GAAG;AAC9B,EAAA,OAAOrB,mBAAmB,EAAE,IAAIW,4BAA4B,EAAE,CAAA;AAChE;;;;"}
|
package/build/styles/main.css
CHANGED
|
@@ -1491,6 +1491,50 @@ button.np-option {
|
|
|
1491
1491
|
border-radius: var(--radius-small);
|
|
1492
1492
|
}
|
|
1493
1493
|
}
|
|
1494
|
+
.np-select-option {
|
|
1495
|
+
border-radius: 10px;
|
|
1496
|
+
border-radius: var(--radius-small);
|
|
1497
|
+
padding: 16px;
|
|
1498
|
+
padding: var(--size-16);
|
|
1499
|
+
}
|
|
1500
|
+
.np-select-option-placeholder {
|
|
1501
|
+
background-color: rgba(134,167,189,0.10196);
|
|
1502
|
+
background-color: var(--color-background-neutral);
|
|
1503
|
+
}
|
|
1504
|
+
.np-select-option-placeholder:not(.disabled):hover {
|
|
1505
|
+
background-color: var(--color-background-neutral-hover);
|
|
1506
|
+
}
|
|
1507
|
+
.np-select-option-placeholder:not(.disabled):focus,
|
|
1508
|
+
.np-select-option-placeholder:not(.disabled):active {
|
|
1509
|
+
background-color: var(--color-background-neutral-active);
|
|
1510
|
+
}
|
|
1511
|
+
.np-select-option-selected {
|
|
1512
|
+
border: 1px solid #c9cbce;
|
|
1513
|
+
border: 1px solid var(--color-interactive-secondary);
|
|
1514
|
+
}
|
|
1515
|
+
.np-select-option-list {
|
|
1516
|
+
max-height: 350px;
|
|
1517
|
+
overflow-y: auto;
|
|
1518
|
+
}
|
|
1519
|
+
.np-select-option-list > .np-section {
|
|
1520
|
+
margin-top: 0;
|
|
1521
|
+
}
|
|
1522
|
+
.has-error * .np-select-option {
|
|
1523
|
+
--ring-outline-color: var(--color-sentiment-negative);
|
|
1524
|
+
--ring-outline-width: 3px;
|
|
1525
|
+
--ring-outline-offset: calc(-1 * var(--ring-outline-width));
|
|
1526
|
+
outline: var(--ring-outline-color) solid 3px;
|
|
1527
|
+
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
1528
|
+
outline-offset: calc(-1 * 3px);
|
|
1529
|
+
outline-offset: var(--ring-outline-offset);
|
|
1530
|
+
}
|
|
1531
|
+
.has-error * .np-select-option:focus {
|
|
1532
|
+
outline: none;
|
|
1533
|
+
}
|
|
1534
|
+
.has-error * .np-select-option:focus-visible {
|
|
1535
|
+
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
1536
|
+
outline-offset: var(--ring-outline-offset);
|
|
1537
|
+
}
|
|
1494
1538
|
.np-panel__content {
|
|
1495
1539
|
opacity: 0;
|
|
1496
1540
|
visibility: hidden;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.np-select-option {
|
|
2
|
+
border-radius: 10px;
|
|
3
|
+
border-radius: var(--radius-small);
|
|
4
|
+
padding: 16px;
|
|
5
|
+
padding: var(--size-16);
|
|
6
|
+
}
|
|
7
|
+
.np-select-option-placeholder {
|
|
8
|
+
background-color: rgba(134,167,189,0.10196);
|
|
9
|
+
background-color: var(--color-background-neutral);
|
|
10
|
+
}
|
|
11
|
+
.np-select-option-placeholder:not(.disabled):hover {
|
|
12
|
+
background-color: var(--color-background-neutral-hover);
|
|
13
|
+
}
|
|
14
|
+
.np-select-option-placeholder:not(.disabled):focus,
|
|
15
|
+
.np-select-option-placeholder:not(.disabled):active {
|
|
16
|
+
background-color: var(--color-background-neutral-active);
|
|
17
|
+
}
|
|
18
|
+
.np-select-option-selected {
|
|
19
|
+
border: 1px solid #c9cbce;
|
|
20
|
+
border: 1px solid var(--color-interactive-secondary);
|
|
21
|
+
}
|
|
22
|
+
.np-select-option-list {
|
|
23
|
+
max-height: 350px;
|
|
24
|
+
overflow-y: auto;
|
|
25
|
+
}
|
|
26
|
+
.np-select-option-list > .np-section {
|
|
27
|
+
margin-top: 0;
|
|
28
|
+
}
|
|
29
|
+
.has-error * .np-select-option {
|
|
30
|
+
--ring-outline-color: var(--color-sentiment-negative);
|
|
31
|
+
--ring-outline-width: 3px;
|
|
32
|
+
--ring-outline-offset: calc(-1 * var(--ring-outline-width));
|
|
33
|
+
outline: var(--ring-outline-color) solid 3px;
|
|
34
|
+
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
35
|
+
outline-offset: calc(-1 * 3px);
|
|
36
|
+
outline-offset: var(--ring-outline-offset);
|
|
37
|
+
}
|
|
38
|
+
.has-error * .np-select-option:focus {
|
|
39
|
+
outline: none;
|
|
40
|
+
}
|
|
41
|
+
.has-error * .np-select-option:focus-visible {
|
|
42
|
+
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
43
|
+
outline-offset: var(--ring-outline-offset);
|
|
44
|
+
}
|