@ebay/ui-core-react 8.6.0 → 8.7.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.
- package/README.md +1 -0
- package/ebay-carousel/index.js +1 -1
- package/ebay-list/README.md +149 -0
- package/ebay-list/index.d.ts +5 -0
- package/ebay-list/index.d.ts.map +1 -0
- package/ebay-list/index.js +1 -0
- package/ebay-list/list-item-leading.d.ts +7 -0
- package/ebay-list/list-item-leading.d.ts.map +1 -0
- package/ebay-list/list-item-trailing.d.ts +7 -0
- package/ebay-list/list-item-trailing.d.ts.map +1 -0
- package/ebay-list/list-item.d.ts +11 -0
- package/ebay-list/list-item.d.ts.map +1 -0
- package/ebay-list/list.d.ts +8 -0
- package/ebay-list/list.d.ts.map +1 -0
- package/ebay-list/types.d.ts +6 -0
- package/ebay-list/types.d.ts.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,6 +56,7 @@ eBayUI React components
|
|
|
56
56
|
- [x] [ebay-inline-notice](src/ebay-inline-notice)
|
|
57
57
|
- [x] [ebay-lightbox-dialog](src/ebay-lightbox-dialog)
|
|
58
58
|
- [ ] `ebay-line-chart`
|
|
59
|
+
- [x] [ebay-list](src/ebay-list)
|
|
59
60
|
- [x] [ebay-listbox-button](src/ebay-listbox-button)
|
|
60
61
|
- [x] [ebay-listbox](src/ebay-listbox)
|
|
61
62
|
- [x] [ebay-menu](src/ebay-menu)
|
package/ebay-carousel/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("../tslib.es6-C4EgNkz1.js"),s=require("react"),q=require("classnames"),ee=require("../icon-C-bWGO-9.js"),W=require("../debounce-BQsYxxOL.js"),le=require("react-dom");require("../array.polyfill.flat-5BAolFdk.js");const ae=require("../reduced-motion-CMIhlQVx.js"),ce=require("../forwardRef-DBQKIlPy.js"),ie={prev:"chevronLeft16",next:"chevronRight16"},ue={prev:"LEFT",next:"RIGHT"},Y=({type:e,label:n,hidden:t,disabled:r,onClick:a})=>{const c=l=>{a(l,{direction:ue[e]})};return s.createElement("button",{className:q("carousel__control",`carousel__control--${e}`),"aria-label":n,"aria-disabled":r,disabled:r,onClick:c},s.createElement(ee.EbayIcon,{className:q("icon",`icon--carousel-${e}`),focusable:!1,name:ie[e],"aria-hidden":t}))};function fe(e){const n=e.parentElement,t=n?n.firstElementChild.getBoundingClientRect().left:0,{left:r,right:a}=e.getBoundingClientRect();return{left:r-t,right:a-t}}const de=e=>getComputedStyle(e).overflowX!=="visible",I=(e,n)=>{if(!e.length)return 0;const t=e[e.length-1];return Math.max(t.right-n,0)||0},he=(e,n,t)=>e.length&&Math.min(e[n].left,I(e,t))||0,me=(e,n,t,r,a,c)=>s.Children.map(e,(l,u)=>{const{style:f={}}=l.props;let i;if(t){const o=t+t%1;i=`calc(${100/o}% - ${(o-1)*c/o}px)`}const d=t?u%t===0:!0;return s.cloneElement(l,{slideWidth:r,offset:a,ref:o=>{n.current[u]=o},className:d?"carousel__snap-point":l.props.className,style:Object.assign(Object.assign({},f),{width:i||f.width,marginRight:c&&u!==s.Children.count(e)-1?`${c}px`:f.marginRight})})}),te=(e,n,t)=>{if(e>0){let r=e;return r%=n.length||1,r-=r%(t||1),r=Math.abs(r),r}return 0},ye=(e,n,t=e)=>{if(n)return Math.ceil(t/n)},Ee=e=>e==="LEFT"?-1:1,ge=(e,n,t,r,a)=>{let c=n,l;if(e==="LEFT"&&c===0)c=t.length-1;else{do{const u=Ee(e);l=t[c+=u]}while(l&&l.fullyVisible);if(e==="LEFT"&&!a){const u=l.right-r;do l=t[--c];while(l&&l.left>=u);c+=1}}return te(c,t,a)},pe=(e,n,t,r=1,a)=>{let c;if(e>=I(n,t)-a)c=n.length-1;else{const l=n.length;let u=0,f=Math.ceil(l/r)-1;for(;f-u>1;){const o=Math.floor((u+f)/2);e>n[o*r].left?u=o:f=o}const i=Math.abs(e-n[u*r].left),d=Math.abs(e-n[f*r].left);c=te((i>d?f:u)*r,n,r)}return c};function be({direction:e,nextIndex:n,currentIndex:t,itemsRef:r,slideWidth:a,gap:c,onAnimationStart:l,onAnimationEnd:u}){if(e==="RIGHT"&&n<t){let i=r.current[t].element.closest("ul");i.style.transition="none";const d=I(r.current,a)+a+c;for(let o=t;o>n;o--)r.current[o].element.style.transform=`translateX(${-d}px)`;i.style.transform=`translate3d(${a+c}px, 0, 0)`,l(),requestAnimationFrame(()=>{i.style.transition="",i.style.transform="translate3d(0, 0, 0)",i=null}),i.addEventListener("transitionend",()=>{requestAnimationFrame(()=>{for(let o=t;o>n;o--)r.current[o].element.style.transform="";u()})},{once:!0})}else if(e==="LEFT"&&n>t){let i=r.current[t].element.closest("ul");i.style.transition="none";const d=I(r.current,a)+a+c;for(let o=t;o<n;o++)r.current[o].element.style.transform=`translateX(${d}px)`;i.style.transform=`translate3d(${-d}px, 0, 0)`,l(),requestAnimationFrame(()=>{i.style.transition="",i.style.transform=`translate3d(${-d+a+c}px, 0, 0)`,i=null}),i.addEventListener("transitionend",()=>{requestAnimationFrame(()=>{for(let o=t;o<n;o++)r.current[o].element.style.transform="";u()})},{once:!0})}}const ve=(e,n)=>{let t,r,a;return function c(){const{scrollLeft:l}=e;if(a!==l){a=l,t=setTimeout(()=>{r=requestAnimationFrame(c)},90);return}n(a)}(),()=>{clearTimeout(t),cancelAnimationFrame(r)}},Se=typeof window<"u"&&"scrollBehavior"in document.body.style;function ne(e,n,t){if(Se)return e.scrollTo({left:n}),ve(e,t);let r,a,c=requestAnimationFrame(o=>{const{scrollLeft:L}=e,x=n-L,R=450;(function w(p){const b=p-o;if(b>R)return e.scrollLeft=n,l(),t();e.scrollLeft=Te(b/R)*x+L,c=requestAnimationFrame(w)})(o)});return e.addEventListener("touchstart",u),l;function l(){cancelAnimationFrame(c),r===void 0?i():(a&&a(),d())}function u(){l(),r=e.scrollLeft,e.addEventListener("touchend",f)}function f(){d(),r===e.scrollLeft&&(a=ne(e,n,t))}function i(){e.removeEventListener("touchstart",u)}function d(){e.removeEventListener("touchend",f)}}function Te(e){return e<.5?2*e*e:-1+(4-2*e)*e}const Ce=({gap:e=16,itemsPerSlide:n,slideWidth:t,offset:r,activeIndex:a,nextControlDisabled:c,isAutoplayEnabled:l,className:u,itemsRef:f,children:i,onSetActiveIndex:d,onScroll:o})=>{const[L,x]=s.useState(0),[R,w]=s.useState(!1),[p,b]=s.useState(!1),m=s.useRef(null),v=s.useRef(null);s.useEffect(()=>{if(!s.Children.count(i)||!m.current)return;if(R){w(!1);return}const E=m.current;de(E)
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("../tslib.es6-C4EgNkz1.js"),s=require("react"),q=require("classnames"),ee=require("../icon-C-bWGO-9.js"),W=require("../debounce-BQsYxxOL.js"),le=require("react-dom");require("../array.polyfill.flat-5BAolFdk.js");const ae=require("../reduced-motion-CMIhlQVx.js"),ce=require("../forwardRef-DBQKIlPy.js"),ie={prev:"chevronLeft16",next:"chevronRight16"},ue={prev:"LEFT",next:"RIGHT"},Y=({type:e,label:n,hidden:t,disabled:r,onClick:a})=>{const c=l=>{a(l,{direction:ue[e]})};return s.createElement("button",{className:q("carousel__control",`carousel__control--${e}`),"aria-label":n,"aria-disabled":r,disabled:r,onClick:c},s.createElement(ee.EbayIcon,{className:q("icon",`icon--carousel-${e}`),focusable:!1,name:ie[e],"aria-hidden":t}))};function fe(e){const n=e.parentElement,t=n?n.firstElementChild.getBoundingClientRect().left:0,{left:r,right:a}=e.getBoundingClientRect();return{left:r-t,right:a-t}}const de=e=>getComputedStyle(e).overflowX!=="visible",I=(e,n)=>{if(!e.length)return 0;const t=e[e.length-1];return Math.max(t.right-n,0)||0},he=(e,n,t)=>e.length&&Math.min(e[n].left,I(e,t))||0,me=(e,n,t,r,a,c)=>s.Children.map(e,(l,u)=>{const{style:f={}}=l.props;let i;if(t){const o=t+t%1;i=`calc(${100/o}% - ${(o-1)*c/o}px)`}const d=t?u%t===0:!0;return s.cloneElement(l,{slideWidth:r,offset:a,ref:o=>{n.current[u]=o},className:d?"carousel__snap-point":l.props.className,style:Object.assign(Object.assign({},f),{width:i||f.width,marginRight:c&&u!==s.Children.count(e)-1?`${c}px`:f.marginRight})})}),te=(e,n,t)=>{if(e>0){let r=e;return r%=n.length||1,r-=r%(t||1),r=Math.abs(r),r}return 0},ye=(e,n,t=e)=>{if(n)return Math.ceil(t/n)},Ee=e=>e==="LEFT"?-1:1,ge=(e,n,t,r,a)=>{let c=n,l;if(e==="LEFT"&&c===0)c=t.length-1;else{do{const u=Ee(e);l=t[c+=u]}while(l&&l.fullyVisible);if(e==="LEFT"&&!a){const u=l.right-r;do l=t[--c];while(l&&l.left>=u);c+=1}}return te(c,t,a)},pe=(e,n,t,r=1,a)=>{let c;if(e>=I(n,t)-a)c=n.length-1;else{const l=n.length;let u=0,f=Math.ceil(l/r)-1;for(;f-u>1;){const o=Math.floor((u+f)/2);e>n[o*r].left?u=o:f=o}const i=Math.abs(e-n[u*r].left),d=Math.abs(e-n[f*r].left);c=te((i>d?f:u)*r,n,r)}return c};function be({direction:e,nextIndex:n,currentIndex:t,itemsRef:r,slideWidth:a,gap:c,onAnimationStart:l,onAnimationEnd:u}){if(e==="RIGHT"&&n<t){let i=r.current[t].element.closest("ul");i.style.transition="none";const d=I(r.current,a)+a+c;for(let o=t;o>n;o--)r.current[o].element.style.transform=`translateX(${-d}px)`;i.style.transform=`translate3d(${a+c}px, 0, 0)`,l(),requestAnimationFrame(()=>{i.style.transition="",i.style.transform="translate3d(0, 0, 0)",i=null}),i.addEventListener("transitionend",()=>{requestAnimationFrame(()=>{for(let o=t;o>n;o--)r.current[o].element.style.transform="";u()})},{once:!0})}else if(e==="LEFT"&&n>t){let i=r.current[t].element.closest("ul");i.style.transition="none";const d=I(r.current,a)+a+c;for(let o=t;o<n;o++)r.current[o].element.style.transform=`translateX(${d}px)`;i.style.transform=`translate3d(${-d}px, 0, 0)`,l(),requestAnimationFrame(()=>{i.style.transition="",i.style.transform=`translate3d(${-d+a+c}px, 0, 0)`,i=null}),i.addEventListener("transitionend",()=>{requestAnimationFrame(()=>{for(let o=t;o<n;o++)r.current[o].element.style.transform="";u()})},{once:!0})}}const ve=(e,n)=>{let t,r,a;return function c(){const{scrollLeft:l}=e;if(a!==l){a=l,t=setTimeout(()=>{r=requestAnimationFrame(c)},90);return}n(a)}(),()=>{clearTimeout(t),cancelAnimationFrame(r)}},Se=typeof window<"u"&&"scrollBehavior"in document.body.style;function ne(e,n,t){if(Se)return e.scrollTo({left:n}),ve(e,t);let r,a,c=requestAnimationFrame(o=>{const{scrollLeft:L}=e,x=n-L,R=450;(function w(p){const b=p-o;if(b>R)return e.scrollLeft=n,l(),t();e.scrollLeft=Te(b/R)*x+L,c=requestAnimationFrame(w)})(o)});return e.addEventListener("touchstart",u),l;function l(){cancelAnimationFrame(c),r===void 0?i():(a&&a(),d())}function u(){l(),r=e.scrollLeft,e.addEventListener("touchend",f)}function f(){d(),r===e.scrollLeft&&(a=ne(e,n,t))}function i(){e.removeEventListener("touchstart",u)}function d(){e.removeEventListener("touchend",f)}}function Te(e){return e<.5?2*e*e:-1+(4-2*e)*e}const Ce=({gap:e=16,itemsPerSlide:n,slideWidth:t,offset:r,activeIndex:a,nextControlDisabled:c,isAutoplayEnabled:l,className:u,itemsRef:f,children:i,onSetActiveIndex:d,onScroll:o})=>{const[L,x]=s.useState(0),[R,w]=s.useState(!1),[p,b]=s.useState(!1),m=s.useRef(null),v=s.useRef(null);s.useEffect(()=>{if(!s.Children.count(i)||!m.current)return;if(R){w(!1);return}const E=m.current;if(de(E))return b(!0),ne(E,r,()=>b(!1));x(r)},[r]);const y=s.useCallback(()=>{const _=m.current.scrollLeft,E=pe(_,f.current,t,n,e);E!==a&&(w(!0),d(E),o({index:E}))},[m.current,t,a,d]),M=()=>{v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{p||y()},640)};return s.createElement("div",{className:q("carousel__viewport",{"carousel__viewport--mask":!c&&!l},u)},s.createElement("ul",{className:"carousel__list",ref:m,onScroll:M,style:{transform:`translate3d(${-L}px, 0, 0)`}},me(i,f,n,t,r,e)))},Le=le.flushSync||(e=>e()),Re=e=>{var{gap:n=16,index:t=0,itemsPerSlide:r,a11yPreviousText:a,a11yNextText:c,a11yPauseText:l,a11yPlayText:u,autoplay:f,onScroll:i=()=>{},onNext:d=()=>{},onPrevious:o=()=>{},onSlide:L=()=>{},onPlay:x=()=>{},onPause:R=()=>{},className:w,children:p}=e,b=Z.__rest(e,["gap","index","itemsPerSlide","a11yPreviousText","a11yNextText","a11yPauseText","a11yPlayText","autoplay","onScroll","onNext","onPrevious","onSlide","onPlay","onPause","className","children"]);const[m,v]=s.useState(t),[y,M]=s.useState(0),[_,E]=s.useState(0),[k,D]=s.useState(!1),F=s.useRef(null),S=s.useRef([]),O=s.Children.count(p),T=Math.floor(r)||void 0,j=O<=T,g=!!f,re=j||_===0&&!g,H=j||_===I(S.current,y)&&!g,V=()=>{if(!F.current)return;const{width:h}=F.current.getBoundingClientRect();M(h)};s.useEffect(()=>(window.addEventListener("resize",W.debounce(V,16)),()=>{window.removeEventListener("resize",W.debounce(V,16))}),[]);const[G,X]=s.useState(!1);s.useEffect(()=>{G||E(he(S.current,m,y))},[m,y,G]),s.useEffect(()=>{t>=0&&t<=O-1&&v(t)},[t]),s.useEffect(()=>{S.current=S.current.splice(0,O)},[p]),s.useEffect(()=>{const{width:h}=F.current.getBoundingClientRect();M(h)},[F.current]);const A=ae.useReducedMotion(),[N,U]=s.useState(A);s.useEffect(()=>{U(A)},[A]);const se=h=>{U(!N),N?x(h):R(h)},J=s.useRef(m);J.current=m;const K=(h,C)=>{const P=J.current,z=ge(h,P,S.current,y,C),oe=ye(P,C,z);L({slide:oe}),g&&be({direction:h,nextIndex:z,currentIndex:P,itemsRef:S,slideWidth:y,gap:n,onAnimationStart:()=>X(!0),onAnimationEnd:()=>X(!1)}),Le(()=>v(z))};s.useEffect(()=>{if(!g||N||k)return;const C=setInterval(()=>{K("RIGHT",T)},typeof f=="number"?f:4e3);return()=>clearInterval(C)},[g,N,T,k]);const Q=(h,{direction:C})=>{K(C,T),C==="LEFT"?o(h):d(h)},$=()=>D(!0),B=()=>D(!1);return s.createElement("div",Object.assign({className:q("carousel",w,{"carousel--slides":T,"carousel--peek":T%1===0,carousel__autoplay:g})},b),s.createElement("div",{ref:F,className:"carousel__container",onFocusCapture:$,onMouseEnter:$,onTouchStartCapture:$,onBlurCapture:B,onMouseLeave:B,onTouchEndCapture:B},s.createElement(Y,{label:a,type:"prev",disabled:re,onClick:Q}),s.createElement(Ce,{itemsRef:S,offset:_,gap:n,itemsPerSlide:T,nextControlDisabled:H,isAutoplayEnabled:g,activeIndex:m,onScroll:i,onSetActiveIndex:v,slideWidth:y},p),s.createElement(Y,{type:"next",label:c,disabled:H,onClick:Q}),g?s.createElement("button",{className:"carousel__playback",type:"button",onClick:se,"aria-label":N?u:l},s.createElement(ee.EbayIcon,{name:N?"play24":"pause24"})):null))},we=e=>{var{slideWidth:n,offset:t,forwardedRef:r,children:a}=e,c=Z.__rest(e,["slideWidth","offset","forwardedRef","children"]);const l=s.useRef(null),[u,f]=s.useState(!1);return s.useImperativeHandle(r,()=>{if(!l.current)return;const{left:i,right:d}=fe(l.current),o=i===void 0||i-t>=-.01&&d-t<=n+.01;return f(o),{element:l.current,left:i,right:d,fullyVisible:o}},[n,t]),s.createElement("li",Object.assign({},c,{ref:l,"aria-hidden":!u}),a)},_e=ce.withForwardRef(we);exports.EbayCarousel=Re;exports.EbayCarouselItem=_e;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# EbayList
|
|
2
|
+
|
|
3
|
+
A versatile list component for displaying items with optional leading and trailing content.
|
|
4
|
+
|
|
5
|
+
## Demo
|
|
6
|
+
|
|
7
|
+
[Storybook](https://opensource.ebay.com/ebayui-core-react/main/?path=/docs/building-blocks-ebay-list--docs)
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
### Import JS
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
import { EbayList, EbayListItem, EbayListItemLeading, EbayListItemTrailing } from "@ebay/ui-core-react/ebay-list";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Import following styles from SKIN
|
|
18
|
+
|
|
19
|
+
```jsx harmony
|
|
20
|
+
import "@ebay/skin/list";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### If tokens haven't been added to the project at a higher level, make sure to import
|
|
24
|
+
|
|
25
|
+
```jsx harmony
|
|
26
|
+
import "@ebay/skin/tokens";
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Or import styles using SCSS/CSS
|
|
30
|
+
|
|
31
|
+
```jsx harmony
|
|
32
|
+
import "@ebay/skin/list.css";
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Examples
|
|
36
|
+
|
|
37
|
+
### Basic List
|
|
38
|
+
|
|
39
|
+
```jsx
|
|
40
|
+
<EbayList>
|
|
41
|
+
<EbayListItem>Item 1</EbayListItem>
|
|
42
|
+
<EbayListItem>Item 2</EbayListItem>
|
|
43
|
+
<EbayListItem>Item 3</EbayListItem>
|
|
44
|
+
</EbayList>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### List with Leading and Trailing Content (Method 1 - Using Components)
|
|
48
|
+
|
|
49
|
+
```jsx
|
|
50
|
+
<EbayList>
|
|
51
|
+
<EbayListItem>
|
|
52
|
+
<EbayListItemLeading>
|
|
53
|
+
<EbayIcon name="folder16" />
|
|
54
|
+
</EbayListItemLeading>
|
|
55
|
+
Item 1
|
|
56
|
+
</EbayListItem>
|
|
57
|
+
<EbayListItem>
|
|
58
|
+
<EbayListItemLeading>
|
|
59
|
+
<EbayIcon name="lamp16" />
|
|
60
|
+
</EbayListItemLeading>
|
|
61
|
+
Item 2
|
|
62
|
+
<EbayListItemTrailing>
|
|
63
|
+
<EbayIcon name="chevronRight16" />
|
|
64
|
+
</EbayListItemTrailing>
|
|
65
|
+
</EbayListItem>
|
|
66
|
+
</EbayList>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Interactive List Items
|
|
70
|
+
|
|
71
|
+
```jsx
|
|
72
|
+
<EbayList onButtonClick={(event, { index }) => console.log(`Button ${index} clicked`)}>
|
|
73
|
+
<EbayListItem as="button">Clickable Button Item</EbayListItem>
|
|
74
|
+
<EbayListItem as="a" href="https://www.ebay.com">
|
|
75
|
+
Link Item
|
|
76
|
+
<EbayListItemTrailing>
|
|
77
|
+
<EbayIcon name="chevronRight16" />
|
|
78
|
+
</EbayListItemTrailing>
|
|
79
|
+
</EbayListItem>
|
|
80
|
+
<EbayListItem id="switch-item">
|
|
81
|
+
Item with Switch
|
|
82
|
+
<EbayListItemTrailing>
|
|
83
|
+
<EbaySwitch aria-labelledby="switch-item" />
|
|
84
|
+
</EbayListItemTrailing>
|
|
85
|
+
</EbayListItem>
|
|
86
|
+
</EbayList>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### List with Separators
|
|
90
|
+
|
|
91
|
+
```jsx
|
|
92
|
+
<EbayList>
|
|
93
|
+
<EbayListItem>Item 1</EbayListItem>
|
|
94
|
+
<EbayListItem separator />
|
|
95
|
+
<EbayListItem>Item 2</EbayListItem>
|
|
96
|
+
<EbayListItem>Item 3</EbayListItem>
|
|
97
|
+
<EbayListItem separator />
|
|
98
|
+
<EbayListItem>Item 4</EbayListItem>
|
|
99
|
+
</EbayList>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Components
|
|
103
|
+
|
|
104
|
+
### EbayList
|
|
105
|
+
|
|
106
|
+
The main container component that wraps a list of EbayListItem components.
|
|
107
|
+
|
|
108
|
+
### EbayListItem
|
|
109
|
+
|
|
110
|
+
Individual list items that can be rendered as different elements (div, button, a) and can contain leading and trailing content.
|
|
111
|
+
|
|
112
|
+
### EbayListItemLeading
|
|
113
|
+
|
|
114
|
+
Component for adding leading content to a list item.
|
|
115
|
+
|
|
116
|
+
### EbayListItemTrailing
|
|
117
|
+
|
|
118
|
+
Component for adding trailing content to a list item.
|
|
119
|
+
|
|
120
|
+
## Attributes
|
|
121
|
+
|
|
122
|
+
### EbayList Attributes
|
|
123
|
+
|
|
124
|
+
| Name | Type | Required | Description |
|
|
125
|
+
| --------------- | -------- | -------- | --------------------------------------------------------------------------------------------- |
|
|
126
|
+
| `onButtonClick` | Function | No | Called when a list item with `as="button"` is clicked. Callback receives `(event, { index })` |
|
|
127
|
+
| `className` | String | No | Custom class name |
|
|
128
|
+
| `style` | Object | No | Custom styles |
|
|
129
|
+
|
|
130
|
+
### EbayListItem Attributes
|
|
131
|
+
|
|
132
|
+
| Name | Type | Required | Description |
|
|
133
|
+
| ----------- | -------- | -------- | ------------------------------------------------------------------------------------ |
|
|
134
|
+
| `as` | String | No | The element to render the item as. Can be 'div', 'button', or 'a'. Default is 'div'. |
|
|
135
|
+
| `separator` | Boolean | No | If true, will render the current item as a separator |
|
|
136
|
+
| `onClick` | Function | No | Called when the list item is clicked |
|
|
137
|
+
| `className` | String | No | Custom class name |
|
|
138
|
+
|
|
139
|
+
### EbayListItemLeading Attributes
|
|
140
|
+
|
|
141
|
+
| Name | Type | Required | Description |
|
|
142
|
+
| ---------- | --------- | -------- | ----------------------------------------- |
|
|
143
|
+
| `children` | ReactNode | Yes | Content to display in the leading section |
|
|
144
|
+
|
|
145
|
+
### EbayListItemTrailing Attributes
|
|
146
|
+
|
|
147
|
+
| Name | Type | Required | Description |
|
|
148
|
+
| ---------- | --------- | -------- | ------------------------------------------ |
|
|
149
|
+
| `children` | ReactNode | Yes | Content to display in the trailing section |
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as EbayList, type EbayListProps } from "./list";
|
|
2
|
+
export { default as EbayListItem, type EbayListItemProps } from "./list-item";
|
|
3
|
+
export { default as EbayListItemLeading } from "./list-item-leading";
|
|
4
|
+
export { default as EbayListItemTrailing } from "./list-item-trailing";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-list/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("../tslib.es6-C4EgNkz1.js"),e=require("react"),p=require("classnames"),s=require("../utils-C9NL3q0j.js"),u=({children:t})=>e.createElement("div",{className:"list__leading"},t),E=({children:t})=>e.createElement("div",{className:"list__trailing"},t),g=t=>{var{className:i,as:a="div",separator:r,children:n,onClick:c}=t,o=C.__rest(t,["className","as","separator","children","onClick"]);if(r)return e.createElement("hr",null);const l=s.findComponent(n,u),m=s.findComponent(n,E),d=s.excludeComponent(s.excludeComponent(n,u),E);return e.createElement("li",null,e.createElement(a,Object.assign({className:p("list__body",i),onClick:c},o),l,e.createElement("div",{className:"list__body"},d),m))},L=t=>{var{className:i,style:a,children:r,onButtonClick:n=()=>{}}=t,c=C.__rest(t,["className","style","children","onButtonClick"]);const o=s.filterByType(r,g);return e.createElement("div",Object.assign({className:p("list",i),style:a},c),e.createElement("ul",null,e.Children.map(o,(l,m)=>{const{as:d,onClick:b}=l.props,_=d==="button"?{onClick:y=>{b&&b(y),n(y,{index:m})}}:{};return e.cloneElement(l,_)})))};exports.EbayList=L;exports.EbayListItem=g;exports.EbayListItemLeading=u;exports.EbayListItemTrailing=E;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
type EbayListItemLeadingProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
export declare const EbayListItemLeading: React.FC<EbayListItemLeadingProps>;
|
|
6
|
+
export default EbayListItemLeading;
|
|
7
|
+
//# sourceMappingURL=list-item-leading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-item-leading.d.ts","sourceRoot":"","sources":["../../src/ebay-list/list-item-leading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,KAAK,wBAAwB,GAAG;IAC5B,QAAQ,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAElE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
type EbayListItemTrailingProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
declare const EbayListItemTrailing: React.FC<EbayListItemTrailingProps>;
|
|
6
|
+
export default EbayListItemTrailing;
|
|
7
|
+
//# sourceMappingURL=list-item-trailing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-item-trailing.d.ts","sourceRoot":"","sources":["../../src/ebay-list/list-item-trailing.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,KAAK,yBAAyB,GAAG;IAC7B,QAAQ,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAE7D,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { ElementType, FC, ReactNode } from "react";
|
|
2
|
+
export type EbayListItemProps = {
|
|
3
|
+
as?: ElementType;
|
|
4
|
+
separator?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
} & React.HTMLAttributes<HTMLElement>;
|
|
9
|
+
declare const EbayListItem: FC<EbayListItemProps>;
|
|
10
|
+
export default EbayListItem;
|
|
11
|
+
//# sourceMappingURL=list-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-item.d.ts","sourceRoot":"","sources":["../../src/ebay-list/list-item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAM1D,MAAM,MAAM,iBAAiB,GAAG;IAC5B,EAAE,CAAC,EAAE,WAAW,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB,GAAG,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;AAEtC,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CA0BvC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComponentProps, FC } from "react";
|
|
2
|
+
import { ListItemClickHandler } from "./types";
|
|
3
|
+
export type EbayListProps = ComponentProps<"div"> & {
|
|
4
|
+
onButtonClick?: ListItemClickHandler;
|
|
5
|
+
};
|
|
6
|
+
declare const EbayList: FC<EbayListProps>;
|
|
7
|
+
export default EbayList;
|
|
8
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/ebay-list/list.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAwC,MAAM,OAAO,CAAC;AAIxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAChD,aAAa,CAAC,EAAE,oBAAoB,CAAC;CACxC,CAAC;AAEF,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CA4B/B,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ebay-list/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,sBAAsB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CAAC"}
|