@ebay/ui-core-react 4.2.6 → 5.0.1
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/common/event-utils/index.d.ts +10 -7
- package/common/event-utils/index.d.ts.map +1 -1
- package/common/event-utils/index.js +11 -3
- package/common/event-utils/types.d.ts +7 -0
- package/common/event-utils/types.d.ts.map +1 -1
- package/common/event-utils/types.js +12 -0
- package/common/floating-label-utils/hooks.d.ts +2 -1
- package/common/floating-label-utils/hooks.d.ts.map +1 -1
- package/common/floating-label-utils/hooks.js +5 -4
- package/ebay-alert-dialog/README.md +3 -2
- package/ebay-alert-dialog/alert-dialog.d.ts +0 -1
- package/ebay-alert-dialog/alert-dialog.d.ts.map +1 -1
- package/ebay-alert-dialog/alert-dialog.js +1 -1
- package/ebay-breadcrumbs/README.md +1 -1
- package/ebay-breadcrumbs/breadcrumbs.d.ts +3 -2
- package/ebay-breadcrumbs/breadcrumbs.d.ts.map +1 -1
- package/ebay-breadcrumbs/breadcrumbs.js +1 -1
- package/ebay-button/README.md +4 -4
- package/ebay-carousel/carousel-control-button.js +2 -2
- package/ebay-carousel/carousel.js +1 -1
- package/ebay-checkbox/README.md +11 -10
- package/ebay-checkbox/checkbox.d.ts +15 -3
- package/ebay-checkbox/checkbox.d.ts.map +1 -1
- package/ebay-checkbox/checkbox.js +9 -4
- package/ebay-confirm-dialog/README.md +6 -6
- package/ebay-confirm-dialog/confirm-dialog.d.ts +0 -1
- package/ebay-confirm-dialog/confirm-dialog.d.ts.map +1 -1
- package/ebay-confirm-dialog/confirm-dialog.js +1 -1
- package/ebay-dialog-base/components/dialogBase.d.ts +3 -2
- package/ebay-dialog-base/components/dialogBase.d.ts.map +1 -1
- package/ebay-dialog-base/components/dialogBase.js +6 -3
- package/ebay-drawer-dialog/README.md +7 -6
- package/ebay-drawer-dialog/components/drawer.d.ts +3 -0
- package/ebay-drawer-dialog/components/drawer.d.ts.map +1 -1
- package/ebay-fake-menu/README.md +5 -5
- package/ebay-fake-menu/menu-item.d.ts +1 -1
- package/ebay-fake-menu/menu-item.d.ts.map +1 -1
- package/ebay-fake-menu/menu.d.ts +9 -5
- package/ebay-fake-menu/menu.d.ts.map +1 -1
- package/ebay-fake-menu/menu.js +2 -2
- package/ebay-fake-menu-button/README.md +9 -4
- package/ebay-fake-menu-button/menu-button.d.ts +9 -2
- package/ebay-fake-menu-button/menu-button.d.ts.map +1 -1
- package/ebay-fake-menu-button/menu-button.js +7 -5
- package/ebay-fullscreen-dialog/fullscreen-dialog.d.ts +0 -1
- package/ebay-fullscreen-dialog/fullscreen-dialog.d.ts.map +1 -1
- package/ebay-fullscreen-dialog/fullscreen-dialog.js +1 -1
- package/ebay-icon/types.d.ts +1 -1
- package/ebay-icon/types.d.ts.map +1 -1
- package/ebay-icon-button/README.md +9 -0
- package/ebay-icon-button/icon-button.d.ts +3 -1
- package/ebay-icon-button/icon-button.d.ts.map +1 -1
- package/ebay-icon-button/icon-button.js +8 -2
- package/ebay-lightbox-dialog/lightbox-dialog.d.ts +0 -1
- package/ebay-lightbox-dialog/lightbox-dialog.d.ts.map +1 -1
- package/ebay-lightbox-dialog/lightbox-dialog.js +1 -1
- package/ebay-listbox-button/README.md +8 -1
- package/ebay-listbox-button/listbox-button.d.ts +11 -3
- package/ebay-listbox-button/listbox-button.d.ts.map +1 -1
- package/ebay-listbox-button/listbox-button.js +41 -16
- package/ebay-menu/README.md +5 -4
- package/ebay-menu/menu-item.d.ts +1 -1
- package/ebay-menu/menu-item.d.ts.map +1 -1
- package/ebay-menu/menu.d.ts +4 -4
- package/ebay-menu/menu.d.ts.map +1 -1
- package/ebay-menu/menu.js +85 -42
- package/ebay-menu/types.d.ts +21 -12
- package/ebay-menu/types.d.ts.map +1 -1
- package/ebay-menu-button/README.md +2 -2
- package/ebay-menu-button/menu-button.d.ts +3 -3
- package/ebay-menu-button/menu-button.d.ts.map +1 -1
- package/ebay-menu-button/menu-button.js +18 -4
- package/ebay-page-notice/README.md +5 -1
- package/ebay-page-notice/index.d.ts +1 -1
- package/ebay-page-notice/index.d.ts.map +1 -1
- package/ebay-page-notice/page-notice.d.ts +5 -4
- package/ebay-page-notice/page-notice.d.ts.map +1 -1
- package/ebay-page-notice/page-notice.js +7 -8
- package/ebay-pagination/README.md +5 -5
- package/ebay-pagination/pagination-item.d.ts +8 -4
- package/ebay-pagination/pagination-item.d.ts.map +1 -1
- package/ebay-pagination/pagination-item.js +2 -1
- package/ebay-pagination/pagination.d.ts +8 -5
- package/ebay-pagination/pagination.d.ts.map +1 -1
- package/ebay-pagination/pagination.js +1 -1
- package/ebay-panel-dialog/panel-dialog.d.ts +0 -1
- package/ebay-panel-dialog/panel-dialog.d.ts.map +1 -1
- package/ebay-panel-dialog/panel-dialog.js +1 -1
- package/ebay-radio/README.md +7 -2
- package/ebay-radio/radio.d.ts +12 -3
- package/ebay-radio/radio.d.ts.map +1 -1
- package/ebay-radio/radio.js +7 -5
- package/ebay-section-notice/README.md +5 -0
- package/ebay-section-notice/index.d.ts +1 -1
- package/ebay-section-notice/index.d.ts.map +1 -1
- package/ebay-section-notice/section-notice.d.ts +6 -3
- package/ebay-section-notice/section-notice.d.ts.map +1 -1
- package/ebay-section-notice/section-notice.js +32 -4
- package/ebay-select/README.md +3 -1
- package/ebay-select/ebay-select.d.ts +7 -2
- package/ebay-select/ebay-select.d.ts.map +1 -1
- package/ebay-select/ebay-select.js +1 -1
- package/ebay-select/index.d.ts +1 -1
- package/ebay-select/index.d.ts.map +1 -1
- package/ebay-split-button/README.md +2 -2
- package/ebay-split-button/split-button.js +1 -1
- package/ebay-split-button/types.d.ts +2 -3
- package/ebay-split-button/types.d.ts.map +1 -1
- package/ebay-star-rating-select/README.md +8 -0
- package/ebay-star-rating-select/star-rating-select.d.ts +8 -4
- package/ebay-star-rating-select/star-rating-select.d.ts.map +1 -1
- package/ebay-star-rating-select/star-rating-select.js +8 -8
- package/ebay-svg/svg.d.ts.map +1 -1
- package/ebay-svg/svg.js +266 -28
- package/ebay-switch/README.md +5 -1
- package/ebay-switch/ebay-switch.d.ts +7 -3
- package/ebay-switch/ebay-switch.d.ts.map +1 -1
- package/ebay-switch/ebay-switch.js +6 -3
- package/ebay-tabs/README.md +6 -10
- package/ebay-tabs/tab-panel.d.ts +0 -1
- package/ebay-tabs/tab-panel.d.ts.map +1 -1
- package/ebay-tabs/tab-panel.js +2 -2
- package/ebay-tabs/tab.d.ts +1 -7
- package/ebay-tabs/tab.d.ts.map +1 -1
- package/ebay-tabs/tab.js +2 -7
- package/ebay-tabs/tabs.d.ts +7 -1
- package/ebay-tabs/tabs.d.ts.map +1 -1
- package/ebay-tabs/tabs.js +12 -19
- package/ebay-textbox/README.md +16 -9
- package/ebay-textbox/postfix-icon.d.ts.map +1 -1
- package/ebay-textbox/postfix-icon.js +25 -3
- package/ebay-textbox/prefix-icon.d.ts.map +1 -1
- package/ebay-textbox/prefix-icon.js +24 -2
- package/ebay-textbox/textbox.d.ts +17 -7
- package/ebay-textbox/textbox.d.ts.map +1 -1
- package/ebay-textbox/textbox.js +47 -14
- package/ebay-textbox/types.d.ts +2 -2
- package/ebay-textbox/types.d.ts.map +1 -1
- package/ebay-video/README.md +7 -5
- package/ebay-video/controls.d.ts.map +1 -1
- package/ebay-video/controls.js +10 -4
- package/ebay-video/reportButton.d.ts +1 -5
- package/ebay-video/reportButton.d.ts.map +1 -1
- package/ebay-video/reportButton.js +3 -3
- package/ebay-video/video.d.ts +13 -10
- package/ebay-video/video.d.ts.map +1 -1
- package/ebay-video/video.js +4 -1
- package/package.json +1 -1
package/ebay-switch/README.md
CHANGED
|
@@ -27,7 +27,11 @@ yarn add @ebay/ui-core-react
|
|
|
27
27
|
Name | Type | Stateful | Description
|
|
28
28
|
--- | --- | --- | ---
|
|
29
29
|
`disabled` | Boolean | No |
|
|
30
|
-
|
|
30
|
+
|
|
31
|
+
## Callbacks
|
|
32
|
+
Name | Data | Description
|
|
33
|
+
--- | --- | --- | ---
|
|
34
|
+
`onChange` | `(ChangeEvent, { value: string, checked: boolean }` | Triggered on change
|
|
31
35
|
|
|
32
36
|
Note: For this component, `className`/`style` are applied to the root tag, while all other HTML attributes are applied to the `input` tag.
|
|
33
37
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { FC,
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { FC, ComponentProps } from 'react';
|
|
2
|
+
import { EbayChangeEventHandler } from '../common/event-utils/types';
|
|
3
|
+
declare type Props = Omit<ComponentProps<'input'>, 'onChange'> & {
|
|
4
|
+
onChange?: EbayChangeEventHandler<HTMLInputElement, {
|
|
5
|
+
value: string | number;
|
|
6
|
+
checked: boolean;
|
|
7
|
+
}>;
|
|
4
8
|
};
|
|
5
9
|
declare const EbaySwitch: FC<Props>;
|
|
6
10
|
export default EbaySwitch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ebay-switch.d.ts","sourceRoot":"","sources":["../../src/ebay-switch/ebay-switch.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAuB,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"ebay-switch.d.ts","sourceRoot":"","sources":["../../src/ebay-switch/ebay-switch.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAuB,EAAE,EAAe,cAAc,EAAE,MAAM,OAAO,CAAA;AAEnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE,aAAK,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,GAAG;IACrD,QAAQ,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,EAAE;QAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACrG,CAAA;AAED,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,KAAK,CA0CzB,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -53,9 +53,12 @@ var EbaySwitch = function (_a) {
|
|
|
53
53
|
setChecked(!!checked);
|
|
54
54
|
}, [checked]);
|
|
55
55
|
var handleChange = function (e) {
|
|
56
|
-
var
|
|
57
|
-
onChange(e,
|
|
58
|
-
|
|
56
|
+
var _a = e.target || {}, _b = _a.value, inputValue = _b === void 0 ? '' : _b, _c = _a.checked, inputChecked = _c === void 0 ? false : _c;
|
|
57
|
+
onChange(e, {
|
|
58
|
+
value: inputValue,
|
|
59
|
+
checked: inputChecked
|
|
60
|
+
});
|
|
61
|
+
setChecked(inputChecked);
|
|
59
62
|
};
|
|
60
63
|
return (react_1.default.createElement("span", { className: "switch" },
|
|
61
64
|
react_1.default.createElement("input", __assign({}, rest, { className: classnames_1.default('switch__control', className), id: id, role: "switch", type: "checkbox", value: value, "aria-checked": isChecked, checked: isChecked, name: name, onChange: handleChange })),
|
package/ebay-tabs/README.md
CHANGED
|
@@ -28,15 +28,17 @@ import '@ebay/skin/tabs';
|
|
|
28
28
|
|
|
29
29
|
Name | Type | Stateful | Description
|
|
30
30
|
--- | --- | --- | ---
|
|
31
|
-
`index` |Number | Yes | 0-based index of selected tab heading and panel
|
|
31
|
+
`index` |Number | Yes | Deprecated, use `selectedIndex` instead. 0-based index of selected tab heading and panel
|
|
32
|
+
`selectedIndex` |Number | Yes | 0-based index of selected tab heading and panel
|
|
32
33
|
`activation` | Enum | Yes | whether to use automatic or manual activation when navigating by keyboard, can be `auto` (default) or `manual`
|
|
33
34
|
`size` | Enum | No | Whether to opt into larger font-size for tab headings, can be `medium` (default) or `large`
|
|
34
35
|
|
|
35
36
|
## Callbacks
|
|
36
37
|
|
|
37
|
-
Event
|
|
38
|
-
|
|
39
|
-
`onTabSelect` | `{ index }` |
|
|
38
|
+
| Event | Data | Description |
|
|
39
|
+
|---------------|-------------------------------------------|---------------------------------------------------------------------------------------------------------|
|
|
40
|
+
| `onTabSelect` | `({ index: number })` | Triggered on tab selected. Deprecated, use onSelect instead. Will be removed in the next major release. |
|
|
41
|
+
| `onSelect` | `(ChangeEvent, { selectedIndex:number })` | Triggered on tab selected. |
|
|
40
42
|
|
|
41
43
|
## EbayTab
|
|
42
44
|
|
|
@@ -44,12 +46,6 @@ Event | Data | Description
|
|
|
44
46
|
<EbayTab>Tab 1</EbayTab>
|
|
45
47
|
```
|
|
46
48
|
|
|
47
|
-
### EbayTab Props
|
|
48
|
-
|
|
49
|
-
Name | Type | Stateful | Description
|
|
50
|
-
--- | --- | --- | ---
|
|
51
|
-
`href` | String | No | For use with `fake` tab component (links instead of real tabs)
|
|
52
|
-
|
|
53
49
|
## EbayTabPanel
|
|
54
50
|
```jsx harmony
|
|
55
51
|
<EbayTabPanel>Panel 1</EbayTabPanel>
|
package/ebay-tabs/tab-panel.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-panel.d.ts","sourceRoot":"","sources":["../../src/ebay-tabs/tab-panel.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAGjD,aAAK,aAAa,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"tab-panel.d.ts","sourceRoot":"","sources":["../../src/ebay-tabs/tab-panel.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAGjD,aAAK,aAAa,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAoB/B,CAAA;AAED,eAAe,QAAQ,CAAA"}
|
package/ebay-tabs/tab-panel.js
CHANGED
|
@@ -28,8 +28,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
28
28
|
var react_1 = __importDefault(require("react"));
|
|
29
29
|
var classnames_1 = __importDefault(require("classnames"));
|
|
30
30
|
var TabPanel = function (_a) {
|
|
31
|
-
var children = _a.children, index = _a.index, parentId = _a.parentId, selected = _a.selected,
|
|
32
|
-
return
|
|
31
|
+
var children = _a.children, index = _a.index, parentId = _a.parentId, selected = _a.selected, className = _a.className, rest = __rest(_a, ["children", "index", "parentId", "selected", "className"]);
|
|
32
|
+
return (react_1.default.createElement("div", __assign({}, rest, { "aria-labelledby": "default-tab-" + index, className: classnames_1.default(className, 'tabs__panel'), id: (parentId || 'default') + "-tabpanel-" + index, role: "tabpanel", hidden: !selected }),
|
|
33
33
|
react_1.default.createElement("div", { className: "tabs__cell" }, children)));
|
|
34
34
|
};
|
|
35
35
|
exports.default = TabPanel;
|
package/ebay-tabs/tab.d.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { ComponentProps, FC, RefCallback } from 'react';
|
|
2
|
-
declare type TabProps = ComponentProps<'
|
|
2
|
+
declare type TabProps = ComponentProps<'div'> & {
|
|
3
3
|
index?: number;
|
|
4
4
|
parentId?: string;
|
|
5
5
|
selected?: boolean;
|
|
6
6
|
focused?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Use EbayFakeTabs instead
|
|
9
|
-
*/
|
|
10
|
-
href?: string;
|
|
11
|
-
onClick?: () => void;
|
|
12
|
-
onKeyDown?: () => void;
|
|
13
7
|
refCallback?: RefCallback<HTMLElement>;
|
|
14
8
|
};
|
|
15
9
|
declare const Tab: FC<TabProps>;
|
package/ebay-tabs/tab.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../src/ebay-tabs/tab.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAG9D,aAAK,QAAQ,GAAG,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../src/ebay-tabs/tab.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAG9D,aAAK,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;CAC1C,CAAA;AAED,QAAA,MAAM,GAAG,EAAE,EAAE,CAAC,QAAQ,CAwBrB,CAAA;AAED,eAAe,GAAG,CAAA"}
|
package/ebay-tabs/tab.js
CHANGED
|
@@ -28,13 +28,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
28
28
|
var react_1 = __importDefault(require("react"));
|
|
29
29
|
var classnames_1 = __importDefault(require("classnames"));
|
|
30
30
|
var Tab = function (_a) {
|
|
31
|
-
var children = _a.children, index = _a.index, parentId = _a.parentId, selected = _a.selected, focused = _a.focused,
|
|
32
|
-
|
|
33
|
-
* @deprecated Use EbayFakeTabs instead
|
|
34
|
-
*/
|
|
35
|
-
href = _a.href, className = _a.className, refCallback = _a.refCallback, _b = _a.onClick, onClick = _b === void 0 ? function () { } : _b, _c = _a.onKeyDown, onKeyDown = _c === void 0 ? function () { } : _c, rest = __rest(_a, ["children", "index", "parentId", "selected", "focused", "href", "className", "refCallback", "onClick", "onKeyDown"]);
|
|
36
|
-
return href ? (react_1.default.createElement("li", __assign({}, rest, { className: classnames_1.default(className, 'fake-tabs__item', { 'fake-tabs__item--current': selected }) }),
|
|
37
|
-
react_1.default.createElement("a", { href: href, "aria-current": selected ? "page" : null }, children))) : (react_1.default.createElement("div", __assign({}, rest, { ref: refCallback, "aria-controls": (parentId || 'default') + "-tabpanel-" + index, "aria-selected": selected, className: classnames_1.default(className, 'tabs__item'), id: (parentId || 'default') + "-tab-" + index, role: "tab", tabIndex: focused ? 0 : -1, onClick: onClick, onKeyDown: onKeyDown }),
|
|
31
|
+
var children = _a.children, index = _a.index, parentId = _a.parentId, selected = _a.selected, focused = _a.focused, className = _a.className, refCallback = _a.refCallback, rest = __rest(_a, ["children", "index", "parentId", "selected", "focused", "className", "refCallback"]);
|
|
32
|
+
return (react_1.default.createElement("div", __assign({}, rest, { ref: refCallback, "aria-controls": (parentId || 'default') + "-tabpanel-" + index, "aria-selected": selected, className: classnames_1.default(className, 'tabs__item'), id: (parentId || 'default') + "-tab-" + index, role: "tab", tabIndex: focused ? 0 : -1 }),
|
|
38
33
|
react_1.default.createElement("span", null, children)));
|
|
39
34
|
};
|
|
40
35
|
exports.default = Tab;
|
package/ebay-tabs/tabs.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { ComponentProps, FC } from 'react';
|
|
2
2
|
import { Activation, Size } from './types';
|
|
3
|
-
declare type TabsProps = ComponentProps<'div'> & {
|
|
3
|
+
export declare type TabsProps = ComponentProps<'div'> & {
|
|
4
4
|
index?: number;
|
|
5
5
|
size?: Size;
|
|
6
6
|
activation?: Activation;
|
|
7
|
+
onSelect?: ({ selectedIndex: number }: {
|
|
8
|
+
selectedIndex: any;
|
|
9
|
+
}) => void;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Use onSelect instead
|
|
12
|
+
*/
|
|
7
13
|
onTabSelect?: (index: number) => void;
|
|
8
14
|
};
|
|
9
15
|
declare const Tabs: FC<TabsProps>;
|
package/ebay-tabs/tabs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/ebay-tabs/tabs.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAgB,cAAc,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/ebay-tabs/tabs.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAgB,cAAc,EAAE,EAAE,EAAsC,MAAM,OAAO,CAAA;AAKnG,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAI1C,oBAAY,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE;;KAAA,KAAK,IAAI,CAAC;IAC/C;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CA4FvB,CAAA;AAED,eAAe,IAAI,CAAA"}
|
package/ebay-tabs/tabs.js
CHANGED
|
@@ -36,15 +36,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
var react_1 = __importStar(require("react"));
|
|
37
37
|
var classnames_1 = __importDefault(require("classnames"));
|
|
38
38
|
var event_utils_1 = require("../common/event-utils");
|
|
39
|
+
var component_utils_1 = require("../common/component-utils");
|
|
39
40
|
var tab_1 = __importDefault(require("./tab"));
|
|
40
41
|
var tab_panel_1 = __importDefault(require("./tab-panel"));
|
|
41
|
-
var component_utils_1 = require("../common/component-utils");
|
|
42
42
|
var Tabs = function (_a) {
|
|
43
|
-
var id = _a.id, className = _a.className, _b = _a.index, index = _b === void 0 ? 0 : _b, _c = _a.size, size = _c === void 0 ? 'medium' : _c, _d = _a.activation, activation = _d === void 0 ? 'auto' : _d, _e = _a.
|
|
43
|
+
var id = _a.id, className = _a.className, _b = _a.index, index = _b === void 0 ? 0 : _b, _c = _a.size, size = _c === void 0 ? 'medium' : _c, _d = _a.activation, activation = _d === void 0 ? 'auto' : _d, _e = _a.onSelect, onSelect = _e === void 0 ? function () { } : _e, _f = _a.onTabSelect, onTabSelect = _f === void 0 ? function () { } : _f, children = _a.children;
|
|
44
44
|
var headings = [];
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
45
|
+
var _g = react_1.useState(index), selectedIndex = _g[0], setSelectedIndex = _g[1];
|
|
46
|
+
var _h = react_1.useState(index), focusedIndex = _h[0], setFocusedIndex = _h[1];
|
|
47
|
+
var handleSelect = function (i) {
|
|
48
|
+
onSelect({ selectedIndex: i });
|
|
48
49
|
onTabSelect(i);
|
|
49
50
|
setSelectedIndex(i);
|
|
50
51
|
};
|
|
@@ -56,7 +57,7 @@ var Tabs = function (_a) {
|
|
|
56
57
|
event_utils_1.handleActionKeydown(ev, function () {
|
|
57
58
|
ev.preventDefault();
|
|
58
59
|
if (activation === 'manual') {
|
|
59
|
-
|
|
60
|
+
handleSelect(i);
|
|
60
61
|
}
|
|
61
62
|
});
|
|
62
63
|
event_utils_1.handleLeftRightArrowsKeydown(ev, function () {
|
|
@@ -69,38 +70,30 @@ var Tabs = function (_a) {
|
|
|
69
70
|
setFocusedIndex(nextIndex);
|
|
70
71
|
(_a = headings[nextIndex]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
71
72
|
if (activation !== 'manual') {
|
|
72
|
-
|
|
73
|
+
handleSelect(nextIndex);
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
76
|
};
|
|
76
77
|
react_1.useEffect(function () {
|
|
77
|
-
|
|
78
|
+
handleSelect(index);
|
|
78
79
|
}, [index]);
|
|
79
|
-
var isFake = component_utils_1.filterBy(children, function (_a) {
|
|
80
|
-
var type = _a.type, props = _a.props;
|
|
81
|
-
return type === tab_1.default && props.href;
|
|
82
|
-
}).length > 0;
|
|
83
80
|
var isLarge = size === 'large';
|
|
84
81
|
var tabHeadings = component_utils_1.filterByType(children, tab_1.default).map(function (item, i) {
|
|
85
82
|
return react_1.cloneElement(item, __assign(__assign({}, item.props), { refCallback: function (ref) { headings[i] = ref; }, index: i, parentId: id, selected: selectedIndex === i, focused: focusedIndex === i, onClick: function () {
|
|
86
|
-
|
|
83
|
+
handleSelect(i);
|
|
87
84
|
setFocusedIndex(i);
|
|
88
85
|
}, onKeyDown: function (e) { onKeyDown(e, i); } }));
|
|
89
86
|
});
|
|
90
87
|
var tabPanels = component_utils_1.filterByType(children, tab_panel_1.default).map(function (item, i) {
|
|
91
|
-
var content = item.props.children;
|
|
92
88
|
var itemProps = {
|
|
93
89
|
index: i,
|
|
94
90
|
parentId: id,
|
|
95
91
|
selected: selectedIndex === i,
|
|
96
|
-
|
|
97
|
-
children: content
|
|
92
|
+
children: item.props.children
|
|
98
93
|
};
|
|
99
94
|
return react_1.cloneElement(item, itemProps);
|
|
100
95
|
});
|
|
101
|
-
return
|
|
102
|
-
react_1.default.createElement("ul", { className: classnames_1.default('fake-tabs__items', { 'fake-tabs__items--large': isLarge }) }, tabHeadings),
|
|
103
|
-
react_1.default.createElement("div", { className: "fake-tabs__content" }, tabPanels))) : (react_1.default.createElement("div", { id: id, className: classnames_1.default(className, 'tabs') },
|
|
96
|
+
return (react_1.default.createElement("div", { id: id, className: classnames_1.default(className, 'tabs') },
|
|
104
97
|
react_1.default.createElement("div", { className: classnames_1.default('tabs__items', { 'tabs__items--large': isLarge }), role: "tablist" }, tabHeadings),
|
|
105
98
|
react_1.default.createElement("div", { className: "tabs__content" }, tabPanels)));
|
|
106
99
|
};
|
package/ebay-textbox/README.md
CHANGED
|
@@ -11,19 +11,15 @@ yarn add @ebay/ui-core-react
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
### Import JS
|
|
14
|
-
|
|
15
14
|
```jsx harmony
|
|
16
15
|
import { EbayTextbox } from '@ebay/ui-core-react/ebay-textbox'
|
|
17
16
|
```
|
|
18
17
|
|
|
19
18
|
### Import following styles from SKIN
|
|
20
|
-
|
|
21
19
|
```jsx harmony
|
|
22
20
|
import "@ebay/skin/textbox";
|
|
23
21
|
```
|
|
24
|
-
|
|
25
22
|
### or if using CSS/SCSS
|
|
26
|
-
|
|
27
23
|
```jsx
|
|
28
24
|
import "@ebay/skin/textbox.css";
|
|
29
25
|
```
|
|
@@ -44,12 +40,23 @@ import "@ebay/skin/textbox.css";
|
|
|
44
40
|
| `defaultValue` | String | No | No | Indicates the default input element value. Use when the component is not controlled. |
|
|
45
41
|
| `inputSize` | String | No | No | `default` (default), `large` |
|
|
46
42
|
| `floatingLabel` | String | No | No | Indicates that the input is a floating label type and renders it as a label |
|
|
47
|
-
| `onFocus` | Function | No | No | Called when input gets focus, parameters passed: `originalEvent`, `value` |
|
|
48
|
-
| `onBlur` | Function | No | No | Called when input loses focus, parameters passed: `originalEvent`, `value` |
|
|
49
|
-
| `onChange` | Function | No | No | Called when input changes value, parameters passed: `originalEvent`, `value` |
|
|
50
|
-
| `onButtonClick` | Function | No | No | Triggers when clicking on postfix-icon-button. Requires `buttonAriaLabel` to be present in order to attach correctly |
|
|
51
43
|
|
|
52
|
-
|
|
44
|
+
## Callbacks
|
|
45
|
+
| Name | Required | Description | Arguments |
|
|
46
|
+
|------|----------|-------------|-----------|
|
|
47
|
+
|
|
48
|
+
| `onChange` | No | Triggered when focus leaves and value is changed. | `(ChangeEvent, { value: string })` | |
|
|
49
|
+
| `onInputChange` | No | Triggered when the value of the input is changed. | `(ChangeEvent, { value: string })` | |
|
|
50
|
+
| `onFocus` | No | Called when input gets focus | `(FocusEvent, { value: string })` |
|
|
51
|
+
| `onBlur` | No | Called when input loses focus | `(FocusEvent, { value: string })` |
|
|
52
|
+
| `onKeyPress` | No | Called on key press | `(KeyboardEvent, { value: string })` |
|
|
53
|
+
| `onKeyUp` | No | Called on key up | `(KeyboardEvent, { value: string })` |
|
|
54
|
+
| `onKeyDown` | No | Called on key down | `(KeyboardEvent, { value: string })` |
|
|
55
|
+
| `onInvalid` | No | Triggered when value is invalid | `(ChangeEvent, { value: string })` |
|
|
56
|
+
| `onFloatingLabelInit` | No | Triggered when floating label is initialized | `()` |
|
|
57
|
+
| `onButtonClick` | No | Triggers when clicking on postfix-icon-button. Requires `buttonAriaLabel` to be present in order to attach correctly | `(MouseEvent, { value: string })` |
|
|
58
|
+
|
|
59
|
+
It supports all the events supported by an input element (e.g. `onInput`, `onPaste`)
|
|
53
60
|
|
|
54
61
|
## EbayTextboxPrefixIcon
|
|
55
62
|
| Name | Type | Required | Description |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postfix-icon.d.ts","sourceRoot":"","sources":["../../src/ebay-textbox/postfix-icon.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAI9C,QAAA,MAAM,sBAAsB,EAAE,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"postfix-icon.d.ts","sourceRoot":"","sources":["../../src/ebay-textbox/postfix-icon.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAI9C,QAAA,MAAM,sBAAsB,EAAE,EAAE,CAAC,oBAAoB,CAaR,CAAA;AAE7C,eAAe,sBAAsB,CAAA"}
|
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
2
24
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
26
|
};
|
|
@@ -7,9 +29,9 @@ var react_1 = __importDefault(require("react"));
|
|
|
7
29
|
var ebay_icon_1 = require("../ebay-icon");
|
|
8
30
|
var ebay_icon_button_1 = require("../ebay-icon-button");
|
|
9
31
|
var EbayTextboxPostfixIcon = function (_a) {
|
|
10
|
-
var name = _a.name, buttonAriaLabel = _a.buttonAriaLabel, _b = _a.onClick, onClick = _b === void 0 ? function () { } : _b;
|
|
32
|
+
var name = _a.name, buttonAriaLabel = _a.buttonAriaLabel, _b = _a.onClick, onClick = _b === void 0 ? function () { } : _b, rest = __rest(_a, ["name", "buttonAriaLabel", "onClick"]);
|
|
11
33
|
return buttonAriaLabel ?
|
|
12
|
-
react_1.default.createElement(ebay_icon_button_1.EbayIconButton, { "aria-label": buttonAriaLabel, icon: name, transparent: true, onClick: onClick }) :
|
|
13
|
-
react_1.default.createElement(ebay_icon_1.EbayIcon, { name: name });
|
|
34
|
+
react_1.default.createElement(ebay_icon_button_1.EbayIconButton, __assign({ "aria-label": buttonAriaLabel, icon: name, transparent: true, onClick: onClick }, rest)) :
|
|
35
|
+
react_1.default.createElement(ebay_icon_1.EbayIcon, __assign({ name: name }, rest));
|
|
14
36
|
};
|
|
15
37
|
exports.default = EbayTextboxPostfixIcon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefix-icon.d.ts","sourceRoot":"","sources":["../../src/ebay-textbox/prefix-icon.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAE9C,QAAA,MAAM,qBAAqB,EAAE,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"prefix-icon.d.ts","sourceRoot":"","sources":["../../src/ebay-textbox/prefix-icon.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAE9C,QAAA,MAAM,qBAAqB,EAAE,EAAE,CAAC,oBAAoB,CAKnD,CAAA;AAED,eAAe,qBAAqB,CAAA"}
|
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
2
24
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
26
|
};
|
|
@@ -6,7 +28,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
28
|
var react_1 = __importDefault(require("react"));
|
|
7
29
|
var ebay_icon_1 = require("../ebay-icon");
|
|
8
30
|
var EbayTextboxPrefixIcon = function (_a) {
|
|
9
|
-
var name = _a.name;
|
|
10
|
-
return (react_1.default.createElement(ebay_icon_1.EbayIcon, { name: name }));
|
|
31
|
+
var name = _a.name, rest = __rest(_a, ["name"]);
|
|
32
|
+
return (react_1.default.createElement(ebay_icon_1.EbayIcon, __assign({ name: name }, rest)));
|
|
11
33
|
};
|
|
12
34
|
exports.default = EbayTextboxPrefixIcon;
|
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { ComponentProps, Ref } from 'react';
|
|
2
2
|
import { Size } from './index';
|
|
3
|
+
import { EbayChangeEventHandler, EbayEventHandler, EbayFocusEventHandler, EbayKeyboardEventHandler, EbayMouseEventHandler } from '../common/event-utils/types';
|
|
3
4
|
declare type TextInputProps = ComponentProps<'input'> & ComponentProps<'textarea'>;
|
|
5
|
+
export declare type TextboxEventProps = {
|
|
6
|
+
value: string;
|
|
7
|
+
};
|
|
4
8
|
export declare type EbayTextboxProps = {
|
|
5
9
|
fluid?: boolean;
|
|
6
10
|
invalid?: boolean;
|
|
7
11
|
multiline?: boolean;
|
|
8
12
|
defaultValue?: string;
|
|
9
13
|
inputSize?: Size;
|
|
10
|
-
onFocus?: (e?: FocusEvent<HTMLTextAreaElement & HTMLInputElement>, value?: string) => void;
|
|
11
|
-
onBlur?: (e?: FocusEvent<HTMLTextAreaElement & HTMLInputElement>, value?: string) => void;
|
|
12
|
-
onChange?: (e: ChangeEvent<HTMLTextAreaElement & HTMLInputElement>, value: string) => void;
|
|
13
|
-
onButtonClick?: (e: MouseEvent, value: string) => void;
|
|
14
14
|
floatingLabel?: string;
|
|
15
|
+
onChange?: EbayChangeEventHandler<HTMLTextAreaElement & HTMLInputElement, TextboxEventProps>;
|
|
16
|
+
onInputChange?: EbayChangeEventHandler<HTMLTextAreaElement & HTMLInputElement, TextboxEventProps>;
|
|
17
|
+
onFocus?: EbayFocusEventHandler<HTMLTextAreaElement & HTMLInputElement, TextboxEventProps>;
|
|
18
|
+
onBlur?: EbayFocusEventHandler<HTMLTextAreaElement & HTMLInputElement, TextboxEventProps>;
|
|
19
|
+
onKeyPress?: EbayKeyboardEventHandler<HTMLTextAreaElement & HTMLInputElement, TextboxEventProps>;
|
|
20
|
+
onKeyUp?: EbayKeyboardEventHandler<HTMLTextAreaElement & HTMLInputElement, TextboxEventProps>;
|
|
21
|
+
onKeyDown?: EbayKeyboardEventHandler<HTMLTextAreaElement & HTMLInputElement, TextboxEventProps>;
|
|
22
|
+
onInvalid?: EbayEventHandler<HTMLTextAreaElement & HTMLInputElement, TextboxEventProps>;
|
|
23
|
+
onFloatingLabelInit?: () => void;
|
|
24
|
+
onButtonClick?: EbayKeyboardEventHandler<HTMLInputElement, TextboxEventProps> & EbayMouseEventHandler<HTMLInputElement, TextboxEventProps>;
|
|
15
25
|
forwardedRef?: Ref<HTMLTextAreaElement | HTMLInputElement>;
|
|
16
|
-
} & Omit<TextInputProps, 'onFocus' | 'onBlur'>;
|
|
17
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<EbayTextboxProps, "form" | "slot" | "style" | "title" | "pattern" | "type" | "invalid" | "key" | "value" | "className" | "disabled" | "inputSize" | "placeholder" | "children" | "dir" | "list" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "cols" | "crossOrigin" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "readOnly" | "required" | "rows" | "size" | "src" | "step" | "width" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "forwardedRef" | "fluid" | "floatingLabel" | "dirName" | "multiline" | "onButtonClick"> & React.RefAttributes<React.FC<EbayTextboxProps>>>;
|
|
26
|
+
} & Omit<TextInputProps, 'onFocus' | 'onBlur' | 'onChange' | 'onKeyPress' | 'onKeyUp' | 'onKeyDown' | 'onInvalid'>;
|
|
27
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<EbayTextboxProps, "form" | "slot" | "style" | "title" | "pattern" | "type" | "invalid" | "key" | "value" | "className" | "disabled" | "inputSize" | "placeholder" | "children" | "dir" | "list" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "cols" | "crossOrigin" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "readOnly" | "required" | "rows" | "size" | "src" | "step" | "width" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "forwardedRef" | "fluid" | "floatingLabel" | "dirName" | "multiline" | "onInputChange" | "onFloatingLabelInit" | "onButtonClick"> & React.RefAttributes<React.FC<EbayTextboxProps>>>;
|
|
18
28
|
export default _default;
|
|
19
29
|
//# sourceMappingURL=textbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textbox.d.ts","sourceRoot":"","sources":["../../src/ebay-textbox/textbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"textbox.d.ts","sourceRoot":"","sources":["../../src/ebay-textbox/textbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACI,cAAc,EAAM,GAAG,EAGxC,MAAM,OAAO,CAAA;AAGd,OAAO,EAAiD,IAAI,EAAE,MAAM,SAAS,CAAA;AAE7E,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EAAE,qBAAqB,EAClD,MAAM,6BAA6B,CAAA;AAIpC,aAAK,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,cAAc,CAAC,UAAU,CAAC,CAAA;AAE1E,oBAAY,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AACjD,oBAAY,gBAAgB,GAAG;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,sBAAsB,CAAC,mBAAmB,GAAG,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAC7F,aAAa,CAAC,EAAE,sBAAsB,CAAC,mBAAmB,GAAG,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAClG,OAAO,CAAC,EAAE,qBAAqB,CAAC,mBAAmB,GAAG,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAC3F,MAAM,CAAC,EAAE,qBAAqB,CAAC,mBAAmB,GAAG,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAC1F,UAAU,CAAC,EAAE,wBAAwB,CAAC,mBAAmB,GAAG,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IACjG,OAAO,CAAC,EAAE,wBAAwB,CAAC,mBAAmB,GAAG,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAC9F,SAAS,CAAC,EAAE,wBAAwB,CAAC,mBAAmB,GAAG,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAChG,SAAS,CAAC,EAAE,gBAAgB,CAAC,mBAAmB,GAAG,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IACxF,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,aAAa,CAAC,EAAE,wBAAwB,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,GACzE,qBAAqB,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAC/D,YAAY,CAAC,EAAE,GAAG,CAAC,mBAAmB,GAAG,gBAAgB,CAAC,CAAC;CAC9D,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,CAAC,CAAC;;AAuJnH,wBAA4D"}
|
package/ebay-textbox/textbox.js
CHANGED
|
@@ -51,38 +51,67 @@ var index_1 = require("./index");
|
|
|
51
51
|
var hooks_1 = require("../common/floating-label-utils/hooks");
|
|
52
52
|
var isControlled = function (value) { return typeof value !== 'undefined'; };
|
|
53
53
|
var EbayTextbox = function (_a) {
|
|
54
|
-
var _b = _a.type, type = _b === void 0 ? 'text' : _b, invalid = _a.invalid, fluid = _a.fluid, multiline = _a.multiline, _c = _a.onChange, onChange = _c === void 0 ? function () { } : _c, _d = _a.
|
|
55
|
-
var
|
|
56
|
-
var
|
|
54
|
+
var _b = _a.type, type = _b === void 0 ? 'text' : _b, invalid = _a.invalid, fluid = _a.fluid, multiline = _a.multiline, _c = _a.onChange, onChange = _c === void 0 ? function () { } : _c, _d = _a.onInputChange, onInputChange = _d === void 0 ? function () { } : _d, _e = _a.onFocus, onFocus = _e === void 0 ? function () { } : _e, _f = _a.onBlur, onBlur = _f === void 0 ? function () { } : _f, _g = _a.onKeyPress, onKeyPress = _g === void 0 ? function () { } : _g, _h = _a.onKeyUp, onKeyUp = _h === void 0 ? function () { } : _h, _j = _a.onKeyDown, onKeyDown = _j === void 0 ? function () { } : _j, _k = _a.onInvalid, onInvalid = _k === void 0 ? function () { } : _k, _l = _a.onFloatingLabelInit, onFloatingLabelInit = _l === void 0 ? function () { } : _l, _m = _a.onButtonClick, onButtonClick = _m === void 0 ? function () { } : _m, autoFocus = _a.autoFocus, _o = _a.defaultValue, defaultValue = _o === void 0 ? '' : _o, controlledValue = _a.value, forwardedRef = _a.forwardedRef, _p = _a.inputSize, inputSize = _p === void 0 ? 'default' : _p, floatingLabel = _a.floatingLabel, children = _a.children, placeholder = _a.placeholder, rest = __rest(_a, ["type", "invalid", "fluid", "multiline", "onChange", "onInputChange", "onFocus", "onBlur", "onKeyPress", "onKeyUp", "onKeyDown", "onInvalid", "onFloatingLabelInit", "onButtonClick", "autoFocus", "defaultValue", "value", "forwardedRef", "inputSize", "floatingLabel", "children", "placeholder"]);
|
|
55
|
+
var _q = react_1.useState(defaultValue), value = _q[0], setValue = _q[1];
|
|
56
|
+
var _r = react_1.useState(defaultValue), inputValue = _r[0], setInputValue = _r[1];
|
|
57
|
+
var _s = hooks_1.useFloatingLabel({
|
|
57
58
|
ref: forwardedRef,
|
|
58
59
|
inputId: rest.id,
|
|
59
60
|
className: rest.className,
|
|
60
61
|
disabled: rest.disabled,
|
|
61
62
|
label: floatingLabel,
|
|
62
63
|
inputSize: inputSize,
|
|
63
|
-
inputValue: controlledValue ||
|
|
64
|
+
inputValue: controlledValue || inputValue,
|
|
64
65
|
placeholder: placeholder,
|
|
65
|
-
invalid: invalid
|
|
66
|
-
|
|
66
|
+
invalid: invalid,
|
|
67
|
+
onMount: onFloatingLabelInit
|
|
68
|
+
}), label = _s.label, Container = _s.Container, onFloatingLabelBlur = _s.onBlur, onFloatingLabelFocus = _s.onFocus, ref = _s.ref, floatingLabelPlaceholder = _s.placeholder;
|
|
67
69
|
var handleFocus = function (event) {
|
|
68
|
-
|
|
70
|
+
var _a;
|
|
71
|
+
onFocus(event, { value: ((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value) || defaultValue });
|
|
69
72
|
onFloatingLabelFocus();
|
|
70
73
|
};
|
|
71
74
|
var handleBlur = function (event) {
|
|
72
|
-
|
|
75
|
+
var _a;
|
|
76
|
+
var newValue = (_a = event.target) === null || _a === void 0 ? void 0 : _a.value;
|
|
77
|
+
onBlur(event, { value: newValue });
|
|
78
|
+
if (newValue !== value) {
|
|
79
|
+
onChange(event, { value: newValue });
|
|
80
|
+
setValue(newValue);
|
|
81
|
+
}
|
|
73
82
|
onFloatingLabelBlur();
|
|
74
83
|
};
|
|
84
|
+
var handleKeyPress = function (event) {
|
|
85
|
+
var textbox = event.target;
|
|
86
|
+
onKeyPress(event, { value: textbox === null || textbox === void 0 ? void 0 : textbox.value });
|
|
87
|
+
};
|
|
88
|
+
var handleKeyUp = function (event) {
|
|
89
|
+
var textbox = event.target;
|
|
90
|
+
onKeyUp(event, { value: textbox === null || textbox === void 0 ? void 0 : textbox.value });
|
|
91
|
+
};
|
|
92
|
+
var handleKeyDown = function (event) {
|
|
93
|
+
var textbox = event.target;
|
|
94
|
+
onKeyDown(event, { value: textbox === null || textbox === void 0 ? void 0 : textbox.value });
|
|
95
|
+
};
|
|
96
|
+
var handleInvalid = function (event) {
|
|
97
|
+
var textbox = event.target;
|
|
98
|
+
onInvalid(event, { value: textbox === null || textbox === void 0 ? void 0 : textbox.value });
|
|
99
|
+
};
|
|
100
|
+
var handleButtonClick = function (event) {
|
|
101
|
+
onButtonClick(event, { value: value });
|
|
102
|
+
};
|
|
75
103
|
react_1.useEffect(function () {
|
|
76
104
|
if (autoFocus) {
|
|
77
105
|
handleFocus();
|
|
78
106
|
}
|
|
79
107
|
}, []);
|
|
80
|
-
var
|
|
81
|
-
var
|
|
108
|
+
var handleInputChange = function (e) {
|
|
109
|
+
var _a;
|
|
110
|
+
var newValue = (_a = e.target) === null || _a === void 0 ? void 0 : _a.value;
|
|
82
111
|
if (!isControlled(controlledValue)) {
|
|
83
|
-
|
|
112
|
+
setInputValue(newValue);
|
|
84
113
|
}
|
|
85
|
-
|
|
114
|
+
onInputChange(e, { value: newValue });
|
|
86
115
|
};
|
|
87
116
|
var Input = multiline ? 'textarea' : 'input';
|
|
88
117
|
var Wrapper = fluid ? 'div' : 'span';
|
|
@@ -99,7 +128,11 @@ var EbayTextbox = function (_a) {
|
|
|
99
128
|
label,
|
|
100
129
|
react_1.default.createElement(Wrapper, { className: wrapperClassName },
|
|
101
130
|
prefixIcon,
|
|
102
|
-
react_1.default.createElement(Input, __assign({}, rest, { className: inputClassName, type: type, "aria-invalid": invalid, value: isControlled(controlledValue) ? controlledValue :
|
|
103
|
-
postfixIcon && react_1.cloneElement(postfixIcon, __assign({
|
|
131
|
+
react_1.default.createElement(Input, __assign({}, rest, { className: inputClassName, type: type, "aria-invalid": invalid, value: isControlled(controlledValue) ? controlledValue : inputValue, onChange: handleInputChange, onBlur: handleBlur, onFocus: handleFocus, onKeyPress: handleKeyPress, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, onInvalid: handleInvalid, autoFocus: autoFocus, ref: ref, placeholder: floatingLabelPlaceholder })),
|
|
132
|
+
postfixIcon && react_1.cloneElement(postfixIcon, __assign(__assign({}, postfixIcon.props), { onClick: function (e) {
|
|
133
|
+
var _a = postfixIcon.props.onClick, iconClick = _a === void 0 ? function () { } : _a;
|
|
134
|
+
iconClick(e);
|
|
135
|
+
handleButtonClick(e);
|
|
136
|
+
} })))));
|
|
104
137
|
};
|
|
105
138
|
exports.default = component_utils_1.withForwardRef(EbayTextbox);
|
package/ebay-textbox/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { KeyboardEvent, MouseEvent } from 'react';
|
|
1
|
+
import { ComponentProps, KeyboardEvent, MouseEvent } from 'react';
|
|
2
2
|
import type { Icon } from '../ebay-icon';
|
|
3
3
|
export declare type Size = 'default' | 'large';
|
|
4
|
-
export declare type EbayTextboxIconProps = {
|
|
4
|
+
export declare type EbayTextboxIconProps = ComponentProps<'button'> & ComponentProps<'a'> & {
|
|
5
5
|
name: Icon;
|
|
6
6
|
buttonAriaLabel?: string;
|
|
7
7
|
onClick?: (e: KeyboardEvent | MouseEvent) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ebay-textbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ebay-textbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAExC,oBAAY,IAAI,GAAG,SAAS,GAAG,OAAO,CAAA;AAEtC,oBAAY,oBAAoB,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG;IAChF,IAAI,EAAE,IAAI,CAAA;IACV,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,GAAG,UAAU,KAAK,IAAI,CAAA;CACpD,CAAA"}
|