@ebay/ui-core-react 7.4.0-alpha.8 → 7.4.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.
Files changed (153) hide show
  1. package/README.md +2 -2
  2. package/array.polyfill.flat-5BAolFdk.js +1 -0
  3. package/badge-CoHKfiPt.js +1 -0
  4. package/button-DGuEBUDJ.js +1 -0
  5. package/calendar-lAu6VfAb.js +1 -0
  6. package/common/component-utils/forwardRef/index.js +1 -10
  7. package/common/component-utils/index.js +1 -9
  8. package/common/component-utils/utils/index.js +1 -25
  9. package/common/event-utils/index.js +1 -113
  10. package/common/floating-label-utils/hooks/index.js +1 -106
  11. package/common/notice-utils/notice-cta/index.js +1 -5
  12. package/common/random-id/index.js +1 -13
  13. package/common/tooltip-utils/constants/index.js +1 -97
  14. package/common/tooltip-utils/index.js +1 -11
  15. package/debounce-BQsYxxOL.js +1 -0
  16. package/dialog-previous-button-CpuFLkQp.js +1 -0
  17. package/drawer-rqXAEeqd.js +1 -0
  18. package/ebay-alert-dialog/index.js +1 -26
  19. package/ebay-badge/index.js +1 -4
  20. package/ebay-breadcrumbs/index.js +1 -47
  21. package/ebay-button/index.js +1 -5
  22. package/ebay-calendar/index.js +1 -4
  23. package/ebay-carousel/index.js +1 -345
  24. package/ebay-checkbox/index.js +1 -52
  25. package/ebay-confirm-dialog/index.js +1 -28
  26. package/ebay-cta-button/index.js +1 -22
  27. package/ebay-date-textbox/index.js +1 -140
  28. package/ebay-dialog-base/components/animation/index.js +1 -92
  29. package/ebay-dialog-base/components/dialog-footer/index.js +1 -4
  30. package/ebay-dialog-base/components/dialog-header/index.js +1 -4
  31. package/ebay-dialog-base/index.js +1 -13
  32. package/ebay-drawer-dialog/index.js +1 -4
  33. package/ebay-eek/index.js +1 -54
  34. package/ebay-fake-menu/index.js +1 -10
  35. package/ebay-fake-menu/menu-item/index.js +1 -49
  36. package/ebay-fake-menu-button/index.js +1 -7
  37. package/ebay-fake-menu-button/menu-button/index.js +1 -12
  38. package/ebay-fake-tabs/index.js +1 -30
  39. package/ebay-field/index.js +1 -21
  40. package/ebay-fullscreen-dialog/index.js +1 -10
  41. package/ebay-icon/index.js +1 -4
  42. package/ebay-icon/types.d.ts +1 -1
  43. package/ebay-icon/types.d.ts.map +1 -1
  44. package/ebay-icon-button/index.js +1 -4
  45. package/ebay-infotip/index.js +1 -76
  46. package/ebay-inline-notice/index.js +1 -36
  47. package/ebay-lightbox-dialog/index.js +1 -12
  48. package/ebay-listbox-button/index.d.ts +2 -1
  49. package/ebay-listbox-button/index.d.ts.map +1 -1
  50. package/ebay-listbox-button/index.js +2 -151
  51. package/ebay-listbox-button/listbox-button-option.d.ts +10 -0
  52. package/ebay-listbox-button/listbox-button-option.d.ts.map +1 -0
  53. package/ebay-listbox-button/listbox-button.d.ts +5 -15
  54. package/ebay-listbox-button/listbox-button.d.ts.map +1 -1
  55. package/ebay-menu/index.js +1 -9
  56. package/ebay-menu-button/index.js +1 -113
  57. package/ebay-notice-base/index.js +1 -7
  58. package/ebay-page-notice/index.js +1 -50
  59. package/ebay-pagination/index.js +1 -244
  60. package/ebay-panel-dialog/index.js +1 -12
  61. package/ebay-progress-bar/index.js +1 -6
  62. package/ebay-progress-spinner/index.js +1 -4
  63. package/ebay-progress-stepper/index.js +1 -72
  64. package/ebay-radio/index.js +1 -4
  65. package/ebay-radio/radio/index.js +1 -48
  66. package/ebay-section-notice/index.js +1 -69
  67. package/ebay-section-title/index.js +1 -38
  68. package/ebay-segmented-buttons/index.js +1 -46
  69. package/ebay-select/index.js +1 -98
  70. package/ebay-signal/index.js +1 -9
  71. package/ebay-snackbar-dialog/index.js +1 -81
  72. package/ebay-split-button/index.js +1 -22
  73. package/ebay-star-rating/index.js +1 -9
  74. package/ebay-star-rating-select/index.js +1 -55
  75. package/ebay-svg/index.js +1 -5189
  76. package/ebay-svg/symbols.d.ts.map +1 -1
  77. package/ebay-switch/index.js +1 -27
  78. package/ebay-tabs/index.js +1 -88
  79. package/ebay-textbox/index.js +1 -10
  80. package/ebay-toast-dialog/index.js +1 -9
  81. package/ebay-toggle-button/README.md +39 -0
  82. package/ebay-toggle-button/index.d.ts +3 -0
  83. package/ebay-toggle-button/index.d.ts.map +1 -0
  84. package/ebay-toggle-button/index.js +1 -0
  85. package/ebay-toggle-button/toggle-button.d.ts +5 -0
  86. package/ebay-toggle-button/toggle-button.d.ts.map +1 -0
  87. package/ebay-toggle-button/types.d.ts +23 -0
  88. package/ebay-toggle-button/types.d.ts.map +1 -0
  89. package/ebay-toggle-button-group/README.md +56 -0
  90. package/ebay-toggle-button-group/index.d.ts +3 -0
  91. package/ebay-toggle-button-group/index.d.ts.map +1 -0
  92. package/ebay-toggle-button-group/index.js +1 -0
  93. package/ebay-toggle-button-group/toggle-button-group.d.ts +5 -0
  94. package/ebay-toggle-button-group/toggle-button-group.d.ts.map +1 -0
  95. package/ebay-toggle-button-group/types.d.ts +20 -0
  96. package/ebay-toggle-button-group/types.d.ts.map +1 -0
  97. package/ebay-tooltip/index.js +1 -64
  98. package/ebay-tourtip/index.js +1 -54
  99. package/ebay-video/index.js +1 -229
  100. package/events/index.js +1 -18
  101. package/icon-TuxfQndO.js +1 -0
  102. package/icon-button-Cwaj-eT9.js +1 -0
  103. package/label-CnrpYJ-g.js +1 -0
  104. package/menu-CV-INYLM.js +1 -0
  105. package/menu-_LzP6yje.js +1 -0
  106. package/menu-button-BZ66jxvI.js +1 -0
  107. package/notice-content-9iF4T8uB.js +1 -0
  108. package/notice-content-C0ZStfuX.js +1 -0
  109. package/notice-footer-Cw1DMzoB.js +1 -0
  110. package/package.json +2 -5
  111. package/progress-spinner-U2qOANON.js +1 -0
  112. package/range-DOsPN0h5.js +1 -0
  113. package/textbox-dUhinDwj.js +1 -0
  114. package/toggle-button-D8l0YB43.js +1 -0
  115. package/use-roving-index-DoAVBgsp.js +1 -0
  116. package/use-tooltip-CL3_zAeg.js +1 -0
  117. package/utils/index.js +1 -13
  118. package/array.polyfill.flat-DyxysTxZ.js +0 -21
  119. package/badge-CR5t7-2L.js +0 -8
  120. package/button-B4bZIgwB.js +0 -83
  121. package/calendar-D-DWjrMU.js +0 -333
  122. package/debounce-v8bWAUnY.js +0 -9
  123. package/dialog-previous-button-EC_Y6KaT.js +0 -370
  124. package/drawer-DBDktEBZ.js +0 -69
  125. package/ebay-listbox/README.md +0 -100
  126. package/ebay-listbox/index.d.ts +0 -4
  127. package/ebay-listbox/index.d.ts.map +0 -1
  128. package/ebay-listbox/index.js +0 -6
  129. package/ebay-listbox/listbox-option-description.d.ts +0 -4
  130. package/ebay-listbox/listbox-option-description.d.ts.map +0 -1
  131. package/ebay-listbox/listbox-option.d.ts +0 -10
  132. package/ebay-listbox/listbox-option.d.ts.map +0 -1
  133. package/ebay-listbox/listbox.d.ts +0 -21
  134. package/ebay-listbox/listbox.d.ts.map +0 -1
  135. package/icon-B17Di3YL.js +0 -56
  136. package/icon-button-BQWoMgX1.js +0 -31
  137. package/index-BXizW4ue.js +0 -89
  138. package/index-DcH7Tjjd.js +0 -272
  139. package/label-C0AS4fnO.js +0 -19
  140. package/listbox-DGbY99kq.js +0 -674
  141. package/menu-Bsy48CE1.js +0 -163
  142. package/menu-button-CKGsgg6G.js +0 -89
  143. package/menu-fCOy6wBS.js +0 -29
  144. package/notice-content-BTXVxttv.js +0 -8
  145. package/notice-content-BhUeK1pd.js +0 -3
  146. package/notice-footer-CIQ8SM6N.js +0 -10
  147. package/progress-spinner-DOFKRtuu.js +0 -20
  148. package/range-C5qzyhg4.js +0 -3
  149. package/textbox-J291yCpJ.js +0 -136
  150. package/use-roving-index-CEM_UsCH.js +0 -58
  151. package/use-tooltip-7JxcZHJn.js +0 -92
  152. package/utils/scroll.d.ts +0 -2
  153. package/utils/scroll.d.ts.map +0 -1
@@ -1,98 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- const classNames = require("classnames");
5
- const icon = require("../icon-B17Di3YL.js");
6
- const common_componentUtils_forwardRef = require("../common/component-utils/forwardRef/index.js");
7
- const common_componentUtils_utils = require("../common/component-utils/utils/index.js");
8
- const common_floatingLabelUtils_hooks = require("../common/floating-label-utils/hooks/index.js");
9
- const EbaySelectOption = ({ children, ...rest }) => React.createElement("option", { ...rest }, children);
10
- const isControlled = (value) => typeof value !== "undefined";
11
- const EbaySelect = ({ value: controlledValue, defaultValue, className, borderless, name, disabled, onChange = () => {
12
- }, onBlur = () => {
13
- }, onFocus = () => {
14
- }, floatingLabel, forwardedRef, children, inputSize, invalid, ...rest }) => {
15
- const isFieldInvalid = invalid || rest["aria-invalid"] === "true";
16
- const [value, setValue] = React.useState(defaultValue);
17
- const { label, Container, onBlur: onFloatingLabelBlur, onFocus: onFloatingLabelFocus, ref } = common_floatingLabelUtils_hooks.useFloatingLabel({
18
- ref: forwardedRef,
19
- inputId: rest.id,
20
- className,
21
- disabled,
22
- label: floatingLabel,
23
- inputValue: controlledValue,
24
- inputSize,
25
- invalid: isFieldInvalid
26
- });
27
- const handleSelectChange = (e) => {
28
- const { value: newValue, selectedIndex } = e.target;
29
- if (!isControlled(controlledValue)) {
30
- setValue(newValue);
31
- }
32
- onChange(e, { index: selectedIndex, selected: [newValue] });
33
- };
34
- const handleBlur = (event) => {
35
- onBlur(event);
36
- onFloatingLabelBlur();
37
- };
38
- const handleFocus = (event) => {
39
- onFocus(event);
40
- onFloatingLabelFocus();
41
- };
42
- const selectClassName = classNames("select", className, {
43
- "select--borderless": borderless,
44
- "select--large": inputSize === `large`
45
- });
46
- return React.createElement(
47
- Container,
48
- null,
49
- label,
50
- React.createElement(
51
- "span",
52
- { className: selectClassName },
53
- React.createElement("select", { ...rest, name, value: isControlled(controlledValue) ? controlledValue : value, disabled, onChange: handleSelectChange, onBlur: handleBlur, onFocus: handleFocus, ref }, options(children)),
54
- React.createElement(icon.EbayIcon, { name: "chevronDown12", height: "8", width: "8" })
55
- )
56
- );
57
- };
58
- const ebaySelect = common_componentUtils_forwardRef.withForwardRef(EbaySelect);
59
- function optionGroups(data) {
60
- const optGroups = {};
61
- data.forEach((opt) => {
62
- const option = opt.props;
63
- if (option.optgroup) {
64
- if (!Object.prototype.hasOwnProperty.call(optGroups, option.optgroup)) {
65
- optGroups[option.optgroup] = [];
66
- }
67
- optGroups[option.optgroup].push(option);
68
- }
69
- });
70
- return optGroups;
71
- }
72
- function options(children) {
73
- const renderedGroups = [];
74
- const allOptions = [];
75
- let optGroups = {};
76
- let withinGroup = false;
77
- const childrenOpts = common_componentUtils_utils.filterByType(children, EbaySelectOption).map((c) => React.cloneElement(c, {}));
78
- if (childrenOpts) {
79
- optGroups = optionGroups(childrenOpts);
80
- let currentGroupName;
81
- childrenOpts.forEach((option, idx) => {
82
- const { value, optionClassName, children: optionChildren, optgroup } = option.props;
83
- withinGroup = optgroup && renderedGroups.indexOf(optgroup) === -1;
84
- if (withinGroup) {
85
- currentGroupName = optgroup;
86
- const currentGroupOptions = optGroups[currentGroupName];
87
- const opts = currentGroupOptions.map((groupOption) => React.createElement(EbaySelectOption, { key: `opt-${groupOption.value}`, value: groupOption.value, className: groupOption.optionClassName }, groupOption.children));
88
- allOptions.push(React.createElement("optgroup", { key: idx, label: optgroup }, opts));
89
- renderedGroups.push(optgroup);
90
- } else if (!optgroup) {
91
- allOptions.push(React.createElement(EbaySelectOption, { key: idx, value, className: optionClassName }, optionChildren));
92
- }
93
- });
94
- return allOptions;
95
- }
96
- }
97
- exports.EbaySelect = ebaySelect;
98
- exports.EbaySelectOption = EbaySelectOption;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),L=require("classnames"),R=require("../icon-TuxfQndO.js"),U=require("../common/component-utils/forwardRef/index.js"),j=require("../common/component-utils/utils/index.js"),x=require("../common/floating-label-utils/hooks/index.js"),d=({children:e,...t})=>n.createElement("option",{...t},e),v=e=>typeof e<"u",P=({value:e,defaultValue:t,className:s,borderless:o,name:p,disabled:r,onChange:a=()=>{},onBlur:h=()=>{},onFocus:m=()=>{},floatingLabel:f,forwardedRef:b,children:y,inputSize:l,invalid:E,...u})=>{const c=E||u["aria-invalid"]==="true",[F,w]=n.useState(t),{label:C,Container:G,onBlur:S,onFocus:N,ref:O}=x.useFloatingLabel({ref:b,inputId:u.id,className:s,disabled:r,label:f,inputValue:e,inputSize:l,invalid:c}),q=i=>{const{value:g,selectedIndex:I}=i.target;v(e)||w(g),a(i,{index:I,selected:[g]})},_=i=>{h(i),S()},B=i=>{m(i),N()},k=L("select",s,{"select--borderless":o,"select--large":l==="large"});return n.createElement(G,null,C,n.createElement("span",{className:k},n.createElement("select",{...u,name:p,value:v(e)?e:F,disabled:r,onChange:q,onBlur:_,onFocus:B,ref:O},M(y)),n.createElement(R.EbayIcon,{name:"chevronDown12",height:"8",width:"8"})))},T=U.withForwardRef(P);function D(e){const t={};return e.forEach(s=>{const o=s.props;o.optgroup&&(Object.prototype.hasOwnProperty.call(t,o.optgroup)||(t[o.optgroup]=[]),t[o.optgroup].push(o))}),t}function M(e){const t=[],s=[];let o={},p=!1;const r=j.filterByType(e,d).map(a=>n.cloneElement(a,{}));if(r){o=D(r);let a;return r.forEach((h,m)=>{const{value:f,optionClassName:b,children:y,optgroup:l}=h.props;if(p=l&&t.indexOf(l)===-1,p){a=l;const u=o[a].map(c=>n.createElement(d,{key:`opt-${c.value}`,value:c.value,className:c.optionClassName},c.children));s.push(n.createElement("optgroup",{key:m,label:l},u)),t.push(l)}else l||s.push(n.createElement(d,{key:m,value:f,className:b},y))}),s}}exports.EbaySelect=T;exports.EbaySelectOption=d;
@@ -1,9 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- const classNames = require("classnames");
5
- const EbaySignal = ({ status = "neutral", ...rest }) => {
6
- const className = classNames(`signal signal--${status}`, rest.className);
7
- return React.createElement("span", { ...rest, className });
8
- };
9
- exports.EbaySignal = EbaySignal;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),t=require("classnames"),l=({status:a="neutral",...e})=>{const s=t(`signal signal--${a}`,e.className);return n.createElement("span",{...e,className:s})};exports.EbaySignal=l;
@@ -1,81 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const classNames = require("classnames");
4
- const React = require("react");
5
- const dialogPreviousButton = require("../dialog-previous-button-EC_Y6KaT.js");
6
- require("../icon-button-BQWoMgX1.js");
7
- const EbaySnackbarDialogAction = ({ className, children, ...rest }) => React.createElement("button", { className: classNames(className, "fake-link"), ...rest }, children);
8
- const DEFAULT_TIMEOUT_LENGTH = 6e3;
9
- const EbaySnackbarDialog = ({ className, onOpen = () => {
10
- }, onClose = () => {
11
- }, layout, open, children, onAction, ...rest }) => {
12
- const eventSet = React.useRef(/* @__PURE__ */ new Set());
13
- const timeoutRef = React.useRef();
14
- const [isOpen, setIsOpen] = React.useState(open);
15
- const childrenArray = React.Children.toArray(children);
16
- const action = childrenArray.find((child) => child.type === EbaySnackbarDialogAction);
17
- const content = childrenArray.filter((child) => child.type !== EbaySnackbarDialogAction);
18
- const cancelCurrentCloseRequest = () => {
19
- clearTimeout(timeoutRef.current);
20
- };
21
- const closeDialog = () => {
22
- setIsOpen(false);
23
- onClose();
24
- };
25
- const requestToCloseDialog = () => {
26
- if (eventSet.current.size === 0) {
27
- cancelCurrentCloseRequest();
28
- timeoutRef.current = setTimeout(() => {
29
- closeDialog();
30
- }, DEFAULT_TIMEOUT_LENGTH);
31
- }
32
- };
33
- const openDialog = () => {
34
- setIsOpen(true);
35
- onOpen();
36
- requestToCloseDialog();
37
- };
38
- const handleFocus = () => {
39
- cancelCurrentCloseRequest();
40
- eventSet.current.add("focus");
41
- };
42
- const handleBlur = () => {
43
- eventSet.current.delete("focus");
44
- requestToCloseDialog();
45
- };
46
- const handleMouseEnter = () => {
47
- cancelCurrentCloseRequest();
48
- eventSet.current.add("mouseEnter");
49
- };
50
- const handleMouseLeave = () => {
51
- eventSet.current.delete("mouseEnter");
52
- requestToCloseDialog();
53
- };
54
- const handleAction = (event) => {
55
- var _a, _b;
56
- cancelCurrentCloseRequest();
57
- onAction == null ? void 0 : onAction(event);
58
- (_b = (_a = action == null ? void 0 : action.props) == null ? void 0 : _a.onClick) == null ? void 0 : _b.call(_a, event);
59
- closeDialog();
60
- };
61
- React.useEffect(() => () => {
62
- cancelCurrentCloseRequest();
63
- }, []);
64
- React.useEffect(() => {
65
- if (open) {
66
- openDialog();
67
- } else {
68
- closeDialog();
69
- }
70
- }, [open]);
71
- return React.createElement(
72
- dialogPreviousButton.DialogBaseWithState,
73
- { ...rest, open: isOpen, isModal: false, baseEl: "aside", classPrefix: "snackbar-dialog", transitionElement: "root", a11yCloseText: "", buttonPosition: "hidden", className: classNames(className, "snackbar-dialog--transition"), windowClass: layout === "column" && "snackbar-dialog__window--column", onFocus: handleFocus, onBlur: handleBlur, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave },
74
- content,
75
- action ? React.createElement(dialogPreviousButton.EbayDialogActions, null, React.cloneElement(action, {
76
- onClick: handleAction
77
- })) : null
78
- );
79
- };
80
- exports.EbaySnackbarDialog = EbaySnackbarDialog;
81
- exports.EbaySnackbarDialogAction = EbaySnackbarDialogAction;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("classnames"),e=require("react"),k=require("../dialog-previous-button-CpuFLkQp.js");require("../icon-button-Cwaj-eT9.js");const f=({className:r,children:c,...l})=>e.createElement("button",{className:D(r,"fake-link"),...l},c),L=6e3,N=({className:r,onOpen:c=()=>{},onClose:l=()=>{},layout:S,open:i,children:h,onAction:u,...T})=>{const n=e.useRef(new Set),b=e.useRef(),[C,m]=e.useState(i),g=e.Children.toArray(h),o=g.find(t=>t.type===f),p=g.filter(t=>t.type!==f),s=()=>{clearTimeout(b.current)},d=()=>{m(!1),l()},E=()=>{n.current.size===0&&(s(),b.current=setTimeout(()=>{d()},L))},M=()=>{m(!0),c(),E()},q=()=>{s(),n.current.add("focus")},w=()=>{n.current.delete("focus"),E()},R=()=>{s(),n.current.add("mouseEnter")},v=()=>{n.current.delete("mouseEnter"),E()},B=t=>{var a,y;s(),u==null||u(t),(y=(a=o==null?void 0:o.props)==null?void 0:a.onClick)==null||y.call(a,t),d()};return e.useEffect(()=>()=>{s()},[]),e.useEffect(()=>{i?M():d()},[i]),e.createElement(k.DialogBaseWithState,{...T,open:C,isModal:!1,baseEl:"aside",classPrefix:"snackbar-dialog",transitionElement:"root",a11yCloseText:"",buttonPosition:"hidden",className:D(r,"snackbar-dialog--transition"),windowClass:S==="column"&&"snackbar-dialog__window--column",onFocus:q,onBlur:w,onMouseEnter:R,onMouseLeave:v},p,o?e.createElement(k.EbayDialogActions,null,e.cloneElement(o,{onClick:B})):null)};exports.EbaySnackbarDialog=N;exports.EbaySnackbarDialogAction=f;
@@ -1,22 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- const common_componentUtils_utils = require("../common/component-utils/utils/index.js");
5
- const button = require("../button-B4bZIgwB.js");
6
- const ebayMenuButton = require("../ebay-menu-button/index.js");
7
- const menu = require("../menu-Bsy48CE1.js");
8
- require("classnames");
9
- const EbaySplitButton = ({ a11yMenuText, children, type, bodyState, a11yButtonLoadingText, onCollapse, onExpand, onSelect = () => {
10
- }, onChange = () => {
11
- }, ref, ...rest }) => {
12
- const menuItemComponents = [menu.EbayMenuItem, ebayMenuButton.EbayMenuButtonSeparator];
13
- const buttonLabel = common_componentUtils_utils.filterBy(children, (el) => !menuItemComponents.includes(el.type));
14
- const menuItems = common_componentUtils_utils.filterByType(children, menuItemComponents);
15
- return React.createElement(
16
- "span",
17
- { className: "split-button" },
18
- React.createElement(button.EbayButton, { "aria-label": bodyState === "loading" ? a11yButtonLoadingText : void 0, ...rest, split: "start", bodyState: bodyState === "expand" ? void 0 : bodyState }, buttonLabel),
19
- React.createElement(ebayMenuButton.EbayMenuButton, { priority: rest.priority, disabled: rest.disabled, transparent: rest.transparent, size: rest.size, type, split: "end", reverse: true, a11yText: a11yMenuText, onCollapse, onExpand, onSelect, onChange }, menuItems)
20
- );
21
- };
22
- exports.EbaySplitButton = EbaySplitButton;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),a=require("../common/component-utils/utils/index.js"),B=require("../button-DGuEBUDJ.js"),i=require("../ebay-menu-button/index.js"),q=require("../menu-CV-INYLM.js");require("classnames");const M=({a11yMenuText:u,children:r,type:s,bodyState:t,a11yButtonLoadingText:l,onCollapse:c,onExpand:p,onSelect:b=()=>{},onChange:m=()=>{},ref:f,...e})=>{const o=[q.EbayMenuItem,i.EbayMenuButtonSeparator],y=a.filterBy(r,E=>!o.includes(E.type)),d=a.filterByType(r,o);return n.createElement("span",{className:"split-button"},n.createElement(B.EbayButton,{"aria-label":t==="loading"?l:void 0,...e,split:"start",bodyState:t==="expand"?void 0:t},y),n.createElement(i.EbayMenuButton,{priority:e.priority,disabled:e.disabled,transparent:e.transparent,size:e.size,type:s,split:"end",reverse:!0,a11yText:u,onCollapse:c,onExpand:p,onSelect:b,onChange:m},d))};exports.EbaySplitButton=M;
@@ -1,9 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- const classNames = require("classnames");
5
- const icon = require("../icon-B17Di3YL.js");
6
- const range = require("../range-C5qzyhg4.js");
7
- const stars = range.range(1, 5);
8
- const EbayStarRating = ({ value, a11yText, className, ...rest }) => React.createElement("div", { role: "img", "aria-label": a11yText, className: classNames("star-rating", className), "data-stars": value, ...rest }, stars.map((i) => React.createElement(icon.EbayIcon, { key: i, className: "star-rating__icon", name: "starDynamic" })));
9
- exports.EbayStarRating = EbayStarRating;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),c=require("classnames"),i=require("../icon-TuxfQndO.js"),o=require("../range-DOsPN0h5.js"),l=o.range(1,5),m=({value:e,a11yText:t,className:r,...s})=>a.createElement("div",{role:"img","aria-label":t,className:c("star-rating",r),"data-stars":e,...s},l.map(n=>a.createElement(i.EbayIcon,{key:n,className:"star-rating__icon",name:"starDynamic"})));exports.EbayStarRating=m;
@@ -1,55 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- const classNames = require("classnames");
5
- const icon = require("../icon-B17Di3YL.js");
6
- const range = require("../range-C5qzyhg4.js");
7
- const common_randomId = require("../common/random-id/index.js");
8
- const stars = range.range(1, 5);
9
- const getValue = (val) => {
10
- let value = parseInt(val, 0) || 0;
11
- if (value > 5) {
12
- value = 0;
13
- }
14
- return value;
15
- };
16
- const EbayStarRatingSelect = ({ value = 0, a11yText, className, a11yStarText = [], disabled, onChange = () => {
17
- }, onFocus = () => {
18
- }, onKeyDown = () => {
19
- }, name, ...rest }) => {
20
- const rId = common_randomId.useRandomId();
21
- const inputName = name || `star-rating-${rId}`;
22
- const [checkedValue, setChecked] = React.useState(getValue(value));
23
- React.useEffect(() => {
24
- setChecked(getValue(value));
25
- }, [value]);
26
- const handleKeyDown = (i) => (e) => {
27
- if (!disabled) {
28
- setChecked(getValue(i));
29
- onKeyDown(e, { value: i });
30
- }
31
- };
32
- const handleClick = (i) => (e) => {
33
- if (!disabled) {
34
- setChecked(getValue(i));
35
- onChange(e, { value: i });
36
- }
37
- };
38
- const handleFocus = (i) => (e) => {
39
- if (!disabled) {
40
- setChecked(getValue(i));
41
- onFocus(e, { value: i });
42
- }
43
- };
44
- return React.createElement("div", { role: a11yText && "radiogroup", "aria-label": a11yText, className: classNames("star-rating-select", className), ...rest }, stars.map((i) => React.createElement(
45
- "span",
46
- { className: "star-rating-select__radio", key: i },
47
- React.createElement("input", { "aria-label": a11yStarText == null ? void 0 : a11yStarText[i - 1], className: classNames("star-rating-select__control", { "star-rating-select__control--filled": i <= checkedValue }), type: "radio", name: inputName, value: i, disabled, defaultChecked: checkedValue === i, onClick: handleClick(i), onFocus: handleFocus(i), onKeyDown: handleKeyDown(i) }),
48
- React.createElement(
49
- "span",
50
- { className: "star-rating-select__radio-icon" },
51
- React.createElement(icon.EbayIcon, { className: "star-rating__icon", name: "starDynamic" })
52
- )
53
- )));
54
- };
55
- exports.EbayStarRatingSelect = EbayStarRatingSelect;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),u=require("classnames"),v=require("../icon-TuxfQndO.js"),y=require("../range-DOsPN0h5.js"),I=require("../common/random-id/index.js"),b=y.range(1,5),r=n=>{let a=parseInt(n,0)||0;return a>5&&(a=0),a},C=({value:n=0,a11yText:a,className:m,a11yStarText:l=[],disabled:s,onChange:g=()=>{},onFocus:d=()=>{},onKeyDown:_=()=>{},name:f,...p})=>{const E=I.useRandomId(),N=f||`star-rating-${E}`,[i,o]=t.useState(r(n));t.useEffect(()=>{o(r(n))},[n]);const h=e=>c=>{s||(o(r(e)),_(c,{value:e}))},k=e=>c=>{s||(o(r(e)),g(c,{value:e}))},q=e=>c=>{s||(o(r(e)),d(c,{value:e}))};return t.createElement("div",{role:a&&"radiogroup","aria-label":a,className:u("star-rating-select",m),...p},b.map(e=>t.createElement("span",{className:"star-rating-select__radio",key:e},t.createElement("input",{"aria-label":l==null?void 0:l[e-1],className:u("star-rating-select__control",{"star-rating-select__control--filled":e<=i}),type:"radio",name:N,value:e,disabled:s,defaultChecked:i===e,onClick:k(e),onFocus:q(e),onKeyDown:h(e)}),t.createElement("span",{className:"star-rating-select__radio-icon"},t.createElement(v.EbayIcon,{className:"star-rating__icon",name:"starDynamic"})))))};exports.EbayStarRatingSelect=C;