@pega/cosmos-react-core 2.0.0-dev.14.0 → 2.0.0-dev.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  2. package/lib/components/AppShell/AppShell.js +14 -4
  3. package/lib/components/AppShell/AppShell.js.map +1 -1
  4. package/lib/components/AppShell/AppShell.styles.d.ts +0 -1
  5. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  6. package/lib/components/AppShell/AppShell.styles.js +16 -24
  7. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  8. package/lib/components/AppShell/AppShell.types.d.ts +1 -1
  9. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  10. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  11. package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
  12. package/lib/components/AppShell/AppShellList.js +1 -1
  13. package/lib/components/AppShell/AppShellList.js.map +1 -1
  14. package/lib/components/AppShell/Drawer.js +1 -1
  15. package/lib/components/AppShell/Drawer.js.map +1 -1
  16. package/lib/components/Avatar/Avatar.d.ts.map +1 -1
  17. package/lib/components/Avatar/Avatar.js +2 -1
  18. package/lib/components/Avatar/Avatar.js.map +1 -1
  19. package/lib/components/Badges/Status.d.ts +2 -2
  20. package/lib/components/Badges/Status.d.ts.map +1 -1
  21. package/lib/components/Badges/Status.js.map +1 -1
  22. package/lib/components/Button/BareButton.d.ts.map +1 -1
  23. package/lib/components/Button/BareButton.js +21 -2
  24. package/lib/components/Button/BareButton.js.map +1 -1
  25. package/lib/components/Button/Button.d.ts.map +1 -1
  26. package/lib/components/Button/Button.js +19 -2
  27. package/lib/components/Button/Button.js.map +1 -1
  28. package/lib/components/Card/CardHeader.d.ts +3 -1
  29. package/lib/components/Card/CardHeader.d.ts.map +1 -1
  30. package/lib/components/Card/CardHeader.js +5 -3
  31. package/lib/components/Card/CardHeader.js.map +1 -1
  32. package/lib/components/Configuration/Configuration.js +1 -1
  33. package/lib/components/Configuration/Configuration.js.map +1 -1
  34. package/lib/components/Currency/CurrencyDisplay.d.ts.map +1 -1
  35. package/lib/components/Currency/CurrencyDisplay.js +9 -1
  36. package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
  37. package/lib/components/DateTime/DateTimeDisplay.js +1 -1
  38. package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
  39. package/lib/components/DateTime/Input/DateTime.styles.js +1 -1
  40. package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
  41. package/lib/components/DateTime/Input/QuarterInput.d.ts +9 -0
  42. package/lib/components/DateTime/Input/QuarterInput.d.ts.map +1 -0
  43. package/lib/components/DateTime/Input/QuarterInput.js +102 -0
  44. package/lib/components/DateTime/Input/QuarterInput.js.map +1 -0
  45. package/lib/components/DateTime/Input/utils.d.ts +5 -3
  46. package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
  47. package/lib/components/DateTime/Input/utils.js +10 -1
  48. package/lib/components/DateTime/Input/utils.js.map +1 -1
  49. package/lib/components/DateTime/index.d.ts +2 -0
  50. package/lib/components/DateTime/index.d.ts.map +1 -1
  51. package/lib/components/DateTime/index.js +1 -0
  52. package/lib/components/DateTime/index.js.map +1 -1
  53. package/lib/components/FieldGroup/FieldGroup.js +1 -1
  54. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  55. package/lib/components/File/FileInput.d.ts.map +1 -1
  56. package/lib/components/File/FileInput.js +3 -1
  57. package/lib/components/File/FileInput.js.map +1 -1
  58. package/lib/components/File/FileUploadItem.js +1 -1
  59. package/lib/components/File/FileUploadItem.js.map +1 -1
  60. package/lib/components/Form/Form.d.ts +3 -1
  61. package/lib/components/Form/Form.d.ts.map +1 -1
  62. package/lib/components/Form/Form.js.map +1 -1
  63. package/lib/components/List/CommaSeparatedList.d.ts +15 -0
  64. package/lib/components/List/CommaSeparatedList.d.ts.map +1 -0
  65. package/lib/components/List/CommaSeparatedList.js +61 -0
  66. package/lib/components/List/CommaSeparatedList.js.map +1 -0
  67. package/lib/components/List/List.d.ts +30 -0
  68. package/lib/components/List/List.d.ts.map +1 -0
  69. package/lib/components/List/List.js +56 -0
  70. package/lib/components/List/List.js.map +1 -0
  71. package/lib/components/List/OrderedList.d.ts +6 -0
  72. package/lib/components/List/OrderedList.d.ts.map +1 -0
  73. package/lib/components/List/OrderedList.js +6 -0
  74. package/lib/components/List/OrderedList.js.map +1 -0
  75. package/lib/components/List/UnorderedList.d.ts +6 -0
  76. package/lib/components/List/UnorderedList.d.ts.map +1 -0
  77. package/lib/components/List/UnorderedList.js +6 -0
  78. package/lib/components/List/UnorderedList.js.map +1 -0
  79. package/lib/components/List/index.d.ts +5 -0
  80. package/lib/components/List/index.d.ts.map +1 -0
  81. package/lib/components/List/index.js +4 -0
  82. package/lib/components/List/index.js.map +1 -0
  83. package/lib/components/Location/LocationInput.js +1 -1
  84. package/lib/components/Location/LocationInput.js.map +1 -1
  85. package/lib/components/Menu/Menu.context.d.ts.map +1 -1
  86. package/lib/components/Menu/Menu.context.js +2 -0
  87. package/lib/components/Menu/Menu.context.js.map +1 -1
  88. package/lib/components/Menu/Menu.d.ts.map +1 -1
  89. package/lib/components/Menu/Menu.js +14 -3
  90. package/lib/components/Menu/Menu.js.map +1 -1
  91. package/lib/components/Menu/Menu.types.d.ts +2 -0
  92. package/lib/components/Menu/Menu.types.d.ts.map +1 -1
  93. package/lib/components/Menu/Menu.types.js.map +1 -1
  94. package/lib/components/Menu/MenuItem.d.ts.map +1 -1
  95. package/lib/components/Menu/MenuItem.js +15 -6
  96. package/lib/components/Menu/MenuItem.js.map +1 -1
  97. package/lib/components/Menu/MenuList.d.ts.map +1 -1
  98. package/lib/components/Menu/MenuList.js +4 -2
  99. package/lib/components/Menu/MenuList.js.map +1 -1
  100. package/lib/components/Menu/MenuListHeader.js +1 -1
  101. package/lib/components/Menu/MenuListHeader.js.map +1 -1
  102. package/lib/components/MetaList/MetaList.d.ts +11 -2
  103. package/lib/components/MetaList/MetaList.d.ts.map +1 -1
  104. package/lib/components/MetaList/MetaList.js +32 -18
  105. package/lib/components/MetaList/MetaList.js.map +1 -1
  106. package/lib/components/MultiStep/MultiStep.d.ts.map +1 -1
  107. package/lib/components/MultiStep/MultiStep.js +4 -3
  108. package/lib/components/MultiStep/MultiStep.js.map +1 -1
  109. package/lib/components/MultiStep/MultiStep.types.d.ts +2 -0
  110. package/lib/components/MultiStep/MultiStep.types.d.ts.map +1 -1
  111. package/lib/components/MultiStep/MultiStep.types.js.map +1 -1
  112. package/lib/components/Number/NumberInput.js +2 -2
  113. package/lib/components/Number/NumberInput.js.map +1 -1
  114. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts +1 -1
  115. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts.map +1 -1
  116. package/lib/components/PageTemplates/DashboardPage.d.ts +1 -1
  117. package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
  118. package/lib/components/PageTemplates/DashboardPage.js +9 -7
  119. package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
  120. package/lib/components/PageTemplates/PageTemplates.d.ts +15 -8
  121. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  122. package/lib/components/PageTemplates/PageTemplates.js +81 -61
  123. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  124. package/lib/components/PageTemplates/index.d.ts +2 -0
  125. package/lib/components/PageTemplates/index.d.ts.map +1 -1
  126. package/lib/components/PageTemplates/index.js.map +1 -1
  127. package/lib/components/Pagination/Pagination.js +1 -1
  128. package/lib/components/Pagination/Pagination.js.map +1 -1
  129. package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
  130. package/lib/components/Phone/PhoneInput.js +5 -5
  131. package/lib/components/Phone/PhoneInput.js.map +1 -1
  132. package/lib/components/Popover/Popover.d.ts +0 -4
  133. package/lib/components/Popover/Popover.d.ts.map +1 -1
  134. package/lib/components/Popover/Popover.js +1 -115
  135. package/lib/components/Popover/Popover.js.map +1 -1
  136. package/lib/components/Popover/Popover.styles.d.ts +5 -0
  137. package/lib/components/Popover/Popover.styles.d.ts.map +1 -0
  138. package/lib/components/Popover/Popover.styles.js +116 -0
  139. package/lib/components/Popover/Popover.styles.js.map +1 -0
  140. package/lib/components/Popover/index.d.ts +1 -1
  141. package/lib/components/Popover/index.d.ts.map +1 -1
  142. package/lib/components/Popover/index.js +1 -1
  143. package/lib/components/Popover/index.js.map +1 -1
  144. package/lib/components/Rating/Rating.js +1 -1
  145. package/lib/components/Rating/Rating.js.map +1 -1
  146. package/lib/components/SearchInput/SearchInput.d.ts +2 -2
  147. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  148. package/lib/components/SummaryList/SummaryList.js +1 -1
  149. package/lib/components/SummaryList/SummaryList.js.map +1 -1
  150. package/lib/components/Tabs/Tab.d.ts +1 -1
  151. package/lib/components/Tabs/Tab.d.ts.map +1 -1
  152. package/lib/components/Tabs/Tab.js +6 -1
  153. package/lib/components/Tabs/Tab.js.map +1 -1
  154. package/lib/components/Tabs/Tabs.d.ts +1 -0
  155. package/lib/components/Tabs/Tabs.d.ts.map +1 -1
  156. package/lib/components/Tabs/Tabs.js +17 -12
  157. package/lib/components/Tabs/Tabs.js.map +1 -1
  158. package/lib/components/TextArea/TextArea.d.ts.map +1 -1
  159. package/lib/components/TextArea/TextArea.js +7 -5
  160. package/lib/components/TextArea/TextArea.js.map +1 -1
  161. package/lib/components/Tooltip/Tooltip.d.ts +6 -1
  162. package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  163. package/lib/components/Tooltip/Tooltip.js +3 -3
  164. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  165. package/lib/components/Tree/StandardTree.js +1 -1
  166. package/lib/components/Tree/StandardTree.js.map +1 -1
  167. package/lib/components/Tree/StandardTree.styles.js +1 -1
  168. package/lib/components/Tree/StandardTree.styles.js.map +1 -1
  169. package/lib/hooks/index.d.ts +1 -0
  170. package/lib/hooks/index.d.ts.map +1 -1
  171. package/lib/hooks/index.js +1 -0
  172. package/lib/hooks/index.js.map +1 -1
  173. package/lib/hooks/useDraggable.d.ts +8 -0
  174. package/lib/hooks/useDraggable.d.ts.map +1 -0
  175. package/lib/hooks/useDraggable.js +64 -0
  176. package/lib/hooks/useDraggable.js.map +1 -0
  177. package/lib/hooks/useI18n.d.ts +222 -54
  178. package/lib/hooks/useI18n.d.ts.map +1 -1
  179. package/lib/hooks/useI18n.js +2 -2
  180. package/lib/hooks/useI18n.js.map +1 -1
  181. package/lib/i18n/default.json +239 -71
  182. package/lib/i18n/i18n.d.ts +444 -108
  183. package/lib/i18n/i18n.d.ts.map +1 -1
  184. package/lib/i18n/translate.d.ts +29 -4
  185. package/lib/i18n/translate.d.ts.map +1 -1
  186. package/lib/i18n/translate.js +21 -8
  187. package/lib/i18n/translate.js.map +1 -1
  188. package/lib/index.d.ts +1 -0
  189. package/lib/index.d.ts.map +1 -1
  190. package/lib/index.js +1 -0
  191. package/lib/index.js.map +1 -1
  192. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,UAAU,EAKV,MAAM,EAEN,SAAS,EACT,OAAO,EACP,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,SAAS,EAAe,MAAM,cAAc,CAAC;AAGtD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AA0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ef,\n ReactNode,\n useEffect,\n useMemo,\n useState\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { usePopper, PopperProps } from 'react-popper';\nimport { VirtualElement } from '@popperjs/core';\nimport { OffsetModifier } from '@popperjs/core/lib/modifiers/offset';\nimport styled, { css } from 'styled-components';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { useConfiguration, useConsolidatedRef, useElement, useUID } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport { windowIsAvailable } from '../../utils';\n\nimport { PopoverManagerContext } from './PopoverContext';\n\nexport type Delay = 'none' | 'short' | 'long';\nexport interface PopoverProps<Modifiers extends string = string> extends BaseProps {\n /** The DOM element or [virtual element](https://popper.js.org/docs/v2/virtual-elements) that the Popover is positioned in reference to. */\n target: Element | VirtualElement | null;\n /**\n * If true, the Popover will be visible.\n * @default true\n */\n show?: boolean;\n /**\n * If true, the Popover will render outside of the current DOM hierarchy in a [portal](https://reactjs.org/docs/portals.html).\n * @default false\n */\n portal?: boolean;\n /**\n * Delay on showing the Popover.\n * @default \"none\"\n */\n showDelay?: Delay;\n /**\n * Delay on hiding the Popover.\n * @default \"none\"\n */\n hideDelay?: Delay;\n /**\n * [React Popper Placement](https://popper.js.org/react-popper/v2/render-props/#placement)\n */\n placement?: PopperProps<Modifiers>['placement'];\n /**\n * [React Popper Strategy](https://popper.js.org/react-popper/v2/render-props/#strategy)\n * @default \"absolute\"\n */\n strategy?: PopperProps<Modifiers>['strategy'];\n /**\n * [React Popper Modifiers](https://popper.js.org/react-popper/v2/render-props/#modifiers)\n * @default []\n */\n modifiers?: PopperProps<Modifiers>['modifiers'];\n /**\n * If true, an arrow will visually identify from which element the Popover is rendered.\n * @default false\n */\n arrow?: boolean;\n /** The group that the Popover belongs to. Popovers in the same group will be closed when others open. */\n groupId?: string;\n /**\n * If true, the Popover will be visibly hidden when its target leaves the viewport.\n * @default false\n */\n hideOnTargetHidden?: boolean;\n /** The content of the Popover. */\n children: ReactNode;\n /** The ref of the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledPopoverArrow = styled.div`\n background-color: inherit;\n height: 0;\n width: 0;\n\n ::after {\n content: '';\n display: block;\n background-color: inherit;\n height: 0.5rem;\n width: 0.5rem;\n transform: rotate(45deg);\n }\n`;\n\nexport const StyledPopover = styled.div<{ offset?: number }>(\n ({\n theme: {\n base: {\n 'border-radius': borderRadius,\n 'z-index': { popover: zIndex },\n shadow: { 'low-filter': low }\n },\n components: {\n card: { background, 'border-radius': cardBorderRadius }\n }\n },\n offset\n }) => {\n return css`\n /*\n Margin should never be used with Popper.\n https://popper.js.org/docs/v2/migration-guide/#4-remove-all-css-margins\n */\n margin: 0 !important;\n z-index: ${zIndex};\n background-color: ${background};\n border-radius: calc(${cardBorderRadius} / 2);\n filter: ${low};\n\n &[data-popper-reference-hidden='true'] {\n visibility: hidden;\n pointer-events: none;\n }\n\n &[data-popper-placement^='top'] {\n > ${StyledPopoverArrow} {\n top: calc(100% - 0.25rem);\n margin-inline-start: -0.25rem;\n\n ::after {\n border-bottom-right-radius: calc(${borderRadius} / 4);\n }\n }\n\n ::before {\n content: '';\n position: absolute;\n height: ${offset}px;\n bottom: -${offset}px;\n left: 0;\n right: 0;\n }\n }\n\n &[data-popper-placement^='bottom'] {\n > ${StyledPopoverArrow} {\n bottom: calc(100% + 0.25rem);\n margin-inline-start: -0.25rem;\n\n ::after {\n border-top-left-radius: calc(${borderRadius} / 4);\n }\n }\n\n ::before {\n content: '';\n position: absolute;\n height: ${offset}px;\n top: -${offset}px;\n left: 0;\n right: 0;\n }\n }\n\n &[data-popper-placement^='right'] {\n > ${StyledPopoverArrow} {\n right: calc(100% + 0.25rem);\n margin-block-start: -0.25rem;\n\n ::after {\n border-bottom-left-radius: calc(${borderRadius} / 4);\n }\n }\n\n ::before {\n content: '';\n position: absolute;\n width: ${offset}px;\n left: -${offset}px;\n top: 0;\n bottom: 0;\n }\n }\n\n &[data-popper-placement^='left'] {\n > ${StyledPopoverArrow} {\n left: calc(100% - 0.25rem);\n margin-block-start: -0.25rem;\n\n ::after {\n border-top-right-radius: calc(${borderRadius} / 4);\n }\n }\n\n ::before {\n content: '';\n position: absolute;\n width: ${offset}px;\n right: -${offset}px;\n top: 0;\n bottom: 0;\n }\n }\n `;\n }\n);\n\nStyledPopover.defaultProps = defaultThemeProp;\n\nconst delays = {\n none: 0,\n short: 500,\n long: 1000\n};\n\nconst Popover: <Modifiers extends string = string>(\n props: PopoverProps<Modifiers> & ForwardProps\n) => ReactElement | null = forwardRef(\n (\n {\n show = true,\n portal = false,\n target,\n placement,\n strategy = 'fixed',\n style,\n modifiers = [],\n arrow = false,\n groupId,\n showDelay = 'none',\n hideDelay = 'none',\n hideOnTargetHidden = false,\n children,\n ...restProps\n }: PropsWithoutRef<PopoverProps> & { style?: CSSProperties },\n ref: PopoverProps['ref']\n ) => {\n const { portalTarget } = useConfiguration();\n const { checkActive, setActive } = useContext(PopoverManagerContext);\n const [, setPopperEl] = useElement<HTMLDivElement>();\n const popperRef = useConsolidatedRef<HTMLDivElement>(ref, setPopperEl);\n const arrowRef = useRef<HTMLDivElement>(null);\n const forceUpdateRef = useRef<() => void>();\n const [showPopover, setShowPopover] = useState(show);\n const timeout = useRef<number>();\n const uid = useUID();\n\n const memoedModifiers = useMemo(\n () => [\n {\n name: 'offset',\n options: {\n offset: [0, arrow ? 5.5 : 2]\n }\n },\n { name: 'hide', enabled: hideOnTargetHidden },\n { name: 'arrow', enabled: arrow, options: { element: arrowRef.current } },\n ...modifiers\n ],\n [modifiers, arrow, hideOnTargetHidden]\n );\n\n const offset = useMemo(() => {\n const offsetModifier = [...memoedModifiers]\n .reverse()\n .find(m => m.name === 'offset' && m.enabled !== false) as OffsetModifier | undefined;\n return Array.isArray(offsetModifier?.options?.offset)\n ? offsetModifier?.options?.offset[1] ?? 0\n : 0;\n }, [memoedModifiers]);\n\n const { styles, attributes, forceUpdate } = usePopper(target, popperRef.current, {\n placement,\n strategy,\n modifiers: memoedModifiers\n });\n\n if (forceUpdate) forceUpdateRef.current = forceUpdate;\n\n useEffect(() => {\n const observer = new ResizeObserver(() => {\n forceUpdateRef.current?.();\n });\n\n if (popperRef.current) observer.observe(popperRef.current);\n if (target instanceof Element) observer.observe(target);\n\n return () => {\n observer.disconnect();\n };\n }, [forceUpdate, popperRef.current, target]);\n\n useEffect(() => {\n if (groupId && show) setActive(uid, groupId);\n\n if (windowIsAvailable) {\n if (timeout.current) clearTimeout(timeout.current);\n timeout.current = window.setTimeout(() => {\n setShowPopover(show);\n }, delays[show ? showDelay : hideDelay]);\n } else {\n setShowPopover(show);\n }\n }, [show]);\n\n useEffect(() => {\n return () => clearTimeout(timeout.current);\n }, []);\n\n const content = (\n <StyledPopover\n {...restProps}\n offset={offset}\n ref={popperRef}\n style={{ ...style, ...styles.popper }}\n {...attributes.popper}\n >\n {arrow && <StyledPopoverArrow ref={arrowRef} style={{ ...styles.arrow }} />}\n {children}\n </StyledPopover>\n );\n\n if (!target || !showPopover || (groupId && !checkActive(uid, groupId))) return null;\n\n return portal && portalTarget ? createPortal(content, portalTarget) : content;\n }\n);\n\nexport default Popover;\n"]}
1
+ {"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,UAAU,EAKV,MAAM,EAEN,SAAS,EACT,OAAO,EACP,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,SAAS,EAAe,MAAM,cAAc,CAAC;AAKtD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB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AW,IAAI,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAEpF,OAAO,MAAM,IAAI,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAChF,CAAC,CACF,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import {\n forwardRef,\n useContext,\n PropsWithoutRef,\n Ref,\n CSSProperties,\n ReactElement,\n useRef,\n ReactNode,\n useEffect,\n useMemo,\n useState\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { usePopper, PopperProps } from 'react-popper';\nimport { VirtualElement } from '@popperjs/core';\nimport { OffsetModifier } from '@popperjs/core/lib/modifiers/offset';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { useConfiguration, useConsolidatedRef, useElement, useUID } from '../../hooks';\nimport { windowIsAvailable } from '../../utils';\n\nimport { PopoverManagerContext } from './PopoverContext';\nimport { StyledPopover, StyledPopoverArrow } from './Popover.styles';\n\nexport type Delay = 'none' | 'short' | 'long';\nexport interface PopoverProps<Modifiers extends string = string> extends BaseProps {\n /** The DOM element or [virtual element](https://popper.js.org/docs/v2/virtual-elements) that the Popover is positioned in reference to. */\n target: Element | VirtualElement | null;\n /**\n * If true, the Popover will be visible.\n * @default true\n */\n show?: boolean;\n /**\n * If true, the Popover will render outside of the current DOM hierarchy in a [portal](https://reactjs.org/docs/portals.html).\n * @default false\n */\n portal?: boolean;\n /**\n * Delay on showing the Popover.\n * @default \"none\"\n */\n showDelay?: Delay;\n /**\n * Delay on hiding the Popover.\n * @default \"none\"\n */\n hideDelay?: Delay;\n /**\n * [React Popper Placement](https://popper.js.org/react-popper/v2/render-props/#placement)\n */\n placement?: PopperProps<Modifiers>['placement'];\n /**\n * [React Popper Strategy](https://popper.js.org/react-popper/v2/render-props/#strategy)\n * @default \"absolute\"\n */\n strategy?: PopperProps<Modifiers>['strategy'];\n /**\n * [React Popper Modifiers](https://popper.js.org/react-popper/v2/render-props/#modifiers)\n * @default []\n */\n modifiers?: PopperProps<Modifiers>['modifiers'];\n /**\n * If true, an arrow will visually identify from which element the Popover is rendered.\n * @default false\n */\n arrow?: boolean;\n /** The group that the Popover belongs to. Popovers in the same group will be closed when others open. */\n groupId?: string;\n /**\n * If true, the Popover will be visibly hidden when its target leaves the viewport.\n * @default false\n */\n hideOnTargetHidden?: boolean;\n /** The content of the Popover. */\n children: ReactNode;\n /** The ref of the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst delays = {\n none: 0,\n short: 500,\n long: 1000\n};\n\nconst Popover: <Modifiers extends string = string>(\n props: PopoverProps<Modifiers> & ForwardProps\n) => ReactElement | null = forwardRef(\n (\n {\n show = true,\n portal = false,\n target,\n placement,\n strategy = 'fixed',\n style,\n modifiers = [],\n arrow = false,\n groupId,\n showDelay = 'none',\n hideDelay = 'none',\n hideOnTargetHidden = false,\n children,\n ...restProps\n }: PropsWithoutRef<PopoverProps> & { style?: CSSProperties },\n ref: PopoverProps['ref']\n ) => {\n const { portalTarget } = useConfiguration();\n const { checkActive, setActive } = useContext(PopoverManagerContext);\n const [, setPopperEl] = useElement<HTMLDivElement>();\n const popperRef = useConsolidatedRef<HTMLDivElement>(ref, setPopperEl);\n const arrowRef = useRef<HTMLDivElement>(null);\n const forceUpdateRef = useRef<() => void>();\n const [showPopover, setShowPopover] = useState(show);\n const timeout = useRef<number>();\n const uid = useUID();\n\n const memoedModifiers = useMemo(\n () => [\n {\n name: 'offset',\n options: {\n offset: [0, arrow ? 5.5 : 2]\n }\n },\n { name: 'hide', enabled: hideOnTargetHidden },\n { name: 'arrow', enabled: arrow, options: { element: arrowRef.current } },\n ...modifiers\n ],\n [modifiers, arrow, hideOnTargetHidden]\n );\n\n const offset = useMemo(() => {\n const offsetModifier = [...memoedModifiers]\n .reverse()\n .find(m => m.name === 'offset' && m.enabled !== false) as OffsetModifier | undefined;\n return Array.isArray(offsetModifier?.options?.offset)\n ? offsetModifier?.options?.offset[1] ?? 0\n : 0;\n }, [memoedModifiers]);\n\n const { styles, attributes, forceUpdate } = usePopper(target, popperRef.current, {\n placement,\n strategy,\n modifiers: memoedModifiers\n });\n\n if (forceUpdate) forceUpdateRef.current = forceUpdate;\n\n useEffect(() => {\n const observer = new ResizeObserver(() => {\n forceUpdateRef.current?.();\n });\n\n if (popperRef.current) observer.observe(popperRef.current);\n if (target instanceof Element) observer.observe(target);\n\n return () => {\n observer.disconnect();\n };\n }, [forceUpdate, popperRef.current, target]);\n\n useEffect(() => {\n if (groupId && show) setActive(uid, groupId);\n\n if (windowIsAvailable) {\n if (timeout.current) clearTimeout(timeout.current);\n timeout.current = window.setTimeout(() => {\n setShowPopover(show);\n }, delays[show ? showDelay : hideDelay]);\n } else {\n setShowPopover(show);\n }\n }, [show]);\n\n useEffect(() => {\n return () => clearTimeout(timeout.current);\n }, []);\n\n const content = (\n <StyledPopover\n {...restProps}\n offset={offset}\n ref={popperRef}\n style={{ ...style, ...styles.popper }}\n {...attributes.popper}\n >\n {arrow && <StyledPopoverArrow ref={arrowRef} style={{ ...styles.arrow }} />}\n {children}\n </StyledPopover>\n );\n\n if (!target || !showPopover || (groupId && !checkActive(uid, groupId))) return null;\n\n return portal && portalTarget ? createPortal(content, portalTarget) : content;\n }\n);\n\nexport default Popover;\n"]}
@@ -0,0 +1,5 @@
1
+ export declare const StyledPopoverArrow: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
2
+ export declare const StyledPopover: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
3
+ offset?: number | undefined;
4
+ }, never>;
5
+ //# sourceMappingURL=Popover.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Popover.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,yGAa9B,CAAC;AAEF,eAAO,MAAM,aAAa;;SA+GzB,CAAC"}
@@ -0,0 +1,116 @@
1
+ import styled, { css } from 'styled-components';
2
+ import { defaultThemeProp } from '../../theme';
3
+ export const StyledPopoverArrow = styled.div `
4
+ background-color: inherit;
5
+ height: 0;
6
+ width: 0;
7
+
8
+ ::after {
9
+ content: '';
10
+ display: block;
11
+ background-color: inherit;
12
+ height: 0.5rem;
13
+ width: 0.5rem;
14
+ transform: rotate(45deg);
15
+ }
16
+ `;
17
+ export const StyledPopover = styled.div(({ theme: { base: { 'border-radius': borderRadius, 'z-index': { popover: zIndex }, shadow: { 'low-filter': low } }, components: { card: { background, 'border-radius': cardBorderRadius } } }, offset }) => {
18
+ return css `
19
+ /*
20
+ Margin should never be used with Popper.
21
+ https://popper.js.org/docs/v2/migration-guide/#4-remove-all-css-margins
22
+ */
23
+ margin: 0 !important;
24
+ z-index: ${zIndex};
25
+ background-color: ${background};
26
+ border-radius: calc(${cardBorderRadius} / 2);
27
+ filter: ${low};
28
+
29
+ &[data-popper-reference-hidden='true'] {
30
+ visibility: hidden;
31
+ pointer-events: none;
32
+ }
33
+
34
+ &[data-popper-placement^='top'] {
35
+ > ${StyledPopoverArrow} {
36
+ top: calc(100% - 0.25rem);
37
+ margin-inline-start: -0.25rem;
38
+
39
+ ::after {
40
+ border-bottom-right-radius: calc(${borderRadius} / 4);
41
+ }
42
+ }
43
+
44
+ ::before {
45
+ content: '';
46
+ position: absolute;
47
+ height: ${offset}px;
48
+ bottom: -${offset}px;
49
+ left: 0;
50
+ right: 0;
51
+ }
52
+ }
53
+
54
+ &[data-popper-placement^='bottom'] {
55
+ > ${StyledPopoverArrow} {
56
+ bottom: calc(100% + 0.25rem);
57
+ margin-inline-start: -0.25rem;
58
+
59
+ ::after {
60
+ border-top-left-radius: calc(${borderRadius} / 4);
61
+ }
62
+ }
63
+
64
+ ::before {
65
+ content: '';
66
+ position: absolute;
67
+ height: ${offset}px;
68
+ top: -${offset}px;
69
+ left: 0;
70
+ right: 0;
71
+ }
72
+ }
73
+
74
+ &[data-popper-placement^='right'] {
75
+ > ${StyledPopoverArrow} {
76
+ inset-inline-end: calc(100% + 0.25rem);
77
+ margin-block-start: -0.25rem;
78
+
79
+ ::after {
80
+ border-bottom-left-radius: calc(${borderRadius} / 4);
81
+ }
82
+ }
83
+
84
+ ::before {
85
+ content: '';
86
+ position: absolute;
87
+ width: ${offset}px;
88
+ left: -${offset}px;
89
+ top: 0;
90
+ bottom: 0;
91
+ }
92
+ }
93
+
94
+ &[data-popper-placement^='left'] {
95
+ > ${StyledPopoverArrow} {
96
+ left: calc(100% - 0.25rem);
97
+ margin-block-start: -0.25rem;
98
+
99
+ ::after {
100
+ border-top-right-radius: calc(${borderRadius} / 4);
101
+ }
102
+ }
103
+
104
+ ::before {
105
+ content: '';
106
+ position: absolute;
107
+ width: ${offset}px;
108
+ right: -${offset}px;
109
+ top: 0;
110
+ bottom: 0;
111
+ }
112
+ }
113
+ `;
114
+ });
115
+ StyledPopover.defaultProps = defaultThemeProp;
116
+ //# sourceMappingURL=Popover.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Popover.styles.js","sourceRoot":"","sources":["../../../src/components/Popover/Popover.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;CAa3C,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CACrC,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,eAAe,EAAE,YAAY,EAC7B,SAAS,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAC9B,MAAM,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,EAC9B,EACD,UAAU,EAAE,EACV,IAAI,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,EACxD,EACF,EACD,MAAM,EACP,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;;;;;;iBAMG,MAAM;0BACG,UAAU;4BACR,gBAAgB;gBAC5B,GAAG;;;;;;;;YAQP,kBAAkB;;;;;+CAKiB,YAAY;;;;;;;oBAOvC,MAAM;qBACL,MAAM;;;;;;;YAOf,kBAAkB;;;;;2CAKa,YAAY;;;;;;;oBAOnC,MAAM;kBACR,MAAM;;;;;;;YAOZ,kBAAkB;;;;;8CAKgB,YAAY;;;;;;;mBAOvC,MAAM;mBACN,MAAM;;;;;;;YAOb,kBAAkB;;;;;4CAKc,YAAY;;;;;;;mBAOrC,MAAM;oBACL,MAAM;;;;;KAKrB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,aAAa,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\n\nexport const StyledPopoverArrow = styled.div`\n background-color: inherit;\n height: 0;\n width: 0;\n\n ::after {\n content: '';\n display: block;\n background-color: inherit;\n height: 0.5rem;\n width: 0.5rem;\n transform: rotate(45deg);\n }\n`;\n\nexport const StyledPopover = styled.div<{ offset?: number }>(\n ({\n theme: {\n base: {\n 'border-radius': borderRadius,\n 'z-index': { popover: zIndex },\n shadow: { 'low-filter': low }\n },\n components: {\n card: { background, 'border-radius': cardBorderRadius }\n }\n },\n offset\n }) => {\n return css`\n /*\n Margin should never be used with Popper.\n https://popper.js.org/docs/v2/migration-guide/#4-remove-all-css-margins\n */\n margin: 0 !important;\n z-index: ${zIndex};\n background-color: ${background};\n border-radius: calc(${cardBorderRadius} / 2);\n filter: ${low};\n\n &[data-popper-reference-hidden='true'] {\n visibility: hidden;\n pointer-events: none;\n }\n\n &[data-popper-placement^='top'] {\n > ${StyledPopoverArrow} {\n top: calc(100% - 0.25rem);\n margin-inline-start: -0.25rem;\n\n ::after {\n border-bottom-right-radius: calc(${borderRadius} / 4);\n }\n }\n\n ::before {\n content: '';\n position: absolute;\n height: ${offset}px;\n bottom: -${offset}px;\n left: 0;\n right: 0;\n }\n }\n\n &[data-popper-placement^='bottom'] {\n > ${StyledPopoverArrow} {\n bottom: calc(100% + 0.25rem);\n margin-inline-start: -0.25rem;\n\n ::after {\n border-top-left-radius: calc(${borderRadius} / 4);\n }\n }\n\n ::before {\n content: '';\n position: absolute;\n height: ${offset}px;\n top: -${offset}px;\n left: 0;\n right: 0;\n }\n }\n\n &[data-popper-placement^='right'] {\n > ${StyledPopoverArrow} {\n inset-inline-end: calc(100% + 0.25rem);\n margin-block-start: -0.25rem;\n\n ::after {\n border-bottom-left-radius: calc(${borderRadius} / 4);\n }\n }\n\n ::before {\n content: '';\n position: absolute;\n width: ${offset}px;\n left: -${offset}px;\n top: 0;\n bottom: 0;\n }\n }\n\n &[data-popper-placement^='left'] {\n > ${StyledPopoverArrow} {\n left: calc(100% - 0.25rem);\n margin-block-start: -0.25rem;\n\n ::after {\n border-top-right-radius: calc(${borderRadius} / 4);\n }\n }\n\n ::before {\n content: '';\n position: absolute;\n width: ${offset}px;\n right: -${offset}px;\n top: 0;\n bottom: 0;\n }\n }\n `;\n }\n);\n\nStyledPopover.defaultProps = defaultThemeProp;\n"]}
@@ -3,5 +3,5 @@ export { default as PopoverManager } from './PopoverManager';
3
3
  export { PopoverManagerContext } from './PopoverContext';
4
4
  export { Delay } from './Popover';
5
5
  export { PopoverProps } from './Popover';
6
- export { StyledPopover } from './Popover';
6
+ export { StyledPopover } from './Popover.styles';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export { default } from './Popover';
2
2
  export { default as PopoverManager } from './PopoverManager';
3
3
  export { PopoverManagerContext } from './PopoverContext';
4
- export { StyledPopover } from './Popover';
4
+ export { StyledPopover } from './Popover.styles';
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export { default } from './Popover';\nexport { default as PopoverManager } from './PopoverManager';\nexport { PopoverManagerContext } from './PopoverContext';\nexport { Delay } from './Popover';\nexport { PopoverProps } from './Popover';\nexport { StyledPopover } from './Popover';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { default } from './Popover';\nexport { default as PopoverManager } from './PopoverManager';\nexport { PopoverManagerContext } from './PopoverContext';\nexport { Delay } from './Popover';\nexport { PopoverProps } from './Popover';\nexport { StyledPopover } from './Popover.styles';\n"]}
@@ -64,7 +64,7 @@ const Rating = (props) => {
64
64
  }
65
65
  starsOutline.push(_jsx(RatingItem, { fill: fillValue }, `star-${i}`));
66
66
  }
67
- return (_jsxs(StyledRating, Object.assign({ "aria-label": ariaLabel, title: ariaLabel, tabIndex: tabIndex }, restProps, { children: [_jsx(StyledRatingItemsContainer, { children: starsOutline }, void 0), metaInfo && _jsxs(StyledRatingMetaInfo, { children: ["(", metaInfo, ")"] }, void 0), ' '] }), void 0));
67
+ return (_jsxs(StyledRating, Object.assign({ "aria-label": ariaLabel, tabIndex: tabIndex }, restProps, { children: [_jsx(StyledRatingItemsContainer, { children: starsOutline }, void 0), metaInfo && _jsxs(StyledRatingMetaInfo, { children: ["(", metaInfo, ")"] }, void 0), ' '] }), void 0));
68
68
  };
69
69
  Rating.defaultProps = defaultProps;
70
70
  export default Rating;
@@ -1 +1 @@
1
- {"version":3,"file":"Rating.js","sourceRoot":"","sources":["../../../src/components/Rating/Rating.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,IAAI,MAAM,SAAS,CAAC;AA0B3B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B,MAAM,YAAY,GAAyB;IACzC,QAAQ,EAAE,KAAK;IACf,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C,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAC5C,SAAS,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACvC;QACD,YAAY,CAAC,IAAI,CAAC,KAAC,UAAU,IAAmB,IAAI,EAAE,SAAS,IAA5B,QAAQ,CAAC,EAAE,CAAqB,CAAC,CAAC;KACtE;IAED,OAAO,CACL,MAAC,YAAY,gCAAa,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,IAAM,SAAS,eACtF,KAAC,0BAA0B,cAAE,YAAY,WAA8B,EACtE,QAAQ,IAAI,MAAC,oBAAoB,oBAAG,QAAQ,iBAAyB,EAAE,GAAG,aAC9D,CAChB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;AAEnC,eAAe,MAAM,CAAC","sourcesContent":["import { FunctionComponent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport Icon from '../Icon';\n\nexport interface RatingProps extends BaseProps {\n /**\n * Sets the rating to read only.\n * @default false\n */\n readOnly?: boolean;\n /**\n * The maximum rating allowed. Must be an integer greater than 1.\n * @default 5\n */\n maxRating?: number;\n /** The value of the Rating. Could be a decimal or integer. */\n value: number;\n /** Text that is displayed in parentheses inline with the Rating stars. */\n metaInfo?: string;\n /** Aria label for screen readers. */\n 'aria-label'?: string;\n /**\n * The tabIndex to control focus.\n * @default 0\n */\n tabIndex?: number;\n}\n\nconst DEFAULT_MAX_RATING = 5;\n\nconst defaultProps: Partial<RatingProps> = {\n readOnly: false,\n maxRating: DEFAULT_MAX_RATING,\n tabIndex: 0\n};\n\nconst StyledRating = styled.div`\n display: inline-block;\n vertical-align: middle;\n`;\n\nconst StyledRatingItemsContainer = styled.div(props => {\n const { theme } = props;\n return css`\n color: ${theme.components.rating.color};\n line-height: 1;\n vertical-align: middle;\n display: inline-block;\n `;\n});\n\nStyledRatingItemsContainer.defaultProps = defaultThemeProp;\n\nconst StyledPartialRatingContainer = styled.div`\n position: relative;\n display: inline-block;\n`;\n\ninterface StyledPartialRatingProps {\n ratingPercentage: number;\n}\n\nexport const StyledPartialRating = styled.div<StyledPartialRatingProps>(props => {\n const { ratingPercentage } = props;\n return css`\n display: inline-block;\n position: absolute;\n inset-inline-start: 0;\n width: ${ratingPercentage}%;\n overflow: hidden;\n white-space: nowrap;\n `;\n});\n\nconst StyledRatingMetaInfo = styled.span(props => {\n const { theme } = props;\n return css`\n margin-inline-start: ${theme.base.spacing};\n `;\n});\n\nStyledRatingMetaInfo.defaultProps = defaultThemeProp;\n\ninterface RatingItemProps {\n fill: number;\n}\n\nconst RatingItem: FunctionComponent<RatingItemProps> = (props: RatingItemProps) => {\n const { fill, ...restProps } = props;\n const fillPercentage = Math.round((100 / 1) * fill);\n return (\n <>\n {fillPercentage === 0 && <Icon {...restProps} name='star' />}\n {fillPercentage === 100 && <Icon {...restProps} name='star-solid' />}\n {fillPercentage > 0 && fillPercentage < 100 && (\n <StyledPartialRatingContainer>\n <Icon {...restProps} name='star' />\n <StyledPartialRating ratingPercentage={fillPercentage}>\n <Icon {...restProps} name='star-solid' />\n </StyledPartialRating>\n </StyledPartialRatingContainer>\n )}\n </>\n );\n};\n\nconst Rating: FunctionComponent<RatingProps & ForwardProps> = (props: RatingProps) => {\n const starsOutline = [];\n const { 'aria-label': ariaLabel, metaInfo, tabIndex, readOnly, ...restProps } = props;\n\n let { maxRating, value } = props;\n maxRating = typeof maxRating !== 'number' ? DEFAULT_MAX_RATING : maxRating;\n maxRating = Math.max(1, maxRating);\n value = Math.min(maxRating, value);\n\n const isDecimalValue = Math.round(value) !== value;\n for (let i = 1; i <= maxRating; i += 1) {\n let fillValue = i <= value ? 1 : 0;\n if (isDecimalValue && Math.ceil(value) === i) {\n fillValue = value - Math.floor(value);\n }\n starsOutline.push(<RatingItem key={`star-${i}`} fill={fillValue} />);\n }\n\n return (\n <StyledRating aria-label={ariaLabel} title={ariaLabel} tabIndex={tabIndex} {...restProps}>\n <StyledRatingItemsContainer>{starsOutline}</StyledRatingItemsContainer>\n {metaInfo && <StyledRatingMetaInfo>({metaInfo})</StyledRatingMetaInfo>}{' '}\n </StyledRating>\n );\n};\n\nRating.defaultProps = defaultProps;\n\nexport default Rating;\n"]}
1
+ {"version":3,"file":"Rating.js","sourceRoot":"","sources":["../../../src/components/Rating/Rating.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,IAAI,MAAM,SAAS,CAAC;AA0B3B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B,MAAM,YAAY,GAAyB;IACzC,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,kBAAkB;IAC7B,QAAQ,EAAE,CAAC;CACZ,CAAC;AAEF,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAG9B,CAAC;AAEF,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;IACpD,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,OAAO,GAAG,CAAA;aACC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK;;;;GAIvC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,0BAA0B,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3D,MAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAG9C,CAAC;AAMF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAA2B,KAAK,CAAC,EAAE;IAC9E,MAAM,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;IACnC,OAAO,GAAG,CAAA;;;;aAIC,gBAAgB;;;GAG1B,CAAC;AACJ,CAAC,CA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AG,KAAK,CAAC;IACjC,SAAS,GAAG,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3E,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IACnC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAEnC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC;IACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE;QACtC,IAAI,SAAS,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,IAAI,cAAc,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAC5C,SAAS,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACvC;QACD,YAAY,CAAC,IAAI,CAAC,KAAC,UAAU,IAAmB,IAAI,EAAE,SAAS,IAA5B,QAAQ,CAAC,EAAE,CAAqB,CAAC,CAAC;KACtE;IAED,OAAO,CACL,MAAC,YAAY,gCAAa,SAAS,EAAE,QAAQ,EAAE,QAAQ,IAAM,SAAS,eACpE,KAAC,0BAA0B,cAAE,YAAY,WAA8B,EACtE,QAAQ,IAAI,MAAC,oBAAoB,oBAAG,QAAQ,iBAAyB,EAAE,GAAG,aAC9D,CAChB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;AAEnC,eAAe,MAAM,CAAC","sourcesContent":["import { FunctionComponent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport Icon from '../Icon';\n\nexport interface RatingProps extends BaseProps {\n /**\n * Sets the rating to read only.\n * @default false\n */\n readOnly?: boolean;\n /**\n * The maximum rating allowed. Must be an integer greater than 1.\n * @default 5\n */\n maxRating?: number;\n /** The value of the Rating. Could be a decimal or integer. */\n value: number;\n /** Text that is displayed in parentheses inline with the Rating stars. */\n metaInfo?: string;\n /** Aria label for screen readers. */\n 'aria-label'?: string;\n /**\n * The tabIndex to control focus.\n * @default 0\n */\n tabIndex?: number;\n}\n\nconst DEFAULT_MAX_RATING = 5;\n\nconst defaultProps: Partial<RatingProps> = {\n readOnly: false,\n maxRating: DEFAULT_MAX_RATING,\n tabIndex: 0\n};\n\nconst StyledRating = styled.div`\n display: inline-block;\n vertical-align: middle;\n`;\n\nconst StyledRatingItemsContainer = styled.div(props => {\n const { theme } = props;\n return css`\n color: ${theme.components.rating.color};\n line-height: 1;\n vertical-align: middle;\n display: inline-block;\n `;\n});\n\nStyledRatingItemsContainer.defaultProps = defaultThemeProp;\n\nconst StyledPartialRatingContainer = styled.div`\n position: relative;\n display: inline-block;\n`;\n\ninterface StyledPartialRatingProps {\n ratingPercentage: number;\n}\n\nexport const StyledPartialRating = styled.div<StyledPartialRatingProps>(props => {\n const { ratingPercentage } = props;\n return css`\n display: inline-block;\n position: absolute;\n inset-inline-start: 0;\n width: ${ratingPercentage}%;\n overflow: hidden;\n white-space: nowrap;\n `;\n});\n\nconst StyledRatingMetaInfo = styled.span(props => {\n const { theme } = props;\n return css`\n margin-inline-start: ${theme.base.spacing};\n `;\n});\n\nStyledRatingMetaInfo.defaultProps = defaultThemeProp;\n\ninterface RatingItemProps {\n fill: number;\n}\n\nconst RatingItem: FunctionComponent<RatingItemProps> = (props: RatingItemProps) => {\n const { fill, ...restProps } = props;\n const fillPercentage = Math.round((100 / 1) * fill);\n return (\n <>\n {fillPercentage === 0 && <Icon {...restProps} name='star' />}\n {fillPercentage === 100 && <Icon {...restProps} name='star-solid' />}\n {fillPercentage > 0 && fillPercentage < 100 && (\n <StyledPartialRatingContainer>\n <Icon {...restProps} name='star' />\n <StyledPartialRating ratingPercentage={fillPercentage}>\n <Icon {...restProps} name='star-solid' />\n </StyledPartialRating>\n </StyledPartialRatingContainer>\n )}\n </>\n );\n};\n\nconst Rating: FunctionComponent<RatingProps & ForwardProps> = (props: RatingProps) => {\n const starsOutline = [];\n const { 'aria-label': ariaLabel, metaInfo, tabIndex, readOnly, ...restProps } = props;\n\n let { maxRating, value } = props;\n maxRating = typeof maxRating !== 'number' ? DEFAULT_MAX_RATING : maxRating;\n maxRating = Math.max(1, maxRating);\n value = Math.min(maxRating, value);\n\n const isDecimalValue = Math.round(value) !== value;\n for (let i = 1; i <= maxRating; i += 1) {\n let fillValue = i <= value ? 1 : 0;\n if (isDecimalValue && Math.ceil(value) === i) {\n fillValue = value - Math.floor(value);\n }\n starsOutline.push(<RatingItem key={`star-${i}`} fill={fillValue} />);\n }\n\n return (\n <StyledRating aria-label={ariaLabel} tabIndex={tabIndex} {...restProps}>\n <StyledRatingItemsContainer>{starsOutline}</StyledRatingItemsContainer>\n {metaInfo && <StyledRatingMetaInfo>({metaInfo})</StyledRatingMetaInfo>}{' '}\n </StyledRating>\n );\n};\n\nRating.defaultProps = defaultProps;\n\nexport default Rating;\n"]}
@@ -3,8 +3,8 @@ import { ForwardProps } from '../../types';
3
3
  import { FormControlProps } from '../FormControl';
4
4
  export interface SearchInputProps {
5
5
  /**
6
- * Placeholder text. The default value is a locale translation of 'Search...'
7
- * @default "Search..."
6
+ * Placeholder text. The default value is a locale translation of 'Search'
7
+ * @default "Search"
8
8
  */
9
9
  placeholder?: FormControlProps['placeholder'];
10
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput.js","sourceRoot":"","sources":["../../../src/components/SearchInput/SearchInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,UAAU,EACV,QAAQ,EAER,WAAW,EAEX,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBA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,gBACD,oBAAoB,EAChC,WAAW,EAAE,WAAW,IACpB,SAAS,IACb,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,YACpB,EACF,KAAC,IAAI,kBACH,EAAE,EAAE,gBAAgB,EACpB,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,EACtD,OAAO,EAAE,GAAG,EAAE;oBACZ,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;gBAC5B,CAAC,gBAED,KAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,WAAG,YACjB,aACF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import {\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n forwardRef,\n useState,\n ChangeEvent,\n useCallback,\n KeyboardEvent,\n useEffect\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { transparentize } from 'polished';\n\nimport { ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport Input from '../Input';\nimport Icon from '../Icon';\nimport { FormControlProps } from '../FormControl';\nimport { useAfterInitialEffect, useConsolidatedRef, useI18n } from '../../hooks';\nimport Flex from '../Flex';\nimport { tryCatch } from '../../utils';\n\nexport interface SearchInputProps {\n /**\n * Placeholder text. The default value is a locale translation of 'Search...'\n * @default \"Search...\"\n */\n placeholder?: FormControlProps['placeholder'];\n /**\n * Creates a controlled input and sets the value. Requires an onChange handler to update value.\n * value + onChange is the recommended method per React team.\n */\n value?: FormControlProps['value'];\n /**\n * If you wish to use an [uncontrolled input](https://reactjs.org/docs/uncontrolled-components.html), pass a defaultValue prop and a ref to access the input's native value prop or by other DOM ref means.\n */\n defaultValue?: FormControlProps['defaultValue'];\n /** Called when the SearchInput value changes. */\n onSearchChange?: (value: string) => void;\n /**\n * Called when the SearchButton is clicked or when the Enter key is pressed while SearchInput is in focus.\n * NOTE: this does not trigger an actual form submit event. It simply represents an explicit action by the user to search as opposed to onSearchChange.\n */\n onSearchSubmit?: (value: string) => void;\n /** Aria label for search input, used by screen readers. */\n searchInputAriaLabel?: string;\n}\n\nexport const StyledSearchIcon = styled.div(props => {\n const {\n theme: {\n base,\n components: { 'search-input': searchInput, 'form-control': formControl }\n }\n } = props;\n const iconColor = tryCatch(() => transparentize(0.75, base.palette['foreground-color']));\n return css`\n position: absolute;\n z-index: 1;\n inset-inline-start: 0.0625rem;\n top: 0.0625rem;\n width: calc(${base['hit-area']['mouse-min']} - 0.125rem);\n height: calc(${base['hit-area']['mouse-min']} - 0.125rem);\n border-radius: calc(${base['border-radius']} * ${searchInput['border-radius']});\n padding: 0;\n background: ${formControl['background-color']};\n color: ${iconColor};\n cursor: text;\n line-height: 1;\n `;\n});\n\nStyledSearchIcon.defaultProps = defaultThemeProp;\n\nexport const StyledSearchTextInput = styled(Input)(props => {\n const { theme } = props;\n const comp = theme.components['search-input'];\n return css`\n position: relative;\n width: 100%;\n height: ${theme.base['hit-area']['mouse-min']};\n min-height: ${theme.base['hit-area']['mouse-min']};\n padding-inline-start: 0;\n padding-inline-end: calc(${theme.base['hit-area']['mouse-min']} - 0.125rem);\n text-indent: calc(${theme.base['hit-area']['mouse-min']} - 0.125rem);\n border-radius: calc(${comp['border-radius']} * ${theme.base['border-radius']});\n &::-ms-clear {\n display: none;\n }\n &::-webkit-search-cancel-button {\n display: none;\n }\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n &:focus:not([disabled]) {\n box-shadow: none;\n }\n `;\n});\n\nStyledSearchTextInput.defaultProps = defaultThemeProp;\n\nexport const StyledSearchInput = styled.div(({ theme: { base, components } }) => {\n const iconColor = tryCatch(() => transparentize(0.3, base.palette['foreground-color']));\n\n return css`\n position: relative;\n height: ${base['hit-area']['mouse-min']};\n border-radius: calc(${components['search-input']['border-radius']} * ${base['border-radius']});\n\n &:focus-within {\n box-shadow: ${base.shadow.focus};\n\n ${StyledSearchIcon} {\n color: ${iconColor};\n }\n }\n `;\n});\n\nStyledSearchInput.defaultProps = defaultThemeProp;\n\nconst SearchInput: FunctionComponent<SearchInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<SearchInputProps>, ref: Ref<HTMLInputElement>) => {\n const t = useI18n();\n\n const {\n defaultValue,\n value,\n placeholder = t('search_placeholder_default'),\n onSearchChange,\n onSearchSubmit,\n searchInputAriaLabel,\n ...restProps\n } = props;\n\n const [searchInputValue, setValue] = useState<string>(value || defaultValue || '');\n\n const innerRef = useConsolidatedRef(ref);\n\n useEffect(() => {\n if (typeof value === 'string' && value !== searchInputValue) {\n setValue(value);\n }\n }, [value]);\n\n const onChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n },\n [searchInputValue]\n );\n\n const onSubmit = useCallback(() => {\n onSearchSubmit?.(searchInputValue);\n }, [searchInputValue]);\n\n const onKeyDown = useCallback(\n (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Enter') {\n onSubmit();\n }\n },\n [searchInputValue]\n );\n\n useAfterInitialEffect(() => {\n if (onSearchChange) onSearchChange(searchInputValue);\n }, [searchInputValue]);\n\n return (\n <Flex container as={StyledSearchInput}>\n <StyledSearchTextInput\n ref={innerRef}\n type='search'\n aria-label={searchInputAriaLabel}\n placeholder={placeholder}\n {...restProps}\n value={searchInputValue}\n onChange={onChange}\n onKeyDown={onKeyDown}\n />\n <Flex\n as={StyledSearchIcon}\n container={{ justify: 'center', alignItems: 'center' }}\n onClick={() => {\n innerRef.current?.focus();\n }}\n >\n <Icon name='search' />\n </Flex>\n </Flex>\n );\n }\n);\n\nexport default SearchInput;\n"]}
1
+ {"version":3,"file":"SearchInput.js","sourceRoot":"","sources":["../../../src/components/SearchInput/SearchInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,UAAU,EACV,QAAQ,EAER,WAAW,EAEX,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,E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I,EAAC,QAAQ,gBACD,oBAAoB,EAChC,WAAW,EAAE,WAAW,IACpB,SAAS,IACb,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,YACpB,EACF,KAAC,IAAI,kBACH,EAAE,EAAE,gBAAgB,EACpB,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,EACtD,OAAO,EAAE,GAAG,EAAE;oBACZ,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;gBAC5B,CAAC,gBAED,KAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,WAAG,YACjB,aACF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import {\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n forwardRef,\n useState,\n ChangeEvent,\n useCallback,\n KeyboardEvent,\n useEffect\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { transparentize } from 'polished';\n\nimport { ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport Input from '../Input';\nimport Icon from '../Icon';\nimport { FormControlProps } from '../FormControl';\nimport { useAfterInitialEffect, useConsolidatedRef, useI18n } from '../../hooks';\nimport Flex from '../Flex';\nimport { tryCatch } from '../../utils';\n\nexport interface SearchInputProps {\n /**\n * Placeholder text. The default value is a locale translation of 'Search'\n * @default \"Search…\"\n */\n placeholder?: FormControlProps['placeholder'];\n /**\n * Creates a controlled input and sets the value. Requires an onChange handler to update value.\n * value + onChange is the recommended method per React team.\n */\n value?: FormControlProps['value'];\n /**\n * If you wish to use an [uncontrolled input](https://reactjs.org/docs/uncontrolled-components.html), pass a defaultValue prop and a ref to access the input's native value prop or by other DOM ref means.\n */\n defaultValue?: FormControlProps['defaultValue'];\n /** Called when the SearchInput value changes. */\n onSearchChange?: (value: string) => void;\n /**\n * Called when the SearchButton is clicked or when the Enter key is pressed while SearchInput is in focus.\n * NOTE: this does not trigger an actual form submit event. It simply represents an explicit action by the user to search as opposed to onSearchChange.\n */\n onSearchSubmit?: (value: string) => void;\n /** Aria label for search input, used by screen readers. */\n searchInputAriaLabel?: string;\n}\n\nexport const StyledSearchIcon = styled.div(props => {\n const {\n theme: {\n base,\n components: { 'search-input': searchInput, 'form-control': formControl }\n }\n } = props;\n const iconColor = tryCatch(() => transparentize(0.75, base.palette['foreground-color']));\n return css`\n position: absolute;\n z-index: 1;\n inset-inline-start: 0.0625rem;\n top: 0.0625rem;\n width: calc(${base['hit-area']['mouse-min']} - 0.125rem);\n height: calc(${base['hit-area']['mouse-min']} - 0.125rem);\n border-radius: calc(${base['border-radius']} * ${searchInput['border-radius']});\n padding: 0;\n background: ${formControl['background-color']};\n color: ${iconColor};\n cursor: text;\n line-height: 1;\n `;\n});\n\nStyledSearchIcon.defaultProps = defaultThemeProp;\n\nexport const StyledSearchTextInput = styled(Input)(props => {\n const { theme } = props;\n const comp = theme.components['search-input'];\n return css`\n position: relative;\n width: 100%;\n height: ${theme.base['hit-area']['mouse-min']};\n min-height: ${theme.base['hit-area']['mouse-min']};\n padding-inline-start: 0;\n padding-inline-end: calc(${theme.base['hit-area']['mouse-min']} - 0.125rem);\n text-indent: calc(${theme.base['hit-area']['mouse-min']} - 0.125rem);\n border-radius: calc(${comp['border-radius']} * ${theme.base['border-radius']});\n &::-ms-clear {\n display: none;\n }\n &::-webkit-search-cancel-button {\n display: none;\n }\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n &:focus:not([disabled]) {\n box-shadow: none;\n }\n `;\n});\n\nStyledSearchTextInput.defaultProps = defaultThemeProp;\n\nexport const StyledSearchInput = styled.div(({ theme: { base, components } }) => {\n const iconColor = tryCatch(() => transparentize(0.3, base.palette['foreground-color']));\n\n return css`\n position: relative;\n height: ${base['hit-area']['mouse-min']};\n border-radius: calc(${components['search-input']['border-radius']} * ${base['border-radius']});\n\n &:focus-within {\n box-shadow: ${base.shadow.focus};\n\n ${StyledSearchIcon} {\n color: ${iconColor};\n }\n }\n `;\n});\n\nStyledSearchInput.defaultProps = defaultThemeProp;\n\nconst SearchInput: FunctionComponent<SearchInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<SearchInputProps>, ref: Ref<HTMLInputElement>) => {\n const t = useI18n();\n\n const {\n defaultValue,\n value,\n placeholder = t('search_placeholder_default'),\n onSearchChange,\n onSearchSubmit,\n searchInputAriaLabel,\n ...restProps\n } = props;\n\n const [searchInputValue, setValue] = useState<string>(value || defaultValue || '');\n\n const innerRef = useConsolidatedRef(ref);\n\n useEffect(() => {\n if (typeof value === 'string' && value !== searchInputValue) {\n setValue(value);\n }\n }, [value]);\n\n const onChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n },\n [searchInputValue]\n );\n\n const onSubmit = useCallback(() => {\n onSearchSubmit?.(searchInputValue);\n }, [searchInputValue]);\n\n const onKeyDown = useCallback(\n (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Enter') {\n onSubmit();\n }\n },\n [searchInputValue]\n );\n\n useAfterInitialEffect(() => {\n if (onSearchChange) onSearchChange(searchInputValue);\n }, [searchInputValue]);\n\n return (\n <Flex container as={StyledSearchInput}>\n <StyledSearchTextInput\n ref={innerRef}\n type='search'\n aria-label={searchInputAriaLabel}\n placeholder={placeholder}\n {...restProps}\n value={searchInputValue}\n onChange={onChange}\n onKeyDown={onKeyDown}\n />\n <Flex\n as={StyledSearchIcon}\n container={{ justify: 'center', alignItems: 'center' }}\n onClick={() => {\n innerRef.current?.focus();\n }}\n >\n <Icon name='search' />\n </Flex>\n </Flex>\n );\n }\n);\n\nexport default SearchInput;\n"]}
@@ -50,7 +50,7 @@ const SummaryList = forwardRef(({ icon, name, count, actions, items, onViewAll,
50
50
  }
51
51
  return items.length > 0 ? (_jsx(SummaryListItems, { items: items }, void 0)) : (_jsx(EmptyState, { message: noItemsText }, void 0));
52
52
  }, [loading, items, noItemsText, error]);
53
- return (_jsxs(Card, Object.assign({ ref: ref }, restProps, { children: [(icon || name || typeof count === 'number' || actions) && (_jsxs(CardHeader, { children: [_jsxs(Flex, Object.assign({ container: { alignItems: 'center', gap: 1 } }, { children: [icon && _jsx(Icon, { name: icon }, void 0), name && _jsx(Text, Object.assign({ variant: 'h2' }, { children: name }), void 0), typeof count === 'number' && _jsx(Count, { children: count }, void 0)] }), void 0), actions && _jsx(Actions, { items: actions }, void 0)] }, void 0)), _jsx(StyledSummaryListContent, Object.assign({ loading: loading }, { children: content }), void 0), !error && typeof count === 'number' && count > items.length && onViewAll && (_jsx(CardFooter, Object.assign({ justify: 'center' }, { children: _jsx(Button, Object.assign({ variant: 'link', "aria-label": name ? t('view_all_noun', name) : t('view_all'), onClick: onViewAll }, { children: t('view_all') }), void 0) }), void 0))] }), void 0));
53
+ return (_jsxs(Card, Object.assign({ ref: ref }, restProps, { children: [(icon || name || typeof count === 'number' || actions) && (_jsxs(CardHeader, { children: [_jsxs(Flex, Object.assign({ container: { alignItems: 'center', gap: 1 } }, { children: [icon && _jsx(Icon, { name: icon }, void 0), name && _jsx(Text, Object.assign({ variant: 'h2' }, { children: name }), void 0), typeof count === 'number' && _jsx(Count, { children: count }, void 0)] }), void 0), actions && _jsx(Actions, { items: actions }, void 0)] }, void 0)), _jsx(StyledSummaryListContent, Object.assign({ loading: loading }, { children: content }), void 0), !error && typeof count === 'number' && count > items.length && onViewAll && (_jsx(CardFooter, Object.assign({ justify: 'center' }, { children: _jsx(Button, Object.assign({ variant: 'link', "aria-label": name ? t('view_all_noun', [name.toLowerCase()]) : t('view_all'), onClick: onViewAll }, { children: t('view_all') }), void 0) }), void 0))] }), void 0));
54
54
  });
55
55
  export default SummaryList;
56
56
  //# sourceMappingURL=SummaryList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SummaryList.js","sourceRoot":"","sources":["../../../src/components/SummaryList/SummaryList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA4B,OAAO,EAAE,MAAM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C","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, FC, useMemo } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Actions from '../Actions';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Count from '../Badges/Count';\nimport Icon from '../Icon';\nimport Card, { CardHeader, CardContent, CardFooter } from '../Card';\nimport EmptyState, { EmptyStateProps } from '../EmptyState';\nimport { ForwardProps, NoChildrenProp, OmitStrict, Action } from '../../types';\nimport { omitProps } from '../../styles';\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport SummaryItem, { SummaryItemProps } from '../SummaryItem';\nimport Progress from '../Progress';\nimport Button from '../Button';\nimport ErrorState from '../ErrorState';\nimport type { ErrorStateProps } from '../ErrorState';\n\nexport interface SummaryListProps extends NoChildrenProp {\n /** Name of the utility to be used as its heading along with associated actions and aria attributes. */\n name?: string;\n /** Identifier for the icon within Pega icons. */\n icon?: string;\n /** Integer representing the total count of items for a list utility dataset. */\n count?: number;\n /** Top level actions for the utility. If more than one action is passed a consolidated ActionMenu will be generated. */\n actions?: Action[];\n /** If the utility is in a state of fetching data. */\n loading?: boolean | string;\n /** An array of SummaryListItem objects to render. Pass an appropriately limited length array with a desired sort order based on design system defaults or config. */\n items: SummaryListItem[];\n /** User click initiated callback for when to show view all modal. List lengths less than the count prop will display a \"View all\" button with this function is bound to. */\n onViewAll?: (callback: Function) => void;\n /** A simple message to display when there are no items. */\n noItemsText?: EmptyStateProps['message'];\n /**\n * Indicate an error occurred while acquiring data for the list.\n * The default error state may be overridden with custom props.\n */\n error?: boolean | ErrorStateProps;\n /** Ref for the SummaryList's root element. */\n ref?: Ref<HTMLElement>;\n}\n\nexport interface SummaryListItem extends OmitStrict<SummaryItemProps, 'actions'>, ForwardProps {\n /** A unique id to represent the item. */\n id: string;\n /** A set of Actions to render alongside the item. If more than one action is passed a consolidated ActionMenu will be generated. */\n actions?: Action[];\n}\n\nexport const StyledSummaryListContent = styled(CardContent).withConfig<{ loading?: boolean }>(\n omitProps('loading')\n)(\n ({ theme, loading }) => css`\n ${loading &&\n css`\n min-height: 4rem;\n `}\n\n &:not(:last-child) > ul > li:last-child {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n `\n);\n\nStyledSummaryListContent.defaultProps = defaultThemeProp;\n\nexport const StyledSummaryListItem: typeof SummaryItem = styled(SummaryItem)(\n ({ theme }) =>\n css`\n padding: ${theme.base.spacing} 0;\n\n &:not(:last-child) {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n `\n);\n\nStyledSummaryListItem.defaultProps = defaultThemeProp;\n\nexport const SummaryListItems = ({ items }: Pick<SummaryListProps, 'items'>) => {\n return (\n <ul>\n {items.map(({ id, actions: itemActions, ...restItemProps }) => {\n return (\n <StyledSummaryListItem\n key={id}\n {...restItemProps}\n forwardedAs='li'\n actions={itemActions && <Actions items={itemActions} />}\n />\n );\n })}\n </ul>\n );\n};\n\nconst SummaryList: FC<SummaryListProps & ForwardProps> = forwardRef(\n (\n {\n icon,\n name,\n count,\n actions,\n items,\n onViewAll,\n loading,\n noItemsText,\n error,\n ...restProps\n }: PropsWithoutRef<SummaryListProps>,\n ref: SummaryListProps['ref']\n ) => {\n const t = useI18n();\n\n const content = useMemo(() => {\n if (loading) {\n return (\n <Progress placement='local' message={typeof loading === 'string' ? loading : undefined} />\n );\n }\n\n if (error) {\n return <ErrorState {...(error === true ? {} : error)} />;\n }\n\n return items.length > 0 ? (\n <SummaryListItems items={items} />\n ) : (\n <EmptyState message={noItemsText} />\n );\n }, [loading, items, noItemsText, error]);\n\n return (\n <Card ref={ref} {...restProps}>\n {(icon || name || typeof count === 'number' || actions) && (\n <CardHeader>\n <Flex container={{ alignItems: 'center', gap: 1 }}>\n {icon && <Icon name={icon} />}\n {name && <Text variant='h2'>{name}</Text>}\n {typeof count === 'number' && <Count>{count}</Count>}\n </Flex>\n {actions && <Actions items={actions} />}\n </CardHeader>\n )}\n\n <StyledSummaryListContent loading={loading}>{content}</StyledSummaryListContent>\n\n {!error && typeof count === 'number' && count > items.length && onViewAll && (\n <CardFooter justify='center'>\n <Button\n variant='link'\n aria-label={name ? t('view_all_noun', name) : t('view_all')}\n onClick={onViewAll}\n >\n {t('view_all')}\n </Button>\n </CardFooter>\n )}\n </Card>\n );\n }\n);\n\nexport default SummaryList;\n"]}
1
+ {"version":3,"file":"SummaryList.js","sourceRoot":"","sources":["../../../src/components/SummaryList/SummaryList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA4B,OAAO,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,UAA+B,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,WAAiC,MAAM,gBAAgB,CAAC;AAC/D,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,UAAU,MAAM,eAAe,CAAC;AAoCvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,UAAU,CACpE,SAAS,CAAC,SAAS,CAAC,CACrB,CACC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;MACvB,OAAO;IACT,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I,SAAS,IAAI,CAC3E,KAAC,UAAU,kBAAC,OAAO,EAAC,QAAQ,gBAC1B,KAAC,MAAM,kBACL,OAAO,EAAC,MAAM,gBACF,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,EAC3E,OAAO,EAAE,SAAS,gBAEjB,CAAC,CAAC,UAAU,CAAC,YACP,YACE,CACd,aACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, FC, useMemo } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Actions from '../Actions';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Count from '../Badges/Count';\nimport Icon from '../Icon';\nimport Card, { CardHeader, CardContent, CardFooter } from '../Card';\nimport EmptyState, { EmptyStateProps } from '../EmptyState';\nimport { ForwardProps, NoChildrenProp, OmitStrict, Action } from '../../types';\nimport { omitProps } from '../../styles';\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport SummaryItem, { SummaryItemProps } from '../SummaryItem';\nimport Progress from '../Progress';\nimport Button from '../Button';\nimport ErrorState from '../ErrorState';\nimport type { ErrorStateProps } from '../ErrorState';\n\nexport interface SummaryListProps extends NoChildrenProp {\n /** Name of the utility to be used as its heading along with associated actions and aria attributes. */\n name?: string;\n /** Identifier for the icon within Pega icons. */\n icon?: string;\n /** Integer representing the total count of items for a list utility dataset. */\n count?: number;\n /** Top level actions for the utility. If more than one action is passed a consolidated ActionMenu will be generated. */\n actions?: Action[];\n /** If the utility is in a state of fetching data. */\n loading?: boolean | string;\n /** An array of SummaryListItem objects to render. Pass an appropriately limited length array with a desired sort order based on design system defaults or config. */\n items: SummaryListItem[];\n /** User click initiated callback for when to show view all modal. List lengths less than the count prop will display a \"View all\" button with this function is bound to. */\n onViewAll?: (callback: Function) => void;\n /** A simple message to display when there are no items. */\n noItemsText?: EmptyStateProps['message'];\n /**\n * Indicate an error occurred while acquiring data for the list.\n * The default error state may be overridden with custom props.\n */\n error?: boolean | ErrorStateProps;\n /** Ref for the SummaryList's root element. */\n ref?: Ref<HTMLElement>;\n}\n\nexport interface SummaryListItem extends OmitStrict<SummaryItemProps, 'actions'>, ForwardProps {\n /** A unique id to represent the item. */\n id: string;\n /** A set of Actions to render alongside the item. If more than one action is passed a consolidated ActionMenu will be generated. */\n actions?: Action[];\n}\n\nexport const StyledSummaryListContent = styled(CardContent).withConfig<{ loading?: boolean }>(\n omitProps('loading')\n)(\n ({ theme, loading }) => css`\n ${loading &&\n css`\n min-height: 4rem;\n `}\n\n &:not(:last-child) > ul > li:last-child {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n `\n);\n\nStyledSummaryListContent.defaultProps = defaultThemeProp;\n\nexport const StyledSummaryListItem: typeof SummaryItem = styled(SummaryItem)(\n ({ theme }) =>\n css`\n padding: ${theme.base.spacing} 0;\n\n &:not(:last-child) {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n `\n);\n\nStyledSummaryListItem.defaultProps = defaultThemeProp;\n\nexport const SummaryListItems = ({ items }: Pick<SummaryListProps, 'items'>) => {\n return (\n <ul>\n {items.map(({ id, actions: itemActions, ...restItemProps }) => {\n return (\n <StyledSummaryListItem\n key={id}\n {...restItemProps}\n forwardedAs='li'\n actions={itemActions && <Actions items={itemActions} />}\n />\n );\n })}\n </ul>\n );\n};\n\nconst SummaryList: FC<SummaryListProps & ForwardProps> = forwardRef(\n (\n {\n icon,\n name,\n count,\n actions,\n items,\n onViewAll,\n loading,\n noItemsText,\n error,\n ...restProps\n }: PropsWithoutRef<SummaryListProps>,\n ref: SummaryListProps['ref']\n ) => {\n const t = useI18n();\n\n const content = useMemo(() => {\n if (loading) {\n return (\n <Progress placement='local' message={typeof loading === 'string' ? loading : undefined} />\n );\n }\n\n if (error) {\n return <ErrorState {...(error === true ? {} : error)} />;\n }\n\n return items.length > 0 ? (\n <SummaryListItems items={items} />\n ) : (\n <EmptyState message={noItemsText} />\n );\n }, [loading, items, noItemsText, error]);\n\n return (\n <Card ref={ref} {...restProps}>\n {(icon || name || typeof count === 'number' || actions) && (\n <CardHeader>\n <Flex container={{ alignItems: 'center', gap: 1 }}>\n {icon && <Icon name={icon} />}\n {name && <Text variant='h2'>{name}</Text>}\n {typeof count === 'number' && <Count>{count}</Count>}\n </Flex>\n {actions && <Actions items={actions} />}\n </CardHeader>\n )}\n\n <StyledSummaryListContent loading={loading}>{content}</StyledSummaryListContent>\n\n {!error && typeof count === 'number' && count > items.length && onViewAll && (\n <CardFooter justify='center'>\n <Button\n variant='link'\n aria-label={name ? t('view_all_noun', [name.toLowerCase()]) : t('view_all')}\n onClick={onViewAll}\n >\n {t('view_all')}\n </Button>\n </CardFooter>\n )}\n </Card>\n );\n }\n);\n\nexport default SummaryList;\n"]}
@@ -23,7 +23,7 @@ export interface StyledTabProps {
23
23
  inverted: TabProps['inverted'];
24
24
  tabType: TabProps['type'];
25
25
  }
26
- export declare const StyledTab: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, StyledTabProps, never>;
26
+ export declare const StyledTab: import("styled-components").StyledComponent<import("react").FunctionComponent<import("../Button/BareButton").BareButtonProps & ForwardProps>, import("styled-components").DefaultTheme, StyledTabProps, never>;
27
27
  declare const Tab: FC<TabProps & ForwardProps>;
28
28
  export default Tab;
29
29
  //# sourceMappingURL=Tab.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tab.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,SAAS,EAAoC,MAAM,OAAO,CAAC;AAOxE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,UAAU,QAAQ;IAChB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,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC/B,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC/B,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC3B;AAiHD,eAAO,MAAM,SAAS,gNA0BrB,CAAC;AAIF,QAAA,MAAM,GAAG,EAAE,EAAE,CAAC,QAAQ,GAAG,YAAY,CAoBpC,CAAC;AAEF,eAAe,GAAG,CAAC"}
@@ -5,6 +5,7 @@ import { transparentize } from 'polished';
5
5
  import { defaultThemeProp } from '../../theme';
6
6
  import { tryCatch } from '../../utils/utils';
7
7
  import { StyledCount } from '../Badges/Count';
8
+ import BareButton from '../Button/BareButton';
8
9
  const activeStyle = (color) => css `
9
10
  ::after {
10
11
  display: block;
@@ -111,7 +112,7 @@ const getVerticalStyles = ({ selected, theme }) => {
111
112
  }
112
113
  `;
113
114
  };
114
- export const StyledTab = styled.button `
115
+ export const StyledTab = styled(BareButton) `
115
116
  position: relative;
116
117
  background: none;
117
118
  cursor: pointer;
@@ -123,6 +124,10 @@ export const StyledTab = styled.button `
123
124
  `}
124
125
  white-space: nowrap;
125
126
 
127
+ & + & {
128
+ margin-inline-start: 0;
129
+ }
130
+
126
131
  &:focus {
127
132
  outline: none;
128
133
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../../src/components/Tabs/Tab.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAiB,UAAU,EAAwB,MAAM,OAAO,CAAC;AACxE,OAAO,MAAM,EAAE,EAAe,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AA6B9C,MAAM,WAA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AAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,IAAI,EACb,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,QAAQ,IACT,SAAS,eAEb,6CAAoB,OAAO,gBAAG,OAAO,YAAQ,EAC5C,KAAK,aACI,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,GAAG,CAAC","sourcesContent":["import { FC, ReactNode, forwardRef, PropsWithoutRef, Ref } from 'react';\nimport styled, { StyledProps, css } from 'styled-components';\nimport { transparentize } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils/utils';\nimport { StyledCount } from '../Badges/Count';\nimport { ForwardProps } from '../../types';\n\nimport { TabsProps } from './Tabs.types';\n\ninterface TabProps {\n /** Indicates if this Tab is active. */\n selected: boolean;\n /**\n * Indicates if the styling of this Tab is inverted.\n * @deprecated\n */\n inverted: boolean;\n /** The text to display as the name of the Tab. */\n content: string;\n /** A number to associate with the Tab. */\n count?: ReactNode;\n /** Determines the direction in which the Tab will render. */\n type: TabsProps['type'];\n /** Disables the tab if true */\n disabled?: boolean;\n}\n\nexport interface StyledTabProps {\n selected: TabProps['selected'];\n inverted: TabProps['inverted'];\n tabType: TabProps['type'];\n}\n\nconst activeStyle = (color: string) => css`\n ::after {\n display: block;\n background-color: ${color};\n }\n`;\n\nconst getHorizontalStyles = ({ selected, theme, inverted }: StyledProps<StyledTabProps>) => {\n const primaryColor = inverted\n ? theme.components.tabs.inverted.foreground\n : theme.components.tabs.base.foreground;\n const lightenedColor = tryCatch(() => transparentize(0.3, primaryColor)) ?? '';\n const { spacing } = theme.base;\n\n return css`\n align-items: center;\n display: flex;\n flex-direction: row;\n height: calc(4 * ${spacing});\n padding: 0 calc(2 * ${spacing});\n border: none;\n\n span:first-of-type {\n color: ${selected ? primaryColor : theme.base.palette['foreground-color']};\n text-transform: uppercase;\n display: inline-block;\n\n ::before {\n content: attr(data-content);\n display: block;\n font-weight: bold;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n }\n\n &:first-child {\n margin-left: 0;\n }\n\n ::after {\n background: ${selected ? primaryColor : lightenedColor};\n display: ${selected ? 'block' : 'none'};\n content: '';\n position: absolute;\n height: 0.125rem;\n bottom: 0;\n left: 0;\n right: 0;\n }\n\n &:hover&:not(:disabled) {\n ${activeStyle(lightenedColor)}\n }\n\n &:focus {\n ${activeStyle(lightenedColor)}\n box-shadow: inset ${theme.base.shadow.focus}\n }\n\n ${StyledCount} {\n margin-inline-start: calc(0.5 * ${spacing});\n }\n `;\n};\n\nconst getVerticalStyles = ({ selected, theme }: StyledProps<StyledTabProps>) => {\n const borderColor = theme.base.palette['border-line'];\n const primaryColor = theme.base.palette.interactive;\n const lightenedColor = tryCatch(() => transparentize(0.5, primaryColor)) ?? '';\n const { spacing } = theme.base;\n\n return css`\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-style: solid;\n color: ${theme.base.palette['foreground-color']};\n border-width: 0.0625rem 0;\n border-color: ${borderColor};\n height: calc(5.5 * ${spacing});\n margin-top: -0.0625rem;\n padding: 0 calc(2 * ${spacing});\n\n &:first-child {\n border-top: 0.0625rem solid ${borderColor};\n }\n\n ::after {\n content: '';\n position: absolute;\n display: ${selected ? 'block' : 'none'};\n top: 0;\n bottom: 0;\n right: 0;\n width: 0.25rem;\n background: ${primaryColor};\n }\n\n &:hover&:not(:disabled) {\n ${activeStyle(lightenedColor)}\n }\n\n &:focus {\n ${activeStyle(primaryColor)}\n box-shadow: inset 0 0 0 0.0625rem ${primaryColor};\n }\n `;\n};\n\nexport const StyledTab = styled.button<StyledTabProps>`\n position: relative;\n background: none;\n cursor: pointer;\n\n ${props =>\n props.tabType === 'horizontal' ? getHorizontalStyles(props) : getVerticalStyles(props)}\n ${props =>\n props.selected &&\n css`\n font-weight: bold;\n `}\n white-space: nowrap;\n\n &:focus {\n outline: none;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: ${props => props.theme.base['disabled-opacity']};\n }\n`;\n\nStyledTab.defaultProps = defaultThemeProp;\n\nconst Tab: FC<TabProps & ForwardProps> = forwardRef(\n (\n { selected, inverted, content, count, type, disabled, ...restProps }: PropsWithoutRef<TabProps>,\n ref: Ref<HTMLButtonElement>\n ) => {\n return (\n <StyledTab\n ref={ref}\n selected={selected}\n inverted={inverted}\n tabType={type}\n disabled={disabled}\n type='button'\n {...restProps}\n >\n <span data-content={content}>{content}</span>\n {count}\n </StyledTab>\n );\n }\n);\n\nexport default Tab;\n"]}
1
+ {"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../../src/components/Tabs/Tab.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAiB,UAAU,EAAwB,MAAM,OAAO,CAAC;AACxE,OAAO,MAAM,EAAE,EAAe,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,UAAU,MAAM,sBAAsB,CAAC;AA4B9C,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,GAAG,CAAA;;;wBAGlB,KAAK;;CAE5B,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAA+B,EAAE,EAAE;IACzF,MAAM,YAAY,GAAG,QAAQ;QAC3B,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU;QAC3C,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;IAC1C,MAAM,cAAc,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,IAAI,EA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AC,cAAc,CAAC;;;;QAI3B,WAAW,CAAC,YAAY,CAAC;0CACS,YAAY;;GAEnD,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,CAAgB;;;;;IAKvD,KAAK,CAAC,EAAE,CACR,KAAK,CAAC,OAAO,KAAK,YAAY,CAAC,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC;IACtF,KAAK,CAAC,EAAE,CACR,KAAK,CAAC,QAAQ;IACd,GAAG,CAAA;;KAEF;;;;;;;;;;;;;eAaU,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC;;CAE3D,CAAC;AAEF,SAAS,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE1C,MAAM,GAAG,GAAgC,UAAU,CACjD,CACE,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,SAAS,EAA6B,EAC/F,GAA2B,EAC3B,EAAE;IACF,OAAO,CACL,MAAC,SAAS,kBACR,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,IAAI,EACb,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,QAAQ,IACT,SAAS,eAEb,6CAAoB,OAAO,gBAAG,OAAO,YAAQ,EAC5C,KAAK,aACI,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,GAAG,CAAC","sourcesContent":["import { FC, ReactNode, forwardRef, PropsWithoutRef, Ref } from 'react';\nimport styled, { StyledProps, css } from 'styled-components';\nimport { transparentize } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils/utils';\nimport { StyledCount } from '../Badges/Count';\nimport { ForwardProps } from '../../types';\nimport BareButton from '../Button/BareButton';\n\nimport { TabsProps } from './Tabs.types';\n\ninterface TabProps {\n /** Indicates if this Tab is active. */\n selected: boolean;\n /**\n * Indicates if the styling of this Tab is inverted.\n * @deprecated\n */\n inverted: boolean;\n /** The text to display as the name of the Tab. */\n content: string;\n /** A number to associate with the Tab. */\n count?: ReactNode;\n /** Determines the direction in which the Tab will render. */\n type: TabsProps['type'];\n /** Disables the tab if true */\n disabled?: boolean;\n}\n\nexport interface StyledTabProps {\n selected: TabProps['selected'];\n inverted: TabProps['inverted'];\n tabType: TabProps['type'];\n}\n\nconst activeStyle = (color: string) => css`\n ::after {\n display: block;\n background-color: ${color};\n }\n`;\n\nconst getHorizontalStyles = ({ selected, theme, inverted }: StyledProps<StyledTabProps>) => {\n const primaryColor = inverted\n ? theme.components.tabs.inverted.foreground\n : theme.components.tabs.base.foreground;\n const lightenedColor = tryCatch(() => transparentize(0.3, primaryColor)) ?? '';\n const { spacing } = theme.base;\n\n return css`\n align-items: center;\n display: flex;\n flex-direction: row;\n height: calc(4 * ${spacing});\n padding: 0 calc(2 * ${spacing});\n border: none;\n\n span:first-of-type {\n color: ${selected ? primaryColor : theme.base.palette['foreground-color']};\n text-transform: uppercase;\n display: inline-block;\n\n ::before {\n content: attr(data-content);\n display: block;\n font-weight: bold;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n }\n\n &:first-child {\n margin-left: 0;\n }\n\n ::after {\n background: ${selected ? primaryColor : lightenedColor};\n display: ${selected ? 'block' : 'none'};\n content: '';\n position: absolute;\n height: 0.125rem;\n bottom: 0;\n left: 0;\n right: 0;\n }\n\n &:hover&:not(:disabled) {\n ${activeStyle(lightenedColor)}\n }\n\n &:focus {\n ${activeStyle(lightenedColor)}\n box-shadow: inset ${theme.base.shadow.focus}\n }\n\n ${StyledCount} {\n margin-inline-start: calc(0.5 * ${spacing});\n }\n `;\n};\n\nconst getVerticalStyles = ({ selected, theme }: StyledProps<StyledTabProps>) => {\n const borderColor = theme.base.palette['border-line'];\n const primaryColor = theme.base.palette.interactive;\n const lightenedColor = tryCatch(() => transparentize(0.5, primaryColor)) ?? '';\n const { spacing } = theme.base;\n\n return css`\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-style: solid;\n color: ${theme.base.palette['foreground-color']};\n border-width: 0.0625rem 0;\n border-color: ${borderColor};\n height: calc(5.5 * ${spacing});\n margin-top: -0.0625rem;\n padding: 0 calc(2 * ${spacing});\n\n &:first-child {\n border-top: 0.0625rem solid ${borderColor};\n }\n\n ::after {\n content: '';\n position: absolute;\n display: ${selected ? 'block' : 'none'};\n top: 0;\n bottom: 0;\n right: 0;\n width: 0.25rem;\n background: ${primaryColor};\n }\n\n &:hover&:not(:disabled) {\n ${activeStyle(lightenedColor)}\n }\n\n &:focus {\n ${activeStyle(primaryColor)}\n box-shadow: inset 0 0 0 0.0625rem ${primaryColor};\n }\n `;\n};\n\nexport const StyledTab = styled(BareButton)<StyledTabProps>`\n position: relative;\n background: none;\n cursor: pointer;\n\n ${props =>\n props.tabType === 'horizontal' ? getHorizontalStyles(props) : getVerticalStyles(props)}\n ${props =>\n props.selected &&\n css`\n font-weight: bold;\n `}\n white-space: nowrap;\n\n & + & {\n margin-inline-start: 0;\n }\n\n &:focus {\n outline: none;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: ${props => props.theme.base['disabled-opacity']};\n }\n`;\n\nStyledTab.defaultProps = defaultThemeProp;\n\nconst Tab: FC<TabProps & ForwardProps> = forwardRef(\n (\n { selected, inverted, content, count, type, disabled, ...restProps }: PropsWithoutRef<TabProps>,\n ref: Ref<HTMLButtonElement>\n ) => {\n return (\n <StyledTab\n ref={ref}\n selected={selected}\n inverted={inverted}\n tabType={type}\n disabled={disabled}\n type='button'\n {...restProps}\n >\n <span data-content={content}>{content}</span>\n {count}\n </StyledTab>\n );\n }\n);\n\nexport default Tab;\n"]}
@@ -1,6 +1,7 @@
1
1
  import { FunctionComponent } from 'react';
2
2
  import { ForwardProps } from '../../types';
3
3
  import { TabsProps } from './Tabs.types';
4
+ export declare const StyledTabs: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Partial<TabsProps>, never>;
4
5
  /**
5
6
  * The tabs component will take a list of tab data objects and render out a list of tabs in either vertical or horizontal direction.
6
7
  * The tabs component handles which tab is active but will give you a callback function that allows you to make changes when a new tab is activated
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAOf,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAmBzC;;;GAGG;AACH,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CAoGrD,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAOf,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,eAAO,MAAM,UAAU,yHAUtB,CAAC;AAIF;;;GAGG;AACH,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CAwGrD,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,14 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createRef, forwardRef } from 'react';
2
+ import { forwardRef, useRef } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { defaultThemeProp } from '../../theme';
5
5
  import Flex from '../Flex';
6
6
  import Link from '../Link';
7
7
  import Count from '../Badges/Count';
8
8
  import Tab from './Tab';
9
- const TabContainer = styled.div(({ type, theme }) => css `
9
+ export const StyledTabs = styled.div(({ type, theme }) => css `
10
10
  position: relative;
11
- flex-shrink: 0;
12
11
  overflow: ${type === 'horizontal' ? 'auto' : 'visible'};
13
12
  ${type === 'horizontal' &&
14
13
  css `
@@ -16,21 +15,21 @@ const TabContainer = styled.div(({ type, theme }) => css `
16
15
  height: max-content;
17
16
  `}
18
17
  `);
19
- TabContainer.defaultProps = defaultThemeProp;
18
+ StyledTabs.defaultProps = defaultThemeProp;
20
19
  /**
21
20
  * The tabs component will take a list of tab data objects and render out a list of tabs in either vertical or horizontal direction.
22
21
  * The tabs component handles which tab is active but will give you a callback function that allows you to make changes when a new tab is activated
23
22
  */
24
23
  const Tabs = forwardRef(({ tabs = [], type = 'horizontal', currentTabId, onTabClick, inverted = false, ...restProps }, ref) => {
25
24
  // Used to keep a reference for every tab in order to focus them with key presses
26
- const tabRefs = tabs.map(() => createRef());
25
+ const tabRefs = useRef([]);
27
26
  // Handles arrow keypresses for changing the focus
28
27
  const changeTabFocus = (event, index) => {
29
- if (tabRefs.length) {
28
+ if (tabRefs.current?.length) {
30
29
  const { key } = event;
31
30
  if (key === 'ArrowRight' || key === 'ArrowDown') {
32
31
  const nextIndex = index + 1 < tabs.length ? index + 1 : 0;
33
- const nextTab = tabRefs[nextIndex]?.current;
32
+ const nextTab = tabRefs.current[nextIndex];
34
33
  if (!nextTab?.disabled) {
35
34
  nextTab?.focus();
36
35
  }
@@ -40,7 +39,7 @@ const Tabs = forwardRef(({ tabs = [], type = 'horizontal', currentTabId, onTabCl
40
39
  }
41
40
  else if (key === 'ArrowLeft' || key === 'ArrowUp') {
42
41
  const prevIndex = index === 0 ? tabs.length - 1 : index - 1;
43
- const prevTab = tabRefs[prevIndex]?.current;
42
+ const prevTab = tabRefs.current[prevIndex];
44
43
  if (!prevTab?.disabled) {
45
44
  prevTab?.focus();
46
45
  }
@@ -57,16 +56,22 @@ const Tabs = forwardRef(({ tabs = [], type = 'horizontal', currentTabId, onTabCl
57
56
  else {
58
57
  badgeVariant = 'default';
59
58
  }
60
- return (_jsx(Flex, Object.assign({ container: {
59
+ return (_jsx(Flex, Object.assign({}, restProps, { container: {
61
60
  direction: type !== 'horizontal' ? 'column' : undefined
62
- }, as: TabContainer, ref: ref, type: type, role: 'tablist' }, restProps, { children: tabs.map((tab, i) => {
61
+ }, item: { grow: 1, shrink: 0 }, as: StyledTabs, ref: ref, type: type, role: 'tablist' }, { children: tabs.map((tab, i) => {
63
62
  const { href, name, count, id, disabled } = tab;
64
63
  const selected = id === currentTabId;
65
- return (_jsx(Tab, { id: id, "aria-selected": selected, "aria-controls": `${id}-panel`, content: name, count: typeof count === 'number' && (_jsx(Count, Object.assign({ variant: selected && type === 'vertical' ? 'interactive' : badgeVariant }, { children: count }), void 0)), href: href, inverted: inverted || false, selected: selected, onClick: (event) => onTabClick?.(id, event), role: 'tab', ref: tabRefs[i], onKeyDown: (e) => {
64
+ return (_jsx(Tab, { id: id, "aria-selected": selected, "aria-controls": `${id}-panel`, content: name, count: typeof count === 'number' && (_jsx(Count, Object.assign({ variant: selected ? 'interactive' : badgeVariant }, { children: count }), void 0)), href: href, inverted: inverted || false, selected: selected, onClick: (event) => {
65
+ onTabClick?.(id, event);
66
+ }, role: 'tab', ref: (el) => {
67
+ tabRefs.current[i] = el;
68
+ }, onKeyDown: (e) => {
66
69
  if (['ArrowRight', 'ArrowDown', 'ArrowLeft', 'ArrowUp'].includes(e.key)) {
67
70
  e.preventDefault();
68
71
  }
69
- }, onKeyUp: (e) => changeTabFocus(e, i), as: href ? Link : undefined, tabIndex: selected ? undefined : -1, title: name, type: type, disabled: disabled }, id));
72
+ }, onKeyUp: (e) => {
73
+ changeTabFocus(e, i);
74
+ }, as: href ? Link : undefined, tabIndex: selected ? undefined : -1, "aria-label": name, type: type, disabled: disabled }, id));
70
75
  }) }), void 0));
71
76
  });
72
77
  export default Tabs;