no-frills-ui 0.0.14-alpha.8 → 0.0.14-rc.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 (150) hide show
  1. package/README.md +2 -3
  2. package/dist/index.js +841 -710
  3. package/dist/index.js.map +1 -1
  4. package/lib-esm/components/Accordion/Accordion.d.ts +9 -13
  5. package/lib-esm/components/Accordion/Accordion.js +3 -10
  6. package/lib-esm/components/Accordion/Accordion.js.map +1 -1
  7. package/lib-esm/components/Accordion/AccordionStep.d.ts +22 -22
  8. package/lib-esm/components/Accordion/AccordionStep.js +33 -28
  9. package/lib-esm/components/Accordion/AccordionStep.js.map +1 -1
  10. package/lib-esm/components/Badge/Badge.d.ts +13 -16
  11. package/lib-esm/components/Badge/Badge.js +10 -20
  12. package/lib-esm/components/Badge/Badge.js.map +1 -1
  13. package/lib-esm/components/Button/ActionButton.d.ts +9 -5
  14. package/lib-esm/components/Button/ActionButton.js +18 -3
  15. package/lib-esm/components/Button/ActionButton.js.map +1 -1
  16. package/lib-esm/components/Button/Button.d.ts +9 -5
  17. package/lib-esm/components/Button/Button.js +17 -5
  18. package/lib-esm/components/Button/Button.js.map +1 -1
  19. package/lib-esm/components/Button/IconButton.d.ts +9 -5
  20. package/lib-esm/components/Button/IconButton.js +18 -3
  21. package/lib-esm/components/Button/IconButton.js.map +1 -1
  22. package/lib-esm/components/Button/LinkButton.d.ts +9 -5
  23. package/lib-esm/components/Button/LinkButton.js +18 -3
  24. package/lib-esm/components/Button/LinkButton.js.map +1 -1
  25. package/lib-esm/components/Button/RaisedButton.d.ts +9 -5
  26. package/lib-esm/components/Button/RaisedButton.js +18 -3
  27. package/lib-esm/components/Button/RaisedButton.js.map +1 -1
  28. package/lib-esm/components/Card/Card.d.ts +4 -6
  29. package/lib-esm/components/Card/Card.js +16 -3
  30. package/lib-esm/components/Card/Card.js.map +1 -1
  31. package/lib-esm/components/Chip/Chip.d.ts +2 -2
  32. package/lib-esm/components/Chip/Chip.js +14 -8
  33. package/lib-esm/components/Chip/Chip.js.map +1 -1
  34. package/lib-esm/components/ChipInput/ChipInput.d.ts +28 -39
  35. package/lib-esm/components/ChipInput/ChipInput.js +35 -36
  36. package/lib-esm/components/ChipInput/ChipInput.js.map +1 -1
  37. package/lib-esm/components/Dialog/AlertDialog.d.ts +11 -12
  38. package/lib-esm/components/Dialog/AlertDialog.js +4 -11
  39. package/lib-esm/components/Dialog/AlertDialog.js.map +1 -1
  40. package/lib-esm/components/Dialog/ConfirmDialog.d.ts +13 -14
  41. package/lib-esm/components/Dialog/ConfirmDialog.js +4 -12
  42. package/lib-esm/components/Dialog/ConfirmDialog.js.map +1 -1
  43. package/lib-esm/components/Dialog/Dialog.d.ts +8 -14
  44. package/lib-esm/components/Dialog/Dialog.js +11 -9
  45. package/lib-esm/components/Dialog/Dialog.js.map +1 -1
  46. package/lib-esm/components/Dialog/PromptDialog.d.ts +18 -19
  47. package/lib-esm/components/Dialog/PromptDialog.js +10 -18
  48. package/lib-esm/components/Dialog/PromptDialog.js.map +1 -1
  49. package/lib-esm/components/DragAndDrop/DragAndDrop.d.ts +37 -59
  50. package/lib-esm/components/DragAndDrop/DragAndDrop.js +23 -26
  51. package/lib-esm/components/DragAndDrop/DragAndDrop.js.map +1 -1
  52. package/lib-esm/components/DragAndDrop/DragItem.d.ts +2 -2
  53. package/lib-esm/components/DragAndDrop/DragItem.js +40 -38
  54. package/lib-esm/components/DragAndDrop/DragItem.js.map +1 -1
  55. package/lib-esm/components/DragAndDrop/types.d.ts +3 -3
  56. package/lib-esm/components/DragAndDrop/types.js.map +1 -1
  57. package/lib-esm/components/Drawer/Drawer.d.ts +24 -31
  58. package/lib-esm/components/Drawer/Drawer.js +49 -45
  59. package/lib-esm/components/Drawer/Drawer.js.map +1 -1
  60. package/lib-esm/components/Groups/Group.d.ts +6 -8
  61. package/lib-esm/components/Groups/Group.js +12 -10
  62. package/lib-esm/components/Groups/Group.js.map +1 -1
  63. package/lib-esm/components/Input/Checkbox.d.ts +12 -15
  64. package/lib-esm/components/Input/Checkbox.js +30 -26
  65. package/lib-esm/components/Input/Checkbox.js.map +1 -1
  66. package/lib-esm/components/Input/Dropdown.d.ts +8 -18
  67. package/lib-esm/components/Input/Dropdown.js +42 -17
  68. package/lib-esm/components/Input/Dropdown.js.map +1 -1
  69. package/lib-esm/components/Input/Input.d.ts +8 -3
  70. package/lib-esm/components/Input/Input.js +20 -19
  71. package/lib-esm/components/Input/Input.js.map +1 -1
  72. package/lib-esm/components/Input/Radio.d.ts +4 -8
  73. package/lib-esm/components/Input/Radio.js +16 -13
  74. package/lib-esm/components/Input/Radio.js.map +1 -1
  75. package/lib-esm/components/Input/RadioButton.d.ts +4 -8
  76. package/lib-esm/components/Input/RadioButton.js +15 -12
  77. package/lib-esm/components/Input/RadioButton.js.map +1 -1
  78. package/lib-esm/components/Input/Select.d.ts +6 -13
  79. package/lib-esm/components/Input/Select.js +21 -18
  80. package/lib-esm/components/Input/Select.js.map +1 -1
  81. package/lib-esm/components/Input/TextArea.d.ts +6 -13
  82. package/lib-esm/components/Input/TextArea.js +29 -24
  83. package/lib-esm/components/Input/TextArea.js.map +1 -1
  84. package/lib-esm/components/Input/Toggle.d.ts +4 -9
  85. package/lib-esm/components/Input/Toggle.js +12 -10
  86. package/lib-esm/components/Input/Toggle.js.map +1 -1
  87. package/lib-esm/components/Menu/Menu.d.ts +4 -14
  88. package/lib-esm/components/Menu/Menu.js +24 -16
  89. package/lib-esm/components/Menu/Menu.js.map +1 -1
  90. package/lib-esm/components/Menu/MenuContext.d.ts +4 -4
  91. package/lib-esm/components/Menu/MenuContext.js +1 -0
  92. package/lib-esm/components/Menu/MenuContext.js.map +1 -1
  93. package/lib-esm/components/Menu/MenuItem.d.ts +10 -4
  94. package/lib-esm/components/Menu/MenuItem.js +19 -5
  95. package/lib-esm/components/Menu/MenuItem.js.map +1 -1
  96. package/lib-esm/components/Modal/Modal.d.ts +17 -23
  97. package/lib-esm/components/Modal/Modal.js +37 -34
  98. package/lib-esm/components/Modal/Modal.js.map +1 -1
  99. package/lib-esm/components/Notification/Notification.d.ts +39 -34
  100. package/lib-esm/components/Notification/Notification.js +16 -39
  101. package/lib-esm/components/Notification/Notification.js.map +1 -1
  102. package/lib-esm/components/Notification/NotificationManager.d.ts +4 -4
  103. package/lib-esm/components/Notification/NotificationManager.js +18 -14
  104. package/lib-esm/components/Notification/NotificationManager.js.map +1 -1
  105. package/lib-esm/components/Notification/index.d.ts +1 -0
  106. package/lib-esm/components/Notification/style.d.ts +2 -3
  107. package/lib-esm/components/Notification/style.js +11 -11
  108. package/lib-esm/components/Notification/style.js.map +1 -1
  109. package/lib-esm/components/Popover/Popover.d.ts +21 -20
  110. package/lib-esm/components/Popover/Popover.js +42 -44
  111. package/lib-esm/components/Popover/Popover.js.map +1 -1
  112. package/lib-esm/components/Spinner/Spinner.d.ts +14 -15
  113. package/lib-esm/components/Spinner/Spinner.js +12 -13
  114. package/lib-esm/components/Spinner/Spinner.js.map +1 -1
  115. package/lib-esm/components/Stepper/Step.d.ts +15 -12
  116. package/lib-esm/components/Stepper/Step.js +10 -8
  117. package/lib-esm/components/Stepper/Step.js.map +1 -1
  118. package/lib-esm/components/Stepper/Stepper.d.ts +11 -17
  119. package/lib-esm/components/Stepper/Stepper.js +25 -23
  120. package/lib-esm/components/Stepper/Stepper.js.map +1 -1
  121. package/lib-esm/components/Tabs/Tab.d.ts +10 -16
  122. package/lib-esm/components/Tabs/Tab.js +0 -8
  123. package/lib-esm/components/Tabs/Tab.js.map +1 -1
  124. package/lib-esm/components/Tabs/Tabs.d.ts +11 -22
  125. package/lib-esm/components/Tabs/Tabs.js +39 -31
  126. package/lib-esm/components/Tabs/Tabs.js.map +1 -1
  127. package/lib-esm/components/Toast/Toast.d.ts +7 -7
  128. package/lib-esm/components/Toast/Toast.js +13 -12
  129. package/lib-esm/components/Toast/Toast.js.map +1 -1
  130. package/lib-esm/components/Toast/ToastStory.d.ts +21 -24
  131. package/lib-esm/components/Tooltip/Tooltip.d.ts +11 -14
  132. package/lib-esm/components/Tooltip/Tooltip.js +11 -21
  133. package/lib-esm/components/Tooltip/Tooltip.js.map +1 -1
  134. package/lib-esm/icons/CheckCircle.js +2 -2
  135. package/lib-esm/icons/CheckCircle.js.map +1 -1
  136. package/lib-esm/icons/ErrorOutline.js +2 -2
  137. package/lib-esm/icons/ErrorOutline.js.map +1 -1
  138. package/lib-esm/icons/Info.js +2 -2
  139. package/lib-esm/icons/Info.js.map +1 -1
  140. package/lib-esm/icons/ReportProblem.js +2 -2
  141. package/lib-esm/icons/ReportProblem.js.map +1 -1
  142. package/lib-esm/index.js +43 -0
  143. package/lib-esm/shared/LayerManager.d.ts +5 -4
  144. package/lib-esm/shared/LayerManager.js +123 -111
  145. package/lib-esm/shared/LayerManager.js.map +1 -1
  146. package/lib-esm/shared/styles.js +4 -4
  147. package/lib-esm/shared/styles.js.map +1 -1
  148. package/package.json +66 -31
  149. package/lib-esm/components/index.js +0 -43
  150. /package/lib-esm/{components/index.js.map → index.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useId, useRef, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport { Card } from '../Card';\n\nexport enum POPOVER_POSITION {\n TOP_LEFT = 'TOP_LEFT',\n TOP_RIGHT = 'TOP_RIGHT',\n BOTTOM_LEFT = 'BOTTOM_LEFT',\n BOTTOM_RIGHT = 'BOTTOM_RIGHT',\n}\n\ninterface translate {\n x: number;\n y: number;\n}\n\nconst positionMap = {\n [POPOVER_POSITION.TOP_LEFT]: `\n bottom: calc(100% - 10px);\n left: 0;\n `,\n [POPOVER_POSITION.TOP_RIGHT]: `\n bottom: calc(100% - 10px);\n right: 0;\n `,\n [POPOVER_POSITION.BOTTOM_RIGHT]: `\n top: calc(100% - 10px);\n right: 0;\n `,\n [POPOVER_POSITION.BOTTOM_LEFT]: `\n top: calc(100% - 10px);\n left: 0;\n `,\n};\n\nconst PopoverDiv = styled.div`\n position: relative;\n display: inline-flex;\n`;\n\nconst Popper = styled(Card)<{ position: POPOVER_POSITION; translateX: number; translateY: number }>`\n position: absolute;\n width: 100%;\n min-width: 200px;\n overflow: auto;\n animation: enter 0.3s linear;\n border-radius: 3px;\n z-index: 1;\n transform: translate(${(props) => props.translateX}px, ${(props) => props.translateY}px);\n ${(props) => positionMap[props.position]}\n\n &.closing {\n /* max-height: 0px;\n opacity: 0;\n overflow: hidden; */\n animation: exit 0.3s linear;\n }\n\n @keyframes enter {\n from {\n max-height: 0px;\n opacity: 1;\n overflow: hidden;\n }\n to {\n max-height: 300px;\n opacity: 1;\n overflow: hidden;\n }\n }\n\n @keyframes exit {\n to {\n max-height: 0px;\n opacity: 1;\n overflow: hidden;\n }\n from {\n max-height: 300px;\n opacity: 1;\n overflow: hidden;\n }\n }\n`;\n\nconst KEY_CODES = {\n ESC: 27,\n};\n\nexport default function Popover(\n props: React.PropsWithChildren<PropTypes.InferProps<typeof Popover.propTypes>>,\n) {\n const [open, setOpen] = useState(props.open);\n const [closing, setClosing] = useState(false);\n const [translate, setTranslate] = useState<translate>({ x: 0, y: 0 });\n const popperRef = useRef<HTMLDivElement>();\n const containerRef = useRef<HTMLDivElement>();\n const triggerRef = useRef<HTMLElement | null>(null);\n const closeTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n const focusTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n const popperId = useId();\n const triggerId = useId();\n\n const close = useCallback(() => {\n // Clear any existing timeouts first\n if (closeTimeoutRef.current) {\n clearTimeout(closeTimeoutRef.current);\n }\n if (focusTimeoutRef.current) {\n clearTimeout(focusTimeoutRef.current);\n }\n\n setClosing(true);\n closeTimeoutRef.current = setTimeout(() => {\n setOpen(false);\n setTranslate({ x: 0, y: 0 });\n\n if (props.onClose) {\n props.onClose();\n }\n setClosing(false);\n\n // Restore focus to the trigger element after animation completes\n focusTimeoutRef.current = setTimeout(() => {\n if (triggerRef.current && document.body.contains(triggerRef.current)) {\n triggerRef.current.focus();\n }\n focusTimeoutRef.current = null;\n }, 50);\n closeTimeoutRef.current = null;\n }, 280);\n }, [props]);\n\n const keyupEventHandler = useCallback(\n (e: KeyboardEvent) => {\n if (props.closeOnEsc && e.keyCode === KEY_CODES.ESC) {\n close();\n }\n },\n [close, props.closeOnEsc],\n );\n\n const clickOutsideHandler = useCallback(\n (e: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(e.target as Node)) {\n close();\n }\n },\n [close],\n );\n\n /**\n * Get called on popover mount.\n */\n useEffect(() => {\n document.addEventListener('keyup', keyupEventHandler);\n\n return () => {\n document.removeEventListener('keyup', keyupEventHandler);\n };\n }, [keyupEventHandler]);\n\n useEffect(() => {\n if (props.open) {\n setOpen(true);\n // Use requestAnimationFrame to add listener after current event loop\n const rafId = requestAnimationFrame(() => {\n document.addEventListener('click', clickOutsideHandler);\n });\n\n return () => {\n cancelAnimationFrame(rafId);\n document.removeEventListener('click', clickOutsideHandler);\n };\n } else {\n if (open) {\n close();\n }\n }\n }, [props.open, open, clickOutsideHandler, close]);\n\n useEffect(() => {\n if (open) {\n const { top, left, right } = popperRef.current.getBoundingClientRect();\n const height = popperRef.current.scrollHeight;\n const viewportWidth = document.documentElement.clientWidth;\n const viewportHeight = document.documentElement.clientHeight;\n const translation = { x: 0, y: 0 };\n\n if (props.position === POPOVER_POSITION.BOTTOM_LEFT) {\n // overflow can happen at bottom and right\n if (viewportHeight - top - height < 0) {\n translation.y = -1 * (Math.abs(viewportHeight - top - height) + 5);\n }\n if (viewportWidth - right < 0) {\n translation.x = -1 * (Math.abs(viewportWidth - right) + 5);\n }\n } else if (props.position == POPOVER_POSITION.BOTTOM_RIGHT) {\n // overflow can happen at bottom and left\n if (viewportHeight - top - height < 0) {\n translation.y = -1 * (Math.abs(viewportHeight - top - height) + 5);\n }\n if (left < 0) {\n translation.x = Math.abs(left) + 5;\n }\n } else if (props.position === POPOVER_POSITION.TOP_LEFT) {\n // overflow can happen at top and right\n if (top - height < 0) {\n translation.y = Math.abs(top - height) + 5;\n }\n if (viewportWidth - right < 0) {\n translation.x = -1 * (Math.abs(viewportWidth - right) + 5);\n }\n } else {\n // overflow can happen at top and left\n if (top - height < 0) {\n translation.y = Math.abs(top - height) + 5;\n }\n if (left < 0) {\n translation.x = Math.abs(left) + 5;\n }\n }\n // Note it can still overflow, but in that case fitting popper inside the\n // window is not possible.\n setTranslate(translation);\n popperRef.current.focus();\n }\n }, [open, props.position]);\n\n /**\n * Cleanup timeouts on unmount\n */\n useEffect(() => {\n return () => {\n if (closeTimeoutRef.current) {\n clearTimeout(closeTimeoutRef.current);\n }\n if (focusTimeoutRef.current) {\n clearTimeout(focusTimeoutRef.current);\n }\n };\n }, []);\n\n return (\n <PopoverDiv ref={containerRef}>\n {React.createElement(props.element, {\n ref: triggerRef,\n id: triggerId,\n 'aria-expanded': open,\n 'aria-haspopup': 'dialog',\n 'aria-controls': popperId,\n })}\n {open && (\n <Popper\n elevated\n tabIndex={0}\n role=\"dialog\"\n aria-labelledby={triggerId}\n id={popperId}\n position={props.position}\n translateX={translate.x}\n translateY={translate.y}\n className={closing && 'closing'}\n ref={popperRef}\n onClick={(e) => {\n e.stopPropagation();\n e.nativeEvent.stopImmediatePropagation();\n }}\n >\n {props.children}\n </Popper>\n )}\n </PopoverDiv>\n );\n}\n\nPopover.propTypes = {\n /** Opens the popover */\n open: PropTypes.bool.isRequired,\n /** Anchor element for the popover */\n element: PropTypes.func,\n /** Position of the popover around anchor element */\n position: PropTypes.oneOf([\n POPOVER_POSITION.TOP_LEFT,\n POPOVER_POSITION.TOP_RIGHT,\n POPOVER_POSITION.BOTTOM_LEFT,\n POPOVER_POSITION.BOTTOM_RIGHT,\n ]),\n /** If the popover should close on `esc` key press */\n closeOnEsc: PropTypes.bool,\n /** Popover close callback */\n onClose: PropTypes.func,\n};\n\nPopover.defaultProps = {\n closeOnEsc: true,\n position: POPOVER_POSITION.BOTTOM_LEFT,\n};\n"],"names":["POPOVER_POSITION","positionMap","PopoverDiv","styled","Popper","Card","props","translateX","translateY","position","KEY_CODES","ESC","Popover","open","setOpen","useState","closing","setClosing","translate","setTranslate","x","y","popperRef","useRef","containerRef","triggerRef","closeTimeoutRef","focusTimeoutRef","popperId","useId","triggerId","close","useCallback","current","clearTimeout","setTimeout","onClose","document","body","contains","focus","keyupEventHandler","e","closeOnEsc","keyCode","clickOutsideHandler","target","useEffect","addEventListener","removeEventListener","rafId","requestAnimationFrame","cancelAnimationFrame","top","left","right","getBoundingClientRect","height","scrollHeight","viewportWidth","documentElement","clientWidth","viewportHeight","clientHeight","translation","Math","abs","_jsxs","ref","React","createElement","element","id","_jsx","elevated","tabIndex","role","aria-labelledby","className","onClick","stopPropagation","nativeEvent","stopImmediatePropagation","children","propTypes","PropTypes","bool","isRequired","func","oneOf","defaultProps"],"mappings":";;;;;;AAKO,IAAA,gBAAKA,iBAAAA,SAAAA,gBAAAA,EAAAA;;;;;AAAAA,IAAAA,OAAAA,gBAAAA;AAKX,CAAA,CAAA,EAAA;AAOD,MAAMC,WAAAA,GAAc;AAChB,IAAA,CAAA,UAAA,GAA6B;;;IAG7B,CAAC;AACD,IAAA,CAAA,WAAA,GAA8B;;;IAG9B,CAAC;AACD,IAAA,CAAA,cAAA,GAAiC;;;IAGjC,CAAC;AACD,IAAA,CAAA,aAAA,GAAgC;;;IAGhC;AACJ,CAAA;AAEA,MAAMC,UAAAA,iBAAaC,MAAAA,CAAAA,KAAAA,EAAAA;;;;AAKnB,MAAMC,uBAASD,MAAAA,CAAOE,IAAAA,EAAAA;;;AAQK,CAAA,CAAA,CAAA,yIAAA,EAAA,CAACC,KAAAA,GAAUA,KAAAA,CAAMC,UAAU,EAAA,KAAA,EAAO,CAACD,KAAAA,GAAUA,KAAAA,CAAME,UAAU,EAAA,MAAA,EAClF,CAACF,KAAAA,GAAUL,WAAW,CAACK,KAAAA,CAAMG,QAAQ,CAA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iB,QAAA;gBACjB,eAAA,EAAiBe;AACrB,aAAA,CAAA;AACCf,YAAAA,IAAAA,kBACG4D,GAAA,CAACrE,MAAAA,EAAAA;gBACGsE,QAAQ,EAAA,IAAA;gBACRC,QAAAA,EAAU,CAAA;gBACVC,IAAAA,EAAK,QAAA;gBACLC,iBAAAA,EAAiB/C,SAAAA;gBACjB0C,EAAAA,EAAI5C,QAAAA;AACJnB,gBAAAA,QAAAA,EAAUH,MAAMG,QAAQ;AACxBF,gBAAAA,UAAAA,EAAYW,UAAUE,CAAC;AACvBZ,gBAAAA,UAAAA,EAAYU,UAAUG,CAAC;AACvByD,gBAAAA,SAAAA,EAAW9D,OAAAA,IAAW,SAAA;gBACtBoD,GAAAA,EAAK9C,SAAAA;AACLyD,gBAAAA,OAAAA,EAAS,CAACrC,CAAAA,GAAAA;AACNA,oBAAAA,CAAAA,CAAEsC,eAAe,EAAA;oBACjBtC,CAAAA,CAAEuC,WAAW,CAACC,wBAAwB,EAAA;AAC1C,gBAAA,CAAA;AAEC5E,gBAAAA,QAAAA,EAAAA,KAAAA,CAAM6E;;;;AAK3B;AAEAvE,OAAAA,CAAQwE,SAAS,GAAG;AAChB,6BACAvE,IAAAA,EAAMwE,SAAAA,CAAUC,IAAI,CAACC,UAAU;0CAE/BhB,OAAAA,EAASc,SAAAA,CAAUG,IAAI;AACvB,yDACA/E,QAAAA,EAAU4E,SAAAA,CAAUI,KAAK,CAAC;;;;;AAKzB,KAAA,CAAA;0DAED9C,UAAAA,EAAY0C,SAAAA,CAAUC,IAAI;kCAE1BlD,OAAAA,EAASiD,SAAAA,CAAUG;AACvB,CAAA;AAEA5E,OAAAA,CAAQ8E,YAAY,GAAG;IACnB/C,UAAAA,EAAY,IAAA;IACZlC,QAAQ,EAAA;AACZ,CAAA;;;;"}
1
+ {"version":3,"file":"Popover.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useId, useRef, useState } from 'react';\nimport styled from '@emotion/styled';\nimport { Card } from '../Card';\n\nexport enum POPOVER_POSITION {\n TOP_LEFT = 'TOP_LEFT',\n TOP_RIGHT = 'TOP_RIGHT',\n BOTTOM_LEFT = 'BOTTOM_LEFT',\n BOTTOM_RIGHT = 'BOTTOM_RIGHT',\n}\n\ninterface Translate {\n x: number;\n y: number;\n}\n\nconst positionMap = {\n [POPOVER_POSITION.TOP_LEFT]: `\n bottom: calc(100% - 10px);\n left: 0;\n `,\n [POPOVER_POSITION.TOP_RIGHT]: `\n bottom: calc(100% - 10px);\n right: 0;\n `,\n [POPOVER_POSITION.BOTTOM_RIGHT]: `\n top: calc(100% - 10px);\n right: 0;\n `,\n [POPOVER_POSITION.BOTTOM_LEFT]: `\n top: calc(100% - 10px);\n left: 0;\n `,\n};\n\nconst PopoverDiv = styled.div`\n position: relative;\n display: inline-flex;\n`;\n\nconst Popper = styled(Card)<{ position: POPOVER_POSITION; translateX: number; translateY: number }>`\n position: absolute;\n width: 100%;\n min-width: 200px;\n overflow: auto;\n animation: enter 0.3s linear;\n border-radius: 3px;\n z-index: 1;\n transform: translate(${(props) => props.translateX}px, ${(props) => props.translateY}px);\n ${(props) => positionMap[props.position]}\n\n &.closing {\n /* max-height: 0px;\n opacity: 0;\n overflow: hidden; */\n animation: exit 0.3s linear;\n }\n\n @keyframes enter {\n from {\n max-height: 0px;\n opacity: 1;\n overflow: hidden;\n }\n to {\n max-height: 300px;\n opacity: 1;\n overflow: hidden;\n }\n }\n\n @keyframes exit {\n to {\n max-height: 0px;\n opacity: 1;\n overflow: hidden;\n }\n from {\n max-height: 300px;\n opacity: 1;\n overflow: hidden;\n }\n }\n`;\n\nconst KEY_CODES = {\n ESC: 27,\n};\n\ntype PopoverProps = {\n /** Opens the popover */\n open: boolean;\n /** Anchor element for the popover */\n element: React.ElementType;\n /**\n * Position of the popover around anchor element\n * @default POPOVER_POSITION.BOTTOM_LEFT\n */\n position?: POPOVER_POSITION;\n /**\n * If the popover should close on `esc` key press\n * @default true\n */\n closeOnEsc?: boolean;\n /** Popover close callback */\n onClose?: () => void;\n};\n\n/**\n * Popover Component\n * @param props - Component props\n * @param ref - Ref forwarded to the underlying HTMLDivElement\n */\nfunction PopoverComponent(\n props: React.PropsWithChildren<PopoverProps>,\n ref: React.Ref<HTMLDivElement>,\n) {\n const {\n open: propsOpen,\n element,\n position = POPOVER_POSITION.BOTTOM_LEFT,\n closeOnEsc = true,\n onClose,\n children,\n ...rest\n } = props;\n\n const [open, setOpen] = useState<boolean>(propsOpen);\n const [closing, setClosing] = useState<boolean>(false);\n const [translate, setTranslate] = useState<Translate>({ x: 0, y: 0 });\n const popperRef = useRef<HTMLDivElement | null>(null);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLElement | null>(null);\n const closeTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const focusTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const popperId = useId();\n const triggerId = useId();\n\n const close = useCallback(() => {\n // Clear any existing timeouts first\n if (closeTimeoutRef.current) {\n clearTimeout(closeTimeoutRef.current);\n }\n if (focusTimeoutRef.current) {\n clearTimeout(focusTimeoutRef.current);\n }\n\n setClosing(true);\n closeTimeoutRef.current = setTimeout(() => {\n setOpen(false);\n setTranslate({ x: 0, y: 0 });\n\n if (onClose) {\n onClose();\n }\n setClosing(false);\n\n // Restore focus to the trigger element after animation completes\n focusTimeoutRef.current = setTimeout(() => {\n if (triggerRef.current && document.body.contains(triggerRef.current)) {\n triggerRef.current.focus();\n }\n focusTimeoutRef.current = null;\n }, 50);\n closeTimeoutRef.current = null;\n }, 280);\n }, [onClose]);\n\n const keyupEventHandler = useCallback(\n (e: KeyboardEvent) => {\n if (closeOnEsc && e.keyCode === KEY_CODES.ESC) {\n close();\n }\n },\n [close, closeOnEsc],\n );\n\n const clickOutsideHandler = useCallback(\n (e: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(e.target as Node)) {\n close();\n }\n },\n [close],\n );\n\n /**\n * Get called on popover mount.\n */\n useEffect(() => {\n document.addEventListener('keyup', keyupEventHandler);\n\n return () => {\n document.removeEventListener('keyup', keyupEventHandler);\n };\n }, [keyupEventHandler]);\n\n useEffect(() => {\n if (propsOpen) {\n setOpen(true);\n // Use requestAnimationFrame to add listener after current event loop\n const rafId = requestAnimationFrame(() => {\n document.addEventListener('click', clickOutsideHandler);\n });\n\n return () => {\n cancelAnimationFrame(rafId);\n document.removeEventListener('click', clickOutsideHandler);\n };\n } else {\n if (open) {\n close();\n }\n }\n }, [propsOpen, open, clickOutsideHandler, close]);\n\n useEffect(() => {\n if (open) {\n const {\n top = 0,\n left = 0,\n right = 0,\n } = popperRef.current?.getBoundingClientRect() ?? {};\n const height = popperRef.current?.scrollHeight ?? 0;\n const viewportWidth = document.documentElement.clientWidth;\n const viewportHeight = document.documentElement.clientHeight;\n const translation = { x: 0, y: 0 };\n\n if (position === POPOVER_POSITION.BOTTOM_LEFT) {\n // overflow can happen at bottom and right\n if (viewportHeight - top - height < 0) {\n translation.y = -1 * (Math.abs(viewportHeight - top - height) + 5);\n }\n if (viewportWidth - right < 0) {\n translation.x = -1 * (Math.abs(viewportWidth - right) + 5);\n }\n } else if (position == POPOVER_POSITION.BOTTOM_RIGHT) {\n // overflow can happen at bottom and left\n if (viewportHeight - top - height < 0) {\n translation.y = -1 * (Math.abs(viewportHeight - top - height) + 5);\n }\n if (left < 0) {\n translation.x = Math.abs(left) + 5;\n }\n } else if (position === POPOVER_POSITION.TOP_LEFT) {\n // overflow can happen at top and right\n if (top - height < 0) {\n translation.y = Math.abs(top - height) + 5;\n }\n if (viewportWidth - right < 0) {\n translation.x = -1 * (Math.abs(viewportWidth - right) + 5);\n }\n } else {\n // overflow can happen at top and left\n if (top - height < 0) {\n translation.y = Math.abs(top - height) + 5;\n }\n if (left < 0) {\n translation.x = Math.abs(left) + 5;\n }\n }\n // Note it can still overflow, but in that case fitting popper inside the\n // window is not possible.\n setTranslate(translation);\n popperRef.current?.focus();\n }\n }, [open, position]);\n\n /**\n * Cleanup timeouts on unmount\n */\n useEffect(() => {\n return () => {\n if (closeTimeoutRef.current) {\n clearTimeout(closeTimeoutRef.current);\n }\n if (focusTimeoutRef.current) {\n clearTimeout(focusTimeoutRef.current);\n }\n };\n }, []);\n\n const forwardRef = (node: HTMLDivElement | null) => {\n containerRef.current = node;\n\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }\n };\n\n return (\n <PopoverDiv ref={forwardRef} {...rest}>\n {React.createElement(element, {\n ref: triggerRef,\n id: triggerId,\n 'aria-expanded': open,\n 'aria-haspopup': 'dialog',\n 'aria-controls': popperId,\n })}\n {open && (\n <Popper\n elevated\n tabIndex={0}\n role=\"dialog\"\n aria-labelledby={triggerId}\n id={popperId}\n position={position}\n translateX={translate.x}\n translateY={translate.y}\n className={closing ? 'closing' : ''}\n ref={popperRef}\n onClick={(e) => {\n e.stopPropagation();\n e.nativeEvent.stopImmediatePropagation();\n }}\n >\n {children}\n </Popper>\n )}\n </PopoverDiv>\n );\n}\n\nconst Popover = React.forwardRef(PopoverComponent);\nexport default Popover;\n"],"names":["POPOVER_POSITION","positionMap","PopoverDiv","styled","Popper","Card","props","translateX","translateY","position","KEY_CODES","ESC","PopoverComponent","ref","open","propsOpen","element","closeOnEsc","onClose","children","rest","setOpen","useState","closing","setClosing","translate","setTranslate","x","y","popperRef","useRef","containerRef","triggerRef","closeTimeoutRef","focusTimeoutRef","popperId","useId","triggerId","close","useCallback","current","clearTimeout","setTimeout","document","body","contains","focus","keyupEventHandler","e","keyCode","clickOutsideHandler","target","useEffect","addEventListener","removeEventListener","rafId","requestAnimationFrame","cancelAnimationFrame","top","left","right","getBoundingClientRect","height","scrollHeight","viewportWidth","documentElement","clientWidth","viewportHeight","clientHeight","translation","Math","abs","forwardRef","node","_jsxs","React","createElement","id","_jsx","elevated","tabIndex","role","aria-labelledby","className","onClick","stopPropagation","nativeEvent","stopImmediatePropagation","Pop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GgE,GAAA,CAAC1E,MAAAA,EAAAA;gBACG2E,QAAQ,EAAA,IAAA;gBACRC,QAAAA,EAAU,CAAA;gBACVC,IAAAA,EAAK,QAAA;gBACLC,iBAAAA,EAAiB7C,SAAAA;gBACjBwC,EAAAA,EAAI1C,QAAAA;gBACJ1B,QAAAA,EAAUA,QAAAA;AACVF,gBAAAA,UAAAA,EAAYkB,UAAUE,CAAC;AACvBnB,gBAAAA,UAAAA,EAAYiB,UAAUG,CAAC;AACvBuD,gBAAAA,SAAAA,EAAW5D,UAAU,SAAA,GAAY,EAAA;gBACjCV,GAAAA,EAAKgB,SAAAA;AACLuD,gBAAAA,OAAAA,EAAS,CAACpC,CAAAA,GAAAA;AACNA,oBAAAA,CAAAA,CAAEqC,eAAe,EAAA;oBACjBrC,CAAAA,CAAEsC,WAAW,CAACC,wBAAwB,EAAA;AAC1C,gBAAA,CAAA;AAECpE,gBAAAA,QAAAA,EAAAA;;;;AAKrB;AAEA,MAAMqE,OAAAA,iBAAUb,KAAAA,CAAMH,UAAU,CAAC5D,gBAAAA;;;;"}
@@ -1,16 +1,15 @@
1
- import PropTypes from 'prop-types';
2
- declare function Spinner(props: SpinnerProp): import("@emotion/react/jsx-runtime").JSX.Element;
3
- declare namespace Spinner {
4
- var propTypes: {
5
- /** Spinner's size */
6
- size: PropTypes.Requireable<number>;
7
- /** Accessible label for screen readers */
8
- label: PropTypes.Requireable<string>;
9
- };
10
- var defaultProps: {
11
- size: number;
12
- label: string;
13
- };
14
- }
15
- type SpinnerProp = PropTypes.InferProps<typeof Spinner.propTypes>;
1
+ import React from 'react';
2
+ type SpinnerProp = {
3
+ /**
4
+ * Spinner's size
5
+ * @default 30
6
+ */
7
+ size?: number;
8
+ /**
9
+ * Accessible label for screen readers
10
+ * @default 'Loading'
11
+ */
12
+ label?: string;
13
+ };
14
+ declare const Spinner: React.ForwardRefExoticComponent<SpinnerProp & React.RefAttributes<HTMLDivElement>>;
16
15
  export default Spinner;
@@ -1,30 +1,29 @@
1
1
  import { jsx } from '@emotion/react/jsx-runtime';
2
- import PropTypes from 'prop-types';
2
+ import React from 'react';
3
3
  import styled from '@emotion/styled';
4
4
  import { getThemeValue, THEME_NAME } from '../../shared/constants.js';
5
5
 
6
6
  const SpinnerDiv = /*#__PURE__*/ styled("div", {
7
- target: "e12p7es30",
7
+ target: "e14pfj3w0",
8
8
  label: "SpinnerDiv"
9
9
  })("border:4px solid ", getThemeValue(THEME_NAME.PRIMARY), ";border-top:4px solid ", getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR), ";border-radius:50%;width:", (props)=>props.size, "px;height:", (props)=>props.size, "px;margin:0 auto;animation:spin 1s linear infinite;@keyframes spin{0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}");
10
- function Spinner(props) {
11
- const { label, ...rest } = props;
10
+ /**
11
+ * Spinner Component
12
+ * @param props - Component props
13
+ * @param ref - Ref forwarded to the underlying HTMLDivElement
14
+ */ function SpinnerComponent(props, ref) {
15
+ const { label = 'Loading', size = 30, ...rest } = props;
12
16
  return /*#__PURE__*/ jsx(SpinnerDiv, {
13
17
  ...rest,
18
+ ref: ref,
19
+ size: size,
14
20
  role: "status",
15
- "aria-label": label,
21
+ "aria-label": label || undefined,
16
22
  "aria-live": "polite",
17
23
  "aria-busy": "true"
18
24
  });
19
25
  }
20
- Spinner.propTypes = {
21
- /** Spinner's size */ size: PropTypes.number,
22
- /** Accessible label for screen readers */ label: PropTypes.string
23
- };
24
- Spinner.defaultProps = {
25
- size: 30,
26
- label: 'Loading'
27
- };
26
+ const Spinner = /*#__PURE__*/ React.forwardRef(SpinnerComponent);
28
27
 
29
28
  export { Spinner as default };
30
29
  //# sourceMappingURL=Spinner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Spinner.js","sources":["../../../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\nconst SpinnerDiv = styled.div<SpinnerProp>`\n border: 4px solid ${getThemeValue(THEME_NAME.PRIMARY)};\n border-top: 4px solid ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};\n border-radius: 50%;\n width: ${(props) => props.size}px;\n height: ${(props) => props.size}px;\n margin: 0 auto;\n animation: spin 1s linear infinite;\n\n @keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n`;\n\nfunction Spinner(props: SpinnerProp) {\n const { label, ...rest } = props;\n return (\n <SpinnerDiv\n {...rest}\n role=\"status\"\n aria-label={label}\n aria-live=\"polite\"\n aria-busy=\"true\"\n />\n );\n}\n\ntype SpinnerProp = PropTypes.InferProps<typeof Spinner.propTypes>;\n\nSpinner.propTypes = {\n /** Spinner's size */\n size: PropTypes.number,\n /** Accessible label for screen readers */\n label: PropTypes.string,\n};\n\nSpinner.defaultProps = {\n size: 30,\n label: 'Loading',\n};\n\nexport default Spinner;\n"],"names":["SpinnerDiv","styled","getThemeValue","THEME_NAME","PRIMARY","BORDER_LIGHT_COLOR","props","size","Spinner","label","rest","_jsx","role","aria-label","aria-live","aria-busy","propTypes","PropTypes","number","string","defaultProps"],"mappings":";;;;;AAIA,MAAMA,UAAAA,iBAAaC,MAAAA,CAAAA,KAAAA,EAAAA;;;AACKC,CAAAA,CAAAA,CAAAA,mBAAAA,EAAAA,aAAAA,CAAcC,UAAAA,CAAWC,OAAO,CAAA,EAAA,wBAAA,EAC5BF,aAAAA,CAAcC,WAAWE,kBAAkB,CAAA,EAAA,2BAAA,EAE1D,CAACC,KAAAA,GAAUA,MAAMC,IAAI,EAAA,YAAA,EACpB,CAACD,KAAAA,GAAUA,MAAMC,IAAI,EAAA,gIAAA,CAAA;AAcnC,SAASC,QAAQF,KAAkB,EAAA;AAC/B,IAAA,MAAM,EAAEG,KAAK,EAAE,GAAGC,MAAM,GAAGJ,KAAAA;AAC3B,IAAA,qBACIK,GAAA,CAACX,UAAAA,EAAAA;AACI,QAAA,GAAGU,IAAI;QACRE,IAAAA,EAAK,QAAA;QACLC,YAAAA,EAAYJ,KAAAA;QACZK,WAAAA,EAAU,QAAA;QACVC,WAAAA,EAAU;;AAGtB;AAIAP,OAAAA,CAAQQ,SAAS,GAAG;0BAEhBT,IAAAA,EAAMU,SAAAA,CAAUC,MAAM;+CAEtBT,KAAAA,EAAOQ,SAAAA,CAAUE;AACrB,CAAA;AAEAX,OAAAA,CAAQY,YAAY,GAAG;IACnBb,IAAAA,EAAM,EAAA;IACNE,KAAAA,EAAO;AACX,CAAA;;;;"}
1
+ {"version":3,"file":"Spinner.js","sources":["../../../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import React from 'react';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\nconst SpinnerDiv = styled.div<SpinnerProp>`\n border: 4px solid ${getThemeValue(THEME_NAME.PRIMARY)};\n border-top: 4px solid ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};\n border-radius: 50%;\n width: ${(props) => props.size}px;\n height: ${(props) => props.size}px;\n margin: 0 auto;\n animation: spin 1s linear infinite;\n\n @keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n`;\n\ntype SpinnerProp = {\n /**\n * Spinner's size\n * @default 30\n */\n size?: number;\n /**\n * Accessible label for screen readers\n * @default 'Loading'\n */\n label?: string;\n};\n\n/**\n * Spinner Component\n * @param props - Component props\n * @param ref - Ref forwarded to the underlying HTMLDivElement\n */\nfunction SpinnerComponent(props: SpinnerProp, ref: React.Ref<HTMLDivElement>) {\n const { label = 'Loading', size = 30, ...rest } = props;\n return (\n <SpinnerDiv\n {...rest}\n ref={ref}\n size={size}\n role=\"status\"\n aria-label={label || undefined}\n aria-live=\"polite\"\n aria-busy=\"true\"\n />\n );\n}\n\nconst Spinner = React.forwardRef<HTMLDivElement, SpinnerProp>(SpinnerComponent);\nexport default Spinner;\n"],"names":["SpinnerDiv","styled","getThemeValue","THEME_NAME","PRIMARY","BORDER_LIGHT_COLOR","props","size","SpinnerComponent","ref","label","rest","_jsx","role","aria-label","undefined","aria-live","aria-busy","Spinner","React","forwardRef"],"mappings":";;;;;AAIA,MAAMA,UAAAA,iBAAaC,MAAAA,CAAAA,KAAAA,EAAAA;;;AACKC,CAAAA,CAAAA,CAAAA,mBAAAA,EAAAA,aAAAA,CAAcC,UAAAA,CAAWC,OAAO,CAAA,EAAA,wBAAA,EAC5BF,aAAAA,CAAcC,WAAWE,kBAAkB,CAAA,EAAA,2BAAA,EAE1D,CAACC,KAAAA,GAAUA,MAAMC,IAAI,EAAA,YAAA,EACpB,CAACD,KAAAA,GAAUA,MAAMC,IAAI,EAAA,gIAAA,CAAA;AA2BnC;;;;AAIC,IACD,SAASC,gBAAAA,CAAiBF,KAAkB,EAAEG,GAA8B,EAAA;IACxE,MAAM,EAAEC,QAAQ,SAAS,EAAEH,OAAO,EAAE,EAAE,GAAGI,IAAAA,EAAM,GAAGL,KAAAA;AAClD,IAAA,qBACIM,GAAA,CAACZ,UAAAA,EAAAA;AACI,QAAA,GAAGW,IAAI;QACRF,GAAAA,EAAKA,GAAAA;QACLF,IAAAA,EAAMA,IAAAA;QACNM,IAAAA,EAAK,QAAA;AACLC,QAAAA,YAAAA,EAAYJ,KAAAA,IAASK,SAAAA;QACrBC,WAAAA,EAAU,QAAA;QACVC,WAAAA,EAAU;;AAGtB;AAEA,MAAMC,OAAAA,iBAAUC,KAAAA,CAAMC,UAAU,CAA8BZ,gBAAAA;;;;"}
@@ -1,17 +1,20 @@
1
1
  import React from 'react';
2
- interface StepProps {
3
- /** Name of the step to be displayed in the header */
2
+ declare const Step: React.ForwardRefExoticComponent<{
3
+ /**
4
+ * Name of the step to be displayed in the header
5
+ */
4
6
  name: string;
5
- /** Disables the step */
7
+ /**
8
+ * Disables the step
9
+ * @default false
10
+ */
6
11
  disabled?: boolean;
7
- /** Marks the step as completed */
12
+ /**
13
+ * Marks the step as completed
14
+ * @default false
15
+ */
8
16
  completed?: boolean;
9
- }
10
- declare function Step(props: React.PropsWithChildren<StepProps>): import("@emotion/react/jsx-runtime").JSX.Element;
11
- declare namespace Step {
12
- var defaultProps: {
13
- disabled: boolean;
14
- completed: boolean;
15
- };
16
- }
17
+ } & React.HTMLAttributes<HTMLDivElement> & {
18
+ children?: React.ReactNode | undefined;
19
+ } & React.RefAttributes<HTMLDivElement>>;
17
20
  export default Step;
@@ -1,22 +1,24 @@
1
1
  import { jsx } from '@emotion/react/jsx-runtime';
2
- import 'react';
2
+ import React from 'react';
3
3
  import styled from '@emotion/styled';
4
4
 
5
5
  const Container = /*#__PURE__*/ styled("div", {
6
- target: "eac2nqz0",
6
+ target: "e1v23xop0",
7
7
  label: "Container"
8
8
  })("flex:1;display:flex;flex-direction:column;");
9
- function Step(props) {
9
+ /**
10
+ * Step Component
11
+ * @param props - Component props
12
+ * @param ref - Ref forwarded to the underlying HTMLDivElement
13
+ */ function StepComponent(props, ref) {
10
14
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
11
15
  const { name, disabled, completed, ...rest } = props;
12
16
  return /*#__PURE__*/ jsx(Container, {
13
- ...rest
17
+ ...rest,
18
+ ref: ref
14
19
  });
15
20
  }
16
- Step.defaultProps = {
17
- disabled: false,
18
- completed: false
19
- };
21
+ const Step = /*#__PURE__*/ React.forwardRef(StepComponent);
20
22
 
21
23
  export { Step as default };
22
24
  //# sourceMappingURL=Step.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Step.js","sources":["../../../src/components/Stepper/Step.tsx"],"sourcesContent":["import React from 'react';\nimport styled from '@emotion/styled';\n\ninterface StepProps {\n /** Name of the step to be displayed in the header */\n name: string;\n /** Disables the step */\n disabled?: boolean;\n /** Marks the step as completed */\n completed?: boolean;\n}\n\nconst Container = styled.div`\n flex: 1;\n display: flex;\n flex-direction: column;\n`;\n\nexport default function Step(props: React.PropsWithChildren<StepProps>) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { name, disabled, completed, ...rest } = props;\n return <Container {...rest} />;\n}\n\nStep.defaultProps = {\n disabled: false,\n completed: false,\n};\n"],"names":["Container","styled","Step","props","name","disabled","completed","rest","_jsx","defaultProps"],"mappings":";;;;AAYA,MAAMA,SAAAA,iBAAYC,MAAAA,CAAAA,KAAAA,EAAAA;;;;AAMH,SAASC,KAAKC,KAAyC,EAAA;;IAElE,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,SAAS,EAAE,GAAGC,IAAAA,EAAM,GAAGJ,KAAAA;AAC/C,IAAA,qBAAOK,GAAA,CAACR,SAAAA,EAAAA;AAAW,QAAA,GAAGO;;AAC1B;AAEAL,IAAAA,CAAKO,YAAY,GAAG;IAChBJ,QAAAA,EAAU,KAAA;IACVC,SAAAA,EAAW;AACf,CAAA;;;;"}
1
+ {"version":3,"file":"Step.js","sources":["../../../src/components/Stepper/Step.tsx"],"sourcesContent":["import React from 'react';\nimport styled from '@emotion/styled';\n\nconst Container = styled.div`\n flex: 1;\n display: flex;\n flex-direction: column;\n`;\n\ntype StepProps = {\n /**\n * Name of the step to be displayed in the header\n */\n name: string;\n /**\n * Disables the step\n * @default false\n */\n disabled?: boolean;\n /**\n * Marks the step as completed\n * @default false\n */\n completed?: boolean;\n} & React.HTMLAttributes<HTMLDivElement>;\n\n/**\n * Step Component\n * @param props - Component props\n * @param ref - Ref forwarded to the underlying HTMLDivElement\n */\nfunction StepComponent(props: React.PropsWithChildren<StepProps>, ref: React.Ref<HTMLDivElement>) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { name, disabled, completed, ...rest } = props;\n return <Container {...rest} ref={ref} />;\n}\n\nconst Step = React.forwardRef(StepComponent);\nexport default Step;\n"],"names":["Container","styled","StepComponent","props","ref","name","disabled","completed","rest","_jsx","Step","React","forwardRef"],"mappings":";;;;AAGA,MAAMA,SAAAA,iBAAYC,MAAAA,CAAAA,KAAAA,EAAAA;;;;AAuBlB;;;;AAIC,IACD,SAASC,aAAAA,CAAcC,KAAyC,EAAEC,GAA8B,EAAA;;IAE5F,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,SAAS,EAAE,GAAGC,IAAAA,EAAM,GAAGL,KAAAA;AAC/C,IAAA,qBAAOM,GAAA,CAACT,SAAAA,EAAAA;AAAW,QAAA,GAAGQ,IAAI;QAAEJ,GAAAA,EAAKA;;AACrC;AAEA,MAAMM,IAAAA,iBAAOC,KAAAA,CAAMC,UAAU,CAACV,aAAAA;;;;"}
@@ -1,19 +1,13 @@
1
- import { PropsWithChildren } from 'react';
2
- import PropTypes from 'prop-types';
3
- type StepperProps = PropsWithChildren<{
4
- active: number;
1
+ import React from 'react';
2
+ declare const Stepper: React.ForwardRefExoticComponent<{
3
+ /**
4
+ * Index of currently active step
5
+ * @default 0
6
+ */
7
+ active?: number;
8
+ /** Callback function for click event on a step */
5
9
  onStepClick?: (index: number) => void;
6
- }>;
7
- declare function Stepper(props: StepperProps): import("@emotion/react/jsx-runtime").JSX.Element;
8
- declare namespace Stepper {
9
- var propTypes: {
10
- /** Index of currently active step */
11
- active: PropTypes.Requireable<number>;
12
- /** Callback function for click event on a step */
13
- onStepClick: PropTypes.Requireable<(...args: any[]) => any>;
14
- };
15
- var defaultProps: {
16
- active: number;
17
- };
18
- }
10
+ } & {
11
+ children?: React.ReactNode | undefined;
12
+ } & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
19
13
  export default Stepper;
@@ -1,30 +1,33 @@
1
1
  import { jsxs, jsx } from '@emotion/react/jsx-runtime';
2
- import { useState, Children, isValidElement } from 'react';
3
- import PropTypes from 'prop-types';
2
+ import React, { useState, Children, isValidElement } from 'react';
4
3
  import styled from '@emotion/styled';
5
4
  import { getThemeValue, THEME_NAME } from '../../shared/constants.js';
6
5
  import { Ellipsis } from '../../shared/styles.js';
7
6
  import Badge, { BADGE_TYPE } from '../Badge/Badge.js';
8
7
 
9
- const Container = /*#__PURE__*/ styled("div", {
10
- target: "e1n4tau0",
8
+ const Container$1 = /*#__PURE__*/ styled("div", {
9
+ target: "e14em2c80",
11
10
  label: "Container"
12
11
  })("flex:1;display:flex;flex-direction:column;min-height:400px;");
13
12
  const Header = /*#__PURE__*/ styled("div", {
14
- target: "e1n4tau1",
13
+ target: "e14em2c81",
15
14
  label: "Header"
16
15
  })("display:flex;flex-direction:row;justify-content:space-between;border-bottom:1px solid ", getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR), ";@media (min-width:601px){&::before{position:absolute;top:25px;left:0;right:0;height:2px;background-color:", getThemeValue(THEME_NAME.LIGHT_GREY), ";content:' ';z-index:0;}}& > *{z-index:1;}");
17
16
  const HeaderButton = /*#__PURE__*/ styled("button", {
18
- target: "e1n4tau2",
17
+ target: "e14em2c82",
19
18
  label: "HeaderButton"
20
19
  })("border:none;padding:16px 24px 16px 16px;font-size:16px;cursor:pointer;background-color:", (props)=>props.active ? getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR) : getThemeValue(THEME_NAME.BACKGROUND), ";font-weight:", (props)=>props.active ? 'bold' : 'normal', ";overflow:hidden;display:flex;align-items:center;color:", getThemeValue(THEME_NAME.TEXT_COLOR_DARK), ";&:disabled{cursor:not-allowed;background-color:", getThemeValue(THEME_NAME.DISABLED_BACKGROUND), ";}&:enabled:hover,&:focus{background-color:", getThemeValue(THEME_NAME.PRIMARY_LIGHTER), ";}@media (max-width:600px){&{display:none;}}");
21
20
  const MobileHeader = /*#__PURE__*/ styled("div", {
22
- target: "e1n4tau3",
21
+ target: "e14em2c83",
23
22
  label: "MobileHeader"
24
23
  })("padding:16px;font-size:16px;line-height:18px;align-items:center;font-weight:bold;flex:1;display:flex;flex-direction:row;justify-content:space-between;@media (min-width:601px){&{display:none;}}");
25
- function Stepper(props) {
26
- const [active, setActive] = useState(props.active);
27
- const { children, onStepClick } = props;
24
+ /**
25
+ * Stepper Component
26
+ * @param props - Component props
27
+ * @param ref - Ref forwarded to the underlying HTMLDivElement
28
+ */ function StepperComponent(props, ref) {
29
+ const { active: propsActive = 0, onStepClick, children, ...rest } = props;
30
+ const [active, setActive] = useState(propsActive);
28
31
  const childrenArray = Children.toArray(children);
29
32
  const stepRefs = [];
30
33
  const stepClickHandler = (index)=>()=>{
@@ -55,7 +58,9 @@ function Stepper(props) {
55
58
  stepRefs[prev]?.focus();
56
59
  }
57
60
  };
58
- return /*#__PURE__*/ jsxs(Container, {
61
+ return /*#__PURE__*/ jsxs(Container$1, {
62
+ ref: ref,
63
+ ...rest,
59
64
  children: [
60
65
  /*#__PURE__*/ jsxs(Header, {
61
66
  role: "tablist",
@@ -63,24 +68,27 @@ function Stepper(props) {
63
68
  children: [
64
69
  Children.map(children, (child, index)=>{
65
70
  if (!/*#__PURE__*/ isValidElement(child)) return null;
71
+ const reactElement = child;
66
72
  return /*#__PURE__*/ jsxs(HeaderButton, {
67
- ref: (el)=>stepRefs[index] = el,
73
+ ref: (el)=>{
74
+ stepRefs[index] = el;
75
+ },
68
76
  active: index === active,
69
77
  type: "button",
70
78
  role: "tab",
71
79
  "aria-selected": index === active,
72
- "aria-disabled": !!child.props.disabled,
80
+ "aria-disabled": !!reactElement.props.disabled,
73
81
  tabIndex: index === active ? 0 : -1,
74
- disabled: child.props.disabled,
82
+ disabled: reactElement.props.disabled,
75
83
  onClick: stepClickHandler(index),
76
84
  onKeyDown: onStepKeyDown(index),
77
85
  children: [
78
86
  /*#__PURE__*/ jsx(Badge, {
79
87
  inline: true,
80
- type: getBadgeType(index, child.props.completed, child.props.disabled)
88
+ type: getBadgeType(index, reactElement.props.completed || false, reactElement.props.disabled || false)
81
89
  }),
82
90
  /*#__PURE__*/ jsx(Ellipsis, {
83
- children: child.props.name
91
+ children: reactElement.props.name
84
92
  })
85
93
  ]
86
94
  });
@@ -107,13 +115,7 @@ function Stepper(props) {
107
115
  ]
108
116
  });
109
117
  }
110
- Stepper.propTypes = {
111
- /** Index of currently active step */ active: PropTypes.number,
112
- /** Callback function for click event on a step */ onStepClick: PropTypes.func
113
- };
114
- Stepper.defaultProps = {
115
- active: 0
116
- };
118
+ const Stepper = /*#__PURE__*/ React.forwardRef(StepperComponent);
117
119
 
118
120
  export { Stepper as default };
119
121
  //# sourceMappingURL=Stepper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Stepper.js","sources":["../../../src/components/Stepper/Stepper.tsx"],"sourcesContent":["import { Children, PropsWithChildren, useState, isValidElement } from 'react';\nimport PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\nimport { Ellipsis } from '../../shared/styles';\nimport { Badge, BADGE_TYPE } from '../Badge';\n\ntype StepperProps = PropsWithChildren<{\n active: number;\n onStepClick?: (index: number) => void;\n}>;\n\nconst Container = styled.div`\n flex: 1;\n display: flex;\n flex-direction: column;\n min-height: 400px;\n`;\n\nconst Header = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n border-bottom: 1px solid ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};\n\n @media (min-width: 601px) {\n &::before {\n position: absolute;\n top: 25px;\n left: 0;\n right: 0;\n height: 2px;\n background-color: ${getThemeValue(THEME_NAME.LIGHT_GREY)};\n content: ' ';\n z-index: 0;\n }\n }\n\n & > * {\n z-index: 1;\n }\n`;\n\nconst HeaderButton = styled.button<{ active: boolean }>`\n border: none;\n padding: 16px 24px 16px 16px;\n font-size: 16px;\n cursor: pointer;\n background-color: ${(props) =>\n props.active\n ? getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)\n : getThemeValue(THEME_NAME.BACKGROUND)};\n font-weight: ${(props) => (props.active ? 'bold' : 'normal')};\n overflow: hidden;\n display: flex;\n align-items: center;\n color: ${getThemeValue(THEME_NAME.TEXT_COLOR_DARK)};\n\n &:disabled {\n cursor: not-allowed;\n background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};\n }\n\n &:enabled:hover,\n &:focus {\n background-color: ${getThemeValue(THEME_NAME.PRIMARY_LIGHTER)};\n }\n\n @media (max-width: 600px) {\n & {\n display: none;\n }\n }\n`;\n\nconst MobileHeader = styled.div`\n padding: 16px;\n font-size: 16px;\n line-height: 18px;\n align-items: center;\n font-weight: bold;\n flex: 1;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n\n @media (min-width: 601px) {\n & {\n display: none;\n }\n }\n`;\n\nexport default function Stepper(props: StepperProps) {\n const [active, setActive] = useState(props.active);\n const { children, onStepClick } = props;\n const childrenArray = Children.toArray(children);\n const stepRefs = [] as Array<HTMLButtonElement | null>;\n\n const stepClickHandler = (index: number) => () => {\n setActive(index);\n onStepClick?.(index);\n // Move focus to the active step\n stepRefs[index]?.focus();\n };\n\n const getBadgeType = (index: number, completed: boolean, disabled: boolean) => {\n if (disabled) {\n return BADGE_TYPE.DISABLED;\n } else if (index === active) {\n return BADGE_TYPE.PRIMARY;\n } else if (completed) {\n return BADGE_TYPE.SUCCESS;\n }\n return BADGE_TYPE.DISABLED;\n };\n\n // Keyboard navigation for step buttons\n const onStepKeyDown = (index: number) => (e: React.KeyboardEvent<HTMLButtonElement>) => {\n if (e.key === 'ArrowRight' || e.key === 'ArrowDown') {\n e.preventDefault();\n const next = (index + 1) % childrenArray.length;\n stepRefs[next]?.focus();\n } else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') {\n e.preventDefault();\n const prev = (index - 1 + childrenArray.length) % childrenArray.length;\n stepRefs[prev]?.focus();\n }\n };\n\n return (\n <Container>\n <Header role=\"tablist\" aria-label=\"Stepper Steps\">\n {Children.map(children, (child, index) => {\n if (!isValidElement(child)) return null;\n return (\n <HeaderButton\n ref={(el) => (stepRefs[index] = el)}\n active={index === active}\n type=\"button\"\n role=\"tab\"\n aria-selected={index === active}\n aria-disabled={!!child.props.disabled}\n tabIndex={index === active ? 0 : -1}\n disabled={child.props.disabled}\n onClick={stepClickHandler(index)}\n onKeyDown={onStepKeyDown(index)}\n >\n <Badge\n inline\n type={getBadgeType(\n index,\n child.props.completed,\n child.props.disabled,\n )}\n />\n <Ellipsis>{child.props.name}</Ellipsis>\n </HeaderButton>\n );\n })}\n <MobileHeader>\n <span>\n {isValidElement(childrenArray[active])\n ? childrenArray[active].props.name\n : ''}\n </span>\n <Badge inline type={BADGE_TYPE.PRIMARY}>\n {active + 1} of {Children.count(children)}\n </Badge>\n </MobileHeader>\n </Header>\n {childrenArray[active]}\n </Container>\n );\n}\n\nStepper.propTypes = {\n /** Index of currently active step */\n active: PropTypes.number,\n /** Callback function for click event on a step */\n onStepClick: PropTypes.func,\n};\n\nStepper.defaultProps = {\n active: 0,\n};\n"],"names":["Container","styled","Header","getThemeValue","THEME_NAME","BORDER_LIGHT_COLOR","LIGHT_GREY","HeaderButton","props","active","BACKGROUND","TEXT_COLOR_DARK","DISABLED_BACKGROUND","PRIMARY_LIGHTER","MobileHeader","Stepper","setActive","useState","children","onStepClick","childrenArray","Children","toArray","stepRefs","stepClickHandler","index","focus","getBadgeType","completed","disabled","BADGE_TYPE","DISABLED","PRIMARY","SUCCESS","onStepKeyDown","e","key","preventDefault","next","length","prev","_jsxs","role","aria-label","map","child","isValidElement","ref","el","type","aria-selected","aria-disabled","tabIndex","onClick","onKeyDown","_jsx","Badge","inline","Ellipsis","name","span","count","propTypes","PropTypes","number","func","defaultProps"],"mappings":";;;;;;;;AAYA,MAAMA,SAAAA,iBAAYC,MAAAA,CAAAA,KAAAA,EAAAA;;;;AAOlB,MAAMC,MAAAA,iBAASD,MAAAA,CAAAA,KAAAA,EAAAA;;;AAIgBE,CAAAA,CAAAA,CAAAA,wFAAAA,EAAAA,aAAAA,CAAcC,UAAAA,CAAWC,kBAAkB,CAAA,EAAA,4GAAA,EAS1CF,aAAAA,CAAcC,WAAWE,UAAU,CAAA,EAAA,4CAAA,CAAA;AAWnE,MAAMC,YAAAA,iBAAeN,MAAAA,CAAAA,QAAAA,EAAAA;;;AAKG,CAAA,CAAA,CAAA,yFAAA,EAAA,CAACO,KAAAA,GACjBA,KAAAA,CAAMC,MAAM,GACNN,aAAAA,CAAcC,UAAAA,CAAWC,kBAAkB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AUC,MAAM;uDAExB7C,WAAAA,EAAa4C,SAAAA,CAAUE;AAC3B,CAAA;AAEAlD,OAAAA,CAAQmD,YAAY,GAAG;IACnBzD,MAAAA,EAAQ;AACZ,CAAA;;;;"}
1
+ {"version":3,"file":"Stepper.js","sources":["../../../src/components/Stepper/Stepper.tsx"],"sourcesContent":["import React, { Children, PropsWithChildren, useState, isValidElement } from 'react';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\nimport { Ellipsis } from '../../shared/styles';\nimport { Badge, BADGE_TYPE } from '../Badge';\n\nconst Container = styled.div`\n flex: 1;\n display: flex;\n flex-direction: column;\n min-height: 400px;\n`;\n\nconst Header = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n border-bottom: 1px solid ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};\n\n @media (min-width: 601px) {\n &::before {\n position: absolute;\n top: 25px;\n left: 0;\n right: 0;\n height: 2px;\n background-color: ${getThemeValue(THEME_NAME.LIGHT_GREY)};\n content: ' ';\n z-index: 0;\n }\n }\n\n & > * {\n z-index: 1;\n }\n`;\n\nconst HeaderButton = styled.button<{ active: boolean }>`\n border: none;\n padding: 16px 24px 16px 16px;\n font-size: 16px;\n cursor: pointer;\n background-color: ${(props) =>\n props.active\n ? getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)\n : getThemeValue(THEME_NAME.BACKGROUND)};\n font-weight: ${(props) => (props.active ? 'bold' : 'normal')};\n overflow: hidden;\n display: flex;\n align-items: center;\n color: ${getThemeValue(THEME_NAME.TEXT_COLOR_DARK)};\n\n &:disabled {\n cursor: not-allowed;\n background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};\n }\n\n &:enabled:hover,\n &:focus {\n background-color: ${getThemeValue(THEME_NAME.PRIMARY_LIGHTER)};\n }\n\n @media (max-width: 600px) {\n & {\n display: none;\n }\n }\n`;\n\nconst MobileHeader = styled.div`\n padding: 16px;\n font-size: 16px;\n line-height: 18px;\n align-items: center;\n font-weight: bold;\n flex: 1;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n\n @media (min-width: 601px) {\n & {\n display: none;\n }\n }\n`;\n\ntype StepperProps = PropsWithChildren<{\n /**\n * Index of currently active step\n * @default 0\n */\n active?: number;\n /** Callback function for click event on a step */\n onStepClick?: (index: number) => void;\n}> &\n React.HTMLAttributes<HTMLDivElement>;\n\n/**\n * Stepper Component\n * @param props - Component props\n * @param ref - Ref forwarded to the underlying HTMLDivElement\n */\nfunction StepperComponent(props: StepperProps, ref: React.Ref<HTMLDivElement>) {\n const { active: propsActive = 0, onStepClick, children, ...rest } = props;\n\n const [active, setActive] = useState(propsActive);\n const childrenArray = Children.toArray(children);\n const stepRefs = [] as Array<HTMLButtonElement | null>;\n\n const stepClickHandler = (index: number) => () => {\n setActive(index);\n onStepClick?.(index);\n // Move focus to the active step\n stepRefs[index]?.focus();\n };\n\n const getBadgeType = (index: number, completed: boolean, disabled: boolean) => {\n if (disabled) {\n return BADGE_TYPE.DISABLED;\n } else if (index === active) {\n return BADGE_TYPE.PRIMARY;\n } else if (completed) {\n return BADGE_TYPE.SUCCESS;\n }\n return BADGE_TYPE.DISABLED;\n };\n\n // Keyboard navigation for step buttons\n const onStepKeyDown = (index: number) => (e: React.KeyboardEvent<HTMLButtonElement>) => {\n if (e.key === 'ArrowRight' || e.key === 'ArrowDown') {\n e.preventDefault();\n const next = (index + 1) % childrenArray.length;\n stepRefs[next]?.focus();\n } else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') {\n e.preventDefault();\n const prev = (index - 1 + childrenArray.length) % childrenArray.length;\n stepRefs[prev]?.focus();\n }\n };\n\n return (\n <Container ref={ref} {...rest}>\n <Header role=\"tablist\" aria-label=\"Stepper Steps\">\n {Children.map(children, (child, index) => {\n if (!isValidElement(child)) return null;\n const reactElement = child as React.ReactElement<{\n disabled?: boolean;\n completed?: boolean;\n name?: string;\n }>;\n return (\n <HeaderButton\n ref={(el) => {\n stepRefs[index] = el;\n }}\n active={index === active}\n type=\"button\"\n role=\"tab\"\n aria-selected={index === active}\n aria-disabled={!!reactElement.props.disabled}\n tabIndex={index === active ? 0 : -1}\n disabled={reactElement.props.disabled}\n onClick={stepClickHandler(index)}\n onKeyDown={onStepKeyDown(index)}\n >\n <Badge\n inline\n type={getBadgeType(\n index,\n reactElement.props.completed || false,\n reactElement.props.disabled || false,\n )}\n />\n <Ellipsis>{reactElement.props.name}</Ellipsis>\n </HeaderButton>\n );\n })}\n <MobileHeader>\n <span>\n {isValidElement(childrenArray[active])\n ? (childrenArray[active] as React.ReactElement<{ name?: string }>).props\n .name\n : ''}\n </span>\n <Badge inline type={BADGE_TYPE.PRIMARY}>\n {active + 1} of {Children.count(children)}\n </Badge>\n </MobileHeader>\n </Header>\n {childrenArray[active]}\n </Container>\n );\n}\n\nconst Stepper = React.forwardRef(StepperComponent);\nexport default Stepper;\n"],"names":["Container","styled","Header","getThemeValue","THEME_NAME","BORDER_LIGHT_COLOR","LIGHT_GREY","HeaderButton","props","active","BACKGROUND","TEXT_COLOR_DARK","DISABLED_BACKGROUND","PRIMARY_LIGHTER","MobileHeader","StepperComponent","ref","propsActive","onStepClick","children","rest","setActive","useState","childrenArray","Children","toArray","stepRefs","stepClickHandler","index","focus","getBadgeType","completed","disabled","BADGE_TYPE","DISABLED","PRIMARY","SUCCESS","onStepKeyDown","e","key","preventDefault","next","length","prev","_jsxs","role","aria-label","map","child","isValidElement","reactElement","el","type","aria-selected","aria-disabled","tabIndex","onClick","onKeyDown","_jsx","Badge","inline","Ellipsis","name","span","count","Stepper","React","forwardRef"],"mappings":";;;;;;;AAMA,MAAMA,WAAAA,iBAAYC,MAAAA,CAAAA,KAAAA,EAAAA;;;;AAOlB,MAAMC,MAAAA,iBAASD,MAAAA,CAAAA,KAAAA,EAAAA;;;AAIgBE,CAAAA,CAAAA,CAAAA,wFAAAA,EAAAA,aAAAA,CAAcC,UAAAA,CAAWC,kBAAkB,CAAA,EAAA,4G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,GAAA,CAACK,MAAAA,EAAAA;AACId,gCAAAA,QAAAA,gBAAAA,cAAAA,CAAe1B,aAAa,CAACd,MAAAA,CAAO,CAAA,GAC9Bc,aAAa,CAACd,MAAAA,CAAO,CAA2CD,KAAK,CACjEsD,IAAI,GACT;;0CAEVlB,IAAA,CAACe,KAAAA,EAAAA;gCAAMC,MAAM,EAAA,IAAA;AAACR,gCAAAA,IAAAA,EAAMnB,WAAWE,OAAO;;oCACjC1B,MAAAA,GAAS,CAAA;AAAE,oCAAA,MAAA;AAAKe,oCAAAA,QAAAA,CAASwC,KAAK,CAAC7C,QAAAA;;;;;;;AAI3CI,YAAAA,aAAa,CAACd,MAAAA;;;AAG3B;AAEA,MAAMwD,OAAAA,iBAAUC,KAAAA,CAAMC,UAAU,CAACpD,gBAAAA;;;;"}
@@ -1,18 +1,12 @@
1
1
  import { PropsWithChildren } from 'react';
2
- import PropTypes from 'prop-types';
3
- declare const Tab: {
4
- (props: PropsWithChildren<{
5
- name: string;
6
- disabled: boolean;
7
- }>): import("@emotion/react/jsx-runtime").JSX.Element;
8
- propTypes: {
9
- /** Name of the tab. This shown in the tab's button */
10
- name: PropTypes.Validator<string>;
11
- /** If the tab is disabled */
12
- disabled: PropTypes.Requireable<boolean>;
13
- };
14
- defaultProps: {
15
- disabled: boolean;
16
- };
17
- };
2
+ type TabProps = PropsWithChildren<{
3
+ /** Name of the tab. This shown in the tab's button */
4
+ name: string;
5
+ /**
6
+ * If the tab is disabled
7
+ * @default false
8
+ */
9
+ disabled?: boolean;
10
+ }>;
11
+ declare const Tab: (props: TabProps) => import("@emotion/react/jsx-runtime").JSX.Element;
18
12
  export default Tab;
@@ -1,5 +1,4 @@
1
1
  import { jsx, Fragment } from '@emotion/react/jsx-runtime';
2
- import PropTypes from 'prop-types';
3
2
 
4
3
  const Tab = (props)=>{
5
4
  const { children } = props;
@@ -7,13 +6,6 @@ const Tab = (props)=>{
7
6
  children: children
8
7
  });
9
8
  };
10
- Tab.propTypes = {
11
- /** Name of the tab. This shown in the tab's button */ name: PropTypes.string.isRequired,
12
- /** If the tab is disabled */ disabled: PropTypes.bool
13
- };
14
- Tab.defaultProps = {
15
- disabled: false
16
- };
17
9
 
18
10
  export { Tab as default };
19
11
  //# sourceMappingURL=Tab.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tab.js","sources":["../../../src/components/Tabs/Tab.tsx"],"sourcesContent":["import { PropsWithChildren } from 'react';\nimport PropTypes from 'prop-types';\n\nconst Tab = (props: PropsWithChildren<{ name: string; disabled: boolean }>) => {\n const { children } = props;\n return <>{children}</>;\n};\n\nTab.propTypes = {\n /** Name of the tab. This shown in the tab's button */\n name: PropTypes.string.isRequired,\n /** If the tab is disabled */\n disabled: PropTypes.bool,\n};\n\nTab.defaultProps = {\n disabled: false,\n};\n\nexport default Tab;\n"],"names":["Tab","props","children","_jsx","_Fragment","propTypes","name","PropTypes","string","isRequired","disabled","bool","defaultProps"],"mappings":";;;AAGA,MAAMA,MAAM,CAACC,KAAAA,GAAAA;IACT,MAAM,EAAEC,QAAQ,EAAE,GAAGD,KAAAA;IACrB,qBAAOE,GAAA,CAAAC,QAAA,EAAA;AAAGF,QAAAA,QAAAA,EAAAA;;AACd;AAEAF,GAAAA,CAAIK,SAAS,GAAG;AACZ,2DACAC,IAAAA,EAAMC,SAAAA,CAAUC,MAAM,CAACC,UAAU;kCAEjCC,QAAAA,EAAUH,SAAAA,CAAUI;AACxB,CAAA;AAEAX,GAAAA,CAAIY,YAAY,GAAG;IACfF,QAAAA,EAAU;AACd,CAAA;;;;"}
1
+ {"version":3,"file":"Tab.js","sources":["../../../src/components/Tabs/Tab.tsx"],"sourcesContent":["import { PropsWithChildren } from 'react';\n\ntype TabProps = PropsWithChildren<{\n /** Name of the tab. This shown in the tab's button */\n name: string;\n /**\n * If the tab is disabled\n * @default false\n */\n disabled?: boolean;\n}>;\n\nconst Tab = (props: TabProps) => {\n const { children } = props;\n return <>{children}</>;\n};\n\nexport default Tab;\n"],"names":["Tab","props","children","_jsx","_Fragment"],"mappings":";;AAYA,MAAMA,MAAM,CAACC,KAAAA,GAAAA;IACT,MAAM,EAAEC,QAAQ,EAAE,GAAGD,KAAAA;IACrB,qBAAOE,GAAA,CAAAC,QAAA,EAAA;AAAGF,QAAAA,QAAAA,EAAAA;;AACd;;;;"}
@@ -1,25 +1,14 @@
1
- import { PropsWithChildren } from 'react';
2
- import PropTypes from 'prop-types';
3
- type ITabsProps = PropsWithChildren<{
1
+ declare const Tabs: import("react").ForwardRefExoticComponent<{
2
+ /**
3
+ * Active Tab Index
4
+ * @default 0
5
+ */
4
6
  active?: number;
7
+ /** OnChange event handler */
5
8
  onChange?: (index: number) => void;
6
- props?: object;
7
- bodyProps?: object;
8
- }>;
9
- declare function Tabs(props: ITabsProps): import("@emotion/react/jsx-runtime").JSX.Element;
10
- declare namespace Tabs {
11
- var propTypes: {
12
- /** Active Tab Index */
13
- active: PropTypes.Requireable<number>;
14
- /** OnChange event handler */
15
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
16
- /** Props for div that contains tab buttons */
17
- props: PropTypes.Requireable<object>;
18
- /** Props for div that contains tab body */
19
- bodyProps: PropTypes.Requireable<object>;
20
- };
21
- var defaultProps: {
22
- active: number;
23
- };
24
- }
9
+ /** Props for div that contains tab body */
10
+ bodyProps?: React.HTMLAttributes<HTMLDivElement>;
11
+ } & {
12
+ children?: import("react").ReactNode | undefined;
13
+ } & import("react").RefAttributes<HTMLDivElement>>;
25
14
  export default Tabs;