@transferwise/components 0.0.0-experimental-6e68717 → 0.0.0-experimental-61a37bc

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.
Files changed (117) hide show
  1. package/build/i18n/en.json +2 -0
  2. package/build/i18n/en.json.js +2 -0
  3. package/build/i18n/en.json.js.map +1 -1
  4. package/build/i18n/en.json.mjs +2 -0
  5. package/build/i18n/en.json.mjs.map +1 -1
  6. package/build/index.js +2 -0
  7. package/build/index.js.map +1 -1
  8. package/build/index.mjs +1 -0
  9. package/build/index.mjs.map +1 -1
  10. package/build/inputs/_BottomSheet.js +1 -29
  11. package/build/inputs/_BottomSheet.js.map +1 -1
  12. package/build/inputs/_BottomSheet.mjs +2 -30
  13. package/build/inputs/_BottomSheet.mjs.map +1 -1
  14. package/build/main.css +63 -16
  15. package/build/moneyInputField/AmountInput.js +284 -0
  16. package/build/moneyInputField/AmountInput.js.map +1 -0
  17. package/build/moneyInputField/AmountInput.mjs +282 -0
  18. package/build/moneyInputField/AmountInput.mjs.map +1 -0
  19. package/build/moneyInputField/AnimatedNumber.js +50 -0
  20. package/build/moneyInputField/AnimatedNumber.js.map +1 -0
  21. package/build/moneyInputField/AnimatedNumber.mjs +48 -0
  22. package/build/moneyInputField/AnimatedNumber.mjs.map +1 -0
  23. package/build/moneyInputField/Chevron.js +33 -0
  24. package/build/moneyInputField/Chevron.js.map +1 -0
  25. package/build/moneyInputField/Chevron.mjs +31 -0
  26. package/build/moneyInputField/Chevron.mjs.map +1 -0
  27. package/build/moneyInputField/CurrencySelector.js +160 -0
  28. package/build/moneyInputField/CurrencySelector.js.map +1 -0
  29. package/build/moneyInputField/CurrencySelector.mjs +157 -0
  30. package/build/moneyInputField/CurrencySelector.mjs.map +1 -0
  31. package/build/moneyInputField/MoneyInputField.js +111 -0
  32. package/build/moneyInputField/MoneyInputField.js.map +1 -0
  33. package/build/moneyInputField/MoneyInputField.messages.js +17 -0
  34. package/build/moneyInputField/MoneyInputField.messages.js.map +1 -0
  35. package/build/moneyInputField/MoneyInputField.messages.mjs +13 -0
  36. package/build/moneyInputField/MoneyInputField.messages.mjs.map +1 -0
  37. package/build/moneyInputField/MoneyInputField.mjs +107 -0
  38. package/build/moneyInputField/MoneyInputField.mjs.map +1 -0
  39. package/build/moneyInputField/useFocus.js +37 -0
  40. package/build/moneyInputField/useFocus.js.map +1 -0
  41. package/build/moneyInputField/useFocus.mjs +35 -0
  42. package/build/moneyInputField/useFocus.mjs.map +1 -0
  43. package/build/moneyInputField/useInputStyle.js +71 -0
  44. package/build/moneyInputField/useInputStyle.js.map +1 -0
  45. package/build/moneyInputField/useInputStyle.mjs +69 -0
  46. package/build/moneyInputField/useInputStyle.mjs.map +1 -0
  47. package/build/moneyInputField/utils.js +87 -0
  48. package/build/moneyInputField/utils.js.map +1 -0
  49. package/build/moneyInputField/utils.mjs +78 -0
  50. package/build/moneyInputField/utils.mjs.map +1 -0
  51. package/build/styles/inputs/SelectInput.css +5 -16
  52. package/build/styles/main.css +63 -16
  53. package/build/styles/moneyInputField/AmountInput.css +32 -0
  54. package/build/styles/moneyInputField/Chevron.css +12 -0
  55. package/build/styles/moneyInputField/CurrencySelector.css +6 -0
  56. package/build/styles/moneyInputField/MoneyInputField.css +58 -0
  57. package/build/types/index.d.ts +2 -0
  58. package/build/types/index.d.ts.map +1 -1
  59. package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
  60. package/build/types/moneyInputField/AmountInput.d.ts +13 -0
  61. package/build/types/moneyInputField/AmountInput.d.ts.map +1 -0
  62. package/build/types/moneyInputField/AnimatedNumber.d.ts +9 -0
  63. package/build/types/moneyInputField/AnimatedNumber.d.ts.map +1 -0
  64. package/build/types/moneyInputField/Chevron.d.ts +6 -0
  65. package/build/types/moneyInputField/Chevron.d.ts.map +1 -0
  66. package/build/types/moneyInputField/CurrencySelector.d.ts +30 -0
  67. package/build/types/moneyInputField/CurrencySelector.d.ts.map +1 -0
  68. package/build/types/moneyInputField/MoneyInputField.d.ts +24 -0
  69. package/build/types/moneyInputField/MoneyInputField.d.ts.map +1 -0
  70. package/build/types/moneyInputField/MoneyInputField.messages.d.ts +12 -0
  71. package/build/types/moneyInputField/MoneyInputField.messages.d.ts.map +1 -0
  72. package/build/types/moneyInputField/index.d.ts +3 -0
  73. package/build/types/moneyInputField/index.d.ts.map +1 -0
  74. package/build/types/moneyInputField/useFocus.d.ts +7 -0
  75. package/build/types/moneyInputField/useFocus.d.ts.map +1 -0
  76. package/build/types/moneyInputField/useInputStyle.d.ts +10 -0
  77. package/build/types/moneyInputField/useInputStyle.d.ts.map +1 -0
  78. package/build/types/moneyInputField/useSelectionRange.d.ts +10 -0
  79. package/build/types/moneyInputField/useSelectionRange.d.ts.map +1 -0
  80. package/build/types/moneyInputField/utils.d.ts +22 -0
  81. package/build/types/moneyInputField/utils.d.ts.map +1 -0
  82. package/build/types/test-utils/index.d.ts +4 -0
  83. package/build/types/test-utils/index.d.ts.map +1 -1
  84. package/package.json +6 -5
  85. package/src/i18n/en.json +2 -0
  86. package/src/index.ts +2 -0
  87. package/src/inputs/SelectInput.css +5 -16
  88. package/src/inputs/SelectInput.spec.tsx +0 -33
  89. package/src/inputs/_BottomSheet.less +3 -16
  90. package/src/inputs/_BottomSheet.tsx +3 -19
  91. package/src/main.css +63 -16
  92. package/src/main.less +1 -0
  93. package/src/moneyInputField/AmountInput.css +32 -0
  94. package/src/moneyInputField/AmountInput.less +43 -0
  95. package/src/moneyInputField/AmountInput.tsx +355 -0
  96. package/src/moneyInputField/AnimatedNumber.tsx +40 -0
  97. package/src/moneyInputField/Chevron.css +12 -0
  98. package/src/moneyInputField/Chevron.less +13 -0
  99. package/src/moneyInputField/Chevron.tsx +35 -0
  100. package/src/moneyInputField/CurrencySelector.css +6 -0
  101. package/src/moneyInputField/CurrencySelector.less +7 -0
  102. package/src/moneyInputField/CurrencySelector.tsx +219 -0
  103. package/src/moneyInputField/MoneyInputField.css +58 -0
  104. package/src/moneyInputField/MoneyInputField.less +13 -0
  105. package/src/moneyInputField/MoneyInputField.messages.ts +13 -0
  106. package/src/moneyInputField/MoneyInputField.story.tsx +188 -0
  107. package/src/moneyInputField/MoneyInputField.tsx +116 -0
  108. package/src/moneyInputField/index.ts +2 -0
  109. package/src/moneyInputField/useFocus.ts +35 -0
  110. package/src/moneyInputField/useInputStyle.ts +85 -0
  111. package/src/moneyInputField/useSelectionRange.ts +23 -0
  112. package/src/moneyInputField/utils.spec.ts +114 -0
  113. package/src/moneyInputField/utils.ts +116 -0
  114. package/src/ssr.spec.tsx +1 -0
  115. package/src/common/bottomSheet/BottomSheet.test.story.tsx +0 -94
  116. package/src/inputs/SelectInput.test.story.tsx +0 -83
  117. package/src/moneyInput/MoneyInput.test.story.tsx +0 -101
@@ -23,6 +23,8 @@
23
23
  "neptune.MoneyInput.Select.placeholder": "Select an option...",
24
24
  "neptune.MoneyInput.Select.searchPlaceholder": "Type a currency or country",
25
25
  "neptune.MoneyInput.Select.selectCurrencyLabel": "Select currency",
26
+ "neptune.MoneyInputField.currency.search.placeholder": "Type a currency / country",
27
+ "neptune.MoneyInputField.currency.select.currency": "Select currency",
26
28
  "neptune.PhoneNumberInput.SelectInput.placeholder": "Select an option...",
27
29
  "neptune.PhoneNumberInput.countryCodeLabel": "Country code",
28
30
  "neptune.PhoneNumberInput.phoneNumberLabel": "Phone number",
@@ -27,6 +27,8 @@ var en = {
27
27
  "neptune.MoneyInput.Select.placeholder": "Select an option...",
28
28
  "neptune.MoneyInput.Select.searchPlaceholder": "Type a currency or country",
29
29
  "neptune.MoneyInput.Select.selectCurrencyLabel": "Select currency",
30
+ "neptune.MoneyInputField.currency.search.placeholder": "Type a currency / country",
31
+ "neptune.MoneyInputField.currency.select.currency": "Select currency",
30
32
  "neptune.PhoneNumberInput.SelectInput.placeholder": "Select an option...",
31
33
  "neptune.PhoneNumberInput.countryCodeLabel": "Country code",
32
34
  "neptune.PhoneNumberInput.phoneNumberLabel": "Phone number",
@@ -1 +1 @@
1
- {"version":3,"file":"en.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"en.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -23,6 +23,8 @@ var en = {
23
23
  "neptune.MoneyInput.Select.placeholder": "Select an option...",
24
24
  "neptune.MoneyInput.Select.searchPlaceholder": "Type a currency or country",
25
25
  "neptune.MoneyInput.Select.selectCurrencyLabel": "Select currency",
26
+ "neptune.MoneyInputField.currency.search.placeholder": "Type a currency / country",
27
+ "neptune.MoneyInputField.currency.select.currency": "Select currency",
26
28
  "neptune.PhoneNumberInput.SelectInput.placeholder": "Select an option...",
27
29
  "neptune.PhoneNumberInput.countryCodeLabel": "Country code",
28
30
  "neptune.PhoneNumberInput.phoneNumberLabel": "Phone number",
@@ -1 +1 @@
1
- {"version":3,"file":"en.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"en.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/build/index.js CHANGED
@@ -67,6 +67,7 @@ var Markdown = require('./markdown/Markdown.js');
67
67
  var Modal = require('./modal/Modal.js');
68
68
  var Money = require('./money/Money.js');
69
69
  var MoneyInput = require('./moneyInput/MoneyInput.js');
70
+ var MoneyInputField = require('./moneyInputField/MoneyInputField.js');
70
71
  var NavigationOption = require('./navigationOption/NavigationOption.js');
71
72
  var NavigationOptionsList = require('./navigationOptionsList/NavigationOptionsList.js');
72
73
  var Nudge = require('./nudge/Nudge.js');
@@ -229,6 +230,7 @@ exports.Markdown = Markdown.default;
229
230
  exports.Modal = Modal.default;
230
231
  exports.Money = Money.default;
231
232
  exports.MoneyInput = MoneyInput.default;
233
+ exports.MoneyInputField = MoneyInputField.default;
232
234
  exports.NavigationOption = NavigationOption.default;
233
235
  exports.NavigationOptionsList = NavigationOptionsList.default;
234
236
  exports.Nudge = Nudge.default;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/build/index.mjs CHANGED
@@ -65,6 +65,7 @@ export { default as Markdown } from './markdown/Markdown.mjs';
65
65
  export { default as Modal } from './modal/Modal.mjs';
66
66
  export { default as Money } from './money/Money.mjs';
67
67
  export { default as MoneyInput } from './moneyInput/MoneyInput.mjs';
68
+ export { default as MoneyInputField } from './moneyInputField/MoneyInputField.mjs';
68
69
  export { default as NavigationOption } from './navigationOption/NavigationOption.mjs';
69
70
  export { default as NavigationOptionsList } from './navigationOptionsList/NavigationOptionsList.mjs';
70
71
  export { default as Nudge } from './nudge/Nudge.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -6,37 +6,12 @@ var focus = require('@react-aria/focus');
6
6
  var componentsTheming = require('@wise/components-theming');
7
7
  var clsx = require('clsx');
8
8
  var React = require('react');
9
- require('../common/theme.js');
10
- require('../common/direction.js');
11
- require('../common/propsValues/control.js');
12
- require('../common/propsValues/breakpoint.js');
13
- var size = require('../common/propsValues/size.js');
14
- require('../common/propsValues/typography.js');
15
- require('../common/propsValues/width.js');
16
- require('../common/propsValues/type.js');
17
- require('../common/propsValues/dateMode.js');
18
- require('../common/propsValues/monthFormat.js');
19
- require('../common/propsValues/position.js');
20
- require('../common/propsValues/layouts.js');
21
- require('../common/propsValues/status.js');
22
- require('../common/propsValues/sentiment.js');
23
- require('../common/propsValues/profileType.js');
24
- require('../common/propsValues/variant.js');
25
- require('../common/propsValues/scroll.js');
26
- require('../common/propsValues/markdownNodeType.js');
27
- require('../common/fileType.js');
28
9
  var CloseButton = require('../common/closeButton/CloseButton.js');
29
10
  var useVirtualKeyboard = require('../common/hooks/useVirtualKeyboard.js');
30
11
  var PreventScroll = require('../common/preventScroll/PreventScroll.js');
12
+ var size = require('../common/propsValues/size.js');
31
13
  var jsxRuntime = require('react/jsx-runtime');
32
14
 
33
- const freezeScroll = (shouldFreeze = true) => {
34
- if (shouldFreeze) {
35
- document.documentElement.classList.add('wds-select-input-scroll-freeze');
36
- } else {
37
- document.documentElement.classList.remove('wds-select-input-scroll-freeze');
38
- }
39
- };
40
15
  function BottomSheet({
41
16
  open,
42
17
  renderTrigger,
@@ -59,9 +34,6 @@ function BottomSheet({
59
34
  }
60
35
  }
61
36
  });
62
- React.useEffect(() => {
63
- freezeScroll(open);
64
- }, [open]);
65
37
  const dismiss = react.useDismiss(context);
66
38
  const role = react.useRole(context);
67
39
  const {
@@ -1 +1 @@
1
- {"version":3,"file":"_BottomSheet.js","sources":["../../src/inputs/_BottomSheet.tsx"],"sourcesContent":["import {\n FloatingFocusManager,\n FloatingPortal,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport { Transition } from '@headlessui/react';\nimport { FocusScope } from '@react-aria/focus';\nimport { ThemeProvider, useTheme } from '@wise/components-theming';\nimport { clsx } from 'clsx';\nimport { Fragment, useEffect, useState } from 'react';\n\nimport { CloseButton , Size } from '../common';\nimport { useVirtualKeyboard } from '../common/hooks/useVirtualKeyboard';\nimport { PreventScroll } from '../common/preventScroll/PreventScroll';\n\nexport interface BottomSheetProps {\n open: boolean;\n renderTrigger?: (args: {\n ref: React.RefCallback<Element>;\n getInteractionProps: (customEventHandlers?: React.HTMLProps<Element>) => {\n [key: string]: unknown;\n };\n }) => React.ReactNode;\n title?: string;\n initialFocusRef?: React.MutableRefObject<HTMLElement | null>;\n padding?: 'none' | 'md';\n children?: React.ReactNode;\n onClose?: () => void;\n onCloseEnd?: () => void;\n}\n\n/**\n * App pages set scroll-behavior to 'smooth' which causes mobile Safari to\n * slow-scroll and glitch. This function temporarily disables that behaviour\n * while the BottomSheet is open. It complements <PreventScroll />.\n */\nconst freezeScroll = (shouldFreeze = true) => {\n if (shouldFreeze) {\n document.documentElement.classList.add('wds-select-input-scroll-freeze');\n } else {\n document.documentElement.classList.remove('wds-select-input-scroll-freeze');\n }\n};\n\nexport function BottomSheet({\n open,\n renderTrigger,\n title,\n initialFocusRef,\n padding = 'md',\n children,\n onClose,\n onCloseEnd,\n}: BottomSheetProps) {\n useVirtualKeyboard();\n\n const { refs, context } = useFloating<Element>({\n open,\n onOpenChange: (value) => {\n if (!value) {\n onClose?.();\n }\n },\n });\n\n useEffect(() => {\n freezeScroll(open);\n }, [open]);\n\n const dismiss = useDismiss(context);\n const role = useRole(context);\n const { getReferenceProps, getFloatingProps } = useInteractions([dismiss, role]);\n\n const [floatingKey, setFloatingKey] = useState(0);\n\n const { theme, screenMode } = useTheme();\n\n return (\n <>\n {open ? <PreventScroll /> : null}\n {renderTrigger?.({\n ref: refs.setReference,\n getInteractionProps: getReferenceProps,\n })}\n\n <FloatingPortal>\n <ThemeProvider\n theme=\"personal\"\n screenMode={theme === 'personal' ? screenMode : 'light'}\n isNotRootProvider\n >\n <Transition\n show={open}\n className=\"np-bottom-sheet-v2-container\"\n beforeEnter={() => {\n setFloatingKey((prev) => prev + 1);\n }}\n afterLeave={onCloseEnd}\n >\n <Transition.Child\n className=\"np-bottom-sheet-v2-backdrop\"\n enterFrom=\"np-bottom-sheet-v2-backdrop--closed\"\n leaveTo=\"np-bottom-sheet-v2-backdrop--closed\"\n />\n\n <div className=\"np-bottom-sheet-v2\">\n <FocusScope>\n <FloatingFocusManager context={context} initialFocus={initialFocusRef}>\n <Fragment\n key={floatingKey} // Force inner state invalidation on open\n >\n <Transition.Child\n ref={refs.setFloating}\n className=\"np-bottom-sheet-v2-content\"\n enterFrom=\"np-bottom-sheet-v2-content--closed\"\n leaveTo=\"np-bottom-sheet-v2-content--closed\"\n {...getFloatingProps()}\n >\n <div className=\"np-bottom-sheet-v2-header\">\n <CloseButton\n size={Size.SMALL}\n onClick={() => {\n onClose?.();\n }}\n />\n </div>\n <div\n className={clsx(\n 'np-bottom-sheet-v2-content-inner',\n title && 'np-bottom-sheet-v2-content-inner--has-title',\n padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md',\n )}\n >\n {title ? (\n <h2 className=\"np-bottom-sheet-v2-title np-text-title-body\">{title}</h2>\n ) : null}\n <div className=\"np-bottom-sheet-v2-body np-text-body-default\">\n {children}\n </div>\n </div>\n </Transition.Child>\n </Fragment>\n </FloatingFocusManager>\n </FocusScope>\n </div>\n </Transition>\n </ThemeProvider>\n </FloatingPortal>\n </>\n );\n}\n"],"names":["freezeScroll","shouldFreeze","document","documentElement","classList","add","remove","BottomSheet","open","renderTrigger","title","initialFocusRef","padding","children","onClose","onCloseEnd","useVirtualKeyboard","refs","context","useFloating","onOpenChange","value","useEffect","dismiss","useDismiss","role","useRole","getReferenceProps","getFloatingProps","useInteractions","floatingKey","setFloatingKey","useState","theme","screenMode","useTheme","_jsxs","_Fragment","_jsx","PreventScroll","ref","setReference","getInteractionProps","FloatingPortal","ThemeProvider","isNotRootProvider","Transition","show","className","beforeEnter","prev","afterLeave","Child","enterFrom","leaveTo","FocusScope","FloatingFocusManager","initialFocus","Fragment","setFloating","CloseButton","size","Size","SMALL","onClick","clsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAMA,YAAY,GAAGA,CAACC,YAAY,GAAG,IAAI,KAAI;AAC3C,EAAA,IAAIA,YAAY,EAAE;IAChBC,QAAQ,CAACC,e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AA,GACxC1B,gBAAgB,EAAE;AAAAf,oBAAAA,QAAA,gBAEtByB,cAAA,CAAA,KAAA,EAAA;AAAKU,sBAAAA,SAAS,EAAC,2BAA2B;sBAAAnC,QAAA,eACxCyB,cAAA,CAACsB,uBAAW,EAAA;wBACVC,IAAI,EAAEC,SAAI,CAACC,KAAM;wBACjBC,OAAO,EAAEA,MAAK;AACZlD,0BAAAA,OAAO,IAAI;AACb,wBAAA;uBAAE;qBAED,CACL,eAAAsB,eAAA,CAAA,KAAA,EAAA;AACEY,sBAAAA,SAAS,EAAEiB,SAAI,CACb,kCAAkC,EAClCvD,KAAK,IAAI,6CAA6C,EACtDE,OAAO,KAAK,IAAI,IAAI,8CAA8C,CAClE;sBAAAC,QAAA,EAAA,CAEDH,KAAK,gBACJ4B,cAAA,CAAA,IAAA,EAAA;AAAIU,wBAAAA,SAAS,EAAC,6CAA6C;AAAAnC,wBAAAA,QAAA,EAAEH;AAAK,uBAAK,CAAC,GACtE,IAAI,eACR4B,cAAA,CAAA,KAAA,EAAA;AAAKU,wBAAAA,SAAS,EAAC,8CAA8C;AAAAnC,wBAAAA,QAAA,EAC1DA;AAAQ,uBACN,CACP;AAAA,qBAAK,CACP;mBAAkB;AACpB,iBAAA,EAhCOiB,WAgCG;eACU;aACZ;AACd,WAAK,CACP;SAAY;OACC;AACjB,KAAgB,CAClB;AAAA,GAAA,CAAG;AAEP;;;;"}
1
+ {"version":3,"file":"_BottomSheet.js","sources":["../../src/inputs/_BottomSheet.tsx"],"sourcesContent":["import {\n FloatingFocusManager,\n FloatingPortal,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport { Transition } from '@headlessui/react';\nimport { FocusScope } from '@react-aria/focus';\nimport { ThemeProvider, useTheme } from '@wise/components-theming';\nimport { clsx } from 'clsx';\nimport { Fragment, useState } from 'react';\n\nimport { CloseButton } from '../common/closeButton';\nimport { useVirtualKeyboard } from '../common/hooks/useVirtualKeyboard';\nimport { PreventScroll } from '../common/preventScroll/PreventScroll';\nimport { Size } from '../common/propsValues/size';\n\nexport interface BottomSheetProps {\n open: boolean;\n renderTrigger?: (args: {\n ref: React.RefCallback<Element>;\n getInteractionProps: (customEventHandlers?: React.HTMLProps<Element>) => {\n [key: string]: unknown;\n };\n }) => React.ReactNode;\n title?: string;\n initialFocusRef?: React.MutableRefObject<HTMLElement | null>;\n padding?: 'none' | 'md';\n children?: React.ReactNode;\n onClose?: () => void;\n onCloseEnd?: () => void;\n}\n\nexport function BottomSheet({\n open,\n renderTrigger,\n title,\n initialFocusRef,\n padding = 'md',\n children,\n onClose,\n onCloseEnd,\n}: BottomSheetProps) {\n useVirtualKeyboard();\n\n const { refs, context } = useFloating<Element>({\n open,\n onOpenChange: (value) => {\n if (!value) {\n onClose?.();\n }\n },\n });\n\n const dismiss = useDismiss(context);\n const role = useRole(context);\n const { getReferenceProps, getFloatingProps } = useInteractions([dismiss, role]);\n\n const [floatingKey, setFloatingKey] = useState(0);\n\n const { theme, screenMode } = useTheme();\n\n return (\n <>\n {open ? <PreventScroll /> : null}\n {renderTrigger?.({\n ref: refs.setReference,\n getInteractionProps: getReferenceProps,\n })}\n\n <FloatingPortal>\n <ThemeProvider\n theme=\"personal\"\n screenMode={theme === 'personal' ? screenMode : 'light'}\n isNotRootProvider\n >\n <Transition\n show={open}\n className=\"np-bottom-sheet-v2-container\"\n beforeEnter={() => {\n setFloatingKey((prev) => prev + 1);\n }}\n afterLeave={onCloseEnd}\n >\n <Transition.Child\n className=\"np-bottom-sheet-v2-backdrop\"\n enterFrom=\"np-bottom-sheet-v2-backdrop--closed\"\n leaveTo=\"np-bottom-sheet-v2-backdrop--closed\"\n />\n\n <div className=\"np-bottom-sheet-v2\">\n <FocusScope>\n <FloatingFocusManager context={context} initialFocus={initialFocusRef}>\n <Fragment\n key={floatingKey} // Force inner state invalidation on open\n >\n <Transition.Child\n ref={refs.setFloating}\n className=\"np-bottom-sheet-v2-content\"\n enterFrom=\"np-bottom-sheet-v2-content--closed\"\n leaveTo=\"np-bottom-sheet-v2-content--closed\"\n {...getFloatingProps()}\n >\n <div className=\"np-bottom-sheet-v2-header\">\n <CloseButton\n size={Size.SMALL}\n onClick={() => {\n onClose?.();\n }}\n />\n </div>\n <div\n className={clsx(\n 'np-bottom-sheet-v2-content-inner',\n title && 'np-bottom-sheet-v2-content-inner--has-title',\n padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md',\n )}\n >\n {title ? (\n <h2 className=\"np-bottom-sheet-v2-title np-text-title-body\">{title}</h2>\n ) : null}\n <div className=\"np-bottom-sheet-v2-body np-text-body-default\">\n {children}\n </div>\n </div>\n </Transition.Child>\n </Fragment>\n </FloatingFocusManager>\n </FocusScope>\n </div>\n </Transition>\n </ThemeProvider>\n </FloatingPortal>\n </>\n );\n}\n"],"names":["BottomSheet","open","renderTrigger","title","initialFocusRef","padding","children","onClose","onCloseEnd","useVirtualKeyboard","refs","context","useFloating","onOpenChange","value","dismiss","useDismiss","role","useRole","getReferenceProps","getFloatingProps","useInteractions","floatingKey","setFloatingKey","useState","theme","screenMode","useTheme","_jsxs","_Fragment","_jsx","PreventScroll","ref","setReference","getInteractionProps","FloatingPortal","ThemeProvider","isNotRootProvider","Transition","show","className","beforeEnter","prev","afterLeave","Child","enterFrom","leaveTo","FocusScope","FloatingFocusManager","initialFocus","Fragment","setFloating","CloseButton","size","Size","SMALL","onClick","clsx"],"mappings":";;;;;;;;;;;;;;AAmCM,SAAUA,WAAWA,CAAC;EAC1BC,IAAI;EACJC,aAAa;EACbC,KAAK;EACLC,eAAe;AACfC,EAAAA,OAAO,GAAG,IAAI;EACdC,QAAQ;EACRC,OAAO;AACPC,EAAAA;AAAU,CACO,EAAA;AACjBC,EAAAA,qCAAkB,EAAE;EAEpB,MAAM;IAAEC,IAAI;AAAEC,IAAAA;GAAS,GAAGC,iBAAW,CAAU;IAC7CX,IAAI;IACJY,YAAY,EAAGC,KAAK,IAAI;MACtB,IAAI,CAACA,KAAK,EAAE;A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R2B,cAAA,CAAA,KAAA,EAAA;AAAKU,wBAAAA,SAAS,EAAC,8CAA8C;AAAAlC,wBAAAA,QAAA,EAC1DA;AAAQ,uBACN,CACP;AAAA,qBAAK,CACP;mBAAkB;AACpB,iBAAA,EAhCOgB,WAgCG;eACU;aACZ;AACd,WAAK,CACP;SAAY;OACC;AACjB,KAAgB,CAClB;AAAA,GAAA,CAAG;AAEP;;;;"}
@@ -3,38 +3,13 @@ import { Transition } from '@headlessui/react';
3
3
  import { FocusScope } from '@react-aria/focus';
4
4
  import { useTheme, ThemeProvider } from '@wise/components-theming';
5
5
  import { clsx } from 'clsx';
6
- import { useEffect, useState, Fragment as Fragment$1 } from 'react';
7
- import '../common/theme.mjs';
8
- import '../common/direction.mjs';
9
- import '../common/propsValues/control.mjs';
10
- import '../common/propsValues/breakpoint.mjs';
11
- import { Size } from '../common/propsValues/size.mjs';
12
- import '../common/propsValues/typography.mjs';
13
- import '../common/propsValues/width.mjs';
14
- import '../common/propsValues/type.mjs';
15
- import '../common/propsValues/dateMode.mjs';
16
- import '../common/propsValues/monthFormat.mjs';
17
- import '../common/propsValues/position.mjs';
18
- import '../common/propsValues/layouts.mjs';
19
- import '../common/propsValues/status.mjs';
20
- import '../common/propsValues/sentiment.mjs';
21
- import '../common/propsValues/profileType.mjs';
22
- import '../common/propsValues/variant.mjs';
23
- import '../common/propsValues/scroll.mjs';
24
- import '../common/propsValues/markdownNodeType.mjs';
25
- import '../common/fileType.mjs';
6
+ import { useState, Fragment as Fragment$1 } from 'react';
26
7
  import { CloseButton } from '../common/closeButton/CloseButton.mjs';
27
8
  import { useVirtualKeyboard } from '../common/hooks/useVirtualKeyboard.mjs';
28
9
  import { PreventScroll } from '../common/preventScroll/PreventScroll.mjs';
10
+ import { Size } from '../common/propsValues/size.mjs';
29
11
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
30
12
 
31
- const freezeScroll = (shouldFreeze = true) => {
32
- if (shouldFreeze) {
33
- document.documentElement.classList.add('wds-select-input-scroll-freeze');
34
- } else {
35
- document.documentElement.classList.remove('wds-select-input-scroll-freeze');
36
- }
37
- };
38
13
  function BottomSheet({
39
14
  open,
40
15
  renderTrigger,
@@ -57,9 +32,6 @@ function BottomSheet({
57
32
  }
58
33
  }
59
34
  });
60
- useEffect(() => {
61
- freezeScroll(open);
62
- }, [open]);
63
35
  const dismiss = useDismiss(context);
64
36
  const role = useRole(context);
65
37
  const {
@@ -1 +1 @@
1
- {"version":3,"file":"_BottomSheet.mjs","sources":["../../src/inputs/_BottomSheet.tsx"],"sourcesContent":["import {\n FloatingFocusManager,\n FloatingPortal,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport { Transition } from '@headlessui/react';\nimport { FocusScope } from '@react-aria/focus';\nimport { ThemeProvider, useTheme } from '@wise/components-theming';\nimport { clsx } from 'clsx';\nimport { Fragment, useEffect, useState } from 'react';\n\nimport { CloseButton , Size } from '../common';\nimport { useVirtualKeyboard } from '../common/hooks/useVirtualKeyboard';\nimport { PreventScroll } from '../common/preventScroll/PreventScroll';\n\nexport interface BottomSheetProps {\n open: boolean;\n renderTrigger?: (args: {\n ref: React.RefCallback<Element>;\n getInteractionProps: (customEventHandlers?: React.HTMLProps<Element>) => {\n [key: string]: unknown;\n };\n }) => React.ReactNode;\n title?: string;\n initialFocusRef?: React.MutableRefObject<HTMLElement | null>;\n padding?: 'none' | 'md';\n children?: React.ReactNode;\n onClose?: () => void;\n onCloseEnd?: () => void;\n}\n\n/**\n * App pages set scroll-behavior to 'smooth' which causes mobile Safari to\n * slow-scroll and glitch. This function temporarily disables that behaviour\n * while the BottomSheet is open. It complements <PreventScroll />.\n */\nconst freezeScroll = (shouldFreeze = true) => {\n if (shouldFreeze) {\n document.documentElement.classList.add('wds-select-input-scroll-freeze');\n } else {\n document.documentElement.classList.remove('wds-select-input-scroll-freeze');\n }\n};\n\nexport function BottomSheet({\n open,\n renderTrigger,\n title,\n initialFocusRef,\n padding = 'md',\n children,\n onClose,\n onCloseEnd,\n}: BottomSheetProps) {\n useVirtualKeyboard();\n\n const { refs, context } = useFloating<Element>({\n open,\n onOpenChange: (value) => {\n if (!value) {\n onClose?.();\n }\n },\n });\n\n useEffect(() => {\n freezeScroll(open);\n }, [open]);\n\n const dismiss = useDismiss(context);\n const role = useRole(context);\n const { getReferenceProps, getFloatingProps } = useInteractions([dismiss, role]);\n\n const [floatingKey, setFloatingKey] = useState(0);\n\n const { theme, screenMode } = useTheme();\n\n return (\n <>\n {open ? <PreventScroll /> : null}\n {renderTrigger?.({\n ref: refs.setReference,\n getInteractionProps: getReferenceProps,\n })}\n\n <FloatingPortal>\n <ThemeProvider\n theme=\"personal\"\n screenMode={theme === 'personal' ? screenMode : 'light'}\n isNotRootProvider\n >\n <Transition\n show={open}\n className=\"np-bottom-sheet-v2-container\"\n beforeEnter={() => {\n setFloatingKey((prev) => prev + 1);\n }}\n afterLeave={onCloseEnd}\n >\n <Transition.Child\n className=\"np-bottom-sheet-v2-backdrop\"\n enterFrom=\"np-bottom-sheet-v2-backdrop--closed\"\n leaveTo=\"np-bottom-sheet-v2-backdrop--closed\"\n />\n\n <div className=\"np-bottom-sheet-v2\">\n <FocusScope>\n <FloatingFocusManager context={context} initialFocus={initialFocusRef}>\n <Fragment\n key={floatingKey} // Force inner state invalidation on open\n >\n <Transition.Child\n ref={refs.setFloating}\n className=\"np-bottom-sheet-v2-content\"\n enterFrom=\"np-bottom-sheet-v2-content--closed\"\n leaveTo=\"np-bottom-sheet-v2-content--closed\"\n {...getFloatingProps()}\n >\n <div className=\"np-bottom-sheet-v2-header\">\n <CloseButton\n size={Size.SMALL}\n onClick={() => {\n onClose?.();\n }}\n />\n </div>\n <div\n className={clsx(\n 'np-bottom-sheet-v2-content-inner',\n title && 'np-bottom-sheet-v2-content-inner--has-title',\n padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md',\n )}\n >\n {title ? (\n <h2 className=\"np-bottom-sheet-v2-title np-text-title-body\">{title}</h2>\n ) : null}\n <div className=\"np-bottom-sheet-v2-body np-text-body-default\">\n {children}\n </div>\n </div>\n </Transition.Child>\n </Fragment>\n </FloatingFocusManager>\n </FocusScope>\n </div>\n </Transition>\n </ThemeProvider>\n </FloatingPortal>\n </>\n );\n}\n"],"names":["freezeScroll","shouldFreeze","document","documentElement","classList","add","remove","BottomSheet","open","renderTrigger","title","initialFocusRef","padding","children","onClose","onCloseEnd","useVirtualKeyboard","refs","context","useFloating","onOpenChange","value","useEffect","dismiss","useDismiss","role","useRole","getReferenceProps","getFloatingProps","useInteractions","floatingKey","setFloatingKey","useState","theme","screenMode","useTheme","_jsxs","_Fragment","_jsx","PreventScroll","ref","setReference","getInteractionProps","FloatingPortal","ThemeProvider","isNotRootProvider","Transition","show","className","beforeEnter","prev","afterLeave","Child","enterFrom","leaveTo","FocusScope","FloatingFocusManager","initialFocus","Fragment","setFloating","CloseButton","size","Size","SMALL","onClick","clsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAMA,YAAY,GAAGA,CAACC,YAAY,GAAG,IAAI,KAAI;AAC3C,EAAA,IAAIA,YAAY,EAAE;IAChBC,QAAQ,CAACC,eAAe,CAACC,SAAS,CAACC,GAAG,CAAC,gCAAgC,CAAC;AAC1E,EAAA,CAAC,MAAM;IACLH,QAAQ,CAACC,eAAe,CAACC,SAAS,CAACE,MAAM,CAAC,gCAAgC,CAAC;AAC7E,EAAA;AACF,CAAC;AAEK,SAAUC,WAAWA,CAAC;EAC1BC,IAAI;EACJC,aAAa;EACbC,KAAK;EACLC,eAAe;AACfC,EAAAA,OAAO,GAAG,IAAI;EACdC,QAAQ;EACRC,OAAO;AACPC,EAAAA;AAAU,CACO,EAAA;AACjBC,EAAAA,kBAAkB,EAAE;EAEpB,MAAM;IAAEC,IAAI;AAAEC,IAAAA;GAAS,GAAGC,WAAW,CAAU;IAC7CX,IAAI;IACJY,YAAY,EAAGC,KAAK,IAAI;MACtB,IAAI,CAACA,KAAK,E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;AAAIU,wBAAAA,SAAS,EAAC,6CAA6C;AAAAnC,wBAAAA,QAAA,EAAEH;AAAK,uBAAK,CAAC,GACtE,IAAI,eACR4B,GAAA,CAAA,KAAA,EAAA;AAAKU,wBAAAA,SAAS,EAAC,8CAA8C;AAAAnC,wBAAAA,QAAA,EAC1DA;AAAQ,uBACN,CACP;AAAA,qBAAK,CACP;mBAAkB;AACpB,iBAAA,EAhCOiB,WAgCG;eACU;aACZ;AACd,WAAK,CACP;SAAY;OACC;AACjB,KAAgB,CAClB;AAAA,GAAA,CAAG;AAEP;;;;"}
1
+ {"version":3,"file":"_BottomSheet.mjs","sources":["../../src/inputs/_BottomSheet.tsx"],"sourcesContent":["import {\n FloatingFocusManager,\n FloatingPortal,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport { Transition } from '@headlessui/react';\nimport { FocusScope } from '@react-aria/focus';\nimport { ThemeProvider, useTheme } from '@wise/components-theming';\nimport { clsx } from 'clsx';\nimport { Fragment, useState } from 'react';\n\nimport { CloseButton } from '../common/closeButton';\nimport { useVirtualKeyboard } from '../common/hooks/useVirtualKeyboard';\nimport { PreventScroll } from '../common/preventScroll/PreventScroll';\nimport { Size } from '../common/propsValues/size';\n\nexport interface BottomSheetProps {\n open: boolean;\n renderTrigger?: (args: {\n ref: React.RefCallback<Element>;\n getInteractionProps: (customEventHandlers?: React.HTMLProps<Element>) => {\n [key: string]: unknown;\n };\n }) => React.ReactNode;\n title?: string;\n initialFocusRef?: React.MutableRefObject<HTMLElement | null>;\n padding?: 'none' | 'md';\n children?: React.ReactNode;\n onClose?: () => void;\n onCloseEnd?: () => void;\n}\n\nexport function BottomSheet({\n open,\n renderTrigger,\n title,\n initialFocusRef,\n padding = 'md',\n children,\n onClose,\n onCloseEnd,\n}: BottomSheetProps) {\n useVirtualKeyboard();\n\n const { refs, context } = useFloating<Element>({\n open,\n onOpenChange: (value) => {\n if (!value) {\n onClose?.();\n }\n },\n });\n\n const dismiss = useDismiss(context);\n const role = useRole(context);\n const { getReferenceProps, getFloatingProps } = useInteractions([dismiss, role]);\n\n const [floatingKey, setFloatingKey] = useState(0);\n\n const { theme, screenMode } = useTheme();\n\n return (\n <>\n {open ? <PreventScroll /> : null}\n {renderTrigger?.({\n ref: refs.setReference,\n getInteractionProps: getReferenceProps,\n })}\n\n <FloatingPortal>\n <ThemeProvider\n theme=\"personal\"\n screenMode={theme === 'personal' ? screenMode : 'light'}\n isNotRootProvider\n >\n <Transition\n show={open}\n className=\"np-bottom-sheet-v2-container\"\n beforeEnter={() => {\n setFloatingKey((prev) => prev + 1);\n }}\n afterLeave={onCloseEnd}\n >\n <Transition.Child\n className=\"np-bottom-sheet-v2-backdrop\"\n enterFrom=\"np-bottom-sheet-v2-backdrop--closed\"\n leaveTo=\"np-bottom-sheet-v2-backdrop--closed\"\n />\n\n <div className=\"np-bottom-sheet-v2\">\n <FocusScope>\n <FloatingFocusManager context={context} initialFocus={initialFocusRef}>\n <Fragment\n key={floatingKey} // Force inner state invalidation on open\n >\n <Transition.Child\n ref={refs.setFloating}\n className=\"np-bottom-sheet-v2-content\"\n enterFrom=\"np-bottom-sheet-v2-content--closed\"\n leaveTo=\"np-bottom-sheet-v2-content--closed\"\n {...getFloatingProps()}\n >\n <div className=\"np-bottom-sheet-v2-header\">\n <CloseButton\n size={Size.SMALL}\n onClick={() => {\n onClose?.();\n }}\n />\n </div>\n <div\n className={clsx(\n 'np-bottom-sheet-v2-content-inner',\n title && 'np-bottom-sheet-v2-content-inner--has-title',\n padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md',\n )}\n >\n {title ? (\n <h2 className=\"np-bottom-sheet-v2-title np-text-title-body\">{title}</h2>\n ) : null}\n <div className=\"np-bottom-sheet-v2-body np-text-body-default\">\n {children}\n </div>\n </div>\n </Transition.Child>\n </Fragment>\n </FloatingFocusManager>\n </FocusScope>\n </div>\n </Transition>\n </ThemeProvider>\n </FloatingPortal>\n </>\n );\n}\n"],"names":["BottomSheet","open","renderTrigger","title","initialFocusRef","padding","children","onClose","onCloseEnd","useVirtualKeyboard","refs","context","useFloating","onOpenChange","value","dismiss","useDismiss","role","useRole","getReferenceProps","getFloatingProps","useInteractions","floatingKey","setFloatingKey","useState","theme","screenMode","useTheme","_jsxs","_Fragment","_jsx","PreventScroll","ref","setReference","getInteractionProps","FloatingPortal","ThemeProvider","isNotRootProvider","Transition","show","className","beforeEnter","prev","afterLeave","Child","enterFrom","leaveTo","FocusScope","FloatingFocusManager","initialFocus","Fragment","setFloating","CloseButton","size","Size","SMALL","onClick","clsx"],"mappings":";;;;;;;;;;;;AAmCM,SAAUA,WAAWA,CAAC;EAC1BC,IAAI;EACJC,aAAa;EACbC,KAAK;EACLC,eAAe;AACfC,EAAAA,OAAO,GAAG,IAAI;EACdC,QAAQ;EACRC,OAAO;AACPC,EAAAA;AAAU,CACO,EAAA;AACjBC,EAAAA,kBAAkB,EAAE;EAEpB,MAAM;IAAEC,IAAI;AAAEC,IAAAA;GAAS,GAAGC,WAAW,CAAU;IAC7CX,IAAI;IACJY,YAAY,EAAGC,KAAK,IAAI;MACtB,IAAI,CAACA,KAAK,EAAE;AACVP,QAAAA,OAAO,IAAI;AACb,MAAA;AACF,IAAA;AACD,GAAA,CAAC;AAEF,EAAA,MAAMQ,OAAO,GAAGC,UAAU,CAACL,OAAO,CAAC;AACnC,EAAA,MAAMM,IAAI,GAAGC,OAAO,CAACP,OAAO,CAAC;EAC7B,MAAM;IAAEQ,iBAAiB;AAAEC,IAAAA;GAAkB,GAAGC,eAAe,CAAC,CAACN,OAAO,EAAEE,IAAI,CAAC,CAAC;EAEhF,MAAM,CAACK,WAAW,EAAEC,cAAc,CAAC,GAAGC,QAAQ,CAAC,CAAC,CAAC;EAEjD,MAAM;IAAEC,KAAK;AAAEC,IAAAA;GAAY,GAAGC,QAAQ,EAAE;EAExC,oBACEC,IAAA,CAAAC,QAAA,EAAA;AAAAvB,IAAAA,QAAA,EAAA,CACGL,IAAI,gBAAG6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C,4BAA4B;AACtCK,oBAAAA,SAAS,EAAC,oCAAoC;AAC9CC,oBAAAA,OAAO,EAAC,oCAAoC;oBAAA,GACxC1B,gBAAgB,EAAE;AAAAd,oBAAAA,QAAA,gBAEtBwB,GAAA,CAAA,KAAA,EAAA;AAAKU,sBAAAA,SAAS,EAAC,2BAA2B;sBAAAlC,QAAA,eACxCwB,GAAA,CAACsB,WAAW,EAAA;wBACVC,IAAI,EAAEC,IAAI,CAACC,KAAM;wBACjBC,OAAO,EAAEA,MAAK;AACZjD,0BAAAA,OAAO,IAAI;AACb,wBAAA;uBAAE;qBAED,CACL,eAAAqB,IAAA,CAAA,KAAA,EAAA;AACEY,sBAAAA,SAAS,EAAEiB,IAAI,CACb,kCAAkC,EAClCtD,KAAK,IAAI,6CAA6C,EACtDE,OAAO,KAAK,IAAI,IAAI,8CAA8C,CAClE;sBAAAC,QAAA,EAAA,CAEDH,KAAK,gBACJ2B,GAAA,CAAA,IAAA,EAAA;AAAIU,wBAAAA,SAAS,EAAC,6CAA6C;AAAAlC,wBAAAA,QAAA,EAAEH;AAAK,uBAAK,CAAC,GACtE,IAAI,eACR2B,GAAA,CAAA,KAAA,EAAA;AAAKU,wBAAAA,SAAS,EAAC,8CAA8C;AAAAlC,wBAAAA,QAAA,EAC1DA;AAAQ,uBACN,CACP;AAAA,qBAAK,CACP;mBAAkB;AACpB,iBAAA,EAhCOgB,WAgCG;eACU;aACZ;AACd,WAAK,CACP;SAAY;OACC;AACjB,KAAgB,CAClB;AAAA,GAAA,CAAG;AAEP;;;;"}
package/build/main.css CHANGED
@@ -3524,13 +3524,6 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
3524
3524
  padding-inline-start: 8px;
3525
3525
  padding-inline-start: var(--size-8);
3526
3526
  }
3527
- .wds-select-input-scroll-freeze {
3528
- scroll-behavior: unset !important;
3529
- height: 100vh;
3530
- }
3531
- .wds-select-input-scroll-freeze body {
3532
- height: 100vh;
3533
- }
3534
3527
  .np-bottom-sheet-v2-container {
3535
3528
  position: relative;
3536
3529
  z-index: 1060;
@@ -3544,8 +3537,6 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
3544
3537
  transition-property: opacity;
3545
3538
  transition-timing-function: ease-out;
3546
3539
  transition-duration: 300ms;
3547
- will-change: transform;
3548
- min-height: 100vh;
3549
3540
  }
3550
3541
  .np-bottom-sheet-v2-backdrop--closed {
3551
3542
  opacity: 0;
@@ -3553,8 +3544,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
3553
3544
  .np-bottom-sheet-v2 {
3554
3545
  position: fixed;
3555
3546
  inset: 0px;
3556
- bottom: calc(env(keyboard-inset-height, 12px));
3557
- bottom: calc(env(keyboard-inset-height, var(--size-12)));
3547
+ bottom: env(keyboard-inset-height, 0px);
3558
3548
  margin-left: 8px;
3559
3549
  margin-left: var(--size-8);
3560
3550
  margin-right: 8px;
@@ -3569,14 +3559,13 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
3569
3559
  display: flex;
3570
3560
  flex-direction: column;
3571
3561
  overflow: auto;
3572
- border-radius: 32px;
3573
- border-radius: var(--size-32);
3574
- margin-bottom: 8px;
3575
- margin-bottom: var(--size-8);
3562
+ border-top-left-radius: 32px;
3563
+ /* TODO: Tokenize */
3564
+ border-top-right-radius: 32px;
3565
+ /* TODO: Tokenize */
3576
3566
  background-color: #ffffff;
3577
3567
  background-color: var(--color-background-elevated);
3578
3568
  box-shadow: 0 0 40px rgba(69, 71, 69, 0.2);
3579
- will-change: transform;
3580
3569
  }
3581
3570
  .np-bottom-sheet-v2-content:focus {
3582
3571
  outline: none;
@@ -4452,6 +4441,64 @@ button.np-link {
4452
4441
  box-shadow: inset 0 0 0 1px #c9cbce !important;
4453
4442
  box-shadow: inset 0 0 0 1px var(--color-interactive-secondary) !important;
4454
4443
  }
4444
+ .wds-amount-input-container {
4445
+ width: 100%;
4446
+ }
4447
+ .wds-amount-input-input-container {
4448
+ display: flex;
4449
+ justify-content: right;
4450
+ width: 100%;
4451
+ transition: font-size 0.4s cubic-bezier(0.3, 0, 0.1, 1), height 0.4s cubic-bezier(0.3, 0, 0.1, 1), margin-top 0.4s cubic-bezier(0.3, 0, 0.1, 1), color 0.4s ease;
4452
+ color: var(--color-interactive-primary);
4453
+ overflow: hidden;
4454
+ margin-bottom: 0 !important;
4455
+ }
4456
+ @media (prefers-reduced-motion: reduce) {
4457
+ .wds-amount-input-input-container {
4458
+ transition: none;
4459
+ }
4460
+ }
4461
+ .wds-amount-input-input {
4462
+ border: none;
4463
+ outline: none;
4464
+ flex-grow: 1;
4465
+ text-align: right;
4466
+ background-color: transparent;
4467
+ }
4468
+ .wds-amount-input-input:focus-visible {
4469
+ outline: none;
4470
+ }
4471
+ .wds-amount-input-placeholder {
4472
+ flex-grow: 0;
4473
+ display: flex;
4474
+ align-items: center;
4475
+ }
4476
+ .wds-currency-selector:disabled {
4477
+ opacity: 1 !important;
4478
+ cursor: auto !important;
4479
+ cursor: initial !important;
4480
+ mix-blend-mode: initial !important;
4481
+ }
4482
+ .wds-chevron-container {
4483
+ width: 32px;
4484
+ width: var(--size-32);
4485
+ overflow: hidden;
4486
+ color: var(--color-interactive-primary);
4487
+ margin-left: 8px;
4488
+ margin-left: var(--size-8);
4489
+ transition: width 0.3s ease;
4490
+ }
4491
+ .wds-chevron-hidden {
4492
+ width: 0;
4493
+ }
4494
+ .wds-money-input-field-currency-selector {
4495
+ flex-shrink: 0;
4496
+ margin-right: 24px;
4497
+ margin-right: var(--size-24);
4498
+ }
4499
+ .wds-money-input-field-chevron {
4500
+ transform: translateY(-5%);
4501
+ }
4455
4502
  .np-navigation-option {
4456
4503
  -webkit-text-decoration: none;
4457
4504
  text-decoration: none;