@ebay/ui-core-react 6.0.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-button/button.d.ts +1 -1
- package/ebay-button/button.d.ts.map +1 -1
- package/ebay-button/button.js +1 -0
- package/ebay-button/types.d.ts +1 -1
- package/ebay-button/types.d.ts.map +1 -1
- package/ebay-calendar/README.md +44 -0
- package/ebay-calendar/calendar.d.ts +35 -0
- package/ebay-calendar/calendar.d.ts.map +1 -0
- package/ebay-calendar/calendar.js +323 -0
- package/ebay-calendar/date-utils.d.ts +14 -0
- package/ebay-calendar/date-utils.d.ts.map +1 -0
- package/ebay-calendar/date-utils.js +67 -0
- package/ebay-calendar/index.d.ts +2 -0
- package/ebay-calendar/index.d.ts.map +1 -0
- package/ebay-calendar/index.js +8 -0
- package/ebay-cta-button/cta-button.d.ts +1 -1
- 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-icon-button/README.md +1 -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 +2 -2
- package/ebay-infotip/ebay-infotip-host.d.ts +1 -1
- package/ebay-lightbox-dialog/lightbox-dialog.d.ts +4 -2
- package/ebay-lightbox-dialog/lightbox-dialog.d.ts.map +1 -1
- package/ebay-lightbox-dialog/lightbox-dialog.js +2 -2
- 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-button/button.d.ts
CHANGED
|
@@ -18,6 +18,6 @@ export type EbayButtonProps = {
|
|
|
18
18
|
fixedHeight?: boolean;
|
|
19
19
|
};
|
|
20
20
|
type Props = ComponentProps<'button'> & ComponentProps<'a'> & EbayButtonProps;
|
|
21
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "split" | "form" | "slot" | "style" | "title" | "forwardedRef" | "type" | "key" | "value" | "className" | "disabled" | "placeholder" | "children" | "name" | "size" | "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" | "autoFocus" | "download" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "href" | "hrefLang" | "media" | "rel" | "target" | "
|
|
21
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "split" | "form" | "slot" | "style" | "title" | "forwardedRef" | "type" | "key" | "value" | "className" | "disabled" | "placeholder" | "children" | "name" | "size" | "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" | "autoFocus" | "download" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "href" | "hrefLang" | "media" | "rel" | "target" | "priority" | "variant" | "bodyState" | "transparent" | "fluid" | "partiallyDisabled" | "onEscape" | "truncate" | "borderless" | "fixedHeight" | "ping" | "referrerPolicy"> & React.RefAttributes<React.FC<Props>>>;
|
|
22
22
|
export default _default;
|
|
23
23
|
//# sourceMappingURL=button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/ebay-button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEV,cAAc,EAEd,aAAa,EACb,UAAU,EAGV,SAAS,EACZ,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAKnE,MAAM,MAAM,eAAe,GAAG;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC7E,YAAY,CAAC,EAAE,SAAS,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,CAAC;IAChE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB,CAAA;AAED,KAAK,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC;;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/ebay-button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEV,cAAc,EAEd,aAAa,EACb,UAAU,EAGV,SAAS,EACZ,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAKnE,MAAM,MAAM,eAAe,GAAG;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC7E,YAAY,CAAC,EAAE,SAAS,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,CAAC;IAChE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB,CAAA;AAED,KAAK,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC;;AAsH9E,wBAAyC"}
|
package/ebay-button/button.js
CHANGED
package/ebay-button/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type Priority = 'primary' | 'secondary' | 'tertiary' | 'none';
|
|
2
2
|
export type Variant = 'standard' | 'destructive' | 'form';
|
|
3
|
-
export type Size = 'default' | 'regular' | 'large';
|
|
3
|
+
export type Size = 'default' | 'regular' | 'small' | 'large';
|
|
4
4
|
export type BodyState = 'loading' | 'expand' | 'reset' | 'none';
|
|
5
5
|
export type Split = 'start' | 'end';
|
|
6
6
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ebay-button/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,CAAA;AAEpE,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,aAAa,GAAG,MAAM,CAAA;AAEzD,MAAM,MAAM,IAAI,GAAG,SAAS,GAAoB,SAAS,GAAG,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ebay-button/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,CAAA;AAEpE,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,aAAa,GAAG,MAAM,CAAA;AAEzD,MAAM,MAAM,IAAI,GAAG,SAAS,GAAoB,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;AAE7E,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;AAE/D,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# EbayCalendar
|
|
2
|
+
|
|
3
|
+
## Usage
|
|
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
|
+
|
|
15
|
+
```react
|
|
16
|
+
<EbayCalendar />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Attributes
|
|
20
|
+
|
|
21
|
+
| Name | Type | Stateful | Description | Data |
|
|
22
|
+
| ---------------------- | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | --- |
|
|
23
|
+
| `navigable` | Boolean | No | If true, a header is included that allows for navigation between months |
|
|
24
|
+
| `interactive` | Boolean | No | Date cells are contained in buttons for interactive calendars, and spans otherwise |
|
|
25
|
+
| `numMonths` | Number | No | Number of months to be displayed at once |
|
|
26
|
+
| `range` | Boolean | No | True if selecting a range, false if a single value |
|
|
27
|
+
| `selected` | Date, Date[] | No | Date or list of dates that are selected, represented as an ISO string or an array of ISO strings |
|
|
28
|
+
| `locale` | String | No | Locale of the date picker, default to `navigator.language` |
|
|
29
|
+
| `disableBefore` | Date | No | First date that may be selected |
|
|
30
|
+
| `disableAfter` | Date | No | Last date that may be selected |
|
|
31
|
+
| `disableWeekdays` | Number[] | No | List of weekdays that are disabled. Must be an array of numbers, where Sunday is `0` and Saturday is `6` |
|
|
32
|
+
| `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 |
|
|
33
|
+
| `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 |
|
|
34
|
+
| `getA11yShowMonthText` | Function | No | Function used to get the text for showing previous and next months, defaults to `Show ${monthName}` |
|
|
35
|
+
| `a11ySelectedText` | String | No | Text to be read by screen readers when a date is selected, defaults to `Selected` |
|
|
36
|
+
| `a11yRangeStartText` | String | No | Text to be read by screen readers when a date is the start of a range, defaults to `Start of range` |
|
|
37
|
+
| `a11yInRangeText` | String | No | Text to be read by screen readers when a date is in a range, defaults to `in range` |
|
|
38
|
+
| `a11yRangeEndText` | String | No | Text to be read by screen readers when a date is the end of a range, defaults to `End of range` |
|
|
39
|
+
| `a11yTodayText` | String | No | Text to be read by screen readers when a date is the current date, defaults to `Today` |
|
|
40
|
+
| `a11yDisabledText` | String | No | Text to be read by screen readers when a date is disabled, defaults to `inactive` |
|
|
41
|
+
| `a11ySeparator` | String | No | Text to be read by screen readers to separate properties, defaults to `-` |
|
|
42
|
+
| `onFocus` | Function | - | Triggered when a day is focused on, typically via keyboard events | `(event: FocusEvent, { iso })` | |
|
|
43
|
+
| `onSelect` | Function | - | Triggered when a day is selected | `(event: Event, { iso })` | |
|
|
44
|
+
| `onMonthChange` | Function | - | Triggered during month navigation | `(event: Event, { iso })` | |
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { FC, FocusEvent, KeyboardEvent, MouseEvent } from 'react';
|
|
2
|
+
import { DayISO } from './date-utils';
|
|
3
|
+
export type EbayCalendarProps = {
|
|
4
|
+
selected?: DayISO | DayISO[];
|
|
5
|
+
numMonths?: number;
|
|
6
|
+
navigable?: boolean;
|
|
7
|
+
interactive?: boolean;
|
|
8
|
+
range?: boolean;
|
|
9
|
+
locale?: string;
|
|
10
|
+
disableBefore?: DayISO;
|
|
11
|
+
disableAfter?: DayISO;
|
|
12
|
+
disableWeekdays?: number[];
|
|
13
|
+
disableList?: DayISO[];
|
|
14
|
+
getA11yShowMonthText?: (monthTitle: string) => string;
|
|
15
|
+
a11ySelectedText?: string;
|
|
16
|
+
a11yRangeStartText?: string;
|
|
17
|
+
a11yInRangeText?: string;
|
|
18
|
+
a11yRangeEndText?: string;
|
|
19
|
+
a11ySeparator?: string;
|
|
20
|
+
a11yTodayText?: string;
|
|
21
|
+
a11yDisabledText?: string;
|
|
22
|
+
linkBuilder?: (iso: DayISO) => string;
|
|
23
|
+
onMonthChange?: ({ iso }: {
|
|
24
|
+
iso: DayISO;
|
|
25
|
+
}) => void;
|
|
26
|
+
onFocus?: (event: MouseEvent | KeyboardEvent | FocusEvent, { iso }: {
|
|
27
|
+
iso: DayISO;
|
|
28
|
+
}) => void;
|
|
29
|
+
onSelect?: (event: MouseEvent, { iso }: {
|
|
30
|
+
iso: DayISO;
|
|
31
|
+
}) => void;
|
|
32
|
+
};
|
|
33
|
+
declare const EbayCalendar: FC<EbayCalendarProps>;
|
|
34
|
+
export default EbayCalendar;
|
|
35
|
+
//# sourceMappingURL=calendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../src/ebay-calendar/calendar.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAA+B,MAAM,OAAO,CAAA;AAErG,OAAO,EAAE,MAAM,EAA6D,MAAM,cAAc,CAAA;AAGhG,MAAM,MAAM,iBAAiB,GAAG;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,oBAAoB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IACtD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IACtC,aAAa,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACnD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,GAAG,aAAa,GAAG,UAAU,EAAE,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC7F,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACpE,CAAA;AASD,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAqavC,CAAA;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
26
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
27
|
+
if (ar || !(i in from)) {
|
|
28
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
29
|
+
ar[i] = from[i];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
var react_1 = __importStar(require("react"));
|
|
39
|
+
var ebay_icon_button_1 = require("../ebay-icon-button");
|
|
40
|
+
var date_utils_1 = require("./date-utils");
|
|
41
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
42
|
+
var DAY_UPDATE_KEYMAP = {
|
|
43
|
+
ArrowRight: 1,
|
|
44
|
+
ArrowLeft: -1,
|
|
45
|
+
ArrowDown: 7,
|
|
46
|
+
ArrowUp: -7
|
|
47
|
+
};
|
|
48
|
+
var EbayCalendar = function (_a) {
|
|
49
|
+
var selected = _a.selected, _b = _a.numMonths, numMonths = _b === void 0 ? 1 : _b, navigable = _a.navigable, interactive = _a.interactive, range = _a.range, locale = _a.locale, disableBefore = _a.disableBefore, disableAfter = _a.disableAfter, disableWeekdays = _a.disableWeekdays, disableList = _a.disableList, _c = _a.a11ySelectedText, a11ySelectedText = _c === void 0 ? 'selected' : _c, _d = _a.a11yRangeStartText, a11yRangeStartText = _d === void 0 ? 'start of range' : _d, _e = _a.a11yInRangeText, a11yInRangeText = _e === void 0 ? 'in range' : _e, _f = _a.a11yRangeEndText, a11yRangeEndText = _f === void 0 ? 'end of range' : _f, _g = _a.a11ySeparator, a11ySeparator = _g === void 0 ? '-' : _g, _h = _a.a11yTodayText, a11yTodayText = _h === void 0 ? 'today' : _h, _j = _a.a11yDisabledText, a11yDisabledText = _j === void 0 ? 'inactive' : _j, _k = _a.getA11yShowMonthText, getA11yShowMonthText = _k === void 0 ? function (monthTitle) { return "Show ".concat(monthTitle); } : _k, linkBuilder = _a.linkBuilder, _l = _a.onMonthChange, onMonthChange = _l === void 0 ? function () { } : _l, _m = _a.onFocus, onFocus = _m === void 0 ? function () { } : _m, _o = _a.onSelect, onSelect = _o === void 0 ? function () { } : _o;
|
|
50
|
+
var todayISO = (0, date_utils_1.toISO)(new Date());
|
|
51
|
+
var _p = (0, date_utils_1.getWeekdayInfo)((0, date_utils_1.localeOverride)(locale)), firstDayOfWeek = _p.firstDayOfWeek, weekdayLabels = _p.weekdayLabels;
|
|
52
|
+
var containerRef = (0, react_1.useRef)(null);
|
|
53
|
+
var _q = (0, react_1.useState)(0), offset = _q[0], setOffset = _q[1];
|
|
54
|
+
var _r = (0, react_1.useState)(null), focusISO = _r[0], setFocusISO = _r[1];
|
|
55
|
+
var _s = (0, react_1.useState)(todayISO), tabIndexISO = _s[0], setTabIndexISO = _s[1];
|
|
56
|
+
var baseISO = (0, react_1.useRef)(todayISO);
|
|
57
|
+
var getMonthDate = function (monthOffset) {
|
|
58
|
+
var baseDate = (0, date_utils_1.fromISO)(baseISO.current);
|
|
59
|
+
var date = new Date(Date.UTC(baseDate.getUTCFullYear(), baseDate.getUTCMonth() + monthOffset));
|
|
60
|
+
return date;
|
|
61
|
+
};
|
|
62
|
+
var getFirstVisibleISO = function () {
|
|
63
|
+
return (0, date_utils_1.toISO)(getMonthDate(offset));
|
|
64
|
+
};
|
|
65
|
+
var getLastVisibleISO = function () {
|
|
66
|
+
var baseDate = (0, date_utils_1.fromISO)(baseISO.current);
|
|
67
|
+
return (0, date_utils_1.toISO)(new Date(Date.UTC(baseDate.getUTCFullYear(), baseDate.getUTCMonth() + offset + (numMonths || 1), 0)));
|
|
68
|
+
};
|
|
69
|
+
(0, react_1.useEffect)(function () {
|
|
70
|
+
if (selected) {
|
|
71
|
+
var selectedISOs = Array.isArray(selected) ? selected : [selected];
|
|
72
|
+
var currFirstISO_1 = getFirstVisibleISO();
|
|
73
|
+
var currLastISO_1 = getLastVisibleISO();
|
|
74
|
+
var selectedTimeInView = selectedISOs.find(function (iso) { return iso >= currFirstISO_1 && iso <= currLastISO_1; });
|
|
75
|
+
if (selectedTimeInView === undefined) {
|
|
76
|
+
baseISO.current = selectedISOs[0];
|
|
77
|
+
setOffset(0);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}, [selected]);
|
|
81
|
+
var calculateRangeDisplay = function () {
|
|
82
|
+
if (selected && range) {
|
|
83
|
+
var iso1 = void 0;
|
|
84
|
+
var iso2 = void 0;
|
|
85
|
+
if (Array.isArray(selected)) {
|
|
86
|
+
// Two elements are selected, we can use them as the ends of the range.
|
|
87
|
+
iso1 = selected[0], iso2 = selected[1];
|
|
88
|
+
}
|
|
89
|
+
else if (focusISO) {
|
|
90
|
+
// One element is selected and the user is focused on a date,
|
|
91
|
+
// so we use the selected component and the focus date instead
|
|
92
|
+
iso1 = selected;
|
|
93
|
+
iso2 = focusISO;
|
|
94
|
+
}
|
|
95
|
+
if (iso1 && iso2) {
|
|
96
|
+
var _a = [iso1, iso2].sort(), start = _a[0], end = _a[1];
|
|
97
|
+
return {
|
|
98
|
+
rangeStart: start,
|
|
99
|
+
rangeEnd: end
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
rangeStart: null,
|
|
105
|
+
rangeEnd: null
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
var monthTitle = function (date) {
|
|
109
|
+
var formatter = new Intl.DateTimeFormat((0, date_utils_1.localeOverride)(locale), {
|
|
110
|
+
month: 'long',
|
|
111
|
+
year: 'numeric'
|
|
112
|
+
});
|
|
113
|
+
return formatter.format(new Date(date.getUTCFullYear(), date.getUTCMonth()));
|
|
114
|
+
};
|
|
115
|
+
var isDayDisabled = function (iso) {
|
|
116
|
+
return (disableBefore && iso < disableBefore) ||
|
|
117
|
+
(disableAfter && iso > disableAfter) ||
|
|
118
|
+
(disableWeekdays && disableWeekdays.includes((0, date_utils_1.fromISO)(iso).getUTCDay())) ||
|
|
119
|
+
(disableList && disableList.includes(iso));
|
|
120
|
+
};
|
|
121
|
+
var getFirstActiveISO = function () {
|
|
122
|
+
var iso = getFirstVisibleISO();
|
|
123
|
+
var lastVisible = getLastVisibleISO();
|
|
124
|
+
while (iso <= lastVisible && isDayDisabled(iso)) {
|
|
125
|
+
iso = (0, date_utils_1.offsetISO)(iso, 1);
|
|
126
|
+
}
|
|
127
|
+
return iso > lastVisible ? null : iso;
|
|
128
|
+
};
|
|
129
|
+
var getLastActiveISO = function () {
|
|
130
|
+
var iso = getLastVisibleISO();
|
|
131
|
+
var firstVisible = getFirstVisibleISO();
|
|
132
|
+
while (iso >= firstVisible && isDayDisabled(iso)) {
|
|
133
|
+
iso = (0, date_utils_1.offsetISO)(iso, -1);
|
|
134
|
+
}
|
|
135
|
+
return iso < firstVisible ? null : iso;
|
|
136
|
+
};
|
|
137
|
+
var setTabindexAndFocus = function (iso) {
|
|
138
|
+
setTabIndexISO(iso);
|
|
139
|
+
setTimeout(function () {
|
|
140
|
+
var _a;
|
|
141
|
+
var elementToFocus = (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("[data-iso=\"".concat(iso, "\"]"));
|
|
142
|
+
elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.focus();
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
var prevMonth = function (focus) {
|
|
146
|
+
if (disableBefore && getFirstVisibleISO() <= disableBefore) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
setOffset(function (currentOffset) { return currentOffset - 1; });
|
|
150
|
+
var newTabIndexISO = tabIndexISO;
|
|
151
|
+
var lastActiveISO = getLastActiveISO();
|
|
152
|
+
if (lastActiveISO && lastActiveISO < tabIndexISO) {
|
|
153
|
+
newTabIndexISO = lastActiveISO;
|
|
154
|
+
setTabIndexISO(lastActiveISO);
|
|
155
|
+
}
|
|
156
|
+
if (focus) {
|
|
157
|
+
setTabindexAndFocus(newTabIndexISO);
|
|
158
|
+
}
|
|
159
|
+
onMonthChange({
|
|
160
|
+
iso: (0, date_utils_1.toISO)(getMonthDate(offset))
|
|
161
|
+
});
|
|
162
|
+
return true;
|
|
163
|
+
};
|
|
164
|
+
var nextMonth = function (focus) {
|
|
165
|
+
if (disableAfter && getLastVisibleISO() >= disableAfter) {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
setOffset(function (currentOffset) { return currentOffset + 1; });
|
|
169
|
+
var newTabIndexISO = tabIndexISO;
|
|
170
|
+
var firstActiveISO = getFirstActiveISO();
|
|
171
|
+
if (firstActiveISO && firstActiveISO > tabIndexISO) {
|
|
172
|
+
newTabIndexISO = firstActiveISO;
|
|
173
|
+
setTabIndexISO(firstActiveISO);
|
|
174
|
+
}
|
|
175
|
+
if (focus) {
|
|
176
|
+
setTabindexAndFocus(newTabIndexISO);
|
|
177
|
+
}
|
|
178
|
+
onMonthChange({
|
|
179
|
+
iso: (0, date_utils_1.toISO)(getMonthDate(offset + (numMonths || 1)))
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
var onKeyDown = function (event) {
|
|
183
|
+
var dayChange = DAY_UPDATE_KEYMAP[event.key];
|
|
184
|
+
if (dayChange) {
|
|
185
|
+
event.preventDefault();
|
|
186
|
+
var tries = 7;
|
|
187
|
+
var iso = tabIndexISO;
|
|
188
|
+
do {
|
|
189
|
+
iso = (0, date_utils_1.offsetISO)(iso, dayChange);
|
|
190
|
+
} while (tries-- > 0 && isDayDisabled(iso));
|
|
191
|
+
if (tries > 0) {
|
|
192
|
+
var firstVisible = getFirstVisibleISO();
|
|
193
|
+
var lastVisible = getLastVisibleISO();
|
|
194
|
+
if (iso < firstVisible) {
|
|
195
|
+
if (navigable) {
|
|
196
|
+
prevMonth();
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
iso = firstVisible;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
else if (iso > lastVisible) {
|
|
203
|
+
if (navigable) {
|
|
204
|
+
nextMonth();
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
iso = lastVisible;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
setTabindexAndFocus(iso);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
switch (event.key) {
|
|
215
|
+
case 'PageUp':
|
|
216
|
+
prevMonth(true);
|
|
217
|
+
break;
|
|
218
|
+
case 'PageDown':
|
|
219
|
+
nextMonth(true);
|
|
220
|
+
break;
|
|
221
|
+
case 'Home':
|
|
222
|
+
setTabindexAndFocus(getFirstActiveISO());
|
|
223
|
+
break;
|
|
224
|
+
case 'End':
|
|
225
|
+
setTabindexAndFocus(getLastActiveISO());
|
|
226
|
+
break;
|
|
227
|
+
default:
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
var onDaySelect = function (event, iso) {
|
|
232
|
+
onSelect(event, { iso: iso });
|
|
233
|
+
};
|
|
234
|
+
var onDayFocus = function (event, day) {
|
|
235
|
+
setFocusISO(day);
|
|
236
|
+
setTabIndexISO(day);
|
|
237
|
+
onFocus(event, { iso: day });
|
|
238
|
+
};
|
|
239
|
+
var onDayBlur = function () {
|
|
240
|
+
setFocusISO(null);
|
|
241
|
+
};
|
|
242
|
+
var _t = calculateRangeDisplay(), rangeStart = _t.rangeStart, rangeEnd = _t.rangeEnd;
|
|
243
|
+
var isDayInRange = function (iso) {
|
|
244
|
+
if (!rangeStart || !rangeEnd) {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
if (iso < rangeStart || iso > rangeEnd) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
return true;
|
|
251
|
+
};
|
|
252
|
+
var monthDates = __spreadArray([], Array(numMonths), true).map(function (_, i) { return getMonthDate(offset + i); });
|
|
253
|
+
return (react_1.default.createElement("div", { className: "calendar", ref: containerRef },
|
|
254
|
+
navigable && (react_1.default.createElement("div", { className: "calendar__header" },
|
|
255
|
+
react_1.default.createElement("div", { className: "calendar__header--inner" },
|
|
256
|
+
react_1.default.createElement(ebay_icon_button_1.EbayIconButton, { transparent: true, size: "small", icon: "chevronLeft24", disabled: disableBefore && getFirstVisibleISO() <= disableBefore, "aria-label": getA11yShowMonthText(monthTitle(getMonthDate(offset - 1))), onClick: function () { return prevMonth(); } }),
|
|
257
|
+
monthDates.map(function (monthDate, i) { return (react_1.default.createElement("h3", { key: i }, monthTitle(monthDate))); }),
|
|
258
|
+
react_1.default.createElement(ebay_icon_button_1.EbayIconButton, { transparent: true, size: "small", icon: "chevronRight24", disabled: disableAfter && getLastVisibleISO() >= disableAfter, "aria-label": getA11yShowMonthText(monthTitle(getMonthDate(offset + numMonths))), onClick: function () { return nextMonth(); } })))),
|
|
259
|
+
react_1.default.createElement("div", { className: "calendar__body" }, monthDates.map(function (monthDate, i) {
|
|
260
|
+
var numBlankDays = (monthDate.getUTCDay() - firstDayOfWeek + 7) % 7;
|
|
261
|
+
var year = monthDate.getUTCFullYear();
|
|
262
|
+
var month = monthDate.getUTCMonth();
|
|
263
|
+
var daysInMont = new Date(year, month + 1, 0).getDate();
|
|
264
|
+
var calendarRows = __spreadArray([], Array(Math.ceil((numBlankDays + daysInMont) / 7)), true);
|
|
265
|
+
return (react_1.default.createElement("div", { key: i, className: "calendar__month" },
|
|
266
|
+
react_1.default.createElement("table", { onKeyDown: onKeyDown },
|
|
267
|
+
react_1.default.createElement("caption", null, monthTitle(monthDate)),
|
|
268
|
+
react_1.default.createElement("thead", null,
|
|
269
|
+
react_1.default.createElement("tr", null, weekdayLabels.map(function (dayName) { return (react_1.default.createElement("th", { key: dayName, scope: "col" }, dayName)); }))),
|
|
270
|
+
react_1.default.createElement("tbody", null, calendarRows.map(function (_, row) {
|
|
271
|
+
var startDate = row * 7 - numBlankDays + 1;
|
|
272
|
+
var endDate = startDate + 6;
|
|
273
|
+
var columns = [];
|
|
274
|
+
if (row === 0 && numBlankDays !== 0) {
|
|
275
|
+
startDate = 1;
|
|
276
|
+
columns.push(react_1.default.createElement("td", { key: "pre-column", colSpan: numBlankDays }));
|
|
277
|
+
}
|
|
278
|
+
else if (endDate > daysInMont) {
|
|
279
|
+
endDate = daysInMont;
|
|
280
|
+
}
|
|
281
|
+
var _loop_1 = function (day) {
|
|
282
|
+
var dayISO = (0, date_utils_1.toISO)(new Date(Date.UTC(year, month, day)));
|
|
283
|
+
var isToday = dayISO === todayISO;
|
|
284
|
+
var isSelected = Array.isArray(selected)
|
|
285
|
+
? selected.some(function (iso) { return iso === dayISO; })
|
|
286
|
+
: selected === dayISO;
|
|
287
|
+
var isRangeStart = dayISO === rangeStart;
|
|
288
|
+
var isInRange = isDayInRange(dayISO);
|
|
289
|
+
var isRangeEnd = dayISO === rangeEnd;
|
|
290
|
+
var isDisabled = isDayDisabled(dayISO);
|
|
291
|
+
var a11yTexts = [
|
|
292
|
+
'',
|
|
293
|
+
isSelected && a11ySelectedText,
|
|
294
|
+
isRangeStart && a11yRangeStartText,
|
|
295
|
+
!isRangeStart && !isRangeEnd && isInRange && a11yInRangeText,
|
|
296
|
+
isRangeEnd && a11yRangeEndText,
|
|
297
|
+
!interactive && isToday && a11yTodayText,
|
|
298
|
+
!interactive && isDisabled && a11yDisabledText
|
|
299
|
+
].filter(function (value) { return typeof value !== 'boolean' || value !== false; });
|
|
300
|
+
var link = !interactive && !isDisabled && linkBuilder && linkBuilder(dayISO);
|
|
301
|
+
var NonInteractiveTag = link ? 'a' : 'span';
|
|
302
|
+
columns.push(react_1.default.createElement("td", { key: day, className: (0, classnames_1.default)({
|
|
303
|
+
'calendar__cell--selected': isSelected,
|
|
304
|
+
'calendar__range--start': isRangeStart,
|
|
305
|
+
'calendar__range': isInRange,
|
|
306
|
+
'calendar__range--end': isRangeEnd
|
|
307
|
+
}) }, interactive ? (react_1.default.createElement("button", { disabled: isDisabled, "aria-label": a11yTexts.length > 1
|
|
308
|
+
? "".concat(day).concat(a11yTexts.join(a11ySeparator))
|
|
309
|
+
: undefined, tabIndex: tabIndexISO !== dayISO ? -1 : undefined, "aria-current": isToday ? 'date' : undefined, "aria-pressed": isSelected ? 'true' : undefined, onClick: function (event) { return onDaySelect(event, dayISO); }, onFocus: function (event) { return onDayFocus(event, dayISO); }, onMouseOver: function (event) { return onDayFocus(event, dayISO); }, onMouseOut: function (event) { return onDayBlur(); }, onBlur: function () { return onDayBlur(); }, "data-iso": dayISO }, day)) : (react_1.default.createElement(NonInteractiveTag, { className: (0, classnames_1.default)({
|
|
310
|
+
'calendar__cell--disabled': isDisabled,
|
|
311
|
+
'calendar__cell--current': isToday
|
|
312
|
+
}), href: link },
|
|
313
|
+
day,
|
|
314
|
+
a11yTexts.length > 1 && (react_1.default.createElement("span", { className: "clipped" }, a11yTexts.join(a11ySeparator)))))));
|
|
315
|
+
};
|
|
316
|
+
for (var day = startDate; day <= endDate; day++) {
|
|
317
|
+
_loop_1(day);
|
|
318
|
+
}
|
|
319
|
+
return (react_1.default.createElement("tr", { key: row }, columns));
|
|
320
|
+
})))));
|
|
321
|
+
}))));
|
|
322
|
+
};
|
|
323
|
+
exports.default = EbayCalendar;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type DayISO = `${number}-${number}-${number}`;
|
|
2
|
+
export declare function findFirstDayOfWeek(localeName: string): number;
|
|
3
|
+
type WeekdayInfo = {
|
|
4
|
+
firstDayOfWeek: number;
|
|
5
|
+
weekdayLabels: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare function getWeekdayInfo(localeName: string): WeekdayInfo;
|
|
8
|
+
export declare function dateArgToISO(arg?: DateConstructor['arguments']): DayISO;
|
|
9
|
+
export declare function toISO(date: Date): DayISO;
|
|
10
|
+
export declare function fromISO(iso: DayISO): Date;
|
|
11
|
+
export declare function offsetISO(iso: DayISO, days: number): DayISO;
|
|
12
|
+
export declare function localeOverride(locale?: string): string;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=date-utils.d.ts.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.localeOverride = exports.offsetISO = exports.fromISO = exports.toISO = exports.dateArgToISO = exports.getWeekdayInfo = exports.findFirstDayOfWeek = void 0;
|
|
13
|
+
function findFirstDayOfWeek(localeName) {
|
|
14
|
+
// weekInfo only exists on some browsers, so we default to Sunday otherwise
|
|
15
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/weekInfo
|
|
16
|
+
var locale = new Intl.Locale(localeName);
|
|
17
|
+
if (locale.weekInfo) {
|
|
18
|
+
return locale.weekInfo.firstDay;
|
|
19
|
+
}
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
exports.findFirstDayOfWeek = findFirstDayOfWeek;
|
|
23
|
+
function getWeekdayInfo(localeName) {
|
|
24
|
+
var firstDayOfWeek = findFirstDayOfWeek(localeName);
|
|
25
|
+
var weekdayLabelFormatter = new Intl.DateTimeFormat(localeName, {
|
|
26
|
+
weekday: 'short'
|
|
27
|
+
});
|
|
28
|
+
var weekday = new Date(2022, 9, 2 + firstDayOfWeek); // October 2, 2022 was a Sunday
|
|
29
|
+
var weekdayLabels = __spreadArray([], Array(7), true).map(function () {
|
|
30
|
+
var dayLabel = weekdayLabelFormatter.format(weekday);
|
|
31
|
+
weekday.setDate(weekday.getDate() + 1);
|
|
32
|
+
return dayLabel;
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
firstDayOfWeek: firstDayOfWeek,
|
|
36
|
+
weekdayLabels: weekdayLabels
|
|
37
|
+
};
|
|
38
|
+
}
|
|
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;
|
|
48
|
+
function toISO(date) {
|
|
49
|
+
if (isNaN(date.getTime()))
|
|
50
|
+
return;
|
|
51
|
+
return date.toISOString().slice(0, 10);
|
|
52
|
+
}
|
|
53
|
+
exports.toISO = toISO;
|
|
54
|
+
function fromISO(iso) {
|
|
55
|
+
return new Date(iso);
|
|
56
|
+
}
|
|
57
|
+
exports.fromISO = fromISO;
|
|
58
|
+
function offsetISO(iso, days) {
|
|
59
|
+
var date = fromISO(iso);
|
|
60
|
+
date.setUTCDate(date.getUTCDate() + days);
|
|
61
|
+
return toISO(date);
|
|
62
|
+
}
|
|
63
|
+
exports.offsetISO = offsetISO;
|
|
64
|
+
function localeOverride(locale) {
|
|
65
|
+
return locale || navigator.language;
|
|
66
|
+
}
|
|
67
|
+
exports.localeOverride = localeOverride;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-calendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,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.EbayCalendar = void 0;
|
|
7
|
+
var calendar_1 = require("./calendar");
|
|
8
|
+
Object.defineProperty(exports, "EbayCalendar", { enumerable: true, get: function () { return __importDefault(calendar_1).default; } });
|
|
@@ -7,6 +7,6 @@ type Props = HTMLAnchorProps & {
|
|
|
7
7
|
size?: Size;
|
|
8
8
|
forwardedRef?: RefObject<HTMLAnchorElement>;
|
|
9
9
|
};
|
|
10
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "forwardedRef" | "key" | "size" |
|
|
10
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "forwardedRef" | "key" | "size" | "fluid" | "truncate" | keyof React.AnchorHTMLAttributes<HTMLAnchorElement>> & React.RefAttributes<React.FC<Props>>>;
|
|
11
11
|
export default _default;
|
|
12
12
|
//# sourceMappingURL=cta-button.d.ts.map
|
|
@@ -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; } });
|
|
@@ -39,6 +39,7 @@ Name | Type | Stateful | Required | Description | Data
|
|
|
39
39
|
`bageNumber` | Number | No | No | number on the badge
|
|
40
40
|
`bageAriaLabel` | String | No | No | aria label of the badge
|
|
41
41
|
`transparent` | Boolean | No | No | for transparent background
|
|
42
|
+
`size` | String | No | No | alternative size for the icon button, 'large' or 'small'
|
|
42
43
|
|
|
43
44
|
## Callbacks
|
|
44
45
|
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import React, { ComponentProps, RefObject } from 'react';
|
|
2
2
|
import { Icon } from '../ebay-icon';
|
|
3
3
|
import { EbayKeyboardEventHandler } from '../common/event-utils/types';
|
|
4
|
+
import { Size } from '../ebay-button';
|
|
4
5
|
export type EbayIconButtonProps = {
|
|
5
6
|
href?: string;
|
|
6
7
|
icon: Icon;
|
|
7
8
|
badgeNumber?: number;
|
|
8
9
|
badgeAriaLabel?: string;
|
|
9
10
|
transparent?: boolean;
|
|
11
|
+
size?: Size;
|
|
10
12
|
forwardedRef?: RefObject<HTMLAnchorElement & HTMLButtonElement>;
|
|
11
13
|
onEscape?: EbayKeyboardEventHandler;
|
|
12
14
|
};
|
|
13
15
|
type HTMLButtonProps = ComponentProps<'button'>;
|
|
14
16
|
type HTMLAnchorProps = ComponentProps<'a'>;
|
|
15
17
|
type Props = EbayIconButtonProps & HTMLButtonProps & HTMLAnchorProps;
|
|
16
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "form" | "slot" | "style" | "title" | "forwardedRef" | "type" | "key" | "value" | "className" | "disabled" | "placeholder" | "children" | "name" | "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" | "autoFocus" | "download" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "href" | "hrefLang" | "media" | "rel" | "target" | "icon" | "
|
|
18
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "form" | "slot" | "style" | "title" | "forwardedRef" | "type" | "key" | "value" | "className" | "disabled" | "placeholder" | "children" | "name" | "size" | "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" | "autoFocus" | "download" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "href" | "hrefLang" | "media" | "rel" | "target" | "icon" | "transparent" | "onEscape" | "ping" | "referrerPolicy" | "badgeNumber" | "badgeAriaLabel"> & React.RefAttributes<React.FC<Props>>>;
|
|
17
19
|
export default _default;
|
|
18
20
|
//# sourceMappingURL=icon-button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../src/ebay-icon-button/icon-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,cAAc,EAAqB,SAAS,EAAE,MAAM,OAAO,CAAA;AAE3E,OAAO,EAAY,IAAI,EAAE,MAAM,cAAc,CAAA;AAG7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../src/ebay-icon-button/icon-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,cAAc,EAAqB,SAAS,EAAE,MAAM,OAAO,CAAA;AAE3E,OAAO,EAAY,IAAI,EAAE,MAAM,cAAc,CAAA;AAG7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAErC,MAAM,MAAM,mBAAmB,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,YAAY,CAAC,EAAE,SAAS,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,CAAC;IAChE,QAAQ,CAAC,EAAE,wBAAwB,CAAC;CACvC,CAAA;AAED,KAAK,eAAe,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;AAChD,KAAK,eAAe,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;AAC3C,KAAK,KAAK,GAAG,mBAAmB,GAAG,eAAe,GAAG,eAAe,CAAC;;AA8DrE,wBAA6C"}
|
|
@@ -32,9 +32,9 @@ var ebay_badge_1 = require("../ebay-badge");
|
|
|
32
32
|
var component_utils_1 = require("../common/component-utils");
|
|
33
33
|
var EbayIconButton = function (_a) {
|
|
34
34
|
var _b;
|
|
35
|
-
var href = _a.href, icon = _a.icon, badgeNumber = _a.badgeNumber, badgeAriaLabel = _a.badgeAriaLabel, transparent = _a.transparent, extraClasses = _a.className, forwardedRef = _a.forwardedRef, _c = _a.onEscape, onEscape = _c === void 0 ? function () { } : _c, _d = _a.onKeyDown, onKeyDown = _d === void 0 ? function () { } : _d, rest = __rest(_a, ["href", "icon", "badgeNumber", "badgeAriaLabel", "transparent", "className", "forwardedRef", "onEscape", "onKeyDown"]);
|
|
35
|
+
var href = _a.href, icon = _a.icon, badgeNumber = _a.badgeNumber, badgeAriaLabel = _a.badgeAriaLabel, transparent = _a.transparent, extraClasses = _a.className, forwardedRef = _a.forwardedRef, size = _a.size, _c = _a.onEscape, onEscape = _c === void 0 ? function () { } : _c, _d = _a.onKeyDown, onKeyDown = _d === void 0 ? function () { } : _d, rest = __rest(_a, ["href", "icon", "badgeNumber", "badgeAriaLabel", "transparent", "className", "forwardedRef", "size", "onEscape", "onKeyDown"]);
|
|
36
36
|
var classPrefix = href ? 'icon-link' : 'icon-btn';
|
|
37
|
-
var className = (0, classnames_1.default)(extraClasses, classPrefix, (_b = {},
|
|
37
|
+
var className = (0, classnames_1.default)(extraClasses, classPrefix, size && "".concat(classPrefix, "--").concat(size), (_b = {},
|
|
38
38
|
_b["".concat(classPrefix, "--badged")] = badgeNumber,
|
|
39
39
|
_b["".concat(classPrefix, "--transparent")] = transparent,
|
|
40
40
|
_b));
|
|
@@ -9,6 +9,6 @@ type InfotipHostProps = ComponentProps<'button'> & {
|
|
|
9
9
|
icon: any;
|
|
10
10
|
}) => ReactNode) | ReactNode;
|
|
11
11
|
};
|
|
12
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<InfotipHostProps, "forwardedRef" | "key" | "icon" | keyof React.ButtonHTMLAttributes<HTMLButtonElement
|
|
12
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<InfotipHostProps, "forwardedRef" | "key" | "icon" | "variant" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & React.RefAttributes<React.FC<InfotipHostProps>>>;
|
|
13
13
|
export default _default;
|
|
14
14
|
//# sourceMappingURL=ebay-infotip-host.d.ts.map
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { DialogBaseProps } from '../ebay-dialog-base';
|
|
3
3
|
type Mode = 'default' | 'mini';
|
|
4
|
-
|
|
4
|
+
type Size = 'wide' | 'narrow';
|
|
5
|
+
export type Props<T = any> = Omit<DialogBaseProps<T>, 'size'> & {
|
|
5
6
|
open?: boolean;
|
|
6
7
|
mode?: Mode;
|
|
8
|
+
size?: Size;
|
|
7
9
|
onClose?: () => void;
|
|
8
|
-
}
|
|
10
|
+
};
|
|
9
11
|
declare const EbayLightboxDialog: FC<Props>;
|
|
10
12
|
export default EbayLightboxDialog;
|
|
11
13
|
//# sourceMappingURL=lightbox-dialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lightbox-dialog.d.ts","sourceRoot":"","sources":["../../src/ebay-lightbox-dialog/lightbox-dialog.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,eAAe,EAAuB,MAAM,qBAAqB,CAAA;AAI1E,KAAK,IAAI,GAAG,SAAS,GAAG,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"lightbox-dialog.d.ts","sourceRoot":"","sources":["../../src/ebay-lightbox-dialog/lightbox-dialog.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,eAAe,EAAuB,MAAM,qBAAqB,CAAA;AAI1E,KAAK,IAAI,GAAG,SAAS,GAAG,MAAM,CAAA;AAC9B,KAAK,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAA;AAE7B,MAAM,MAAM,KAAK,CAAC,CAAC,GAAG,GAAG,IAAI,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG;IAC9D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAA;AAED,QAAA,MAAM,kBAAkB,EAAE,EAAE,CAAC,KAAK,CAmBjC,CAAA;AAED,eAAe,kBAAkB,CAAA"}
|
|
@@ -31,8 +31,8 @@ var ebay_dialog_base_1 = require("../ebay-dialog-base");
|
|
|
31
31
|
var classPrefix = 'lightbox-dialog';
|
|
32
32
|
var EbayLightboxDialog = function (_a) {
|
|
33
33
|
var _b;
|
|
34
|
-
var open = _a.open, mode = _a.mode, _c = _a.onClose, onClose = _c === void 0 ? function () { } : _c, rest = __rest(_a, ["open", "mode", "onClose"]);
|
|
35
|
-
return (react_1.default.createElement(ebay_dialog_base_1.DialogBaseWithState, __assign({ buttonPosition: "right" }, rest, { classPrefix: classPrefix, onCloseBtnClick: onClose, onBackgroundClick: onClose, className: (0, classnames_1.default)(rest.className, "".concat(classPrefix, "--mask-fade")), windowClass: (0, classnames_1.default)('lightbox-dialog__window--fade', (_b = {},
|
|
34
|
+
var open = _a.open, mode = _a.mode, size = _a.size, _c = _a.onClose, onClose = _c === void 0 ? function () { } : _c, rest = __rest(_a, ["open", "mode", "size", "onClose"]);
|
|
35
|
+
return (react_1.default.createElement(ebay_dialog_base_1.DialogBaseWithState, __assign({ buttonPosition: "right" }, rest, { classPrefix: classPrefix, onCloseBtnClick: onClose, onBackgroundClick: onClose, className: (0, classnames_1.default)(rest.className, "".concat(classPrefix, "--mask-fade"), size && "".concat(classPrefix, "--").concat(size)), windowClass: (0, classnames_1.default)('lightbox-dialog__window--fade', (_b = {},
|
|
36
36
|
_b["".concat(classPrefix, "__window--mini")] = mode === 'mini',
|
|
37
37
|
_b)), open: open })));
|
|
38
38
|
};
|
|
@@ -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"
|