@ebay/ui-core-react 7.1.0 → 7.2.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 +11 -8
- package/ebay-segmented-buttons/README.md +42 -0
- package/ebay-segmented-buttons/button.d.ts +5 -0
- package/ebay-segmented-buttons/button.d.ts.map +1 -0
- package/ebay-segmented-buttons/index.d.ts +4 -0
- package/ebay-segmented-buttons/index.d.ts.map +1 -0
- package/ebay-segmented-buttons/segmented-buttons.d.ts +5 -0
- package/ebay-segmented-buttons/segmented-buttons.d.ts.map +1 -0
- package/ebay-segmented-buttons/types.d.ts +16 -0
- package/ebay-segmented-buttons/types.d.ts.map +1 -0
- package/ebay-segmented-buttons.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,9 +6,9 @@ eBayUI React components
|
|
|
6
6
|
|
|
7
7
|
### Requirements
|
|
8
8
|
|
|
9
|
-
* [Node.js](https://nodejs.org/en/) (
|
|
10
|
-
* [React](https://reactjs.org/) (v16.8+)
|
|
11
|
-
* [eBay Skin](https://ebay.github.io/skin/) (
|
|
9
|
+
* [Node.js](https://nodejs.org/en/) (v20.12.2)
|
|
10
|
+
* [React](https://reactjs.org/) (v18+, v16.8+ in maintenance mode)
|
|
11
|
+
* [eBay Skin](https://ebay.github.io/skin/) (v18+)
|
|
12
12
|
|
|
13
13
|
### eBayUI Components
|
|
14
14
|
* [ ] `ebay-3d-viewer`
|
|
@@ -17,13 +17,13 @@ eBayUI React components
|
|
|
17
17
|
* [x] [ebay-badge](src/ebay-badge)
|
|
18
18
|
* [x] [ebay-breadcrumbs](src/ebay-breadcrumbs)
|
|
19
19
|
* [x] [ebay-button](src/ebay-button)
|
|
20
|
-
* [
|
|
20
|
+
* [x] [ebay-calendar](src/ebay-calendar)
|
|
21
21
|
* [x] [ebay-carousel](src/ebay-carousel)
|
|
22
22
|
* [x] [ebay-checkbox](src/ebay-checkbox)
|
|
23
23
|
* [ ] `ebay-combobox`
|
|
24
24
|
* [x] [ebay-confirm-dialog](src/ebay-confirm-dialog)
|
|
25
25
|
* [x] [ebay-cta-button](src/ebay-cta-button)
|
|
26
|
-
* [
|
|
26
|
+
* [x] [ebay-date-textbox](src/ebay-date-textbox)
|
|
27
27
|
* [ ] `ebay-details`
|
|
28
28
|
* [x] [ebay-drawer-dialog](src/ebay-drawer-dialog)
|
|
29
29
|
* [x] [ebay-eek](src/ebay-eek)
|
|
@@ -33,7 +33,7 @@ eBayUI React components
|
|
|
33
33
|
* [x] [ebay-fake-menu-button](src/ebay-fake-menu-button)
|
|
34
34
|
* [x] [ebay-fake-tabs](src/ebay-fake-tabs)
|
|
35
35
|
* [x] [ebay-field](src/ebay-field)
|
|
36
|
-
* [ ] `ebay-filter`
|
|
36
|
+
* [ ] `ebay-filter`
|
|
37
37
|
* [ ] `ebay-filter-menu`
|
|
38
38
|
* [ ] `ebay-filter-menu-button`
|
|
39
39
|
* [x] [ebay-icon-button](src/ebay-icon-button)
|
|
@@ -55,6 +55,7 @@ eBayUI React components
|
|
|
55
55
|
* [x] [ebay-radio](src/ebay-radio)
|
|
56
56
|
* [x] [ebay-section-title](src/ebay-section-title)
|
|
57
57
|
* [x] [ebay-section-notice](src/ebay-section-notice)
|
|
58
|
+
* [x] [ebay-segmented-buttons](src/ebay-segmented-buttons)
|
|
58
59
|
* [x] [ebay-select](src/ebay-select)
|
|
59
60
|
* [x] [ebay-signal](src/ebay-signal)
|
|
60
61
|
* [x] [ebay-snackbar-dialog](src/ebay-snackbar-dialog)
|
|
@@ -123,16 +124,18 @@ Create an issue on github
|
|
|
123
124
|
## Changelog
|
|
124
125
|
|
|
125
126
|
`@ebay/ui-core-react`
|
|
127
|
+
### version 7.x (Skin 18, breaking changes in icon names)
|
|
128
|
+
### version 6.x (Skin 17, breaking changes in icon names)
|
|
126
129
|
### version 5.x (Skin 16, breaking changes in event callbacks)
|
|
127
130
|
### version 4.x (Skin 16, breaking changes in icon names)
|
|
128
131
|
### version 3.x (Skin 15, some breaking changes in dialog components)
|
|
129
132
|
### version 2.x (Skin 15)
|
|
130
133
|
|
|
131
|
-
`@ebay/ebayui-core-react`
|
|
134
|
+
`@ebay/ebayui-core-react` (obsolete)
|
|
132
135
|
### version 10.x (Skin 14)
|
|
133
136
|
### version 9.x (skin 13)
|
|
134
137
|
|
|
135
|
-
`ebayui-core-react`
|
|
138
|
+
`ebayui-core-react` (obsolete)
|
|
136
139
|
### version 8.x (skin 12)
|
|
137
140
|
### version 6.x (skin 10)
|
|
138
141
|
### version 5.x (removed less, changed imports to minimize bundle size)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# EbaySegmentedButtons
|
|
2
|
+
|
|
3
|
+
## Demo
|
|
4
|
+
[Storybook](https://opensource.ebay.com/ebayui-core-react/main/?path=/story/buttons-ebay-segmented-buttons--default)
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
```
|
|
8
|
+
yarn add @ebay/ui-core-react @ebay/skin
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
```
|
|
13
|
+
import React from 'react'
|
|
14
|
+
import { EbaySegmentedButtons, EbaySegmentedButton as Button } from '@ebay/ui-core-react/ebay-segmented-buttons'
|
|
15
|
+
import { EbayIcon } from '@ebay/ui-core-react/ebay-icon'
|
|
16
|
+
import '@ebay/skin/segmented-buttons'
|
|
17
|
+
|
|
18
|
+
export const Example = () => (
|
|
19
|
+
<EbaySegmentedButtons
|
|
20
|
+
size="large"
|
|
21
|
+
onChange={(e, { i, value }) => console.log('Selected:', i, value)}
|
|
22
|
+
>
|
|
23
|
+
<Button value="1" selected>Button 1</Button>
|
|
24
|
+
<Button value="2">Button 2</Button>
|
|
25
|
+
<Button value="3"><EbayIcon name="settings24" /> Button 3</Button>
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## EbaySegmentedButtons Props
|
|
31
|
+
|
|
32
|
+
Name | Type | Required | Description
|
|
33
|
+
--- |----------| --- | ---
|
|
34
|
+
`size` | enum | No | Can be `regular` (default) or `large`
|
|
35
|
+
`onChange` | Function | No | props: (e: event, { index: number, value: string), triggered on selected button change
|
|
36
|
+
|
|
37
|
+
## EbaySegmentedButton Props
|
|
38
|
+
|
|
39
|
+
Name | Type | Required | Description
|
|
40
|
+
--- | --- |---------------------------------| ---
|
|
41
|
+
`value` | String | No | the value to use with `onChange` callback
|
|
42
|
+
`selected` | Boolean | No | Whether or not the button is selected
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/ebay-segmented-buttons/button.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAIjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAE9C,QAAA,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CA8B7C,CAAA;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-segmented-buttons/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AACrE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACzD,YAAY,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segmented-buttons.d.ts","sourceRoot":"","sources":["../../src/ebay-segmented-buttons/segmented-buttons.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAgB,EAAE,EAA0B,MAAM,OAAO,CAAA;AAEvE,OAAO,EAAwB,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAIrE,QAAA,MAAM,oBAAoB,EAAE,EAAE,CAAC,qBAAqB,CAsCnD,CAAA;AAED,eAAe,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { EbayChangeEventHandler, EbayMouseEventHandler } from '../common/event-utils/types';
|
|
3
|
+
export type SegmentedButtonProps = Omit<ComponentProps<'button'>, 'onClick'> & {
|
|
4
|
+
value?: string;
|
|
5
|
+
selected?: boolean;
|
|
6
|
+
onClick?: EbayMouseEventHandler<HTMLButtonElement>;
|
|
7
|
+
};
|
|
8
|
+
export type SegmentedButtonSize = 'large' | 'regular';
|
|
9
|
+
export type SegmentedButtonsProps = Omit<ComponentProps<'div'>, 'onChange'> & {
|
|
10
|
+
size?: SegmentedButtonSize;
|
|
11
|
+
onChange?: EbayChangeEventHandler<HTMLButtonElement, {
|
|
12
|
+
index: number;
|
|
13
|
+
value?: string;
|
|
14
|
+
}>;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ebay-segmented-buttons/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAE3F,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,GAAG;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,qBAAqB,CAAC,iBAAiB,CAAC,CAAC;CACtD,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,SAAS,CAAA;AAErD,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IAC1E,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,QAAQ,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3F,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),b=require("classnames"),d=require("./utils-C9NL3q0j.js"),i=require("./icon-DK6eEQD8.js"),E=({selected:o,children:n,className:u,...a})=>{const c=d.findComponent(n,i.EbayIcon),l=()=>{const r=d.excludeComponent(n,i.EbayIcon);return e.createElement("span",{className:"segmented-buttons__button-cell"},c,e.createElement("span",null,r))};return e.createElement("li",null,e.createElement("button",{className:b("segmented-buttons__button",u),"aria-current":o||void 0,...a},c?l():n))},x=({size:o,className:n,onChange:u=()=>{},children:a,...c})=>{const l=d.filterByType(a,E),[r,p]=e.useState(l.findIndex(t=>t.props.selected)||0),g=(t,s,m)=>{p(s),u(t,{index:s,value:m})};return e.createElement("div",{className:b("segmented-buttons",o&&`segmented-buttons--${o}`,n),...c},e.createElement("ul",null,l.map((t,s)=>{const{value:m,...y}=t.props;return e.cloneElement(t,{...y,onClick:S=>g(S,s,m),selected:s===r})})))};exports.EbaySegmentedButton=E;exports.EbaySegmentedButtons=x;
|