@elliemae/ds-tabs 2.2.0 → 2.3.0-alpha.3

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 (104) hide show
  1. package/cjs/DSTabs.js +58 -40
  2. package/cjs/DSTabs.js.map +7 -0
  3. package/cjs/DSTabsCTX.js +51 -25
  4. package/cjs/DSTabsCTX.js.map +7 -0
  5. package/cjs/DSTabsDatatestid.js +42 -14
  6. package/cjs/DSTabsDatatestid.js.map +7 -0
  7. package/cjs/DSTabsTypes.js +27 -2
  8. package/cjs/DSTabsTypes.js.map +7 -0
  9. package/cjs/config/useCrossRef.js +38 -11
  10. package/cjs/config/useCrossRef.js.map +7 -0
  11. package/cjs/config/useTabs.js +53 -36
  12. package/cjs/config/useTabs.js.map +7 -0
  13. package/cjs/defaultProps.js +39 -13
  14. package/cjs/defaultProps.js.map +7 -0
  15. package/cjs/exportsRelated/DSTab.js +46 -32
  16. package/cjs/exportsRelated/DSTab.js.map +7 -0
  17. package/cjs/index.js +38 -17
  18. package/cjs/index.js.map +7 -0
  19. package/cjs/parts/carousel/Carousel.js +61 -53
  20. package/cjs/parts/carousel/Carousel.js.map +7 -0
  21. package/cjs/parts/carousel/styles.js +77 -63
  22. package/cjs/parts/carousel/styles.js.map +7 -0
  23. package/cjs/parts/carousel/useCarousel.js +51 -49
  24. package/cjs/parts/carousel/useCarousel.js.map +7 -0
  25. package/cjs/parts/carousel/useCarouselCallbacks.js +53 -36
  26. package/cjs/parts/carousel/useCarouselCallbacks.js.map +7 -0
  27. package/cjs/parts/tabBar/TabBar.js +131 -120
  28. package/cjs/parts/tabBar/TabBar.js.map +7 -0
  29. package/cjs/parts/tabBar/styles.js +289 -195
  30. package/cjs/parts/tabBar/styles.js.map +7 -0
  31. package/cjs/parts/tabBar/useTabBar.js +66 -62
  32. package/cjs/parts/tabBar/useTabBar.js.map +7 -0
  33. package/cjs/parts/tabsContent/TabsContent.js +49 -45
  34. package/cjs/parts/tabsContent/TabsContent.js.map +7 -0
  35. package/cjs/parts/tabsContent/styles.js +39 -15
  36. package/cjs/parts/tabsContent/styles.js.map +7 -0
  37. package/cjs/parts/tabsPanel/TabsPanels.js +60 -58
  38. package/cjs/parts/tabsPanel/TabsPanels.js.map +7 -0
  39. package/cjs/parts/tabsPanel/styles.js +43 -23
  40. package/cjs/parts/tabsPanel/styles.js.map +7 -0
  41. package/cjs/propTypes.js +54 -29
  42. package/cjs/propTypes.js.map +7 -0
  43. package/cjs/utils/constants.js +44 -16
  44. package/cjs/utils/constants.js.map +7 -0
  45. package/cjs/utils/helpers.js +63 -22
  46. package/cjs/utils/helpers.js.map +7 -0
  47. package/cjs/utils/hooks/useKeyboardNavigation.js +59 -43
  48. package/cjs/utils/hooks/useKeyboardNavigation.js.map +7 -0
  49. package/cjs/utils/hooks/useTabsCallbacks.js +46 -45
  50. package/cjs/utils/hooks/useTabsCallbacks.js.map +7 -0
  51. package/esm/DSTabs.js +24 -25
  52. package/esm/DSTabs.js.map +7 -0
  53. package/esm/DSTabsCTX.js +22 -20
  54. package/esm/DSTabsCTX.js.map +7 -0
  55. package/esm/DSTabsDatatestid.js +13 -10
  56. package/esm/DSTabsDatatestid.js.map +7 -0
  57. package/esm/DSTabsTypes.js +2 -1
  58. package/esm/DSTabsTypes.js.map +7 -0
  59. package/esm/config/useCrossRef.js +6 -4
  60. package/esm/config/useCrossRef.js.map +7 -0
  61. package/esm/config/useTabs.js +14 -22
  62. package/esm/config/useTabs.js.map +7 -0
  63. package/esm/defaultProps.js +9 -8
  64. package/esm/defaultProps.js.map +7 -0
  65. package/esm/exportsRelated/DSTab.js +15 -19
  66. package/esm/exportsRelated/DSTab.js.map +7 -0
  67. package/esm/index.js +9 -4
  68. package/esm/index.js.map +7 -0
  69. package/esm/parts/carousel/Carousel.js +25 -38
  70. package/esm/parts/carousel/Carousel.js.map +7 -0
  71. package/esm/parts/carousel/styles.js +48 -52
  72. package/esm/parts/carousel/styles.js.map +7 -0
  73. package/esm/parts/carousel/useCarousel.js +15 -34
  74. package/esm/parts/carousel/useCarousel.js.map +7 -0
  75. package/esm/parts/carousel/useCarouselCallbacks.js +20 -28
  76. package/esm/parts/carousel/useCarouselCallbacks.js.map +7 -0
  77. package/esm/parts/tabBar/TabBar.js +100 -102
  78. package/esm/parts/tabBar/TabBar.js.map +7 -0
  79. package/esm/parts/tabBar/styles.js +262 -183
  80. package/esm/parts/tabBar/styles.js.map +7 -0
  81. package/esm/parts/tabBar/useTabBar.js +27 -44
  82. package/esm/parts/tabBar/useTabBar.js.map +7 -0
  83. package/esm/parts/tabsContent/TabsContent.js +19 -35
  84. package/esm/parts/tabsContent/TabsContent.js.map +7 -0
  85. package/esm/parts/tabsContent/styles.js +10 -7
  86. package/esm/parts/tabsContent/styles.js.map +7 -0
  87. package/esm/parts/tabsPanel/TabsPanels.js +28 -45
  88. package/esm/parts/tabsPanel/TabsPanels.js.map +7 -0
  89. package/esm/parts/tabsPanel/styles.js +14 -15
  90. package/esm/parts/tabsPanel/styles.js.map +7 -0
  91. package/esm/propTypes.js +25 -24
  92. package/esm/propTypes.js.map +7 -0
  93. package/esm/utils/constants.js +15 -8
  94. package/esm/utils/constants.js.map +7 -0
  95. package/esm/utils/helpers.js +33 -11
  96. package/esm/utils/helpers.js.map +7 -0
  97. package/esm/utils/hooks/useKeyboardNavigation.js +30 -39
  98. package/esm/utils/hooks/useKeyboardNavigation.js.map +7 -0
  99. package/esm/utils/hooks/useTabsCallbacks.js +15 -39
  100. package/esm/utils/hooks/useTabsCallbacks.js.map +7 -0
  101. package/package.json +6 -6
  102. package/types/DSTabs.d.ts +2 -2
  103. package/types/DSTabsTypes.d.ts +4 -0
  104. package/types/utils/helpers.d.ts +2 -1
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSTabs.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport type { WeakValidationMap } from 'react';\nimport { describe } from 'react-desc';\nimport { tabsPropTypes } from './propTypes';\nimport { DSTabsContext, DSTabsCrossRefContext } from './DSTabsCTX';\nimport { TabsContent } from './parts/tabsContent/TabsContent';\nimport { useTabs } from './config/useTabs';\nimport { useCrossRef } from './config/useCrossRef';\nimport { TabTypes } from './utils/constants';\nimport type { DSTabsPropsT } from './DSTabsTypes';\n\nconst DSTabs = (props: DSTabsPropsT): JSX.Element => {\n const ctx = useTabs(props);\n const crossRefsCtx = useCrossRef();\n\n const { type } = props;\n\n if (type === TabTypes.SUBTABS) {\n return (\n <DSTabsContext.Provider value={ctx}>\n <TabsContent />\n </DSTabsContext.Provider>\n );\n }\n\n return (\n <DSTabsCrossRefContext.Provider value={crossRefsCtx}>\n <DSTabsContext.Provider value={ctx}>\n <TabsContent />\n </DSTabsContext.Provider>\n </DSTabsCrossRefContext.Provider>\n );\n};\n\nDSTabs.propTypes = tabsPropTypes as WeakValidationMap<unknown>;\nconst DSTabsWithSchema = describe<DSTabsPropsT>(DSTabs);\nDSTabsWithSchema.propTypes = tabsPropTypes;\n\nexport { DSTabs, DSTabsWithSchema };\nexport default DSTabs;\n"],
5
+ "mappings": "AAAA;ACAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,MAAM,SAAS,CAAC,UAAqC;AACnD,QAAM,MAAM,QAAQ;AACpB,QAAM,eAAe;AAErB,QAAM,EAAE,SAAS;AAEjB,MAAI,SAAS,SAAS,SAAS;AAC7B,WACE,qCAAC,cAAc,UAAf;AAAA,MAAwB,OAAO;AAAA,OAC7B,qCAAC,aAAD;AAAA;AAKN,SACE,qCAAC,sBAAsB,UAAvB;AAAA,IAAgC,OAAO;AAAA,KACrC,qCAAC,cAAc,UAAf;AAAA,IAAwB,OAAO;AAAA,KAC7B,qCAAC,aAAD;AAAA;AAMR,OAAO,YAAY;AACnB,MAAM,mBAAmB,SAAuB;AAChD,iBAAiB,YAAY;AAG7B,IAAO,iBAAQ;",
6
+ "names": []
7
+ }
package/esm/DSTabsCTX.js CHANGED
@@ -1,25 +1,27 @@
1
- import { createContext, createRef } from 'react';
2
- import { tabsDefaultProps } from './defaultProps.js';
3
-
4
- // eslint-disable-next-line @typescript-eslint/no-empty-function
5
- const noop = () => {};
6
-
1
+ import * as React from "react";
2
+ import { createContext, createRef } from "react";
3
+ import { tabsDefaultProps as defaultProps } from "./defaultProps";
4
+ const noop = () => {
5
+ };
7
6
  const defaultContext = {
8
- props: tabsDefaultProps,
9
- tabsRef: /*#__PURE__*/createRef(),
10
- tabsListRef: /*#__PURE__*/createRef(),
11
- carouselOnlyListRef: /*#__PURE__*/createRef(),
12
- focusableTabsRef: /*#__PURE__*/createRef(),
13
- tabsRefAsArray: /*#__PURE__*/createRef(),
14
- actualActiveTabRef: /*#__PURE__*/createRef(),
7
+ props: defaultProps,
8
+ tabsRef: createRef(),
9
+ tabsListRef: createRef(),
10
+ carouselOnlyListRef: createRef(),
11
+ focusableTabsRef: createRef(),
12
+ tabsRefAsArray: createRef(),
13
+ actualActiveTabRef: createRef(),
15
14
  setInternalActiveTab: noop,
16
- actualActiveTab: ''
15
+ actualActiveTab: ""
17
16
  };
18
17
  const defaultCrossRefsContext = {
19
- lastTabInternalRef: /*#__PURE__*/createRef(),
20
- firstSubtabInternalRef: /*#__PURE__*/createRef()
18
+ lastTabInternalRef: createRef(),
19
+ firstSubtabInternalRef: createRef()
20
+ };
21
+ const DSTabsContext = createContext(defaultContext);
22
+ const DSTabsCrossRefContext = createContext(defaultCrossRefsContext);
23
+ export {
24
+ DSTabsContext,
25
+ DSTabsCrossRefContext
21
26
  };
22
- const DSTabsContext = /*#__PURE__*/createContext(defaultContext);
23
- const DSTabsCrossRefContext = /*#__PURE__*/createContext(defaultCrossRefsContext);
24
-
25
- export { DSTabsContext, DSTabsCrossRefContext };
27
+ //# sourceMappingURL=DSTabsCTX.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSTabsCTX.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createContext, createRef } from 'react';\nimport { tabsDefaultProps as defaultProps } from './defaultProps';\nimport type { DSTabsUseCrossRefContextT, DSTabsUseTabsContextT } from './DSTabsTypes';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = () => {};\n\nconst defaultContext = {\n props: defaultProps,\n tabsRef: createRef<Record<number, HTMLButtonElement> | null>(),\n tabsListRef: createRef<HTMLDivElement | null>(),\n carouselOnlyListRef: createRef<HTMLDivElement | null>(),\n focusableTabsRef: createRef<HTMLButtonElement[] | null>(),\n tabsRefAsArray: createRef<HTMLButtonElement[] | null>(),\n actualActiveTabRef: createRef<HTMLButtonElement | null>(),\n setInternalActiveTab: noop,\n actualActiveTab: '',\n};\n\nconst defaultCrossRefsContext = {\n lastTabInternalRef: createRef<HTMLButtonElement | null>(),\n firstSubtabInternalRef: createRef<HTMLButtonElement | null>(),\n};\n\nexport const DSTabsContext = createContext<DSTabsUseTabsContextT>(defaultContext);\nexport const DSTabsCrossRefContext = createContext<DSTabsUseCrossRefContextT>(defaultCrossRefsContext);\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAIA,MAAM,OAAO,MAAM;AAAA;AAEnB,MAAM,iBAAiB;AAAA,EACrB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,aAAa;AAAA,EACb,qBAAqB;AAAA,EACrB,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,sBAAsB;AAAA,EACtB,iBAAiB;AAAA;AAGnB,MAAM,0BAA0B;AAAA,EAC9B,oBAAoB;AAAA,EACpB,wBAAwB;AAAA;AAGnB,MAAM,gBAAgB,cAAqC;AAC3D,MAAM,wBAAwB,cAAyC;",
6
+ "names": []
7
+ }
@@ -1,14 +1,17 @@
1
+ import * as React from "react";
1
2
  const DSTabsDatatestid = {
2
- TABS_CONTAINER: 'ds-tabs-container',
3
- TAB_BUTTON: 'ds-tabs-tab-button',
4
- SUBTAB_BUTTON: 'ds-tabs-subtab-button',
5
- TAB_PANEL: 'ds-tabs-tab-panel',
6
- SUB_TAB_LIST: 'subtabs-list',
7
- TAB_LIST: 'tab-list',
3
+ TABS_CONTAINER: "ds-tabs-container",
4
+ TAB_BUTTON: "ds-tabs-tab-button",
5
+ SUBTAB_BUTTON: "ds-tabs-subtab-button",
6
+ TAB_PANEL: "ds-tabs-tab-panel",
7
+ SUB_TAB_LIST: "subtabs-list",
8
+ TAB_LIST: "tab-list",
8
9
  CAROUSEL: {
9
- BUTTON_RIGHT: 'chevron-right',
10
- BUTTON_LEFT: 'chevron-left'
10
+ BUTTON_RIGHT: "chevron-right",
11
+ BUTTON_LEFT: "chevron-left"
11
12
  }
12
13
  };
13
-
14
- export { DSTabsDatatestid };
14
+ export {
15
+ DSTabsDatatestid
16
+ };
17
+ //# sourceMappingURL=DSTabsDatatestid.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSTabsDatatestid.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSTabsDatatestid = {\n TABS_CONTAINER: 'ds-tabs-container',\n TAB_BUTTON: 'ds-tabs-tab-button',\n SUBTAB_BUTTON: 'ds-tabs-subtab-button',\n TAB_PANEL: 'ds-tabs-tab-panel',\n SUB_TAB_LIST: 'subtabs-list',\n TAB_LIST: 'tab-list',\n CAROUSEL: {\n BUTTON_RIGHT: 'chevron-right',\n BUTTON_LEFT: 'chevron-left',\n },\n};\n"],
5
+ "mappings": "AAAA;ACAO,MAAM,mBAAmB;AAAA,EAC9B,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,WAAW;AAAA,EACX,cAAc;AAAA,EACd,UAAU;AAAA,EACV,UAAU;AAAA,IACR,cAAc;AAAA,IACd,aAAa;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -1 +1,2 @@
1
-
1
+ import * as React from "react";
2
+ //# sourceMappingURL=DSTabsTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "AAAA;",
6
+ "names": []
7
+ }
@@ -1,5 +1,5 @@
1
- import { useRef, useMemo } from 'react';
2
-
1
+ import * as React from "react";
2
+ import { useRef, useMemo } from "react";
3
3
  const useCrossRef = () => {
4
4
  const firstSubtabInternalRef = useRef();
5
5
  const lastTabInternalRef = useRef();
@@ -9,5 +9,7 @@ const useCrossRef = () => {
9
9
  }), []);
10
10
  return ctx;
11
11
  };
12
-
13
- export { useCrossRef };
12
+ export {
13
+ useCrossRef
14
+ };
15
+ //# sourceMappingURL=useCrossRef.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useCrossRef.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useRef, useMemo } from 'react';\nimport type { DSTabsUseCrossRefContextT } from '../DSTabsTypes';\n\nexport const useCrossRef = (): DSTabsUseCrossRefContextT => {\n const firstSubtabInternalRef = useRef<HTMLButtonElement>();\n const lastTabInternalRef = useRef<HTMLButtonElement>();\n\n const ctx = useMemo(\n () => ({\n firstSubtabInternalRef,\n lastTabInternalRef,\n }),\n [],\n );\n\n return ctx;\n};\n"],
5
+ "mappings": "AAAA;ACAA;AAGO,MAAM,cAAc,MAAiC;AAC1D,QAAM,yBAAyB;AAC/B,QAAM,qBAAqB;AAE3B,QAAM,MAAM,QACV,MAAO;AAAA,IACL;AAAA,IACA;AAAA,MAEF;AAGF,SAAO;AAAA;",
6
+ "names": []
7
+ }
@@ -1,34 +1,24 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
- import 'core-js/modules/esnext.async-iterator.find.js';
3
- import 'core-js/modules/esnext.iterator.constructor.js';
4
- import 'core-js/modules/esnext.iterator.find.js';
5
- import { useRef, useState, useMemo, useEffect } from 'react';
6
- import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';
7
- import { tabsDefaultProps } from '../defaultProps.js';
8
-
9
- const useTabs = props => {
10
- var _children$, _children$$props;
11
-
1
+ import * as React from "react";
2
+ import { useRef, useState, useMemo, useEffect } from "react";
3
+ import { useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
4
+ import { tabsDefaultProps } from "../defaultProps";
5
+ const useTabs = (props) => {
12
6
  const propsWithDefaults = useMemoMergePropsWithDefault(props, tabsDefaultProps);
13
- const {
14
- activeTab,
15
- children
16
- } = propsWithDefaults;
7
+ const { activeTab, children } = propsWithDefaults;
17
8
  const tabsRef = useRef({});
18
9
  const tabsRefAsArray = useRef([]);
19
10
  const focusableTabsRef = useRef([]);
20
11
  const carouselOnlyListRef = useRef(null);
21
12
  const tabsListRef = useRef(null);
22
13
  const actualActiveTabRef = useRef(null);
23
- const [internalActiveTab, setInternalActiveTab] = useState(children === null || children === void 0 ? void 0 : (_children$ = children[0]) === null || _children$ === void 0 ? void 0 : (_children$$props = _children$.props) === null || _children$$props === void 0 ? void 0 : _children$$props.tabId);
14
+ const [internalActiveTab, setInternalActiveTab] = useState(children?.[0]?.props?.tabId);
24
15
  const actualActiveTab = useMemo(() => {
25
- if (activeTab !== undefined) return activeTab;
16
+ if (activeTab !== void 0)
17
+ return activeTab;
26
18
  return internalActiveTab;
27
19
  }, [activeTab, internalActiveTab]);
28
20
  useEffect(() => {
29
- var _focusableTabsRef$cur;
30
-
31
- actualActiveTabRef.current = (_focusableTabsRef$cur = focusableTabsRef.current.find(el => el.dataset.tabId === actualActiveTab)) !== null && _focusableTabsRef$cur !== void 0 ? _focusableTabsRef$cur : null;
21
+ actualActiveTabRef.current = focusableTabsRef.current.find((el) => el.dataset.tabId === actualActiveTab) ?? null;
32
22
  }, [actualActiveTab]);
33
23
  const ctx = useMemo(() => ({
34
24
  props: propsWithDefaults,
@@ -43,5 +33,7 @@ const useTabs = props => {
43
33
  }), [actualActiveTab, propsWithDefaults]);
44
34
  return ctx;
45
35
  };
46
-
47
- export { useTabs };
36
+ export {
37
+ useTabs
38
+ };
39
+ //# sourceMappingURL=useTabs.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useTabs.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useRef, useState, useMemo, useEffect } from 'react';\nimport { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { tabsDefaultProps } from '../defaultProps';\nimport type { DSTabsPropsT, DSTabsUseTabsContextT, DSTabsPropsWithDefaultsT } from '../DSTabsTypes';\n\nexport const useTabs = (props: DSTabsPropsT): DSTabsUseTabsContextT => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, tabsDefaultProps) as DSTabsPropsWithDefaultsT;\n\n const { activeTab, children } = propsWithDefaults;\n\n const tabsRef = useRef<Record<number, HTMLButtonElement>>({});\n const tabsRefAsArray = useRef<HTMLButtonElement[]>([]);\n const focusableTabsRef = useRef<HTMLButtonElement[]>([]);\n const carouselOnlyListRef = useRef<HTMLDivElement | null>(null);\n const tabsListRef = useRef<HTMLDivElement | null>(null);\n const actualActiveTabRef = useRef<HTMLButtonElement | null>(null);\n\n const [internalActiveTab, setInternalActiveTab] = useState<string>(children?.[0]?.props?.tabId);\n\n const actualActiveTab = useMemo(() => {\n if (activeTab !== undefined) return activeTab;\n return internalActiveTab;\n }, [activeTab, internalActiveTab]);\n\n useEffect(() => {\n actualActiveTabRef.current = focusableTabsRef.current.find((el) => el.dataset.tabId === actualActiveTab) ?? null;\n }, [actualActiveTab]);\n\n const ctx = useMemo(\n () => ({\n props: propsWithDefaults,\n tabsRef,\n focusableTabsRef,\n tabsListRef,\n tabsRefAsArray,\n setInternalActiveTab,\n actualActiveTab,\n actualActiveTabRef,\n carouselOnlyListRef,\n }),\n [actualActiveTab, propsWithDefaults],\n );\n\n return ctx;\n};\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AAGO,MAAM,UAAU,CAAC,UAA+C;AACrE,QAAM,oBAAoB,6BAA6B,OAAO;AAE9D,QAAM,EAAE,WAAW,aAAa;AAEhC,QAAM,UAAU,OAA0C;AAC1D,QAAM,iBAAiB,OAA4B;AACnD,QAAM,mBAAmB,OAA4B;AACrD,QAAM,sBAAsB,OAA8B;AAC1D,QAAM,cAAc,OAA8B;AAClD,QAAM,qBAAqB,OAAiC;AAE5D,QAAM,CAAC,mBAAmB,wBAAwB,SAAiB,WAAW,IAAI,OAAO;AAEzF,QAAM,kBAAkB,QAAQ,MAAM;AACpC,QAAI,cAAc;AAAW,aAAO;AACpC,WAAO;AAAA,KACN,CAAC,WAAW;AAEf,YAAU,MAAM;AACd,uBAAmB,UAAU,iBAAiB,QAAQ,KAAK,CAAC,OAAO,GAAG,QAAQ,UAAU,oBAAoB;AAAA,KAC3G,CAAC;AAEJ,QAAM,MAAM,QACV,MAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MAEF,CAAC,iBAAiB;AAGpB,SAAO;AAAA;",
6
+ "names": []
7
+ }
@@ -1,15 +1,14 @@
1
- import { TabTypes } from './utils/constants.js';
2
-
3
- // eslint-disable-next-line @typescript-eslint/no-empty-function
4
- const noop = () => {};
5
-
1
+ import * as React from "react";
2
+ import { TabTypes } from "./utils/constants";
3
+ const noop = () => {
4
+ };
6
5
  const tabsDefaultProps = {
7
6
  containerProps: {},
8
7
  animated: true,
9
8
  enableMouseEvents: false,
10
9
  allowTextSelection: false,
11
10
  onTabChange: noop,
12
- tabsListAriaLabel: 'Tab list',
11
+ tabsListAriaLabel: "Tab list",
13
12
  type: TabTypes.NORMAL,
14
13
  onlyRenderActiveTab: false,
15
14
  withCarousel: false,
@@ -19,5 +18,7 @@ const tabsDefaultProps = {
19
18
  fixedTabsHeaders: false,
20
19
  showSeparator: true
21
20
  };
22
-
23
- export { tabsDefaultProps };
21
+ export {
22
+ tabsDefaultProps
23
+ };
24
+ //# sourceMappingURL=defaultProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/defaultProps.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { TabTypes } from './utils/constants';\nimport type { DSTabsDefaultPropsT } from './DSTabsTypes';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\n\nexport const tabsDefaultProps: DSTabsDefaultPropsT = {\n containerProps: {},\n animated: true,\n enableMouseEvents: false,\n allowTextSelection: false,\n onTabChange: noop,\n tabsListAriaLabel: 'Tab list',\n type: TabTypes.NORMAL,\n onlyRenderActiveTab: false,\n withCarousel: false,\n isDSMobile: false,\n showSelectionIndicator: true,\n children: [],\n fixedTabsHeaders: false,\n showSeparator: true,\n};\n"],
5
+ "mappings": "AAAA;ACAA;AAIA,MAAM,OAAO,MAAY;AAAA;AAElB,MAAM,mBAAwC;AAAA,EACnD,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,MAAM,SAAS;AAAA,EACf,qBAAqB;AAAA,EACrB,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,wBAAwB;AAAA,EACxB,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,eAAe;AAAA;",
6
+ "names": []
7
+ }
@@ -1,21 +1,17 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import React from 'react';
8
- import { describe } from 'react-desc';
9
- import { tabPropTypes } from '../propTypes.js';
10
- import { jsx } from 'react/jsx-runtime';
11
-
12
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
-
14
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
-
16
- const DSTab = props => /*#__PURE__*/jsx(React.Fragment, _objectSpread({}, props));
17
-
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { describe } from "react-desc";
4
+ import { tabPropTypes } from "../propTypes";
5
+ const DSTab = (props) => /* @__PURE__ */ React2.createElement(React2.Fragment, {
6
+ ...props
7
+ });
8
+ DSTab.propTypes = tabPropTypes;
18
9
  const DSTabWithSchema = describe(DSTab);
19
10
  DSTabWithSchema.propTypes = tabPropTypes;
20
-
21
- export { DSTab, DSTabWithSchema, DSTab as default };
11
+ var DSTab_default = DSTab;
12
+ export {
13
+ DSTab,
14
+ DSTabWithSchema,
15
+ DSTab_default as default
16
+ };
17
+ //# sourceMappingURL=DSTab.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/exportsRelated/DSTab.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport type { WeakValidationMap } from 'react';\nimport { describe } from 'react-desc';\nimport { tabPropTypes } from '../propTypes';\nimport type { DSTabPropsT } from '../DSTabsTypes';\n\nconst DSTab = (props: DSTabPropsT): JSX.Element => <React.Fragment {...props} />;\n\nDSTab.propTypes = tabPropTypes as WeakValidationMap<unknown>;\nconst DSTabWithSchema = describe<DSTabPropsT>(DSTab);\nDSTabWithSchema.propTypes = tabPropTypes;\n\nexport { DSTab, DSTabWithSchema };\nexport default DSTab;\n"],
5
+ "mappings": "AAAA;ACAA;AAEA;AACA;AAGA,MAAM,QAAQ,CAAC,UAAoC,qCAAC,OAAM,UAAP;AAAA,KAAoB;AAAA;AAEvE,MAAM,YAAY;AAClB,MAAM,kBAAkB,SAAsB;AAC9C,gBAAgB,YAAY;AAG5B,IAAO,gBAAQ;",
6
+ "names": []
7
+ }
package/esm/index.js CHANGED
@@ -1,4 +1,9 @@
1
- export { DSTab, DSTabWithSchema } from './exportsRelated/DSTab.js';
2
- export { DSTabs, DSTabsWithSchema } from './DSTabs.js';
3
- export { TabTypes } from './utils/constants.js';
4
- export { DSTabsDatatestid } from './DSTabsDatatestid.js';
1
+ import * as React from "react";
2
+ export * from "./exportsRelated/DSTab";
3
+ export * from "./DSTabs";
4
+ import { TabTypes } from "./utils/constants";
5
+ export * from "./DSTabsDatatestid";
6
+ export {
7
+ TabTypes
8
+ };
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './exportsRelated/DSTab';\nexport * from './DSTabs';\nexport { TabTypes } from './utils/constants';\nexport * from './DSTabsDatatestid';\n\nexport type { DSTabsPropsT, DSTabPropsT } from './DSTabsTypes';\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;",
6
+ "names": []
7
+ }
@@ -1,61 +1,48 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import { useContext } from 'react';
3
- import { DSIconSizes } from '@elliemae/ds-icon';
4
- import { BUTTON_TYPES } from '@elliemae/ds-button';
5
- import { ChevronLeft, ChevronRight } from '@elliemae/ds-icons';
6
- import { StyledCarouselWrapper, StyledCarouselButtonWrapper, StyledCarouselBtn, StyledChildrenWrap } from './styles.js';
7
- import { useCarousel } from './useCarousel.js';
8
- import { DSTabsContext } from '../../DSTabsCTX.js';
9
- import { DSTabsDatatestid } from '../../DSTabsDatatestid.js';
10
- import { jsx } from 'react/jsx-runtime';
11
-
12
- const Carousel = _ref => {
13
- let {
14
- children,
15
- updateIndicatorStyle
16
- } = _ref;
17
- const {
18
- showChevrons,
19
- leftButtonOnClick,
20
- rightButtonOnClick,
21
- handleOnClick,
22
- handleOnScroll
23
- } = useCarousel({
1
+ import * as React from "react";
2
+ import { useContext } from "react";
3
+ import { DSIconSizes } from "@elliemae/ds-icon";
4
+ import { BUTTON_TYPES } from "@elliemae/ds-button";
5
+ import { ChevronRight, ChevronLeft } from "@elliemae/ds-icons";
6
+ import { StyledCarouselBtn, StyledCarouselButtonWrapper, StyledCarouselWrapper, StyledChildrenWrap } from "./styles";
7
+ import { useCarousel } from "./useCarousel";
8
+ import { DSTabsContext } from "../../DSTabsCTX";
9
+ import { DSTabsDatatestid } from "../../DSTabsDatatestid";
10
+ const Carousel = ({ children, updateIndicatorStyle }) => {
11
+ const { showChevrons, leftButtonOnClick, rightButtonOnClick, handleOnClick, handleOnScroll } = useCarousel({
24
12
  updateIndicatorStyle
25
13
  });
26
14
  const {
27
15
  carouselOnlyListRef,
28
- props: {
29
- type
30
- }
16
+ props: { type }
31
17
  } = useContext(DSTabsContext);
32
- return /*#__PURE__*/_jsx(StyledCarouselWrapper, {}, void 0, showChevrons.left && /*#__PURE__*/_jsx(StyledCarouselButtonWrapper, {
18
+ return /* @__PURE__ */ React.createElement(StyledCarouselWrapper, null, showChevrons.left && /* @__PURE__ */ React.createElement(StyledCarouselButtonWrapper, {
33
19
  tabType: type
34
- }, void 0, /*#__PURE__*/_jsx(StyledCarouselBtn, {
20
+ }, /* @__PURE__ */ React.createElement(StyledCarouselBtn, {
35
21
  size: "s",
36
22
  onClick: leftButtonOnClick,
37
23
  tabIndex: -1,
38
24
  "data-testid": DSTabsDatatestid.CAROUSEL.BUTTON_LEFT,
39
25
  buttonType: BUTTON_TYPES.ICON
40
- }, void 0, /*#__PURE__*/_jsx(ChevronLeft, {
26
+ }, /* @__PURE__ */ React.createElement(ChevronLeft, {
41
27
  size: DSIconSizes.S
42
- }))), showChevrons.right && /*#__PURE__*/_jsx(StyledCarouselButtonWrapper, {
28
+ }))), showChevrons.right && /* @__PURE__ */ React.createElement(StyledCarouselButtonWrapper, {
43
29
  tabType: type,
44
30
  right: showChevrons.right
45
- }, void 0, /*#__PURE__*/_jsx(StyledCarouselBtn, {
31
+ }, /* @__PURE__ */ React.createElement(StyledCarouselBtn, {
46
32
  size: "s",
47
33
  onClick: rightButtonOnClick,
48
34
  tabIndex: -1,
49
35
  "data-testid": DSTabsDatatestid.CAROUSEL.BUTTON_RIGHT,
50
36
  buttonType: BUTTON_TYPES.ICON
51
- }, void 0, /*#__PURE__*/_jsx(ChevronRight, {
37
+ }, /* @__PURE__ */ React.createElement(ChevronRight, {
52
38
  size: DSIconSizes.S
53
- }))), /*#__PURE__*/jsx(StyledChildrenWrap, {
39
+ }))), /* @__PURE__ */ React.createElement(StyledChildrenWrap, {
54
40
  ref: carouselOnlyListRef,
55
41
  onClick: handleOnClick,
56
- onScroll: handleOnScroll,
57
- children: children
58
- }));
42
+ onScroll: handleOnScroll
43
+ }, children));
44
+ };
45
+ export {
46
+ Carousel
59
47
  };
60
-
61
- export { Carousel };
48
+ //# sourceMappingURL=Carousel.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/carousel/Carousel.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useContext } from 'react';\nimport { DSIconSizes } from '@elliemae/ds-icon';\nimport { BUTTON_TYPES } from '@elliemae/ds-button';\nimport { ChevronRight, ChevronLeft } from '@elliemae/ds-icons';\nimport { StyledCarouselBtn, StyledCarouselButtonWrapper, StyledCarouselWrapper, StyledChildrenWrap } from './styles';\nimport { useCarousel } from './useCarousel';\nimport { DSTabsContext } from '../../DSTabsCTX';\nimport { DSTabsDatatestid } from '../../DSTabsDatatestid';\nimport type { CarouselPropsT } from '../../DSTabsTypes';\n\nexport const Carousel = ({ children, updateIndicatorStyle }: CarouselPropsT): JSX.Element => {\n const { showChevrons, leftButtonOnClick, rightButtonOnClick, handleOnClick, handleOnScroll } = useCarousel({\n updateIndicatorStyle,\n });\n\n const {\n carouselOnlyListRef,\n props: { type },\n } = useContext(DSTabsContext);\n\n return (\n <StyledCarouselWrapper>\n {showChevrons.left && (\n <StyledCarouselButtonWrapper tabType={type}>\n <StyledCarouselBtn\n size=\"s\"\n onClick={leftButtonOnClick}\n tabIndex={-1}\n data-testid={DSTabsDatatestid.CAROUSEL.BUTTON_LEFT}\n buttonType={BUTTON_TYPES.ICON}\n >\n <ChevronLeft size={DSIconSizes.S} />\n </StyledCarouselBtn>\n </StyledCarouselButtonWrapper>\n )}\n {showChevrons.right && (\n <StyledCarouselButtonWrapper tabType={type} right={showChevrons.right}>\n <StyledCarouselBtn\n size=\"s\"\n onClick={rightButtonOnClick}\n tabIndex={-1}\n data-testid={DSTabsDatatestid.CAROUSEL.BUTTON_RIGHT}\n buttonType={BUTTON_TYPES.ICON}\n >\n <ChevronRight size={DSIconSizes.S} />\n </StyledCarouselBtn>\n </StyledCarouselButtonWrapper>\n )}\n <StyledChildrenWrap ref={carouselOnlyListRef} onClick={handleOnClick} onScroll={handleOnScroll}>\n {children}\n </StyledChildrenWrap>\n </StyledCarouselWrapper>\n );\n};\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGO,MAAM,WAAW,CAAC,EAAE,UAAU,2BAAwD;AAC3F,QAAM,EAAE,cAAc,mBAAmB,oBAAoB,eAAe,mBAAmB,YAAY;AAAA,IACzG;AAAA;AAGF,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE;AAAA,MACP,WAAW;AAEf,SACE,oCAAC,uBAAD,MACG,aAAa,QACZ,oCAAC,6BAAD;AAAA,IAA6B,SAAS;AAAA,KACpC,oCAAC,mBAAD;AAAA,IACE,MAAK;AAAA,IACL,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAa,iBAAiB,SAAS;AAAA,IACvC,YAAY,aAAa;AAAA,KAEzB,oCAAC,aAAD;AAAA,IAAa,MAAM,YAAY;AAAA,QAIpC,aAAa,SACZ,oCAAC,6BAAD;AAAA,IAA6B,SAAS;AAAA,IAAM,OAAO,aAAa;AAAA,KAC9D,oCAAC,mBAAD;AAAA,IACE,MAAK;AAAA,IACL,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAa,iBAAiB,SAAS;AAAA,IACvC,YAAY,aAAa;AAAA,KAEzB,oCAAC,cAAD;AAAA,IAAc,MAAM,YAAY;AAAA,QAItC,oCAAC,oBAAD;AAAA,IAAoB,KAAK;AAAA,IAAqB,SAAS;AAAA,IAAe,UAAU;AAAA,KAC7E;AAAA;",
6
+ "names": []
7
+ }
@@ -1,54 +1,50 @@
1
- import styled from 'styled-components';
2
- import { DSButtonV2 } from '@elliemae/ds-button';
3
- import { TabTypes } from '../../utils/constants.js';
1
+ import * as React from "react";
2
+ import styled from "styled-components";
3
+ import { DSButtonV2 } from "@elliemae/ds-button";
4
+ import { TabTypes } from "../../utils/constants";
5
+ const StyledCarouselBtn = styled(DSButtonV2)`
6
+ margin: 0;
7
+ min-width: ${({ theme }) => theme.space.xs};
8
+ width: ${({ theme }) => theme.space.xs};
4
9
 
5
- const StyledCarouselBtn = /*#__PURE__*/styled(DSButtonV2).withConfig({
6
- componentId: "sc-prv5a7-0"
7
- })(["margin:0;min-width:", ";width:", ";&:hover:not(:disabled){background-color:transparent;}background-color:transparent;border-radius:0px;& .em-ds-icon svg{fill:", ";}"], _ref => {
8
- let {
9
- theme
10
- } = _ref;
11
- return theme.space.xs;
12
- }, _ref2 => {
13
- let {
14
- theme
15
- } = _ref2;
16
- return theme.space.xs;
17
- }, _ref3 => {
18
- let {
19
- theme
20
- } = _ref3;
21
- return theme.colors.brand[600];
22
- });
23
- const StyledCarouselWrapper = /*#__PURE__*/styled.span.withConfig({
24
- componentId: "sc-prv5a7-1"
25
- })(["position:relative;width:100%;display:flex;"]);
26
- const StyledChildrenWrap = /*#__PURE__*/styled.div.withConfig({
27
- componentId: "sc-prv5a7-2"
28
- })(["display:flex;flex-wrap:nowrap;flex:1;overflow-x:hidden;"]);
29
- const StyledCarouselButtonWrapper = /*#__PURE__*/styled.div.withConfig({
30
- componentId: "sc-prv5a7-3"
31
- })(["max-width:16px;position:absolute;z-index:200;", " width:16px;height:", ";padding-top:", ";background:white;", ";"], _ref4 => {
32
- let {
33
- right
34
- } = _ref4;
35
- return right ? 'right: 0;' : "left: 0;";
36
- }, _ref5 => {
37
- let {
38
- tabType
39
- } = _ref5;
40
- return tabType === TabTypes.NORMAL ? '32px' : '22px';
41
- }, _ref6 => {
42
- let {
43
- tabType
44
- } = _ref6;
45
- return tabType === TabTypes.NORMAL ? '5px' : '0px';
46
- }, _ref7 => {
47
- let {
48
- theme,
49
- tabType
50
- } = _ref7;
51
- return tabType === TabTypes.NORMAL ? "\n background: linear-gradient(to bottom, white 0px, white 30px, ".concat(theme.colors.neutral[400], " 30px, ").concat(theme.colors.neutral[400], " 31px, white 31px , white 32px );\n ") : "";
52
- });
10
+ &:hover:not(:disabled) {
11
+ background-color: transparent;
12
+ }
13
+ background-color: transparent;
14
+ border-radius: 0px;
53
15
 
54
- export { StyledCarouselBtn, StyledCarouselButtonWrapper, StyledCarouselWrapper, StyledChildrenWrap };
16
+ & .em-ds-icon svg {
17
+ fill: ${({ theme }) => theme.colors.brand[600]};
18
+ }
19
+ `;
20
+ const StyledCarouselWrapper = styled.span`
21
+ position: relative;
22
+ width: 100%;
23
+ display: flex;
24
+ `;
25
+ const StyledChildrenWrap = styled.div`
26
+ display: flex;
27
+ flex-wrap: nowrap;
28
+ flex: 1;
29
+ overflow-x: hidden;
30
+ `;
31
+ const StyledCarouselButtonWrapper = styled.div`
32
+ max-width: 16px;
33
+ position: absolute;
34
+ z-index: 200;
35
+ ${({ right }) => right ? "right: 0;" : `left: 0;`}
36
+ width: 16px;
37
+ height: ${({ tabType }) => tabType === TabTypes.NORMAL ? "32px" : "22px"};
38
+ padding-top: ${({ tabType }) => tabType === TabTypes.NORMAL ? "5px" : "0px"};
39
+ background: white;
40
+ ${({ theme, tabType }) => tabType === TabTypes.NORMAL ? `
41
+ background: linear-gradient(to bottom, white 0px, white 30px, ${theme.colors.neutral[400]} 30px, ${theme.colors.neutral[400]} 31px, white 31px , white 32px );
42
+ ` : ``};
43
+ `;
44
+ export {
45
+ StyledCarouselBtn,
46
+ StyledCarouselButtonWrapper,
47
+ StyledCarouselWrapper,
48
+ StyledChildrenWrap
49
+ };
50
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/carousel/styles.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import styled from 'styled-components';\nimport { DSButtonV2 } from '@elliemae/ds-button';\nimport { TabTypes } from '../../utils/constants';\nimport type { StyledCarouselButtonWrapperPropsT } from '../../DSTabsTypes';\n\nexport const StyledCarouselBtn = styled(DSButtonV2)`\n margin: 0;\n min-width: ${({ theme }) => theme.space.xs};\n width: ${({ theme }) => theme.space.xs};\n\n &:hover:not(:disabled) {\n background-color: transparent;\n }\n background-color: transparent;\n border-radius: 0px;\n\n & .em-ds-icon svg {\n fill: ${({ theme }) => theme.colors.brand[600]};\n }\n`;\n\nexport const StyledCarouselWrapper = styled.span`\n position: relative;\n width: 100%;\n display: flex;\n`;\n\nexport const StyledChildrenWrap = styled.div`\n display: flex;\n flex-wrap: nowrap;\n flex: 1;\n overflow-x: hidden;\n`;\n\nexport const StyledCarouselButtonWrapper = styled.div<StyledCarouselButtonWrapperPropsT>`\n max-width: 16px;\n position: absolute;\n z-index: 200;\n ${({ right }) => (right ? 'right: 0;' : `left: 0;`)}\n width: 16px;\n height: ${({ tabType }) => (tabType === TabTypes.NORMAL ? '32px' : '22px')};\n padding-top: ${({ tabType }) => (tabType === TabTypes.NORMAL ? '5px' : '0px')};\n background: white;\n ${({ theme, tabType }) =>\n tabType === TabTypes.NORMAL\n ? `\n background: linear-gradient(to bottom, white 0px, white 30px, ${theme.colors.neutral[400]} 30px, ${theme.colors.neutral[400]} 31px, white 31px , white 32px );\n `\n : ``};\n`;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AAGO,MAAM,oBAAoB,OAAO;AAAA;AAAA,eAEzB,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA,WAC/B,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAS1B,CAAC,EAAE,YAAY,MAAM,OAAO,MAAM;AAAA;AAAA;AAIvC,MAAM,wBAAwB,OAAO;AAAA;AAAA;AAAA;AAAA;AAMrC,MAAM,qBAAqB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAOlC,MAAM,8BAA8B,OAAO;AAAA;AAAA;AAAA;AAAA,IAI9C,CAAC,EAAE,YAAa,QAAQ,cAAc;AAAA;AAAA,YAE9B,CAAC,EAAE,cAAe,YAAY,SAAS,SAAS,SAAS;AAAA,iBACpD,CAAC,EAAE,cAAe,YAAY,SAAS,SAAS,QAAQ;AAAA;AAAA,IAErE,CAAC,EAAE,OAAO,cACV,YAAY,SAAS,SACjB;AAAA,sEAC8D,MAAM,OAAO,QAAQ,cAAc,MAAM,OAAO,QAAQ;AAAA,KAEtH;AAAA;",
6
+ "names": []
7
+ }
@@ -1,34 +1,20 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
- import 'core-js/modules/esnext.async-iterator.reduce.js';
3
- import 'core-js/modules/esnext.iterator.constructor.js';
4
- import 'core-js/modules/esnext.iterator.reduce.js';
5
- import { useContext, useState, useCallback } from 'react';
6
- import useResizeObserver from '@react-hook/resize-observer';
7
- import { DSTabsContext } from '../../DSTabsCTX.js';
8
- import { isElementVisibleCarousel } from '../../utils/helpers.js';
9
- import { useCarouselCallbacks } from './useCarouselCallbacks.js';
10
-
11
- const useCarousel = _ref => {
12
- let {
13
- updateIndicatorStyle
14
- } = _ref;
15
- const {
16
- carouselOnlyListRef
17
- } = useContext(DSTabsContext);
1
+ import * as React from "react";
2
+ import { useCallback, useState, useContext } from "react";
3
+ import useResizeObserver from "@react-hook/resize-observer";
4
+ import { DSTabsContext } from "../../DSTabsCTX";
5
+ import { isElementVisibleCarousel } from "../../utils/helpers";
6
+ import { useCarouselCallbacks } from "./useCarouselCallbacks";
7
+ const useCarousel = ({ updateIndicatorStyle }) => {
8
+ const { carouselOnlyListRef } = useContext(DSTabsContext);
18
9
  const [showChevrons, setShowChevrons] = useState({
19
10
  right: false,
20
11
  left: false
21
12
  });
22
- const {
23
- tabsRefAsArray
24
- } = useContext(DSTabsContext);
13
+ const { tabsRefAsArray } = useContext(DSTabsContext);
25
14
  const shouldShowLeft = useCallback(() => carouselOnlyListRef.current ? carouselOnlyListRef.current.scrollLeft > 0 : false, [carouselOnlyListRef]);
26
15
  const shouldShowRight = useCallback(() => carouselOnlyListRef.current ? carouselOnlyListRef.current.scrollLeft < carouselOnlyListRef.current.scrollWidth - carouselOnlyListRef.current.clientWidth : false, [carouselOnlyListRef]);
27
16
  const recalcChevrons = useCallback(() => {
28
- setShowChevrons({
29
- right: shouldShowRight(),
30
- left: shouldShowLeft()
31
- });
17
+ setShowChevrons({ right: shouldShowRight(), left: shouldShowLeft() });
32
18
  }, [shouldShowLeft, shouldShowRight]);
33
19
  const getVisibleItemsOffset = useCallback(() => {
34
20
  if (tabsRefAsArray.current) {
@@ -39,21 +25,14 @@ const useCarousel = _ref => {
39
25
  const margin = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
40
26
  return acc + (width + margin);
41
27
  }
42
-
43
28
  return acc;
44
29
  }, 0);
45
30
  return scroll - 16;
46
31
  }
47
-
48
32
  return 0;
49
33
  }, [tabsRefAsArray, carouselOnlyListRef]);
50
34
  useResizeObserver(carouselOnlyListRef, recalcChevrons);
51
- const {
52
- leftButtonOnClick,
53
- rightButtonOnClick,
54
- handleOnClick,
55
- handleOnScroll
56
- } = useCarouselCallbacks({
35
+ const { leftButtonOnClick, rightButtonOnClick, handleOnClick, handleOnScroll } = useCarouselCallbacks({
57
36
  getVisibleItemsOffset,
58
37
  recalcChevrons,
59
38
  updateIndicatorStyle
@@ -66,5 +45,7 @@ const useCarousel = _ref => {
66
45
  handleOnScroll
67
46
  };
68
47
  };
69
-
70
- export { useCarousel };
48
+ export {
49
+ useCarousel
50
+ };
51
+ //# sourceMappingURL=useCarousel.js.map