@pega/cosmos-react-core 4.0.0-dev.14.0 → 4.0.0-dev.14.1

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 (215) hide show
  1. package/lib/components/AppShell/AppHeader.styles.d.ts.map +1 -1
  2. package/lib/components/AppShell/AppHeader.styles.js +0 -2
  3. package/lib/components/AppShell/AppHeader.styles.js.map +1 -1
  4. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  5. package/lib/components/AppShell/AppShell.styles.js +0 -4
  6. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  7. package/lib/components/AppShell/AppShell.types.d.ts +6 -5
  8. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  9. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  10. package/lib/components/AppShell/AppShellList.d.ts +1 -1
  11. package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
  12. package/lib/components/AppShell/AppShellList.js.map +1 -1
  13. package/lib/components/AppShell/AppShellList.styles.d.ts.map +1 -1
  14. package/lib/components/AppShell/AppShellList.styles.js +0 -1
  15. package/lib/components/AppShell/AppShellList.styles.js.map +1 -1
  16. package/lib/components/AppShell/NavigationList.d.ts.map +1 -1
  17. package/lib/components/AppShell/NavigationList.js.map +1 -1
  18. package/lib/components/AppShell/NavigationListItemWrapper.d.ts.map +1 -1
  19. package/lib/components/AppShell/NavigationListItemWrapper.js +31 -11
  20. package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
  21. package/lib/components/AppShell/Operator.d.ts.map +1 -1
  22. package/lib/components/AppShell/Operator.js +1 -3
  23. package/lib/components/AppShell/Operator.js.map +1 -1
  24. package/lib/components/Avatar/Avatar.d.ts +2 -2
  25. package/lib/components/Avatar/Avatar.js.map +1 -1
  26. package/lib/components/Backdrop/Backdrop.d.ts +9 -21
  27. package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
  28. package/lib/components/Backdrop/Backdrop.js +0 -2
  29. package/lib/components/Backdrop/Backdrop.js.map +1 -1
  30. package/lib/components/Badges/Count.d.ts +1 -1
  31. package/lib/components/Badges/Count.js.map +1 -1
  32. package/lib/components/Banner/Banner.d.ts +1 -1
  33. package/lib/components/Banner/Banner.js.map +1 -1
  34. package/lib/components/Boolean/BooleanDisplay.d.ts +2 -2
  35. package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
  36. package/lib/components/Button/BareButton.d.ts +1 -1
  37. package/lib/components/Button/BareButton.js.map +1 -1
  38. package/lib/components/Button/Button.d.ts +4 -8
  39. package/lib/components/Button/Button.d.ts.map +1 -1
  40. package/lib/components/Button/Button.js.map +1 -1
  41. package/lib/components/ColorPicker/ColorPicker.d.ts +1 -1
  42. package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
  43. package/lib/components/CompositeInput/CompositeInput.types.d.ts +2 -6
  44. package/lib/components/CompositeInput/CompositeInput.types.d.ts.map +1 -1
  45. package/lib/components/CompositeInput/CompositeInput.types.js.map +1 -1
  46. package/lib/components/Configuration/Configuration.d.ts +9 -27
  47. package/lib/components/Configuration/Configuration.d.ts.map +1 -1
  48. package/lib/components/Configuration/Configuration.js.map +1 -1
  49. package/lib/components/CreditCard/utils.d.ts +1 -1
  50. package/lib/components/CreditCard/utils.d.ts.map +1 -1
  51. package/lib/components/CreditCard/utils.js +1 -1
  52. package/lib/components/CreditCard/utils.js.map +1 -1
  53. package/lib/components/Currency/CurrencyInput.types.d.ts +3 -7
  54. package/lib/components/Currency/CurrencyInput.types.d.ts.map +1 -1
  55. package/lib/components/Currency/CurrencyInput.types.js.map +1 -1
  56. package/lib/components/DateTime/DateTimeDisplay.d.ts +4 -10
  57. package/lib/components/DateTime/DateTimeDisplay.d.ts.map +1 -1
  58. package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
  59. package/lib/components/DateTime/Input/DateTimeInput.d.ts +1 -3
  60. package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
  61. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  62. package/lib/components/DateTime/Input/TimeInput.d.ts +1 -3
  63. package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
  64. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  65. package/lib/components/DateTime/Input/TimeRangeInput.d.ts +1 -3
  66. package/lib/components/DateTime/Input/TimeRangeInput.d.ts.map +1 -1
  67. package/lib/components/DateTime/Input/TimeRangeInput.js.map +1 -1
  68. package/lib/components/DateTime/Input/usePickerButton.js +3 -3
  69. package/lib/components/DateTime/Input/usePickerButton.js.map +1 -1
  70. package/lib/components/DateTime/Picker/Calendar.d.ts +4 -6
  71. package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
  72. package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
  73. package/lib/components/DateTime/Picker/DatePicker.types.d.ts +2 -4
  74. package/lib/components/DateTime/Picker/DatePicker.types.d.ts.map +1 -1
  75. package/lib/components/DateTime/Picker/DatePicker.types.js.map +1 -1
  76. package/lib/components/DateTime/Picker/TimePicker.d.ts +1 -3
  77. package/lib/components/DateTime/Picker/TimePicker.d.ts.map +1 -1
  78. package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
  79. package/lib/components/DateTime/Picker/Weeks.d.ts +1 -3
  80. package/lib/components/DateTime/Picker/Weeks.d.ts.map +1 -1
  81. package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
  82. package/lib/components/DateTime/Picker/utils.js +1 -1
  83. package/lib/components/DateTime/Picker/utils.js.map +1 -1
  84. package/lib/components/Dialog/Dialog.types.d.ts +11 -33
  85. package/lib/components/Dialog/Dialog.types.d.ts.map +1 -1
  86. package/lib/components/Dialog/Dialog.types.js.map +1 -1
  87. package/lib/components/Dialog/InfoDialog.js +1 -1
  88. package/lib/components/Dialog/InfoDialog.js.map +1 -1
  89. package/lib/components/Drawer/Drawer.d.ts +9 -9
  90. package/lib/components/Drawer/Drawer.d.ts.map +1 -1
  91. package/lib/components/Drawer/Drawer.js.map +1 -1
  92. package/lib/components/Email/EmailDisplay.d.ts +1 -1
  93. package/lib/components/Email/EmailDisplay.js.map +1 -1
  94. package/lib/components/EmojiPicker/EmojiPicker.styles.d.ts.map +1 -1
  95. package/lib/components/EmojiPicker/EmojiPicker.styles.js +1 -6
  96. package/lib/components/EmojiPicker/EmojiPicker.styles.js.map +1 -1
  97. package/lib/components/ExpandCollapse/ExpandCollapse.d.ts +6 -6
  98. package/lib/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -1
  99. package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
  100. package/lib/components/FieldGroup/FieldGroup.d.ts +1 -3
  101. package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
  102. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  103. package/lib/components/FieldValueList/FieldValueList.d.ts +1 -1
  104. package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
  105. package/lib/components/File/FileDisplay.d.ts +2 -2
  106. package/lib/components/File/FileDisplay.d.ts.map +1 -1
  107. package/lib/components/File/FileDisplay.js.map +1 -1
  108. package/lib/components/File/FileInput.d.ts +1 -3
  109. package/lib/components/File/FileInput.d.ts.map +1 -1
  110. package/lib/components/File/FileInput.js.map +1 -1
  111. package/lib/components/FormControl/FormControl.d.ts +3 -2
  112. package/lib/components/FormControl/FormControl.d.ts.map +1 -1
  113. package/lib/components/FormControl/FormControl.js.map +1 -1
  114. package/lib/components/FormField/FormField.d.ts +2 -2
  115. package/lib/components/FormField/FormField.d.ts.map +1 -1
  116. package/lib/components/FormField/FormField.js +10 -14
  117. package/lib/components/FormField/FormField.js.map +1 -1
  118. package/lib/components/Grid/Grid.d.ts.map +1 -1
  119. package/lib/components/Grid/Grid.js +0 -3
  120. package/lib/components/Grid/Grid.js.map +1 -1
  121. package/lib/components/Grid/Grid.types.d.ts +6 -6
  122. package/lib/components/Grid/Grid.types.js.map +1 -1
  123. package/lib/components/Input/Input.d.ts +1 -1
  124. package/lib/components/Input/Input.js.map +1 -1
  125. package/lib/components/Label/Label.d.ts +1 -1
  126. package/lib/components/Label/Label.js.map +1 -1
  127. package/lib/components/Lightbox/Lightbox.types.d.ts +1 -1
  128. package/lib/components/Lightbox/Lightbox.types.d.ts.map +1 -1
  129. package/lib/components/Lightbox/Lightbox.types.js.map +1 -1
  130. package/lib/components/Link/Link.d.ts +1 -1
  131. package/lib/components/Link/Link.js.map +1 -1
  132. package/lib/components/ListToolbar/ListToolbar.types.d.ts +2 -2
  133. package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
  134. package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
  135. package/lib/components/Location/LocationDisplay.d.ts +1 -1
  136. package/lib/components/Location/LocationDisplay.js.map +1 -1
  137. package/lib/components/Location/utils.d.ts +1 -1
  138. package/lib/components/Location/utils.d.ts.map +1 -1
  139. package/lib/components/Location/utils.js +1 -1
  140. package/lib/components/Location/utils.js.map +1 -1
  141. package/lib/components/Menu/Menu.types.d.ts +6 -12
  142. package/lib/components/Menu/Menu.types.d.ts.map +1 -1
  143. package/lib/components/Menu/Menu.types.js.map +1 -1
  144. package/lib/components/MenuButton/MenuButton.d.ts +1 -1
  145. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  146. package/lib/components/Modal/Modal.d.ts.map +1 -1
  147. package/lib/components/Modal/Modal.js +3 -5
  148. package/lib/components/Modal/Modal.js.map +1 -1
  149. package/lib/components/Modal/Modal.types.d.ts +25 -71
  150. package/lib/components/Modal/Modal.types.d.ts.map +1 -1
  151. package/lib/components/Modal/Modal.types.js.map +1 -1
  152. package/lib/components/MultiStepForm/HorizontalFormProgress.d.ts.map +1 -1
  153. package/lib/components/MultiStepForm/HorizontalFormProgress.js +4 -0
  154. package/lib/components/MultiStepForm/HorizontalFormProgress.js.map +1 -1
  155. package/lib/components/MultiStepForm/MultiStepForm.d.ts.map +1 -1
  156. package/lib/components/MultiStepForm/MultiStepForm.js +1 -1
  157. package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -1
  158. package/lib/components/MultiStepForm/MultiStepForm.types.d.ts +1 -1
  159. package/lib/components/MultiStepForm/MultiStepForm.types.js.map +1 -1
  160. package/lib/components/Phone/PhoneDisplay.d.ts +1 -1
  161. package/lib/components/Phone/PhoneDisplay.js.map +1 -1
  162. package/lib/components/Popover/Popover.d.ts +4 -4
  163. package/lib/components/Popover/Popover.d.ts.map +1 -1
  164. package/lib/components/Popover/Popover.js +16 -1
  165. package/lib/components/Popover/Popover.js.map +1 -1
  166. package/lib/components/Popover/modifiers.d.ts.map +1 -1
  167. package/lib/components/Popover/modifiers.js +25 -6
  168. package/lib/components/Popover/modifiers.js.map +1 -1
  169. package/lib/components/Progress/Progress.types.d.ts +2 -2
  170. package/lib/components/Progress/Progress.types.js.map +1 -1
  171. package/lib/components/SearchInput/SearchInput.d.ts +1 -1
  172. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  173. package/lib/components/Skeleton/LineSkeleton.d.ts +2 -2
  174. package/lib/components/Skeleton/LineSkeleton.js.map +1 -1
  175. package/lib/components/Skeleton/RectangleSkeleton.d.ts +3 -3
  176. package/lib/components/Skeleton/RectangleSkeleton.js.map +1 -1
  177. package/lib/components/Slider/Slider.types.d.ts +3 -9
  178. package/lib/components/Slider/Slider.types.d.ts.map +1 -1
  179. package/lib/components/Slider/Slider.types.js.map +1 -1
  180. package/lib/components/SummaryItem/SummaryItem.d.ts +2 -1
  181. package/lib/components/SummaryItem/SummaryItem.d.ts.map +1 -1
  182. package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
  183. package/lib/components/SummaryList/SummaryList.d.ts +2 -2
  184. package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
  185. package/lib/components/SummaryList/SummaryList.js.map +1 -1
  186. package/lib/components/Table/Table.d.ts +1 -1
  187. package/lib/components/Table/Table.js.map +1 -1
  188. package/lib/components/Tabs/TabPanel.d.ts +1 -1
  189. package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
  190. package/lib/components/Tabs/TabPanel.js.map +1 -1
  191. package/lib/components/Tabs/Tabs.types.d.ts +1 -1
  192. package/lib/components/Tabs/Tabs.types.js.map +1 -1
  193. package/lib/components/Text/Text.d.ts +2 -4
  194. package/lib/components/Text/Text.d.ts.map +1 -1
  195. package/lib/components/Text/Text.js.map +1 -1
  196. package/lib/components/Toaster/Toaster.types.d.ts +1 -1
  197. package/lib/components/Toaster/Toaster.types.d.ts.map +1 -1
  198. package/lib/components/Toaster/Toaster.types.js.map +1 -1
  199. package/lib/components/Tooltip/Tooltip.d.ts +3 -3
  200. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  201. package/lib/components/URL/URLDisplay.d.ts +1 -1
  202. package/lib/components/URL/URLDisplay.js +2 -2
  203. package/lib/components/URL/URLDisplay.js.map +1 -1
  204. package/lib/hooks/useArrows.js +1 -1
  205. package/lib/hooks/useArrows.js.map +1 -1
  206. package/lib/i18n/translate.d.ts +2 -6
  207. package/lib/i18n/translate.d.ts.map +1 -1
  208. package/lib/i18n/translate.js.map +1 -1
  209. package/lib/types/types.d.ts.map +1 -1
  210. package/lib/types/types.js.map +1 -1
  211. package/lib/utils/kebabToCamel.d.ts +1 -3
  212. package/lib/utils/kebabToCamel.d.ts.map +1 -1
  213. package/lib/utils/kebabToCamel.js +1 -3
  214. package/lib/utils/kebabToCamel.js.map +1 -1
  215. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Banner.js","sourceRoot":"","sources":["../../../src/components/Banner/Banner.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EACR,UAAU,EAKV,OAAO,EAEP,mBAAmB,EACpB,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,MAAM,EAAE,EAAE,YAAY,EAAE,MAA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AAI,IAAC,IAAI,EAAC,OAAO,GAAG,GACd,CACV,GACI,IACF,EACP,KAAC,cAAc,IAAC,SAAS,EAAE,SAAS,YAClC,KAAC,uBAAuB,IAAC,KAAK,EAAE,gBAAgB,GAAI,GACrC,IACG,CACvB,IACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import {\n useState,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n MouseEventHandler,\n useMemo,\n ReactNode,\n useImperativeHandle\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { getContrast, readableColor } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp, OmitStrict } from '../../types';\nimport Button, { StyledButton } from '../Button';\nimport { focusHeadingOrContainer, tryCatch } from '../../utils';\nimport { useConsolidatedRef, useDirection, useI18n } from '../../hooks';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Grid from '../Grid';\nimport ExpandCollapse from '../ExpandCollapse';\nimport { Count } from '../Badges';\nimport Icon, { StyledIcon, registerIcon } from '../Icon';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport * as caretRightIcon from '../Icon/icons/caret-right.icon';\nimport * as warnSolidIcon from '../Icon/icons/warn-solid.icon';\nimport * as flagWaveSolidIcon from '../Icon/icons/flag-wave-solid.icon';\nimport * as informationSolidIcon from '../Icon/icons/information-solid.icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { UnorderedList } from '../List';\n\nregisterIcon(\n timesIcon,\n caretRightIcon,\n warnSolidIcon,\n flagWaveSolidIcon,\n informationSolidIcon,\n checkIcon\n);\n\nexport interface BannerHandleValue {\n /** Used to apply focus to the banner via an imperative handle. */\n focus: () => void;\n}\n\nexport interface BannerMessage {\n label: string;\n description?: string;\n action?: {\n text: string;\n onClick?: MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;\n href?: string;\n };\n items?: (BannerMessage | string)[];\n}\n\nexport interface BannerProps extends BaseProps, NoChildrenProp {\n /** Controls the styling of the Banner. */\n variant: 'urgent' | 'warning' | 'success' | 'info';\n /**\n * The heading tag to render the provided heading as. This is agnostic to the styling of the heading.\n * @default \"h2\"\n */\n headingTag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n /** Pass one or more descriptive messages to inform the user. */\n messages: (string | BannerMessage)[];\n /** Callback when user explicitly dismisses the Banner. */\n onDismiss?: MouseEventHandler;\n /** Ref that can be used to access the imperative handle. */\n handle?: Ref<BannerHandleValue>;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledBanner = styled.div<{ headingTag: BannerProps['headingTag'] }>(\n ({ headingTag, theme }) => {\n return css`\n border-radius: ${theme.components.card['border-radius']};\n\n &:has(${headingTag}:focus) {\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n }\n);\n\nStyledBanner.defaultProps = defaultThemeProp;\n\nexport const StyledBannerStatus = styled.div<Pick<BannerProps, 'variant'>>(({ variant, theme }) => {\n const { background } = theme.components.banner[variant];\n const color = tryCatch(() =>\n getContrast(background, theme.base.palette['primary-background']) >= 3\n ? theme.base.palette['primary-background']\n : readableColor(background)\n );\n\n return css`\n background-color: ${background};\n color: ${color};\n border-start-start-radius: inherit;\n border-end-start-radius: inherit;\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-inline-end: none;\n font-size: 1.25rem;\n `;\n});\n\nStyledBannerStatus.defaultProps = defaultThemeProp;\n\nexport const StyledBannerHeader = styled.div(({ theme }) => {\n const { rtl } = useDirection();\n\n return css`\n min-height: 2rem;\n\n ${StyledButton}[aria-expanded] {\n ${StyledIcon} {\n transition: rotate ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n }\n\n &[aria-expanded='true'] ${StyledIcon} {\n rotate: 90deg;\n }\n\n &[aria-expanded='false'] ${StyledIcon} {\n rotate: ${rtl ? 180 : 0}deg;\n }\n }\n `;\n});\n\nStyledBannerHeader.defaultProps = defaultThemeProp;\n\nexport const StyledBannerContent = styled.div(({ theme }) => {\n return css`\n height: 100%;\n background: ${theme.components.card.background};\n padding-block: calc(0.5 * ${theme.base.spacing});\n padding-inline-start: calc(2 * ${theme.base.spacing});\n padding-inline-end: calc(0.5 * ${theme.base.spacing});\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-inline-start: none;\n border-start-end-radius: inherit;\n border-end-end-radius: inherit;\n `;\n});\n\nStyledBannerContent.defaultProps = defaultThemeProp;\n\nexport const StyledBannerMessageList: typeof UnorderedList = styled(UnorderedList)(\n ({ theme }) => css`\n padding-block-end: calc(0.5 * ${theme.base.spacing});\n padding-inline-end: calc(2 * ${theme.base.spacing});\n `\n);\n\nStyledBannerMessageList.defaultProps = defaultThemeProp;\n\nexport const StyledBannerMessage = styled.span`\n overflow-wrap: break-word;\n list-style: none;\n`;\n\nStyledBannerMessage.defaultProps = defaultThemeProp;\n\nconst BannerMessageItem = forwardRef<\n HTMLLIElement,\n OmitStrict<BannerMessage, 'items'> & ForwardProps\n>(({ label, description, action, ...restProps }, ref) => {\n return (\n <StyledBannerMessage {...restProps} ref={ref}>\n <span>{label}</span>\n {description && (\n <>\n {' '}\n <Text variant='secondary'>{description}</Text>\n </>\n )}\n {action && (\n <>\n {' '}\n <Text variant='secondary'>\n <Button variant='link' href={action.href} onClick={action.onClick} {...action}>\n {action.text}\n </Button>\n </Text>\n </>\n )}\n </StyledBannerMessage>\n );\n});\n\nconst prepareMessages = (\n messages: (string | BannerMessage)[]\n): [messages: ReactNode[], count: number] => {\n let count = 0;\n\n return [\n messages.flatMap(msg => {\n count += 1;\n\n if (typeof msg === 'string') {\n return [<BannerMessageItem label={msg} />];\n }\n\n if (msg.items) {\n const { items, ...restMsg } = msg;\n const [subMessages, subCount] = prepareMessages(items);\n count += subCount;\n return [<BannerMessageItem {...restMsg} />, subMessages];\n }\n\n return [<BannerMessageItem {...msg} />];\n }),\n count\n ];\n};\n\nconst Banner: FunctionComponent<BannerProps & ForwardProps> = forwardRef(\n (\n {\n variant,\n headingTag = 'h2',\n messages,\n onDismiss,\n handle,\n ...restProps\n }: PropsWithoutRef<BannerProps>,\n ref: BannerProps['ref']\n ) => {\n const [messagesToRender, count] = useMemo(() => prepareMessages(messages), [messages]);\n\n const t = useI18n();\n const [collapsed, setCollapsed] = useState(count > 2);\n\n const bannerRef = useConsolidatedRef(ref);\n\n let role: string;\n let icon: string;\n let heading: string;\n let ariaLive: string;\n\n switch (variant) {\n case 'urgent':\n heading = t('error');\n icon = 'warn-solid';\n role = 'alert';\n ariaLive = 'assertive';\n break;\n case 'warning':\n heading = t('warning');\n icon = 'flag-wave-solid';\n role = 'alert';\n ariaLive = 'assertive';\n break;\n case 'success':\n heading = t('success');\n icon = 'check';\n role = 'none';\n ariaLive = 'polite';\n break;\n case 'info':\n default:\n heading = t('information');\n icon = 'information-solid';\n role = 'none';\n ariaLive = 'polite';\n break;\n }\n\n useImperativeHandle(\n handle,\n () => ({\n focus: () => {\n if (bannerRef.current) focusHeadingOrContainer(bannerRef.current, heading);\n }\n }),\n []\n );\n\n return (\n <Grid\n {...restProps}\n as={StyledBanner}\n container={{ cols: '2rem minmax(0, 1fr)' }}\n role={role}\n aria-live={ariaLive}\n headingTag={headingTag}\n ref={bannerRef}\n >\n <Flex\n as={StyledBannerStatus}\n container={{ justify: 'center', alignItems: 'start', pad: [1.5, 0] }}\n variant={variant}\n >\n <Icon name={icon} />\n </Flex>\n {count === 1 ? (\n <Flex container={{ alignItems: 'start' }} as={StyledBannerContent}>\n <VisuallyHiddenText as={headingTag}>{`${heading} ${count}`}</VisuallyHiddenText>\n <Flex item={{ alignSelf: 'center', grow: 1 }} as='ul'>\n {typeof messages[0] === 'string' ? (\n <BannerMessageItem label={messages[0]} as='li' />\n ) : (\n <BannerMessageItem {...messages[0]} as='li' />\n )}\n </Flex>\n {onDismiss && (\n <Button\n onClick={onDismiss}\n label={t('dismiss')}\n aria-label={t('banner_dismiss_button_label_a11y')}\n variant='simple'\n icon\n >\n <Icon name='times' />\n </Button>\n )}\n </Flex>\n ) : (\n <StyledBannerContent>\n <Grid\n as={StyledBannerHeader}\n container={{ cols: 'auto 1fr auto', areas: '\"toggle heading dismiss\"', gap: 1 }}\n >\n <Grid\n container={{ cols: 'min-content min-content', gap: 0.5, alignItems: 'center' }}\n item={{ area: 'heading', alignSelf: 'center' }}\n as={Text}\n forwardedAs={headingTag}\n variant='h2'\n >\n {heading} <Count>{count}</Count>\n </Grid>\n <Grid item={{ area: 'toggle', alignSelf: 'center' }}>\n <Button\n onClick={() => {\n setCollapsed(cur => !cur);\n }}\n label={t(collapsed ? 'expand' : 'collapse')}\n aria-expanded={collapsed ? 'false' : 'true'}\n variant='simple'\n icon\n >\n <Icon name='caret-right' />\n </Button>\n </Grid>\n <Grid item={{ area: 'dismiss', alignSelf: 'center' }}>\n {onDismiss && (\n <Button\n onClick={onDismiss}\n label={t('dismiss')}\n aria-label={t('banner_dismiss_button_label_a11y')}\n variant='simple'\n icon\n >\n <Icon name='times' />\n </Button>\n )}\n </Grid>\n </Grid>\n <ExpandCollapse collapsed={collapsed}>\n <StyledBannerMessageList items={messagesToRender} />\n </ExpandCollapse>\n </StyledBannerContent>\n )}\n </Grid>\n );\n }\n);\n\nexport default Banner;\n"]}
1
+ {"version":3,"file":"Banner.js","sourceRoot":"","sources":["../../../src/components/Banner/Banner.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EACR,UAAU,EAKV,OAAO,EAEP,mBAAmB,EACpB,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAA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AAO,GAAG,GACd,CACV,GACI,IACF,EACP,KAAC,cAAc,IAAC,SAAS,EAAE,SAAS,YAClC,KAAC,uBAAuB,IAAC,KAAK,EAAE,gBAAgB,GAAI,GACrC,IACG,CACvB,IACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import {\n useState,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n MouseEventHandler,\n useMemo,\n ReactNode,\n useImperativeHandle\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { getContrast, readableColor } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp, OmitStrict } from '../../types';\nimport Button, { StyledButton } from '../Button';\nimport { focusHeadingOrContainer, tryCatch } from '../../utils';\nimport { useConsolidatedRef, useDirection, useI18n } from '../../hooks';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Grid from '../Grid';\nimport ExpandCollapse from '../ExpandCollapse';\nimport { Count } from '../Badges';\nimport Icon, { StyledIcon, registerIcon } from '../Icon';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport * as caretRightIcon from '../Icon/icons/caret-right.icon';\nimport * as warnSolidIcon from '../Icon/icons/warn-solid.icon';\nimport * as flagWaveSolidIcon from '../Icon/icons/flag-wave-solid.icon';\nimport * as informationSolidIcon from '../Icon/icons/information-solid.icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { UnorderedList } from '../List';\n\nregisterIcon(\n timesIcon,\n caretRightIcon,\n warnSolidIcon,\n flagWaveSolidIcon,\n informationSolidIcon,\n checkIcon\n);\n\nexport interface BannerHandleValue {\n /** Used to apply focus to the banner via an imperative handle. */\n focus: () => void;\n}\n\nexport interface BannerMessage {\n label: string;\n description?: string;\n action?: {\n text: string;\n onClick?: MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;\n href?: string;\n };\n items?: (BannerMessage | string)[];\n}\n\nexport interface BannerProps extends BaseProps, NoChildrenProp {\n /** Controls the styling of the Banner. */\n variant: 'urgent' | 'warning' | 'success' | 'info';\n /**\n * The heading tag to render the provided heading as. This is agnostic to the styling of the heading.\n * @default 'h2'\n */\n headingTag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n /** Pass one or more descriptive messages to inform the user. */\n messages: (string | BannerMessage)[];\n /** Callback when user explicitly dismisses the Banner. */\n onDismiss?: MouseEventHandler;\n /** Ref that can be used to access the imperative handle. */\n handle?: Ref<BannerHandleValue>;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledBanner = styled.div<{ headingTag: BannerProps['headingTag'] }>(\n ({ headingTag, theme }) => {\n return css`\n border-radius: ${theme.components.card['border-radius']};\n\n &:has(${headingTag}:focus) {\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n }\n);\n\nStyledBanner.defaultProps = defaultThemeProp;\n\nexport const StyledBannerStatus = styled.div<Pick<BannerProps, 'variant'>>(({ variant, theme }) => {\n const { background } = theme.components.banner[variant];\n const color = tryCatch(() =>\n getContrast(background, theme.base.palette['primary-background']) >= 3\n ? theme.base.palette['primary-background']\n : readableColor(background)\n );\n\n return css`\n background-color: ${background};\n color: ${color};\n border-start-start-radius: inherit;\n border-end-start-radius: inherit;\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-inline-end: none;\n font-size: 1.25rem;\n `;\n});\n\nStyledBannerStatus.defaultProps = defaultThemeProp;\n\nexport const StyledBannerHeader = styled.div(({ theme }) => {\n const { rtl } = useDirection();\n\n return css`\n min-height: 2rem;\n\n ${StyledButton}[aria-expanded] {\n ${StyledIcon} {\n transition: rotate ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n }\n\n &[aria-expanded='true'] ${StyledIcon} {\n rotate: 90deg;\n }\n\n &[aria-expanded='false'] ${StyledIcon} {\n rotate: ${rtl ? 180 : 0}deg;\n }\n }\n `;\n});\n\nStyledBannerHeader.defaultProps = defaultThemeProp;\n\nexport const StyledBannerContent = styled.div(({ theme }) => {\n return css`\n height: 100%;\n background: ${theme.components.card.background};\n padding-block: calc(0.5 * ${theme.base.spacing});\n padding-inline-start: calc(2 * ${theme.base.spacing});\n padding-inline-end: calc(0.5 * ${theme.base.spacing});\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-inline-start: none;\n border-start-end-radius: inherit;\n border-end-end-radius: inherit;\n `;\n});\n\nStyledBannerContent.defaultProps = defaultThemeProp;\n\nexport const StyledBannerMessageList: typeof UnorderedList = styled(UnorderedList)(\n ({ theme }) => css`\n padding-block-end: calc(0.5 * ${theme.base.spacing});\n padding-inline-end: calc(2 * ${theme.base.spacing});\n `\n);\n\nStyledBannerMessageList.defaultProps = defaultThemeProp;\n\nexport const StyledBannerMessage = styled.span`\n overflow-wrap: break-word;\n list-style: none;\n`;\n\nStyledBannerMessage.defaultProps = defaultThemeProp;\n\nconst BannerMessageItem = forwardRef<\n HTMLLIElement,\n OmitStrict<BannerMessage, 'items'> & ForwardProps\n>(({ label, description, action, ...restProps }, ref) => {\n return (\n <StyledBannerMessage {...restProps} ref={ref}>\n <span>{label}</span>\n {description && (\n <>\n {' '}\n <Text variant='secondary'>{description}</Text>\n </>\n )}\n {action && (\n <>\n {' '}\n <Text variant='secondary'>\n <Button variant='link' href={action.href} onClick={action.onClick} {...action}>\n {action.text}\n </Button>\n </Text>\n </>\n )}\n </StyledBannerMessage>\n );\n});\n\nconst prepareMessages = (\n messages: (string | BannerMessage)[]\n): [messages: ReactNode[], count: number] => {\n let count = 0;\n\n return [\n messages.flatMap(msg => {\n count += 1;\n\n if (typeof msg === 'string') {\n return [<BannerMessageItem label={msg} />];\n }\n\n if (msg.items) {\n const { items, ...restMsg } = msg;\n const [subMessages, subCount] = prepareMessages(items);\n count += subCount;\n return [<BannerMessageItem {...restMsg} />, subMessages];\n }\n\n return [<BannerMessageItem {...msg} />];\n }),\n count\n ];\n};\n\nconst Banner: FunctionComponent<BannerProps & ForwardProps> = forwardRef(\n (\n {\n variant,\n headingTag = 'h2',\n messages,\n onDismiss,\n handle,\n ...restProps\n }: PropsWithoutRef<BannerProps>,\n ref: BannerProps['ref']\n ) => {\n const [messagesToRender, count] = useMemo(() => prepareMessages(messages), [messages]);\n\n const t = useI18n();\n const [collapsed, setCollapsed] = useState(count > 2);\n\n const bannerRef = useConsolidatedRef(ref);\n\n let role: string;\n let icon: string;\n let heading: string;\n let ariaLive: string;\n\n switch (variant) {\n case 'urgent':\n heading = t('error');\n icon = 'warn-solid';\n role = 'alert';\n ariaLive = 'assertive';\n break;\n case 'warning':\n heading = t('warning');\n icon = 'flag-wave-solid';\n role = 'alert';\n ariaLive = 'assertive';\n break;\n case 'success':\n heading = t('success');\n icon = 'check';\n role = 'none';\n ariaLive = 'polite';\n break;\n case 'info':\n default:\n heading = t('information');\n icon = 'information-solid';\n role = 'none';\n ariaLive = 'polite';\n break;\n }\n\n useImperativeHandle(\n handle,\n () => ({\n focus: () => {\n if (bannerRef.current) focusHeadingOrContainer(bannerRef.current, heading);\n }\n }),\n []\n );\n\n return (\n <Grid\n {...restProps}\n as={StyledBanner}\n container={{ cols: '2rem minmax(0, 1fr)' }}\n role={role}\n aria-live={ariaLive}\n headingTag={headingTag}\n ref={bannerRef}\n >\n <Flex\n as={StyledBannerStatus}\n container={{ justify: 'center', alignItems: 'start', pad: [1.5, 0] }}\n variant={variant}\n >\n <Icon name={icon} />\n </Flex>\n {count === 1 ? (\n <Flex container={{ alignItems: 'start' }} as={StyledBannerContent}>\n <VisuallyHiddenText as={headingTag}>{`${heading} ${count}`}</VisuallyHiddenText>\n <Flex item={{ alignSelf: 'center', grow: 1 }} as='ul'>\n {typeof messages[0] === 'string' ? (\n <BannerMessageItem label={messages[0]} as='li' />\n ) : (\n <BannerMessageItem {...messages[0]} as='li' />\n )}\n </Flex>\n {onDismiss && (\n <Button\n onClick={onDismiss}\n label={t('dismiss')}\n aria-label={t('banner_dismiss_button_label_a11y')}\n variant='simple'\n icon\n >\n <Icon name='times' />\n </Button>\n )}\n </Flex>\n ) : (\n <StyledBannerContent>\n <Grid\n as={StyledBannerHeader}\n container={{ cols: 'auto 1fr auto', areas: '\"toggle heading dismiss\"', gap: 1 }}\n >\n <Grid\n container={{ cols: 'min-content min-content', gap: 0.5, alignItems: 'center' }}\n item={{ area: 'heading', alignSelf: 'center' }}\n as={Text}\n forwardedAs={headingTag}\n variant='h2'\n >\n {heading} <Count>{count}</Count>\n </Grid>\n <Grid item={{ area: 'toggle', alignSelf: 'center' }}>\n <Button\n onClick={() => {\n setCollapsed(cur => !cur);\n }}\n label={t(collapsed ? 'expand' : 'collapse')}\n aria-expanded={collapsed ? 'false' : 'true'}\n variant='simple'\n icon\n >\n <Icon name='caret-right' />\n </Button>\n </Grid>\n <Grid item={{ area: 'dismiss', alignSelf: 'center' }}>\n {onDismiss && (\n <Button\n onClick={onDismiss}\n label={t('dismiss')}\n aria-label={t('banner_dismiss_button_label_a11y')}\n variant='simple'\n icon\n >\n <Icon name='times' />\n </Button>\n )}\n </Grid>\n </Grid>\n <ExpandCollapse collapsed={collapsed}>\n <StyledBannerMessageList items={messagesToRender} />\n </ExpandCollapse>\n </StyledBannerContent>\n )}\n </Grid>\n );\n }\n);\n\nexport default Banner;\n"]}
@@ -4,11 +4,11 @@ export interface BooleanDisplayProps extends BaseProps, NoChildrenProp {
4
4
  /** Boolean value */
5
5
  value?: boolean;
6
6
  /** The text to be displayed when value is true.
7
- * @default "Yes"
7
+ * @default 'Yes'
8
8
  */
9
9
  trueLabel?: string;
10
10
  /** The text to be displayed when value is false.
11
- * @default "No"
11
+ * @default 'No'
12
12
  */
13
13
  falseLabel?: string;
14
14
  /** Ref for the wrapping element. */
@@ -1 +1 @@
1
- {"version":3,"file":"BooleanDisplay.js","sourceRoot":"","sources":["../../../src/components/Boolean/BooleanDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAkB/C,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CAAA,EAAE,CAAC;AAE3C,oBAAoB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAErD,MAAM,cAAc,GAA0D,UAAU,CACtF,CACE,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,SAAS,EAAwC,EACpF,GAA+B,EAC/B,EAAE;IACF,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,WAAW,GAAG,KAAK;QACvB,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,4BAA4B,CAAC;QAC9C,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,6BAA6B,CAAC,CAAC;IAEnD,OAAO,CACL,KAAC,oBAAoB,IAAC,GAAG,EAAE,GAAG,KAAM,SAAS,YAC1C,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,8BAAkB,MAAM,6BAAsB,GAC9D,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled from 'styled-components';\n\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\n\nexport interface BooleanDisplayProps extends BaseProps, NoChildrenProp {\n /** Boolean value */\n value?: boolean;\n /** The text to be displayed when value is true.\n * @default \"Yes\"\n */\n trueLabel?: string;\n /** The text to be displayed when value is false.\n * @default \"No\"\n */\n falseLabel?: string;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLSpanElement>;\n}\n\nconst StyledBooleanDisplay = styled.span``;\n\nStyledBooleanDisplay.defaultProps = defaultThemeProp;\n\nconst BooleanDisplay: FunctionComponent<BooleanDisplayProps & ForwardProps> = forwardRef(\n (\n { value, trueLabel, falseLabel, ...restProps }: PropsWithoutRef<BooleanDisplayProps>,\n ref: BooleanDisplayProps['ref']\n ) => {\n const t = useI18n();\n\n const displayText = value\n ? trueLabel || t('boolean_display_true_label')\n : falseLabel || t('boolean_display_false_label');\n\n return (\n <StyledBooleanDisplay ref={ref} {...restProps}>\n {value !== undefined ? displayText : <span aria-hidden='true'>&ndash;&ndash;</span>}\n </StyledBooleanDisplay>\n );\n }\n);\n\nexport default BooleanDisplay;\n"]}
1
+ {"version":3,"file":"BooleanDisplay.js","sourceRoot":"","sources":["../../../src/components/Boolean/BooleanDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAkB/C,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CAAA,EAAE,CAAC;AAE3C,oBAAoB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAErD,MAAM,cAAc,GAA0D,UAAU,CACtF,CACE,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,SAAS,EAAwC,EACpF,GAA+B,EAC/B,EAAE;IACF,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,WAAW,GAAG,KAAK;QACvB,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,4BAA4B,CAAC;QAC9C,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,6BAA6B,CAAC,CAAC;IAEnD,OAAO,CACL,KAAC,oBAAoB,IAAC,GAAG,EAAE,GAAG,KAAM,SAAS,YAC1C,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,8BAAkB,MAAM,6BAAsB,GAC9D,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled from 'styled-components';\n\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\n\nexport interface BooleanDisplayProps extends BaseProps, NoChildrenProp {\n /** Boolean value */\n value?: boolean;\n /** The text to be displayed when value is true.\n * @default 'Yes'\n */\n trueLabel?: string;\n /** The text to be displayed when value is false.\n * @default 'No'\n */\n falseLabel?: string;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLSpanElement>;\n}\n\nconst StyledBooleanDisplay = styled.span``;\n\nStyledBooleanDisplay.defaultProps = defaultThemeProp;\n\nconst BooleanDisplay: FunctionComponent<BooleanDisplayProps & ForwardProps> = forwardRef(\n (\n { value, trueLabel, falseLabel, ...restProps }: PropsWithoutRef<BooleanDisplayProps>,\n ref: BooleanDisplayProps['ref']\n ) => {\n const t = useI18n();\n\n const displayText = value\n ? trueLabel || t('boolean_display_true_label')\n : falseLabel || t('boolean_display_false_label');\n\n return (\n <StyledBooleanDisplay ref={ref} {...restProps}>\n {value !== undefined ? displayText : <span aria-hidden='true'>&ndash;&ndash;</span>}\n </StyledBooleanDisplay>\n );\n }\n);\n\nexport default BooleanDisplay;\n"]}
@@ -13,7 +13,7 @@ export interface BareButtonProps extends BaseProps {
13
13
  href?: ButtonProps['href'];
14
14
  /**
15
15
  * Controls the behavior of a Button within a Form.
16
- * @default "button"
16
+ * @default 'button'
17
17
  */
18
18
  type?: ButtonProps['type'];
19
19
  /** Ref forwarded to the wrapping element. */
@@ -1 +1 @@
1
- {"version":3,"file":"BareButton.js","sourceRoot":"","sources":["../../../src/components/Button/BareButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,MAAM,EAMN,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,M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YAClE,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,gBAAgB,CAAC;YACvF,cAAc,CAAC,OAAO,GAAG,SAAS,CAAC;YAEnC,IAAI,WAAW,IAAI,SAAS,CAAC,OAAO,KAAK,QAAQ,CAAC,aAAa,EAAE;gBAC/D,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;aAC5B;YAED,OAAQ,SAAS,CAAC,SAA2C,EAAE,CAAC,CAAC,CAAC,CAAC;QACrE,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {\n forwardRef,\n useRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n MouseEvent,\n MouseEventHandler,\n useEffect\n} from 'react';\nimport styled from 'styled-components';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { useConsolidatedRef } from '../../hooks';\n\nimport { ButtonProps } from './Button';\n\nexport interface BareButtonProps extends BaseProps {\n /** Text or content for the Button. */\n children: ButtonProps['children'];\n /**\n * Determines if the Button will be disabled.\n * @default false\n */\n disabled?: ButtonProps['disabled'];\n /** A location to navigate to. Passing an href will render a Link styled as a Button. */\n href?: ButtonProps['href'];\n /**\n * Controls the behavior of a Button within a Form.\n * @default \"button\"\n */\n type?: ButtonProps['type'];\n /** Ref forwarded to the wrapping element. */\n ref?: ButtonProps['ref'];\n}\n\nexport const StyledBareButton = styled.button`\n background: none;\n border: none;\n outline: none;\n cursor: pointer;\n user-select: none;\n color: inherit;\n\n & + & {\n margin-inline-start: ${props => props.theme.base.spacing};\n }\n`;\n\nStyledBareButton.defaultProps = defaultThemeProp;\n\nconst BareButton: FunctionComponent<BareButtonProps & ForwardProps> = forwardRef(\n (\n {\n type = 'button',\n disabled = false,\n href,\n ...restProps\n }: PropsWithoutRef<BareButtonProps> & ForwardProps,\n ref: Ref<HTMLButtonElement>\n ) => {\n const mouseDownEvent = useRef<MouseEvent>();\n const buttonRef = useConsolidatedRef(ref);\n\n useEffect(() => {\n return () => {\n mouseDownEvent.current = undefined;\n };\n }, []);\n\n return (\n <StyledBareButton\n ref={buttonRef}\n as={href ? ('a' as any) : undefined}\n type={href ? undefined : type}\n disabled={disabled}\n {...restProps}\n href={href}\n onMouseDown={(e: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n (restProps.onMouseDown as MouseEventHandler | undefined)?.(e);\n e.persist();\n mouseDownEvent.current = e;\n }}\n onMouseUp={(e: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n const shouldFocus = mouseDownEvent.current && !mouseDownEvent.current.defaultPrevented;\n mouseDownEvent.current = undefined;\n\n if (shouldFocus && buttonRef.current !== document.activeElement) {\n buttonRef.current?.focus();\n }\n\n return (restProps.onMouseUp as MouseEventHandler | undefined)?.(e);\n }}\n />\n );\n }\n);\n\nexport default BareButton;\n"]}
1
+ {"version":3,"file":"BareButton.js","sourceRoot":"","sources":["../../../src/components/Button/BareButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,MAAM,EAMN,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAuBjD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAA;;;;;;;;;2BASlB,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO;;CAE3D,CAAC;AAEF,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEjD,MAAM,UAAU,GAAsD,UAAU,CAC9E,CACE,EACE,IAAI,GAAG,QAAQ,EACf,QAAQ,GAAG,KAAK,EAChB,IAAI,EACJ,GAAG,SAAS,EACoC,EAClD,GAA2B,EAC3B,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ler,\n useEffect\n} from 'react';\nimport styled from 'styled-components';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { useConsolidatedRef } from '../../hooks';\n\nimport { ButtonProps } from './Button';\n\nexport interface BareButtonProps extends BaseProps {\n /** Text or content for the Button. */\n children: ButtonProps['children'];\n /**\n * Determines if the Button will be disabled.\n * @default false\n */\n disabled?: ButtonProps['disabled'];\n /** A location to navigate to. Passing an href will render a Link styled as a Button. */\n href?: ButtonProps['href'];\n /**\n * Controls the behavior of a Button within a Form.\n * @default 'button'\n */\n type?: ButtonProps['type'];\n /** Ref forwarded to the wrapping element. */\n ref?: ButtonProps['ref'];\n}\n\nexport const StyledBareButton = styled.button`\n background: none;\n border: none;\n outline: none;\n cursor: pointer;\n user-select: none;\n color: inherit;\n\n & + & {\n margin-inline-start: ${props => props.theme.base.spacing};\n }\n`;\n\nStyledBareButton.defaultProps = defaultThemeProp;\n\nconst BareButton: FunctionComponent<BareButtonProps & ForwardProps> = forwardRef(\n (\n {\n type = 'button',\n disabled = false,\n href,\n ...restProps\n }: PropsWithoutRef<BareButtonProps> & ForwardProps,\n ref: Ref<HTMLButtonElement>\n ) => {\n const mouseDownEvent = useRef<MouseEvent>();\n const buttonRef = useConsolidatedRef(ref);\n\n useEffect(() => {\n return () => {\n mouseDownEvent.current = undefined;\n };\n }, []);\n\n return (\n <StyledBareButton\n ref={buttonRef}\n as={href ? ('a' as any) : undefined}\n type={href ? undefined : type}\n disabled={disabled}\n {...restProps}\n href={href}\n onMouseDown={(e: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n (restProps.onMouseDown as MouseEventHandler | undefined)?.(e);\n e.persist();\n mouseDownEvent.current = e;\n }}\n onMouseUp={(e: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n const shouldFocus = mouseDownEvent.current && !mouseDownEvent.current.defaultPrevented;\n mouseDownEvent.current = undefined;\n\n if (shouldFocus && buttonRef.current !== document.activeElement) {\n buttonRef.current?.focus();\n }\n\n return (restProps.onMouseUp as MouseEventHandler | undefined)?.(e);\n }}\n />\n );\n }\n);\n\nexport default BareButton;\n"]}
@@ -13,12 +13,12 @@ export interface ButtonProps extends BaseProps, AsProp {
13
13
  href?: string;
14
14
  /**
15
15
  * Controls the styling of the Button.
16
- * @default "secondary"
16
+ * @default 'secondary'
17
17
  */
18
18
  variant?: 'primary' | 'secondary' | 'simple' | 'link' | 'text';
19
19
  /**
20
20
  * Controls the behavior of a Button within a Form.
21
- * @default "button"
21
+ * @default 'button'
22
22
  */
23
23
  type?: 'button' | 'reset' | 'submit';
24
24
  /**
@@ -31,13 +31,9 @@ export interface ButtonProps extends BaseProps, AsProp {
31
31
  * @default false
32
32
  */
33
33
  compact?: boolean;
34
- /**
35
- * The label text will be used inside a Tooltip.
36
- */
34
+ /** The label text will be used inside a Tooltip. */
37
35
  label?: string;
38
- /**
39
- * The aria label text will be inserted as the aria-label on the Button.
40
- */
36
+ /** The aria label text will be inserted as the aria-label on the Button. */
41
37
  'aria-label'?: string;
42
38
  /**
43
39
  * Optionally renders an indeterminate progress indicator in a button.
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EACjB,SAAS,EAET,GAAG,EAGJ,MAAM,OAAO,CAAC;AACf,OAAe,EAAO,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG9D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAWjF,MAAM,WAAW,WAAY,SAAQ,SAAS,EAAE,MAAM;IACpD,sCAAsC;IACtC,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2FAA2F;IAC3F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS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EAAE;wBAC/D,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;qBAC5B;oBAED,OAAQ,SAAS,CAAC,SAA2C,EAAE,CAAC,CAAC,CAAC,CAAC;gBACrE,CAAC,aAEA,YAAY,IAAI,KAAC,QAAQ,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,OAAO,GAAG,EAC7D,QAAQ,IACE,EAEZ,QAAQ,IAAI,KAAK,IAAI,CACpB,KAAC,OAAO,IAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM,EAAC,cAAc,EAAE,KAAK,YAC/E,KAAK,GACE,CACX,IACA,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import {\n useRef,\n useEffect,\n forwardRef,\n FunctionComponent,\n ReactNode,\n PropsWithoutRef,\n Ref,\n MouseEvent,\n MouseEventHandler\n} from 'react';\nimport styled, { css, DefaultTheme } from 'styled-components';\nimport { mix, readableColor } from 'polished';\n\nimport { BaseProps, ForwardProps, PropsWithDefaults, AsProp } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { getHoverColors, omitProps, readableHue } from '../../styles';\nimport { useElement, useConsolidatedRef } from '../../hooks';\nimport Tooltip from '../Tooltip';\nimport Progress, { StyledProgressRing } from '../Progress';\nimport { StyledBackdrop } from '../Backdrop';\nimport { StyledIcon } from '../Icon';\nimport { StyledPopover } from '../Popover';\n\nexport interface ButtonProps extends BaseProps, AsProp {\n /** Text or content for the Button. */\n children: ReactNode;\n /**\n * Determines if the Button will be disabled.\n * @default false\n */\n disabled?: boolean;\n /** A location to navigate to. Passing an href will render an anchor styled as a Button. */\n href?: string;\n /**\n * Controls the styling of the Button.\n * @default \"secondary\"\n */\n variant?: 'primary' | 'secondary' | 'simple' | 'link' | 'text';\n /**\n * Controls the behavior of a Button within a Form.\n * @default \"button\"\n */\n type?: 'button' | 'reset' | 'submit';\n /**\n * Set the Icon prop to `true` if you're using just an Icon in your Button. Make sure to pass an Icon as children if `true`.\n * @default false\n */\n icon?: boolean;\n /**\n * Used for a smaller sized button.\n * @default false\n */\n compact?: boolean;\n /**\n * The label text will be used inside a Tooltip.\n */\n label?: string;\n /**\n * The aria label text will be inserted as the aria-label on the Button.\n */\n 'aria-label'?: string;\n /**\n * Optionally renders an indeterminate progress indicator in a button.\n * @default false\n */\n loading?: boolean;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLButtonElement>;\n}\n\ntype ButtonPropsWithDefaults = PropsWithDefaults<\n ButtonProps,\n 'variant' | 'type' | 'disabled' | 'icon' | 'loading'\n>;\n\nconst baseStyles = (theme: DefaultTheme) => {\n const {\n base: {\n spacing,\n animation: {\n speed,\n timing: { ease }\n },\n 'disabled-opacity': disabledOpacity\n },\n components: {\n button: { 'focus-shadow': focusShadow }\n }\n } = theme;\n\n return css`\n outline: none;\n text-decoration: none;\n transition-property: background-color, color, box-shadow;\n transition-duration: calc(0.5 * ${speed});\n transition-timing-function: ${ease};\n cursor: pointer;\n\n & + & {\n margin-inline-start: ${spacing};\n }\n\n /* Not able to combine with selector above. Stylis bug? */\n & + ${StyledPopover} + & {\n margin-inline-start: ${spacing};\n }\n\n &:disabled,\n &[disabled] {\n opacity: ${disabledOpacity};\n cursor: not-allowed;\n pointer-events: none;\n }\n\n &:enabled:focus,\n &:not([disabled]):focus {\n box-shadow: ${focusShadow};\n }\n `;\n};\n\nexport const StyledButton = styled.button.withConfig<ButtonPropsWithDefaults>(omitProps('loading'))(\n ({ variant, icon, loading, compact, theme }) => {\n const {\n base: {\n 'border-radius': baseBorderRadius,\n palette: { 'primary-background': backgroundColor },\n 'hit-area': {\n 'mouse-min': hitAreaMouse,\n 'finger-min': hitAreaFinger,\n 'compact-min': hitAreaCompact\n },\n animation: { speed }\n },\n components: {\n button: {\n color,\n 'secondary-color': secondaryColor,\n padding,\n 'border-radius': borderRadius,\n 'border-width': borderWidth,\n touch: { padding: touchPadding }\n }\n }\n } = theme;\n const contrastColor = tryCatch(() => readableColor(color));\n\n // Base\n const base = baseStyles(theme);\n\n // Non-text base\n const nonTextual = css`\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: ${hitAreaMouse};\n min-width: ${hitAreaMouse};\n line-height: 1;\n border: ${borderWidth} solid transparent;\n border-radius: calc(${baseBorderRadius} * ${borderRadius});\n -webkit-user-select: none;\n user-select: none;\n\n ${!icon &&\n css`\n padding: ${padding};\n `}\n\n ${icon &&\n css`\n border-radius: calc(${baseBorderRadius} * ${borderRadius});\n\n > svg {\n display: block;\n }\n `}\n\n ${compact &&\n css`\n min-height: ${hitAreaCompact};\n min-width: ${hitAreaCompact};\n `}\n\n @media (pointer: coarse) {\n border-radius: calc(${baseBorderRadius} * ${borderRadius});\n\n ${!compact &&\n css`\n min-height: ${hitAreaFinger};\n min-width: ${hitAreaFinger};\n `}\n\n ${!icon &&\n css`\n padding: ${touchPadding};\n `}\n }\n `;\n\n // Primary\n const hoverColors = getHoverColors(color);\n const hoverPrimaryColor = hoverColors.background;\n const hoverContrastColor = hoverColors.foreground;\n const primary = css`\n --button-background-color: ${color};\n color: ${contrastColor};\n background-color: ${color};\n\n @media (hover: hover) {\n &:hover {\n background-color: ${hoverPrimaryColor};\n color: ${hoverContrastColor};\n text-decoration: none;\n }\n }\n `;\n\n // Secondary\n const secondaryHoverBackgroundColor = tryCatch(() => mix(0.85, secondaryColor, color));\n const secondaryHoverForegroundColor = readableHue(\n color,\n secondaryHoverBackgroundColor ?? 'transparent'\n );\n const secondary = css`\n --button-background-color: ${secondaryColor};\n color: ${color};\n background-color: ${secondaryColor};\n border-color: ${color};\n\n @media (hover: hover) {\n &:hover {\n color: ${secondaryHoverForegroundColor};\n background-color: ${secondaryHoverBackgroundColor};\n text-decoration: none;\n border-color: ${secondaryHoverForegroundColor};\n }\n }\n `;\n\n // Simple\n const simple = css`\n --button-background-color: ${icon ? 'transparent' : backgroundColor};\n color: ${icon ? 'currentColor' : color};\n background-color: ${icon ? 'transparent' : backgroundColor};\n\n @media (hover: hover) {\n &:hover {\n ${icon &&\n css`\n ::before {\n content: '';\n position: absolute;\n top: calc(${borderWidth} * -1);\n bottom: calc(${borderWidth} * -1);\n left: calc(${borderWidth} * -1);\n right: calc(${borderWidth} * -1);\n border-radius: inherit;\n background-color: currentColor;\n opacity: 0.15;\n }\n `}\n\n ${!icon &&\n css`\n background-color: ${secondaryHoverBackgroundColor};\n color: ${secondaryHoverForegroundColor};\n border-color: ${secondaryHoverForegroundColor};\n text-decoration: none;\n `}\n }\n }\n `;\n\n return css`\n ${base}\n ${nonTextual}\n ${variant === 'primary' && primary}\n ${variant === 'secondary' && secondary}\n ${variant === 'simple' && simple}\n\n ${loading &&\n css`\n ${StyledBackdrop} {\n background-color: var(--button-background-color);\n border-radius: inherit;\n }\n\n ${StyledProgressRing} {\n width: 1em;\n height: 1em;\n circle:nth-child(2) {\n animation-duration: calc(${speed} * 2);\n }\n }\n `}\n `;\n }\n);\n\nStyledButton.defaultProps = defaultThemeProp;\n\nexport const StyledButtonLink = styled.a.withConfig<ButtonPropsWithDefaults>(omitProps('loading'))(\n ({ theme, variant }) => {\n const {\n base: {\n palette: { 'foreground-color': textColor }\n },\n components: {\n link: { color: linkColor }\n }\n } = theme;\n\n const base = baseStyles(theme);\n\n const textual = css`\n background-color: transparent;\n display: inline;\n text-align: start;\n border: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n > ${StyledIcon} {\n vertical-align: bottom;\n }\n `;\n\n const link = css`\n color: ${linkColor};\n `;\n\n const text = css`\n color: ${textColor};\n `;\n\n return css`\n ${base}\n ${textual}\n ${variant === 'link' && link}\n ${variant === 'text' && text}\n `;\n }\n);\n\nStyledButtonLink.defaultProps = defaultThemeProp;\n\nconst Button: FunctionComponent<ButtonProps & ForwardProps> = forwardRef(\n (\n {\n variant = 'secondary',\n type = 'button',\n disabled = false,\n icon = false,\n compact = false,\n href,\n as,\n forwardedAs,\n label,\n 'aria-label': ariaLabel,\n loading = false,\n children,\n ...restProps\n }: PropsWithoutRef<ButtonProps> & ForwardProps,\n ref: Ref<HTMLButtonElement>\n ) => {\n const [buttonEl, setButtonEl] = useElement();\n const mouseDownEvent = useRef<MouseEvent>();\n const buttonRef = useConsolidatedRef<HTMLButtonElement>(ref, setButtonEl);\n const isTextual = ['link', 'text'].includes(variant);\n const showProgress = loading && !isTextual;\n const StyledComp: React.ElementType = isTextual ? StyledButtonLink : StyledButton;\n\n useEffect(() => {\n return () => {\n mouseDownEvent.current = undefined;\n };\n }, []);\n\n return (\n <>\n <StyledComp\n {...restProps}\n ref={buttonRef}\n as={as || (href ? 'a' : 'button')}\n forwardedAs={forwardedAs || (href ? 'a' : 'button')}\n variant={variant}\n icon={icon}\n compact={compact}\n type={href ? undefined : type}\n href={href}\n disabled={disabled && !href}\n loading={showProgress}\n aria-label={ariaLabel || label}\n onMouseDown={(e: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n (restProps.onMouseDown as MouseEventHandler | undefined)?.(e);\n e.persist();\n mouseDownEvent.current = e;\n }}\n onMouseUp={(e: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n const shouldFocus = mouseDownEvent.current && !mouseDownEvent.current.defaultPrevented;\n mouseDownEvent.current = undefined;\n\n if (shouldFocus && buttonRef.current !== document.activeElement) {\n buttonRef.current?.focus();\n }\n\n return (restProps.onMouseUp as MouseEventHandler | undefined)?.(e);\n }}\n >\n {showProgress && <Progress variant='ring' placement='local' />}\n {children}\n </StyledComp>\n\n {buttonEl && label && (\n <Tooltip target={buttonEl} showDelay='none' hideDelay='none' describeTarget={false}>\n {label}\n </Tooltip>\n )}\n </>\n );\n }\n);\n\nexport default Button;\n"]}
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,MAAM,EACN,SAAS,EACT,UAAU,EAOX,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AAC,CAAC;gBAC7B,CAAC,EACD,SAAS,EAAE,CAAC,CAAoD,EAAE,EAAE;oBAClE,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,gBAAgB,CAAC;oBACvF,cAAc,CAAC,OAAO,GAAG,SAAS,CAAC;oBAEnC,IAAI,WAAW,IAAI,SAAS,CAAC,OAAO,KAAK,QAAQ,CAAC,aAAa,EAAE;wBAC/D,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;qBAC5B;oBAED,OAAQ,SAAS,CAAC,SAA2C,EAAE,CAAC,CAAC,CAAC,CAAC;gBACrE,CAAC,aAEA,YAAY,IAAI,KAAC,QAAQ,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,OAAO,GAAG,EAC7D,QAAQ,IACE,EAEZ,QAAQ,IAAI,KAAK,IAAI,CACpB,KAAC,OAAO,IAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM,EAAC,cAAc,EAAE,KAAK,YAC/E,KAAK,GACE,CACX,IACA,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import {\n useRef,\n useEffect,\n forwardRef,\n FunctionComponent,\n ReactNode,\n PropsWithoutRef,\n Ref,\n MouseEvent,\n MouseEventHandler\n} from 'react';\nimport styled, { css, DefaultTheme } from 'styled-components';\nimport { mix, readableColor } from 'polished';\n\nimport { BaseProps, ForwardProps, PropsWithDefaults, AsProp } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { getHoverColors, omitProps, readableHue } from '../../styles';\nimport { useElement, useConsolidatedRef } from '../../hooks';\nimport Tooltip from '../Tooltip';\nimport Progress, { StyledProgressRing } from '../Progress';\nimport { StyledBackdrop } from '../Backdrop';\nimport { StyledIcon } from '../Icon';\nimport { StyledPopover } from '../Popover';\n\nexport interface ButtonProps extends BaseProps, AsProp {\n /** Text or content for the Button. */\n children: ReactNode;\n /**\n * Determines if the Button will be disabled.\n * @default false\n */\n disabled?: boolean;\n /** A location to navigate to. Passing an href will render an anchor styled as a Button. */\n href?: string;\n /**\n * Controls the styling of the Button.\n * @default 'secondary'\n */\n variant?: 'primary' | 'secondary' | 'simple' | 'link' | 'text';\n /**\n * Controls the behavior of a Button within a Form.\n * @default 'button'\n */\n type?: 'button' | 'reset' | 'submit';\n /**\n * Set the Icon prop to `true` if you're using just an Icon in your Button. Make sure to pass an Icon as children if `true`.\n * @default false\n */\n icon?: boolean;\n /**\n * Used for a smaller sized button.\n * @default false\n */\n compact?: boolean;\n /** The label text will be used inside a Tooltip. */\n label?: string;\n /** The aria label text will be inserted as the aria-label on the Button. */\n 'aria-label'?: string;\n /**\n * Optionally renders an indeterminate progress indicator in a button.\n * @default false\n */\n loading?: boolean;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLButtonElement>;\n}\n\ntype ButtonPropsWithDefaults = PropsWithDefaults<\n ButtonProps,\n 'variant' | 'type' | 'disabled' | 'icon' | 'loading'\n>;\n\nconst baseStyles = (theme: DefaultTheme) => {\n const {\n base: {\n spacing,\n animation: {\n speed,\n timing: { ease }\n },\n 'disabled-opacity': disabledOpacity\n },\n components: {\n button: { 'focus-shadow': focusShadow }\n }\n } = theme;\n\n return css`\n outline: none;\n text-decoration: none;\n transition-property: background-color, color, box-shadow;\n transition-duration: calc(0.5 * ${speed});\n transition-timing-function: ${ease};\n cursor: pointer;\n\n & + & {\n margin-inline-start: ${spacing};\n }\n\n /* Not able to combine with selector above. Stylis bug? */\n & + ${StyledPopover} + & {\n margin-inline-start: ${spacing};\n }\n\n &:disabled,\n &[disabled] {\n opacity: ${disabledOpacity};\n cursor: not-allowed;\n pointer-events: none;\n }\n\n &:enabled:focus,\n &:not([disabled]):focus {\n box-shadow: ${focusShadow};\n }\n `;\n};\n\nexport const StyledButton = styled.button.withConfig<ButtonPropsWithDefaults>(omitProps('loading'))(\n ({ variant, icon, loading, compact, theme }) => {\n const {\n base: {\n 'border-radius': baseBorderRadius,\n palette: { 'primary-background': backgroundColor },\n 'hit-area': {\n 'mouse-min': hitAreaMouse,\n 'finger-min': hitAreaFinger,\n 'compact-min': hitAreaCompact\n },\n animation: { speed }\n },\n components: {\n button: {\n color,\n 'secondary-color': secondaryColor,\n padding,\n 'border-radius': borderRadius,\n 'border-width': borderWidth,\n touch: { padding: touchPadding }\n }\n }\n } = theme;\n const contrastColor = tryCatch(() => readableColor(color));\n\n // Base\n const base = baseStyles(theme);\n\n // Non-text base\n const nonTextual = css`\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: ${hitAreaMouse};\n min-width: ${hitAreaMouse};\n line-height: 1;\n border: ${borderWidth} solid transparent;\n border-radius: calc(${baseBorderRadius} * ${borderRadius});\n -webkit-user-select: none;\n user-select: none;\n\n ${!icon &&\n css`\n padding: ${padding};\n `}\n\n ${icon &&\n css`\n border-radius: calc(${baseBorderRadius} * ${borderRadius});\n\n > svg {\n display: block;\n }\n `}\n\n ${compact &&\n css`\n min-height: ${hitAreaCompact};\n min-width: ${hitAreaCompact};\n `}\n\n @media (pointer: coarse) {\n border-radius: calc(${baseBorderRadius} * ${borderRadius});\n\n ${!compact &&\n css`\n min-height: ${hitAreaFinger};\n min-width: ${hitAreaFinger};\n `}\n\n ${!icon &&\n css`\n padding: ${touchPadding};\n `}\n }\n `;\n\n // Primary\n const hoverColors = getHoverColors(color);\n const hoverPrimaryColor = hoverColors.background;\n const hoverContrastColor = hoverColors.foreground;\n const primary = css`\n --button-background-color: ${color};\n color: ${contrastColor};\n background-color: ${color};\n\n @media (hover: hover) {\n &:hover {\n background-color: ${hoverPrimaryColor};\n color: ${hoverContrastColor};\n text-decoration: none;\n }\n }\n `;\n\n // Secondary\n const secondaryHoverBackgroundColor = tryCatch(() => mix(0.85, secondaryColor, color));\n const secondaryHoverForegroundColor = readableHue(\n color,\n secondaryHoverBackgroundColor ?? 'transparent'\n );\n const secondary = css`\n --button-background-color: ${secondaryColor};\n color: ${color};\n background-color: ${secondaryColor};\n border-color: ${color};\n\n @media (hover: hover) {\n &:hover {\n color: ${secondaryHoverForegroundColor};\n background-color: ${secondaryHoverBackgroundColor};\n text-decoration: none;\n border-color: ${secondaryHoverForegroundColor};\n }\n }\n `;\n\n // Simple\n const simple = css`\n --button-background-color: ${icon ? 'transparent' : backgroundColor};\n color: ${icon ? 'currentColor' : color};\n background-color: ${icon ? 'transparent' : backgroundColor};\n\n @media (hover: hover) {\n &:hover {\n ${icon &&\n css`\n ::before {\n content: '';\n position: absolute;\n top: calc(${borderWidth} * -1);\n bottom: calc(${borderWidth} * -1);\n left: calc(${borderWidth} * -1);\n right: calc(${borderWidth} * -1);\n border-radius: inherit;\n background-color: currentColor;\n opacity: 0.15;\n }\n `}\n\n ${!icon &&\n css`\n background-color: ${secondaryHoverBackgroundColor};\n color: ${secondaryHoverForegroundColor};\n border-color: ${secondaryHoverForegroundColor};\n text-decoration: none;\n `}\n }\n }\n `;\n\n return css`\n ${base}\n ${nonTextual}\n ${variant === 'primary' && primary}\n ${variant === 'secondary' && secondary}\n ${variant === 'simple' && simple}\n\n ${loading &&\n css`\n ${StyledBackdrop} {\n background-color: var(--button-background-color);\n border-radius: inherit;\n }\n\n ${StyledProgressRing} {\n width: 1em;\n height: 1em;\n circle:nth-child(2) {\n animation-duration: calc(${speed} * 2);\n }\n }\n `}\n `;\n }\n);\n\nStyledButton.defaultProps = defaultThemeProp;\n\nexport const StyledButtonLink = styled.a.withConfig<ButtonPropsWithDefaults>(omitProps('loading'))(\n ({ theme, variant }) => {\n const {\n base: {\n palette: { 'foreground-color': textColor }\n },\n components: {\n link: { color: linkColor }\n }\n } = theme;\n\n const base = baseStyles(theme);\n\n const textual = css`\n background-color: transparent;\n display: inline;\n text-align: start;\n border: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n > ${StyledIcon} {\n vertical-align: bottom;\n }\n `;\n\n const link = css`\n color: ${linkColor};\n `;\n\n const text = css`\n color: ${textColor};\n `;\n\n return css`\n ${base}\n ${textual}\n ${variant === 'link' && link}\n ${variant === 'text' && text}\n `;\n }\n);\n\nStyledButtonLink.defaultProps = defaultThemeProp;\n\nconst Button: FunctionComponent<ButtonProps & ForwardProps> = forwardRef(\n (\n {\n variant = 'secondary',\n type = 'button',\n disabled = false,\n icon = false,\n compact = false,\n href,\n as,\n forwardedAs,\n label,\n 'aria-label': ariaLabel,\n loading = false,\n children,\n ...restProps\n }: PropsWithoutRef<ButtonProps> & ForwardProps,\n ref: Ref<HTMLButtonElement>\n ) => {\n const [buttonEl, setButtonEl] = useElement();\n const mouseDownEvent = useRef<MouseEvent>();\n const buttonRef = useConsolidatedRef<HTMLButtonElement>(ref, setButtonEl);\n const isTextual = ['link', 'text'].includes(variant);\n const showProgress = loading && !isTextual;\n const StyledComp: React.ElementType = isTextual ? StyledButtonLink : StyledButton;\n\n useEffect(() => {\n return () => {\n mouseDownEvent.current = undefined;\n };\n }, []);\n\n return (\n <>\n <StyledComp\n {...restProps}\n ref={buttonRef}\n as={as || (href ? 'a' : 'button')}\n forwardedAs={forwardedAs || (href ? 'a' : 'button')}\n variant={variant}\n icon={icon}\n compact={compact}\n type={href ? undefined : type}\n href={href}\n disabled={disabled && !href}\n loading={showProgress}\n aria-label={ariaLabel || label}\n onMouseDown={(e: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n (restProps.onMouseDown as MouseEventHandler | undefined)?.(e);\n e.persist();\n mouseDownEvent.current = e;\n }}\n onMouseUp={(e: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n const shouldFocus = mouseDownEvent.current && !mouseDownEvent.current.defaultPrevented;\n mouseDownEvent.current = undefined;\n\n if (shouldFocus && buttonRef.current !== document.activeElement) {\n buttonRef.current?.focus();\n }\n\n return (restProps.onMouseUp as MouseEventHandler | undefined)?.(e);\n }}\n >\n {showProgress && <Progress variant='ring' placement='local' />}\n {children}\n </StyledComp>\n\n {buttonEl && label && (\n <Tooltip target={buttonEl} showDelay='none' hideDelay='none' describeTarget={false}>\n {label}\n </Tooltip>\n )}\n </>\n );\n }\n);\n\nexport default Button;\n"]}
@@ -13,7 +13,7 @@ export interface ColorPickerProps extends BaseProps, NoChildrenProp, TestIdProp
13
13
  id?: FormControlProps['id'];
14
14
  /**
15
15
  * Color picker value in hex
16
- * @default "#000000"
16
+ * @default '#000000'
17
17
  */
18
18
  value?: FormControlProps['value'];
19
19
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/components/ColorPicker/ColorPicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAEV,QAAQ,EAGR,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAsB,MAAM,aAAa,CAAC;AAS/D,OAAO,SAA6B,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAoB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAChG,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAuD/D,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAClC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE;IACxB,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3C,MAAM,WAAW,GAAG,KAAK,CAAC,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GAAI,EAC/D,CAAC,UAAU,IAAI,KAAK,EACrB,KAAC,OAAO,IACN,SAAS,EAAC,cAAc,EACxB,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EACzB,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,YAAY,EACjB,OAAO,EAAC,SAAS,EACjB,MAAM,EAAE,eAAe,CAAC,OAAO,YAE/B,KAAC,YAAY,IACX,YAAY,EAAE,CAAC,KAAK,EACpB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;4BACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;wBACvB,CAAC,GACD,GACM,IACL,GACG,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import {\n FC,\n forwardRef,\n Ref,\n useState,\n PropsWithoutRef,\n MouseEventHandler,\n useEffect\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually } from 'polished';\nimport { ChromePicker, ColorChangeHandler } from 'react-color';\n\nimport {\n BaseProps,\n ForwardProps,\n NoChildrenProp,\n PropsWithDefaults,\n TestIdProp\n} from '../../types';\nimport FormField, { FormFieldProps } from '../FormField';\nimport { defaultThemeProp } from '../../theme';\nimport { FormControlProps, StyledFormControl } from '../FormControl';\nimport Flex from '../Flex';\nimport { useConsolidatedRef, useUID, useElement, useOuterEvent, useTestIds } from '../../hooks';\nimport Popover from '../Popover';\n\nimport { getColorPickerTestIds } from './ColorPicker.test-ids';\n\nexport interface ColorPickerProps extends BaseProps, NoChildrenProp, TestIdProp {\n /** label for the color picker control */\n label: FormControlProps['label'];\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not passed, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /**\n * Color picker value in hex\n * @default \"#000000\"\n */\n value?: FormControlProps['value'];\n /**\n * Show color swatch without hex value display.\n * @default false\n */\n swatchOnly?: boolean;\n /**\n * Enables alpha slider.\n * @default false\n */\n alpha?: boolean;\n /** Indicate if the field is required. The browser defaults to false. */\n required?: FormControlProps['required'];\n /** Disable the control. */\n disabled?: FormControlProps['disabled'];\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Makes the input non editable and non clickable. The browser defaults to false. */\n readOnly?: FormControlProps['readOnly'];\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: FormControlProps['name'];\n /** Layout field elements inline in a row. */\n inline?: FormFieldProps['inline'];\n /** Button when clicked will show additional information on the color picker */\n additionalInfo?: FormFieldProps['additionalInfo'];\n /** onChange event handler that gets called on change of value. */\n onChange?: ColorChangeHandler;\n /** onBeforeClose of the color picker */\n onBeforeClose?: () => void;\n /** Called when the underlying input element is clicked. This should be rarely if ever used. */\n onClick?: MouseEventHandler<HTMLInputElement>;\n /** Ref placed on the input element. */\n ref?: Ref<HTMLInputElement>;\n}\n\ntype ColorPickerPropsWithDefaults = PropsWithDefaults<ColorPickerProps, 'value' | 'swatchOnly'>;\n\nconst StyledColorPicker = styled.div<Pick<ColorPickerPropsWithDefaults, 'swatchOnly'>>(\n ({ theme, swatchOnly }) => {\n const size = theme.components.input.height;\n const borderWidth = theme.components['form-control']['border-width'];\n\n return css`\n ${StyledFormControl} {\n overflow: hidden;\n text-transform: uppercase;\n ${!swatchOnly &&\n css`\n min-width: 8rem;\n `}\n\n ${!swatchOnly &&\n css`\n padding-inline-end: ${theme.base.spacing};\n `}\n\n &:focus-within {\n box-shadow: ${theme.base.shadow.focus};\n border: none;\n }\n\n & > input {\n ${hideVisually}\n\n & + div {\n height: calc(${size} - (2 * ${borderWidth}));\n\n ${swatchOnly\n ? css`\n width: calc(${size} - (2 * ${borderWidth}));\n `\n : css`\n min-width: calc(${size} - ${borderWidth});\n margin-inline-end: ${theme.base.spacing};\n border-inline-end: ${borderWidth} solid\n ${theme.components['form-control']['border-color']};\n `}\n }\n\n &:focus + div {\n width: ${size};\n height: ${size};\n }\n }\n\n & input {\n height: 2rem !important;\n min-height: 2rem;\n color: #000000 !important;\n background-color: #ffffff !important;\n font-size: 0.8125rem !important;\n font-family: ${theme.base['font-family']};\n\n & + label {\n font-weight: 600;\n color: rgba(0, 0, 0, 0.6) !important;\n font-size: 0.8125rem !important;\n font-family: ${theme.base['font-family']};\n }\n }\n }\n `;\n }\n);\n\nStyledColorPicker.defaultProps = defaultThemeProp;\n\nconst ColorPicker: FC<ColorPickerProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<ColorPickerProps>, ref: ColorPickerProps['ref']) => {\n const uid = useUID();\n const {\n testId,\n id = uid,\n value = '#000000',\n label,\n info,\n disabled,\n status,\n required,\n readOnly,\n labelHidden,\n swatchOnly = false,\n alpha = false,\n inline,\n onClick,\n onChange,\n onBeforeClose,\n additionalInfo,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getColorPickerTestIds);\n\n const inputRef = useConsolidatedRef(ref);\n const maskedSwatchRef = useConsolidatedRef<HTMLDivElement>();\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>(null);\n const [showPopOver, setShowPopOver] = useState(false);\n\n const hidePopover = () => {\n if (showPopOver) {\n onBeforeClose?.();\n }\n\n setShowPopOver(false);\n };\n\n const closePopover = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n hidePopover();\n }\n };\n\n useOuterEvent('mousedown', [popoverEl], hidePopover);\n\n useEffect(() => {\n document.addEventListener('keydown', closePopover);\n popoverEl?.addEventListener('keydown', closePopover);\n return () => {\n document.removeEventListener('keydown', closePopover);\n popoverEl?.removeEventListener('keydown', closePopover);\n };\n }, [popoverEl]);\n\n useEffect(() => {\n if (showPopOver) {\n popoverEl?.focus();\n }\n }, [showPopOver]);\n\n return (\n <FormField\n testId={testIds}\n inline={inline}\n container={inline ? { justify: 'between' } : undefined}\n as={StyledColorPicker}\n id={id}\n label={label}\n labelHidden={labelHidden}\n swatchOnly={swatchOnly}\n info={info}\n disabled={disabled}\n status={status}\n required={required}\n additionalInfo={additionalInfo}\n >\n <Flex\n container={{ alignItems: 'center' }}\n item={swatchOnly ? { alignSelf: 'start' } : undefined}\n as={StyledFormControl}\n disabled={disabled}\n status={status}\n required={required}\n readOnly={readOnly}\n onClick={readOnly || disabled ? undefined : () => setShowPopOver(true)}\n >\n <input\n data-testid={testIds.control}\n {...restProps}\n id={id}\n type={readOnly ? undefined : 'color'}\n ref={inputRef}\n defaultValue={value}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n onClick={e => {\n e.preventDefault();\n }}\n />\n <div style={{ backgroundColor: value }} ref={maskedSwatchRef} />\n {!swatchOnly && value}\n <Popover\n placement='bottom-start'\n style={{ zIndex: '3000' }}\n show={showPopOver}\n ref={setPopoverEl}\n groupId='popover'\n target={maskedSwatchRef.current}\n >\n <ChromePicker\n disableAlpha={!alpha}\n color={value}\n onChange={(color, e) => {\n onChange?.(color, e);\n }}\n />\n </Popover>\n </Flex>\n </FormField>\n );\n }\n);\n\nexport default ColorPicker;\n"]}
1
+ {"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/components/ColorPicker/ColorPicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAEV,QAAQ,EAGR,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAsB,MAAM,aAAa,CAAC;AAS/D,OAAO,SAA6B,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAoB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,IAAI,MAAM,SAAS,CAA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,KACxB,SAAS,EACb,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EACpC,GAAG,EAAE,QAAQ,EACb,YAAY,EAAE,KAAK,EACnB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,CAAC,CAAC,EAAE;wBACX,CAAC,CAAC,cAAc,EAAE,CAAC;oBACrB,CAAC,GACD,EACF,cAAK,KAAK,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,eAAe,GAAI,EAC/D,CAAC,UAAU,IAAI,KAAK,EACrB,KAAC,OAAO,IACN,SAAS,EAAC,cAAc,EACxB,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EACzB,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,YAAY,EACjB,OAAO,EAAC,SAAS,EACjB,MAAM,EAAE,eAAe,CAAC,OAAO,YAE/B,KAAC,YAAY,IACX,YAAY,EAAE,CAAC,KAAK,EACpB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;4BACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;wBACvB,CAAC,GACD,GACM,IACL,GACG,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import {\n FC,\n forwardRef,\n Ref,\n useState,\n PropsWithoutRef,\n MouseEventHandler,\n useEffect\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually } from 'polished';\nimport { ChromePicker, ColorChangeHandler } from 'react-color';\n\nimport {\n BaseProps,\n ForwardProps,\n NoChildrenProp,\n PropsWithDefaults,\n TestIdProp\n} from '../../types';\nimport FormField, { FormFieldProps } from '../FormField';\nimport { defaultThemeProp } from '../../theme';\nimport { FormControlProps, StyledFormControl } from '../FormControl';\nimport Flex from '../Flex';\nimport { useConsolidatedRef, useUID, useElement, useOuterEvent, useTestIds } from '../../hooks';\nimport Popover from '../Popover';\n\nimport { getColorPickerTestIds } from './ColorPicker.test-ids';\n\nexport interface ColorPickerProps extends BaseProps, NoChildrenProp, TestIdProp {\n /** label for the color picker control */\n label: FormControlProps['label'];\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not passed, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /**\n * Color picker value in hex\n * @default '#000000'\n */\n value?: FormControlProps['value'];\n /**\n * Show color swatch without hex value display.\n * @default false\n */\n swatchOnly?: boolean;\n /**\n * Enables alpha slider.\n * @default false\n */\n alpha?: boolean;\n /** Indicate if the field is required. The browser defaults to false. */\n required?: FormControlProps['required'];\n /** Disable the control. */\n disabled?: FormControlProps['disabled'];\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Makes the input non editable and non clickable. The browser defaults to false. */\n readOnly?: FormControlProps['readOnly'];\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: FormControlProps['name'];\n /** Layout field elements inline in a row. */\n inline?: FormFieldProps['inline'];\n /** Button when clicked will show additional information on the color picker */\n additionalInfo?: FormFieldProps['additionalInfo'];\n /** onChange event handler that gets called on change of value. */\n onChange?: ColorChangeHandler;\n /** onBeforeClose of the color picker */\n onBeforeClose?: () => void;\n /** Called when the underlying input element is clicked. This should be rarely if ever used. */\n onClick?: MouseEventHandler<HTMLInputElement>;\n /** Ref placed on the input element. */\n ref?: Ref<HTMLInputElement>;\n}\n\ntype ColorPickerPropsWithDefaults = PropsWithDefaults<ColorPickerProps, 'value' | 'swatchOnly'>;\n\nconst StyledColorPicker = styled.div<Pick<ColorPickerPropsWithDefaults, 'swatchOnly'>>(\n ({ theme, swatchOnly }) => {\n const size = theme.components.input.height;\n const borderWidth = theme.components['form-control']['border-width'];\n\n return css`\n ${StyledFormControl} {\n overflow: hidden;\n text-transform: uppercase;\n ${!swatchOnly &&\n css`\n min-width: 8rem;\n `}\n\n ${!swatchOnly &&\n css`\n padding-inline-end: ${theme.base.spacing};\n `}\n\n &:focus-within {\n box-shadow: ${theme.base.shadow.focus};\n border: none;\n }\n\n & > input {\n ${hideVisually}\n\n & + div {\n height: calc(${size} - (2 * ${borderWidth}));\n\n ${swatchOnly\n ? css`\n width: calc(${size} - (2 * ${borderWidth}));\n `\n : css`\n min-width: calc(${size} - ${borderWidth});\n margin-inline-end: ${theme.base.spacing};\n border-inline-end: ${borderWidth} solid\n ${theme.components['form-control']['border-color']};\n `}\n }\n\n &:focus + div {\n width: ${size};\n height: ${size};\n }\n }\n\n & input {\n height: 2rem !important;\n min-height: 2rem;\n color: #000000 !important;\n background-color: #ffffff !important;\n font-size: 0.8125rem !important;\n font-family: ${theme.base['font-family']};\n\n & + label {\n font-weight: 600;\n color: rgba(0, 0, 0, 0.6) !important;\n font-size: 0.8125rem !important;\n font-family: ${theme.base['font-family']};\n }\n }\n }\n `;\n }\n);\n\nStyledColorPicker.defaultProps = defaultThemeProp;\n\nconst ColorPicker: FC<ColorPickerProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<ColorPickerProps>, ref: ColorPickerProps['ref']) => {\n const uid = useUID();\n const {\n testId,\n id = uid,\n value = '#000000',\n label,\n info,\n disabled,\n status,\n required,\n readOnly,\n labelHidden,\n swatchOnly = false,\n alpha = false,\n inline,\n onClick,\n onChange,\n onBeforeClose,\n additionalInfo,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getColorPickerTestIds);\n\n const inputRef = useConsolidatedRef(ref);\n const maskedSwatchRef = useConsolidatedRef<HTMLDivElement>();\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>(null);\n const [showPopOver, setShowPopOver] = useState(false);\n\n const hidePopover = () => {\n if (showPopOver) {\n onBeforeClose?.();\n }\n\n setShowPopOver(false);\n };\n\n const closePopover = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n hidePopover();\n }\n };\n\n useOuterEvent('mousedown', [popoverEl], hidePopover);\n\n useEffect(() => {\n document.addEventListener('keydown', closePopover);\n popoverEl?.addEventListener('keydown', closePopover);\n return () => {\n document.removeEventListener('keydown', closePopover);\n popoverEl?.removeEventListener('keydown', closePopover);\n };\n }, [popoverEl]);\n\n useEffect(() => {\n if (showPopOver) {\n popoverEl?.focus();\n }\n }, [showPopOver]);\n\n return (\n <FormField\n testId={testIds}\n inline={inline}\n container={inline ? { justify: 'between' } : undefined}\n as={StyledColorPicker}\n id={id}\n label={label}\n labelHidden={labelHidden}\n swatchOnly={swatchOnly}\n info={info}\n disabled={disabled}\n status={status}\n required={required}\n additionalInfo={additionalInfo}\n >\n <Flex\n container={{ alignItems: 'center' }}\n item={swatchOnly ? { alignSelf: 'start' } : undefined}\n as={StyledFormControl}\n disabled={disabled}\n status={status}\n required={required}\n readOnly={readOnly}\n onClick={readOnly || disabled ? undefined : () => setShowPopOver(true)}\n >\n <input\n data-testid={testIds.control}\n {...restProps}\n id={id}\n type={readOnly ? undefined : 'color'}\n ref={inputRef}\n defaultValue={value}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n onClick={e => {\n e.preventDefault();\n }}\n />\n <div style={{ backgroundColor: value }} ref={maskedSwatchRef} />\n {!swatchOnly && value}\n <Popover\n placement='bottom-start'\n style={{ zIndex: '3000' }}\n show={showPopOver}\n ref={setPopoverEl}\n groupId='popover'\n target={maskedSwatchRef.current}\n >\n <ChromePicker\n disableAlpha={!alpha}\n color={value}\n onChange={(color, e) => {\n onChange?.(color, e);\n }}\n />\n </Popover>\n </Flex>\n </FormField>\n );\n }\n);\n\nexport default ColorPicker;\n"]}
@@ -29,13 +29,9 @@ export interface CompositeInputProps<P extends object = object> extends BaseProp
29
29
  additionalInfo?: FormControlProps['additionalInfo'];
30
30
  /** Value form options. */
31
31
  dialog: {
32
- /**
33
- * A component to render the main portion of the form.
34
- */
32
+ /** A component to render the main portion of the form. */
35
33
  renderer: ComponentType<P>;
36
- /**
37
- * A props object that will be passed to the form renderer.
38
- */
34
+ /** A props object that will be passed to the form renderer. */
39
35
  rendererProps?: DeferInfer<P>;
40
36
  /** Callback when cancel button is clicked. */
41
37
  onCancel: ({ close }: {
@@ -1 +1 @@
1
- {"version":3,"file":"CompositeInput.types.d.ts","sourceRoot":"","sources":["../../../src/components/CompositeInput/CompositeInput.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAC5D,SAAQ,SAAS,EACf,cAAc,EACd,UAAU;IACZ;;;OAGG;IACH,EAAE,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC5B,oDAAoD;IACpD,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACpC,2DAA2D;IAC3D,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClC,uCAAuC;IACvC,WAAW,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC9C,6GAA6G;IAC7G,IAAI,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChC,wEAAwE;IACxE,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,kDAAkD;IAClD,K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IAC3D,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClC,uCAAuC;IACvC,WAAW,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC9C,6GAA6G;IAC7G,IAAI,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChC,wEAAwE;IACxE,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,WAAW,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC9C,mFAAmF;IACnF,cAAc,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACpD,0BAA0B;IAC1B,MAAM,EAAE;QACN,0DAA0D;QAC1D,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QAC3B,+DAA+D;QAC/D,aAAa,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;QAC9B,8CAA8C;QAC9C,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;YAAE,KAAK,EAAE,MAAM,IAAI,CAAA;SAAE,KAAK,IAAI,CAAC;QACrD,6CAA6C;QAC7C,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;YAAE,KAAK,EAAE,MAAM,IAAI,CAAA;SAAE,KAAK,IAAI,CAAC;KACrD,CAAC;IACF,6CAA6C;IAC7C,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"CompositeInput.types.js","sourceRoot":"","sources":["../../../src/components/CompositeInput/CompositeInput.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ComponentType, Ref } from 'react';\n\nimport { BaseProps, DeferInfer, NoChildrenProp, TestIdProp } from '../../types';\nimport { FormControlProps } from '../FormControl';\n\nexport interface CompositeInputProps<P extends object = object>\n extends BaseProps,\n NoChildrenProp,\n TestIdProp {\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Indicate if the field is required. The browser defaults to false. */\n required?: FormControlProps['required'];\n /** Disable the control. The browser defaults to false. */\n disabled?: FormControlProps['disabled'];\n /** Callback when clear button is clicked. */\n onClear: () => void;\n /** String representation of the complex value. */\n value?: string;\n /** Text visible when on value has been set. */\n placeholder?: FormControlProps['placeholder'];\n /** Button when clicked will show additional information for the composite input */\n additionalInfo?: FormControlProps['additionalInfo'];\n /** Value form options. */\n dialog: {\n /**\n * A component to render the main portion of the form.\n */\n renderer: ComponentType<P>;\n /**\n * A props object that will be passed to the form renderer.\n */\n rendererProps?: DeferInfer<P>;\n /** Callback when cancel button is clicked. */\n onCancel: ({ close }: { close: () => void }) => void;\n /** Callback when apply button is clicked. */\n onApply: ({ close }: { close: () => void }) => void;\n };\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n"]}
1
+ {"version":3,"file":"CompositeInput.types.js","sourceRoot":"","sources":["../../../src/components/CompositeInput/CompositeInput.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ComponentType, Ref } from 'react';\n\nimport { BaseProps, DeferInfer, NoChildrenProp, TestIdProp } from '../../types';\nimport { FormControlProps } from '../FormControl';\n\nexport interface CompositeInputProps<P extends object = object>\n extends BaseProps,\n NoChildrenProp,\n TestIdProp {\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Indicate if the field is required. The browser defaults to false. */\n required?: FormControlProps['required'];\n /** Disable the control. The browser defaults to false. */\n disabled?: FormControlProps['disabled'];\n /** Callback when clear button is clicked. */\n onClear: () => void;\n /** String representation of the complex value. */\n value?: string;\n /** Text visible when on value has been set. */\n placeholder?: FormControlProps['placeholder'];\n /** Button when clicked will show additional information for the composite input */\n additionalInfo?: FormControlProps['additionalInfo'];\n /** Value form options. */\n dialog: {\n /** A component to render the main portion of the form. */\n renderer: ComponentType<P>;\n /** A props object that will be passed to the form renderer. */\n rendererProps?: DeferInfer<P>;\n /** Callback when cancel button is clicked. */\n onCancel: ({ close }: { close: () => void }) => void;\n /** Callback when apply button is clicked. */\n onApply: ({ close }: { close: () => void }) => void;\n };\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n"]}
@@ -3,46 +3,28 @@ import { ThemeMachineLike, DefaultSettableTheme, DefaultThemeDefinition } from '
3
3
  import { Translation, TranslationPack } from '../../i18n';
4
4
  import '../../init';
5
5
  export interface ConfigurationProps {
6
- /**
7
- * Any components or nodes that should be impacted by the settings applied by this Configuration component.
8
- */
6
+ /** Any components or nodes that should be impacted by the settings applied by this Configuration component. */
9
7
  children: ReactNode;
10
- /**
11
- * User locale as defined in [BCP-47](https://www.techonthenet.com/js/language_tags.php).
12
- */
8
+ /** User locale as defined in [BCP-47](https://www.techonthenet.com/js/language_tags.php). */
13
9
  locale?: string;
14
- /**
15
- * Override rendering direction of the document. Direction will be based on the locale if now provided.
16
- */
10
+ /** Override rendering direction of the document. Direction will be based on the locale if now provided. */
17
11
  direction?: 'ltr' | 'rtl';
18
- /**
19
- * Object with (partial) translations.
20
- */
12
+ /** Object with (partial) translations. */
21
13
  translations?: Translation;
22
- /**
23
- * Theme object used to override any or all Cosmos theme properties.
24
- */
14
+ /** Theme object used to override any or all Cosmos theme properties. */
25
15
  theme?: DefaultSettableTheme;
26
- /**
27
- * Disables loading Open Sans from Google Fonts. Only takes effect on the root configuration.
28
- */
16
+ /** Disables loading Open Sans from Google Fonts. Only takes effect on the root configuration. */
29
17
  disableDefaultFontLoading?: boolean;
30
- /**
31
- * Target element for loading styles related to `styled-components`.
32
- */
18
+ /** Target element for loading styles related to `styled-components`. */
33
19
  styleSheetTarget?: HTMLElement;
34
- /**
35
- * Target element for rendering a `ReactDOM` portal.
36
- */
20
+ /** Target element for rendering a `ReactDOM` portal. */
37
21
  portalTarget?: Element;
38
22
  /**
39
23
  * Use native HTML5 controls for inputs instead of rich ones.
40
24
  * @default false
41
25
  */
42
26
  renderNativeControls?: boolean;
43
- /**
44
- * String to identify this configuration instance.
45
- */
27
+ /** String to identify this configuration instance. */
46
28
  id?: string;
47
29
  /**
48
30
  * Enable/disable testId attribute rendering for all components.
@@ -1 +1 @@
1
- {"version":3,"file":"Configuration.d.ts","sourceRoot":"","sources":["../../../src/components/Configuration/Configuration.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EACjB,SAAS,EAIT,OAAO,EACP,gBAAgB,EACjB,MAAM,OAAO,CAAC;AAKf,OAAO,EAEL,gBAAgB,EAEhB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,WAAW,EACX,eAAe,EAGhB,MAAM,YAAY,CAAC;AAGpB,OAAO,YAAY,CAAC;AAEpB,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAA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AAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;KAC3D;CACF;AAUD,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,CAiFxD,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"Configuration.d.ts","sourceRoot":"","sources":["../../../src/components/Configuration/Configuration.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EACjB,SAAS,EAIT,OAAO,EACP,gBAAgB,EACjB,MAAM,OAAO,CAAC;AAKf,OAAO,EAEL,gBAAgB,EAEhB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,WAAW,EACX,eAAe,EAGhB,MAAM,YAAY,CAAC;AAGpB,OAAO,YAAY,CAAC;AAEpB,MAAM,WAAW,kBAAkB;IACjC,+GAA+G;IAC/G,QAAQ,EAAE,SAAS,CAAC;IACpB,6FAA6F;IAC7F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2GAA2G;IAC3G,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAC1B,0CAA0C;IAC1C,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,wEAAwE;IACxE,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,iGAAiG;IACjG,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,WAAW,CAAC;IAC/B,wDAAwD;IACxD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,sDAAsD;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAC3C,YAAY,EAAE,eAAe,CAAC;IAC9B,YAAY,EAAE,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;IACvD,gBAAgB,CAAC,EAAE,WAAW,CAAC;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACrC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACxC,gBAAgB;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB;AAID,eAAO,MAAM,oBAAoB,oCAW/B,CAAC;AAIH,UAAU,cAAc;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AA4BD,OAAO,QAAQ,YAAY,CAAC;IAC1B,UAAiB,aAAa;QAC5B,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;QAC7B,oBAAoB,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;KAC3D;CACF;AAUD,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,CAiFxD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../src/components/Configuration/Configuration.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,UAAU,EAGV,OAAO,EACP,QAAQ,EACR,SAAS,EAGV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EACL,YAAY,EAEZ,gBAAgB,EAGjB,MAAM,aAAa,CAAC;AACrB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AEF,OAAO,CACL,KAAC,OAAO,CAAC,QAAQ;IACf,mEAAmE;;QAAnE,mEAAmE;QACnE,KAAK,EAAE;YACL,MAAM,EAAE,MAAM,IAAI,GAAG,CAAC,MAAM;YAC5B,SAAS,EAAE,SAAS,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;YAC1F,YAAY;YACZ,YAAY;YACZ,gBAAgB,EAAE,gBAAgB,IAAI,GAAG,CAAC,gBAAgB;YAC1D,YAAY,EAAE,YAAY,IAAI,GAAG,CAAC,YAAY;YAC9C,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,oBAAoB,EAAE,oBAAoB,IAAI,GAAG,CAAC,oBAAoB;YACtE,OAAO,EAAE,OAAO,IAAI,GAAG,CAAC,OAAO;YAC/B,WAAW,EAAE,IAAI;SAClB,YAED,KAAC,aAAa,IAAC,KAAK,EAAE,YAAY,CAAC,KAAK,YAAG,eAAe,GAAiB,GAC1D,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n createContext,\n useContext,\n FunctionComponent,\n ReactNode,\n useMemo,\n useState,\n useEffect,\n Context,\n MutableRefObject\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { ThemeProvider, StyleSheetManager } from 'styled-components';\n\nimport { GlobalStyle } from '../../styles';\nimport {\n ThemeMachine,\n ThemeMachineLike,\n BaseThemeMachine,\n DefaultSettableTheme,\n DefaultThemeDefinition\n} from '../../theme';\nimport {\n createTranslationPack,\n Translation,\n TranslationPack,\n DefaultTranslation,\n direction as directionOfLocale\n} from '../../i18n';\nimport { windowIsAvailable, navigatorIsAvailable, documentIsAvailable } from '../../utils';\nimport pkg from '../../../package.json';\nimport '../../init';\n\nexport interface ConfigurationProps {\n /**\n * Any components or nodes that should be impacted by the settings applied by this Configuration component.\n */\n children: ReactNode;\n /**\n * User locale as defined in [BCP-47](https://www.techonthenet.com/js/language_tags.php).\n */\n locale?: string;\n /**\n * Override rendering direction of the document. Direction will be based on the locale if now provided.\n */\n direction?: 'ltr' | 'rtl';\n /**\n * Object with (partial) translations.\n */\n translations?: Translation;\n /**\n * Theme object used to override any or all Cosmos theme properties.\n */\n theme?: DefaultSettableTheme;\n /**\n * Disables loading Open Sans from Google Fonts. Only takes effect on the root configuration.\n */\n disableDefaultFontLoading?: boolean;\n /**\n * Target element for loading styles related to `styled-components`.\n */\n styleSheetTarget?: HTMLElement;\n /**\n * Target element for rendering a `ReactDOM` portal.\n */\n portalTarget?: Element;\n /**\n * Use native HTML5 controls for inputs instead of rich ones.\n * @default false\n */\n renderNativeControls?: boolean;\n /**\n * String to identify this configuration instance.\n */\n id?: string;\n /**\n * Enable/disable testId attribute rendering for all components.\n * @default true\n */\n testIds?: boolean;\n}\n\nexport interface ConfigurationContextValue {\n locale: string;\n direction: ConfigurationProps['direction'];\n translations: TranslationPack;\n themeMachine: ThemeMachineLike<DefaultThemeDefinition>;\n styleSheetTarget?: HTMLElement;\n portalTarget?: Element;\n loadedRef: MutableRefObject<boolean>;\n renderNativeControls: boolean;\n testIds?: ConfigurationProps['testIds'];\n /** @internal */\n initialized: boolean;\n}\n\nconst defaultLocale = navigatorIsAvailable ? navigator.language : 'en';\n\nexport const ConfigurationContext = createContext<ConfigurationContextValue>({\n locale: defaultLocale,\n direction: directionOfLocale(defaultLocale),\n translations: DefaultTranslation,\n themeMachine: BaseThemeMachine,\n styleSheetTarget: documentIsAvailable ? document.head : undefined,\n portalTarget: documentIsAvailable ? document.body : undefined,\n loadedRef: { current: false },\n renderNativeControls: false,\n testIds: true,\n initialized: false\n});\n\nconst mountedConfigs = new Set<symbol>();\n\ninterface CosmosInstance {\n version: string;\n mountedConfigs: string[];\n mountOrder: string[];\n mountCount: Record<string, number>;\n}\n\nconst instance: CosmosInstance = {\n version: pkg.version,\n mountedConfigs: [],\n mountOrder: [],\n mountCount: {}\n};\n\nconst mountConfig = (sym: symbol) => {\n mountedConfigs.add(sym);\n instance.mountedConfigs = [...mountedConfigs].map(i => i.description ?? 'Unknown');\n\n const description = sym.description ?? 'Unknown';\n\n instance.mountOrder.push(description);\n\n if (!(description in instance.mountCount)) {\n instance.mountCount[description] = 0;\n }\n instance.mountCount[description] += 1;\n};\n\nconst unmountConfig = (sym: symbol) => {\n mountedConfigs.delete(sym);\n instance.mountedConfigs = [...mountedConfigs].map(i => i.description ?? 'Unknown');\n};\n\ndeclare module '../../init' {\n export interface CosmosGlobals {\n instances?: CosmosInstance[];\n configurationContext?: Context<ConfigurationContextValue>;\n }\n}\n\nif (windowIsAvailable) {\n if (!window.cosmos.instances) {\n window.cosmos.instances = [];\n }\n\n window.cosmos.instances.push(instance);\n}\n\nconst Configuration: FunctionComponent<ConfigurationProps> = ({\n children,\n locale,\n direction,\n translations: customTranslations,\n theme,\n disableDefaultFontLoading,\n styleSheetTarget,\n portalTarget,\n renderNativeControls,\n testIds,\n id\n}: ConfigurationProps) => {\n const context = windowIsAvailable\n ? window.cosmos.configurationContext ?? ConfigurationContext\n : ConfigurationContext;\n const ctx = useContext(context);\n const themeMachine = theme\n ? new ThemeMachine<DefaultThemeDefinition>({ theme, parent: ctx.themeMachine })\n : ctx.themeMachine;\n const translations = useMemo(\n () => createTranslationPack({ ...ctx.translations, ...customTranslations }),\n [ctx.translations, customTranslations]\n );\n\n const [mounted, setMounted] = useState(false);\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n useEffect(() => {\n const sym = Symbol(id);\n mountConfig(sym);\n\n return () => {\n unmountConfig(sym);\n };\n }, [id]);\n\n const wrappedChildren = ctx.initialized ? (\n children\n ) : (\n <StyleSheetManager disableVendorPrefixes target={styleSheetTarget ?? ctx.styleSheetTarget}>\n <>\n {!disableDefaultFontLoading &&\n mounted &&\n documentIsAvailable &&\n createPortal(\n <link\n rel='stylesheet'\n href='https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400..700;1,400..700&display=swap'\n data-cosmos-global-style\n />,\n styleSheetTarget ?? ctx.styleSheetTarget ?? document.head\n )}\n <GlobalStyle />\n {children}\n </>\n </StyleSheetManager>\n );\n\n return (\n <context.Provider\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n value={{\n locale: locale ?? ctx.locale,\n direction: direction ?? (locale !== undefined ? directionOfLocale(locale) : ctx.direction),\n translations,\n themeMachine,\n styleSheetTarget: styleSheetTarget ?? ctx.styleSheetTarget,\n portalTarget: portalTarget ?? ctx.portalTarget,\n loadedRef: ctx.loadedRef,\n renderNativeControls: renderNativeControls ?? ctx.renderNativeControls,\n testIds: testIds ?? ctx.testIds,\n initialized: true\n }}\n >\n <ThemeProvider theme={themeMachine.theme}>{wrappedChildren}</ThemeProvider>\n </context.Provider>\n );\n};\n\nexport default Configuration;\n"]}
1
+ {"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../src/components/Configuration/Configuration.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,UAAU,EAGV,OAAO,EACP,QAAQ,EACR,SAAS,EAGV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EACL,YAAY,EAEZ,gBAAgB,EAGjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,qBAAqB,EAGrB,kBAAkB,EAClB,SAAS,IAAI,iBAAiB,EAC/B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,GAAG,MAAM,uBAAuB,CAAC;AACxC,OAAO,YAAY,CAAC;AA+CpB,MAAM,aAAa,GAAG,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CA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EAAE,gBAAgB,IAAI,GAAG,CAAC,gBAAgB;YAC1D,YAAY,EAAE,YAAY,IAAI,GAAG,CAAC,YAAY;YAC9C,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,oBAAoB,EAAE,oBAAoB,IAAI,GAAG,CAAC,oBAAoB;YACtE,OAAO,EAAE,OAAO,IAAI,GAAG,CAAC,OAAO;YAC/B,WAAW,EAAE,IAAI;SAClB,YAED,KAAC,aAAa,IAAC,KAAK,EAAE,YAAY,CAAC,KAAK,YAAG,eAAe,GAAiB,GAC1D,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n createContext,\n useContext,\n FunctionComponent,\n ReactNode,\n useMemo,\n useState,\n useEffect,\n Context,\n MutableRefObject\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { ThemeProvider, StyleSheetManager } from 'styled-components';\n\nimport { GlobalStyle } from '../../styles';\nimport {\n ThemeMachine,\n ThemeMachineLike,\n BaseThemeMachine,\n DefaultSettableTheme,\n DefaultThemeDefinition\n} from '../../theme';\nimport {\n createTranslationPack,\n Translation,\n TranslationPack,\n DefaultTranslation,\n direction as directionOfLocale\n} from '../../i18n';\nimport { windowIsAvailable, navigatorIsAvailable, documentIsAvailable } from '../../utils';\nimport pkg from '../../../package.json';\nimport '../../init';\n\nexport interface ConfigurationProps {\n /** Any components or nodes that should be impacted by the settings applied by this Configuration component. */\n children: ReactNode;\n /** User locale as defined in [BCP-47](https://www.techonthenet.com/js/language_tags.php). */\n locale?: string;\n /** Override rendering direction of the document. Direction will be based on the locale if now provided. */\n direction?: 'ltr' | 'rtl';\n /** Object with (partial) translations. */\n translations?: Translation;\n /** Theme object used to override any or all Cosmos theme properties. */\n theme?: DefaultSettableTheme;\n /** Disables loading Open Sans from Google Fonts. Only takes effect on the root configuration. */\n disableDefaultFontLoading?: boolean;\n /** Target element for loading styles related to `styled-components`. */\n styleSheetTarget?: HTMLElement;\n /** Target element for rendering a `ReactDOM` portal. */\n portalTarget?: Element;\n /**\n * Use native HTML5 controls for inputs instead of rich ones.\n * @default false\n */\n renderNativeControls?: boolean;\n /** String to identify this configuration instance. */\n id?: string;\n /**\n * Enable/disable testId attribute rendering for all components.\n * @default true\n */\n testIds?: boolean;\n}\n\nexport interface ConfigurationContextValue {\n locale: string;\n direction: ConfigurationProps['direction'];\n translations: TranslationPack;\n themeMachine: ThemeMachineLike<DefaultThemeDefinition>;\n styleSheetTarget?: HTMLElement;\n portalTarget?: Element;\n loadedRef: MutableRefObject<boolean>;\n renderNativeControls: boolean;\n testIds?: ConfigurationProps['testIds'];\n /** @internal */\n initialized: boolean;\n}\n\nconst defaultLocale = navigatorIsAvailable ? navigator.language : 'en';\n\nexport const ConfigurationContext = createContext<ConfigurationContextValue>({\n locale: defaultLocale,\n direction: directionOfLocale(defaultLocale),\n translations: DefaultTranslation,\n themeMachine: BaseThemeMachine,\n styleSheetTarget: documentIsAvailable ? document.head : undefined,\n portalTarget: documentIsAvailable ? document.body : undefined,\n loadedRef: { current: false },\n renderNativeControls: false,\n testIds: true,\n initialized: false\n});\n\nconst mountedConfigs = new Set<symbol>();\n\ninterface CosmosInstance {\n version: string;\n mountedConfigs: string[];\n mountOrder: string[];\n mountCount: Record<string, number>;\n}\n\nconst instance: CosmosInstance = {\n version: pkg.version,\n mountedConfigs: [],\n mountOrder: [],\n mountCount: {}\n};\n\nconst mountConfig = (sym: symbol) => {\n mountedConfigs.add(sym);\n instance.mountedConfigs = [...mountedConfigs].map(i => i.description ?? 'Unknown');\n\n const description = sym.description ?? 'Unknown';\n\n instance.mountOrder.push(description);\n\n if (!(description in instance.mountCount)) {\n instance.mountCount[description] = 0;\n }\n instance.mountCount[description] += 1;\n};\n\nconst unmountConfig = (sym: symbol) => {\n mountedConfigs.delete(sym);\n instance.mountedConfigs = [...mountedConfigs].map(i => i.description ?? 'Unknown');\n};\n\ndeclare module '../../init' {\n export interface CosmosGlobals {\n instances?: CosmosInstance[];\n configurationContext?: Context<ConfigurationContextValue>;\n }\n}\n\nif (windowIsAvailable) {\n if (!window.cosmos.instances) {\n window.cosmos.instances = [];\n }\n\n window.cosmos.instances.push(instance);\n}\n\nconst Configuration: FunctionComponent<ConfigurationProps> = ({\n children,\n locale,\n direction,\n translations: customTranslations,\n theme,\n disableDefaultFontLoading,\n styleSheetTarget,\n portalTarget,\n renderNativeControls,\n testIds,\n id\n}: ConfigurationProps) => {\n const context = windowIsAvailable\n ? window.cosmos.configurationContext ?? ConfigurationContext\n : ConfigurationContext;\n const ctx = useContext(context);\n const themeMachine = theme\n ? new ThemeMachine<DefaultThemeDefinition>({ theme, parent: ctx.themeMachine })\n : ctx.themeMachine;\n const translations = useMemo(\n () => createTranslationPack({ ...ctx.translations, ...customTranslations }),\n [ctx.translations, customTranslations]\n );\n\n const [mounted, setMounted] = useState(false);\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n useEffect(() => {\n const sym = Symbol(id);\n mountConfig(sym);\n\n return () => {\n unmountConfig(sym);\n };\n }, [id]);\n\n const wrappedChildren = ctx.initialized ? (\n children\n ) : (\n <StyleSheetManager disableVendorPrefixes target={styleSheetTarget ?? ctx.styleSheetTarget}>\n <>\n {!disableDefaultFontLoading &&\n mounted &&\n documentIsAvailable &&\n createPortal(\n <link\n rel='stylesheet'\n href='https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400..700;1,400..700&display=swap'\n data-cosmos-global-style\n />,\n styleSheetTarget ?? ctx.styleSheetTarget ?? document.head\n )}\n <GlobalStyle />\n {children}\n </>\n </StyleSheetManager>\n );\n\n return (\n <context.Provider\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n value={{\n locale: locale ?? ctx.locale,\n direction: direction ?? (locale !== undefined ? directionOfLocale(locale) : ctx.direction),\n translations,\n themeMachine,\n styleSheetTarget: styleSheetTarget ?? ctx.styleSheetTarget,\n portalTarget: portalTarget ?? ctx.portalTarget,\n loadedRef: ctx.loadedRef,\n renderNativeControls: renderNativeControls ?? ctx.renderNativeControls,\n testIds: testIds ?? ctx.testIds,\n initialized: true\n }}\n >\n <ThemeProvider theme={themeMachine.theme}>{wrappedChildren}</ThemeProvider>\n </context.Provider>\n );\n};\n\nexport default Configuration;\n"]}
@@ -7,7 +7,7 @@ import type { FormattingOptions } from './CreditCard.types';
7
7
  export declare const formatCreditCard: (value: string, { obfuscation }?: FormattingOptions) => string;
8
8
  /** Returns maximum total length of formatted credit card of given type including gaps. */
9
9
  export declare const creditCardTotalLength: (cardType: string) => number;
10
- /** Returns true if given first numbers match a pattern of any card, false otherwise. */
10
+ /** Returns true if given first numbers match a pattern of any card, false otherwise. */
11
11
  export declare const isPossibleCardNumber: (cardNumber: string) => boolean;
12
12
  /** Returns true if given card number is valid (matches the pattern and length of a card type), false otherwise. */
13
13
  export declare const isValidCreditCard: (cardNumber: number) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/CreditCard/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAe5D;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,UACpB,MAAM,oBACa,iBAAiB,KAC1C,MAaF,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,qBAAqB,aAAc,MAAM,KAAG,MAGxD,CAAC;AAEF,yFAAyF;AACzF,eAAO,MAAM,oBAAoB,eAAgB,MAAM,KAAG,OAEzD,CAAC;AAEF,mHAAmH;AACnH,eAAO,MAAM,iBAAiB,eAAgB,MAAM,KAAG,OAKtD,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/CreditCard/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAe5D;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,UACpB,MAAM,oBACa,iBAAiB,KAC1C,MAaF,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,qBAAqB,aAAc,MAAM,KAAG,MAGxD,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,oBAAoB,eAAgB,MAAM,KAAG,OAEzD,CAAC;AAEF,mHAAmH;AACnH,eAAO,MAAM,iBAAiB,eAAgB,MAAM,KAAG,OAKtD,CAAC"}
@@ -31,7 +31,7 @@ export const creditCardTotalLength = (cardType) => {
31
31
  const type = getTypeInfo(cardType);
32
32
  return Math.max(...type.lengths) + type.gaps.length;
33
33
  };
34
- /** Returns true if given first numbers match a pattern of any card, false otherwise. */
34
+ /** Returns true if given first numbers match a pattern of any card, false otherwise. */
35
35
  export const isPossibleCardNumber = (cardNumber) => {
36
36
  return creditCardType(cardNumber).length > 0;
37
37
  };
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/CreditCard/utils.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,EAAE,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/D,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,IAAc,EAAU,EAAE;IAChE,MAAM,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CACxB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,EAClC,KAAK,CAAC,MAAM,CACb,CAAC;IAEF,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QACjD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KAC1D;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC,CAAC;AAEF;;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AW,EAAE;IAC/D,OAAO,CACL,cAAc,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC;QACxF,KAAK,CACN,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import creditCardType, { getTypeInfo } from 'credit-card-type';\n\nimport type { FormattingOptions } from './CreditCard.types';\n\nconst prettyPrintCard = (value: string, gaps: number[]): string => {\n const offsets = [0].concat(\n gaps.filter(n => n < value.length),\n value.length\n );\n\n const groups = [];\n for (let i = 0; offsets[i] < value.length; i += 1) {\n groups.push(value.substring(offsets[i], offsets[i + 1]));\n }\n return groups.join(' ');\n};\n\n/**\n * Returns a formatted and obfuscated on demand partial credit card number.\n * @param value starting, partial number.\n * @param formattingOptions additional formatting options\n */\nexport const formatCreditCard = (\n value: string,\n { obfuscation = 'none' }: FormattingOptions = {}\n): string => {\n let result;\n switch (obfuscation) {\n case 'none':\n result = prettyPrintCard(value, creditCardType(value)[0]?.gaps ?? []);\n break;\n case 'partial':\n result = prettyPrintCard(value.slice(-4).padStart(16, '•'), [4, 8, 12]);\n break;\n default:\n result = Array.from({ length: 4 }).fill('•'.repeat(4)).join(' ');\n }\n return result;\n};\n\n/** Returns maximum total length of formatted credit card of given type including gaps. */\nexport const creditCardTotalLength = (cardType: string): number => {\n const type = getTypeInfo(cardType);\n return Math.max(...type.lengths) + type.gaps.length;\n};\n\n/** Returns true if given first numbers match a pattern of any card, false otherwise. */\nexport const isPossibleCardNumber = (cardNumber: string): boolean => {\n return creditCardType(cardNumber).length > 0;\n};\n\n/** Returns true if given card number is valid (matches the pattern and length of a card type), false otherwise. */\nexport const isValidCreditCard = (cardNumber: number): boolean => {\n return (\n creditCardType(cardNumber.toString())[0]?.lengths.includes(cardNumber.toString().length) ??\n false\n );\n};\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/CreditCard/utils.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AAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACpE;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,0FAA0F;AAC1F,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAAgB,EAAU,EAAE;IAChE,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IACnC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;AACtD,CAAC,CAAC;AAEF,wFAAwF;AACxF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,UAAkB,EAAW,EAAE;IAClE,OAAO,cAAc,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,mHAAmH;AACnH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,UAAkB,EAAW,EAAE;IAC/D,OAAO,CACL,cAAc,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC;QACxF,KAAK,CACN,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import creditCardType, { getTypeInfo } from 'credit-card-type';\n\nimport type { FormattingOptions } from './CreditCard.types';\n\nconst prettyPrintCard = (value: string, gaps: number[]): string => {\n const offsets = [0].concat(\n gaps.filter(n => n < value.length),\n value.length\n );\n\n const groups = [];\n for (let i = 0; offsets[i] < value.length; i += 1) {\n groups.push(value.substring(offsets[i], offsets[i + 1]));\n }\n return groups.join(' ');\n};\n\n/**\n * Returns a formatted and obfuscated on demand partial credit card number.\n * @param value starting, partial number.\n * @param formattingOptions additional formatting options\n */\nexport const formatCreditCard = (\n value: string,\n { obfuscation = 'none' }: FormattingOptions = {}\n): string => {\n let result;\n switch (obfuscation) {\n case 'none':\n result = prettyPrintCard(value, creditCardType(value)[0]?.gaps ?? []);\n break;\n case 'partial':\n result = prettyPrintCard(value.slice(-4).padStart(16, '•'), [4, 8, 12]);\n break;\n default:\n result = Array.from({ length: 4 }).fill('•'.repeat(4)).join(' ');\n }\n return result;\n};\n\n/** Returns maximum total length of formatted credit card of given type including gaps. */\nexport const creditCardTotalLength = (cardType: string): number => {\n const type = getTypeInfo(cardType);\n return Math.max(...type.lengths) + type.gaps.length;\n};\n\n/** Returns true if given first numbers match a pattern of any card, false otherwise. */\nexport const isPossibleCardNumber = (cardNumber: string): boolean => {\n return creditCardType(cardNumber).length > 0;\n};\n\n/** Returns true if given card number is valid (matches the pattern and length of a card type), false otherwise. */\nexport const isValidCreditCard = (cardNumber: number): boolean => {\n return (\n creditCardType(cardNumber.toString())[0]?.lengths.includes(cardNumber.toString().length) ??\n false\n );\n};\n"]}