@ebay/ui-core-react 6.1.0 → 6.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/ebay-calendar/README.md +10 -0
- package/ebay-calendar/date-utils.d.ts +1 -0
- package/ebay-calendar/date-utils.d.ts.map +1 -1
- package/ebay-calendar/date-utils.js +15 -2
- package/ebay-date-textbox/README.md +52 -0
- package/ebay-date-textbox/date-textbox.d.ts +25 -0
- package/ebay-date-textbox/date-textbox.d.ts.map +1 -0
- package/ebay-date-textbox/date-textbox.js +195 -0
- package/ebay-date-textbox/index.d.ts +2 -0
- package/ebay-date-textbox/index.d.ts.map +1 -0
- package/ebay-date-textbox/index.js +8 -0
- package/ebay-pagination/pagination.d.ts.map +1 -1
- package/ebay-textbox/textbox.d.ts +2 -1
- package/ebay-textbox/textbox.d.ts.map +1 -1
- package/ebay-textbox/textbox.js +5 -3
- package/package.json +2 -1
package/ebay-calendar/README.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## Usage
|
|
4
4
|
|
|
5
|
+
### Import JS
|
|
6
|
+
```jsx harmony
|
|
7
|
+
import { EbayCalendar } from '@ebay/ui-core-react/ebay-calendar'
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### Import following styles from SKIN
|
|
11
|
+
```jsx harmony
|
|
12
|
+
import "@ebay/skin/calendar";
|
|
13
|
+
```
|
|
14
|
+
|
|
5
15
|
```react
|
|
6
16
|
<EbayCalendar />
|
|
7
17
|
```
|
|
@@ -5,6 +5,7 @@ type WeekdayInfo = {
|
|
|
5
5
|
weekdayLabels: string[];
|
|
6
6
|
};
|
|
7
7
|
export declare function getWeekdayInfo(localeName: string): WeekdayInfo;
|
|
8
|
+
export declare function dateArgToISO(arg?: DateConstructor['arguments']): DayISO;
|
|
8
9
|
export declare function toISO(date: Date): DayISO;
|
|
9
10
|
export declare function fromISO(iso: DayISO): Date;
|
|
10
11
|
export declare function offsetISO(iso: DayISO, days: number): DayISO;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-utils.d.ts","sourceRoot":"","sources":["../../src/ebay-calendar/date-utils.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;AAErD,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAW7D;AAED,KAAK,WAAW,GAAG;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAA;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"date-utils.d.ts","sourceRoot":"","sources":["../../src/ebay-calendar/date-utils.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;AAErD,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAW7D;AAED,KAAK,WAAW,GAAG;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAA;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,CAiB9D;AAED,wBAAgB,YAAY,CAAC,GAAG,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,GAAG,MAAM,CAIvE;AAED,wBAAgB,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAGxC;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEzC;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAI3D;AAED,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtD"}
|
|
@@ -9,7 +9,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
9
9
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.localeOverride = exports.offsetISO = exports.fromISO = exports.toISO = exports.getWeekdayInfo = exports.findFirstDayOfWeek = void 0;
|
|
12
|
+
exports.localeOverride = exports.offsetISO = exports.fromISO = exports.toISO = exports.dateArgToISO = exports.getWeekdayInfo = exports.findFirstDayOfWeek = void 0;
|
|
13
13
|
function findFirstDayOfWeek(localeName) {
|
|
14
14
|
// weekInfo only exists on some browsers, so we default to Sunday otherwise
|
|
15
15
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/weekInfo
|
|
@@ -31,10 +31,23 @@ function getWeekdayInfo(localeName) {
|
|
|
31
31
|
weekday.setDate(weekday.getDate() + 1);
|
|
32
32
|
return dayLabel;
|
|
33
33
|
});
|
|
34
|
-
return {
|
|
34
|
+
return {
|
|
35
|
+
firstDayOfWeek: firstDayOfWeek,
|
|
36
|
+
weekdayLabels: weekdayLabels
|
|
37
|
+
};
|
|
35
38
|
}
|
|
36
39
|
exports.getWeekdayInfo = getWeekdayInfo;
|
|
40
|
+
function dateArgToISO(arg) {
|
|
41
|
+
if (!arg)
|
|
42
|
+
return undefined;
|
|
43
|
+
if (/^\d\d\d\d-\d\d-\d\d$/g.test(arg))
|
|
44
|
+
return arg;
|
|
45
|
+
return toISO(new Date(arg));
|
|
46
|
+
}
|
|
47
|
+
exports.dateArgToISO = dateArgToISO;
|
|
37
48
|
function toISO(date) {
|
|
49
|
+
if (isNaN(date.getTime()))
|
|
50
|
+
return;
|
|
38
51
|
return date.toISOString().slice(0, 10);
|
|
39
52
|
}
|
|
40
53
|
exports.toISO = toISO;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# EbayDateTextbox
|
|
2
|
+
|
|
3
|
+
## Usage
|
|
4
|
+
|
|
5
|
+
### Import JS
|
|
6
|
+
|
|
7
|
+
```jsx harmony
|
|
8
|
+
import { EbayDateTextbox } from "@ebay/ui-core-react/ebay-date-textbox";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Import following styles from SKIN
|
|
12
|
+
|
|
13
|
+
```jsx harmony
|
|
14
|
+
import "@ebay/skin/calendar";
|
|
15
|
+
import "@ebay/skin/date-textbox";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```react
|
|
19
|
+
<EbayDateTextbox value="2024-01-05" />
|
|
20
|
+
|
|
21
|
+
<EbayDateTextbox range value="2024-01-05" rangeEnd="2024-02-04" />
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Attributes
|
|
25
|
+
|
|
26
|
+
| Name | Type | Stateful | Description | Data |
|
|
27
|
+
| ---------------------- | -------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------- | --- |
|
|
28
|
+
| `value` | Date, Number, String | No | Selected date for controlled component. |
|
|
29
|
+
| `rangeEnd` | Date, Number, String | No | If range is true, the end of the selected range. |
|
|
30
|
+
| `defaultValue` | Date, Number, String | No | Default selected date. Use it for not controlled component. |
|
|
31
|
+
| `defaultRangeEnd` | Date, Number, String | No | Default end of the selected range. Use it for not controlled component. |
|
|
32
|
+
| `range` | Boolean | No | True if selecting a range, false if a single value |
|
|
33
|
+
| `locale` | String | No | Locale of the date picker, default to `navigator.language` |
|
|
34
|
+
| `inputPlaceholderText` | String, String[] | No | Text for the input placeholder. Should indicate that users need to enter dates in ISO format. If separate placeholders are required for a range display, use an array of two strings (i. e. `["Start (YYYY-MM-DD)", "End (YYYY-MM-DD)"]`). |
|
|
35
|
+
| `collapseOnSelect` | Boolean | No | Whether the calendar should collapse after a date is selected |
|
|
36
|
+
| `disableBefore` | Date | No | First date that may be selected |
|
|
37
|
+
| `disableAfter` | Date | No | Last date that may be selected |
|
|
38
|
+
| `disableWeekdays` | Number[] | No | List of weekdays that are disabled. Must be an array of numbers, where Sunday is `0` and Saturday is `6` |
|
|
39
|
+
| `disableList` | String[], Date[] | No | List of specific days that are disabled. Should be a list of ISO strings, but also accepts timestamps or `Date` objects |
|
|
40
|
+
| `linkBuilder` | Function | No | Function used to build the href for each date. The function is passed the date as a `Date` object, and should return a url string. For dates that don't have a link, the function should return a falsy value |
|
|
41
|
+
| `getA11yShowMonthText` | Function | No | Function used to get the text for showing previous and next months, defaults to `Show ${monthName}` |
|
|
42
|
+
| `a11ySelectedText` | String | No | Text to be read by screen readers when a date is selected, defaults to `Selected` |
|
|
43
|
+
| `a11yRangeStartText` | String | No | Text to be read by screen readers when a date is the start of a range, defaults to `Start of range` |
|
|
44
|
+
| `a11yInRangeText` | String | No | Text to be read by screen readers when a date is in a range, defaults to `in range` |
|
|
45
|
+
| `a11yRangeEndText` | String | No | Text to be read by screen readers when a date is the end of a range, defaults to `End of range` |
|
|
46
|
+
| `a11yTodayText` | String | No | Text to be read by screen readers when a date is the current date, defaults to `Today` |
|
|
47
|
+
| `a11yDisabledText` | String | No | Text to be read by screen readers when a date is disabled, defaults to `inactive` |
|
|
48
|
+
| `a11ySeparator` | String | No | Text to be read by screen readers to separate properties, defaults to `-` |
|
|
49
|
+
| `a11yOpenPopoverText` | String | No | Text to be read by screen readers for the button that opens the calendar popover |
|
|
50
|
+
| `onChange` | Function | - | Triggered when the selection changes | `(event: Event, { selected?, rangeStart?, rangeEnd? })` | |
|
|
51
|
+
| `onInputChange` | Function | - | Triggered when the input field is typed, use it for controlled components | `(event: Event)` | |
|
|
52
|
+
| `onInputRangeEndChange` | Function | - | Triggered when the range end input field is typed, use it for controlled components | `(event: Event)` | |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { EbayCalendarProps } from '../ebay-calendar/calendar';
|
|
3
|
+
import { EbayChangeEventHandler, EbayFocusEventHandler, EbayMouseEventHandler } from '../common/event-utils/types';
|
|
4
|
+
type EventData = {
|
|
5
|
+
selected?: string;
|
|
6
|
+
rangeStart?: string;
|
|
7
|
+
rangeEnd?: string;
|
|
8
|
+
};
|
|
9
|
+
export type EbayDateTextboxProps = Omit<EbayCalendarProps, 'interactive' | 'navigable' | 'numMonths' | 'selected'> & {
|
|
10
|
+
className?: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
rangeEnd?: string;
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
defaultRangeEnd?: string;
|
|
15
|
+
range?: boolean;
|
|
16
|
+
collapseOnSelect?: boolean;
|
|
17
|
+
inputPlaceholderText?: string | string[];
|
|
18
|
+
a11yOpenPopoverText?: string;
|
|
19
|
+
onChange?: EbayChangeEventHandler<HTMLInputElement, EventData> & EbayMouseEventHandler<HTMLInputElement, EventData> & EbayFocusEventHandler<HTMLInputElement, EventData>;
|
|
20
|
+
onInputChange?: EbayChangeEventHandler<HTMLInputElement>;
|
|
21
|
+
onInputRangeEndChange?: EbayChangeEventHandler<HTMLInputElement>;
|
|
22
|
+
};
|
|
23
|
+
declare const EbayDateTextbox: FC<EbayDateTextboxProps>;
|
|
24
|
+
export default EbayDateTextbox;
|
|
25
|
+
//# sourceMappingURL=date-textbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-textbox.d.ts","sourceRoot":"","sources":["../../src/ebay-date-textbox/date-textbox.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAe,EAAE,EAAuD,MAAM,OAAO,CAAA;AAEnG,OAAqB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAG3E,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAIlH,KAAK,SAAS,GAAG;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,WAAW,GAAG,WAAW,GAAG,UAAU,CAAC,GAAG;IACjH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,EAAE,SAAS,CAAC,GACxD,qBAAqB,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAClD,qBAAqB,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;IACzD,aAAa,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;IACzD,qBAAqB,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;CACpE,CAAA;AAID,QAAA,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CA8L7C,CAAA;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -0,0 +1,195 @@
|
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
37
|
+
var t = {};
|
|
38
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
39
|
+
t[p] = s[p];
|
|
40
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
41
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
42
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
43
|
+
t[p[i]] = s[p[i]];
|
|
44
|
+
}
|
|
45
|
+
return t;
|
|
46
|
+
};
|
|
47
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
var react_1 = __importStar(require("react"));
|
|
52
|
+
var makeup_expander_1 = __importDefault(require("makeup-expander"));
|
|
53
|
+
var calendar_1 = __importDefault(require("../ebay-calendar/calendar"));
|
|
54
|
+
var ebay_textbox_1 = require("../ebay-textbox");
|
|
55
|
+
var date_utils_1 = require("../ebay-calendar/date-utils");
|
|
56
|
+
var textbox_1 = require("../ebay-textbox/textbox");
|
|
57
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
58
|
+
var MIN_WIDTH_FOR_DOUBLE_PANE = 600;
|
|
59
|
+
var EbayDateTextbox = function (_a) {
|
|
60
|
+
var className = _a.className, _b = _a.inputPlaceholderText, inputPlaceholderText = _b === void 0 ? 'YYYY-MM-DD' : _b, _c = _a.a11yOpenPopoverText, a11yOpenPopoverText = _c === void 0 ? 'open calendar' : _c, range = _a.range, controlledValue = _a.value, controlledRangeEnd = _a.rangeEnd, defaultValue = _a.defaultValue, defaultRangeEnd = _a.defaultRangeEnd, collapseOnSelect = _a.collapseOnSelect, _d = _a.onChange, onChange = _d === void 0 ? function () { } : _d, _e = _a.onInputChange, onInputChange = _e === void 0 ? function () { } : _e, _f = _a.onInputRangeEndChange, onInputRangeEndChange = _f === void 0 ? function () { } : _f, rest = __rest(_a, ["className", "inputPlaceholderText", "a11yOpenPopoverText", "range", "value", "rangeEnd", "defaultValue", "defaultRangeEnd", "collapseOnSelect", "onChange", "onInputChange", "onInputRangeEndChange"]);
|
|
61
|
+
var expander = (0, react_1.useRef)();
|
|
62
|
+
var containerRef = (0, react_1.useRef)(null);
|
|
63
|
+
var _g = (0, react_1.useState)(defaultValue || ''), internalValue = _g[0], setInternalValue = _g[1];
|
|
64
|
+
var _h = (0, react_1.useState)(defaultRangeEnd || ''), internalRangeEnd = _h[0], setInternalRangeEnd = _h[1];
|
|
65
|
+
var valueToRender = (0, textbox_1.isControlled)(controlledValue) ? controlledValue : internalValue;
|
|
66
|
+
var rangeEndToRender = (0, textbox_1.isControlled)(controlledRangeEnd) ? controlledRangeEnd : internalRangeEnd;
|
|
67
|
+
var _j = (0, react_1.useState)(function () {
|
|
68
|
+
return (0, date_utils_1.dateArgToISO)(valueToRender);
|
|
69
|
+
}), firstSelected = _j[0], setFirstSelected = _j[1];
|
|
70
|
+
var _k = (0, react_1.useState)(function () {
|
|
71
|
+
return (0, date_utils_1.dateArgToISO)(rangeEndToRender);
|
|
72
|
+
}), secondSelected = _k[0], setSecondSelected = _k[1];
|
|
73
|
+
var _l = (0, react_1.useState)(false), isPopoverOpen = _l[0], setIsPopoverOpen = _l[1];
|
|
74
|
+
var _m = (0, react_1.useState)(1), numMonths = _m[0], setNumMonths = _m[1];
|
|
75
|
+
var openPopover = function () {
|
|
76
|
+
setIsPopoverOpen(true);
|
|
77
|
+
};
|
|
78
|
+
var closePopover = function () {
|
|
79
|
+
setIsPopoverOpen(false);
|
|
80
|
+
};
|
|
81
|
+
(0, react_1.useEffect)(function () {
|
|
82
|
+
if (!containerRef.current) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
expander.current = new makeup_expander_1.default(containerRef.current, {
|
|
86
|
+
hostSelector: '.ebay-date-textbox--main > .icon-btn',
|
|
87
|
+
contentSelector: '.date-textbox__popover',
|
|
88
|
+
expandOnClick: true,
|
|
89
|
+
autoCollapse: true
|
|
90
|
+
});
|
|
91
|
+
containerRef.current.addEventListener('expander-expand', openPopover);
|
|
92
|
+
containerRef.current.addEventListener('expander-collapse', closePopover);
|
|
93
|
+
var calculateNumMonths = function () {
|
|
94
|
+
setNumMonths(document.documentElement.clientWidth < MIN_WIDTH_FOR_DOUBLE_PANE ? 1 : 2);
|
|
95
|
+
};
|
|
96
|
+
calculateNumMonths();
|
|
97
|
+
window.addEventListener('resize', calculateNumMonths);
|
|
98
|
+
return function () {
|
|
99
|
+
var _a;
|
|
100
|
+
(_a = expander.current) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
101
|
+
window.removeEventListener('resize', calculateNumMonths);
|
|
102
|
+
};
|
|
103
|
+
}, []);
|
|
104
|
+
var handleInputChange = function (event, index) {
|
|
105
|
+
var date = new Date(event.target.value);
|
|
106
|
+
var iso = isNaN(date.getTime()) ? null : (0, date_utils_1.toISO)(date);
|
|
107
|
+
if (index === 0) {
|
|
108
|
+
setFirstSelected(iso);
|
|
109
|
+
setInternalValue(iso || '');
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
setSecondSelected(iso);
|
|
113
|
+
setInternalRangeEnd(iso || '');
|
|
114
|
+
}
|
|
115
|
+
if (range) {
|
|
116
|
+
onChange(event, {
|
|
117
|
+
rangeStart: index === 0 ? iso : firstSelected,
|
|
118
|
+
rangeEnd: index === 1 ? iso : secondSelected
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
onChange(event, {
|
|
123
|
+
selected: iso
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
var handlePopoverSelect = function (event, _a) {
|
|
128
|
+
var iso = _a.iso;
|
|
129
|
+
setFirstSelected(iso);
|
|
130
|
+
setInternalValue(iso);
|
|
131
|
+
if (range) {
|
|
132
|
+
var selected = firstSelected || secondSelected;
|
|
133
|
+
var eventData = {
|
|
134
|
+
rangeStart: iso,
|
|
135
|
+
rangeEnd: selected
|
|
136
|
+
};
|
|
137
|
+
if (firstSelected && secondSelected) {
|
|
138
|
+
// both were selected reset selection
|
|
139
|
+
setInternalRangeEnd('');
|
|
140
|
+
setSecondSelected(null);
|
|
141
|
+
eventData.rangeEnd = null;
|
|
142
|
+
}
|
|
143
|
+
else if (selected) {
|
|
144
|
+
// exactly one was selected; fiture out the order
|
|
145
|
+
if (selected < iso) {
|
|
146
|
+
setFirstSelected(selected);
|
|
147
|
+
setInternalValue(selected);
|
|
148
|
+
setInternalRangeEnd(iso);
|
|
149
|
+
setSecondSelected(iso);
|
|
150
|
+
eventData.rangeStart = selected;
|
|
151
|
+
eventData.rangeEnd = iso;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
setFirstSelected(iso);
|
|
155
|
+
setInternalValue(iso);
|
|
156
|
+
setInternalRangeEnd(selected);
|
|
157
|
+
setSecondSelected(selected);
|
|
158
|
+
eventData.rangeStart = iso;
|
|
159
|
+
eventData.rangeEnd = selected;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
onChange(event, eventData);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
onChange(event, {
|
|
166
|
+
selected: iso
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (collapseOnSelect) {
|
|
170
|
+
expander.current.expanded = false;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
var handleInternalChange = function (event, index) {
|
|
174
|
+
if (index === 0) {
|
|
175
|
+
setInternalValue(event.target.value);
|
|
176
|
+
onInputChange(event);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
setInternalRangeEnd(event.target.value);
|
|
180
|
+
onInputRangeEndChange(event);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
var _o = Array.isArray(inputPlaceholderText)
|
|
184
|
+
? inputPlaceholderText
|
|
185
|
+
: [inputPlaceholderText, inputPlaceholderText], rangeStartPlaceholder = _o[0], mainPlaceholder = _o[1];
|
|
186
|
+
return (react_1.default.createElement("span", { className: (0, classnames_1.default)('date-textbox', className), ref: containerRef },
|
|
187
|
+
range && (react_1.default.createElement(ebay_textbox_1.EbayTextbox, { value: valueToRender, placeholder: rangeStartPlaceholder, onInputChange: function (event) { return handleInternalChange(event, 0); }, onBlur: function (event) { return handleInputChange(event, 0); } })),
|
|
188
|
+
react_1.default.createElement(ebay_textbox_1.EbayTextbox, { className: "ebay-date-textbox--main", placeholder: mainPlaceholder, value: range ? rangeEndToRender : valueToRender, onInputChange: function (event) { return handleInternalChange(event, range ? 1 : 0); }, onBlur: function (event) { return handleInputChange(event, range ? 1 : 0); } },
|
|
189
|
+
react_1.default.createElement(ebay_textbox_1.EbayTextboxPostfixIcon, { name: "calendar24", buttonAriaLabel: a11yOpenPopoverText })),
|
|
190
|
+
react_1.default.createElement("div", { hidden: !isPopoverOpen, className: "date-textbox__popover" },
|
|
191
|
+
react_1.default.createElement(calendar_1.default, __assign({}, rest, { range: range, interactive: true, navigable: true, numMonths: numMonths, selected: firstSelected && secondSelected
|
|
192
|
+
? [firstSelected, secondSelected]
|
|
193
|
+
: firstSelected || secondSelected || undefined, onSelect: handlePopoverSelect })))));
|
|
194
|
+
};
|
|
195
|
+
exports.default = EbayDateTextbox;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-date-textbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EbayDateTextbox = void 0;
|
|
7
|
+
var date_textbox_1 = require("./date-textbox");
|
|
8
|
+
Object.defineProperty(exports, "EbayDateTextbox", { enumerable: true, get: function () { return __importDefault(date_textbox_1).default; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/ebay-pagination/pagination.tsx"],"names":[],"mappings":"AAAA,OAAc,EACA,cAAc,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/ebay-pagination/pagination.tsx"],"names":[],"mappings":"AAAA,OAAc,EACA,cAAc,EAAE,EAAE,EAE/B,MAAM,OAAO,CAAA;AAUd,OAAO,EAAa,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACpE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9D,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,eAAe,CAiKvC,CAAA;AAED,eAAe,cAAc,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { ComponentProps, Ref } from 'react';
|
|
2
2
|
import { Size } from './index';
|
|
3
3
|
import { EbayChangeEventHandler, EbayEventHandler, EbayFocusEventHandler, EbayKeyboardEventHandler, EbayMouseEventHandler } from '../common/event-utils/types';
|
|
4
|
+
export declare const isControlled: (value?: unknown) => boolean;
|
|
4
5
|
type TextInputProps = ComponentProps<'input'> & ComponentProps<'textarea'>;
|
|
5
6
|
export type TextboxEventProps = {
|
|
6
7
|
value: string;
|
|
@@ -25,6 +26,6 @@ export type EbayTextboxProps = {
|
|
|
25
26
|
forwardedRef?: Ref<HTMLTextAreaElement | HTMLInputElement>;
|
|
26
27
|
opaqueLabel?: boolean;
|
|
27
28
|
} & Omit<TextInputProps, 'onFocus' | 'onBlur' | 'onChange' | 'onKeyPress' | 'onKeyUp' | 'onKeyDown' | 'onInvalid'>;
|
|
28
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<EbayTextboxProps, "form" | "slot" | "style" | "title" | "pattern" | "forwardedRef" | "type" | "invalid" | "key" | "value" | "className" | "disabled" | "inputSize" | "placeholder" | "opaqueLabel" | "children" | "multiple" | "name" | "required" | "size" | "list" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "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" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "cols" | "crossOrigin" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "max" | "maxLength" | "min" | "minLength" | "readOnly" | "rows" | "src" | "step" | "width" | "wrap" | "fluid" | "dirName" | "
|
|
29
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<EbayTextboxProps, "form" | "slot" | "style" | "title" | "pattern" | "forwardedRef" | "type" | "invalid" | "key" | "value" | "className" | "disabled" | "inputSize" | "placeholder" | "opaqueLabel" | "children" | "multiple" | "name" | "required" | "size" | "list" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "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" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "cols" | "crossOrigin" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "max" | "maxLength" | "min" | "minLength" | "readOnly" | "rows" | "src" | "step" | "width" | "wrap" | "fluid" | "dirName" | "multiline" | "onInputChange" | "onFloatingLabelInit" | "onButtonClick" | "floatingLabel"> & React.RefAttributes<React.FC<EbayTextboxProps>>>;
|
|
29
30
|
export default _default;
|
|
30
31
|
//# 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,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;
|
|
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;AAEpC,eAAO,MAAM,YAAY,WAAY,OAAO,KAAG,OAAuC,CAAA;AAEtF,KAAK,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,cAAc,CAAC,UAAU,CAAC,CAAA;AAE1E,MAAM,MAAM,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AACjD,MAAM,MAAM,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;IAC3D,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,CAAC,CAAC;;AA0JnH,wBAA4D"}
|
package/ebay-textbox/textbox.js
CHANGED
|
@@ -48,12 +48,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
48
48
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
49
|
};
|
|
50
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.isControlled = void 0;
|
|
51
52
|
var react_1 = __importStar(require("react"));
|
|
52
53
|
var classnames_1 = __importDefault(require("classnames"));
|
|
53
54
|
var component_utils_1 = require("../common/component-utils");
|
|
54
55
|
var index_1 = require("./index");
|
|
55
56
|
var hooks_1 = require("../common/floating-label-utils/hooks");
|
|
56
57
|
var isControlled = function (value) { return typeof value !== 'undefined'; };
|
|
58
|
+
exports.isControlled = isControlled;
|
|
57
59
|
var EbayTextbox = function (_a) {
|
|
58
60
|
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, opaqueLabel = _a.opaqueLabel, 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", "opaqueLabel"]);
|
|
59
61
|
var _q = (0, react_1.useState)(defaultValue), value = _q[0], setValue = _q[1];
|
|
@@ -114,7 +116,7 @@ var EbayTextbox = function (_a) {
|
|
|
114
116
|
var handleInputChange = function (e) {
|
|
115
117
|
var _a;
|
|
116
118
|
var newValue = (_a = e.target) === null || _a === void 0 ? void 0 : _a.value;
|
|
117
|
-
if (!isControlled(controlledValue)) {
|
|
119
|
+
if (!(0, exports.isControlled)(controlledValue)) {
|
|
118
120
|
setInputValue(newValue);
|
|
119
121
|
}
|
|
120
122
|
onInputChange(e, { value: newValue });
|
|
@@ -127,14 +129,14 @@ var EbayTextbox = function (_a) {
|
|
|
127
129
|
'textbox__control--fluid': fluid,
|
|
128
130
|
'textbox__control--large': inputSize === 'large'
|
|
129
131
|
});
|
|
130
|
-
var wrapperClassName = (0, classnames_1.default)('textbox', {
|
|
132
|
+
var wrapperClassName = (0, classnames_1.default)('textbox', rest.className, {
|
|
131
133
|
'textbox--icon-end': postfixIcon
|
|
132
134
|
});
|
|
133
135
|
return (react_1.default.createElement(Container, null,
|
|
134
136
|
label,
|
|
135
137
|
react_1.default.createElement(Wrapper, { className: wrapperClassName },
|
|
136
138
|
prefixIcon,
|
|
137
|
-
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 })),
|
|
139
|
+
react_1.default.createElement(Input, __assign({}, rest, { className: inputClassName, type: type, "aria-invalid": invalid, value: (0, exports.isControlled)(controlledValue) ? controlledValue : inputValue, onChange: handleInputChange, onBlur: handleBlur, onFocus: handleFocus, onKeyPress: handleKeyPress, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, onInvalid: handleInvalid, autoFocus: autoFocus, ref: ref, placeholder: floatingLabelPlaceholder })),
|
|
138
140
|
postfixIcon && (0, react_1.cloneElement)(postfixIcon, __assign(__assign({}, postfixIcon.props), { onClick: function (e) {
|
|
139
141
|
var _a = postfixIcon.props.onClick, iconClick = _a === void 0 ? function () { } : _a;
|
|
140
142
|
iconClick(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ebay/ui-core-react",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Skin components build off React",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"classnames": "^2.2.6",
|
|
52
|
+
"makeup-expander": "^0.10.1",
|
|
52
53
|
"makeup-keyboard-trap": "^0.4.1",
|
|
53
54
|
"makeup-screenreader-trap": "^0.4.1",
|
|
54
55
|
"react-remove-scroll": "^2.2.0"
|