@geneui/components 2.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/ActionableList.js +1761 -0
  2. package/AdvancedSearch.js +872 -0
  3. package/Alert.js +98 -0
  4. package/Avatar.js +77 -0
  5. package/Badge.js +76 -0
  6. package/Breadcrumb.js +128 -0
  7. package/BusyLoader.js +69 -0
  8. package/Button.js +130 -0
  9. package/CHANGELOG.md +424 -0
  10. package/Card.js +513 -0
  11. package/CardList.js +705 -0
  12. package/CellMeasurerCache-c11cec83.js +229 -0
  13. package/Charts.js +99 -0
  14. package/Checkbox.js +232 -0
  15. package/CheckboxGroup.js +206 -0
  16. package/CheckboxGroupWithSearch.js +279 -0
  17. package/Collapse.js +196 -0
  18. package/ColorPicker.js +210 -0
  19. package/ComboBox.js +99 -0
  20. package/Counter.js +99 -0
  21. package/DateFilter.js +179 -0
  22. package/DatePicker.js +1231 -0
  23. package/DatePickerInput.js +30 -0
  24. package/Divider.js +56 -0
  25. package/Drawer.js +264 -0
  26. package/Dropdown.js +99 -0
  27. package/Editor.js +22965 -0
  28. package/Empty.js +132 -0
  29. package/ExtendedInput.js +578 -0
  30. package/Form.js +116 -0
  31. package/FormContainer.js +189 -0
  32. package/FormableCheckbox.js +27 -0
  33. package/FormableDatePicker.js +39 -0
  34. package/FormableDropdown.js +105 -0
  35. package/FormableEditor.js +24 -0
  36. package/FormableHOC-21051057.js +83 -0
  37. package/FormableMultiSelectDropdown.js +105 -0
  38. package/FormableNumberInput.js +31 -0
  39. package/FormableRadio.js +23 -0
  40. package/FormableSwitcher.js +23 -0
  41. package/FormableTextInput.js +31 -0
  42. package/FormableUploader.js +40 -0
  43. package/GeneUIProvider.js +256 -0
  44. package/Grid.js +166 -0
  45. package/Holder.js +99 -0
  46. package/Icon.js +63 -0
  47. package/Image.js +130 -0
  48. package/ImagePreview.js +99 -0
  49. package/KeyValue.js +63 -0
  50. package/Label.js +58 -0
  51. package/LinkButton.js +104 -0
  52. package/Menu.js +277 -0
  53. package/MobileNavigation.js +95 -0
  54. package/MobilePopup.js +180 -0
  55. package/Modal.js +251 -0
  56. package/ModuleTitle.js +99 -0
  57. package/NavigationMenu.js +212 -0
  58. package/Notification.js +120 -0
  59. package/Option.js +186 -0
  60. package/Overlay.js +99 -0
  61. package/Overspread.js +343 -0
  62. package/Pagination.js +258 -0
  63. package/Paper.js +97 -0
  64. package/Popover-f4d1cac0.js +411 -0
  65. package/Popover.js +20 -0
  66. package/PopoverV2.js +19 -0
  67. package/Portal.js +58 -0
  68. package/Products.js +115 -0
  69. package/Profile.js +99 -0
  70. package/Progress.js +200 -0
  71. package/QRCode.js +816 -0
  72. package/README.md +90 -0
  73. package/Radio.js +152 -0
  74. package/RadioGroup.js +105 -0
  75. package/Range.js +14 -0
  76. package/RichEditor-b7928765.js +228 -0
  77. package/RichEditor.js +13 -0
  78. package/Scrollbar.js +1587 -0
  79. package/Search.js +72 -0
  80. package/SearchWithDropdown.js +195 -0
  81. package/Section.js +62 -0
  82. package/SkeletonLoader.js +82 -0
  83. package/Slider.js +256 -0
  84. package/Status.js +104 -0
  85. package/Steps.js +312 -0
  86. package/SuggestionList.js +15 -0
  87. package/Switcher.js +194 -0
  88. package/Table.js +102 -0
  89. package/TableCompositions.js +17028 -0
  90. package/Tabs.js +236 -0
  91. package/Tag.js +103 -0
  92. package/TextLink.js +22 -0
  93. package/Textarea.js +239 -0
  94. package/Time.js +63 -0
  95. package/TimePicker.js +99 -0
  96. package/Timeline.js +114 -0
  97. package/Title.js +66 -0
  98. package/Toaster.js +116 -0
  99. package/Tooltip.js +157 -0
  100. package/TransferList.js +502 -0
  101. package/Uploader.js +32 -0
  102. package/ValidatableCheckbox.js +126 -0
  103. package/ValidatableDatePicker.js +312 -0
  104. package/ValidatableDropdown.js +99 -0
  105. package/ValidatableElements.js +99 -0
  106. package/ValidatableMultiSelectDropdown.js +99 -0
  107. package/ValidatableNumberInput.js +194 -0
  108. package/ValidatableRadio.js +117 -0
  109. package/ValidatableSwitcher.js +94 -0
  110. package/ValidatableTextInput.js +164 -0
  111. package/ValidatableTimeInput.js +171 -0
  112. package/ValidatableUploader.js +94 -0
  113. package/Widget.js +99 -0
  114. package/_commonjsHelpers-24198af3.js +35 -0
  115. package/_rollupPluginBabelHelpers-e8fb2e5c.js +16 -0
  116. package/checkTimeValidation-e56771be.js +16 -0
  117. package/checkboxRadioSwitcher-5b69d7bd.js +4 -0
  118. package/clsx.m-2bb6df4b.js +3 -0
  119. package/configs-91c86664.js +96 -0
  120. package/configs.js +131 -0
  121. package/dateValidation-67caec66.js +225 -0
  122. package/debounce-4419bc2f.js +17 -0
  123. package/globalStyling-9c60a159.js +4 -0
  124. package/guid-8ddf77b3.js +16 -0
  125. package/index-00fe8887.js +193 -0
  126. package/index-0cf65939.js +30991 -0
  127. package/index-122432cd.js +270 -0
  128. package/index-262edd7a.js +77 -0
  129. package/index-5cea9a7d.js +407 -0
  130. package/index-5e722d91.js +867 -0
  131. package/index-67f4d4d1.js +6568 -0
  132. package/index-6ff23041.js +66 -0
  133. package/index-702bf24a.js +1938 -0
  134. package/index-a4635754.js +329 -0
  135. package/index-a59530cd.js +4 -0
  136. package/index-ac59cb10.js +169 -0
  137. package/index-b7a33c58.js +11 -0
  138. package/index-d9e8a888.js +987 -0
  139. package/index-e0af0caf.js +1182 -0
  140. package/index-e8776f3d.js +807 -0
  141. package/index.js +128 -0
  142. package/localization-4ba17032.js +46 -0
  143. package/objectWithoutPropertiesLoose-299691d8.js +78 -0
  144. package/package.json +190 -0
  145. package/rangeAndSlider-20599da4.js +8839 -0
  146. package/react-beautiful-dnd.esm-38c37304.js +10117 -0
  147. package/style-inject.es-746bb8ed.js +28 -0
  148. package/useClickOutside-5183e396.js +25 -0
  149. package/useDeviceType-dd51db38.js +15 -0
  150. package/useEllipsisDetection-ef536015.js +23 -0
  151. package/useKeyDown-38102ae7.js +21 -0
  152. package/useMount-6fef51a5.js +9 -0
  153. package/useWidth-9f4647f8.js +15 -0
  154. package/useWindowSize-80369d76.js +33 -0
package/ColorPicker.js ADDED
@@ -0,0 +1,210 @@
1
+ import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import React__default, { useRef, useMemo, useEffect, useState, useCallback, useLayoutEffect } from 'react';
3
+ import { p as propTypesExports } from './index-e0af0caf.js';
4
+ import { c as classnames } from './index-6ff23041.js';
5
+ import { n as noop } from './index-ac59cb10.js';
6
+ import { s as styleInject } from './style-inject.es-746bb8ed.js';
7
+ import './dateValidation-67caec66.js';
8
+ import './_commonjsHelpers-24198af3.js';
9
+ import 'react-dom';
10
+
11
+ function u(){return (u=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);}return e}).apply(this,arguments)}function c(e,r){if(null==e)return {};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r.indexOf(t=a[n])>=0||(o[t]=e[t]);return o}function i(e){var t=useRef(e),n=useRef(function(e){t.current&&t.current(e);});return t.current=e,n.current}var s=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=1),e>t?t:e<r?r:e},f=function(e){return "touches"in e},v=function(e){return e&&e.ownerDocument.defaultView||self},d=function(e,r,t){var n=e.getBoundingClientRect(),o=f(r)?function(e,r){for(var t=0;t<e.length;t++)if(e[t].identifier===r)return e[t];return e[0]}(r.touches,t):r;return {left:s((o.pageX-(n.left+v(e).pageXOffset))/n.width),top:s((o.pageY-(n.top+v(e).pageYOffset))/n.height)}},h=function(e){!f(e)&&e.preventDefault();},m=React__default.memo(function(o){var a=o.onMove,l=o.onKey,s=c(o,["onMove","onKey"]),m=useRef(null),g=i(a),p=i(l),b=useRef(null),_=useRef(!1),x=useMemo(function(){var e=function(e){h(e),(f(e)?e.touches.length>0:e.buttons>0)&&m.current?g(d(m.current,e,b.current)):t(!1);},r=function(){return t(!1)};function t(t){var n=_.current,o=v(m.current),a=t?o.addEventListener:o.removeEventListener;a(n?"touchmove":"mousemove",e),a(n?"touchend":"mouseup",r);}return [function(e){var r=e.nativeEvent,n=m.current;if(n&&(h(r),!function(e,r){return r&&!f(e)}(r,_.current)&&n)){if(f(r)){_.current=!0;var o=r.changedTouches||[];o.length&&(b.current=o[0].identifier);}n.focus(),g(d(n,r,b.current)),t(!0);}},function(e){var r=e.which||e.keyCode;r<37||r>40||(e.preventDefault(),p({left:39===r?.05:37===r?-.05:0,top:40===r?.05:38===r?-.05:0}));},t]},[p,g]),C=x[0],E=x[1],H=x[2];return useEffect(function(){return H},[H]),React__default.createElement("div",u({},s,{onTouchStart:C,onMouseDown:C,className:"react-colorful__interactive",ref:m,onKeyDown:E,tabIndex:0,role:"slider"}))}),g=function(e){return e.filter(Boolean).join(" ")},p=function(r){var t=r.color,n=r.left,o=r.top,a=void 0===o?.5:o,l=g(["react-colorful__pointer",r.className]);return React__default.createElement("div",{className:l,style:{top:100*a+"%",left:100*n+"%"}},React__default.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},b=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=Math.pow(10,r)),Math.round(t*e)/t},x=function(e){return L(C(e))},C=function(e){return "#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?b(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?b(parseInt(e.substring(6,8),16)/255,2):1}},w=function(e){return K(I(e))},y=function(e){var r=e.s,t=e.v,n=e.a,o=(200-r)*t/100;return {h:b(e.h),s:b(o>0&&o<200?r*t/100/(o<=100?o:200-o)*100:0),l:b(o/2),a:b(n,2)}},q=function(e){var r=y(e);return "hsl("+r.h+", "+r.s+"%, "+r.l+"%)"},k=function(e){var r=y(e);return "hsla("+r.h+", "+r.s+"%, "+r.l+"%, "+r.a+")"},I=function(e){var r=e.h,t=e.s,n=e.v,o=e.a;r=r/360*6,t/=100,n/=100;var a=Math.floor(r),l=n*(1-t),u=n*(1-(r-a)*t),c=n*(1-(1-r+a)*t),i=a%6;return {r:b(255*[n,u,l,l,c,n][i]),g:b(255*[c,n,n,u,l,l][i]),b:b(255*[l,l,c,n,n,u][i]),a:b(o,2)}},D=function(e){var r=e.toString(16);return r.length<2?"0"+r:r},K=function(e){var r=e.r,t=e.g,n=e.b,o=e.a,a=o<1?D(b(255*o)):"";return "#"+D(r)+D(t)+D(n)+a},L=function(e){var r=e.r,t=e.g,n=e.b,o=e.a,a=Math.max(r,t,n),l=a-Math.min(r,t,n),u=l?a===r?(t-n)/l:a===t?2+(n-r)/l:4+(r-t)/l:0;return {h:b(60*(u<0?u+6:u)),s:b(a?l/a*100:0),v:b(a/255*100),a:o}},S=React__default.memo(function(r){var t=r.hue,n=r.onChange,o=g(["react-colorful__hue",r.className]);return React__default.createElement("div",{className:o},React__default.createElement(m,{onMove:function(e){n({h:360*e.left});},onKey:function(e){n({h:s(t+360*e.left,0,360)});},"aria-label":"Hue","aria-valuenow":b(t),"aria-valuemax":"360","aria-valuemin":"0"},React__default.createElement(p,{className:"react-colorful__hue-pointer",left:t/360,color:q({h:t,s:100,v:100,a:1})})))}),T=React__default.memo(function(r){var t=r.hsva,n=r.onChange,o={backgroundColor:q({h:t.h,s:100,v:100,a:1})};return React__default.createElement("div",{className:"react-colorful__saturation",style:o},React__default.createElement(m,{onMove:function(e){n({s:100*e.left,v:100-100*e.top});},onKey:function(e){n({s:s(t.s+100*e.left,0,100),v:s(t.v-100*e.top,0,100)});},"aria-label":"Color","aria-valuetext":"Saturation "+b(t.s)+"%, Brightness "+b(t.v)+"%"},React__default.createElement(p,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:q(t)})))}),F=function(e,r){if(e===r)return !0;for(var t in e)if(e[t]!==r[t])return !1;return !0},X=function(e,r){return e.toLowerCase()===r.toLowerCase()||F(C(e),C(r))};function Y(e,t,l){var u=i(l),c=useState(function(){return e.toHsva(t)}),s=c[0],f=c[1],v=useRef({color:t,hsva:s});useEffect(function(){if(!e.equal(t,v.current.color)){var r=e.toHsva(t);v.current={hsva:r,color:t},f(r);}},[t,e]),useEffect(function(){var r;F(s,v.current.hsva)||e.equal(r=e.fromHsva(s),v.current.color)||(v.current={hsva:s,color:r},u(r));},[s,e,u]);var d=useCallback(function(e){f(function(r){return Object.assign({},r,e)});},[]);return [s,d]}var V="undefined"!=typeof window?useLayoutEffect:useEffect,$=function(){return ("undefined"!=typeof __webpack_nonce__?__webpack_nonce__:void 0)},J=new Map,Q=function(e){V(function(){var r=e.current?e.current.ownerDocument:document;if(void 0!==r&&!J.has(r)){var t=r.createElement("style");t.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',J.set(r,t);var n=$();n&&t.setAttribute("nonce",n),r.head.appendChild(t);}},[]);},U=function(t){var n=t.className,o=t.colorModel,a=t.color,l=void 0===a?o.defaultColor:a,i=t.onChange,s=c(t,["className","colorModel","color","onChange"]),f=useRef(null);Q(f);var v=Y(o,l,i),d=v[0],h=v[1],m=g(["react-colorful",n]);return React__default.createElement("div",u({},s,{ref:f,className:m}),React__default.createElement(T,{hsva:d,onChange:h}),React__default.createElement(S,{hue:d.h,onChange:h,className:"react-colorful__last-control"}))},W={defaultColor:"000",toHsva:x,fromHsva:function(e){return w({h:e.h,s:e.s,v:e.v,a:1})},equal:X},Z=function(r){return React__default.createElement(U,u({},r,{colorModel:W}))},ee=function(r){var t=r.className,n=r.hsva,o=r.onChange,a={backgroundImage:"linear-gradient(90deg, "+k(Object.assign({},n,{a:0}))+", "+k(Object.assign({},n,{a:1}))+")"},l=g(["react-colorful__alpha",t]),u=b(100*n.a);return React__default.createElement("div",{className:l},React__default.createElement("div",{className:"react-colorful__alpha-gradient",style:a}),React__default.createElement(m,{onMove:function(e){o({a:e.left});},onKey:function(e){o({a:s(n.a+e.left)});},"aria-label":"Alpha","aria-valuetext":u+"%","aria-valuenow":u,"aria-valuemin":"0","aria-valuemax":"100"},React__default.createElement(p,{className:"react-colorful__alpha-pointer",left:n.a,color:k(n)})))},re=function(t){var n=t.className,o=t.colorModel,a=t.color,l=void 0===a?o.defaultColor:a,i=t.onChange,s=c(t,["className","colorModel","color","onChange"]),f=useRef(null);Q(f);var v=Y(o,l,i),d=v[0],h=v[1],m=g(["react-colorful",n]);return React__default.createElement("div",u({},s,{ref:f,className:m}),React__default.createElement(T,{hsva:d,onChange:h}),React__default.createElement(S,{hue:d.h,onChange:h}),React__default.createElement(ee,{hsva:d,onChange:h,className:"react-colorful__last-control"}))},xe={defaultColor:{r:0,g:0,b:0,a:1},toHsva:L,fromHsva:I,equal:F},Ce=function(r){return React__default.createElement(re,u({},r,{colorModel:xe}))};
12
+
13
+ var css_248z = "[data-gene-ui-version=\"2.11.0\"] .color-picker-holder{background:var(--background);padding:1.2rem;width:27.6rem}[data-gene-ui-version=\"2.11.0\"] .color-picker-holder .react-colorful{grid-row-gap:1.2rem;display:grid;grid-template-columns:100%;height:auto;width:100%}[data-gene-ui-version=\"2.11.0\"] .color-picker-holder .react-colorful .react-colorful__saturation{border-radius:.5rem;height:14rem}[data-gene-ui-version=\"2.11.0\"] .color-picker-holder .react-colorful .react-colorful__alpha,[data-gene-ui-version=\"2.11.0\"] .color-picker-holder .react-colorful .react-colorful__hue{border-radius:1.6rem;height:1.6rem}[data-gene-ui-version=\"2.11.0\"] .color-picker-holder .react-colorful .react-colorful__pointer{box-shadow:0 0 6px 0 #0000004d;height:2rem;width:2rem}[data-gene-ui-version=\"2.11.0\"] .color-picker-samples{grid-column-gap:.5rem;grid-row-gap:.5rem;display:grid;grid-template-columns:repeat(7,1fr);margin:2.4rem 0 0;width:100%}[data-gene-ui-version=\"2.11.0\"] .color-picker-samples button{border:1px solid rgba(var(--background-sc-rgb),.05);border-radius:.5rem;cursor:pointer;padding:100% 0 0;position:relative;transition:border-color .4s}[data-gene-ui-version=\"2.11.0\"] .color-picker-samples button:after{background:#fff;border-radius:.3rem;content:\"\";height:100%;left:0;opacity:0;position:absolute;top:0;transition:opacity .4s;width:100%}@media (hover:hover){[data-gene-ui-version=\"2.11.0\"] .color-picker-samples button:hover{border-color:rgba(var(--background-sc-rgb),.15)}[data-gene-ui-version=\"2.11.0\"] .color-picker-samples button:hover:after{opacity:.15}}[data-gene-ui-version=\"2.11.0\"] .color-picker-samples button small{background:#e86a6a;border-radius:.2rem;display:block;height:.2rem;left:50%;position:absolute;top:50%;transform:translate3d(-50%,-50%,0) rotate(-45deg);width:110%}[data-gene-ui-version=\"2.11.0\"] .color-picker-inputs{grid-column-gap:.5rem;display:grid;grid-template-columns:100%;margin:1.2rem 0 0}[data-gene-ui-version=\"2.11.0\"] .alpha-enabled .color-picker-inputs{grid-template-columns:1fr .75fr}[data-gene-ui-version=\"2.11.0\"] .color-picker-inputs input{background-color:var(--b);border:1px solid rgba(var(--background-sc-rgb),.15);border-radius:.8rem;height:3.2rem;padding:0 1.2rem;text-align:center;transition:border-color .4s;width:100%}[data-gene-ui-version=\"2.11.0\"] .color-picker-inputs input:focus{border-color:rgba(var(--background-sc-rgb),.3)}";
14
+ styleInject(css_248z);
15
+
16
+ const defaultColors = ['#e91e63', '#9c26b0', '#673ab7', '#3f51b5', '#2096f3', '#06a9f4', '#02bcd4', '#029588', '#4caf50', '#ffeb3b', '#ffc108', '#fe9804', '#ff5622'];
17
+ function rgbToHex(val) {
18
+ const color = {
19
+ r: val.r.toString(16),
20
+ g: val.g.toString(16),
21
+ b: val.b.toString(16)
22
+ };
23
+ if (color.r.length === 1) color.r = "0".concat(color.r);
24
+ if (color.g.length === 1) color.g = "0".concat(color.g);
25
+ if (color.b.length === 1) color.b = "0".concat(color.b);
26
+ return "#".concat(color.r).concat(color.g).concat(color.b);
27
+ }
28
+ function hexToRgb(hex) {
29
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
30
+ return result ? {
31
+ r: parseInt(result[1], 16),
32
+ g: parseInt(result[2], 16),
33
+ b: parseInt(result[3], 16)
34
+ } : null;
35
+ }
36
+ function ColorPicker(_ref) {
37
+ let {
38
+ alphaEnabled,
39
+ recentColors,
40
+ defaultColor,
41
+ onChange,
42
+ value,
43
+ colorPickerProps,
44
+ className,
45
+ alphaValue,
46
+ ...rest
47
+ } = _ref;
48
+ const [color, setColor] = useState(() => {
49
+ const initialValue = value || defaultColor;
50
+ return initialValue ? typeof initialValue === 'object' ? rgbToHex(initialValue) : initialValue : '#aabbcc';
51
+ });
52
+ const [colorRGBA, setColorRGBA] = useState(() => {
53
+ const initialValue = value || defaultColor;
54
+ const rgba = typeof initialValue === 'string' ? hexToRgb(initialValue) : initialValue;
55
+ const customAlpha = rgba && rgba.a;
56
+ return initialValue ? {
57
+ ...rgba,
58
+ a: customAlpha || alphaValue / 100
59
+ } : {
60
+ r: 170,
61
+ g: 187,
62
+ b: 204,
63
+ a: alphaValue / 100
64
+ };
65
+ });
66
+ const [alpha, setAlpha] = useState(alphaValue);
67
+ const handlePickerChange = useCallback(val => {
68
+ if (alphaEnabled) {
69
+ const hex = typeof val === 'object' ? rgbToHex(val) : val;
70
+ const rgba = typeof val === 'object' ? val : hexToRgb(val);
71
+ const opacity = rgba.a ? rgba.a === 0 ? 0 : Math.round(rgba.a * 100) || 100 : alpha;
72
+ setColor(hex);
73
+ setColorRGBA(rgba);
74
+ setAlpha(opacity);
75
+ onChange(hex, rgba, opacity);
76
+ } else {
77
+ const rgba = hexToRgb(val);
78
+ setColor(val);
79
+ setColorRGBA(rgba);
80
+ onChange(val, rgba, alpha);
81
+ }
82
+ }, [alpha, alphaEnabled, alpha]);
83
+ const handleColorChange = useCallback(_ref2 => {
84
+ let {
85
+ target
86
+ } = _ref2;
87
+ const {
88
+ value
89
+ } = target;
90
+ const rgba = alphaEnabled ? hexToRgb(value) : value;
91
+ setColor(value);
92
+ rgba && setColorRGBA(rgba);
93
+ onChange(value, rgba, alpha);
94
+ }, [alphaEnabled, alpha]);
95
+ const handleAlphaChange = useCallback(_ref3 => {
96
+ let {
97
+ target
98
+ } = _ref3;
99
+ const {
100
+ value
101
+ } = target;
102
+ if (value > 100 || value < 0) {
103
+ return;
104
+ }
105
+ if (value === '') {
106
+ setAlpha(0);
107
+ setColorRGBA({
108
+ ...colorRGBA,
109
+ a: 0
110
+ });
111
+ onChange(color, {
112
+ ...colorRGBA,
113
+ a: 0
114
+ }, alpha);
115
+ } else {
116
+ setAlpha(value);
117
+ setColorRGBA({
118
+ ...colorRGBA,
119
+ a: value / 100
120
+ });
121
+ onChange(color, {
122
+ ...colorRGBA,
123
+ a: value / 100
124
+ }, alpha);
125
+ }
126
+ }, [alphaEnabled, colorRGBA, onChange, color]);
127
+ const sharedProps = {
128
+ color: alphaEnabled ? colorRGBA : color,
129
+ onChange: handlePickerChange,
130
+ ...colorPickerProps
131
+ };
132
+ useEffect(() => {
133
+ value && setColor(value);
134
+ }, [value]);
135
+ useEffect(() => {
136
+ alphaValue && setAlpha(alphaValue);
137
+ }, [alphaValue]);
138
+ return /*#__PURE__*/React__default.createElement("div", _extends({
139
+ className: classnames(className, 'color-picker-holder', {
140
+ 'alpha-enabled': alphaEnabled
141
+ })
142
+ }, rest), alphaEnabled ? /*#__PURE__*/React__default.createElement(Ce, sharedProps) : /*#__PURE__*/React__default.createElement(Z, sharedProps), /*#__PURE__*/React__default.createElement("div", {
143
+ className: "color-picker-samples"
144
+ }, /*#__PURE__*/React__default.createElement("button", {
145
+ onClick: () => setColor('')
146
+ }, /*#__PURE__*/React__default.createElement("small", null)), recentColors.map(c => /*#__PURE__*/React__default.createElement("button", {
147
+ key: c,
148
+ onClick: () => handlePickerChange(c),
149
+ style: {
150
+ background: c
151
+ }
152
+ }))), /*#__PURE__*/React__default.createElement("div", {
153
+ className: "color-picker-inputs"
154
+ }, /*#__PURE__*/React__default.createElement("input", {
155
+ value: color,
156
+ maxLength: 7,
157
+ onChange: handleColorChange,
158
+ placeholder: "Hex"
159
+ }), alphaEnabled && /*#__PURE__*/React__default.createElement("input", {
160
+ type: "number",
161
+ min: "0",
162
+ max: "100",
163
+ placeholder: "Alpha",
164
+ value: alpha,
165
+ onChange: handleAlphaChange
166
+ })));
167
+ }
168
+ ColorPicker.defaultProps = {
169
+ alphaValue: 100,
170
+ alphaEnabled: false,
171
+ defaultColor: defaultColors[0],
172
+ onChange: noop,
173
+ recentColors: defaultColors
174
+ };
175
+ ColorPicker.propTypes = {
176
+ /**
177
+ * Show alpha in color picker
178
+ */
179
+ alphaEnabled: propTypesExports.bool,
180
+ /**
181
+ * Array of default colors in hex format
182
+ */
183
+ recentColors: propTypesExports.array,
184
+ /**
185
+ * Default selected color
186
+ */
187
+ defaultColor: propTypesExports.string,
188
+ /**
189
+ * Fires an event when 'Color picker' changes value ((hex: string, rgba: object, alpha: number) => void).
190
+ */
191
+ onChange: propTypesExports.func,
192
+ /**
193
+ * Provided value ( if component controlled by you)
194
+ */
195
+ value: propTypesExports.string,
196
+ /**
197
+ * Provided value for aplha ( if component controlled by you)
198
+ */
199
+ alphaValue: propTypesExports.string,
200
+ /**
201
+ * Additional props for color picker, for more info about accepted props pls check 'react-colorful'
202
+ */
203
+ colorPickerProps: propTypesExports.object,
204
+ /**
205
+ * External/additional className for component
206
+ */
207
+ className: propTypesExports.string
208
+ };
209
+
210
+ export { ColorPicker as default };
package/ComboBox.js ADDED
@@ -0,0 +1,99 @@
1
+ import './_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import 'react';
3
+ import './index-e0af0caf.js';
4
+ import './index-6ff23041.js';
5
+ import './configs-91c86664.js';
6
+ import './index-ac59cb10.js';
7
+ import './useClickOutside-5183e396.js';
8
+ import './Tooltip.js';
9
+ import './Icon.js';
10
+ export { C as default } from './index-0cf65939.js';
11
+ import './index-5cea9a7d.js';
12
+ import './Scrollbar.js';
13
+ import './globalStyling-9c60a159.js';
14
+ import './dateValidation-67caec66.js';
15
+ import './_commonjsHelpers-24198af3.js';
16
+ import 'react-dom';
17
+ import './Popover-f4d1cac0.js';
18
+ import './useDeviceType-dd51db38.js';
19
+ import './useWindowSize-80369d76.js';
20
+ import './GeneUIProvider.js';
21
+ import './style-inject.es-746bb8ed.js';
22
+ import './Editor.js';
23
+ import './useMount-6fef51a5.js';
24
+ import './Button.js';
25
+ import './ValidatableUploader.js';
26
+ import './index-d9e8a888.js';
27
+ import './Grid.js';
28
+ import './useWidth-9f4647f8.js';
29
+ import './useKeyDown-38102ae7.js';
30
+ import './BusyLoader.js';
31
+ import './Image.js';
32
+ import './Empty.js';
33
+ import './Checkbox.js';
34
+ import './checkboxRadioSwitcher-5b69d7bd.js';
35
+ import './guid-8ddf77b3.js';
36
+ import './ExtendedInput.js';
37
+ import './ValidatableRadio.js';
38
+ import './RadioGroup.js';
39
+ import './Radio.js';
40
+ import './ValidatableCheckbox.js';
41
+ import './ValidatableSwitcher.js';
42
+ import './Switcher.js';
43
+ import './ValidatableNumberInput.js';
44
+ import './ValidatableTextInput.js';
45
+ import './ValidatableDatePicker.js';
46
+ import './index-5e722d91.js';
47
+ import './index-702bf24a.js';
48
+ import './index-122432cd.js';
49
+ import './debounce-4419bc2f.js';
50
+ import './DatePicker.js';
51
+ import './localization-4ba17032.js';
52
+ import './checkTimeValidation-e56771be.js';
53
+ import './useEllipsisDetection-ef536015.js';
54
+ import './Tabs.js';
55
+ import './Steps.js';
56
+ import './index-a4635754.js';
57
+ import './Portal.js';
58
+ import './Timeline.js';
59
+ import './Card.js';
60
+ import './MobilePopup.js';
61
+ import './Menu.js';
62
+ import './Option.js';
63
+ import './SkeletonLoader.js';
64
+ import './KeyValue.js';
65
+ import './configs.js';
66
+ import './Tag.js';
67
+ import './Alert.js';
68
+ import './index-00fe8887.js';
69
+ import './rangeAndSlider-20599da4.js';
70
+ import './Slider.js';
71
+ import './Pagination.js';
72
+ import './Divider.js';
73
+ import './objectWithoutPropertiesLoose-299691d8.js';
74
+ import './clsx.m-2bb6df4b.js';
75
+ import './index-a59530cd.js';
76
+ import './Notification.js';
77
+ import './Modal.js';
78
+ import './Collapse.js';
79
+ import './Status.js';
80
+ import './Avatar.js';
81
+ import './Search.js';
82
+ import './TextLink.js';
83
+ import './Label.js';
84
+ import './Paper.js';
85
+ import './Badge.js';
86
+ import './Time.js';
87
+ import './Title.js';
88
+ import './index-b7a33c58.js';
89
+ import './QRCode.js';
90
+ import './Progress.js';
91
+ import './MobileNavigation.js';
92
+ import './Products.js';
93
+ import './Breadcrumb.js';
94
+ import './Section.js';
95
+ import './ColorPicker.js';
96
+ import './NavigationMenu.js';
97
+ import './Textarea.js';
98
+ import './AdvancedSearch.js';
99
+ import './LinkButton.js';
package/Counter.js ADDED
@@ -0,0 +1,99 @@
1
+ import 'react';
2
+ import './index-ac59cb10.js';
3
+ import './index-6ff23041.js';
4
+ import './index-e0af0caf.js';
5
+ import './useKeyDown-38102ae7.js';
6
+ import './configs-91c86664.js';
7
+ import './Tooltip.js';
8
+ import './ExtendedInput.js';
9
+ import './TextLink.js';
10
+ import './Button.js';
11
+ import './Label.js';
12
+ import './Icon.js';
13
+ import './Switcher.js';
14
+ import './Divider.js';
15
+ import './Radio.js';
16
+ import './Paper.js';
17
+ import './Portal.js';
18
+ import './Avatar.js';
19
+ import './Badge.js';
20
+ import './BusyLoader.js';
21
+ export { a as default } from './index-0cf65939.js';
22
+ import './SkeletonLoader.js';
23
+ import './Scrollbar.js';
24
+ import './Time.js';
25
+ import './Empty.js';
26
+ import './index-a4635754.js';
27
+ import './index-702bf24a.js';
28
+ import './Title.js';
29
+ import './Image.js';
30
+ import './KeyValue.js';
31
+ import './Option.js';
32
+ import './QRCode.js';
33
+ import './globalStyling-9c60a159.js';
34
+ import './dateValidation-67caec66.js';
35
+ import './_commonjsHelpers-24198af3.js';
36
+ import 'react-dom';
37
+ import './_rollupPluginBabelHelpers-e8fb2e5c.js';
38
+ import './Popover-f4d1cac0.js';
39
+ import './useDeviceType-dd51db38.js';
40
+ import './useWindowSize-80369d76.js';
41
+ import './GeneUIProvider.js';
42
+ import './style-inject.es-746bb8ed.js';
43
+ import './index-5cea9a7d.js';
44
+ import './useClickOutside-5183e396.js';
45
+ import './checkboxRadioSwitcher-5b69d7bd.js';
46
+ import './guid-8ddf77b3.js';
47
+ import './configs.js';
48
+ import './Editor.js';
49
+ import './useMount-6fef51a5.js';
50
+ import './ValidatableUploader.js';
51
+ import './index-d9e8a888.js';
52
+ import './Grid.js';
53
+ import './useWidth-9f4647f8.js';
54
+ import './Checkbox.js';
55
+ import './ValidatableRadio.js';
56
+ import './RadioGroup.js';
57
+ import './ValidatableCheckbox.js';
58
+ import './ValidatableSwitcher.js';
59
+ import './ValidatableNumberInput.js';
60
+ import './ValidatableTextInput.js';
61
+ import './ValidatableDatePicker.js';
62
+ import './index-5e722d91.js';
63
+ import './DatePicker.js';
64
+ import './localization-4ba17032.js';
65
+ import './checkTimeValidation-e56771be.js';
66
+ import './index-122432cd.js';
67
+ import './debounce-4419bc2f.js';
68
+ import './useEllipsisDetection-ef536015.js';
69
+ import './Tabs.js';
70
+ import './Steps.js';
71
+ import './Timeline.js';
72
+ import './Card.js';
73
+ import './MobilePopup.js';
74
+ import './Menu.js';
75
+ import './Tag.js';
76
+ import './Alert.js';
77
+ import './index-00fe8887.js';
78
+ import './rangeAndSlider-20599da4.js';
79
+ import './Slider.js';
80
+ import './Pagination.js';
81
+ import './objectWithoutPropertiesLoose-299691d8.js';
82
+ import './clsx.m-2bb6df4b.js';
83
+ import './index-a59530cd.js';
84
+ import './Notification.js';
85
+ import './Modal.js';
86
+ import './Collapse.js';
87
+ import './Status.js';
88
+ import './Search.js';
89
+ import './index-b7a33c58.js';
90
+ import './Progress.js';
91
+ import './MobileNavigation.js';
92
+ import './Products.js';
93
+ import './Breadcrumb.js';
94
+ import './Section.js';
95
+ import './ColorPicker.js';
96
+ import './NavigationMenu.js';
97
+ import './Textarea.js';
98
+ import './AdvancedSearch.js';
99
+ import './LinkButton.js';
package/DateFilter.js ADDED
@@ -0,0 +1,179 @@
1
+ import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import React__default, { useState, useCallback } from 'react';
3
+ import { p as propTypesExports } from './index-e0af0caf.js';
4
+ import { c as classnames } from './index-6ff23041.js';
5
+ import { n as noop, b as isToday, d as isYesterday, e as isThisWeek, h as isLastWeek, j as isThisMonth, l as isLastMonth, m as isLastMonthToDate, o as getLMTD } from './index-ac59cb10.js';
6
+ import { d as dayjsWithPlugins } from './dateValidation-67caec66.js';
7
+ import { D as DatePickerInput } from './index-5e722d91.js';
8
+ import Button from './Button.js';
9
+ import './globalStyling-9c60a159.js';
10
+ import { s as styleInject } from './style-inject.es-746bb8ed.js';
11
+ import { g as getBrowserDateFormat } from './localization-4ba17032.js';
12
+ import 'react-dom';
13
+ import './_commonjsHelpers-24198af3.js';
14
+ import './configs-91c86664.js';
15
+ import './useKeyDown-38102ae7.js';
16
+ import './useDeviceType-dd51db38.js';
17
+ import './useWindowSize-80369d76.js';
18
+ import './index-702bf24a.js';
19
+ import './index-122432cd.js';
20
+ import './useClickOutside-5183e396.js';
21
+ import './Scrollbar.js';
22
+ import './GeneUIProvider.js';
23
+ import './debounce-4419bc2f.js';
24
+ import './DatePicker.js';
25
+ import './guid-8ddf77b3.js';
26
+ import './Icon.js';
27
+ import './ExtendedInput.js';
28
+ import './index-5cea9a7d.js';
29
+ import './Tooltip.js';
30
+ import './Popover-f4d1cac0.js';
31
+
32
+ var css_248z = "[data-gene-ui-version=\"2.11.0\"] .date-filters-holder{align-items:center;display:flex;justify-content:flex-end;width:100%}[data-gene-ui-version=\"2.11.0\"] .date-filters-holder>:not(:last-child){flex-shrink:0}[data-gene-ui-version=\"2.11.0\"] .date-filter-input{margin-inline-start:1rem}html:not([dir=rtl]) .date-filter-input .input-structure{padding-right:0}html[dir=rtl] .date-filter-input .input-structure{padding-left:0}[data-gene-ui-version=\"2.11.0\"] .date-filter-input .icon{border-radius:var(--input-element-border-radius,100%);height:3.6rem;margin:0 0 0 .5rem;width:3.6rem}html[dir=rtl] .date-filter-input .icon{margin:0 .5rem 0 0}[data-gene-ui-version=\"2.11.0\"] .date-filter-input.active .icon{background:var(--hero);color:var(--hero-sc)}[data-gene-ui-version=\"2.11.0\"] .date-filter-input.active .input-element-back{background:#0000;border-color:var(--hero)}";
33
+ styleInject(css_248z);
34
+
35
+ function getFilterByKey(key, date) {
36
+ const [start, end] = date;
37
+ const startDate = start ? dayjsWithPlugins(start) : null;
38
+ const endDate = end ? dayjsWithPlugins(end) : null;
39
+ const today = dayjsWithPlugins();
40
+ const dayFromLastWeek = today.subtract(7, 'day');
41
+ const dayFromLastMonth = today.subtract(1, 'month');
42
+ if (key === 'today') return {
43
+ selected: startDate && isToday(startDate, endDate || startDate),
44
+ value: [today, today]
45
+ };
46
+ if (key === 'yesterday') return {
47
+ selected: startDate && isYesterday(startDate, endDate || startDate),
48
+ value: [today.subtract(1, 'day'), today.subtract(1, 'day')]
49
+ };
50
+ if (key === 'thisWeek') return {
51
+ selected: startDate && isThisWeek(startDate, endDate),
52
+ value: [today.startOf('week'), today.endOf('week')]
53
+ };
54
+ if (key === 'lastWeek') return {
55
+ selected: startDate && isLastWeek(startDate, endDate),
56
+ value: [dayFromLastWeek.startOf('week'), dayFromLastWeek.endOf('week')]
57
+ };
58
+ if (key === 'thisMonth') return {
59
+ selected: startDate && isThisMonth(startDate, endDate),
60
+ value: [today.startOf('month'), today.endOf('month')]
61
+ };
62
+ if (key === 'lastMonth') return {
63
+ selected: startDate && isLastMonth(startDate, endDate),
64
+ value: [dayFromLastMonth.startOf('month'), dayFromLastMonth.endOf('month')]
65
+ };
66
+ if (key === 'LMTD') return {
67
+ selected: startDate && isLastMonthToDate(startDate, endDate),
68
+ value: [dayFromLastMonth.startOf('month'), getLMTD(today, dayFromLastMonth)]
69
+ };
70
+ }
71
+ const getRightDate = (date, isControlled) => isControlled && date ? dayjsWithPlugins(date).toDate() : null;
72
+ function DateFilter(props) {
73
+ const {
74
+ value,
75
+ onChange,
76
+ format,
77
+ filters,
78
+ className,
79
+ buttonProps,
80
+ pickerProps,
81
+ ...restProps
82
+ } = props;
83
+ const isControlled = ('value' in props);
84
+ const [localValue, setLocalValue] = useState(() => {
85
+ const [start, end] = value;
86
+ const startDate = getRightDate(start, isControlled);
87
+ const endDate = getRightDate(end, isControlled);
88
+ return [startDate, endDate];
89
+ });
90
+ const handleChange = useCallback(dates => {
91
+ setLocalValue(dates);
92
+ onChange(dates);
93
+ }, [onChange]);
94
+ const handleButtonClick = useCallback(_ref => {
95
+ let [start, end] = _ref;
96
+ const dateObj = [start.toDate(), end.toDate()];
97
+ setLocalValue(dateObj);
98
+ onChange(dateObj);
99
+ }, [onChange]);
100
+ return /*#__PURE__*/React__default.createElement("div", _extends({
101
+ className: classnames('date-filters-holder', className)
102
+ }, restProps), Object.keys(filters).map(key => {
103
+ const label = filters[key];
104
+ const filter = getFilterByKey(key, localValue);
105
+ return filter ? /*#__PURE__*/React__default.createElement(Button, _extends({
106
+ key: key,
107
+ onClick: () => handleButtonClick(filter.value),
108
+ color: "default",
109
+ active: filter.selected,
110
+ appearance: "minimal"
111
+ }, buttonProps), label) : null;
112
+ }), /*#__PURE__*/React__default.createElement(DatePickerInput.WithRange, _extends({
113
+ value: localValue,
114
+ format: format,
115
+ onChange: handleChange,
116
+ appearance: "minimal",
117
+ flexibility: "content-size",
118
+ className: "date-filter-input active"
119
+ }, pickerProps)));
120
+ }
121
+ DateFilter.propTypes = {
122
+ /**
123
+ * Specify the format of date
124
+ */
125
+ format: propTypesExports.string,
126
+ /**
127
+ * Fires when user attempts to change value
128
+ * (dates: Array) => void
129
+ */
130
+ onChange: propTypesExports.func,
131
+ /**
132
+ * Controls which filter buttons will be displayed based on filters object existing keys.
133
+ * For example if you define only `today` property on filters objects
134
+ * It will be display button with [today]'s property value
135
+ * Which will change Datefilter value to today.
136
+ * All filters will be displayed by default.
137
+ */
138
+ filters: propTypesExports.exact({
139
+ today: propTypesExports.string,
140
+ yesterday: propTypesExports.string,
141
+ thisWeek: propTypesExports.string,
142
+ lastWeek: propTypesExports.string,
143
+ thisMonth: propTypesExports.string,
144
+ lastMonth: propTypesExports.string,
145
+ LMTD: propTypesExports.string
146
+ }),
147
+ /**
148
+ * Current value. Creates a controlled component.
149
+ */
150
+ value: propTypesExports.oneOfType([propTypesExports.arrayOf(propTypesExports.instanceOf(dayjsWithPlugins)), propTypesExports.arrayOf(propTypesExports.instanceOf(Date)), propTypesExports.arrayOf(propTypesExports.string), propTypesExports.arrayOf(propTypesExports.number)]),
151
+ /**
152
+ * Additional classname which applies to datefilter holder div element
153
+ */
154
+ className: propTypesExports.string,
155
+ /**
156
+ * Accepts same props as button component (atoms)
157
+ */
158
+ buttonProps: propTypesExports.object,
159
+ /**
160
+ * This props will pass to picker, check DatePicker prop types
161
+ */
162
+ pickerProps: propTypesExports.object
163
+ };
164
+ DateFilter.defaultProps = {
165
+ value: [],
166
+ format: getBrowserDateFormat(),
167
+ onChange: noop,
168
+ filters: {
169
+ today: 'Today',
170
+ yesterday: 'Yesterday',
171
+ thisWeek: 'This Week',
172
+ lastWeek: 'Last Week',
173
+ thisMonth: 'This Month',
174
+ lastMonth: 'Last Month',
175
+ LMTD: 'LMTD'
176
+ }
177
+ };
178
+
179
+ export { DateFilter as default };