@transferwise/components 46.46.1 → 46.48.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.
Files changed (156) hide show
  1. package/build/accordion/AccordionItem/AccordionItem.js.map +1 -1
  2. package/build/accordion/AccordionItem/AccordionItem.mjs.map +1 -1
  3. package/build/alert/Alert.js.map +1 -1
  4. package/build/alert/Alert.mjs.map +1 -1
  5. package/build/avatar/Avatar.js.map +1 -1
  6. package/build/avatar/Avatar.mjs.map +1 -1
  7. package/build/badge/Badge.js.map +1 -1
  8. package/build/badge/Badge.mjs.map +1 -1
  9. package/build/button/legacyUtils/legacyUtils.js.map +1 -1
  10. package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
  11. package/build/carousel/Carousel.js.map +1 -1
  12. package/build/carousel/Carousel.mjs.map +1 -1
  13. package/build/chips/Chip.js.map +1 -1
  14. package/build/chips/Chip.mjs.map +1 -1
  15. package/build/chips/Chips.js.map +1 -1
  16. package/build/chips/Chips.mjs.map +1 -1
  17. package/build/common/bottomSheet/BottomSheet.js.map +1 -1
  18. package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
  19. package/build/common/deviceDetection/deviceDetection.js.map +1 -1
  20. package/build/common/deviceDetection/deviceDetection.mjs.map +1 -1
  21. package/build/common/panel/Panel.js.map +1 -1
  22. package/build/common/panel/Panel.mjs.map +1 -1
  23. package/build/common/responsivePanel/ResponsivePanel.js +3 -1
  24. package/build/common/responsivePanel/ResponsivePanel.js.map +1 -1
  25. package/build/common/responsivePanel/ResponsivePanel.mjs +3 -1
  26. package/build/common/responsivePanel/ResponsivePanel.mjs.map +1 -1
  27. package/build/dateInput/DateInput.js.map +1 -1
  28. package/build/dateInput/DateInput.mjs.map +1 -1
  29. package/build/dateLookup/DateLookup.js.map +1 -1
  30. package/build/dateLookup/DateLookup.mjs.map +1 -1
  31. package/build/dateLookup/dateHeader/DateHeader.js.map +1 -1
  32. package/build/dateLookup/dateHeader/DateHeader.mjs.map +1 -1
  33. package/build/dateLookup/dateTrigger/DateTrigger.js.map +1 -1
  34. package/build/dateLookup/dateTrigger/DateTrigger.mjs.map +1 -1
  35. package/build/decision/Decision.js.map +1 -1
  36. package/build/decision/Decision.mjs.map +1 -1
  37. package/build/display/Display.js.map +1 -1
  38. package/build/display/Display.mjs.map +1 -1
  39. package/build/emphasis/EmphasisHtmlTransformer.js.map +1 -1
  40. package/build/emphasis/EmphasisHtmlTransformer.mjs.map +1 -1
  41. package/build/i18n/en.json +2 -0
  42. package/build/i18n/en.json.js +2 -0
  43. package/build/i18n/en.json.js.map +1 -1
  44. package/build/i18n/en.json.mjs +2 -0
  45. package/build/i18n/en.json.mjs.map +1 -1
  46. package/build/index.js +2 -0
  47. package/build/index.js.map +1 -1
  48. package/build/index.mjs +1 -0
  49. package/build/index.mjs.map +1 -1
  50. package/build/inlineAlert/InlineAlert.js.map +1 -1
  51. package/build/inlineAlert/InlineAlert.mjs.map +1 -1
  52. package/build/inputs/InputGroup.js.map +1 -1
  53. package/build/inputs/InputGroup.mjs.map +1 -1
  54. package/build/inputs/contexts.js.map +1 -1
  55. package/build/inputs/contexts.mjs.map +1 -1
  56. package/build/link/Link.js.map +1 -1
  57. package/build/link/Link.mjs.map +1 -1
  58. package/build/loader/Loader.js.map +1 -1
  59. package/build/loader/Loader.mjs.map +1 -1
  60. package/build/logo/Logo.js.map +1 -1
  61. package/build/logo/Logo.mjs.map +1 -1
  62. package/build/main.css +44 -0
  63. package/build/markdown/Markdown.js.map +1 -1
  64. package/build/markdown/Markdown.mjs.map +1 -1
  65. package/build/modal/Modal.js.map +1 -1
  66. package/build/modal/Modal.mjs.map +1 -1
  67. package/build/moneyInput/MoneyInput.js.map +1 -1
  68. package/build/moneyInput/MoneyInput.mjs.map +1 -1
  69. package/build/moneyInput/currencyFormatting.js.map +1 -1
  70. package/build/moneyInput/currencyFormatting.mjs.map +1 -1
  71. package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
  72. package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
  73. package/build/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.js.map +1 -1
  74. package/build/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.mjs.map +1 -1
  75. package/build/popover/Popover.js.map +1 -1
  76. package/build/popover/Popover.mjs.map +1 -1
  77. package/build/processIndicator/ProcessIndicator.js.map +1 -1
  78. package/build/processIndicator/ProcessIndicator.mjs.map +1 -1
  79. package/build/progressBar/ProgressBar.js.map +1 -1
  80. package/build/progressBar/ProgressBar.mjs.map +1 -1
  81. package/build/promoCard/PromoCard.js.map +1 -1
  82. package/build/promoCard/PromoCard.mjs.map +1 -1
  83. package/build/provider/Provider.js.map +1 -1
  84. package/build/provider/Provider.mjs.map +1 -1
  85. package/build/select/Select.js.map +1 -1
  86. package/build/select/Select.mjs.map +1 -1
  87. package/build/select/option/Option.js.map +1 -1
  88. package/build/select/option/Option.mjs.map +1 -1
  89. package/build/select/searchBox/SearchBox.js.map +1 -1
  90. package/build/select/searchBox/SearchBox.mjs.map +1 -1
  91. package/build/selectOption/SelectOption.js +115 -0
  92. package/build/selectOption/SelectOption.js.map +1 -0
  93. package/build/selectOption/SelectOption.messages.js +15 -0
  94. package/build/selectOption/SelectOption.messages.js.map +1 -0
  95. package/build/selectOption/SelectOption.messages.mjs +13 -0
  96. package/build/selectOption/SelectOption.messages.mjs.map +1 -0
  97. package/build/selectOption/SelectOption.mjs +109 -0
  98. package/build/selectOption/SelectOption.mjs.map +1 -0
  99. package/build/slidingPanel/SlidingPanel.js.map +1 -1
  100. package/build/slidingPanel/SlidingPanel.mjs.map +1 -1
  101. package/build/statusIcon/StatusIcon.js.map +1 -1
  102. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  103. package/build/stepper/Stepper.js.map +1 -1
  104. package/build/stepper/Stepper.mjs.map +1 -1
  105. package/build/stepper/deviceDetection.js.map +1 -1
  106. package/build/stepper/deviceDetection.mjs.map +1 -1
  107. package/build/styles/main.css +44 -0
  108. package/build/styles/selectOption/SelectOption.css +44 -0
  109. package/build/tabs/Tabs.js.map +1 -1
  110. package/build/tabs/Tabs.mjs.map +1 -1
  111. package/build/title/Title.js.map +1 -1
  112. package/build/title/Title.mjs.map +1 -1
  113. package/build/tooltip/Tooltip.js.map +1 -1
  114. package/build/tooltip/Tooltip.mjs.map +1 -1
  115. package/build/typeahead/Typeahead.js.map +1 -1
  116. package/build/typeahead/Typeahead.mjs.map +1 -1
  117. package/build/typeahead/typeaheadInput/TypeaheadInput.js.map +1 -1
  118. package/build/typeahead/typeaheadInput/TypeaheadInput.mjs.map +1 -1
  119. package/build/types/common/responsivePanel/ResponsivePanel.d.ts.map +1 -1
  120. package/build/types/index.d.ts +2 -0
  121. package/build/types/index.d.ts.map +1 -1
  122. package/build/types/selectOption/SelectOption.d.ts +21 -0
  123. package/build/types/selectOption/SelectOption.d.ts.map +1 -0
  124. package/build/types/selectOption/SelectOption.messages.d.ts +12 -0
  125. package/build/types/selectOption/SelectOption.messages.d.ts.map +1 -0
  126. package/build/types/selectOption/index.d.ts +3 -0
  127. package/build/types/selectOption/index.d.ts.map +1 -0
  128. package/build/types/uploadInput/UploadInput.d.ts.map +1 -1
  129. package/build/upload/steps/uploadImageStep/uploadImageStep.js.map +1 -1
  130. package/build/upload/steps/uploadImageStep/uploadImageStep.mjs.map +1 -1
  131. package/build/uploadInput/UploadInput.js +6 -0
  132. package/build/uploadInput/UploadInput.js.map +1 -1
  133. package/build/uploadInput/UploadInput.mjs +6 -0
  134. package/build/uploadInput/UploadInput.mjs.map +1 -1
  135. package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
  136. package/build/uploadInput/uploadButton/UploadButton.mjs.map +1 -1
  137. package/build/utilities/cssValueWithUnit.js.map +1 -1
  138. package/build/utilities/cssValueWithUnit.mjs.map +1 -1
  139. package/package.json +32 -33
  140. package/src/common/responsivePanel/ResponsivePanel.tsx +2 -0
  141. package/src/i18n/en.json +2 -0
  142. package/src/index.ts +2 -0
  143. package/src/main.css +44 -0
  144. package/src/main.less +1 -0
  145. package/src/selectOption/SelectOption.css +44 -0
  146. package/src/selectOption/SelectOption.less +40 -0
  147. package/src/selectOption/SelectOption.messages.ts +12 -0
  148. package/src/selectOption/SelectOption.spec.tsx +83 -0
  149. package/src/selectOption/SelectOption.story.tsx +278 -0
  150. package/src/selectOption/SelectOption.tsx +151 -0
  151. package/src/selectOption/index.ts +2 -0
  152. package/src/ssr.spec.js +1 -0
  153. package/src/test-utils/Parameters.d.ts +1 -1
  154. package/src/uploadInput/UploadInput.spec.tsx +14 -1
  155. package/src/uploadInput/UploadInput.story.tsx +11 -0
  156. package/src/uploadInput/UploadInput.tsx +8 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.js","sources":["../../src/chips/Chip.tsx"],"sourcesContent":["import { useTheme } from '@wise/components-theming';\nimport classNames from 'classnames';\nimport { useEffect, useRef } from 'react';\n\nimport Body from '../body/Body';\nimport { AriaLabelProperty, CommonProps, Typography } from '../common';\nimport { CloseButton } from '../common/closeButton/CloseButton';\n\nexport type ChipValue = string | number;\n\nexport type Props = {\n value?: ChipValue;\n label: string;\n onRemove?: () => void;\n onClick?: () => void;\n onKeyPress?: () => void;\n closeButton?: AriaLabelProperty;\n 'aria-checked'?: boolean;\n role?: string;\n} & AriaLabelProperty &\n CommonProps;\n\nconst Chip = ({\n label,\n value,\n onRemove,\n onClick,\n onKeyPress,\n className = undefined,\n 'aria-label': ariaLabel,\n 'aria-checked': ariaChecked,\n role,\n closeButton,\n}: Props) => {\n const isActionable = onClick || onKeyPress;\n const defaultRole = isActionable ? 'button' : undefined;\n const tabIndex = isActionable ? 0 : -1;\n\n const { isModern } = useTheme();\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n const previousCloseButtonShown = useRef<boolean | undefined>(undefined);\n useEffect(() => {\n if (closeButtonReference.current != null && previousCloseButtonShown.current === false) {\n closeButtonReference.current?.focus();\n }\n previousCloseButtonShown.current = closeButtonReference.current != null;\n }, [onRemove]);\n\n return (\n <div\n key={value}\n role={role ?? defaultRole}\n tabIndex={tabIndex}\n aria-label={ariaLabel}\n aria-checked={ariaChecked}\n className={classNames(\n 'np-chip',\n 'd-flex',\n 'align-items-center',\n 'justify-content-between',\n onRemove ? 'np-chip--removable' : '',\n className,\n )}\n {...(isActionable && { onClick, onKeyPress })}\n >\n {isModern ? (\n <Body aria-hidden={!!onRemove} type={Typography.BODY_DEFAULT_BOLD}>\n {label}\n </Body>\n ) : (\n <span aria-hidden=\"false\" className=\"np-chip-label\">\n {label}\n </span>\n )}\n {onRemove ? (\n <CloseButton\n ref={closeButtonReference}\n className={isModern ? `btn-unstyled` : `btn-unstyled m-l-1`}\n aria-label={closeButton?.['aria-label']}\n size=\"sm\"\n filled={isModern}\n onClick={onRemove}\n />\n ) : null}\n </div>\n );\n};\n\nexport default Chip;\n"],"names":["Chip","label","value","onRemove","onClick","onKeyPress","className","undefined","ariaLabel","ariaChecked","role","closeButton","isActionable","defaultRole","tabIndex","isModern","useTheme","closeButtonReference","useRef","previousCloseButtonShown","useEffect","current","focus","_jsxs","classNames","children","_jsx","Body","type","Typography","BODY_DEFAULT_BOLD","CloseButton","ref","size","filled"],"mappings":";;;;;;;;;;;;;;AAsBMA,MAAAA,IAAI,GAAGA,CAAC;EACZC,KAAK;EACLC,KAAK;EACLC,QAAQ;EACRC,OAAO;EACPC,UAAU;AACVC,EAAAA,SAAS,GAAGC,SAAS;AACrB,EAAA,YAAY,EAAEC,SAAS;AACvB,EAAA,cAAc,EAAEC,WAAW;EAC3BC,IAAI;AACJC,EAAAA,WAAAA;AAAW,CACL,KAAI;AACV,EAAA,MAAMC,YAAY,GAAGR,OAAO,IAAIC,UAAU,CAAA;AAC1C,EAAA,MAAMQ,WAAW,GAAGD,YAAY,GAAG,QAAQ,GAAGL,SAAS,CAAA;AACvD,EAAA,MAAMO,QAAQ,GAAGF,YAAY,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;EAEtC,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B,MAAAA,QAAA,EAChDxB,KAAAA;AAAK,KACF,CACP,EACAE,QAAQ,gBACPuB,cAAA,CAACK,uBAAW,EAAA;AACVC,MAAAA,GAAG,EAAEf,oBAAqB;AAC1BX,MAAAA,SAAS,EAAES,QAAQ,GAAiB,CAAA,YAAA,CAAA,GAAuB,CAAC,kBAAA,CAAA;MAC5D,YAAYJ,EAAAA,WAAW,GAAG,YAAY,CAAE;AACxCsB,MAAAA,IAAI,EAAC,IAAI;AACTC,MAAAA,MAAM,EAAEnB,QAAS;AACjBX,MAAAA,OAAO,EAAED,QAAAA;KACT,CAAA,GACA,IAAI,CAAA;AAAA,GAAA,EAjCHD,KAkCF,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"Chip.js","sources":["../../src/chips/Chip.tsx"],"sourcesContent":["import { useTheme } from '@wise/components-theming';\nimport classNames from 'classnames';\nimport { useEffect, useRef } from 'react';\n\nimport Body from '../body/Body';\nimport { AriaLabelProperty, CommonProps, Typography } from '../common';\nimport { CloseButton } from '../common/closeButton/CloseButton';\n\nexport type ChipValue = string | number;\n\nexport type Props = {\n value?: ChipValue;\n label: string;\n onRemove?: () => void;\n onClick?: () => void;\n onKeyPress?: () => void;\n closeButton?: AriaLabelProperty;\n 'aria-checked'?: boolean;\n role?: string;\n} & AriaLabelProperty &\n CommonProps;\n\nconst Chip = ({\n label,\n value,\n onRemove,\n onClick,\n onKeyPress,\n className = undefined,\n 'aria-label': ariaLabel,\n 'aria-checked': ariaChecked,\n role,\n closeButton,\n}: Props) => {\n const isActionable = onClick || onKeyPress;\n const defaultRole = isActionable ? 'button' : undefined;\n const tabIndex = isActionable ? 0 : -1;\n\n const { isModern } = useTheme();\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n const previousCloseButtonShown = useRef<boolean | undefined>(undefined);\n useEffect(() => {\n if (closeButtonReference.current != null && previousCloseButtonShown.current === false) {\n closeButtonReference.current?.focus();\n }\n previousCloseButtonShown.current = closeButtonReference.current != null;\n }, [onRemove]);\n\n return (\n <div\n key={value}\n role={role ?? defaultRole}\n tabIndex={tabIndex}\n aria-label={ariaLabel}\n aria-checked={ariaChecked}\n className={classNames(\n 'np-chip',\n 'd-flex',\n 'align-items-center',\n 'justify-content-between',\n onRemove ? 'np-chip--removable' : '',\n className,\n )}\n {...(isActionable && { onClick, onKeyPress })}\n >\n {isModern ? (\n <Body aria-hidden={!!onRemove} type={Typography.BODY_DEFAULT_BOLD}>\n {label}\n </Body>\n ) : (\n <span aria-hidden=\"false\" className=\"np-chip-label\">\n {label}\n </span>\n )}\n {onRemove ? (\n <CloseButton\n ref={closeButtonReference}\n className={isModern ? `btn-unstyled` : `btn-unstyled m-l-1`}\n aria-label={closeButton?.['aria-label']}\n size=\"sm\"\n filled={isModern}\n onClick={onRemove}\n />\n ) : null}\n </div>\n );\n};\n\nexport default Chip;\n"],"names":["Chip","label","value","onRemove","onClick","onKeyPress","className","undefined","ariaLabel","ariaChecked","role","closeButton","isActionable","defaultRole","tabIndex","isModern","useTheme","closeButtonReference","useRef","previousCloseButtonShown","useEffect","current","focus","_jsxs","classNames","children","_jsx","Body","type","Typography","BODY_DEFAULT_BOLD","CloseButton","ref","size","filled"],"mappings":";;;;;;;;;;;;;;AAsBMA,MAAAA,IAAI,GAAGA,CAAC;EACZC,KAAK;EACLC,KAAK;EACLC,QAAQ;EACRC,OAAO;EACPC,UAAU;AACVC,EAAAA,SAAS,GAAGC,SAAS;AACrB,EAAA,YAAY,EAAEC,SAAS;AACvB,EAAA,cAAc,EAAEC,WAAW;EAC3BC,IAAI;AACJC,EAAAA,WAAAA;AAAW,CACL,KAAI;AACV,EAAA,MAAMC,YAAY,GAAGR,OAAO,IAAIC,UAAU,CAAA;AAC1C,EAAA,MAAMQ,WAAW,GAAGD,YAAY,GAAG,QAAQ,GAAGL,SAAS,CAAA;AACvD,EAAA,MAAMO,QAAQ,GAAGF,YAAY,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;EAEtC,MAAM;AAAEG,I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,QAAA,EAChDxB,KAAAA;AAAK,KACF,CACP,EACAE,QAAQ,gBACPuB,cAAA,CAACK,uBAAW,EAAA;AACVC,MAAAA,GAAG,EAAEf,oBAAqB;AAC1BX,MAAAA,SAAS,EAAES,QAAQ,GAAG,CAAA,YAAA,CAAc,GAAG,CAAqB,kBAAA,CAAA;MAC5D,YAAYJ,EAAAA,WAAW,GAAG,YAAY,CAAE;AACxCsB,MAAAA,IAAI,EAAC,IAAI;AACTC,MAAAA,MAAM,EAAEnB,QAAS;AACjBX,MAAAA,OAAO,EAAED,QAAAA;KACT,CAAA,GACA,IAAI,CAAA;AAAA,GAAA,EAjCHD,KAkCF,CAAC,CAAA;AAEV;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.mjs","sources":["../../src/chips/Chip.tsx"],"sourcesContent":["import { useTheme } from '@wise/components-theming';\nimport classNames from 'classnames';\nimport { useEffect, useRef } from 'react';\n\nimport Body from '../body/Body';\nimport { AriaLabelProperty, CommonProps, Typography } from '../common';\nimport { CloseButton } from '../common/closeButton/CloseButton';\n\nexport type ChipValue = string | number;\n\nexport type Props = {\n value?: ChipValue;\n label: string;\n onRemove?: () => void;\n onClick?: () => void;\n onKeyPress?: () => void;\n closeButton?: AriaLabelProperty;\n 'aria-checked'?: boolean;\n role?: string;\n} & AriaLabelProperty &\n CommonProps;\n\nconst Chip = ({\n label,\n value,\n onRemove,\n onClick,\n onKeyPress,\n className = undefined,\n 'aria-label': ariaLabel,\n 'aria-checked': ariaChecked,\n role,\n closeButton,\n}: Props) => {\n const isActionable = onClick || onKeyPress;\n const defaultRole = isActionable ? 'button' : undefined;\n const tabIndex = isActionable ? 0 : -1;\n\n const { isModern } = useTheme();\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n const previousCloseButtonShown = useRef<boolean | undefined>(undefined);\n useEffect(() => {\n if (closeButtonReference.current != null && previousCloseButtonShown.current === false) {\n closeButtonReference.current?.focus();\n }\n previousCloseButtonShown.current = closeButtonReference.current != null;\n }, [onRemove]);\n\n return (\n <div\n key={value}\n role={role ?? defaultRole}\n tabIndex={tabIndex}\n aria-label={ariaLabel}\n aria-checked={ariaChecked}\n className={classNames(\n 'np-chip',\n 'd-flex',\n 'align-items-center',\n 'justify-content-between',\n onRemove ? 'np-chip--removable' : '',\n className,\n )}\n {...(isActionable && { onClick, onKeyPress })}\n >\n {isModern ? (\n <Body aria-hidden={!!onRemove} type={Typography.BODY_DEFAULT_BOLD}>\n {label}\n </Body>\n ) : (\n <span aria-hidden=\"false\" className=\"np-chip-label\">\n {label}\n </span>\n )}\n {onRemove ? (\n <CloseButton\n ref={closeButtonReference}\n className={isModern ? `btn-unstyled` : `btn-unstyled m-l-1`}\n aria-label={closeButton?.['aria-label']}\n size=\"sm\"\n filled={isModern}\n onClick={onRemove}\n />\n ) : null}\n </div>\n );\n};\n\nexport default Chip;\n"],"names":["Chip","label","value","onRemove","onClick","onKeyPress","className","undefined","ariaLabel","ariaChecked","role","closeButton","isActionable","defaultRole","tabIndex","isModern","useTheme","closeButtonReference","useRef","previousCloseButtonShown","useEffect","current","focus","_jsxs","classNames","children","_jsx","Body","type","Typography","BODY_DEFAULT_BOLD","CloseButton","ref","size","filled"],"mappings":";;;;;;;;AAsBMA,MAAAA,IAAI,GAAGA,CAAC;EACZC,KAAK;EACLC,KAAK;EACLC,QAAQ;EACRC,OAAO;EACPC,UAAU;AACVC,EAAAA,SAAS,GAAGC,SAAS;AACrB,EAAA,YAAY,EAAEC,SAAS;AACvB,EAAA,cAAc,EAAEC,WAAW;EAC3BC,IAAI;AACJC,EAAAA,WAAAA;AAAW,CACL,KAAI;AACV,EAAA,MAAMC,YAAY,GAAGR,OAAO,IAAIC,UAAU,CAAA;AAC1C,EAAA,MAAMQ,WAAW,GAAGD,YAAY,GAAG,QAAQ,GAAGL,SAAS,CAAA;AACvD,EAAA,MAAMO,QAAQ,GAAGF,YAAY,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;EAEtC,MAAM;AAAEG,IA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DxB,KAAAA;AAAK,KACF,CACP,EACAE,QAAQ,gBACPuB,GAAA,CAACK,WAAW,EAAA;AACVC,MAAAA,GAAG,EAAEf,oBAAqB;AAC1BX,MAAAA,SAAS,EAAES,QAAQ,GAAiB,CAAA,YAAA,CAAA,GAAuB,CAAC,kBAAA,CAAA;MAC5D,YAAYJ,EAAAA,WAAW,GAAG,YAAY,CAAE;AACxCsB,MAAAA,IAAI,EAAC,IAAI;AACTC,MAAAA,MAAM,EAAEnB,QAAS;AACjBX,MAAAA,OAAO,EAAED,QAAAA;KACT,CAAA,GACA,IAAI,CAAA;AAAA,GAAA,EAjCHD,KAkCF,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"Chip.mjs","sources":["../../src/chips/Chip.tsx"],"sourcesContent":["import { useTheme } from '@wise/components-theming';\nimport classNames from 'classnames';\nimport { useEffect, useRef } from 'react';\n\nimport Body from '../body/Body';\nimport { AriaLabelProperty, CommonProps, Typography } from '../common';\nimport { CloseButton } from '../common/closeButton/CloseButton';\n\nexport type ChipValue = string | number;\n\nexport type Props = {\n value?: ChipValue;\n label: string;\n onRemove?: () => void;\n onClick?: () => void;\n onKeyPress?: () => void;\n closeButton?: AriaLabelProperty;\n 'aria-checked'?: boolean;\n role?: string;\n} & AriaLabelProperty &\n CommonProps;\n\nconst Chip = ({\n label,\n value,\n onRemove,\n onClick,\n onKeyPress,\n className = undefined,\n 'aria-label': ariaLabel,\n 'aria-checked': ariaChecked,\n role,\n closeButton,\n}: Props) => {\n const isActionable = onClick || onKeyPress;\n const defaultRole = isActionable ? 'button' : undefined;\n const tabIndex = isActionable ? 0 : -1;\n\n const { isModern } = useTheme();\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n const previousCloseButtonShown = useRef<boolean | undefined>(undefined);\n useEffect(() => {\n if (closeButtonReference.current != null && previousCloseButtonShown.current === false) {\n closeButtonReference.current?.focus();\n }\n previousCloseButtonShown.current = closeButtonReference.current != null;\n }, [onRemove]);\n\n return (\n <div\n key={value}\n role={role ?? defaultRole}\n tabIndex={tabIndex}\n aria-label={ariaLabel}\n aria-checked={ariaChecked}\n className={classNames(\n 'np-chip',\n 'd-flex',\n 'align-items-center',\n 'justify-content-between',\n onRemove ? 'np-chip--removable' : '',\n className,\n )}\n {...(isActionable && { onClick, onKeyPress })}\n >\n {isModern ? (\n <Body aria-hidden={!!onRemove} type={Typography.BODY_DEFAULT_BOLD}>\n {label}\n </Body>\n ) : (\n <span aria-hidden=\"false\" className=\"np-chip-label\">\n {label}\n </span>\n )}\n {onRemove ? (\n <CloseButton\n ref={closeButtonReference}\n className={isModern ? `btn-unstyled` : `btn-unstyled m-l-1`}\n aria-label={closeButton?.['aria-label']}\n size=\"sm\"\n filled={isModern}\n onClick={onRemove}\n />\n ) : null}\n </div>\n );\n};\n\nexport default Chip;\n"],"names":["Chip","label","value","onRemove","onClick","onKeyPress","className","undefined","ariaLabel","ariaChecked","role","closeButton","isActionable","defaultRole","tabIndex","isModern","useTheme","closeButtonReference","useRef","previousCloseButtonShown","useEffect","current","focus","_jsxs","classNames","children","_jsx","Body","type","Typography","BODY_DEFAULT_BOLD","CloseButton","ref","size","filled"],"mappings":";;;;;;;;AAsBMA,MAAAA,IAAI,GAAGA,CAAC;EACZC,KAAK;EACLC,KAAK;EACLC,QAAQ;EACRC,OAAO;EACPC,UAAU;AACVC,EAAAA,SAAS,GAAGC,SAAS;AACrB,EAAA,YAAY,EAAEC,SAAS;AACvB,EAAA,cAAc,EAAEC,WAAW;EAC3BC,IAAI;AACJC,EAAAA,WAAAA;AAAW,CACL,KAAI;AACV,EAAA,MAAMC,YAAY,GAAGR,OAAO,IAAIC,UAAU,CAAA;AAC1C,EAAA,MAAMQ,WAAW,GAAGD,YAAY,GAAG,QAAQ,GAAGL,SAAS,CAAA;AACvD,EAAA,MAAMO,QAAQ,GAAGF,YAAY,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;EAEtC,MAAM;AAAEG,IAAAA,QAAAA;GAAU,GAAGC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KACF,CACP,EACAE,QAAQ,gBACPuB,GAAA,CAACK,WAAW,EAAA;AACVC,MAAAA,GAAG,EAAEf,oBAAqB;AAC1BX,MAAAA,SAAS,EAAES,QAAQ,GAAG,CAAA,YAAA,CAAc,GAAG,CAAqB,kBAAA,CAAA;MAC5D,YAAYJ,EAAAA,WAAW,GAAG,YAAY,CAAE;AACxCsB,MAAAA,IAAI,EAAC,IAAI;AACTC,MAAAA,MAAM,EAAEnB,QAAS;AACjBX,MAAAA,OAAO,EAAED,QAAAA;KACT,CAAA,GACA,IAAI,CAAA;AAAA,GAAA,EAjCHD,KAkCF,CAAC,CAAA;AAEV;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Chips.js","sources":["../../src/chips/Chips.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { useIntl } from 'react-intl';\n\nimport { CommonProps, AriaLabelProperty } from '../common';\n\nimport Chip from './Chip';\nimport messages from './Chips.messages';\n\nexport type ChipValue = string | number;\n\nexport type Chip = {\n value: ChipValue;\n label: string;\n};\n\nexport type ChipsProps = CommonProps &\n AriaLabelProperty & {\n /** List of chips with string labels and string/number values */\n chips: readonly Chip[];\n /** Callback which is invoked when a chip is selected or deselected */\n onChange: ({\n isEnabled,\n selectedValue,\n }: {\n isEnabled: boolean;\n selectedValue: ChipValue;\n }) => void;\n /** Used to manage which chips are selected */\n selected: ChipValue | readonly ChipValue[];\n /** Used to activate multi-selection */\n multiple?: boolean;\n };\n\nconst Chips = ({\n chips,\n onChange,\n selected,\n 'aria-label': ariaLabel,\n className,\n multiple,\n}: ChipsProps) => {\n const intl = useIntl();\n\n const isSelected = (value: ChipValue) =>\n Array.isArray(selected) ? selected.includes(value) : selected === value;\n\n const handleOnChange = (selectedValue: ChipValue, isCurrentlyEnabled: boolean) => {\n onChange({ isEnabled: !isCurrentlyEnabled, selectedValue });\n };\n\n return (\n <div\n className={classNames('np-chips d-flex', className)}\n aria-label={ariaLabel}\n role={!multiple ? 'radiogroup' : undefined}\n >\n {chips.map((chip) => {\n const chipSelected = isSelected(chip.value);\n return (\n <Chip\n key={chip.value}\n value={chip.value}\n label={chip.label}\n closeButton={{\n 'aria-label': intl.formatMessage(messages.ariaLabel, { choice: chip.label }),\n }}\n className={classNames('text-xs-nowrap', {\n 'np-chip--selected': chipSelected,\n 'p-r-1': multiple && chipSelected,\n })}\n {...(multiple && chipSelected\n ? {\n onRemove: () => handleOnChange(chip.value, chipSelected),\n 'aria-label': chip.label,\n }\n : {\n onClick: () => handleOnChange(chip.value, chipSelected),\n onKeyPress: () => handleOnChange(chip.value, chipSelected),\n role: !multiple ? 'radio' : undefined,\n 'aria-checked': chipSelected,\n })}\n />\n );\n })}\n </div>\n );\n};\n\nexport default Chips;\n"],"names":["Chips","chips","onChange","selected","ariaLabel","className","multiple","intl","useIntl","isSelected","value","Array","isArray","includes","handleOnChange","selectedValue","isCurrentlyEnabled","isEnabled","_jsx","classNames","role","undefined","children","map","chip","chipSelected","Chip","label","closeButton","formatMessage","messages","choice","onRemove","onClick","onKeyPress"],"mappings":";;;;;;;;;;;;AAiCMA,MAAAA,KAAK,GAAGA,CAAC;EACbC,KAAK;EACLC,QAAQ;EACRC,QAAQ;AACR,EAAA,YAAY,EAAEC,SAAS;EACvBC,SAAS;AACTC,EAAAA,QAAAA;AAAQ,CACG,KAAI;AACf,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE,CAAA;EAEtB,MAAMC,UAAU,GAAIC,KAAgB,IAClCC,KAAK,CAACC,OAAO,CAACT,QAAQ,CAAC,GAAGA,QAAQ,CAACU,QAAQ,CAACH,KAAK,CAAC,GAAGP,QAAQ,KAAKO,KAAK,CAAA;AAEzE,EAAA,MAAMI,cAAc,GAAGA,CAACC,aAAwB,EAAEC,kBAA2B,KAAI;AAC/Ed,IAAAA,QAAQ,CAAC;MAAEe,SAAS,EAAE,CAACD,kBAAkB;AAAED,MAAAA,aAAAA;AAAe,KAAA,CAAC,CAAA;GAC5D,CAAA;AAED,EAAA,oBACEG,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CAAA;KAEL,CAAA;AAAC,GACC,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"Chips.js","sources":["../../src/chips/Chips.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { useIntl } from 'react-intl';\n\nimport { CommonProps, AriaLabelProperty } from '../common';\n\nimport Chip from './Chip';\nimport messages from './Chips.messages';\n\nexport type ChipValue = string | number;\n\nexport type Chip = {\n value: ChipValue;\n label: string;\n};\n\nexport type ChipsProps = CommonProps &\n AriaLabelProperty & {\n /** List of chips with string labels and string/number values */\n chips: readonly Chip[];\n /** Callback which is invoked when a chip is selected or deselected */\n onChange: ({\n isEnabled,\n selectedValue,\n }: {\n isEnabled: boolean;\n selectedValue: ChipValue;\n }) => void;\n /** Used to manage which chips are selected */\n selected: ChipValue | readonly ChipValue[];\n /** Used to activate multi-selection */\n multiple?: boolean;\n };\n\nconst Chips = ({\n chips,\n onChange,\n selected,\n 'aria-label': ariaLabel,\n className,\n multiple,\n}: ChipsProps) => {\n const intl = useIntl();\n\n const isSelected = (value: ChipValue) =>\n Array.isArray(selected) ? selected.includes(value) : selected === value;\n\n const handleOnChange = (selectedValue: ChipValue, isCurrentlyEnabled: boolean) => {\n onChange({ isEnabled: !isCurrentlyEnabled, selectedValue });\n };\n\n return (\n <div\n className={classNames('np-chips d-flex', className)}\n aria-label={ariaLabel}\n role={!multiple ? 'radiogroup' : undefined}\n >\n {chips.map((chip) => {\n const chipSelected = isSelected(chip.value);\n return (\n <Chip\n key={chip.value}\n value={chip.value}\n label={chip.label}\n closeButton={{\n 'aria-label': intl.formatMessage(messages.ariaLabel, { choice: chip.label }),\n }}\n className={classNames('text-xs-nowrap', {\n 'np-chip--selected': chipSelected,\n 'p-r-1': multiple && chipSelected,\n })}\n {...(multiple && chipSelected\n ? {\n onRemove: () => handleOnChange(chip.value, chipSelected),\n 'aria-label': chip.label,\n }\n : {\n onClick: () => handleOnChange(chip.value, chipSelected),\n onKeyPress: () => handleOnChange(chip.value, chipSelected),\n role: !multiple ? 'radio' : undefined,\n 'aria-checked': chipSelected,\n })}\n />\n );\n })}\n </div>\n );\n};\n\nexport default Chips;\n"],"names":["Chips","chips","onChange","selected","ariaLabel","className","multiple","intl","useIntl","isSelected","value","Array","isArray","includes","handleOnChange","selectedValue","isCurrentlyEnabled","isEnabled","_jsx","classNames","role","undefined","children","map","chip","chipSelected","Chip","label","closeButton","formatMessage","messages","choice","onRemove","onClick","onKeyPress"],"mappings":";;;;;;;;;;;;AAiCMA,MAAAA,KAAK,GAAGA,CAAC;EACbC,KAAK;EACLC,QAAQ;EACRC,QAAQ;AACR,EAAA,YAAY,EAAEC,SAAS;EACvBC,SAAS;AACTC,EAAAA,QAAAA;AAAQ,CACG,KAAI;AACf,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE,CAAA;EAEtB,MAAMC,UAAU,GAAIC,KAAgB,IAClCC,KAAK,CAACC,OAAO,CAACT,QAAQ,CAAC,GAAGA,QAAQ,CAACU,QAAQ,CAACH,KAAK,CAAC,GAAGP,QAAQ,KAAKO,KAAK,CAAA;AAEzE,EAAA,MAAMI,cAAc,GAAGA,CAACC,aAAwB,EAAEC,kBAA2B,KAAI;AAC/Ed,IAAAA,QAAQ,CAAC;MAAEe,SAAS,EAAE,CAACD,kBAAkB;AAAED,MAAAA,aAAAA;AAAe,KAAA,CAAC,CAAA;GAC5D,CAAA;AAED,EAAA,oBACEG,cAAA,CAAA,KAAA,EAAA;AACEb,IAAAA,SAAS,EAAEc,2BAAU,CAAC,iBAAiB,EAAEd,SAAS,CAAE;AACpD,IAAA,YAAA,EAAYD,SAAU;AACtBgB,IAAAA,IAAI,EAAE,CAACd,QAAQ,GAAG,YAAY,GAAGe,SAAU;AAAAC,IAAAA,QAAA,EAE1CrB,KAAK,CAACsB,GAAG,CAAEC,IAAI,IAAI;AAClB,MAAA,MAAMC,YAAY,GAAGhB,UAAU,CAACe,IAAI,CAACd,KAAK,CAAC,CAAA;MAC3C,oBACEQ,cAAA,CAACQ,IAAI,EAAA;QAEHhB,KAAK,EAAEc,IAAI,CAACd,KAAM;QAClBiB,KAAK,EAAEH,IAAI,CAACG,KAAM;AAClBC,QAAAA,WAAW,EAAE;UACX,YAAY,EAAErB,IAAI,CAACsB,aAAa,CAACC,cAAQ,CAAC1B,SAAS,EAAE;YAAE2B,MAAM,EAAEP,IAAI,CAACG,KAAAA;WAAO,CAAA;SAC3E;AACFtB,QAAAA,SAAS,EAAEc,2BAAU,CAAC,gBAAgB,EAAE;AACtC,UAAA,mBAAmB,EAAEM,YAAY;UACjC,OAAO,EAAEnB,QAAQ,IAAImB,YAAAA;AACtB,SAAA,CAAE;QAAA,IACEnB,QAAQ,IAAImB,YAAY,GACzB;UACEO,QAAQ,EAAEA,MAAMlB,cAAc,CAACU,IAAI,CAACd,KAAK,EAAEe,YAAY,CAAC;UACxD,YAAY,EAAED,IAAI,CAACG,KAAAA;AACpB,SAAA,GACD;UACEM,OAAO,EAAEA,MAAMnB,cAAc,CAACU,IAAI,CAACd,KAAK,EAAEe,YAAY,CAAC;UACvDS,UAAU,EAAEA,MAAMpB,cAAc,CAACU,IAAI,CAACd,KAAK,EAAEe,YAAY,CAAC;AAC1DL,UAAAA,IAAI,EAAE,CAACd,QAAQ,GAAG,OAAO,GAAGe,SAAS;AACrC,UAAA,cAAc,EAAEI,YAAAA;SACjB,CAAA;OApBAD,EAAAA,IAAI,CAACd,KAqBV,CAAA,CAAA;KAEL,CAAA;AAAC,GACC,CAAC,CAAA;AAEV;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Chips.mjs","sources":["../../src/chips/Chips.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { useIntl } from 'react-intl';\n\nimport { CommonProps, AriaLabelProperty } from '../common';\n\nimport Chip from './Chip';\nimport messages from './Chips.messages';\n\nexport type ChipValue = string | number;\n\nexport type Chip = {\n value: ChipValue;\n label: string;\n};\n\nexport type ChipsProps = CommonProps &\n AriaLabelProperty & {\n /** List of chips with string labels and string/number values */\n chips: readonly Chip[];\n /** Callback which is invoked when a chip is selected or deselected */\n onChange: ({\n isEnabled,\n selectedValue,\n }: {\n isEnabled: boolean;\n selectedValue: ChipValue;\n }) => void;\n /** Used to manage which chips are selected */\n selected: ChipValue | readonly ChipValue[];\n /** Used to activate multi-selection */\n multiple?: boolean;\n };\n\nconst Chips = ({\n chips,\n onChange,\n selected,\n 'aria-label': ariaLabel,\n className,\n multiple,\n}: ChipsProps) => {\n const intl = useIntl();\n\n const isSelected = (value: ChipValue) =>\n Array.isArray(selected) ? selected.includes(value) : selected === value;\n\n const handleOnChange = (selectedValue: ChipValue, isCurrentlyEnabled: boolean) => {\n onChange({ isEnabled: !isCurrentlyEnabled, selectedValue });\n };\n\n return (\n <div\n className={classNames('np-chips d-flex', className)}\n aria-label={ariaLabel}\n role={!multiple ? 'radiogroup' : undefined}\n >\n {chips.map((chip) => {\n const chipSelected = isSelected(chip.value);\n return (\n <Chip\n key={chip.value}\n value={chip.value}\n label={chip.label}\n closeButton={{\n 'aria-label': intl.formatMessage(messages.ariaLabel, { choice: chip.label }),\n }}\n className={classNames('text-xs-nowrap', {\n 'np-chip--selected': chipSelected,\n 'p-r-1': multiple && chipSelected,\n })}\n {...(multiple && chipSelected\n ? {\n onRemove: () => handleOnChange(chip.value, chipSelected),\n 'aria-label': chip.label,\n }\n : {\n onClick: () => handleOnChange(chip.value, chipSelected),\n onKeyPress: () => handleOnChange(chip.value, chipSelected),\n role: !multiple ? 'radio' : undefined,\n 'aria-checked': chipSelected,\n })}\n />\n );\n })}\n </div>\n );\n};\n\nexport default Chips;\n"],"names":["Chips","chips","onChange","selected","ariaLabel","className","multiple","intl","useIntl","isSelected","value","Array","isArray","includes","handleOnChange","selectedValue","isCurrentlyEnabled","isEnabled","_jsx","classNames","role","undefined","children","map","chip","chipSelected","Chip","label","closeButton","formatMessage","messages","choice","onRemove","onClick","onKeyPress"],"mappings":";;;;;;AAiCMA,MAAAA,KAAK,GAAGA,CAAC;EACbC,KAAK;EACLC,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EnB,QAAQ,IAAImB,YAAAA;AACtB,SAAA,CAAE;QAAA,IACEnB,QAAQ,IAAImB,YAAY,GACzB;UACEO,QAAQ,EAAEA,MAAMlB,cAAc,CAACU,IAAI,CAACd,KAAK,EAAEe,YAAY,CAAC;UACxD,YAAY,EAAED,IAAI,CAACG,KAAAA;AACpB,SAAA,GACD;UACEM,OAAO,EAAEA,MAAMnB,cAAc,CAACU,IAAI,CAACd,KAAK,EAAEe,YAAY,CAAC;UACvDS,UAAU,EAAEA,MAAMpB,cAAc,CAACU,IAAI,CAACd,KAAK,EAAEe,YAAY,CAAC;AAC1DL,UAAAA,IAAI,EAAE,CAACd,QAAQ,GAAG,OAAO,GAAGe,SAAS;AACrC,UAAA,cAAc,EAAEI,YAAAA;SACjB;OApBAD,EAAAA,IAAI,CAACd,KAqBV,CAAA,CAAA;KAEL,CAAA;AAAC,GACC,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"Chips.mjs","sources":["../../src/chips/Chips.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { useIntl } from 'react-intl';\n\nimport { CommonProps, AriaLabelProperty } from '../common';\n\nimport Chip from './Chip';\nimport messages from './Chips.messages';\n\nexport type ChipValue = string | number;\n\nexport type Chip = {\n value: ChipValue;\n label: string;\n};\n\nexport type ChipsProps = CommonProps &\n AriaLabelProperty & {\n /** List of chips with string labels and string/number values */\n chips: readonly Chip[];\n /** Callback which is invoked when a chip is selected or deselected */\n onChange: ({\n isEnabled,\n selectedValue,\n }: {\n isEnabled: boolean;\n selectedValue: ChipValue;\n }) => void;\n /** Used to manage which chips are selected */\n selected: ChipValue | readonly ChipValue[];\n /** Used to activate multi-selection */\n multiple?: boolean;\n };\n\nconst Chips = ({\n chips,\n onChange,\n selected,\n 'aria-label': ariaLabel,\n className,\n multiple,\n}: ChipsProps) => {\n const intl = useIntl();\n\n const isSelected = (value: ChipValue) =>\n Array.isArray(selected) ? selected.includes(value) : selected === value;\n\n const handleOnChange = (selectedValue: ChipValue, isCurrentlyEnabled: boolean) => {\n onChange({ isEnabled: !isCurrentlyEnabled, selectedValue });\n };\n\n return (\n <div\n className={classNames('np-chips d-flex', className)}\n aria-label={ariaLabel}\n role={!multiple ? 'radiogroup' : undefined}\n >\n {chips.map((chip) => {\n const chipSelected = isSelected(chip.value);\n return (\n <Chip\n key={chip.value}\n value={chip.value}\n label={chip.label}\n closeButton={{\n 'aria-label': intl.formatMessage(messages.ariaLabel, { choice: chip.label }),\n }}\n className={classNames('text-xs-nowrap', {\n 'np-chip--selected': chipSelected,\n 'p-r-1': multiple && chipSelected,\n })}\n {...(multiple && chipSelected\n ? {\n onRemove: () => handleOnChange(chip.value, chipSelected),\n 'aria-label': chip.label,\n }\n : {\n onClick: () => handleOnChange(chip.value, chipSelected),\n onKeyPress: () => handleOnChange(chip.value, chipSelected),\n role: !multiple ? 'radio' : undefined,\n 'aria-checked': chipSelected,\n })}\n />\n );\n })}\n </div>\n );\n};\n\nexport default Chips;\n"],"names":["Chips","chips","onChange","selected","ariaLabel","className","multiple","intl","useIntl","isSelected","value","Array","isArray","includes","handleOnChange","selectedValue","isCurrentlyEnabled","isEnabled","_jsx","classNames","role","undefined","children","map","chip","chipSelected","Chip","label","closeButton","formatMessage","messages","choice","onRemove","onClick","onKeyPress"],"mappings":";;;;;;AAiCMA,MAAAA,KAAK,GAAGA,CAAC;EACbC,KAAK;EACLC,QAAQ;EACRC,QAAQ;AACR,EAAA,YAAY,EAAEC,SAAS;EACvBC,SAAS;AACTC,EAAAA,QAAAA;AAAQ,CACG,KAAI;AACf,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE,CAAA;EAEtB,MAAMC,UAAU,GAAIC,KAAgB,IAClCC,KAAK,CAACC,OAAO,CAACT,QAAQ,CAAC,GAAGA,QAAQ,CAACU,QAAQ,CAACH,KAAK,CAAC,GAAGP,QAAQ,KAAKO,KAAK,CAAA;AAEzE,EAAA,MAAMI,cAAc,GAAGA,CAACC,aAAwB,EAAEC,kBAA2B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AAC1DL,UAAAA,IAAI,EAAE,CAACd,QAAQ,GAAG,OAAO,GAAGe,SAAS;AACrC,UAAA,cAAc,EAAEI,YAAAA;SACjB,CAAA;OApBAD,EAAAA,IAAI,CAACd,KAqBV,CAAA,CAAA;KAEL,CAAA;AAAC,GACC,CAAC,CAAA;AAEV;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.js","sources":["../../../src/common/bottomSheet/BottomSheet.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { useRef, useState, PropsWithChildren, CSSProperties, SyntheticEvent } from 'react';\n\nimport Dimmer from '../../dimmer';\nimport Drawer from '../../drawer';\nimport SlidingPanel from '../../slidingPanel';\nimport { CloseButton } from '../closeButton';\nimport { CommonProps } from '../commonProps';\nimport { isServerSide } from '../domHelpers';\nimport { useConditionalListener } from '../hooks';\nimport { useMedia } from '../hooks/useMedia';\nimport { Breakpoint } from '../propsValues/breakpoint';\nimport { Position } from '../propsValues/position';\n\nconst INITIAL_Y_POSITION = 0;\n\nconst CONTENT_SCROLL_THRESHOLD = 1;\n\nconst MOVE_OFFSET_THRESHOLD = 50;\n\nexport type BottomSheetProps = PropsWithChildren<\n {\n onClose?: (event: Event | SyntheticEvent) => void;\n open: boolean;\n } & CommonProps\n>;\n\n/**\n * Neptune: https://transferwise.github.io/neptune/components/bottom-sheet/\n *\n * Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet\n *\n */\nconst BottomSheet = (props: BottomSheetProps) => {\n const bottomSheetReference = useRef<HTMLDivElement>(null);\n const topBarReference = useRef<HTMLDivElement>(null);\n const contentReference = useRef<HTMLDivElement>(null);\n\n const [pressed, setPressed] = useState<boolean>(false);\n\n /**\n * Used to track `requestAnimationFrame` requests\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame#return_value\n */\n const animationId = useRef<number>(0);\n\n /**\n * Difference between initial coordinate ({@link initialYCoordinate})\n * and new position (when user moves component), it's get calculated on `onTouchMove` and `onMouseMove` events\n *\n * @see {@link calculateOffsetAfterMove}\n */\n const moveOffset = useRef<number>(0);\n const initialYCoordinate = useRef<number>(0);\n\n // apply shadow to the bottom of top-bar when scroll over content\n useConditionalListener({\n attachListener: props.open && !isServerSide(),\n callback: () => {\n if (topBarReference.current !== null) {\n const { classList } = topBarReference.current;\n if (!isContentScrollPositionAtTop()) {\n classList.add('np-bottom-sheet--top-bar--shadow');\n } else {\n classList.remove('np-bottom-sheet--top-bar--shadow');\n }\n }\n },\n eventType: 'scroll',\n parent: isServerSide() ? undefined : document,\n });\n\n function move(newHeight: number): void {\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.transform = `translateY(${newHeight}px)`;\n }\n }\n\n function close(event: Event | SyntheticEvent): void {\n setPressed(false);\n moveOffset.current = INITIAL_Y_POSITION;\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.removeProperty('transform');\n }\n if (props.onClose) {\n props.onClose(event);\n }\n }\n\n const onSwipeStart = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n initialYCoordinate.current = ('touches' in event ? event.touches[0] : event).clientY;\n setPressed(true);\n };\n\n const onSwipeMove = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n if (pressed) {\n const { clientY } = 'touches' in event ? event.touches[0] : event;\n\n const offset = calculateOffsetAfterMove(clientY);\n // check whether move is to the bottom only and content scroll position is at the top\n if (offset > INITIAL_Y_POSITION && isContentScrollPositionAtTop()) {\n moveOffset.current = offset;\n animationId.current = requestAnimationFrame(() => {\n if (animationId.current !== undefined && bottomSheetReference.current !== null) {\n move(offset);\n }\n });\n }\n }\n };\n\n function onSwipeEnd(\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void {\n // stop moving component\n cancelAnimationFrame(animationId.current);\n setPressed(false);\n // check whether move down is strong enough\n // and content scroll position is at the top to close the component\n if (moveOffset.current > MOVE_OFFSET_THRESHOLD && isContentScrollPositionAtTop()) {\n close(event);\n }\n // otherwise move component back to default (initial) position\n else {\n move(INITIAL_Y_POSITION);\n }\n moveOffset.current = INITIAL_Y_POSITION;\n }\n\n function isContentScrollPositionAtTop(): boolean {\n return (\n contentReference?.current?.scrollTop !== undefined &&\n contentReference.current.scrollTop <= CONTENT_SCROLL_THRESHOLD\n );\n }\n\n /**\n * Calculates how hard user moves component,\n * result value used to determine whether to hide component or re-position to default state\n *\n * @param afterMoveYCoordinate\n */\n function calculateOffsetAfterMove(afterMoveYCoordinate: number): number {\n return afterMoveYCoordinate - initialYCoordinate.current;\n }\n\n /**\n * Set `max-height` for content part (in order to keep it scrollable for content overflow cases) of the component\n * and ensures space for safe zone (32px) at the top.\n */\n function setContentMaxHeight(): CSSProperties {\n const safeZoneHeight = '64px';\n const topbarHeight = '32px';\n const windowHight: number = isServerSide() ? 0 : window.innerHeight;\n /**\n * Calculate _real_ height of the screen (taking into account parts of browser interface).\n *\n * See https://css-tricks.com/the-trick-to-viewport-units-on-mobile for more details.\n */\n const screenHeight = `${windowHight * 0.01 * 100}px`;\n return {\n maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`,\n };\n }\n\n const is400Zoom = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n\n return is400Zoom ? (\n <Drawer open={props.open} className={props.className} onClose={close}>\n {props.children}\n </Drawer>\n ) : (\n <Dimmer open={props.open} fadeContentOnEnter fadeContentOnExit onClose={close}>\n <SlidingPanel\n ref={bottomSheetReference}\n open={props.open}\n position={Position.BOTTOM}\n className={classNames('np-bottom-sheet', props.className)}\n >\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}\n <div\n role=\"dialog\"\n aria-modal\n onTouchStart={onSwipeStart}\n onTouchMove={onSwipeMove}\n onTouchEnd={onSwipeEnd}\n onMouseDown={onSwipeStart}\n onMouseMove={onSwipeMove}\n onMouseUp={onSwipeEnd}\n >\n <div ref={topBarReference} className=\"np-bottom-sheet--top-bar\">\n <div className=\"np-bottom-sheet--handler\" />\n <CloseButton size=\"sm\" className=\"sr-only np-bottom-sheet--close-btn\" onClick={close} />\n </div>\n <div\n ref={contentReference}\n style={setContentMaxHeight()}\n className=\"np-bottom-sheet--content\"\n >\n {props.children}\n </div>\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n};\n\nexport default BottomSheet;\n"],"names":["INITIAL_Y_POSITION","CONTENT_SCROLL_THRESHOLD","MOVE_OFFSET_THRESHOLD","BottomSheet","props","bottomSheetReference","useRef","topBarReference","contentReference","pressed","setPressed","useState","animationId","moveOffset","initialYCoordinate","useConditionalListener","attachListener","open","isServerSide","callback","current","classList","isContentScrollPositionAtTop","add","remove","eventType","parent","undefined","document","move","newHeight","style","transform","close","event","removeProperty","onClose","onSwipeStart","touches","clientY","onSwipeMove","offset","calculateOffsetAfterMove","requestAnimationFrame","onSwipeEnd","cancelAnimationFrame","scrollTop","afterMoveYCoordinate","setContentMaxHeight","safeZoneHeight","topbarHeight","windowHight","window","innerHeight","screenHeight","maxHeight","is400Zoom","useMedia","Breakpoint","ZOOM_400","_jsx","Drawer","className","children","Dimmer","fadeContentOnEnter","fadeContentOnExit","SlidingPanel","ref","position","Position","BOTTOM","classNames","_jsxs","role","onTouchStart","onTouchMove","onTouchEnd","onMouseDown","onMouseMove","onMouseUp","CloseButton","size","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;AAcA,MAAMA,kBAAkB,GAAG,CAAC,CAAA;AAE5B,MAAMC,wBAAwB,GAAG,CAAC,CAAA;AAElC,MAAMC,qBAAqB,GAAG,EAAE,CAAA;AAShC;;;;;AAKG;AACGC,MAAAA,WAAW,GAAIC,KAAuB,IAAI;AAC9C,EAAA,MAAMC,oBAAoB,GAAGC,YAAM,CAAiB,IAAI,CAAC,CAAA;AACzD,EAAA,MAAMC,eAAe,GAAGD,YAAM,CAAiB,IAAI,CAAC,CAAA;AACpD,EAAA,MAAME,gBAAgB,GAAGF,YAAM,CA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A;AAACC,YAAAA,IAAI,EAAC,IAAI;AAACpB,YAAAA,SAAS,EAAC,oCAAoC;AAACqB,YAAAA,OAAO,EAAElD,KAAAA;AAAM,WACvF,CAAA,CAAA;SAAK,CACL,eAAA2B,cAAA,CAAA,KAAA,EAAA;AACEQ,UAAAA,GAAG,EAAE5D,gBAAiB;UACtBuB,KAAK,EAAEiB,mBAAmB,EAAG;AAC7Bc,UAAAA,SAAS,EAAC,0BAA0B;UAAAC,QAAA,EAEnC3D,KAAK,CAAC2D,QAAAA;AAAQ,SACZ,CACP,CAAA;OAAK,CAAA;KACO,CAAA;AAChB,GAAQ,CACT,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"BottomSheet.js","sources":["../../../src/common/bottomSheet/BottomSheet.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { useRef, useState, PropsWithChildren, CSSProperties, SyntheticEvent } from 'react';\n\nimport Dimmer from '../../dimmer';\nimport Drawer from '../../drawer';\nimport SlidingPanel from '../../slidingPanel';\nimport { CloseButton } from '../closeButton';\nimport { CommonProps } from '../commonProps';\nimport { isServerSide } from '../domHelpers';\nimport { useConditionalListener } from '../hooks';\nimport { useMedia } from '../hooks/useMedia';\nimport { Breakpoint } from '../propsValues/breakpoint';\nimport { Position } from '../propsValues/position';\n\nconst INITIAL_Y_POSITION = 0;\n\nconst CONTENT_SCROLL_THRESHOLD = 1;\n\nconst MOVE_OFFSET_THRESHOLD = 50;\n\nexport type BottomSheetProps = PropsWithChildren<\n {\n onClose?: (event: Event | SyntheticEvent) => void;\n open: boolean;\n } & CommonProps\n>;\n\n/**\n * Neptune: https://transferwise.github.io/neptune/components/bottom-sheet/\n *\n * Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet\n *\n */\nconst BottomSheet = (props: BottomSheetProps) => {\n const bottomSheetReference = useRef<HTMLDivElement>(null);\n const topBarReference = useRef<HTMLDivElement>(null);\n const contentReference = useRef<HTMLDivElement>(null);\n\n const [pressed, setPressed] = useState<boolean>(false);\n\n /**\n * Used to track `requestAnimationFrame` requests\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame#return_value\n */\n const animationId = useRef<number>(0);\n\n /**\n * Difference between initial coordinate ({@link initialYCoordinate})\n * and new position (when user moves component), it's get calculated on `onTouchMove` and `onMouseMove` events\n *\n * @see {@link calculateOffsetAfterMove}\n */\n const moveOffset = useRef<number>(0);\n const initialYCoordinate = useRef<number>(0);\n\n // apply shadow to the bottom of top-bar when scroll over content\n useConditionalListener({\n attachListener: props.open && !isServerSide(),\n callback: () => {\n if (topBarReference.current !== null) {\n const { classList } = topBarReference.current;\n if (!isContentScrollPositionAtTop()) {\n classList.add('np-bottom-sheet--top-bar--shadow');\n } else {\n classList.remove('np-bottom-sheet--top-bar--shadow');\n }\n }\n },\n eventType: 'scroll',\n parent: isServerSide() ? undefined : document,\n });\n\n function move(newHeight: number): void {\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.transform = `translateY(${newHeight}px)`;\n }\n }\n\n function close(event: Event | SyntheticEvent): void {\n setPressed(false);\n moveOffset.current = INITIAL_Y_POSITION;\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.removeProperty('transform');\n }\n if (props.onClose) {\n props.onClose(event);\n }\n }\n\n const onSwipeStart = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n initialYCoordinate.current = ('touches' in event ? event.touches[0] : event).clientY;\n setPressed(true);\n };\n\n const onSwipeMove = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n if (pressed) {\n const { clientY } = 'touches' in event ? event.touches[0] : event;\n\n const offset = calculateOffsetAfterMove(clientY);\n // check whether move is to the bottom only and content scroll position is at the top\n if (offset > INITIAL_Y_POSITION && isContentScrollPositionAtTop()) {\n moveOffset.current = offset;\n animationId.current = requestAnimationFrame(() => {\n if (animationId.current !== undefined && bottomSheetReference.current !== null) {\n move(offset);\n }\n });\n }\n }\n };\n\n function onSwipeEnd(\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void {\n // stop moving component\n cancelAnimationFrame(animationId.current);\n setPressed(false);\n // check whether move down is strong enough\n // and content scroll position is at the top to close the component\n if (moveOffset.current > MOVE_OFFSET_THRESHOLD && isContentScrollPositionAtTop()) {\n close(event);\n }\n // otherwise move component back to default (initial) position\n else {\n move(INITIAL_Y_POSITION);\n }\n moveOffset.current = INITIAL_Y_POSITION;\n }\n\n function isContentScrollPositionAtTop(): boolean {\n return (\n contentReference?.current?.scrollTop !== undefined &&\n contentReference.current.scrollTop <= CONTENT_SCROLL_THRESHOLD\n );\n }\n\n /**\n * Calculates how hard user moves component,\n * result value used to determine whether to hide component or re-position to default state\n *\n * @param afterMoveYCoordinate\n */\n function calculateOffsetAfterMove(afterMoveYCoordinate: number): number {\n return afterMoveYCoordinate - initialYCoordinate.current;\n }\n\n /**\n * Set `max-height` for content part (in order to keep it scrollable for content overflow cases) of the component\n * and ensures space for safe zone (32px) at the top.\n */\n function setContentMaxHeight(): CSSProperties {\n const safeZoneHeight = '64px';\n const topbarHeight = '32px';\n const windowHight: number = isServerSide() ? 0 : window.innerHeight;\n /**\n * Calculate _real_ height of the screen (taking into account parts of browser interface).\n *\n * See https://css-tricks.com/the-trick-to-viewport-units-on-mobile for more details.\n */\n const screenHeight = `${windowHight * 0.01 * 100}px`;\n return {\n maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`,\n };\n }\n\n const is400Zoom = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n\n return is400Zoom ? (\n <Drawer open={props.open} className={props.className} onClose={close}>\n {props.children}\n </Drawer>\n ) : (\n <Dimmer open={props.open} fadeContentOnEnter fadeContentOnExit onClose={close}>\n <SlidingPanel\n ref={bottomSheetReference}\n open={props.open}\n position={Position.BOTTOM}\n className={classNames('np-bottom-sheet', props.className)}\n >\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}\n <div\n role=\"dialog\"\n aria-modal\n onTouchStart={onSwipeStart}\n onTouchMove={onSwipeMove}\n onTouchEnd={onSwipeEnd}\n onMouseDown={onSwipeStart}\n onMouseMove={onSwipeMove}\n onMouseUp={onSwipeEnd}\n >\n <div ref={topBarReference} className=\"np-bottom-sheet--top-bar\">\n <div className=\"np-bottom-sheet--handler\" />\n <CloseButton size=\"sm\" className=\"sr-only np-bottom-sheet--close-btn\" onClick={close} />\n </div>\n <div\n ref={contentReference}\n style={setContentMaxHeight()}\n className=\"np-bottom-sheet--content\"\n >\n {props.children}\n </div>\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n};\n\nexport default BottomSheet;\n"],"names":["INITIAL_Y_POSITION","CONTENT_SCROLL_THRESHOLD","MOVE_OFFSET_THRESHOLD","BottomSheet","props","bottomSheetReference","useRef","topBarReference","contentReference","pressed","setPressed","useState","animationId","moveOffset","initialYCoordinate","useConditionalListener","attachListener","open","isServerSide","callback","current","classList","isContentScrollPositionAtTop","add","remove","eventType","parent","undefined","document","move","newHeight","style","transform","close","event","removeProperty","onClose","onSwipeStart","touches","clientY","onSwipeMove","offset","calculateOffsetAfterMove","requestAnimationFrame","onSwipeEnd","cancelAnimationFrame","scrollTop","afterMoveYCoordinate","setContentMaxHeight","safeZoneHeight","topbarHeight","windowHight","window","innerHeight","screenHeight","maxHeight","is400Zoom","useMedia","Breakpoint","ZOOM_400","_jsx","Drawer","className","children","Dimmer","fadeContentOnEnter","fadeContentOnExit","SlidingPanel","ref","position","Position","BOTTOM","classNames","_jsxs","role","onTouchStart","onTouchMove","onTouchEnd","onMouseDown","onMouseMove","onMouseUp","CloseButton","size","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;AAcA,MAAMA,kBAAkB,GAAG,CAAC,CAAA;AAE5B,MAAMC,wBAAwB,GAAG,CAAC,CAAA;AAElC,MAAMC,qBAAqB,GAAG,EAAE,CAAA;AAShC;;;;;AAKG;AACGC,MAAAA,WAAW,G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A,GAAG,EAAE7D,eAAgB;AAACuD,UAAAA,SAAS,EAAC,0BAA0B;AAAAC,UAAAA,QAAA,gBAC7DH,cAAA,CAAA,KAAA,EAAA;AAAKE,YAAAA,SAAS,EAAC,0BAAA;AAA0B,WACzC,CAAA,eAAAF,cAAA,CAACqB,uBAAW,EAAA;AAACC,YAAAA,IAAI,EAAC,IAAI;AAACpB,YAAAA,SAAS,EAAC,oCAAoC;AAACqB,YAAAA,OAAO,EAAElD,KAAAA;AAAM,WACvF,CAAA,CAAA;SAAK,CACL,eAAA2B,cAAA,CAAA,KAAA,EAAA;AACEQ,UAAAA,GAAG,EAAE5D,gBAAiB;UACtBuB,KAAK,EAAEiB,mBAAmB,EAAG;AAC7Bc,UAAAA,SAAS,EAAC,0BAA0B;UAAAC,QAAA,EAEnC3D,KAAK,CAAC2D,QAAAA;AAAQ,SACZ,CACP,CAAA;OAAK,CAAA;KACO,CAAA;AAChB,GAAQ,CACT,CAAA;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.mjs","sources":["../../../src/common/bottomSheet/BottomSheet.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { useRef, useState, PropsWithChildren, CSSProperties, SyntheticEvent } from 'react';\n\nimport Dimmer from '../../dimmer';\nimport Drawer from '../../drawer';\nimport SlidingPanel from '../../slidingPanel';\nimport { CloseButton } from '../closeButton';\nimport { CommonProps } from '../commonProps';\nimport { isServerSide } from '../domHelpers';\nimport { useConditionalListener } from '../hooks';\nimport { useMedia } from '../hooks/useMedia';\nimport { Breakpoint } from '../propsValues/breakpoint';\nimport { Position } from '../propsValues/position';\n\nconst INITIAL_Y_POSITION = 0;\n\nconst CONTENT_SCROLL_THRESHOLD = 1;\n\nconst MOVE_OFFSET_THRESHOLD = 50;\n\nexport type BottomSheetProps = PropsWithChildren<\n {\n onClose?: (event: Event | SyntheticEvent) => void;\n open: boolean;\n } & CommonProps\n>;\n\n/**\n * Neptune: https://transferwise.github.io/neptune/components/bottom-sheet/\n *\n * Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet\n *\n */\nconst BottomSheet = (props: BottomSheetProps) => {\n const bottomSheetReference = useRef<HTMLDivElement>(null);\n const topBarReference = useRef<HTMLDivElement>(null);\n const contentReference = useRef<HTMLDivElement>(null);\n\n const [pressed, setPressed] = useState<boolean>(false);\n\n /**\n * Used to track `requestAnimationFrame` requests\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame#return_value\n */\n const animationId = useRef<number>(0);\n\n /**\n * Difference between initial coordinate ({@link initialYCoordinate})\n * and new position (when user moves component), it's get calculated on `onTouchMove` and `onMouseMove` events\n *\n * @see {@link calculateOffsetAfterMove}\n */\n const moveOffset = useRef<number>(0);\n const initialYCoordinate = useRef<number>(0);\n\n // apply shadow to the bottom of top-bar when scroll over content\n useConditionalListener({\n attachListener: props.open && !isServerSide(),\n callback: () => {\n if (topBarReference.current !== null) {\n const { classList } = topBarReference.current;\n if (!isContentScrollPositionAtTop()) {\n classList.add('np-bottom-sheet--top-bar--shadow');\n } else {\n classList.remove('np-bottom-sheet--top-bar--shadow');\n }\n }\n },\n eventType: 'scroll',\n parent: isServerSide() ? undefined : document,\n });\n\n function move(newHeight: number): void {\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.transform = `translateY(${newHeight}px)`;\n }\n }\n\n function close(event: Event | SyntheticEvent): void {\n setPressed(false);\n moveOffset.current = INITIAL_Y_POSITION;\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.removeProperty('transform');\n }\n if (props.onClose) {\n props.onClose(event);\n }\n }\n\n const onSwipeStart = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n initialYCoordinate.current = ('touches' in event ? event.touches[0] : event).clientY;\n setPressed(true);\n };\n\n const onSwipeMove = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n if (pressed) {\n const { clientY } = 'touches' in event ? event.touches[0] : event;\n\n const offset = calculateOffsetAfterMove(clientY);\n // check whether move is to the bottom only and content scroll position is at the top\n if (offset > INITIAL_Y_POSITION && isContentScrollPositionAtTop()) {\n moveOffset.current = offset;\n animationId.current = requestAnimationFrame(() => {\n if (animationId.current !== undefined && bottomSheetReference.current !== null) {\n move(offset);\n }\n });\n }\n }\n };\n\n function onSwipeEnd(\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void {\n // stop moving component\n cancelAnimationFrame(animationId.current);\n setPressed(false);\n // check whether move down is strong enough\n // and content scroll position is at the top to close the component\n if (moveOffset.current > MOVE_OFFSET_THRESHOLD && isContentScrollPositionAtTop()) {\n close(event);\n }\n // otherwise move component back to default (initial) position\n else {\n move(INITIAL_Y_POSITION);\n }\n moveOffset.current = INITIAL_Y_POSITION;\n }\n\n function isContentScrollPositionAtTop(): boolean {\n return (\n contentReference?.current?.scrollTop !== undefined &&\n contentReference.current.scrollTop <= CONTENT_SCROLL_THRESHOLD\n );\n }\n\n /**\n * Calculates how hard user moves component,\n * result value used to determine whether to hide component or re-position to default state\n *\n * @param afterMoveYCoordinate\n */\n function calculateOffsetAfterMove(afterMoveYCoordinate: number): number {\n return afterMoveYCoordinate - initialYCoordinate.current;\n }\n\n /**\n * Set `max-height` for content part (in order to keep it scrollable for content overflow cases) of the component\n * and ensures space for safe zone (32px) at the top.\n */\n function setContentMaxHeight(): CSSProperties {\n const safeZoneHeight = '64px';\n const topbarHeight = '32px';\n const windowHight: number = isServerSide() ? 0 : window.innerHeight;\n /**\n * Calculate _real_ height of the screen (taking into account parts of browser interface).\n *\n * See https://css-tricks.com/the-trick-to-viewport-units-on-mobile for more details.\n */\n const screenHeight = `${windowHight * 0.01 * 100}px`;\n return {\n maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`,\n };\n }\n\n const is400Zoom = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n\n return is400Zoom ? (\n <Drawer open={props.open} className={props.className} onClose={close}>\n {props.children}\n </Drawer>\n ) : (\n <Dimmer open={props.open} fadeContentOnEnter fadeContentOnExit onClose={close}>\n <SlidingPanel\n ref={bottomSheetReference}\n open={props.open}\n position={Position.BOTTOM}\n className={classNames('np-bottom-sheet', props.className)}\n >\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}\n <div\n role=\"dialog\"\n aria-modal\n onTouchStart={onSwipeStart}\n onTouchMove={onSwipeMove}\n onTouchEnd={onSwipeEnd}\n onMouseDown={onSwipeStart}\n onMouseMove={onSwipeMove}\n onMouseUp={onSwipeEnd}\n >\n <div ref={topBarReference} className=\"np-bottom-sheet--top-bar\">\n <div className=\"np-bottom-sheet--handler\" />\n <CloseButton size=\"sm\" className=\"sr-only np-bottom-sheet--close-btn\" onClick={close} />\n </div>\n <div\n ref={contentReference}\n style={setContentMaxHeight()}\n className=\"np-bottom-sheet--content\"\n >\n {props.children}\n </div>\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n};\n\nexport default BottomSheet;\n"],"names":["INITIAL_Y_POSITION","CONTENT_SCROLL_THRESHOLD","MOVE_OFFSET_THRESHOLD","BottomSheet","props","bottomSheetReference","useRef","topBarReference","contentReference","pressed","setPressed","useState","animationId","moveOffset","initialYCoordinate","useConditionalListener","attachListener","open","isServerSide","callback","current","classList","isContentScrollPositionAtTop","add","remove","eventType","parent","undefined","document","move","newHeight","style","transform","close","event","removeProperty","onClose","onSwipeStart","touches","clientY","onSwipeMove","offset","calculateOffsetAfterMove","requestAnimationFrame","onSwipeEnd","cancelAnimationFrame","scrollTop","afterMoveYCoordinate","setContentMaxHeight","safeZoneHeight","topbarHeight","windowHight","window","innerHeight","screenHeight","maxHeight","is400Zoom","useMedia","Breakpoint","ZOOM_400","_jsx","Drawer","className","children","Dimmer","fadeContentOnEnter","fadeContentOnExit","SlidingPanel","ref","position","Position","BOTTOM","classNames","_jsxs","role","onTouchStart","onTouchMove","onTouchEnd","onMouseDown","onMouseM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EAAEjC,UAAW;AACvBkC,QAAAA,WAAW,EAAEzC,YAAa;AAC1B0C,QAAAA,WAAW,EAAEvC,WAAY;AACzBwC,QAAAA,SAAS,EAAEpC,UAAW;AAAAmB,QAAAA,QAAA,gBAEtBU,IAAA,CAAA,KAAA,EAAA;AAAKL,UAAAA,GAAG,EAAE7D,eAAgB;AAACuD,UAAAA,SAAS,EAAC,0BAA0B;AAAAC,UAAAA,QAAA,gBAC7DH,GAAA,CAAA,KAAA,EAAA;AAAKE,YAAAA,SAAS,EAAC,0BAAA;AAA0B,WACzC,CAAA,eAAAF,GAAA,CAACqB,WAAW,EAAA;AAACC,YAAAA,IAAI,EAAC,IAAI;AAACpB,YAAAA,SAAS,EAAC,oCAAoC;AAACqB,YAAAA,OAAO,EAAElD,KAAAA;AAAM,WACvF,CAAA,CAAA;SAAK,CACL,eAAA2B,GAAA,CAAA,KAAA,EAAA;AACEQ,UAAAA,GAAG,EAAE5D,gBAAiB;UACtBuB,KAAK,EAAEiB,mBAAmB,EAAG;AAC7Bc,UAAAA,SAAS,EAAC,0BAA0B;UAAAC,QAAA,EAEnC3D,KAAK,CAAC2D,QAAAA;AAAQ,SACZ,CACP,CAAA;OAAK,CAAA;KACO,CAAA;AAChB,GAAQ,CACT,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"BottomSheet.mjs","sources":["../../../src/common/bottomSheet/BottomSheet.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { useRef, useState, PropsWithChildren, CSSProperties, SyntheticEvent } from 'react';\n\nimport Dimmer from '../../dimmer';\nimport Drawer from '../../drawer';\nimport SlidingPanel from '../../slidingPanel';\nimport { CloseButton } from '../closeButton';\nimport { CommonProps } from '../commonProps';\nimport { isServerSide } from '../domHelpers';\nimport { useConditionalListener } from '../hooks';\nimport { useMedia } from '../hooks/useMedia';\nimport { Breakpoint } from '../propsValues/breakpoint';\nimport { Position } from '../propsValues/position';\n\nconst INITIAL_Y_POSITION = 0;\n\nconst CONTENT_SCROLL_THRESHOLD = 1;\n\nconst MOVE_OFFSET_THRESHOLD = 50;\n\nexport type BottomSheetProps = PropsWithChildren<\n {\n onClose?: (event: Event | SyntheticEvent) => void;\n open: boolean;\n } & CommonProps\n>;\n\n/**\n * Neptune: https://transferwise.github.io/neptune/components/bottom-sheet/\n *\n * Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet\n *\n */\nconst BottomSheet = (props: BottomSheetProps) => {\n const bottomSheetReference = useRef<HTMLDivElement>(null);\n const topBarReference = useRef<HTMLDivElement>(null);\n const contentReference = useRef<HTMLDivElement>(null);\n\n const [pressed, setPressed] = useState<boolean>(false);\n\n /**\n * Used to track `requestAnimationFrame` requests\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame#return_value\n */\n const animationId = useRef<number>(0);\n\n /**\n * Difference between initial coordinate ({@link initialYCoordinate})\n * and new position (when user moves component), it's get calculated on `onTouchMove` and `onMouseMove` events\n *\n * @see {@link calculateOffsetAfterMove}\n */\n const moveOffset = useRef<number>(0);\n const initialYCoordinate = useRef<number>(0);\n\n // apply shadow to the bottom of top-bar when scroll over content\n useConditionalListener({\n attachListener: props.open && !isServerSide(),\n callback: () => {\n if (topBarReference.current !== null) {\n const { classList } = topBarReference.current;\n if (!isContentScrollPositionAtTop()) {\n classList.add('np-bottom-sheet--top-bar--shadow');\n } else {\n classList.remove('np-bottom-sheet--top-bar--shadow');\n }\n }\n },\n eventType: 'scroll',\n parent: isServerSide() ? undefined : document,\n });\n\n function move(newHeight: number): void {\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.transform = `translateY(${newHeight}px)`;\n }\n }\n\n function close(event: Event | SyntheticEvent): void {\n setPressed(false);\n moveOffset.current = INITIAL_Y_POSITION;\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.removeProperty('transform');\n }\n if (props.onClose) {\n props.onClose(event);\n }\n }\n\n const onSwipeStart = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n initialYCoordinate.current = ('touches' in event ? event.touches[0] : event).clientY;\n setPressed(true);\n };\n\n const onSwipeMove = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n if (pressed) {\n const { clientY } = 'touches' in event ? event.touches[0] : event;\n\n const offset = calculateOffsetAfterMove(clientY);\n // check whether move is to the bottom only and content scroll position is at the top\n if (offset > INITIAL_Y_POSITION && isContentScrollPositionAtTop()) {\n moveOffset.current = offset;\n animationId.current = requestAnimationFrame(() => {\n if (animationId.current !== undefined && bottomSheetReference.current !== null) {\n move(offset);\n }\n });\n }\n }\n };\n\n function onSwipeEnd(\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void {\n // stop moving component\n cancelAnimationFrame(animationId.current);\n setPressed(false);\n // check whether move down is strong enough\n // and content scroll position is at the top to close the component\n if (moveOffset.current > MOVE_OFFSET_THRESHOLD && isContentScrollPositionAtTop()) {\n close(event);\n }\n // otherwise move component back to default (initial) position\n else {\n move(INITIAL_Y_POSITION);\n }\n moveOffset.current = INITIAL_Y_POSITION;\n }\n\n function isContentScrollPositionAtTop(): boolean {\n return (\n contentReference?.current?.scrollTop !== undefined &&\n contentReference.current.scrollTop <= CONTENT_SCROLL_THRESHOLD\n );\n }\n\n /**\n * Calculates how hard user moves component,\n * result value used to determine whether to hide component or re-position to default state\n *\n * @param afterMoveYCoordinate\n */\n function calculateOffsetAfterMove(afterMoveYCoordinate: number): number {\n return afterMoveYCoordinate - initialYCoordinate.current;\n }\n\n /**\n * Set `max-height` for content part (in order to keep it scrollable for content overflow cases) of the component\n * and ensures space for safe zone (32px) at the top.\n */\n function setContentMaxHeight(): CSSProperties {\n const safeZoneHeight = '64px';\n const topbarHeight = '32px';\n const windowHight: number = isServerSide() ? 0 : window.innerHeight;\n /**\n * Calculate _real_ height of the screen (taking into account parts of browser interface).\n *\n * See https://css-tricks.com/the-trick-to-viewport-units-on-mobile for more details.\n */\n const screenHeight = `${windowHight * 0.01 * 100}px`;\n return {\n maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`,\n };\n }\n\n const is400Zoom = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n\n return is400Zoom ? (\n <Drawer open={props.open} className={props.className} onClose={close}>\n {props.children}\n </Drawer>\n ) : (\n <Dimmer open={props.open} fadeContentOnEnter fadeContentOnExit onClose={close}>\n <SlidingPanel\n ref={bottomSheetReference}\n open={props.open}\n position={Position.BOTTOM}\n className={classNames('np-bottom-sheet', props.className)}\n >\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}\n <div\n role=\"dialog\"\n aria-modal\n onTouchStart={onSwipeStart}\n onTouchMove={onSwipeMove}\n onTouchEnd={onSwipeEnd}\n onMouseDown={onSwipeStart}\n onMouseMove={onSwipeMove}\n onMouseUp={onSwipeEnd}\n >\n <div ref={topBarReference} className=\"np-bottom-sheet--top-bar\">\n <div className=\"np-bottom-sheet--handler\" />\n <CloseButton size=\"sm\" className=\"sr-only np-bottom-sheet--close-btn\" onClick={close} />\n </div>\n <div\n ref={contentReference}\n style={setContentMaxHeight()}\n className=\"np-bottom-sheet--content\"\n >\n {props.children}\n </div>\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n};\n\nexport default BottomSheet;\n"],"names":["INITIAL_Y_POSITION","CONTENT_SCROLL_THRESHOLD","MOVE_OFFSET_THRESHOLD","BottomSheet","props","bottomSheetReference","useRef","topBarReference","contentReference","pressed","setPressed","useState","animationId","moveOffset","initialYCoordinate","useConditionalListener","attachListener","open","isServerSide","callback","current","classList","isContentScrollPositionAtTop","add","remove","eventType","parent","undefined","document","move","newHeight","style","transform","close","event","removeProperty","onClose","onSwipeStart","touches","clientY","onSwipeMove","offset","calculateOffsetAfterMove","requestAnimationFrame","onSwipeEnd","cancelAnimationFrame","scrollTop","afterMoveYCoordinate","setContentMaxHeight","safeZoneHeight","topbarHeight","windowHight","window","innerHeight","screenHeight","maxHeight","is400Zoom","useMedia","Breakpoint","ZOOM_400","_jsx","Drawer","className","children","Dimmer","fadeContentOnEnter","fadeContentOnExit","SlidingPanel","ref","position","Position","BOTTOM","classNames","_jsxs","role","onTouchStart","onTouchMove","onTouchEnd","onMouseDown","onMouseMove","onMouseUp","CloseButton","size","onClick"],"mappings":";;;;;;;;;;;;;AAcA,MAAMA,kBAAkB,GAAG,CAAC,CAAA;AAE5B,MAAMC,wBAAwB,GAAG,CAAC,CAAA;AAElC,MAAMC,qBAAqB,GAAG,EAAE,CAAA;AAShC;;;;;AAKG;AACGC,MAAAA,WAAW,GAAIC,KAAuB,IAAI;AAC9C,EAAA,MAAMC,oBAAoB,GAAGC,MAAM,CAAiB,IAAI,CAAC,CAAA;AACzD,EAAA,MAAMC,eAAe,GAAGD,MAAM,CAAiB,IAAI,CAAC,CAAA;AACpD,EAAA,MAAME,gBAAgB,GAAGF,MAAM,CAAiB,IAAI,CAAC,CAAA;EAErD,MAAM,CAACG,OAAO,EAAEC,UAAU,CAAC,GAAGC,QAAQ,CAAU,KAAK,CAAC,CAAA;AAEtD;;;;AAIG;AACH,EAAA,MAAMC,WAAW,GAAGN,MAAM,CAAS,CAAC,CAAC,CAAA;AAErC;;;;;AAKG;AACH,EAAA,MAAMO,UAAU,GAAGP,MAAM,CAAS,CAAC,CAAC,CAAA;AACpC,EAAA,MAAMQ,kBAAkB,GAAGR,MAAM,CAAS,CAAC,CAAC,CAAA;AAE5C;AACAS,EAAAA,sBAAsB,CAAC;IACrBC,cAAc,EAAEZ,KAAK,CAACa,IAAI,IAAI,CAACC,YAAY,EAAE;IAC7CC,QAAQ,EAAEA,MAAK;AACb,MAAA,IAAIZ,eAAe,CAACa,OAAO,KAAK,IAAI,EAAE;QACpC,MAAM;AAAEC,UAAAA,SAAAA;SAAW,GAAGd,eAAe,CAACa,OAAO,CAAA;AAC7C,QAAA,IAAI,CAACE,4BAA4B,EAAE,EAAE;AACnCD,UAAAA,SAAS,CAACE,GAA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,eAG1DU,IAAA,CAAA,KAAA,EAAA;AACEC,QAAAA,IAAI,EAAC,QAAQ;QACb,YAAU,EAAA,IAAA;AACVC,QAAAA,YAAY,EAAEtC,YAAa;AAC3BuC,QAAAA,WAAW,EAAEpC,WAAY;AACzBqC,QAAAA,UAAU,EAAEjC,UAAW;AACvBkC,QAAAA,WAAW,EAAEzC,YAAa;AAC1B0C,QAAAA,WAAW,EAAEvC,WAAY;AACzBwC,QAAAA,SAAS,EAAEpC,UAAW;AAAAmB,QAAAA,QAAA,gBAEtBU,IAAA,CAAA,KAAA,EAAA;AAAKL,UAAAA,GAAG,EAAE7D,eAAgB;AAACuD,UAAAA,SAAS,EAAC,0BAA0B;AAAAC,UAAAA,QAAA,gBAC7DH,GAAA,CAAA,KAAA,EAAA;AAAKE,YAAAA,SAAS,EAAC,0BAAA;AAA0B,WACzC,CAAA,eAAAF,GAAA,CAACqB,WAAW,EAAA;AAACC,YAAAA,IAAI,EAAC,IAAI;AAACpB,YAAAA,SAAS,EAAC,oCAAoC;AAACqB,YAAAA,OAAO,EAAElD,KAAAA;AAAM,WACvF,CAAA,CAAA;SAAK,CACL,eAAA2B,GAAA,CAAA,KAAA,EAAA;AACEQ,UAAAA,GAAG,EAAE5D,gBAAiB;UACtBuB,KAAK,EAAEiB,mBAAmB,EAAG;AAC7Bc,UAAAA,SAAS,EAAC,0BAA0B;UAAAC,QAAA,EAEnC3D,KAAK,CAAC2D,QAAAA;AAAQ,SACZ,CACP,CAAA;OAAK,CAAA;KACO,CAAA;AAChB,GAAQ,CACT,CAAA;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"deviceDetection.js","sources":["../../../src/common/deviceDetection/deviceDetection.ts"],"sourcesContent":["export function isIosDevice() {\n const sampleTouchDevices = ['iphone', 'ipad', 'ipod'];\n const matchString = sampleTouchDevices.map((device: string) => `(${device})`).join('|');\n const regex = new RegExp(matchString, 'gi');\n\n return typeof navigator !== 'undefined' && !!regex.test(navigator.userAgent);\n}\n"],"names":["isIosDevice","sampleTouchDevices","matchString","map","device","join","regex","RegExp","navigator","test","userAgent"],"mappings":";;SAAgBA,WAAWA,GAAA;EACzB,MAAMC,kBAAkB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AACrD,EAAA,MAAMC,WAAW,GAAGD,kBAAkB,CAACE,GAAG,CAAEC,MAAc,IAAS,CAAAA,CAAAA,EAAAA,SAAS,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAA;EACvF,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,WAAW,EAAE,IAAI,CAAC,CAAA;AAE3C,EAAA,OAAO,OAAOM,SAAS,KAAK,WAAW,IAAI,CAAC,CAACF,KAAK,CAACG,IAAI,CAACD,SAAS,CAACE,SAAS,CAAC,CAAA;AAC9E;;;;"}
1
+ {"version":3,"file":"deviceDetection.js","sources":["../../../src/common/deviceDetection/deviceDetection.ts"],"sourcesContent":["export function isIosDevice() {\n const sampleTouchDevices = ['iphone', 'ipad', 'ipod'];\n const matchString = sampleTouchDevices.map((device: string) => `(${device})`).join('|');\n const regex = new RegExp(matchString, 'gi');\n\n return typeof navigator !== 'undefined' && !!regex.test(navigator.userAgent);\n}\n"],"names":["isIosDevice","sampleTouchDevices","matchString","map","device","join","regex","RegExp","navigator","test","userAgent"],"mappings":";;SAAgBA,WAAWA,GAAA;EACzB,MAAMC,kBAAkB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AACrD,EAAA,MAAMC,WAAW,GAAGD,kBAAkB,CAACE,GAAG,CAAEC,MAAc,IAAK,CAAIA,CAAAA,EAAAA,MAAM,GAAG,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAA;EACvF,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,WAAW,EAAE,IAAI,CAAC,CAAA;AAE3C,EAAA,OAAO,OAAOM,SAAS,KAAK,WAAW,IAAI,CAAC,CAACF,KAAK,CAACG,IAAI,CAACD,SAAS,CAACE,SAAS,CAAC,CAAA;AAC9E;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"deviceDetection.mjs","sources":["../../../src/common/deviceDetection/deviceDetection.ts"],"sourcesContent":["export function isIosDevice() {\n const sampleTouchDevices = ['iphone', 'ipad', 'ipod'];\n const matchString = sampleTouchDevices.map((device: string) => `(${device})`).join('|');\n const regex = new RegExp(matchString, 'gi');\n\n return typeof navigator !== 'undefined' && !!regex.test(navigator.userAgent);\n}\n"],"names":["isIosDevice","sampleTouchDevices","matchString","map","device","join","regex","RegExp","navigator","test","userAgent"],"mappings":"SAAgBA,WAAWA,GAAA;EACzB,MAAMC,kBAAkB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AACrD,EAAA,MAAMC,WAAW,GAAGD,kBAAkB,CAACE,GAAG,CAAEC,MAAc,IAAS,CAAAA,CAAAA,EAAAA,SAAS,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAA;EACvF,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,WAAW,EAAE,IAAI,CAAC,CAAA;AAE3C,EAAA,OAAO,OAAOM,SAAS,KAAK,WAAW,IAAI,CAAC,CAACF,KAAK,CAACG,IAAI,CAACD,SAAS,CAACE,SAAS,CAAC,CAAA;AAC9E;;;;"}
1
+ {"version":3,"file":"deviceDetection.mjs","sources":["../../../src/common/deviceDetection/deviceDetection.ts"],"sourcesContent":["export function isIosDevice() {\n const sampleTouchDevices = ['iphone', 'ipad', 'ipod'];\n const matchString = sampleTouchDevices.map((device: string) => `(${device})`).join('|');\n const regex = new RegExp(matchString, 'gi');\n\n return typeof navigator !== 'undefined' && !!regex.test(navigator.userAgent);\n}\n"],"names":["isIosDevice","sampleTouchDevices","matchString","map","device","join","regex","RegExp","navigator","test","userAgent"],"mappings":"SAAgBA,WAAWA,GAAA;EACzB,MAAMC,kBAAkB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AACrD,EAAA,MAAMC,WAAW,GAAGD,kBAAkB,CAACE,GAAG,CAAEC,MAAc,IAAK,CAAIA,CAAAA,EAAAA,MAAM,GAAG,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAA;EACvF,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,WAAW,EAAE,IAAI,CAAC,CAAA;AAE3C,EAAA,OAAO,OAAOM,SAAS,KAAK,WAAW,IAAI,CAAC,CAACF,KAAK,CAACG,IAAI,CAACD,SAAS,CAACE,SAAS,CAAC,CAAA;AAC9E;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Panel.js","sources":["../../../src/common/panel/Panel.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport {\n CSSProperties,\n HTMLAttributes,\n MutableRefObject,\n PropsWithChildren,\n SyntheticEvent,\n forwardRef,\n useEffect,\n useState,\n} from 'react';\nimport { usePopper } from 'react-popper';\n\nimport { Position, PositionBottom, PositionLeft, PositionRight, PositionTop } from '..';\nimport Dimmer from '../../dimmer';\n\nconst POPOVER_OFFSET = [0, 16];\n\n// By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space\n// the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.\n// This mapping forces popover to try the four available positions before going back to the initial chosen one.\nconst fallbackPlacements = {\n [Position.TOP]: [Position.BOTTOM, Position.RIGHT, Position.LEFT],\n [Position.BOTTOM]: [Position.TOP, Position.RIGHT, Position.LEFT],\n [Position.LEFT]: [Position.RIGHT, Position.TOP, Position.BOTTOM],\n [Position.RIGHT]: [Position.LEFT, Position.TOP, Position.BOTTOM],\n};\n\nexport type PanelProps = PropsWithChildren<{\n arrow?: boolean;\n flip?: boolean;\n altAxis?: boolean;\n open?: boolean;\n onClose?: (event: Event | SyntheticEvent) => void;\n position?: PositionBottom | PositionLeft | PositionRight | PositionTop;\n anchorRef: MutableRefObject<Element | null>;\n anchorWidth?: boolean;\n}> &\n HTMLAttributes<HTMLDivElement>;\n\nconst Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(\n {\n arrow = false,\n flip = true,\n altAxis = false,\n children,\n open = false,\n onClose,\n position = Position.BOTTOM,\n anchorRef,\n anchorWidth = false,\n ...rest\n }: PanelProps,\n reference,\n) {\n const [arrowElement, setArrowElement] = useState<HTMLDivElement | null>(null);\n const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);\n\n const modifiers = [];\n\n if (altAxis) {\n modifiers.push({\n // https://popper.js.org/docs/v2/modifiers/prevent-overflow\n name: 'preventOverflow',\n options: {\n altAxis: true,\n tether: false,\n },\n });\n }\n\n if (arrow) {\n modifiers.push({\n name: 'arrow',\n options: {\n element: arrowElement,\n options: {\n padding: 8, // 8px from the edges of the popper\n },\n },\n });\n // This lets you displace a popper element from its reference element.\n modifiers.push({ name: 'offset', options: { offset: POPOVER_OFFSET } });\n }\n if (flip && fallbackPlacements[position]) {\n modifiers.push({\n name: 'flip',\n options: {\n fallbackPlacements: fallbackPlacements[position],\n },\n });\n }\n\n const { styles, attributes, forceUpdate } = usePopper(anchorRef.current, popperElement, {\n placement: position,\n modifiers,\n });\n\n // If the trigger is not visible when the position is calculated, it will be incorrect. Because this can happen repeatedly (on resize for example),\n // it is most simple just to always position before opening\n useEffect(() => {\n if (open && forceUpdate) {\n forceUpdate();\n }\n }, [open]);\n\n const contentStyle: CSSProperties = {\n ...(anchorWidth ? { width: anchorRef.current?.clientWidth } : undefined),\n };\n\n return (\n <Dimmer open={open} transparent fadeContentOnEnter fadeContentOnExit onClose={onClose}>\n <div\n {...rest}\n ref={setPopperElement}\n role=\"dialog\"\n // eslint-disable-next-line react/forbid-dom-props\n style={{ ...styles.popper }}\n {...attributes.popper}\n className={classnames('np-panel', { 'np-panel--open': open }, rest.className)}\n >\n <div\n ref={reference}\n /* eslint-disable-next-line react/forbid-dom-props */\n style={contentStyle}\n className={classnames('np-panel__content')}\n >\n {children}\n {/* Arrow has to stay inside content to get the same animations as the \"dialog\" and to get hidden when panel is closed. */}\n {arrow && (\n <div\n ref={setArrowElement}\n className={classnames('np-panel__arrow')}\n // eslint-disable-next-line react/forbid-dom-props\n style={styles.arrow}\n />\n )}\n </div>\n </div>\n </Dimmer>\n );\n});\n\nexport default Panel;\n"],"names":["POPOVER_OFFSET","fallbackPlacements","Position","TOP","BOTTOM","RIGHT","LEFT","Panel","forwardRef","arrow","flip","altAxis","children","open","onClose","position","anchorRef","anchorWidth","rest","reference","arrowElement","setArrowElement","useState","popperElement","setPopperElement","modifiers","push","name","options","tether","element","padding","offset","styles","attributes","forceUpdate","usePopper","current","placement","useEffect","contentStyle","width","clientWidth","undefined","_jsx","Dimmer","transparent","fadeContentOnEnter","fadeContentOnExit","ref","role","style","popper","className","classnames","_jsxs"],"mappings":";;;;;;;;;;;;;AAgBA,MAAMA,cAAc,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAE9B;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG;AACzB,EAAA,CAACC,iBAAQ,CAACC,GAAG,GAAG,CAACD,iBAAQ,CAACE,MAAM,EAAEF,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,iBAAQ,CAACE,MAAM,GAAG,CAACF,iBAAQ,CAACC,GAAG,EAAED,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,iBAAQ,CAACI,IAAI,GAAG,CAACJ,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACC,GAAG,EAAED,iBAAQ,CAACE,MAAM,CAAC;AAChE,EAAA,CAACF,iBAAQ,CAACG,KAAK,GAAG,CAACH,iBAAQ,CAACI,IAAI,EAAEJ,iBAAQ,CAACC,GAAG,EAAED,iBAAQ,CAACE,MAAM,CAAA;CAChE,CAAA;AAcD,MAAMG,KAAK,gBAAGC,gBAAU,CAA6B,SAASD,KAAKA,CACjE;AACEE,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA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,EAAEK,IAAI,CAACmC,SAAS,CAAE;AAAAzC,MAAAA,QAAA,eAE9E2C,eAAA,CAAA,KAAA,EAAA;AACEN,QAAAA,GAAG,EAAE9B,SAAAA;AACL;AACAgC,QAAAA,KAAK,EAAEX,YAAa;AACpBa,QAAAA,SAAS,EAAEC,2BAAU,CAAC,mBAAmB,CAAE;AAAA1C,QAAAA,QAAA,EAE1CA,CAAAA,QAAQ,EAERH,KAAK,iBACJmC,cAAA,CAAA,KAAA,EAAA;AACEK,UAAAA,GAAG,EAAE5B,eAAgB;UACrBgC,SAAS,EAAEC,2BAAU,CAAC,iBAAiB,CAAA;AACvC;AAAA;UACAH,KAAK,EAAElB,MAAM,CAACxB,KAAAA;AAAM,SAAA,CAEvB,CAAA;OACE,CAAA;KACF,CAAA;AACP,GAAQ,CAAC,CAAA;AAEb,CAAC,CAAC,CAAA;AAEF,cAAeF,KAAK;;;;"}
1
+ {"version":3,"file":"Panel.js","sources":["../../../src/common/panel/Panel.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport {\n CSSProperties,\n HTMLAttributes,\n MutableRefObject,\n PropsWithChildren,\n SyntheticEvent,\n forwardRef,\n useEffect,\n useState,\n} from 'react';\nimport { usePopper } from 'react-popper';\n\nimport { Position, PositionBottom, PositionLeft, PositionRight, PositionTop } from '..';\nimport Dimmer from '../../dimmer';\n\nconst POPOVER_OFFSET = [0, 16];\n\n// By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space\n// the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.\n// This mapping forces popover to try the four available positions before going back to the initial chosen one.\nconst fallbackPlacements = {\n [Position.TOP]: [Position.BOTTOM, Position.RIGHT, Position.LEFT],\n [Position.BOTTOM]: [Position.TOP, Position.RIGHT, Position.LEFT],\n [Position.LEFT]: [Position.RIGHT, Position.TOP, Position.BOTTOM],\n [Position.RIGHT]: [Position.LEFT, Position.TOP, Position.BOTTOM],\n};\n\nexport type PanelProps = PropsWithChildren<{\n arrow?: boolean;\n flip?: boolean;\n altAxis?: boolean;\n open?: boolean;\n onClose?: (event: Event | SyntheticEvent) => void;\n position?: PositionBottom | PositionLeft | PositionRight | PositionTop;\n anchorRef: MutableRefObject<Element | null>;\n anchorWidth?: boolean;\n}> &\n HTMLAttributes<HTMLDivElement>;\n\nconst Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(\n {\n arrow = false,\n flip = true,\n altAxis = false,\n children,\n open = false,\n onClose,\n position = Position.BOTTOM,\n anchorRef,\n anchorWidth = false,\n ...rest\n }: PanelProps,\n reference,\n) {\n const [arrowElement, setArrowElement] = useState<HTMLDivElement | null>(null);\n const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);\n\n const modifiers = [];\n\n if (altAxis) {\n modifiers.push({\n // https://popper.js.org/docs/v2/modifiers/prevent-overflow\n name: 'preventOverflow',\n options: {\n altAxis: true,\n tether: false,\n },\n });\n }\n\n if (arrow) {\n modifiers.push({\n name: 'arrow',\n options: {\n element: arrowElement,\n options: {\n padding: 8, // 8px from the edges of the popper\n },\n },\n });\n // This lets you displace a popper element from its reference element.\n modifiers.push({ name: 'offset', options: { offset: POPOVER_OFFSET } });\n }\n if (flip && fallbackPlacements[position]) {\n modifiers.push({\n name: 'flip',\n options: {\n fallbackPlacements: fallbackPlacements[position],\n },\n });\n }\n\n const { styles, attributes, forceUpdate } = usePopper(anchorRef.current, popperElement, {\n placement: position,\n modifiers,\n });\n\n // If the trigger is not visible when the position is calculated, it will be incorrect. Because this can happen repeatedly (on resize for example),\n // it is most simple just to always position before opening\n useEffect(() => {\n if (open && forceUpdate) {\n forceUpdate();\n }\n }, [open]);\n\n const contentStyle: CSSProperties = {\n ...(anchorWidth ? { width: anchorRef.current?.clientWidth } : undefined),\n };\n\n return (\n <Dimmer open={open} transparent fadeContentOnEnter fadeContentOnExit onClose={onClose}>\n <div\n {...rest}\n ref={setPopperElement}\n role=\"dialog\"\n // eslint-disable-next-line react/forbid-dom-props\n style={{ ...styles.popper }}\n {...attributes.popper}\n className={classnames('np-panel', { 'np-panel--open': open }, rest.className)}\n >\n <div\n ref={reference}\n /* eslint-disable-next-line react/forbid-dom-props */\n style={contentStyle}\n className={classnames('np-panel__content')}\n >\n {children}\n {/* Arrow has to stay inside content to get the same animations as the \"dialog\" and to get hidden when panel is closed. */}\n {arrow && (\n <div\n ref={setArrowElement}\n className={classnames('np-panel__arrow')}\n // eslint-disable-next-line react/forbid-dom-props\n style={styles.arrow}\n />\n )}\n </div>\n </div>\n </Dimmer>\n );\n});\n\nexport default Panel;\n"],"names":["POPOVER_OFFSET","fallbackPlacements","Position","TOP","BOTTOM","RIGHT","LEFT","Panel","forwardRef","arrow","flip","altAxis","children","open","onClose","position","anchorRef","anchorWidth","rest","reference","arrowElement","setArrowElement","useState","popperElement","setPopperElement","modifiers","push","name","options","tether","element","padding","offset","styles","attributes","forceUpdate","usePopper","current","placement","useEffect","contentStyle","width","clientWidth","undefined","_jsx","Dimmer","transparent","fadeContentOnEnter","fadeContentOnExit","ref","role","style","popper","className","classnames","_jsxs"],"mappings":";;;;;;;;;;;;;AAgBA,MAAMA,cAAc,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAE9B;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG;AACzB,EAAA,CAACC,iBAAQ,CAACC,GAAG,GAAG,CAACD,iBAAQ,CAACE,MAAM,EAAEF,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,iBAAQ,CAACE,MAAM,GAAG,CAACF,iBAAQ,CAACC,GAAG,EAAED,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,iBAAQ,CAACI,IAAI,GAAG,CAACJ,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACC,GAAG,EAAED,iBAAQ,CAACE,MAAM,CAAC;AAChE,EAAA,CAACF,iBAAQ,CAACG,KAAK,GAAG,CAACH,iBAAQ,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AA,KAAK,EAAE;AAAE,QAAA,GAAGlB,MAAM,CAACmB,MAAAA;OAAS;MAAA,GACxBlB,UAAU,CAACkB,MAAM;AACrBC,MAAAA,SAAS,EAAEC,2BAAU,CAAC,UAAU,EAAE;AAAE,QAAA,gBAAgB,EAAEzC,IAAAA;AAAI,OAAE,EAAEK,IAAI,CAACmC,SAAS,CAAE;AAAAzC,MAAAA,QAAA,eAE9E2C,eAAA,CAAA,KAAA,EAAA;AACEN,QAAAA,GAAG,EAAE9B,SAAAA;AACL;AACAgC,QAAAA,KAAK,EAAEX,YAAa;AACpBa,QAAAA,SAAS,EAAEC,2BAAU,CAAC,mBAAmB,CAAE;AAAA1C,QAAAA,QAAA,EAE1CA,CAAAA,QAAQ,EAERH,KAAK,iBACJmC,cAAA,CAAA,KAAA,EAAA;AACEK,UAAAA,GAAG,EAAE5B,eAAgB;UACrBgC,SAAS,EAAEC,2BAAU,CAAC,iBAAiB,CAAA;AACvC;AAAA;UACAH,KAAK,EAAElB,MAAM,CAACxB,KAAAA;AAAM,SAAA,CAEvB,CAAA;OACE,CAAA;KACF,CAAA;AACP,GAAQ,CAAC,CAAA;AAEb,CAAC,CAAC,CAAA;AAEF,cAAeF,KAAK;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Panel.mjs","sources":["../../../src/common/panel/Panel.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport {\n CSSProperties,\n HTMLAttributes,\n MutableRefObject,\n PropsWithChildren,\n SyntheticEvent,\n forwardRef,\n useEffect,\n useState,\n} from 'react';\nimport { usePopper } from 'react-popper';\n\nimport { Position, PositionBottom, PositionLeft, PositionRight, PositionTop } from '..';\nimport Dimmer from '../../dimmer';\n\nconst POPOVER_OFFSET = [0, 16];\n\n// By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space\n// the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.\n// This mapping forces popover to try the four available positions before going back to the initial chosen one.\nconst fallbackPlacements = {\n [Position.TOP]: [Position.BOTTOM, Position.RIGHT, Position.LEFT],\n [Position.BOTTOM]: [Position.TOP, Position.RIGHT, Position.LEFT],\n [Position.LEFT]: [Position.RIGHT, Position.TOP, Position.BOTTOM],\n [Position.RIGHT]: [Position.LEFT, Position.TOP, Position.BOTTOM],\n};\n\nexport type PanelProps = PropsWithChildren<{\n arrow?: boolean;\n flip?: boolean;\n altAxis?: boolean;\n open?: boolean;\n onClose?: (event: Event | SyntheticEvent) => void;\n position?: PositionBottom | PositionLeft | PositionRight | PositionTop;\n anchorRef: MutableRefObject<Element | null>;\n anchorWidth?: boolean;\n}> &\n HTMLAttributes<HTMLDivElement>;\n\nconst Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(\n {\n arrow = false,\n flip = true,\n altAxis = false,\n children,\n open = false,\n onClose,\n position = Position.BOTTOM,\n anchorRef,\n anchorWidth = false,\n ...rest\n }: PanelProps,\n reference,\n) {\n const [arrowElement, setArrowElement] = useState<HTMLDivElement | null>(null);\n const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);\n\n const modifiers = [];\n\n if (altAxis) {\n modifiers.push({\n // https://popper.js.org/docs/v2/modifiers/prevent-overflow\n name: 'preventOverflow',\n options: {\n altAxis: true,\n tether: false,\n },\n });\n }\n\n if (arrow) {\n modifiers.push({\n name: 'arrow',\n options: {\n element: arrowElement,\n options: {\n padding: 8, // 8px from the edges of the popper\n },\n },\n });\n // This lets you displace a popper element from its reference element.\n modifiers.push({ name: 'offset', options: { offset: POPOVER_OFFSET } });\n }\n if (flip && fallbackPlacements[position]) {\n modifiers.push({\n name: 'flip',\n options: {\n fallbackPlacements: fallbackPlacements[position],\n },\n });\n }\n\n const { styles, attributes, forceUpdate } = usePopper(anchorRef.current, popperElement, {\n placement: position,\n modifiers,\n });\n\n // If the trigger is not visible when the position is calculated, it will be incorrect. Because this can happen repeatedly (on resize for example),\n // it is most simple just to always position before opening\n useEffect(() => {\n if (open && forceUpdate) {\n forceUpdate();\n }\n }, [open]);\n\n const contentStyle: CSSProperties = {\n ...(anchorWidth ? { width: anchorRef.current?.clientWidth } : undefined),\n };\n\n return (\n <Dimmer open={open} transparent fadeContentOnEnter fadeContentOnExit onClose={onClose}>\n <div\n {...rest}\n ref={setPopperElement}\n role=\"dialog\"\n // eslint-disable-next-line react/forbid-dom-props\n style={{ ...styles.popper }}\n {...attributes.popper}\n className={classnames('np-panel', { 'np-panel--open': open }, rest.className)}\n >\n <div\n ref={reference}\n /* eslint-disable-next-line react/forbid-dom-props */\n style={contentStyle}\n className={classnames('np-panel__content')}\n >\n {children}\n {/* Arrow has to stay inside content to get the same animations as the \"dialog\" and to get hidden when panel is closed. */}\n {arrow && (\n <div\n ref={setArrowElement}\n className={classnames('np-panel__arrow')}\n // eslint-disable-next-line react/forbid-dom-props\n style={styles.arrow}\n />\n )}\n </div>\n </div>\n </Dimmer>\n );\n});\n\nexport default Panel;\n"],"names":["POPOVER_OFFSET","fallbackPlacements","Position","TOP","BOTTOM","RIGHT","LEFT","Panel","forwardRef","arrow","flip","altAxis","children","open","onClose","position","anchorRef","anchorWidth","rest","reference","arrowElement","setArrowElement","useState","popperElement","setPopperElement","modifiers","push","name","options","tether","element","padding","offset","styles","attributes","forceUpdate","usePopper","current","placement","useEffect","contentStyle","width","clientWidth","undefined","_jsx","Dimmer","transparent","fadeContentOnEnter","fadeContentOnExit","ref","role","style","popper","className","classnames","_jsxs"],"mappings":";;;;;;;AAgBA,MAAMA,cAAc,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAE9B;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG;AACzB,EAAA,CAACC,QAAQ,CAACC,GAAG,GAAG,CAACD,QAAQ,CAACE,MAAM,EAAEF,QAAQ,CAACG,KAAK,EAAEH,QAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,QAAQ,CAACE,MAAM,GAAG,CAACF,QAAQ,CAACC,GAAG,EAAED,QAAQ,CAACG,KAAK,EAAEH,QAAQ,CAACI,IAAI,CAA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AAQ;AAAAF,IAAAA,QAAA,eACpFgC,GAAA,CAAA,KAAA,EAAA;AAAA,MAAA,GACM1B,IAAI;AACR+B,MAAAA,GAAG,EAAEzB,gBAAiB;AACtB0B,MAAAA,IAAI,EAAC,QAAA;AACL;AAAA;AACAC,MAAAA,KAAK,EAAE;AAAE,QAAA,GAAGlB,MAAM,CAACmB,MAAAA;OAAS;MAAA,GACxBlB,UAAU,CAACkB,MAAM;AACrBC,MAAAA,SAAS,EAAEC,UAAU,CAAC,UAAU,EAAE;AAAE,QAAA,gBAAgB,EAAEzC,IAAAA;AAAI,OAAE,EAAEK,IAAI,CAACmC,SAAS,CAAE;AAAAzC,MAAAA,QAAA,eAE9E2C,IAAA,CAAA,KAAA,EAAA;AACEN,QAAAA,GAAG,EAAE9B,SAAAA;AACL;AACAgC,QAAAA,KAAK,EAAEX,YAAa;AACpBa,QAAAA,SAAS,EAAEC,UAAU,CAAC,mBAAmB,CAAE;AAAA1C,QAAAA,QAAA,EAE1CA,CAAAA,QAAQ,EAERH,KAAK,iBACJmC,GAAA,CAAA,KAAA,EAAA;AACEK,UAAAA,GAAG,EAAE5B,eAAgB;UACrBgC,SAAS,EAAEC,UAAU,CAAC,iBAAiB,CAAA;AACvC;AAAA;UACAH,KAAK,EAAElB,MAAM,CAACxB,KAAAA;AAAM,SAAA,CAEvB,CAAA;OACE,CAAA;KACF,CAAA;AACP,GAAQ,CAAC,CAAA;AAEb,CAAC,CAAC,CAAA;AAEF,cAAeF,KAAK;;;;"}
1
+ {"version":3,"file":"Panel.mjs","sources":["../../../src/common/panel/Panel.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport {\n CSSProperties,\n HTMLAttributes,\n MutableRefObject,\n PropsWithChildren,\n SyntheticEvent,\n forwardRef,\n useEffect,\n useState,\n} from 'react';\nimport { usePopper } from 'react-popper';\n\nimport { Position, PositionBottom, PositionLeft, PositionRight, PositionTop } from '..';\nimport Dimmer from '../../dimmer';\n\nconst POPOVER_OFFSET = [0, 16];\n\n// By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space\n// the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.\n// This mapping forces popover to try the four available positions before going back to the initial chosen one.\nconst fallbackPlacements = {\n [Position.TOP]: [Position.BOTTOM, Position.RIGHT, Position.LEFT],\n [Position.BOTTOM]: [Position.TOP, Position.RIGHT, Position.LEFT],\n [Position.LEFT]: [Position.RIGHT, Position.TOP, Position.BOTTOM],\n [Position.RIGHT]: [Position.LEFT, Position.TOP, Position.BOTTOM],\n};\n\nexport type PanelProps = PropsWithChildren<{\n arrow?: boolean;\n flip?: boolean;\n altAxis?: boolean;\n open?: boolean;\n onClose?: (event: Event | SyntheticEvent) => void;\n position?: PositionBottom | PositionLeft | PositionRight | PositionTop;\n anchorRef: MutableRefObject<Element | null>;\n anchorWidth?: boolean;\n}> &\n HTMLAttributes<HTMLDivElement>;\n\nconst Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(\n {\n arrow = false,\n flip = true,\n altAxis = false,\n children,\n open = false,\n onClose,\n position = Position.BOTTOM,\n anchorRef,\n anchorWidth = false,\n ...rest\n }: PanelProps,\n reference,\n) {\n const [arrowElement, setArrowElement] = useState<HTMLDivElement | null>(null);\n const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);\n\n const modifiers = [];\n\n if (altAxis) {\n modifiers.push({\n // https://popper.js.org/docs/v2/modifiers/prevent-overflow\n name: 'preventOverflow',\n options: {\n altAxis: true,\n tether: false,\n },\n });\n }\n\n if (arrow) {\n modifiers.push({\n name: 'arrow',\n options: {\n element: arrowElement,\n options: {\n padding: 8, // 8px from the edges of the popper\n },\n },\n });\n // This lets you displace a popper element from its reference element.\n modifiers.push({ name: 'offset', options: { offset: POPOVER_OFFSET } });\n }\n if (flip && fallbackPlacements[position]) {\n modifiers.push({\n name: 'flip',\n options: {\n fallbackPlacements: fallbackPlacements[position],\n },\n });\n }\n\n const { styles, attributes, forceUpdate } = usePopper(anchorRef.current, popperElement, {\n placement: position,\n modifiers,\n });\n\n // If the trigger is not visible when the position is calculated, it will be incorrect. Because this can happen repeatedly (on resize for example),\n // it is most simple just to always position before opening\n useEffect(() => {\n if (open && forceUpdate) {\n forceUpdate();\n }\n }, [open]);\n\n const contentStyle: CSSProperties = {\n ...(anchorWidth ? { width: anchorRef.current?.clientWidth } : undefined),\n };\n\n return (\n <Dimmer open={open} transparent fadeContentOnEnter fadeContentOnExit onClose={onClose}>\n <div\n {...rest}\n ref={setPopperElement}\n role=\"dialog\"\n // eslint-disable-next-line react/forbid-dom-props\n style={{ ...styles.popper }}\n {...attributes.popper}\n className={classnames('np-panel', { 'np-panel--open': open }, rest.className)}\n >\n <div\n ref={reference}\n /* eslint-disable-next-line react/forbid-dom-props */\n style={contentStyle}\n className={classnames('np-panel__content')}\n >\n {children}\n {/* Arrow has to stay inside content to get the same animations as the \"dialog\" and to get hidden when panel is closed. */}\n {arrow && (\n <div\n ref={setArrowElement}\n className={classnames('np-panel__arrow')}\n // eslint-disable-next-line react/forbid-dom-props\n style={styles.arrow}\n />\n )}\n </div>\n </div>\n </Dimmer>\n );\n});\n\nexport default Panel;\n"],"names":["POPOVER_OFFSET","fallbackPlacements","Position","TOP","BOTTOM","RIGHT","LEFT","Panel","forwardRef","arrow","flip","altAxis","children","open","onClose","position","anchorRef","anchorWidth","rest","reference","arrowElement","setArrowElement","useState","popperElement","setPopperElement","modifiers","push","name","options","tether","element","padding","offset","styles","attributes","forceUpdate","usePopper","current","placement","useEffect","contentStyle","width","clientWidth","undefined","_jsx","Dimmer","transparent","fadeContentOnEnter","fadeContentOnExit","ref","role","style","popper","className","classnames","_jsxs"],"mappings":";;;;;;;AAgBA,MAAMA,cAAc,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAE9B;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG;AACzB,EAAA,CAACC,QAAQ,CAACC,GAAG,GAAG,CAACD,QAAQ,CAACE,MAAM,EAAEF,QAAQ,CAACG,KAAK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GAAA,CAACC,MAAM,EAAA;AAAChC,IAAAA,IAAI,EAAEA,IAAK;IAACiC,WAAW,EAAA,IAAA;IAACC,kBAAkB,EAAA,IAAA;IAACC,iBAAiB,EAAA,IAAA;AAAClC,IAAAA,OAAO,EAAEA,OAAQ;AAAAF,IAAAA,QAAA,eACpFgC,GAAA,CAAA,KAAA,EAAA;AAAA,MAAA,GACM1B,IAAI;AACR+B,MAAAA,GAAG,EAAEzB,gBAAiB;AACtB0B,MAAAA,IAAI,EAAC,QAAA;AACL;AAAA;AACAC,MAAAA,KAAK,EAAE;AAAE,QAAA,GAAGlB,MAAM,CAACmB,MAAAA;OAAS;MAAA,GACxBlB,UAAU,CAACkB,MAAM;AACrBC,MAAAA,SAAS,EAAEC,UAAU,CAAC,UAAU,EAAE;AAAE,QAAA,gBAAgB,EAAEzC,IAAAA;AAAI,OAAE,EAAEK,IAAI,CAACmC,SAAS,CAAE;AAAAzC,MAAAA,QAAA,eAE9E2C,IAAA,CAAA,KAAA,EAAA;AACEN,QAAAA,GAAG,EAAE9B,SAAAA;AACL;AACAgC,QAAAA,KAAK,EAAEX,YAAa;AACpBa,QAAAA,SAAS,EAAEC,UAAU,CAAC,mBAAmB,CAAE;AAAA1C,QAAAA,QAAA,EAE1CA,CAAAA,QAAQ,EAERH,KAAK,iBACJmC,GAAA,CAAA,KAAA,EAAA;AACEK,UAAAA,GAAG,EAAE5B,eAAgB;UACrBgC,SAAS,EAAEC,UAAU,CAAC,iBAAiB,CAAA;AACvC;AAAA;UACAH,KAAK,EAAElB,MAAM,CAACxB,KAAAA;AAAM,SAAA,CAEvB,CAAA;OACE,CAAA;KACF,CAAA;AACP,GAAQ,CAAC,CAAA;AAEb,CAAC,CAAC,CAAA;AAEF,cAAeF,KAAK;;;;"}
@@ -15,7 +15,8 @@ const ResponsivePanel = /*#__PURE__*/React.forwardRef(function ResponsivePanel({
15
15
  className = undefined,
16
16
  onClose,
17
17
  open = false,
18
- position: position$1 = position.Position.BOTTOM
18
+ position: position$1 = position.Position.BOTTOM,
19
+ anchorWidth = false
19
20
  }, reference) {
20
21
  const {
21
22
  isMobile
@@ -34,6 +35,7 @@ const ResponsivePanel = /*#__PURE__*/React.forwardRef(function ResponsivePanel({
34
35
  arrow: arrow,
35
36
  open: open,
36
37
  position: position$1,
38
+ anchorWidth: anchorWidth,
37
39
  anchorRef: anchorRef,
38
40
  className: className,
39
41
  onClose: onClose,
@@ -1 +1 @@
1
- {"version":3,"file":"ResponsivePanel.js","sources":["../../../src/common/responsivePanel/ResponsivePanel.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { Position } from '..';\nimport BottomSheet from '../bottomSheet';\nimport { useLayout } from '../hooks';\nimport Panel from '../panel';\nimport { PanelProps } from '../panel/Panel';\n\nconst ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function ResponsivePanel(\n {\n anchorRef,\n arrow = false,\n flip = true,\n children,\n className = undefined,\n onClose,\n open = false,\n position = Position.BOTTOM,\n }: PanelProps,\n reference,\n) {\n const { isMobile } = useLayout();\n if (isMobile) {\n return (\n <BottomSheet key=\"bottomSheet\" open={open} className={className} onClose={onClose}>\n {children}\n </BottomSheet>\n );\n }\n return (\n <Panel\n key=\"panel\"\n ref={reference}\n flip={flip}\n arrow={arrow}\n open={open}\n position={position}\n anchorRef={anchorRef}\n className={className}\n onClose={onClose}\n >\n {children}\n </Panel>\n );\n});\n\nexport default ResponsivePanel;\n"],"names":["ResponsivePanel","forwardRef","anchorRef","arrow","flip","children","className","undefined","onClose","open","position","Position","BOTTOM","reference","isMobile","useLayout","_jsx","BottomSheet","Panel","ref"],"mappings":";;;;;;;;;AAQA,MAAMA,eAAe,gBAAGC,gBAAU,CAA6B,SAASD,eAAeA,CACrF;EACEE,SAAS;AACTC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,IAAI,GAAG,IAAI;EACXC,QAAQ;AACRC,EAAAA,SAAS,GAAGC,SAAS;EACrBC,OAAO;AACPC,EAAAA,IAAI,GAAG,KAAK;YACZC,UAAQ,GAAGC,iBAAQ,CAACC,MAAAA;AAAM,CACf,EACbC,SAAS,EAAA;EAET,MAAM;AAAEC,IAAAA,QAAAA;GAAU,GAAGC,mBAAS,EAAE,CAAA;AAChC,EAAA,IAAID,QAAQ,EAAE;IACZ,oBACEE,cAAA,CAACC,WAAW,EAAA;AAAmBR,MAAAA,IAAI,EAAEA,IAAK;AAACH,MAAAA,SAAS,EAAEA,SAAU;AAACE,MAAAA,OAAO,EAAEA,OAAQ;AAAAH,MAAAA,QAAA,EAC/EA,QAAAA;AAAQ,KAAA,EADM,aAEJ,CAAC,CAAA;AAElB,GAAA;EACA,oBACEW,cAAA,CAACE,KAAK,EAAA;AAEJC,IAAAA,GAAG,EAAEN,SAAU;AACfT,IAAAA,IAAI,EAAEA,IAAK;AACXD,IAAAA,KAAK,EAAEA,KAAM;AACbM,IAAAA,IAAI,EAAEA,IAAK;AACXC,IAAAA,QAAQ,EAAEA,UAAS;AACnBR,IAAAA,SAAS,EAAEA,SAAU;AACrBI,IAAAA,SAAS,EAAEA,SAAU;AACrBE,IAAAA,OAAO,EAAEA,OAAQ;AAAAH,IAAAA,QAAA,EAEhBA,QAAAA;AAAQ,GAAA,EAVL,OAWC,CAAC,CAAA;AAEZ,CAAC;;;;"}
1
+ {"version":3,"file":"ResponsivePanel.js","sources":["../../../src/common/responsivePanel/ResponsivePanel.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { Position } from '..';\nimport BottomSheet from '../bottomSheet';\nimport { useLayout } from '../hooks';\nimport Panel from '../panel';\nimport { PanelProps } from '../panel/Panel';\n\nconst ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function ResponsivePanel(\n {\n anchorRef,\n arrow = false,\n flip = true,\n children,\n className = undefined,\n onClose,\n open = false,\n position = Position.BOTTOM,\n anchorWidth = false,\n }: PanelProps,\n reference,\n) {\n const { isMobile } = useLayout();\n if (isMobile) {\n return (\n <BottomSheet key=\"bottomSheet\" open={open} className={className} onClose={onClose}>\n {children}\n </BottomSheet>\n );\n }\n return (\n <Panel\n key=\"panel\"\n ref={reference}\n flip={flip}\n arrow={arrow}\n open={open}\n position={position}\n anchorWidth={anchorWidth}\n anchorRef={anchorRef}\n className={className}\n onClose={onClose}\n >\n {children}\n </Panel>\n );\n});\n\nexport default ResponsivePanel;\n"],"names":["ResponsivePanel","forwardRef","anchorRef","arrow","flip","children","className","undefined","onClose","open","position","Position","BOTTOM","anchorWidth","reference","isMobile","useLayout","_jsx","BottomSheet","Panel","ref"],"mappings":";;;;;;;;;AAQA,MAAMA,eAAe,gBAAGC,gBAAU,CAA6B,SAASD,eAAeA,CACrF;EACEE,SAAS;AACTC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,IAAI,GAAG,IAAI;EACXC,QAAQ;AACRC,EAAAA,SAAS,GAAGC,SAAS;EACrBC,OAAO;AACPC,EAAAA,IAAI,GAAG,KAAK;YACZC,UAAQ,GAAGC,iBAAQ,CAACC,MAAM;AAC1BC,EAAAA,WAAW,GAAG,KAAA;AAAK,CACR,EACbC,SAAS,EAAA;EAET,MAAM;AAAEC,IAAAA,QAAAA;GAAU,GAAGC,mBAAS,EAAE,CAAA;AAChC,EAAA,IAAID,QAAQ,EAAE;IACZ,oBACEE,cAAA,CAACC,WAAW,EAAA;AAAmBT,MAAAA,IAAI,EAAEA,IAAK;AAACH,MAAAA,SAAS,EAAEA,SAAU;AAACE,MAAAA,OAAO,EAAEA,OAAQ;AAAAH,MAAAA,QAAA,EAC/EA,QAAAA;AAAQ,KAAA,EADM,aAEJ,CAAC,CAAA;AAElB,GAAA;EACA,oBACEY,cAAA,CAACE,KAAK,EAAA;AAEJC,IAAAA,GAAG,EAAEN,SAAU;AACfV,IAAAA,IAAI,EAAEA,IAAK;AACXD,IAAAA,KAAK,EAAEA,KAAM;AACbM,IAAAA,IAAI,EAAEA,IAAK;AACXC,IAAAA,QAAQ,EAAEA,UAAS;AACnBG,IAAAA,WAAW,EAAEA,WAAY;AACzBX,IAAAA,SAAS,EAAEA,SAAU;AACrBI,IAAAA,SAAS,EAAEA,SAAU;AACrBE,IAAAA,OAAO,EAAEA,OAAQ;AAAAH,IAAAA,QAAA,EAEhBA,QAAAA;AAAQ,GAAA,EAXL,OAYC,CAAC,CAAA;AAEZ,CAAC;;;;"}
@@ -13,7 +13,8 @@ const ResponsivePanel = /*#__PURE__*/forwardRef(function ResponsivePanel({
13
13
  className = undefined,
14
14
  onClose,
15
15
  open = false,
16
- position = Position.BOTTOM
16
+ position = Position.BOTTOM,
17
+ anchorWidth = false
17
18
  }, reference) {
18
19
  const {
19
20
  isMobile
@@ -32,6 +33,7 @@ const ResponsivePanel = /*#__PURE__*/forwardRef(function ResponsivePanel({
32
33
  arrow: arrow,
33
34
  open: open,
34
35
  position: position,
36
+ anchorWidth: anchorWidth,
35
37
  anchorRef: anchorRef,
36
38
  className: className,
37
39
  onClose: onClose,
@@ -1 +1 @@
1
- {"version":3,"file":"ResponsivePanel.mjs","sources":["../../../src/common/responsivePanel/ResponsivePanel.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { Position } from '..';\nimport BottomSheet from '../bottomSheet';\nimport { useLayout } from '../hooks';\nimport Panel from '../panel';\nimport { PanelProps } from '../panel/Panel';\n\nconst ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function ResponsivePanel(\n {\n anchorRef,\n arrow = false,\n flip = true,\n children,\n className = undefined,\n onClose,\n open = false,\n position = Position.BOTTOM,\n }: PanelProps,\n reference,\n) {\n const { isMobile } = useLayout();\n if (isMobile) {\n return (\n <BottomSheet key=\"bottomSheet\" open={open} className={className} onClose={onClose}>\n {children}\n </BottomSheet>\n );\n }\n return (\n <Panel\n key=\"panel\"\n ref={reference}\n flip={flip}\n arrow={arrow}\n open={open}\n position={position}\n anchorRef={anchorRef}\n className={className}\n onClose={onClose}\n >\n {children}\n </Panel>\n );\n});\n\nexport default ResponsivePanel;\n"],"names":["ResponsivePanel","forwardRef","anchorRef","arrow","flip","children","className","undefined","onClose","open","position","Position","BOTTOM","reference","isMobile","useLayout","_jsx","BottomSheet","Panel","ref"],"mappings":";;;;;;;AAQA,MAAMA,eAAe,gBAAGC,UAAU,CAA6B,SAASD,eAAeA,CACrF;EACEE,SAAS;AACTC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,IAAI,GAAG,IAAI;EACXC,QAAQ;AACRC,EAAAA,SAAS,GAAGC,SAAS;EACrBC,OAAO;AACPC,EAAAA,IAAI,GAAG,KAAK;EACZC,QAAQ,GAAGC,QAAQ,CAACC,MAAAA;AAAM,CACf,EACbC,SAAS,EAAA;EAET,MAAM;AAAEC,IAAAA,QAAAA;GAAU,GAAGC,SAAS,EAAE,CAAA;AAChC,EAAA,IAAID,QAAQ,EAAE;IACZ,oBACEE,GAAA,CAACC,WAAW,EAAA;AAAmBR,MAAAA,IAAI,EAAEA,IAAK;AAACH,MAAAA,SAAS,EAAEA,SAAU;AAACE,MAAAA,OAAO,EAAEA,OAAQ;AAAAH,MAAAA,QAAA,EAC/EA,QAAAA;AAAQ,KAAA,EADM,aAEJ,CAAC,CAAA;AAElB,GAAA;EACA,oBACEW,GAAA,CAACE,KAAK,EAAA;AAEJC,IAAAA,GAAG,EAAEN,SAAU;AACfT,IAAAA,IAAI,EAAEA,IAAK;AACXD,IAAAA,KAAK,EAAEA,KAAM;AACbM,IAAAA,IAAI,EAAEA,IAAK;AACXC,IAAAA,QAAQ,EAAEA,QAAS;AACnBR,IAAAA,SAAS,EAAEA,SAAU;AACrBI,IAAAA,SAAS,EAAEA,SAAU;AACrBE,IAAAA,OAAO,EAAEA,OAAQ;AAAAH,IAAAA,QAAA,EAEhBA,QAAAA;AAAQ,GAAA,EAVL,OAWC,CAAC,CAAA;AAEZ,CAAC;;;;"}
1
+ {"version":3,"file":"ResponsivePanel.mjs","sources":["../../../src/common/responsivePanel/ResponsivePanel.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { Position } from '..';\nimport BottomSheet from '../bottomSheet';\nimport { useLayout } from '../hooks';\nimport Panel from '../panel';\nimport { PanelProps } from '../panel/Panel';\n\nconst ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function ResponsivePanel(\n {\n anchorRef,\n arrow = false,\n flip = true,\n children,\n className = undefined,\n onClose,\n open = false,\n position = Position.BOTTOM,\n anchorWidth = false,\n }: PanelProps,\n reference,\n) {\n const { isMobile } = useLayout();\n if (isMobile) {\n return (\n <BottomSheet key=\"bottomSheet\" open={open} className={className} onClose={onClose}>\n {children}\n </BottomSheet>\n );\n }\n return (\n <Panel\n key=\"panel\"\n ref={reference}\n flip={flip}\n arrow={arrow}\n open={open}\n position={position}\n anchorWidth={anchorWidth}\n anchorRef={anchorRef}\n className={className}\n onClose={onClose}\n >\n {children}\n </Panel>\n );\n});\n\nexport default ResponsivePanel;\n"],"names":["ResponsivePanel","forwardRef","anchorRef","arrow","flip","children","className","undefined","onClose","open","position","Position","BOTTOM","anchorWidth","reference","isMobile","useLayout","_jsx","BottomSheet","Panel","ref"],"mappings":";;;;;;;AAQA,MAAMA,eAAe,gBAAGC,UAAU,CAA6B,SAASD,eAAeA,CACrF;EACEE,SAAS;AACTC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,IAAI,GAAG,IAAI;EACXC,QAAQ;AACRC,EAAAA,SAAS,GAAGC,SAAS;EACrBC,OAAO;AACPC,EAAAA,IAAI,GAAG,KAAK;EACZC,QAAQ,GAAGC,QAAQ,CAACC,MAAM;AAC1BC,EAAAA,WAAW,GAAG,KAAA;AAAK,CACR,EACbC,SAAS,EAAA;EAET,MAAM;AAAEC,IAAAA,QAAAA;GAAU,GAAGC,SAAS,EAAE,CAAA;AAChC,EAAA,IAAID,QAAQ,EAAE;IACZ,oBACEE,GAAA,CAACC,WAAW,EAAA;AAAmBT,MAAAA,IAAI,EAAEA,IAAK;AAACH,MAAAA,SAAS,EAAEA,SAAU;AAACE,MAAAA,OAAO,EAAEA,OAAQ;AAAAH,MAAAA,QAAA,EAC/EA,QAAAA;AAAQ,KAAA,EADM,aAEJ,CAAC,CAAA;AAElB,GAAA;EACA,oBACEY,GAAA,CAACE,KAAK,EAAA;AAEJC,IAAAA,GAAG,EAAEN,SAAU;AACfV,IAAAA,IAAI,EAAEA,IAAK;AACXD,IAAAA,KAAK,EAAEA,KAAM;AACbM,IAAAA,IAAI,EAAEA,IAAK;AACXC,IAAAA,QAAQ,EAAEA,QAAS;AACnBG,IAAAA,WAAW,EAAEA,WAAY;AACzBX,IAAAA,SAAS,EAAEA,SAAU;AACrBI,IAAAA,SAAS,EAAEA,SAAU;AACrBE,IAAAA,OAAO,EAAEA,OAAQ;AAAAH,IAAAA,QAAA,EAEhBA,QAAAA;AAAQ,GAAA,EAXL,OAYC,CAAC,CAAA;AAEZ,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DateInput.js","sources":["../../src/dateInput/DateInput.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { useState } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { Body, Input, SelectInput, SelectInputOptionContent, SelectInputProps } from '..';\nimport {\n DateMode,\n MonthFormat,\n Size,\n SizeLarge,\n SizeMedium,\n SizeSmall,\n Typography,\n} from '../common';\nimport { MDY, YMD, getMonthNames, isDateValid, isMonthAndYearFormat } from '../common/dateUtils';\nimport { useInputAttributes } from '../inputs/contexts';\nimport messages from './DateInput.messages';\nimport { convertToLocalMidnight } from './utils';\n\nexport interface DateInputProps {\n /** @deprecated Use `Field` wrapper or the `aria-labelledby` attribute instead. */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n disabled?: boolean;\n size?: SizeSmall | SizeMedium | SizeLarge;\n value?: Date | string;\n onChange: (value: string | null) => void;\n onFocus?: React.FocusEventHandler<HTMLDivElement>;\n onBlur?: React.FocusEventHandler<HTMLDivElement>;\n dayLabel?: string;\n dayAutoComplete?: string;\n monthLabel?: string;\n yearLabel?: string;\n yearAutoComplete?: string;\n monthFormat?: `${MonthFormat}`;\n mode?: `${DateMode}`;\n placeholders?: {\n day?: string;\n month?: string;\n year?: string;\n };\n id?: string;\n selectProps?: Partial<SelectInputProps<number | null>>;\n}\n\nconst DateInput = ({\n 'aria-labelledby': ariaLabelledByProp,\n 'aria-label': ariaLabel,\n disabled = false,\n size = Size.MEDIUM,\n value,\n dayLabel,\n dayAutoComplete,\n monthLabel,\n yearLabel,\n yearAutoComplete,\n monthFormat = MonthFormat.LONG,\n mode = DateMode.DAY_MONTH_YEAR,\n onChange,\n onFocus,\n onBlur,\n placeholders,\n id: idProp,\n selectProps = {},\n}: DateInputProps) => {\n const inputAttributes = useInputAttributes({ nonLabelable: true });\n const id = idProp ?? inputAttributes.id;\n const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes['aria-labelledby'];\n\n const { locale, formatMessage } = useIntl();\n\n const getDateObject = (): Date | undefined => {\n if (value && isDateValid(value)) {\n return typeof value === 'string' ? convertToLocalMidnight(value) : value;\n }\n return undefined;\n };\n\n const getInitialDate = (unit: 'year' | 'month' | 'day'): number | null => {\n if (value && isDateValid(value)) {\n const dateObject = getDateObject();\n\n if (typeof value === 'string' && isMonthAndYearFormat(value) && unit === 'day') {\n return null;\n }\n\n if (dateObject !== undefined) {\n switch (unit) {\n case 'year':\n return dateObject.getFullYear();\n case 'month':\n return dateObject.getMonth();\n case 'day':\n return dateObject.getDate();\n default:\n return null;\n }\n }\n }\n return null;\n };\n\n const [day, setDay] = useState(() => getInitialDate('day'));\n const [displayDay, setDisplayDay] = useState(day?.toString());\n const [month, setMonth] = useState(() => getInitialDate('month'));\n const [year, setYear] = useState(() => getInitialDate('year'));\n const [displayYear, setDisplayYear] = useState(year?.toString());\n const [lastBroadcastedValue, setLastBroadcastedValue] = useState<Date | null | undefined>(\n getDateObject,\n );\n const monthNames = getMonthNames(locale, monthFormat);\n\n dayLabel ||= formatMessage(messages.dayLabel);\n monthLabel ||= formatMessage(messages.monthLabel);\n yearLabel ||= formatMessage(messages.yearLabel);\n placeholders = {\n day: placeholders?.day || formatMessage(messages.dayPlaceholder),\n month: placeholders?.month || formatMessage(messages.monthLabel),\n year: placeholders?.year || formatMessage(messages.yearPlaceholder),\n };\n\n const getDateAsString = (date: Date) => {\n if (!isDateValid(date)) {\n return '';\n }\n switch (mode) {\n case DateMode.MONTH_YEAR:\n return [date.getFullYear(), `0${date.getMonth() + 1}`.slice(-2)].join('-');\n case DateMode.DAY_MONTH_YEAR:\n default:\n return [\n date.getFullYear(),\n `0${date.getMonth() + 1}`.slice(-2),\n `0${date.getDate()}`.slice(-2),\n ].join('-');\n }\n };\n\n const getSelectElement = () => {\n return (\n <label className=\"d-flex flex-column\">\n <Body type={Typography.BODY_DEFAULT}>{monthLabel}</Body>\n <SelectInput\n name=\"month\"\n disabled={disabled}\n placeholder={placeholders?.month}\n items={Array.from({ length: 12 }, (_, index) => ({ type: 'option', value: index }))}\n size={size}\n value={month}\n renderValue={(selectedValue) => (\n <SelectInputOptionContent title={monthNames[selectedValue]} />\n )}\n onChange={(selectedValue) => handleMonthChange(selectedValue)}\n {...selectProps}\n />\n </label>\n );\n };\n\n const isDayValid = (newDay: number, newMonth: number, newYear: number) => {\n const maxDay = new Date(newYear, newMonth + 1, 0).getDate();\n return newDay <= maxDay;\n };\n\n const handleInternalValue = (newDay = day, newMonth = month, newYear = year) => {\n if (newDay == null || newDay === 0 || newMonth == null || newYear == null || newYear === 0) {\n broadcastNewValue(null);\n return;\n }\n if (!isDayValid(newDay, newMonth, newYear)) {\n broadcastNewValue(null);\n return;\n }\n\n const dateValue = new Date(newYear, newMonth, newDay);\n if (newYear < 100) {\n dateValue.setFullYear(newYear);\n }\n\n if (!isDateValid(dateValue)) {\n broadcastNewValue(null);\n return;\n }\n\n if (mode === DateMode.MONTH_YEAR) {\n if (newMonth !== month || newYear !== year) {\n broadcastNewValue(dateValue);\n }\n } else if (newDay !== day || newMonth !== month || newYear !== year) {\n broadcastNewValue(dateValue);\n }\n };\n\n const handleDayChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const newDayString = event.target.value.replace(/\\D/g, '');\n const newDayNumber = Number.parseInt(newDayString, 10);\n\n setDay(newDayNumber);\n setDisplayDay(newDayString);\n handleInternalValue(newDayNumber, month, year);\n };\n\n const handleMonthChange = (selectedMonth: number | null) => {\n if (selectedMonth === null) {\n setMonth(null);\n handleInternalValue(day, null, year);\n return;\n }\n setMonth(selectedMonth);\n handleInternalValue(day, selectedMonth, year);\n };\n\n const handleYearChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const newYearString = event.target.value.replace(/\\D/g, '');\n const newYearNumber = Number.parseInt(newYearString, 10);\n\n if (newYearString.length >= 4 && newYearString.length <= 6) {\n setYear(newYearNumber);\n setDisplayYear(newYearString);\n handleInternalValue(day, month, newYearNumber);\n } else {\n setYear(null);\n setDisplayYear(newYearString);\n handleInternalValue(day, month, null);\n }\n };\n\n const broadcastNewValue = (newValue: Date | null) => {\n if (newValue !== lastBroadcastedValue) {\n setLastBroadcastedValue(newValue);\n onChange(newValue != null ? getDateAsString(newValue) : null);\n }\n };\n\n const monthYearOnly = mode === DateMode.MONTH_YEAR;\n\n const monthWidth = classNames({\n 'col-sm-8': monthYearOnly,\n 'col-sm-5': !monthYearOnly,\n });\n\n const getMonth = () => {\n return <div className={monthWidth}>{getSelectElement()}</div>;\n };\n\n const getDay = () => {\n return (\n <div className=\"col-sm-3\">\n <label>\n <Body type={Typography.BODY_DEFAULT}>{dayLabel}</Body>\n <div className={`input-group input-group-${size}`}>\n <Input\n type=\"text\"\n inputMode=\"numeric\"\n pattern=\"[0-9]*\"\n name=\"day\"\n autoComplete={dayAutoComplete}\n value={displayDay || ''}\n placeholder={placeholders?.day}\n disabled={disabled}\n min={1}\n max={31}\n maxLength={2}\n onChange={(event) => handleDayChange(event)}\n />\n </div>\n </label>\n </div>\n );\n };\n\n const getYear = () => {\n return (\n <div className=\"col-sm-4\">\n <label>\n <Body type={Typography.BODY_DEFAULT}>{yearLabel}</Body>\n <div className={`input-group input-group-${size}`}>\n <Input\n type=\"text\"\n inputMode=\"numeric\"\n pattern=\"[0-9]*\"\n name=\"year\"\n autoComplete={yearAutoComplete}\n placeholder={placeholders?.year}\n value={displayYear || ''}\n disabled={disabled}\n min={0}\n max={9999}\n maxLength={6}\n onChange={(event) => handleYearChange(event)}\n />\n </div>\n </label>\n </div>\n );\n };\n const monthBeforeDay = MDY.has(locale);\n const yearFirst = YMD.has(locale);\n\n return (\n <div\n className=\"tw-date\"\n {...inputAttributes}\n id={id}\n aria-labelledby={ariaLabelledBy}\n aria-label={ariaLabel}\n role=\"group\" // Add role attribute to indicate container for interactive elements\n onFocus={(event) =>\n shouldPropagateOnFocus(event) ? onFocus && onFocus(event) : event.stopPropagation()\n }\n onBlur={(event) =>\n shouldPropagateOnBlur(event) ? onBlur && onBlur(event) : event.stopPropagation()\n }\n >\n <div className=\"row\">\n {(() => {\n if (monthYearOnly) {\n return (\n <>\n {!yearFirst && getMonth()}\n {getYear()}\n {yearFirst && getMonth()}\n </>\n );\n }\n if (monthBeforeDay) {\n return (\n <>\n {getMonth()}\n {getDay()}\n {getYear()}\n </>\n );\n }\n if (yearFirst) {\n return (\n <>\n {getYear()}\n {getMonth()}\n {getDay()}\n </>\n );\n }\n return (\n <>\n {getDay()}\n {getMonth()}\n {getYear()}\n </>\n );\n })()}\n </div>\n </div>\n );\n};\n\n// Should only propagate if the relatedTarget is not part of this DateInput component.\nfunction shouldPropagateOnFocus({\n target,\n relatedTarget,\n}: Pick<React.FocusEvent, 'target' | 'relatedTarget'>) {\n const targetParent = target.closest('.tw-date');\n const relatedParent = relatedTarget && relatedTarget.closest('.tw-date');\n return targetParent !== relatedParent;\n}\n\n// Should only propagate if the relatedTarget or the activeElement is not part of this DateInput component.\nfunction shouldPropagateOnBlur({\n target,\n relatedTarget,\n}: Pick<React.FocusEvent, 'target' | 'relatedTarget'>) {\n const blurElementParent = target.closest('.tw-date');\n // Even though FocusEvent.relatedTarget is supported by IE\n // (https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/relatedTarget)\n // \"IE11 sets document.activeElement to the next focused element before the blur event is called.\"\n // (https://stackoverflow.com/a/49325196/986241)\n // Therefore if the relatedTarget is null, we try the document.activeElement,\n // which may contain the HTML element that is gaining focus\n const focusElement =\n relatedTarget || (document.activeElement !== target ? document.activeElement : null);\n const focusElementParent = focusElement && focusElement.closest('.tw-date');\n return blurElementParent !== focusElementParent;\n}\n\nexport default DateInput;\n"],"names":["DateInput","ariaLabelledByProp","ariaLabel","disabled","size","Size","MEDIUM","value","dayLabel","dayAutoComplete","monthLabel","yearLabel","yearAutoComplete","monthFormat","MonthFormat","LONG","mode","DateMode","DAY_MONTH_YEAR","onChange","onFocus","onBlur","placeholders","id","idProp","selectProps","inputAttributes","useInputAttributes","nonLabelable","ariaLabelledBy","locale","formatMessage","useIntl","getDateObject","isDateValid","convertToLocalMidnight","undefined","getInitialDate","unit","dateObject","isMonthAndYearFormat","getFullYear","getMonth","getDate","day","setDay","useState","displayDay","setDisplayDay","toString","month","setMonth","year","setYear","displayYear","setDisplayYear","lastBroadcastedValue","setLastBroadcastedValue","monthNames","getMonthNames","messages","dayPlaceholder","yearPlaceholder","getDateAsString","date","MONTH_YEAR","slice","join","getSelectElement","_jsxs","className","children","_jsx","Body","type","Typography","BODY_DEFAULT","SelectInput","name","placeholder","items","Array","from","length","_","index","renderValue","selectedValue","SelectInputOptionContent","title","handleMonthChange","isDayValid","newDay","newMonth","newYear","maxDay","Date","handleInternalValue","broadcastNewValue","dateValue","setFullYear","handleDayChange","event","newDayString","target","replace","newDayNumber","Number","parseInt","selectedMonth","handleYearChange","newYearString","newYearNumber","newValue","monthYearOnly","monthWidth","classNames","getDay","Input","inputMode","pattern","autoComplete","min","max","maxLength","getYear","monthBeforeDay","MDY","has","yearFirst","YMD","role","shouldPropagateOnFocus","stopPropagation","shouldPropagateOnBlur","_Fragment","relatedTarget","targetParent","closest","relatedParent","blurElementParent","focusElement","document","activeElement","focusElementParent"],"mappings":";;;;;;;;;;;;;;;;;;;;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AACnD,EAAA,MAAMI,iBAAiB,GAAGpC,MAAM,CAACkC,OAAO,CAAC,UAAU,CAAC,CAAA;AACpD;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,MAAMG,YAAY,GAChBL,aAAa,KAAKM,QAAQ,CAACC,aAAa,KAAKvC,MAAM,GAAGsC,QAAQ,CAACC,aAAa,GAAG,IAAI,CAAC,CAAA;EACtF,MAAMC,kBAAkB,GAAGH,YAAY,IAAIA,YAAY,CAACH,OAAO,CAAC,UAAU,CAAC,CAAA;EAC3E,OAAOE,iBAAiB,KAAKI,kBAAkB,CAAA;AACjD;;;;"}
1
+ {"version":3,"file":"DateInput.js","sources":["../../src/dateInput/DateInput.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { useState } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { Body, Input, SelectInput, SelectInputOptionContent, SelectInputProps } from '..';\nimport {\n DateMode,\n MonthFormat,\n Size,\n SizeLarge,\n SizeMedium,\n SizeSmall,\n Typography,\n} from '../common';\nimport { MDY, YMD, getMonthNames, isDateValid, isMonthAndYearFormat } from '../common/dateUtils';\nimport { useInputAttributes } from '../inputs/contexts';\nimport messages from './DateInput.messages';\nimport { convertToLocalMidnight } from './utils';\n\nexport interface DateInputProps {\n /** @deprecated Use `Field` wrapper or the `aria-labelledby` attribute instead. */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n disabled?: boolean;\n size?: SizeSmall | SizeMedium | SizeLarge;\n value?: Date | string;\n onChange: (value: string | null) => void;\n onFocus?: React.FocusEventHandler<HTMLDivElement>;\n onBlur?: React.FocusEventHandler<HTMLDivElement>;\n dayLabel?: string;\n dayAutoComplete?: string;\n monthLabel?: string;\n yearLabel?: string;\n yearAutoComplete?: string;\n monthFormat?: `${MonthFormat}`;\n mode?: `${DateMode}`;\n placeholders?: {\n day?: string;\n month?: string;\n year?: string;\n };\n id?: string;\n selectProps?: Partial<SelectInputProps<number | null>>;\n}\n\nconst DateInput = ({\n 'aria-labelledby': ariaLabelledByProp,\n 'aria-label': ariaLabel,\n disabled = false,\n size = Size.MEDIUM,\n value,\n dayLabel,\n dayAutoComplete,\n monthLabel,\n yearLabel,\n yearAutoComplete,\n monthFormat = MonthFormat.LONG,\n mode = DateMode.DAY_MONTH_YEAR,\n onChange,\n onFocus,\n onBlur,\n placeholders,\n id: idProp,\n selectProps = {},\n}: DateInputProps) => {\n const inputAttributes = useInputAttributes({ nonLabelable: true });\n const id = idProp ?? inputAttributes.id;\n const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes['aria-labelledby'];\n\n const { locale, formatMessage } = useIntl();\n\n const getDateObject = (): Date | undefined => {\n if (value && isDateValid(value)) {\n return typeof value === 'string' ? convertToLocalMidnight(value) : value;\n }\n return undefined;\n };\n\n const getInitialDate = (unit: 'year' | 'month' | 'day'): number | null => {\n if (value && isDateValid(value)) {\n const dateObject = getDateObject();\n\n if (typeof value === 'string' && isMonthAndYearFormat(value) && unit === 'day') {\n return null;\n }\n\n if (dateObject !== undefined) {\n switch (unit) {\n case 'year':\n return dateObject.getFullYear();\n case 'month':\n return dateObject.getMonth();\n case 'day':\n return dateObject.getDate();\n default:\n return null;\n }\n }\n }\n return null;\n };\n\n const [day, setDay] = useState(() => getInitialDate('day'));\n const [displayDay, setDisplayDay] = useState(day?.toString());\n const [month, setMonth] = useState(() => getInitialDate('month'));\n const [year, setYear] = useState(() => getInitialDate('year'));\n const [displayYear, setDisplayYear] = useState(year?.toString());\n const [lastBroadcastedValue, setLastBroadcastedValue] = useState<Date | null | undefined>(\n getDateObject,\n );\n const monthNames = getMonthNames(locale, monthFormat);\n\n dayLabel ||= formatMessage(messages.dayLabel);\n monthLabel ||= formatMessage(messages.monthLabel);\n yearLabel ||= formatMessage(messages.yearLabel);\n placeholders = {\n day: placeholders?.day || formatMessage(messages.dayPlaceholder),\n month: placeholders?.month || formatMessage(messages.monthLabel),\n year: placeholders?.year || formatMessage(messages.yearPlaceholder),\n };\n\n const getDateAsString = (date: Date) => {\n if (!isDateValid(date)) {\n return '';\n }\n switch (mode) {\n case DateMode.MONTH_YEAR:\n return [date.getFullYear(), `0${date.getMonth() + 1}`.slice(-2)].join('-');\n case DateMode.DAY_MONTH_YEAR:\n default:\n return [\n date.getFullYear(),\n `0${date.getMonth() + 1}`.slice(-2),\n `0${date.getDate()}`.slice(-2),\n ].join('-');\n }\n };\n\n const getSelectElement = () => {\n return (\n <label className=\"d-flex flex-column\">\n <Body type={Typography.BODY_DEFAULT}>{monthLabel}</Body>\n <SelectInput\n name=\"month\"\n disabled={disabled}\n placeholder={placeholders?.month}\n items={Array.from({ length: 12 }, (_, index) => ({ type: 'option', value: index }))}\n size={size}\n value={month}\n renderValue={(selectedValue) => (\n <SelectInputOptionContent title={monthNames[selectedValue]} />\n )}\n onChange={(selectedValue) => handleMonthChange(selectedValue)}\n {...selectProps}\n />\n </label>\n );\n };\n\n const isDayValid = (newDay: number, newMonth: number, newYear: number) => {\n const maxDay = new Date(newYear, newMonth + 1, 0).getDate();\n return newDay <= maxDay;\n };\n\n const handleInternalValue = (newDay = day, newMonth = month, newYear = year) => {\n if (newDay == null || newDay === 0 || newMonth == null || newYear == null || newYear === 0) {\n broadcastNewValue(null);\n return;\n }\n if (!isDayValid(newDay, newMonth, newYear)) {\n broadcastNewValue(null);\n return;\n }\n\n const dateValue = new Date(newYear, newMonth, newDay);\n if (newYear < 100) {\n dateValue.setFullYear(newYear);\n }\n\n if (!isDateValid(dateValue)) {\n broadcastNewValue(null);\n return;\n }\n\n if (mode === DateMode.MONTH_YEAR) {\n if (newMonth !== month || newYear !== year) {\n broadcastNewValue(dateValue);\n }\n } else if (newDay !== day || newMonth !== month || newYear !== year) {\n broadcastNewValue(dateValue);\n }\n };\n\n const handleDayChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const newDayString = event.target.value.replace(/\\D/g, '');\n const newDayNumber = Number.parseInt(newDayString, 10);\n\n setDay(newDayNumber);\n setDisplayDay(newDayString);\n handleInternalValue(newDayNumber, month, year);\n };\n\n const handleMonthChange = (selectedMonth: number | null) => {\n if (selectedMonth === null) {\n setMonth(null);\n handleInternalValue(day, null, year);\n return;\n }\n setMonth(selectedMonth);\n handleInternalValue(day, selectedMonth, year);\n };\n\n const handleYearChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const newYearString = event.target.value.replace(/\\D/g, '');\n const newYearNumber = Number.parseInt(newYearString, 10);\n\n if (newYearString.length >= 4 && newYearString.length <= 6) {\n setYear(newYearNumber);\n setDisplayYear(newYearString);\n handleInternalValue(day, month, newYearNumber);\n } else {\n setYear(null);\n setDisplayYear(newYearString);\n handleInternalValue(day, month, null);\n }\n };\n\n const broadcastNewValue = (newValue: Date | null) => {\n if (newValue !== lastBroadcastedValue) {\n setLastBroadcastedValue(newValue);\n onChange(newValue != null ? getDateAsString(newValue) : null);\n }\n };\n\n const monthYearOnly = mode === DateMode.MONTH_YEAR;\n\n const monthWidth = classNames({\n 'col-sm-8': monthYearOnly,\n 'col-sm-5': !monthYearOnly,\n });\n\n const getMonth = () => {\n return <div className={monthWidth}>{getSelectElement()}</div>;\n };\n\n const getDay = () => {\n return (\n <div className=\"col-sm-3\">\n <label>\n <Body type={Typography.BODY_DEFAULT}>{dayLabel}</Body>\n <div className={`input-group input-group-${size}`}>\n <Input\n type=\"text\"\n inputMode=\"numeric\"\n pattern=\"[0-9]*\"\n name=\"day\"\n autoComplete={dayAutoComplete}\n value={displayDay || ''}\n placeholder={placeholders?.day}\n disabled={disabled}\n min={1}\n max={31}\n maxLength={2}\n onChange={(event) => handleDayChange(event)}\n />\n </div>\n </label>\n </div>\n );\n };\n\n const getYear = () => {\n return (\n <div className=\"col-sm-4\">\n <label>\n <Body type={Typography.BODY_DEFAULT}>{yearLabel}</Body>\n <div className={`input-group input-group-${size}`}>\n <Input\n type=\"text\"\n inputMode=\"numeric\"\n pattern=\"[0-9]*\"\n name=\"year\"\n autoComplete={yearAutoComplete}\n placeholder={placeholders?.year}\n value={displayYear || ''}\n disabled={disabled}\n min={0}\n max={9999}\n maxLength={6}\n onChange={(event) => handleYearChange(event)}\n />\n </div>\n </label>\n </div>\n );\n };\n const monthBeforeDay = MDY.has(locale);\n const yearFirst = YMD.has(locale);\n\n return (\n <div\n className=\"tw-date\"\n {...inputAttributes}\n id={id}\n aria-labelledby={ariaLabelledBy}\n aria-label={ariaLabel}\n role=\"group\" // Add role attribute to indicate container for interactive elements\n onFocus={(event) =>\n shouldPropagateOnFocus(event) ? onFocus && onFocus(event) : event.stopPropagation()\n }\n onBlur={(event) =>\n shouldPropagateOnBlur(event) ? onBlur && onBlur(event) : event.stopPropagation()\n }\n >\n <div className=\"row\">\n {(() => {\n if (monthYearOnly) {\n return (\n <>\n {!yearFirst && getMonth()}\n {getYear()}\n {yearFirst && getMonth()}\n </>\n );\n }\n if (monthBeforeDay) {\n return (\n <>\n {getMonth()}\n {getDay()}\n {getYear()}\n </>\n );\n }\n if (yearFirst) {\n return (\n <>\n {getYear()}\n {getMonth()}\n {getDay()}\n </>\n );\n }\n return (\n <>\n {getDay()}\n {getMonth()}\n {getYear()}\n </>\n );\n })()}\n </div>\n </div>\n );\n};\n\n// Should only propagate if the relatedTarget is not part of this DateInput component.\nfunction shouldPropagateOnFocus({\n target,\n relatedTarget,\n}: Pick<React.FocusEvent, 'target' | 'relatedTarget'>) {\n const targetParent = target.closest('.tw-date');\n const relatedParent = relatedTarget && relatedTarget.closest('.tw-date');\n return targetParent !== relatedParent;\n}\n\n// Should only propagate if the relatedTarget or the activeElement is not part of this DateInput component.\nfunction shouldPropagateOnBlur({\n target,\n relatedTarget,\n}: Pick<React.FocusEvent, 'target' | 'relatedTarget'>) {\n const blurElementParent = target.closest('.tw-date');\n // Even though FocusEvent.relatedTarget is supported by IE\n // (https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/relatedTarget)\n // \"IE11 sets document.activeElement to the next focused element before the blur event is called.\"\n // (https://stackoverflow.com/a/49325196/986241)\n // Therefore if the relatedTarget is null, we try the document.activeElement,\n // which may contain the HTML element that is gaining focus\n const focusElement =\n relatedTarget || (document.activeElement !== target ? document.activeElement : null);\n const focusElementParent = focusElement && focusElement.closest('.tw-date');\n return blurElementParent !== focusElementParent;\n}\n\nexport default DateInput;\n"],"names":["DateInput","ariaLabelledByProp","ariaLabel","disabled","size","Size","MEDIUM","value","dayLabel","dayAutoComplete","monthLabel","yearLabel","yearAutoComplete","monthFormat","MonthFormat","LONG","mode","DateMode","DAY_MONTH_YEAR","onChange","onFocus","onBlur","placeholders","id","idProp","selectProps","inputAttributes","useInputAttributes","nonLabelable","ariaLabelledBy","locale","formatMessage","useIntl","getDateObject","isDateValid","convertToLocalMidnight","undefined","getInitialDate","unit","dateObject","isMonthAndYearFormat","getFullYear","getMonth","getDate","day","setDay","useState","displayDay","setDisplayDay","toString","month","setMonth","year","setYear","displayYear","setDisplayYear","lastBroadcastedValue","setLastBroadcastedValue","monthNames","getMonthNames","messages","dayPlaceholder","yearPlaceholder","getDateAsString","date","MONTH_YEAR","slice","join","getSelectElement","_jsxs","className","children","_jsx","Body","type","Typography","BODY_DEFAULT","SelectInput","name","placeholder","items","Array","from","length","_","index","renderValue","selectedValue","SelectInputOptionContent","title","handleMonthChange","isDayValid","newDay","newMonth","newYear","maxDay","Date","handleInternalValue","broadcastNewValue","dateValue","setFullYear","handleDayChange","event","newDayString","target","replace","newDayNumber","Number","parseInt","selectedMonth","handleYearChange","newYearString","newYearNumber","newValue","monthYearOnly","monthWidth","classNames","getDay","Input","inputMode","pattern","autoComplete","min","max","maxLength","getYear","monthBeforeDay","MDY","has","yearFirst","YMD","role","shouldPropagateOnFocus","stopPropagation","shouldPropagateOnBlur","_Fragment","relatedTarget","targetParent","closest","relatedParent","blurElementParent","focusElement","document","activeElement","focusElementParent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6CMA,MAAAA,SAAS,GAAGA,CAAC;AACjB,EAAA,iBAAiB,EAAEC,kBAAkB;AACrC,EAAA,YAAY,EAAEC,SAAS;AACvBC,EAAAA,Q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