@elliemae/ds-chat-sidebar 3.28.1-rc.2 → 3.29.0-next.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/SideBarChat.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import type { WeakValidationMap } from 'react';\nimport React from 'react';\nimport { describe, useValidateTypescriptPropTypes, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { MenuCollapse, MenuExpand } from '@elliemae/ds-icons';\nimport { TileButton } from '@elliemae/ds-chat-tile';\nimport { StyledSideBarContainer, StyledSideBarButtonsContainer } from './styled.js';\nimport { SidebarButton } from './sidebar-button/SidebarButton.js';\nimport type { DSChatSidebarT } from './react-desc-prop-types.js';\nimport { defaultProps, chatSidebarProps } from './react-desc-prop-types.js';\nimport { DSChatSidebarName } from './DSChatSidebarDefinitions.js';\n\nconst FooterChat = ({\n expanded,\n onFooterClose,\n onFooterExpand,\n footerButtonExtraProps,\n}: Pick<DSChatSidebarT.DefaultProps, 'expanded' | 'onFooterClose' | 'onFooterExpand' | 'footerButtonExtraProps'>) => (\n <SidebarButton\n dsId=\"sidebar_footer\"\n Icon={!expanded ? MenuCollapse : MenuExpand}\n onClick={expanded ? onFooterClose : onFooterExpand}\n aria-pressed={expanded}\n aria-label={footerButtonExtraProps['aria-label']}\n />\n);\n\nconst SideBarChat: React.ComponentType<DSChatSidebarT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSChatSidebarT.Props>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, chatSidebarProps, DSChatSidebarName);\n\n const {\n sidebarItems,\n expanded,\n onFooterClose,\n onFooterExpand,\n selectedItem,\n footerButtonExtraProps,\n tooltipPlacement,\n enableTooltipWhenIsClosed,\n actionRef,\n } = propsWithDefault;\n const { current: listRef } = React.useRef<{ [key: string]: HTMLElement }>({});\n const registerReference = React.useCallback(\n (ref: HTMLElement) => {\n if (ref?.dataset?.key) listRef[ref.dataset.key] = ref;\n },\n [listRef],\n );\n React.useEffect(() => {\n if (actionRef?.current?.listRef) {\n actionRef.current.listRef = listRef;\n }\n }, [sidebarItems, expanded, actionRef, listRef]);\n\n return (\n <StyledSideBarContainer rows={['1fr', 'auto']}>\n <StyledSideBarButtonsContainer>\n {sidebarItems.map((p) => (\n <TileButton\n key={p.dsId}\n innerRef={registerReference}\n {...p}\n selected={selectedItem === p.dsId}\n tooltipPlacement={tooltipPlacement}\n disableTooltip={enableTooltipWhenIsClosed ? false : !expanded}\n />\n ))}\n </StyledSideBarButtonsContainer>\n <FooterChat\n expanded={expanded}\n onFooterClose={onFooterClose}\n onFooterExpand={onFooterExpand}\n footerButtonExtraProps={footerButtonExtraProps}\n />\n </StyledSideBarContainer>\n );\n};\n\nSideBarChat.propTypes = chatSidebarProps as WeakValidationMap<unknown>;\nSideBarChat.displayName = DSChatSidebarName;\nconst SideBarChatWithSchema = describe(SideBarChat);\nSideBarChatWithSchema.propTypes = chatSidebarProps as WeakValidationMap<unknown>;\n\nexport { SideBarChat, SideBarChatWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiBrB;AAhBF,mBAAkB;AAClB,8BAAuF;AACvF,sBAAyC;AACzC,0BAA2B;AAC3B,oBAAsE;AACtE,2BAA8B;AAE9B,mCAA+C;AAC/C,sCAAkC;AAElC,MAAM,aAAa,CAAC;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MACE;AAAA,EAAC;AAAA;AAAA,IACC,MAAK;AAAA,IACL,MAAM,CAAC,WAAW,+BAAe;AAAA,IACjC,SAAS,WAAW,gBAAgB;AAAA,IACpC,gBAAc;AAAA,IACd,cAAY,uBAAuB,YAAY;AAAA;AACjD;AAGF,MAAM,cAAyD,CAAC,UAAU;AACxE,QAAM,uBAAmB,sDAAmD,OAAO,yCAAY;AAC/F,8DAA+B,kBAAkB,+CAAkB,iDAAiB;AAEpF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,SAAS,QAAQ,IAAI,aAAAA,QAAM,OAAuC,CAAC,CAAC;AAC5E,QAAM,oBAAoB,aAAAA,QAAM;AAAA,IAC9B,CAAC,QAAqB;AACpB,UAAI,KAAK,SAAS;AAAK,gBAAQ,IAAI,QAAQ,GAAG,IAAI;AAAA,IACpD;AAAA,IACA,CAAC,OAAO;AAAA,EACV;AACA,eAAAA,QAAM,UAAU,MAAM;AACpB,QAAI,WAAW,SAAS,SAAS;AAC/B,gBAAU,QAAQ,UAAU;AAAA,IAC9B;AAAA,EACF,GAAG,CAAC,cAAc,UAAU,WAAW,OAAO,CAAC;AAE/C,SACE,6CAAC,wCAAuB,MAAM,CAAC,OAAO,MAAM,GAC1C;AAAA,gDAAC,+CACE,uBAAa,IAAI,CAAC,MACjB;AAAA,MAAC;AAAA;AAAA,QAEC,UAAU;AAAA,QACT,GAAG;AAAA,QACJ,UAAU,iBAAiB,EAAE;AAAA,QAC7B;AAAA,QACA,gBAAgB,4BAA4B,QAAQ,CAAC;AAAA;AAAA,MALhD,EAAE;AAAA,IAMT,CACD,GACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;AAEA,YAAY,YAAY;AACxB,YAAY,cAAc;AAC1B,MAAM,4BAAwB,kCAAS,WAAW;AAClD,sBAAsB,YAAY;",
4
+ "sourcesContent": ["import type { WeakValidationMap } from 'react';\nimport React from 'react';\nimport { describe, useValidateTypescriptPropTypes, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { MenuCollapse, MenuExpand } from '@elliemae/ds-icons';\nimport { TileButton } from '@elliemae/ds-chat-tile';\nimport { StyledSideBarContainer, StyledSideBarButtonsContainer } from './styled.js';\nimport { SidebarButton } from './sidebar-button/SidebarButton.js';\nimport type { DSChatSidebarT } from './react-desc-prop-types.js';\nimport { defaultProps, chatSidebarProps } from './react-desc-prop-types.js';\nimport { DSChatSidebarName } from './DSChatSidebarDefinitions.js';\n\nconst FooterChat = ({\n expanded,\n onFooterClose,\n onFooterExpand,\n footerButtonExtraProps,\n}: Pick<DSChatSidebarT.DefaultProps, 'expanded' | 'onFooterClose' | 'onFooterExpand' | 'footerButtonExtraProps'>) => (\n <SidebarButton\n dsId=\"sidebar_footer\"\n Icon={!expanded ? MenuCollapse : MenuExpand}\n onClick={expanded ? onFooterClose : onFooterExpand}\n aria-pressed={expanded}\n aria-label={footerButtonExtraProps['aria-label']}\n />\n);\n\nconst SideBarChat: React.ComponentType<DSChatSidebarT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSChatSidebarT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, chatSidebarProps, DSChatSidebarName);\n const {\n sidebarItems,\n expanded,\n onFooterClose,\n onFooterExpand,\n selectedItem,\n footerButtonExtraProps,\n tooltipPlacement,\n enableTooltipWhenIsClosed,\n actionRef,\n } = propsWithDefault;\n const { current: listRef } = React.useRef<{ [key: string]: HTMLElement }>({});\n const registerReference = React.useCallback(\n (ref: HTMLElement) => {\n if (ref?.dataset?.key) listRef[ref.dataset.key] = ref;\n },\n [listRef],\n );\n React.useEffect(() => {\n if (actionRef?.current?.listRef) {\n actionRef.current.listRef = listRef;\n }\n }, [sidebarItems, expanded, actionRef, listRef]);\n\n return (\n <StyledSideBarContainer rows={['1fr', 'auto']}>\n <StyledSideBarButtonsContainer>\n {sidebarItems.map((p) => (\n <TileButton\n key={p.dsId}\n innerRef={registerReference}\n {...p}\n selected={selectedItem === p.dsId}\n tooltipPlacement={tooltipPlacement}\n disableTooltip={enableTooltipWhenIsClosed ? false : !expanded}\n />\n ))}\n </StyledSideBarButtonsContainer>\n <FooterChat\n expanded={expanded}\n onFooterClose={onFooterClose}\n onFooterExpand={onFooterExpand}\n footerButtonExtraProps={footerButtonExtraProps}\n />\n </StyledSideBarContainer>\n );\n};\n\nSideBarChat.propTypes = chatSidebarProps as WeakValidationMap<unknown>;\nSideBarChat.displayName = DSChatSidebarName;\nconst SideBarChatWithSchema = describe(SideBarChat);\nSideBarChatWithSchema.propTypes = chatSidebarProps as WeakValidationMap<unknown>;\n\nexport { SideBarChat, SideBarChatWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiBrB;AAhBF,mBAAkB;AAClB,8BAAuF;AACvF,sBAAyC;AACzC,0BAA2B;AAC3B,oBAAsE;AACtE,2BAA8B;AAE9B,mCAA+C;AAC/C,sCAAkC;AAElC,MAAM,aAAa,CAAC;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MACE;AAAA,EAAC;AAAA;AAAA,IACC,MAAK;AAAA,IACL,MAAM,CAAC,WAAW,+BAAe;AAAA,IACjC,SAAS,WAAW,gBAAgB;AAAA,IACpC,gBAAc;AAAA,IACd,cAAY,uBAAuB,YAAY;AAAA;AACjD;AAGF,MAAM,cAAyD,CAAC,UAAU;AACxE,QAAM,uBAAmB,sDAA2D,OAAO,yCAAY;AACvG,8DAA+B,kBAAkB,+CAAkB,iDAAiB;AACpF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,SAAS,QAAQ,IAAI,aAAAA,QAAM,OAAuC,CAAC,CAAC;AAC5E,QAAM,oBAAoB,aAAAA,QAAM;AAAA,IAC9B,CAAC,QAAqB;AACpB,UAAI,KAAK,SAAS;AAAK,gBAAQ,IAAI,QAAQ,GAAG,IAAI;AAAA,IACpD;AAAA,IACA,CAAC,OAAO;AAAA,EACV;AACA,eAAAA,QAAM,UAAU,MAAM;AACpB,QAAI,WAAW,SAAS,SAAS;AAC/B,gBAAU,QAAQ,UAAU;AAAA,IAC9B;AAAA,EACF,GAAG,CAAC,cAAc,UAAU,WAAW,OAAO,CAAC;AAE/C,SACE,6CAAC,wCAAuB,MAAM,CAAC,OAAO,MAAM,GAC1C;AAAA,gDAAC,+CACE,uBAAa,IAAI,CAAC,MACjB;AAAA,MAAC;AAAA;AAAA,QAEC,UAAU;AAAA,QACT,GAAG;AAAA,QACJ,UAAU,iBAAiB,EAAE;AAAA,QAC7B;AAAA,QACA,gBAAgB,4BAA4B,QAAQ,CAAC;AAAA;AAAA,MALhD,EAAE;AAAA,IAMT,CACD,GACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;AAEA,YAAY,YAAY;AACxB,YAAY,cAAc;AAC1B,MAAM,4BAAwB,kCAAS,WAAW;AAClD,sBAAsB,YAAY;",
6
6
  "names": ["React"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export { SideBarChat, SideBarChatWithSchema } from './SideBarChat.js';\n", "import * as React from 'react';\nexport { React };\n"],
4
+ "sourcesContent": ["export { SideBarChat, SideBarChatWithSchema } from './SideBarChat.js';\nexport type { DSChatSidebarT } from './react-desc-prop-types.js';\n", "import * as React from 'react';\nexport { React };\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,yBAAmD;",
6
6
  "names": []
7
7
  }
@@ -37,7 +37,6 @@ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
37
37
  var import_lodash = require("lodash");
38
38
  const defaultProps = {
39
39
  expanded: false,
40
- selectedItem: void 0,
41
40
  sidebarItems: [],
42
41
  onFooterExpand: import_lodash.noop,
43
42
  onFooterClose: import_lodash.noop,
@@ -50,7 +49,7 @@ const defaultProps = {
50
49
  const chatSidebarProps = {
51
50
  sidebarItems: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.object).description("The array of out-of-the-box items you want to render inside the sidebar nav of the chat").defaultValue(defaultProps.sidebarItems),
52
51
  expanded: import_ds_props_helpers.PropTypes.bool.description("Whether to show the chat expanded or collapsed").defaultValue(defaultProps.expanded),
53
- selectedItem: import_ds_props_helpers.PropTypes.string.description("The id of the chat item you want to be opened").defaultValue(defaultProps.selectedItem),
52
+ selectedItem: import_ds_props_helpers.PropTypes.string.description("The id of the chat item you want to be opened"),
54
53
  tooltipPlacement: import_ds_props_helpers.PropTypes.oneOf([
55
54
  "top-start",
56
55
  "top",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/react-desc-prop-types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import type { DSChatTileT } from '@elliemae/ds-chat-tile';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport { noop } from 'lodash';\n\nexport declare namespace DSChatSidebarT {\n export interface DefaultProps {\n sidebarItems: DSChatTileT.Props[];\n expanded: boolean;\n selectedItem: undefined;\n onFooterClose: () => void;\n onFooterExpand: () => void;\n onHeaderExpand: () => void;\n onHeaderClose: () => void;\n footerButtonExtraProps: Record<string, string>;\n tooltipPlacement:\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n enableTooltipWhenIsClosed: boolean;\n }\n\n export interface OptionalProps {\n actionRef?: React.MutableRefObject<{\n listRef: { [key: string]: HTMLElement };\n }>;\n }\n\n export interface Props extends DefaultProps, OptionalProps {}\n}\n\nexport const defaultProps: DSChatSidebarT.DefaultProps = {\n expanded: false,\n selectedItem: undefined,\n sidebarItems: [],\n onFooterExpand: noop,\n onFooterClose: noop,\n onHeaderExpand: noop,\n onHeaderClose: noop,\n footerButtonExtraProps: { 'aria-label': 'expand or collapse button' },\n tooltipPlacement: 'right',\n enableTooltipWhenIsClosed: false,\n};\n\nexport const chatSidebarProps = {\n sidebarItems: PropTypes.arrayOf(PropTypes.object)\n .description('The array of out-of-the-box items you want to render inside the sidebar nav of the chat')\n .defaultValue(defaultProps.sidebarItems),\n expanded: PropTypes.bool\n .description('Whether to show the chat expanded or collapsed')\n .defaultValue(defaultProps.expanded),\n selectedItem: PropTypes.string\n .description('The id of the chat item you want to be opened')\n .defaultValue(defaultProps.selectedItem),\n tooltipPlacement: PropTypes.oneOf([\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n ])\n .description('start placement preferences, as per popperjs placement option')\n .defaultValue(\"'right'\"),\n enableTooltipWhenIsClosed: PropTypes.bool\n .description('Enable tooltip when is closed')\n .defaultValue(defaultProps.onFooterExpand),\n onFooterExpand: PropTypes.func\n .description('The function to call when the chat is opened via the footer')\n .defaultValue(defaultProps.onFooterExpand),\n onFooterClose: PropTypes.func\n .description('The function to call when the chat is closed via the footer')\n .defaultValue(defaultProps.onFooterClose),\n onHeaderExpand: PropTypes.func\n .description('The function to call when the chat is opened via the header')\n .defaultValue(defaultProps.onHeaderExpand),\n onHeaderClose: PropTypes.func\n .description('The function to call when the chat is closed via the header')\n .defaultValue(defaultProps.onHeaderClose),\n footerButtonExtraProps: PropTypes.object\n .description('Expand/collapse footer button extra props')\n .defaultValue(defaultProps.footerButtonExtraProps),\n actionRef: PropTypes.object.description(\n `Action ref for sidebar\n {\n listRef: references to Tiles\n }\n `,\n ),\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAA0B;AAC1B,oBAAqB;AAqCd,MAAM,eAA4C;AAAA,EACvD,UAAU;AAAA,EACV,cAAc;AAAA,EACd,cAAc,CAAC;AAAA,EACf,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,wBAAwB,EAAE,cAAc,4BAA4B;AAAA,EACpE,kBAAkB;AAAA,EAClB,2BAA2B;AAC7B;AAEO,MAAM,mBAAmB;AAAA,EAC9B,cAAc,kCAAU,QAAQ,kCAAU,MAAM,EAC7C,YAAY,yFAAyF,EACrG,aAAa,aAAa,YAAY;AAAA,EACzC,UAAU,kCAAU,KACjB,YAAY,gDAAgD,EAC5D,aAAa,aAAa,QAAQ;AAAA,EACrC,cAAc,kCAAU,OACrB,YAAY,+CAA+C,EAC3D,aAAa,aAAa,YAAY;AAAA,EACzC,kBAAkB,kCAAU,MAAM;AAAA,IAChC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC,EACE,YAAY,+DAA+D,EAC3E,aAAa,SAAS;AAAA,EACzB,2BAA2B,kCAAU,KAClC,YAAY,+BAA+B,EAC3C,aAAa,aAAa,cAAc;AAAA,EAC3C,gBAAgB,kCAAU,KACvB,YAAY,6DAA6D,EACzE,aAAa,aAAa,cAAc;AAAA,EAC3C,eAAe,kCAAU,KACtB,YAAY,6DAA6D,EACzE,aAAa,aAAa,aAAa;AAAA,EAC1C,gBAAgB,kCAAU,KACvB,YAAY,6DAA6D,EACzE,aAAa,aAAa,cAAc;AAAA,EAC3C,eAAe,kCAAU,KACtB,YAAY,6DAA6D,EACzE,aAAa,aAAa,aAAa;AAAA,EAC1C,wBAAwB,kCAAU,OAC/B,YAAY,2CAA2C,EACvD,aAAa,aAAa,sBAAsB;AAAA,EACnD,WAAW,kCAAU,OAAO;AAAA,IAC1B;AAAA;AAAA;AAAA;AAAA;AAAA,EAKF;AACF;",
4
+ "sourcesContent": ["import type { DSChatTileT } from '@elliemae/ds-chat-tile';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport { noop } from 'lodash';\n\nexport declare namespace DSChatSidebarT {\n type TooltipPlacementT =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n\n export interface DefaultProps {\n sidebarItems: DSChatTileT.Props[];\n expanded: boolean;\n onFooterClose: () => void;\n onFooterExpand: () => void;\n onHeaderExpand: () => void;\n onHeaderClose: () => void;\n footerButtonExtraProps: Record<string, string>;\n tooltipPlacement: TooltipPlacementT;\n enableTooltipWhenIsClosed: boolean;\n }\n\n export interface OptionalProps {\n selectedItem?: string | number;\n actionRef?: React.MutableRefObject<{\n listRef: { [key: string]: HTMLElement };\n }>;\n }\n\n export interface Props extends Partial<DefaultProps>, OptionalProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps {}\n}\n\nexport const defaultProps: DSChatSidebarT.DefaultProps = {\n expanded: false,\n sidebarItems: [],\n onFooterExpand: noop,\n onFooterClose: noop,\n onHeaderExpand: noop,\n onHeaderClose: noop,\n footerButtonExtraProps: { 'aria-label': 'expand or collapse button' },\n tooltipPlacement: 'right',\n enableTooltipWhenIsClosed: false,\n};\n\nexport const chatSidebarProps = {\n sidebarItems: PropTypes.arrayOf(PropTypes.object)\n .description('The array of out-of-the-box items you want to render inside the sidebar nav of the chat')\n .defaultValue(defaultProps.sidebarItems),\n expanded: PropTypes.bool\n .description('Whether to show the chat expanded or collapsed')\n .defaultValue(defaultProps.expanded),\n selectedItem: PropTypes.string.description('The id of the chat item you want to be opened'),\n tooltipPlacement: PropTypes.oneOf([\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n ])\n .description('start placement preferences, as per popperjs placement option')\n .defaultValue(\"'right'\"),\n enableTooltipWhenIsClosed: PropTypes.bool\n .description('Enable tooltip when is closed')\n .defaultValue(defaultProps.onFooterExpand),\n onFooterExpand: PropTypes.func\n .description('The function to call when the chat is opened via the footer')\n .defaultValue(defaultProps.onFooterExpand),\n onFooterClose: PropTypes.func\n .description('The function to call when the chat is closed via the footer')\n .defaultValue(defaultProps.onFooterClose),\n onHeaderExpand: PropTypes.func\n .description('The function to call when the chat is opened via the header')\n .defaultValue(defaultProps.onHeaderExpand),\n onHeaderClose: PropTypes.func\n .description('The function to call when the chat is closed via the header')\n .defaultValue(defaultProps.onHeaderClose),\n footerButtonExtraProps: PropTypes.object\n .description('Expand/collapse footer button extra props')\n .defaultValue(defaultProps.footerButtonExtraProps),\n actionRef: PropTypes.object.description(\n `Action ref for sidebar\n {\n listRef: references to Tiles\n }\n `,\n ),\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAA0B;AAC1B,oBAAqB;AAyCd,MAAM,eAA4C;AAAA,EACvD,UAAU;AAAA,EACV,cAAc,CAAC;AAAA,EACf,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,wBAAwB,EAAE,cAAc,4BAA4B;AAAA,EACpE,kBAAkB;AAAA,EAClB,2BAA2B;AAC7B;AAEO,MAAM,mBAAmB;AAAA,EAC9B,cAAc,kCAAU,QAAQ,kCAAU,MAAM,EAC7C,YAAY,yFAAyF,EACrG,aAAa,aAAa,YAAY;AAAA,EACzC,UAAU,kCAAU,KACjB,YAAY,gDAAgD,EAC5D,aAAa,aAAa,QAAQ;AAAA,EACrC,cAAc,kCAAU,OAAO,YAAY,+CAA+C;AAAA,EAC1F,kBAAkB,kCAAU,MAAM;AAAA,IAChC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC,EACE,YAAY,+DAA+D,EAC3E,aAAa,SAAS;AAAA,EACzB,2BAA2B,kCAAU,KAClC,YAAY,+BAA+B,EAC3C,aAAa,aAAa,cAAc;AAAA,EAC3C,gBAAgB,kCAAU,KACvB,YAAY,6DAA6D,EACzE,aAAa,aAAa,cAAc;AAAA,EAC3C,eAAe,kCAAU,KACtB,YAAY,6DAA6D,EACzE,aAAa,aAAa,aAAa;AAAA,EAC1C,gBAAgB,kCAAU,KACvB,YAAY,6DAA6D,EACzE,aAAa,aAAa,cAAc;AAAA,EAC3C,eAAe,kCAAU,KACtB,YAAY,6DAA6D,EACzE,aAAa,aAAa,aAAa;AAAA,EAC1C,wBAAwB,kCAAU,OAC/B,YAAY,2CAA2C,EACvD,aAAa,aAAa,sBAAsB;AAAA,EACnD,WAAW,kCAAU,OAAO;AAAA,IAC1B;AAAA;AAAA;AAAA;AAAA;AAAA,EAKF;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var React = __toESM(require("react"));
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_react = require("react");
27
+ var import__ = require("../index.js");
28
+ var import_lodash = require("lodash");
29
+ const ref = (0, import_react.createRef)();
30
+ const MockSidebarItems = [
31
+ {
32
+ dsId: "1",
33
+ label: "AB",
34
+ title: "Example AB"
35
+ },
36
+ {
37
+ dsId: "2",
38
+ label: "ED",
39
+ title: "Example ED"
40
+ },
41
+ ,
42
+ ];
43
+ const testOptionalProps = {
44
+ actionRef: ref,
45
+ selectedItem: ""
46
+ };
47
+ const testPartialDefaults = {
48
+ sidebarItems: MockSidebarItems,
49
+ expanded: true,
50
+ tooltipPlacement: "bottom"
51
+ };
52
+ const testProps = {
53
+ ...testOptionalProps,
54
+ ...testPartialDefaults
55
+ };
56
+ const testPropsAsSyntax = {
57
+ ...testOptionalProps,
58
+ ...testPartialDefaults
59
+ };
60
+ const testCompleteDefaults = {
61
+ sidebarItems: MockSidebarItems,
62
+ expanded: false,
63
+ onFooterClose: import_lodash.noop,
64
+ onFooterExpand: import_lodash.noop,
65
+ onHeaderExpand: import_lodash.noop,
66
+ onHeaderClose: import_lodash.noop,
67
+ footerButtonExtraProps: { "aria-label": "expand or collapse button" },
68
+ tooltipPlacement: "bottom",
69
+ enableTooltipWhenIsClosed: false
70
+ };
71
+ const testInternalProps = {
72
+ ...testOptionalProps,
73
+ ...testCompleteDefaults
74
+ };
75
+ const testInternalPropsAsSyntax = {
76
+ ...testOptionalProps,
77
+ ...testCompleteDefaults
78
+ };
79
+ const testExplicitDefinition = {
80
+ sidebarItems: MockSidebarItems,
81
+ expanded: false,
82
+ onFooterClose: import_lodash.noop,
83
+ onFooterExpand: import_lodash.noop,
84
+ onHeaderExpand: import_lodash.noop,
85
+ onHeaderClose: import_lodash.noop,
86
+ footerButtonExtraProps: { "aria-label": "expand or collapse button" },
87
+ tooltipPlacement: "bottom",
88
+ enableTooltipWhenIsClosed: false
89
+ };
90
+ const testInferedTypeCompatibility = {
91
+ sidebarItems: MockSidebarItems,
92
+ expanded: false,
93
+ onFooterClose: import_lodash.noop,
94
+ onFooterExpand: import_lodash.noop,
95
+ onHeaderExpand: import_lodash.noop,
96
+ onHeaderClose: import_lodash.noop,
97
+ footerButtonExtraProps: { "aria-label": "expand or collapse button" },
98
+ tooltipPlacement: "bottom",
99
+ enableTooltipWhenIsClosed: false
100
+ };
101
+ const testDefinitionAsConst = {
102
+ sidebarItems: MockSidebarItems,
103
+ expanded: false,
104
+ onFooterClose: import_lodash.noop,
105
+ onFooterExpand: import_lodash.noop,
106
+ onHeaderExpand: import_lodash.noop,
107
+ onHeaderClose: import_lodash.noop,
108
+ footerButtonExtraProps: { "aria-label": "expand or collapse button" },
109
+ tooltipPlacement: "bottom",
110
+ enableTooltipWhenIsClosed: false
111
+ };
112
+ const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
113
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.SideBarChat, { ...testExplicitDefinition }),
114
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.SideBarChat, { ...testInferedTypeCompatibility }),
115
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.SideBarChat, { ...testDefinitionAsConst }),
116
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
117
+ import__.SideBarChat,
118
+ {
119
+ sidebarItems: MockSidebarItems,
120
+ expanded: true,
121
+ onFooterClose: import_lodash.noop,
122
+ onFooterExpand: import_lodash.noop,
123
+ onHeaderExpand: import_lodash.noop,
124
+ onHeaderClose: import_lodash.noop,
125
+ footerButtonExtraProps: { "aria-label": "expand or collapse button" },
126
+ tooltipPlacement: "bottom",
127
+ enableTooltipWhenIsClosed: false
128
+ }
129
+ )
130
+ ] });
131
+ //# sourceMappingURL=typescript-chat-sidebar-valid.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-chat-sidebar-valid.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { createRef } from 'react';\nimport type { DSChatTileT } from '@elliemae/ds-chat-tile';\nimport { SideBarChat } from '../index.js';\nimport type { DSChatSidebarT } from '../index.js';\nimport { noop } from 'lodash';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSChatSidebarT.Props;\ntype ComponentPropsInternals = DSChatSidebarT.InternalProps;\ntype ComponentPropsDefaultProps = DSChatSidebarT.DefaultProps;\ntype ComponentPropsOptionalProps = DSChatSidebarT.OptionalProps;\n\nconst ref = createRef() as React.MutableRefObject<{\n listRef: { [key: string]: HTMLElement };\n}>;\n\nconst MockSidebarItems = [\n {\n dsId: '1',\n label: 'AB',\n title: 'Example AB',\n },\n {\n dsId: '2',\n label: 'ED',\n title: 'Example ED',\n },\n ,\n] as DSChatTileT.Props[];\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n actionRef: ref,\n selectedItem: '',\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n sidebarItems: MockSidebarItems,\n expanded: true,\n tooltipPlacement: 'bottom',\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n sidebarItems: MockSidebarItems,\n expanded: false,\n onFooterClose: noop,\n onFooterExpand: noop,\n onHeaderExpand: noop,\n onHeaderClose: noop,\n footerButtonExtraProps: { 'aria-label': 'expand or collapse button' },\n tooltipPlacement: 'bottom',\n enableTooltipWhenIsClosed: false,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n sidebarItems: MockSidebarItems,\n expanded: false,\n onFooterClose: noop,\n onFooterExpand: noop,\n onHeaderExpand: noop,\n onHeaderClose: noop,\n footerButtonExtraProps: { 'aria-label': 'expand or collapse button' },\n tooltipPlacement: 'bottom',\n enableTooltipWhenIsClosed: false,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n sidebarItems: MockSidebarItems,\n expanded: false,\n onFooterClose: noop,\n onFooterExpand: noop,\n onHeaderExpand: noop,\n onHeaderClose: noop,\n footerButtonExtraProps: { 'aria-label': 'expand or collapse button' },\n tooltipPlacement: 'bottom',\n enableTooltipWhenIsClosed: false,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n sidebarItems: MockSidebarItems,\n expanded: false,\n onFooterClose: noop,\n onFooterExpand: noop,\n onHeaderExpand: noop,\n onHeaderClose: noop,\n footerButtonExtraProps: { 'aria-label': 'expand or collapse button' },\n tooltipPlacement: 'bottom',\n enableTooltipWhenIsClosed: false,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <SideBarChat {...testExplicitDefinition} />\n <SideBarChat {...testInferedTypeCompatibility} />\n <SideBarChat {...testDefinitionAsConst} />\n {/* works with inline values */}\n <SideBarChat\n sidebarItems={MockSidebarItems}\n expanded\n onFooterClose={noop}\n onFooterExpand={noop}\n onHeaderExpand={noop}\n onHeaderClose={noop}\n footerButtonExtraProps={{ 'aria-label': 'expand or collapse button' }}\n tooltipPlacement=\"bottom\"\n enableTooltipWhenIsClosed={false}\n />\n </>\n);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACoHrB;AAnHF,mBAA0B;AAE1B,eAA4B;AAE5B,oBAAqB;AAQrB,MAAM,UAAM,wBAAU;AAItB,MAAM,mBAAmB;AAAA,EACvB;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA;AACF;AAEA,MAAM,oBAAiD;AAAA,EACrD,WAAW;AAAA,EACX,cAAc;AAChB;AAIA,MAAM,sBAA2D;AAAA,EAC/D,cAAc;AAAA,EACd,UAAU;AAAA,EACV,kBAAkB;AACpB;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,cAAc;AAAA,EACd,UAAU;AAAA,EACV,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,wBAAwB,EAAE,cAAc,4BAA4B;AAAA,EACpE,kBAAkB;AAAA,EAClB,2BAA2B;AAC7B;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,cAAc;AAAA,EACd,UAAU;AAAA,EACV,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,wBAAwB,EAAE,cAAc,4BAA4B;AAAA,EACpE,kBAAkB;AAAA,EAClB,2BAA2B;AAC7B;AAGA,MAAM,+BAA+B;AAAA,EACnC,cAAc;AAAA,EACd,UAAU;AAAA,EACV,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,wBAAwB,EAAE,cAAc,4BAA4B;AAAA,EACpE,kBAAkB;AAAA,EAClB,2BAA2B;AAC7B;AAEA,MAAM,wBAAwB;AAAA,EAC5B,cAAc;AAAA,EACd,UAAU;AAAA,EACV,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,wBAAwB,EAAE,cAAc,4BAA4B;AAAA,EACpE,kBAAkB;AAAA,EAClB,2BAA2B;AAC7B;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,wBAAa,GAAG,wBAAwB;AAAA,EACzC,4CAAC,wBAAa,GAAG,8BAA8B;AAAA,EAC/C,4CAAC,wBAAa,GAAG,uBAAuB;AAAA,EAExC;AAAA,IAAC;AAAA;AAAA,MACC,cAAc;AAAA,MACd,UAAQ;AAAA,MACR,eAAe;AAAA,MACf,gBAAgB;AAAA,MAChB,gBAAgB;AAAA,MAChB,eAAe;AAAA,MACf,wBAAwB,EAAE,cAAc,4BAA4B;AAAA,MACpE,kBAAiB;AAAA,MACjB,2BAA2B;AAAA;AAAA,EAC7B;AAAA,GACF;",
6
+ "names": []
7
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/SideBarChat.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { WeakValidationMap } from 'react';\nimport React from 'react';\nimport { describe, useValidateTypescriptPropTypes, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { MenuCollapse, MenuExpand } from '@elliemae/ds-icons';\nimport { TileButton } from '@elliemae/ds-chat-tile';\nimport { StyledSideBarContainer, StyledSideBarButtonsContainer } from './styled.js';\nimport { SidebarButton } from './sidebar-button/SidebarButton.js';\nimport type { DSChatSidebarT } from './react-desc-prop-types.js';\nimport { defaultProps, chatSidebarProps } from './react-desc-prop-types.js';\nimport { DSChatSidebarName } from './DSChatSidebarDefinitions.js';\n\nconst FooterChat = ({\n expanded,\n onFooterClose,\n onFooterExpand,\n footerButtonExtraProps,\n}: Pick<DSChatSidebarT.DefaultProps, 'expanded' | 'onFooterClose' | 'onFooterExpand' | 'footerButtonExtraProps'>) => (\n <SidebarButton\n dsId=\"sidebar_footer\"\n Icon={!expanded ? MenuCollapse : MenuExpand}\n onClick={expanded ? onFooterClose : onFooterExpand}\n aria-pressed={expanded}\n aria-label={footerButtonExtraProps['aria-label']}\n />\n);\n\nconst SideBarChat: React.ComponentType<DSChatSidebarT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSChatSidebarT.Props>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, chatSidebarProps, DSChatSidebarName);\n\n const {\n sidebarItems,\n expanded,\n onFooterClose,\n onFooterExpand,\n selectedItem,\n footerButtonExtraProps,\n tooltipPlacement,\n enableTooltipWhenIsClosed,\n actionRef,\n } = propsWithDefault;\n const { current: listRef } = React.useRef<{ [key: string]: HTMLElement }>({});\n const registerReference = React.useCallback(\n (ref: HTMLElement) => {\n if (ref?.dataset?.key) listRef[ref.dataset.key] = ref;\n },\n [listRef],\n );\n React.useEffect(() => {\n if (actionRef?.current?.listRef) {\n actionRef.current.listRef = listRef;\n }\n }, [sidebarItems, expanded, actionRef, listRef]);\n\n return (\n <StyledSideBarContainer rows={['1fr', 'auto']}>\n <StyledSideBarButtonsContainer>\n {sidebarItems.map((p) => (\n <TileButton\n key={p.dsId}\n innerRef={registerReference}\n {...p}\n selected={selectedItem === p.dsId}\n tooltipPlacement={tooltipPlacement}\n disableTooltip={enableTooltipWhenIsClosed ? false : !expanded}\n />\n ))}\n </StyledSideBarButtonsContainer>\n <FooterChat\n expanded={expanded}\n onFooterClose={onFooterClose}\n onFooterExpand={onFooterExpand}\n footerButtonExtraProps={footerButtonExtraProps}\n />\n </StyledSideBarContainer>\n );\n};\n\nSideBarChat.propTypes = chatSidebarProps as WeakValidationMap<unknown>;\nSideBarChat.displayName = DSChatSidebarName;\nconst SideBarChatWithSchema = describe(SideBarChat);\nSideBarChatWithSchema.propTypes = chatSidebarProps as WeakValidationMap<unknown>;\n\nexport { SideBarChat, SideBarChatWithSchema };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACiBrB,cAsCE,YAtCF;AAhBF,OAAOA,YAAW;AAClB,SAAS,UAAU,gCAAgC,oCAAoC;AACvF,SAAS,cAAc,kBAAkB;AACzC,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB,qCAAqC;AACtE,SAAS,qBAAqB;AAE9B,SAAS,cAAc,wBAAwB;AAC/C,SAAS,yBAAyB;AAElC,MAAM,aAAa,CAAC;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MACE;AAAA,EAAC;AAAA;AAAA,IACC,MAAK;AAAA,IACL,MAAM,CAAC,WAAW,eAAe;AAAA,IACjC,SAAS,WAAW,gBAAgB;AAAA,IACpC,gBAAc;AAAA,IACd,cAAY,uBAAuB,YAAY;AAAA;AACjD;AAGF,MAAM,cAAyD,CAAC,UAAU;AACxE,QAAM,mBAAmB,6BAAmD,OAAO,YAAY;AAC/F,iCAA+B,kBAAkB,kBAAkB,iBAAiB;AAEpF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,SAAS,QAAQ,IAAIA,OAAM,OAAuC,CAAC,CAAC;AAC5E,QAAM,oBAAoBA,OAAM;AAAA,IAC9B,CAAC,QAAqB;AACpB,UAAI,KAAK,SAAS;AAAK,gBAAQ,IAAI,QAAQ,GAAG,IAAI;AAAA,IACpD;AAAA,IACA,CAAC,OAAO;AAAA,EACV;AACA,EAAAA,OAAM,UAAU,MAAM;AACpB,QAAI,WAAW,SAAS,SAAS;AAC/B,gBAAU,QAAQ,UAAU;AAAA,IAC9B;AAAA,EACF,GAAG,CAAC,cAAc,UAAU,WAAW,OAAO,CAAC;AAE/C,SACE,qBAAC,0BAAuB,MAAM,CAAC,OAAO,MAAM,GAC1C;AAAA,wBAAC,iCACE,uBAAa,IAAI,CAAC,MACjB;AAAA,MAAC;AAAA;AAAA,QAEC,UAAU;AAAA,QACT,GAAG;AAAA,QACJ,UAAU,iBAAiB,EAAE;AAAA,QAC7B;AAAA,QACA,gBAAgB,4BAA4B,QAAQ,CAAC;AAAA;AAAA,MALhD,EAAE;AAAA,IAMT,CACD,GACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;AAEA,YAAY,YAAY;AACxB,YAAY,cAAc;AAC1B,MAAM,wBAAwB,SAAS,WAAW;AAClD,sBAAsB,YAAY;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { WeakValidationMap } from 'react';\nimport React from 'react';\nimport { describe, useValidateTypescriptPropTypes, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { MenuCollapse, MenuExpand } from '@elliemae/ds-icons';\nimport { TileButton } from '@elliemae/ds-chat-tile';\nimport { StyledSideBarContainer, StyledSideBarButtonsContainer } from './styled.js';\nimport { SidebarButton } from './sidebar-button/SidebarButton.js';\nimport type { DSChatSidebarT } from './react-desc-prop-types.js';\nimport { defaultProps, chatSidebarProps } from './react-desc-prop-types.js';\nimport { DSChatSidebarName } from './DSChatSidebarDefinitions.js';\n\nconst FooterChat = ({\n expanded,\n onFooterClose,\n onFooterExpand,\n footerButtonExtraProps,\n}: Pick<DSChatSidebarT.DefaultProps, 'expanded' | 'onFooterClose' | 'onFooterExpand' | 'footerButtonExtraProps'>) => (\n <SidebarButton\n dsId=\"sidebar_footer\"\n Icon={!expanded ? MenuCollapse : MenuExpand}\n onClick={expanded ? onFooterClose : onFooterExpand}\n aria-pressed={expanded}\n aria-label={footerButtonExtraProps['aria-label']}\n />\n);\n\nconst SideBarChat: React.ComponentType<DSChatSidebarT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSChatSidebarT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, chatSidebarProps, DSChatSidebarName);\n const {\n sidebarItems,\n expanded,\n onFooterClose,\n onFooterExpand,\n selectedItem,\n footerButtonExtraProps,\n tooltipPlacement,\n enableTooltipWhenIsClosed,\n actionRef,\n } = propsWithDefault;\n const { current: listRef } = React.useRef<{ [key: string]: HTMLElement }>({});\n const registerReference = React.useCallback(\n (ref: HTMLElement) => {\n if (ref?.dataset?.key) listRef[ref.dataset.key] = ref;\n },\n [listRef],\n );\n React.useEffect(() => {\n if (actionRef?.current?.listRef) {\n actionRef.current.listRef = listRef;\n }\n }, [sidebarItems, expanded, actionRef, listRef]);\n\n return (\n <StyledSideBarContainer rows={['1fr', 'auto']}>\n <StyledSideBarButtonsContainer>\n {sidebarItems.map((p) => (\n <TileButton\n key={p.dsId}\n innerRef={registerReference}\n {...p}\n selected={selectedItem === p.dsId}\n tooltipPlacement={tooltipPlacement}\n disableTooltip={enableTooltipWhenIsClosed ? false : !expanded}\n />\n ))}\n </StyledSideBarButtonsContainer>\n <FooterChat\n expanded={expanded}\n onFooterClose={onFooterClose}\n onFooterExpand={onFooterExpand}\n footerButtonExtraProps={footerButtonExtraProps}\n />\n </StyledSideBarContainer>\n );\n};\n\nSideBarChat.propTypes = chatSidebarProps as WeakValidationMap<unknown>;\nSideBarChat.displayName = DSChatSidebarName;\nconst SideBarChatWithSchema = describe(SideBarChat);\nSideBarChatWithSchema.propTypes = chatSidebarProps as WeakValidationMap<unknown>;\n\nexport { SideBarChat, SideBarChatWithSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACiBrB,cAqCE,YArCF;AAhBF,OAAOA,YAAW;AAClB,SAAS,UAAU,gCAAgC,oCAAoC;AACvF,SAAS,cAAc,kBAAkB;AACzC,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB,qCAAqC;AACtE,SAAS,qBAAqB;AAE9B,SAAS,cAAc,wBAAwB;AAC/C,SAAS,yBAAyB;AAElC,MAAM,aAAa,CAAC;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MACE;AAAA,EAAC;AAAA;AAAA,IACC,MAAK;AAAA,IACL,MAAM,CAAC,WAAW,eAAe;AAAA,IACjC,SAAS,WAAW,gBAAgB;AAAA,IACpC,gBAAc;AAAA,IACd,cAAY,uBAAuB,YAAY;AAAA;AACjD;AAGF,MAAM,cAAyD,CAAC,UAAU;AACxE,QAAM,mBAAmB,6BAA2D,OAAO,YAAY;AACvG,iCAA+B,kBAAkB,kBAAkB,iBAAiB;AACpF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,SAAS,QAAQ,IAAIA,OAAM,OAAuC,CAAC,CAAC;AAC5E,QAAM,oBAAoBA,OAAM;AAAA,IAC9B,CAAC,QAAqB;AACpB,UAAI,KAAK,SAAS;AAAK,gBAAQ,IAAI,QAAQ,GAAG,IAAI;AAAA,IACpD;AAAA,IACA,CAAC,OAAO;AAAA,EACV;AACA,EAAAA,OAAM,UAAU,MAAM;AACpB,QAAI,WAAW,SAAS,SAAS;AAC/B,gBAAU,QAAQ,UAAU;AAAA,IAC9B;AAAA,EACF,GAAG,CAAC,cAAc,UAAU,WAAW,OAAO,CAAC;AAE/C,SACE,qBAAC,0BAAuB,MAAM,CAAC,OAAO,MAAM,GAC1C;AAAA,wBAAC,iCACE,uBAAa,IAAI,CAAC,MACjB;AAAA,MAAC;AAAA;AAAA,QAEC,UAAU;AAAA,QACT,GAAG;AAAA,QACJ,UAAU,iBAAiB,EAAE;AAAA,QAC7B;AAAA,QACA,gBAAgB,4BAA4B,QAAQ,CAAC;AAAA;AAAA,MALhD,EAAE;AAAA,IAMT,CACD,GACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;AAEA,YAAY,YAAY;AACxB,YAAY,cAAc;AAC1B,MAAM,wBAAwB,SAAS,WAAW;AAClD,sBAAsB,YAAY;",
6
6
  "names": ["React"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { SideBarChat, SideBarChatWithSchema } from './SideBarChat.js';\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { SideBarChat, SideBarChatWithSchema } from './SideBarChat.js';\nexport type { DSChatSidebarT } from './react-desc-prop-types.js';\n"],
5
5
  "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,aAAa,6BAA6B;",
6
6
  "names": []
7
7
  }
@@ -3,7 +3,6 @@ import { PropTypes } from "@elliemae/ds-props-helpers";
3
3
  import { noop } from "lodash";
4
4
  const defaultProps = {
5
5
  expanded: false,
6
- selectedItem: void 0,
7
6
  sidebarItems: [],
8
7
  onFooterExpand: noop,
9
8
  onFooterClose: noop,
@@ -16,7 +15,7 @@ const defaultProps = {
16
15
  const chatSidebarProps = {
17
16
  sidebarItems: PropTypes.arrayOf(PropTypes.object).description("The array of out-of-the-box items you want to render inside the sidebar nav of the chat").defaultValue(defaultProps.sidebarItems),
18
17
  expanded: PropTypes.bool.description("Whether to show the chat expanded or collapsed").defaultValue(defaultProps.expanded),
19
- selectedItem: PropTypes.string.description("The id of the chat item you want to be opened").defaultValue(defaultProps.selectedItem),
18
+ selectedItem: PropTypes.string.description("The id of the chat item you want to be opened"),
20
19
  tooltipPlacement: PropTypes.oneOf([
21
20
  "top-start",
22
21
  "top",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSChatTileT } from '@elliemae/ds-chat-tile';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport { noop } from 'lodash';\n\nexport declare namespace DSChatSidebarT {\n export interface DefaultProps {\n sidebarItems: DSChatTileT.Props[];\n expanded: boolean;\n selectedItem: undefined;\n onFooterClose: () => void;\n onFooterExpand: () => void;\n onHeaderExpand: () => void;\n onHeaderClose: () => void;\n footerButtonExtraProps: Record<string, string>;\n tooltipPlacement:\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n enableTooltipWhenIsClosed: boolean;\n }\n\n export interface OptionalProps {\n actionRef?: React.MutableRefObject<{\n listRef: { [key: string]: HTMLElement };\n }>;\n }\n\n export interface Props extends DefaultProps, OptionalProps {}\n}\n\nexport const defaultProps: DSChatSidebarT.DefaultProps = {\n expanded: false,\n selectedItem: undefined,\n sidebarItems: [],\n onFooterExpand: noop,\n onFooterClose: noop,\n onHeaderExpand: noop,\n onHeaderClose: noop,\n footerButtonExtraProps: { 'aria-label': 'expand or collapse button' },\n tooltipPlacement: 'right',\n enableTooltipWhenIsClosed: false,\n};\n\nexport const chatSidebarProps = {\n sidebarItems: PropTypes.arrayOf(PropTypes.object)\n .description('The array of out-of-the-box items you want to render inside the sidebar nav of the chat')\n .defaultValue(defaultProps.sidebarItems),\n expanded: PropTypes.bool\n .description('Whether to show the chat expanded or collapsed')\n .defaultValue(defaultProps.expanded),\n selectedItem: PropTypes.string\n .description('The id of the chat item you want to be opened')\n .defaultValue(defaultProps.selectedItem),\n tooltipPlacement: PropTypes.oneOf([\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n ])\n .description('start placement preferences, as per popperjs placement option')\n .defaultValue(\"'right'\"),\n enableTooltipWhenIsClosed: PropTypes.bool\n .description('Enable tooltip when is closed')\n .defaultValue(defaultProps.onFooterExpand),\n onFooterExpand: PropTypes.func\n .description('The function to call when the chat is opened via the footer')\n .defaultValue(defaultProps.onFooterExpand),\n onFooterClose: PropTypes.func\n .description('The function to call when the chat is closed via the footer')\n .defaultValue(defaultProps.onFooterClose),\n onHeaderExpand: PropTypes.func\n .description('The function to call when the chat is opened via the header')\n .defaultValue(defaultProps.onHeaderExpand),\n onHeaderClose: PropTypes.func\n .description('The function to call when the chat is closed via the header')\n .defaultValue(defaultProps.onHeaderClose),\n footerButtonExtraProps: PropTypes.object\n .description('Expand/collapse footer button extra props')\n .defaultValue(defaultProps.footerButtonExtraProps),\n actionRef: PropTypes.object.description(\n `Action ref for sidebar\n {\n listRef: references to Tiles\n }\n `,\n ),\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AAqCd,MAAM,eAA4C;AAAA,EACvD,UAAU;AAAA,EACV,cAAc;AAAA,EACd,cAAc,CAAC;AAAA,EACf,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,wBAAwB,EAAE,cAAc,4BAA4B;AAAA,EACpE,kBAAkB;AAAA,EAClB,2BAA2B;AAC7B;AAEO,MAAM,mBAAmB;AAAA,EAC9B,cAAc,UAAU,QAAQ,UAAU,MAAM,EAC7C,YAAY,yFAAyF,EACrG,aAAa,aAAa,YAAY;AAAA,EACzC,UAAU,UAAU,KACjB,YAAY,gDAAgD,EAC5D,aAAa,aAAa,QAAQ;AAAA,EACrC,cAAc,UAAU,OACrB,YAAY,+CAA+C,EAC3D,aAAa,aAAa,YAAY;AAAA,EACzC,kBAAkB,UAAU,MAAM;AAAA,IAChC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC,EACE,YAAY,+DAA+D,EAC3E,aAAa,SAAS;AAAA,EACzB,2BAA2B,UAAU,KAClC,YAAY,+BAA+B,EAC3C,aAAa,aAAa,cAAc;AAAA,EAC3C,gBAAgB,UAAU,KACvB,YAAY,6DAA6D,EACzE,aAAa,aAAa,cAAc;AAAA,EAC3C,eAAe,UAAU,KACtB,YAAY,6DAA6D,EACzE,aAAa,aAAa,aAAa;AAAA,EAC1C,gBAAgB,UAAU,KACvB,YAAY,6DAA6D,EACzE,aAAa,aAAa,cAAc;AAAA,EAC3C,eAAe,UAAU,KACtB,YAAY,6DAA6D,EACzE,aAAa,aAAa,aAAa;AAAA,EAC1C,wBAAwB,UAAU,OAC/B,YAAY,2CAA2C,EACvD,aAAa,aAAa,sBAAsB;AAAA,EACnD,WAAW,UAAU,OAAO;AAAA,IAC1B;AAAA;AAAA;AAAA;AAAA;AAAA,EAKF;AACF;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSChatTileT } from '@elliemae/ds-chat-tile';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport { noop } from 'lodash';\n\nexport declare namespace DSChatSidebarT {\n type TooltipPlacementT =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n\n export interface DefaultProps {\n sidebarItems: DSChatTileT.Props[];\n expanded: boolean;\n onFooterClose: () => void;\n onFooterExpand: () => void;\n onHeaderExpand: () => void;\n onHeaderClose: () => void;\n footerButtonExtraProps: Record<string, string>;\n tooltipPlacement: TooltipPlacementT;\n enableTooltipWhenIsClosed: boolean;\n }\n\n export interface OptionalProps {\n selectedItem?: string | number;\n actionRef?: React.MutableRefObject<{\n listRef: { [key: string]: HTMLElement };\n }>;\n }\n\n export interface Props extends Partial<DefaultProps>, OptionalProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps {}\n}\n\nexport const defaultProps: DSChatSidebarT.DefaultProps = {\n expanded: false,\n sidebarItems: [],\n onFooterExpand: noop,\n onFooterClose: noop,\n onHeaderExpand: noop,\n onHeaderClose: noop,\n footerButtonExtraProps: { 'aria-label': 'expand or collapse button' },\n tooltipPlacement: 'right',\n enableTooltipWhenIsClosed: false,\n};\n\nexport const chatSidebarProps = {\n sidebarItems: PropTypes.arrayOf(PropTypes.object)\n .description('The array of out-of-the-box items you want to render inside the sidebar nav of the chat')\n .defaultValue(defaultProps.sidebarItems),\n expanded: PropTypes.bool\n .description('Whether to show the chat expanded or collapsed')\n .defaultValue(defaultProps.expanded),\n selectedItem: PropTypes.string.description('The id of the chat item you want to be opened'),\n tooltipPlacement: PropTypes.oneOf([\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n ])\n .description('start placement preferences, as per popperjs placement option')\n .defaultValue(\"'right'\"),\n enableTooltipWhenIsClosed: PropTypes.bool\n .description('Enable tooltip when is closed')\n .defaultValue(defaultProps.onFooterExpand),\n onFooterExpand: PropTypes.func\n .description('The function to call when the chat is opened via the footer')\n .defaultValue(defaultProps.onFooterExpand),\n onFooterClose: PropTypes.func\n .description('The function to call when the chat is closed via the footer')\n .defaultValue(defaultProps.onFooterClose),\n onHeaderExpand: PropTypes.func\n .description('The function to call when the chat is opened via the header')\n .defaultValue(defaultProps.onHeaderExpand),\n onHeaderClose: PropTypes.func\n .description('The function to call when the chat is closed via the header')\n .defaultValue(defaultProps.onHeaderClose),\n footerButtonExtraProps: PropTypes.object\n .description('Expand/collapse footer button extra props')\n .defaultValue(defaultProps.footerButtonExtraProps),\n actionRef: PropTypes.object.description(\n `Action ref for sidebar\n {\n listRef: references to Tiles\n }\n `,\n ),\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AAyCd,MAAM,eAA4C;AAAA,EACvD,UAAU;AAAA,EACV,cAAc,CAAC;AAAA,EACf,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,wBAAwB,EAAE,cAAc,4BAA4B;AAAA,EACpE,kBAAkB;AAAA,EAClB,2BAA2B;AAC7B;AAEO,MAAM,mBAAmB;AAAA,EAC9B,cAAc,UAAU,QAAQ,UAAU,MAAM,EAC7C,YAAY,yFAAyF,EACrG,aAAa,aAAa,YAAY;AAAA,EACzC,UAAU,UAAU,KACjB,YAAY,gDAAgD,EAC5D,aAAa,aAAa,QAAQ;AAAA,EACrC,cAAc,UAAU,OAAO,YAAY,+CAA+C;AAAA,EAC1F,kBAAkB,UAAU,MAAM;AAAA,IAChC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC,EACE,YAAY,+DAA+D,EAC3E,aAAa,SAAS;AAAA,EACzB,2BAA2B,UAAU,KAClC,YAAY,+BAA+B,EAC3C,aAAa,aAAa,cAAc;AAAA,EAC3C,gBAAgB,UAAU,KACvB,YAAY,6DAA6D,EACzE,aAAa,aAAa,cAAc;AAAA,EAC3C,eAAe,UAAU,KACtB,YAAY,6DAA6D,EACzE,aAAa,aAAa,aAAa;AAAA,EAC1C,gBAAgB,UAAU,KACvB,YAAY,6DAA6D,EACzE,aAAa,aAAa,cAAc;AAAA,EAC3C,eAAe,UAAU,KACtB,YAAY,6DAA6D,EACzE,aAAa,aAAa,aAAa;AAAA,EAC1C,wBAAwB,UAAU,OAC/B,YAAY,2CAA2C,EACvD,aAAa,aAAa,sBAAsB;AAAA,EACnD,WAAW,UAAU,OAAO;AAAA,IAC1B;AAAA;AAAA;AAAA;AAAA;AAAA,EAKF;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,108 @@
1
+ import * as React from "react";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { createRef } from "react";
4
+ import { SideBarChat } from "../index.js";
5
+ import { noop } from "lodash";
6
+ const ref = createRef();
7
+ const MockSidebarItems = [
8
+ {
9
+ dsId: "1",
10
+ label: "AB",
11
+ title: "Example AB"
12
+ },
13
+ {
14
+ dsId: "2",
15
+ label: "ED",
16
+ title: "Example ED"
17
+ },
18
+ ,
19
+ ];
20
+ const testOptionalProps = {
21
+ actionRef: ref,
22
+ selectedItem: ""
23
+ };
24
+ const testPartialDefaults = {
25
+ sidebarItems: MockSidebarItems,
26
+ expanded: true,
27
+ tooltipPlacement: "bottom"
28
+ };
29
+ const testProps = {
30
+ ...testOptionalProps,
31
+ ...testPartialDefaults
32
+ };
33
+ const testPropsAsSyntax = {
34
+ ...testOptionalProps,
35
+ ...testPartialDefaults
36
+ };
37
+ const testCompleteDefaults = {
38
+ sidebarItems: MockSidebarItems,
39
+ expanded: false,
40
+ onFooterClose: noop,
41
+ onFooterExpand: noop,
42
+ onHeaderExpand: noop,
43
+ onHeaderClose: noop,
44
+ footerButtonExtraProps: { "aria-label": "expand or collapse button" },
45
+ tooltipPlacement: "bottom",
46
+ enableTooltipWhenIsClosed: false
47
+ };
48
+ const testInternalProps = {
49
+ ...testOptionalProps,
50
+ ...testCompleteDefaults
51
+ };
52
+ const testInternalPropsAsSyntax = {
53
+ ...testOptionalProps,
54
+ ...testCompleteDefaults
55
+ };
56
+ const testExplicitDefinition = {
57
+ sidebarItems: MockSidebarItems,
58
+ expanded: false,
59
+ onFooterClose: noop,
60
+ onFooterExpand: noop,
61
+ onHeaderExpand: noop,
62
+ onHeaderClose: noop,
63
+ footerButtonExtraProps: { "aria-label": "expand or collapse button" },
64
+ tooltipPlacement: "bottom",
65
+ enableTooltipWhenIsClosed: false
66
+ };
67
+ const testInferedTypeCompatibility = {
68
+ sidebarItems: MockSidebarItems,
69
+ expanded: false,
70
+ onFooterClose: noop,
71
+ onFooterExpand: noop,
72
+ onHeaderExpand: noop,
73
+ onHeaderClose: noop,
74
+ footerButtonExtraProps: { "aria-label": "expand or collapse button" },
75
+ tooltipPlacement: "bottom",
76
+ enableTooltipWhenIsClosed: false
77
+ };
78
+ const testDefinitionAsConst = {
79
+ sidebarItems: MockSidebarItems,
80
+ expanded: false,
81
+ onFooterClose: noop,
82
+ onFooterExpand: noop,
83
+ onHeaderExpand: noop,
84
+ onHeaderClose: noop,
85
+ footerButtonExtraProps: { "aria-label": "expand or collapse button" },
86
+ tooltipPlacement: "bottom",
87
+ enableTooltipWhenIsClosed: false
88
+ };
89
+ const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
90
+ /* @__PURE__ */ jsx(SideBarChat, { ...testExplicitDefinition }),
91
+ /* @__PURE__ */ jsx(SideBarChat, { ...testInferedTypeCompatibility }),
92
+ /* @__PURE__ */ jsx(SideBarChat, { ...testDefinitionAsConst }),
93
+ /* @__PURE__ */ jsx(
94
+ SideBarChat,
95
+ {
96
+ sidebarItems: MockSidebarItems,
97
+ expanded: true,
98
+ onFooterClose: noop,
99
+ onFooterExpand: noop,
100
+ onHeaderExpand: noop,
101
+ onHeaderClose: noop,
102
+ footerButtonExtraProps: { "aria-label": "expand or collapse button" },
103
+ tooltipPlacement: "bottom",
104
+ enableTooltipWhenIsClosed: false
105
+ }
106
+ )
107
+ ] });
108
+ //# sourceMappingURL=typescript-chat-sidebar-valid.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-chat-sidebar-valid.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { createRef } from 'react';\nimport type { DSChatTileT } from '@elliemae/ds-chat-tile';\nimport { SideBarChat } from '../index.js';\nimport type { DSChatSidebarT } from '../index.js';\nimport { noop } from 'lodash';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSChatSidebarT.Props;\ntype ComponentPropsInternals = DSChatSidebarT.InternalProps;\ntype ComponentPropsDefaultProps = DSChatSidebarT.DefaultProps;\ntype ComponentPropsOptionalProps = DSChatSidebarT.OptionalProps;\n\nconst ref = createRef() as React.MutableRefObject<{\n listRef: { [key: string]: HTMLElement };\n}>;\n\nconst MockSidebarItems = [\n {\n dsId: '1',\n label: 'AB',\n title: 'Example AB',\n },\n {\n dsId: '2',\n label: 'ED',\n title: 'Example ED',\n },\n ,\n] as DSChatTileT.Props[];\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n actionRef: ref,\n selectedItem: '',\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n sidebarItems: MockSidebarItems,\n expanded: true,\n tooltipPlacement: 'bottom',\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n sidebarItems: MockSidebarItems,\n expanded: false,\n onFooterClose: noop,\n onFooterExpand: noop,\n onHeaderExpand: noop,\n onHeaderClose: noop,\n footerButtonExtraProps: { 'aria-label': 'expand or collapse button' },\n tooltipPlacement: 'bottom',\n enableTooltipWhenIsClosed: false,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n sidebarItems: MockSidebarItems,\n expanded: false,\n onFooterClose: noop,\n onFooterExpand: noop,\n onHeaderExpand: noop,\n onHeaderClose: noop,\n footerButtonExtraProps: { 'aria-label': 'expand or collapse button' },\n tooltipPlacement: 'bottom',\n enableTooltipWhenIsClosed: false,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n sidebarItems: MockSidebarItems,\n expanded: false,\n onFooterClose: noop,\n onFooterExpand: noop,\n onHeaderExpand: noop,\n onHeaderClose: noop,\n footerButtonExtraProps: { 'aria-label': 'expand or collapse button' },\n tooltipPlacement: 'bottom',\n enableTooltipWhenIsClosed: false,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n sidebarItems: MockSidebarItems,\n expanded: false,\n onFooterClose: noop,\n onFooterExpand: noop,\n onHeaderExpand: noop,\n onHeaderClose: noop,\n footerButtonExtraProps: { 'aria-label': 'expand or collapse button' },\n tooltipPlacement: 'bottom',\n enableTooltipWhenIsClosed: false,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <SideBarChat {...testExplicitDefinition} />\n <SideBarChat {...testInferedTypeCompatibility} />\n <SideBarChat {...testDefinitionAsConst} />\n {/* works with inline values */}\n <SideBarChat\n sidebarItems={MockSidebarItems}\n expanded\n onFooterClose={noop}\n onFooterExpand={noop}\n onHeaderExpand={noop}\n onHeaderClose={noop}\n footerButtonExtraProps={{ 'aria-label': 'expand or collapse button' }}\n tooltipPlacement=\"bottom\"\n enableTooltipWhenIsClosed={false}\n />\n </>\n);\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACoHrB,mBAEE,KAFF;AAnHF,SAAS,iBAAiB;AAE1B,SAAS,mBAAmB;AAE5B,SAAS,YAAY;AAQrB,MAAM,MAAM,UAAU;AAItB,MAAM,mBAAmB;AAAA,EACvB;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA;AACF;AAEA,MAAM,oBAAiD;AAAA,EACrD,WAAW;AAAA,EACX,cAAc;AAChB;AAIA,MAAM,sBAA2D;AAAA,EAC/D,cAAc;AAAA,EACd,UAAU;AAAA,EACV,kBAAkB;AACpB;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,cAAc;AAAA,EACd,UAAU;AAAA,EACV,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,wBAAwB,EAAE,cAAc,4BAA4B;AAAA,EACpE,kBAAkB;AAAA,EAClB,2BAA2B;AAC7B;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,cAAc;AAAA,EACd,UAAU;AAAA,EACV,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,wBAAwB,EAAE,cAAc,4BAA4B;AAAA,EACpE,kBAAkB;AAAA,EAClB,2BAA2B;AAC7B;AAGA,MAAM,+BAA+B;AAAA,EACnC,cAAc;AAAA,EACd,UAAU;AAAA,EACV,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,wBAAwB,EAAE,cAAc,4BAA4B;AAAA,EACpE,kBAAkB;AAAA,EAClB,2BAA2B;AAC7B;AAEA,MAAM,wBAAwB;AAAA,EAC5B,cAAc;AAAA,EACd,UAAU;AAAA,EACV,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,wBAAwB,EAAE,cAAc,4BAA4B;AAAA,EACpE,kBAAkB;AAAA,EAClB,2BAA2B;AAC7B;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,eAAa,GAAG,wBAAwB;AAAA,EACzC,oBAAC,eAAa,GAAG,8BAA8B;AAAA,EAC/C,oBAAC,eAAa,GAAG,uBAAuB;AAAA,EAExC;AAAA,IAAC;AAAA;AAAA,MACC,cAAc;AAAA,MACd,UAAQ;AAAA,MACR,eAAe;AAAA,MACf,gBAAgB;AAAA,MAChB,gBAAgB;AAAA,MAChB,eAAe;AAAA,MACf,wBAAwB,EAAE,cAAc,4BAA4B;AAAA,MACpE,kBAAiB;AAAA,MACjB,2BAA2B;AAAA;AAAA,EAC7B;AAAA,GACF;",
6
+ "names": []
7
+ }
@@ -1 +1,2 @@
1
1
  export { SideBarChat, SideBarChatWithSchema } from './SideBarChat.js';
2
+ export type { DSChatSidebarT } from './react-desc-prop-types.js';
@@ -1,26 +1,29 @@
1
1
  /// <reference types="react" />
2
2
  import type { DSChatTileT } from '@elliemae/ds-chat-tile';
3
3
  export declare namespace DSChatSidebarT {
4
+ type TooltipPlacementT = 'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-end' | 'bottom' | 'bottom-start' | 'left-end' | 'left' | 'left-start';
4
5
  interface DefaultProps {
5
6
  sidebarItems: DSChatTileT.Props[];
6
7
  expanded: boolean;
7
- selectedItem: undefined;
8
8
  onFooterClose: () => void;
9
9
  onFooterExpand: () => void;
10
10
  onHeaderExpand: () => void;
11
11
  onHeaderClose: () => void;
12
12
  footerButtonExtraProps: Record<string, string>;
13
- tooltipPlacement: 'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-end' | 'bottom' | 'bottom-start' | 'left-end' | 'left' | 'left-start';
13
+ tooltipPlacement: TooltipPlacementT;
14
14
  enableTooltipWhenIsClosed: boolean;
15
15
  }
16
16
  interface OptionalProps {
17
+ selectedItem?: string | number;
17
18
  actionRef?: React.MutableRefObject<{
18
19
  listRef: {
19
20
  [key: string]: HTMLElement;
20
21
  };
21
22
  }>;
22
23
  }
23
- interface Props extends DefaultProps, OptionalProps {
24
+ interface Props extends Partial<DefaultProps>, OptionalProps {
25
+ }
26
+ interface InternalProps extends DefaultProps, OptionalProps {
24
27
  }
25
28
  }
26
29
  export declare const defaultProps: DSChatSidebarT.DefaultProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-chat-sidebar",
3
- "version": "3.28.1-rc.2",
3
+ "version": "3.29.0-next.0",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Chat Sidebar",
6
6
  "files": [
@@ -63,16 +63,16 @@
63
63
  "typeSafety": true
64
64
  },
65
65
  "dependencies": {
66
- "@elliemae/ds-chat-tile": "3.28.1-rc.2",
67
- "@elliemae/ds-props-helpers": "3.28.1-rc.2",
68
- "@elliemae/ds-icons": "3.28.1-rc.2",
69
- "@elliemae/ds-grid": "3.28.1-rc.2",
70
- "@elliemae/ds-system": "3.28.1-rc.2"
66
+ "@elliemae/ds-chat-tile": "3.29.0-next.0",
67
+ "@elliemae/ds-grid": "3.29.0-next.0",
68
+ "@elliemae/ds-icons": "3.29.0-next.0",
69
+ "@elliemae/ds-props-helpers": "3.29.0-next.0",
70
+ "@elliemae/ds-system": "3.29.0-next.0"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@elliemae/pui-cli": "~9.0.0-next.31",
74
74
  "styled-components": "~5.3.9",
75
- "@elliemae/ds-monorepo-devops": "3.28.1-rc.2"
75
+ "@elliemae/ds-monorepo-devops": "3.29.0-next.0"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "lodash": "^4.17.21",