@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.
- package/ActionableList.js +1761 -0
- package/AdvancedSearch.js +872 -0
- package/Alert.js +98 -0
- package/Avatar.js +77 -0
- package/Badge.js +76 -0
- package/Breadcrumb.js +128 -0
- package/BusyLoader.js +69 -0
- package/Button.js +130 -0
- package/CHANGELOG.md +424 -0
- package/Card.js +513 -0
- package/CardList.js +705 -0
- package/CellMeasurerCache-c11cec83.js +229 -0
- package/Charts.js +99 -0
- package/Checkbox.js +232 -0
- package/CheckboxGroup.js +206 -0
- package/CheckboxGroupWithSearch.js +279 -0
- package/Collapse.js +196 -0
- package/ColorPicker.js +210 -0
- package/ComboBox.js +99 -0
- package/Counter.js +99 -0
- package/DateFilter.js +179 -0
- package/DatePicker.js +1231 -0
- package/DatePickerInput.js +30 -0
- package/Divider.js +56 -0
- package/Drawer.js +264 -0
- package/Dropdown.js +99 -0
- package/Editor.js +22965 -0
- package/Empty.js +132 -0
- package/ExtendedInput.js +578 -0
- package/Form.js +116 -0
- package/FormContainer.js +189 -0
- package/FormableCheckbox.js +27 -0
- package/FormableDatePicker.js +39 -0
- package/FormableDropdown.js +105 -0
- package/FormableEditor.js +24 -0
- package/FormableHOC-21051057.js +83 -0
- package/FormableMultiSelectDropdown.js +105 -0
- package/FormableNumberInput.js +31 -0
- package/FormableRadio.js +23 -0
- package/FormableSwitcher.js +23 -0
- package/FormableTextInput.js +31 -0
- package/FormableUploader.js +40 -0
- package/GeneUIProvider.js +256 -0
- package/Grid.js +166 -0
- package/Holder.js +99 -0
- package/Icon.js +63 -0
- package/Image.js +130 -0
- package/ImagePreview.js +99 -0
- package/KeyValue.js +63 -0
- package/Label.js +58 -0
- package/LinkButton.js +104 -0
- package/Menu.js +277 -0
- package/MobileNavigation.js +95 -0
- package/MobilePopup.js +180 -0
- package/Modal.js +251 -0
- package/ModuleTitle.js +99 -0
- package/NavigationMenu.js +212 -0
- package/Notification.js +120 -0
- package/Option.js +186 -0
- package/Overlay.js +99 -0
- package/Overspread.js +343 -0
- package/Pagination.js +258 -0
- package/Paper.js +97 -0
- package/Popover-f4d1cac0.js +411 -0
- package/Popover.js +20 -0
- package/PopoverV2.js +19 -0
- package/Portal.js +58 -0
- package/Products.js +115 -0
- package/Profile.js +99 -0
- package/Progress.js +200 -0
- package/QRCode.js +816 -0
- package/README.md +90 -0
- package/Radio.js +152 -0
- package/RadioGroup.js +105 -0
- package/Range.js +14 -0
- package/RichEditor-b7928765.js +228 -0
- package/RichEditor.js +13 -0
- package/Scrollbar.js +1587 -0
- package/Search.js +72 -0
- package/SearchWithDropdown.js +195 -0
- package/Section.js +62 -0
- package/SkeletonLoader.js +82 -0
- package/Slider.js +256 -0
- package/Status.js +104 -0
- package/Steps.js +312 -0
- package/SuggestionList.js +15 -0
- package/Switcher.js +194 -0
- package/Table.js +102 -0
- package/TableCompositions.js +17028 -0
- package/Tabs.js +236 -0
- package/Tag.js +103 -0
- package/TextLink.js +22 -0
- package/Textarea.js +239 -0
- package/Time.js +63 -0
- package/TimePicker.js +99 -0
- package/Timeline.js +114 -0
- package/Title.js +66 -0
- package/Toaster.js +116 -0
- package/Tooltip.js +157 -0
- package/TransferList.js +502 -0
- package/Uploader.js +32 -0
- package/ValidatableCheckbox.js +126 -0
- package/ValidatableDatePicker.js +312 -0
- package/ValidatableDropdown.js +99 -0
- package/ValidatableElements.js +99 -0
- package/ValidatableMultiSelectDropdown.js +99 -0
- package/ValidatableNumberInput.js +194 -0
- package/ValidatableRadio.js +117 -0
- package/ValidatableSwitcher.js +94 -0
- package/ValidatableTextInput.js +164 -0
- package/ValidatableTimeInput.js +171 -0
- package/ValidatableUploader.js +94 -0
- package/Widget.js +99 -0
- package/_commonjsHelpers-24198af3.js +35 -0
- package/_rollupPluginBabelHelpers-e8fb2e5c.js +16 -0
- package/checkTimeValidation-e56771be.js +16 -0
- package/checkboxRadioSwitcher-5b69d7bd.js +4 -0
- package/clsx.m-2bb6df4b.js +3 -0
- package/configs-91c86664.js +96 -0
- package/configs.js +131 -0
- package/dateValidation-67caec66.js +225 -0
- package/debounce-4419bc2f.js +17 -0
- package/globalStyling-9c60a159.js +4 -0
- package/guid-8ddf77b3.js +16 -0
- package/index-00fe8887.js +193 -0
- package/index-0cf65939.js +30991 -0
- package/index-122432cd.js +270 -0
- package/index-262edd7a.js +77 -0
- package/index-5cea9a7d.js +407 -0
- package/index-5e722d91.js +867 -0
- package/index-67f4d4d1.js +6568 -0
- package/index-6ff23041.js +66 -0
- package/index-702bf24a.js +1938 -0
- package/index-a4635754.js +329 -0
- package/index-a59530cd.js +4 -0
- package/index-ac59cb10.js +169 -0
- package/index-b7a33c58.js +11 -0
- package/index-d9e8a888.js +987 -0
- package/index-e0af0caf.js +1182 -0
- package/index-e8776f3d.js +807 -0
- package/index.js +128 -0
- package/localization-4ba17032.js +46 -0
- package/objectWithoutPropertiesLoose-299691d8.js +78 -0
- package/package.json +190 -0
- package/rangeAndSlider-20599da4.js +8839 -0
- package/react-beautiful-dnd.esm-38c37304.js +10117 -0
- package/style-inject.es-746bb8ed.js +28 -0
- package/useClickOutside-5183e396.js +25 -0
- package/useDeviceType-dd51db38.js +15 -0
- package/useEllipsisDetection-ef536015.js +23 -0
- package/useKeyDown-38102ae7.js +21 -0
- package/useMount-6fef51a5.js +9 -0
- package/useWidth-9f4647f8.js +15 -0
- package/useWindowSize-80369d76.js +33 -0
package/configs.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// update mechanism for this section is under consideration
|
|
2
|
+
|
|
3
|
+
const clientConfigs = {};
|
|
4
|
+
const updateConfig = configs => {
|
|
5
|
+
for (const key in configs) {
|
|
6
|
+
clientConfigs[key] = configs[key];
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
const breakPoints = {
|
|
10
|
+
// screens
|
|
11
|
+
xs: 576,
|
|
12
|
+
md: 768,
|
|
13
|
+
lg: 1024,
|
|
14
|
+
xl: 1200,
|
|
15
|
+
xxl: 1600
|
|
16
|
+
};
|
|
17
|
+
const mobileScreenSize = Number(process.env.REACT_APP_MOBILE_SIZE) || breakPoints.lg;
|
|
18
|
+
const screenTypes = ['desktop', 'mobile'];
|
|
19
|
+
const colors = ['primary', 'confirm', 'danger'];
|
|
20
|
+
const sizes = ['small', 'medium', 'big'];
|
|
21
|
+
const positions = ['top', 'right', 'bottom', 'left'];
|
|
22
|
+
const radius = ['default-radius', 'full-radius'];
|
|
23
|
+
const inputConfig = {
|
|
24
|
+
type: ['text', 'color', 'number', 'password', 'textarea', 'date', 'time', 'datetime-local'],
|
|
25
|
+
appearance: ['outline', 'minimal', 'light'],
|
|
26
|
+
size: ['small', 'default', 'big'],
|
|
27
|
+
flexibility: ['full-width', 'content-size'],
|
|
28
|
+
itemsDirection: ['start', 'end'],
|
|
29
|
+
cornerRadius: ['full-radius', 'smooth-radius'],
|
|
30
|
+
labelAppearance: ['none', 'title', 'swap']
|
|
31
|
+
};
|
|
32
|
+
const titleConfig = {
|
|
33
|
+
color: ['base', 'hero']
|
|
34
|
+
};
|
|
35
|
+
const checkboxRadioSwitcherConfig = {
|
|
36
|
+
size: ['small', 'big'],
|
|
37
|
+
labelPosition: ['right', 'left', 'top', 'bottom'],
|
|
38
|
+
labelAlignment: ['start', 'center', 'end']
|
|
39
|
+
};
|
|
40
|
+
const tagConfig = {
|
|
41
|
+
appearance: ['simple', 'minimal', 'outline', 'clean', 'light', 'colored'],
|
|
42
|
+
size: ['small', 'medium', 'big'],
|
|
43
|
+
flexibility: ['content-size', 'compact', 'full-width'],
|
|
44
|
+
cornerRadius: ['full-radius', 'smooth-radius']
|
|
45
|
+
};
|
|
46
|
+
const stepsConfig = {
|
|
47
|
+
size: ['small', 'big'],
|
|
48
|
+
direction: ['horizontal', 'vertical'],
|
|
49
|
+
appearance: ['steps', 'dots'],
|
|
50
|
+
status: ['initial', 'current', 'success', 'fail', 'activated']
|
|
51
|
+
};
|
|
52
|
+
const popoverConfig = {
|
|
53
|
+
align: ['start', 'end', 'center'],
|
|
54
|
+
position: ['bottom', 'top', 'left', 'right'],
|
|
55
|
+
cornerRadius: ['full-radius', 'smooth-radius'],
|
|
56
|
+
behave: ['toggle', 'open']
|
|
57
|
+
};
|
|
58
|
+
const popoverV2Config = {
|
|
59
|
+
onOpenClassName: 'has-popover-opened',
|
|
60
|
+
align: ['start', 'end', 'center'],
|
|
61
|
+
position: ['bottom', 'top', 'left', 'right'],
|
|
62
|
+
cornerRadius: ['full-radius', 'smooth-radius'],
|
|
63
|
+
behave: ['toggle', 'open']
|
|
64
|
+
};
|
|
65
|
+
const uploaderConfig = {
|
|
66
|
+
uploaderAppearance: ['button', 'input', 'cloud', 'box'],
|
|
67
|
+
uploadedItemsAppearance: ['light', 'minimal', 'detailed', 'box'],
|
|
68
|
+
uploadedFilessAppearance: ['light', 'minimal'],
|
|
69
|
+
gridColumnSize: {
|
|
70
|
+
xs: 1,
|
|
71
|
+
md: 2,
|
|
72
|
+
lg: 4,
|
|
73
|
+
xl: 5,
|
|
74
|
+
xxl: 6
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const moduleTitleConfig = {
|
|
78
|
+
cornerRadius: ['position-radius', 'no-radius', 'full-radius'],
|
|
79
|
+
position: ['top', 'bottom'],
|
|
80
|
+
size: ['small', 'medium', 'big', 'extra-big']
|
|
81
|
+
};
|
|
82
|
+
const widgetConfig = {
|
|
83
|
+
type: ['default', 'compact', 'minimal', 'colorful'],
|
|
84
|
+
size: ['small', 'medium', 'big'],
|
|
85
|
+
comparisonStatus: ['initial', 'up', 'down']
|
|
86
|
+
};
|
|
87
|
+
const customScrollbarConfig = {
|
|
88
|
+
size: ['medium', 'small']
|
|
89
|
+
};
|
|
90
|
+
const noDataConfig = ['data', 'image', 'search'];
|
|
91
|
+
const timePickerConfig = {
|
|
92
|
+
appearance: ['multipleInputs', 'singleInput']
|
|
93
|
+
};
|
|
94
|
+
const optionConfig = {
|
|
95
|
+
color: ['default', 'hero'],
|
|
96
|
+
border: ['none', 'top', 'bottom'],
|
|
97
|
+
sticky: ['none', 'top', 'bottom'],
|
|
98
|
+
titlePosition: {
|
|
99
|
+
start: 'start',
|
|
100
|
+
center: 'center',
|
|
101
|
+
end: 'end'
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const keyValueConfig = {
|
|
105
|
+
appearance: {
|
|
106
|
+
horizontal: {
|
|
107
|
+
_key: 'horizontal',
|
|
108
|
+
parentItemClassName: 'geneKeyValue--horizontal',
|
|
109
|
+
labelClassName: 'geneKeyValue__label--horizontal',
|
|
110
|
+
valueClassName: 'geneKeyValue__value--horizontal',
|
|
111
|
+
iconClassName: 'geneKeyValue__icon--horizontal'
|
|
112
|
+
},
|
|
113
|
+
vertical: {
|
|
114
|
+
_key: 'vertical',
|
|
115
|
+
parentItemClassName: '',
|
|
116
|
+
itemClassName: ''
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const advancedSearchConfig = {
|
|
121
|
+
positions: {
|
|
122
|
+
right: 'right',
|
|
123
|
+
left: 'left'
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const badgeConfig = {
|
|
127
|
+
color: ['danger', 'primary'],
|
|
128
|
+
size: ['default', 'medium', 'big', 'huge']
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export { advancedSearchConfig, badgeConfig, breakPoints, checkboxRadioSwitcherConfig, clientConfigs, colors, customScrollbarConfig, inputConfig, keyValueConfig, mobileScreenSize, moduleTitleConfig, noDataConfig, optionConfig, popoverConfig, popoverV2Config, positions, radius, screenTypes, sizes, stepsConfig, tagConfig, timePickerConfig, titleConfig, updateConfig, uploaderConfig, widgetConfig };
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { c as commonjsGlobal } from './_commonjsHelpers-24198af3.js';
|
|
2
|
+
|
|
3
|
+
var dayjs_minExports = {};
|
|
4
|
+
var dayjs_min = {
|
|
5
|
+
get exports(){ return dayjs_minExports; },
|
|
6
|
+
set exports(v){ dayjs_minExports = v; },
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
(function (module, exports) {
|
|
10
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
11
|
+
} (dayjs_min));
|
|
12
|
+
|
|
13
|
+
var dayjs = dayjs_minExports;
|
|
14
|
+
|
|
15
|
+
var customParseFormatExports = {};
|
|
16
|
+
var customParseFormat$1 = {
|
|
17
|
+
get exports(){ return customParseFormatExports; },
|
|
18
|
+
set exports(v){ customParseFormatExports = v; },
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
(function (module, exports) {
|
|
22
|
+
!function(e,t){module.exports=t();}(commonjsGlobal,(function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,o={},s=function(e){return (e=+e)+(e>68?1900:2e3)};var a=function(e){return function(t){this[e]=+t;}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e);}],h=function(e){var t=o[e];return t&&(t.indexOf?t:t.s.concat(t.f))},u=function(e,t){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},d={A:[i,function(e){this.afternoon=u(e,!1);}],a:[i,function(e){this.afternoon=u(e,!0);}],S:[/\d/,function(e){this.milliseconds=100*+e;}],SS:[n,function(e){this.milliseconds=10*+e;}],SSS:[/\d{3}/,function(e){this.milliseconds=+e;}],s:[r,a("seconds")],ss:[r,a("seconds")],m:[r,a("minutes")],mm:[r,a("minutes")],H:[r,a("hours")],h:[r,a("hours")],HH:[r,a("hours")],hh:[r,a("hours")],D:[r,a("day")],DD:[n,a("day")],Do:[i,function(e){var t=o.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r);}],M:[r,a("month")],MM:[n,a("month")],MMM:[i,function(e){var t=h("months"),n=(h("monthsShort")||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[i,function(e){var t=h("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t;}],Y:[/[+-]?\d+/,a("year")],YY:[n,function(e){this.year=s(e);}],YYYY:[/\d{4}/,a("year")],Z:f,ZZ:f};function c(n){var r,i;r=n,i=o&&o.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var o=r&&r.toUpperCase();return n||i[r]||e[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),a=s.length,f=0;f<a;f+=1){var h=s[f],u=d[h],c=u&&u[0],l=u&&u[1];s[f]=l?{regex:c,parser:l}:h.replace(/^\[|\]$/g,"");}return function(e){for(var t={},n=0,r=0;n<a;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else {var o=i.regex,f=i.parser,h=e.slice(r),u=o.exec(h)[0];f.call(t,u),e=e.replace(u,"");}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon;}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(s=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,s=e.args;this.$u=r;var a=s[1];if("string"==typeof a){var f=!0===s[2],h=!0===s[3],u=f||h,d=s[2];h&&(d=s[2]),o=this.$locale(),!f&&d&&(o=n.Ls[d]),this.$d=function(e,t,n){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var r=c(t)(e),i=r.year,o=r.month,s=r.day,a=r.hours,f=r.minutes,h=r.seconds,u=r.milliseconds,d=r.zone,l=new Date,m=s||(i||o?1:l.getDate()),M=i||l.getFullYear(),Y=0;i&&!o||(Y=o>0?o-1:l.getMonth());var p=a||0,v=f||0,D=h||0,g=u||0;return d?new Date(Date.UTC(M,Y,m,p,v,D,g+60*d.offset*1e3)):n?new Date(Date.UTC(M,Y,m,p,v,D,g)):new Date(M,Y,m,p,v,D,g)}catch(e){return new Date("")}}(t,a,r),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(a)&&(this.$d=new Date("")),o={};}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){s[1]=a[m-1];var M=n.apply(this,s);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===l&&(this.$d=new Date(""));}else i.call(this,e);};}}));
|
|
23
|
+
} (customParseFormat$1));
|
|
24
|
+
|
|
25
|
+
var customParseFormat = customParseFormatExports;
|
|
26
|
+
|
|
27
|
+
var isSameOrBeforeExports = {};
|
|
28
|
+
var isSameOrBefore$1 = {
|
|
29
|
+
get exports(){ return isSameOrBeforeExports; },
|
|
30
|
+
set exports(v){ isSameOrBeforeExports = v; },
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
(function (module, exports) {
|
|
34
|
+
!function(e,i){module.exports=i();}(commonjsGlobal,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
|
|
35
|
+
} (isSameOrBefore$1));
|
|
36
|
+
|
|
37
|
+
var isSameOrBefore = isSameOrBeforeExports;
|
|
38
|
+
|
|
39
|
+
var isSameOrAfterExports = {};
|
|
40
|
+
var isSameOrAfter$1 = {
|
|
41
|
+
get exports(){ return isSameOrAfterExports; },
|
|
42
|
+
set exports(v){ isSameOrAfterExports = v; },
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
(function (module, exports) {
|
|
46
|
+
!function(e,t){module.exports=t();}(commonjsGlobal,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
|
|
47
|
+
} (isSameOrAfter$1));
|
|
48
|
+
|
|
49
|
+
var isSameOrAfter = isSameOrAfterExports;
|
|
50
|
+
|
|
51
|
+
var isLeapYearExports = {};
|
|
52
|
+
var isLeapYear$1 = {
|
|
53
|
+
get exports(){ return isLeapYearExports; },
|
|
54
|
+
set exports(v){ isLeapYearExports = v; },
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
(function (module, exports) {
|
|
58
|
+
!function(e,t){module.exports=t();}(commonjsGlobal,(function(){return function(e,t){t.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0};}}));
|
|
59
|
+
} (isLeapYear$1));
|
|
60
|
+
|
|
61
|
+
var isLeapYear = isLeapYearExports;
|
|
62
|
+
|
|
63
|
+
var isBetweenExports = {};
|
|
64
|
+
var isBetween$1 = {
|
|
65
|
+
get exports(){ return isBetweenExports; },
|
|
66
|
+
set exports(v){ isBetweenExports = v; },
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
(function (module, exports) {
|
|
70
|
+
!function(e,i){module.exports=i();}(commonjsGlobal,(function(){return function(e,i,t){i.prototype.isBetween=function(e,i,s,f){var n=t(e),o=t(i),r="("===(f=f||"()")[0],u=")"===f[1];return (r?this.isAfter(n,s):!this.isBefore(n,s))&&(u?this.isBefore(o,s):!this.isAfter(o,s))||(r?this.isBefore(n,s):!this.isAfter(n,s))&&(u?this.isAfter(o,s):!this.isBefore(o,s))};}}));
|
|
71
|
+
} (isBetween$1));
|
|
72
|
+
|
|
73
|
+
var isBetween = isBetweenExports;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Setup dayjs plugin.
|
|
77
|
+
*/
|
|
78
|
+
dayjs.extend(customParseFormat);
|
|
79
|
+
dayjs.extend(isSameOrBefore);
|
|
80
|
+
dayjs.extend(isSameOrAfter);
|
|
81
|
+
dayjs.extend(isLeapYear);
|
|
82
|
+
dayjs.extend(isBetween);
|
|
83
|
+
const dayjsWithPlugins = dayjs;
|
|
84
|
+
|
|
85
|
+
const lettersRegex = /[a-zA-Z]/;
|
|
86
|
+
const nonLettersRegex = /[\W_]+/g;
|
|
87
|
+
const monthLengths = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
88
|
+
const longMonthNames = dayjsWithPlugins.Ls.en.months;
|
|
89
|
+
const shortMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
90
|
+
const yearFormats = ['YY', 'YYYY'];
|
|
91
|
+
const monthFormats = ['M', 'MM', 'MMM', 'MMMM'];
|
|
92
|
+
const dayFormats = ['D', 'DD'];
|
|
93
|
+
const getFormatSeparator = format => format[format.search(nonLettersRegex)];
|
|
94
|
+
function capitalizeFirstLetter(value) {
|
|
95
|
+
const lowerCaseValue = value.toLowerCase();
|
|
96
|
+
const match = lowerCaseValue.match(lettersRegex);
|
|
97
|
+
return match ? lowerCaseValue.replace(match[0], match[0].toUpperCase()) : lowerCaseValue;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/*
|
|
101
|
+
* Splitting date to { format, value } object
|
|
102
|
+
* For checking is value fit format
|
|
103
|
+
* Formats are taken from day.js date formats list
|
|
104
|
+
* */
|
|
105
|
+
function splitDateToObjects(dateParts, formatParts) {
|
|
106
|
+
const day = {};
|
|
107
|
+
const month = {};
|
|
108
|
+
const year = {};
|
|
109
|
+
formatParts.forEach((item, index) => {
|
|
110
|
+
if (dayFormats.includes(item)) {
|
|
111
|
+
day.value = dateParts[index];
|
|
112
|
+
day.format = item;
|
|
113
|
+
} else if (monthFormats.includes(item)) {
|
|
114
|
+
month.value = dateParts[index];
|
|
115
|
+
month.format = item;
|
|
116
|
+
} else if (yearFormats.includes(item)) {
|
|
117
|
+
year.value = dateParts[index];
|
|
118
|
+
year.format = item;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
day,
|
|
123
|
+
month,
|
|
124
|
+
year
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function checkDateValidation(_ref) {
|
|
128
|
+
let {
|
|
129
|
+
day,
|
|
130
|
+
month,
|
|
131
|
+
year
|
|
132
|
+
} = _ref;
|
|
133
|
+
if (isNaN(Number(year.value))) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
if (dayjsWithPlugins(year.value).isLeapYear()) {
|
|
137
|
+
monthLengths[1] = 29;
|
|
138
|
+
}
|
|
139
|
+
const currentMonth = !isNaN(Number(month.value)) ? month.value - 1 : month.format === 'MMM' ? shortMonthNames.indexOf(month.value) : longMonthNames.indexOf(month.value);
|
|
140
|
+
return day.value > 0 && day.value <= monthLengths[currentMonth];
|
|
141
|
+
}
|
|
142
|
+
function validateDateField() {
|
|
143
|
+
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
144
|
+
let required = arguments.length > 1 ? arguments[1] : undefined;
|
|
145
|
+
let isValid = arguments.length > 2 ? arguments[2] : undefined;
|
|
146
|
+
let min = arguments.length > 3 ? arguments[3] : undefined;
|
|
147
|
+
let max = arguments.length > 4 ? arguments[4] : undefined;
|
|
148
|
+
let format = arguments.length > 5 ? arguments[5] : undefined;
|
|
149
|
+
// Need to capitalize first letter of month,
|
|
150
|
+
// because day.js want month name with that format
|
|
151
|
+
const dateString = typeof value === 'string' ? value : dayjsWithPlugins(value).format(format);
|
|
152
|
+
const capitalizedValue = capitalizeFirstLetter(dateString);
|
|
153
|
+
const date = dayjsWithPlugins(capitalizedValue, format);
|
|
154
|
+
const dateWithoutTime = capitalizedValue.split(' ')[0];
|
|
155
|
+
const dateFormat = format.split(' ')[0];
|
|
156
|
+
const separator = getFormatSeparator(dateFormat);
|
|
157
|
+
const dateParts = dateWithoutTime.split(separator);
|
|
158
|
+
const formatParts = dateFormat.split(separator);
|
|
159
|
+
const dateObject = splitDateToObjects(dateParts, formatParts);
|
|
160
|
+
const isInvalidFormat = !dayjsWithPlugins(dateWithoutTime, dateFormat).isValid();
|
|
161
|
+
const isInvalidDate = !checkDateValidation(dateObject);
|
|
162
|
+
const isBefore = !max || date.isBefore(dayjsWithPlugins(capitalizeFirstLetter(max), format));
|
|
163
|
+
const isAfter = !min || date.isAfter(dayjsWithPlugins(capitalizeFirstLetter(min), format));
|
|
164
|
+
|
|
165
|
+
// TODO ::: fix for null case
|
|
166
|
+
// should be valid if value=null and required=false
|
|
167
|
+
if (!capitalizedValue.length) {
|
|
168
|
+
return required ? {
|
|
169
|
+
key: 'required',
|
|
170
|
+
isValid: false
|
|
171
|
+
} : {
|
|
172
|
+
key: null,
|
|
173
|
+
isValid: true
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
if (isInvalidFormat) return {
|
|
177
|
+
key: 'isValidFormat',
|
|
178
|
+
isValid: false
|
|
179
|
+
};
|
|
180
|
+
if (isInvalidDate) return {
|
|
181
|
+
key: 'isValidDate',
|
|
182
|
+
isValid: false
|
|
183
|
+
};
|
|
184
|
+
if (!isBefore) return {
|
|
185
|
+
key: 'isBefore',
|
|
186
|
+
isValid: false
|
|
187
|
+
};
|
|
188
|
+
if (!isAfter) return {
|
|
189
|
+
key: 'isAfter',
|
|
190
|
+
isValid: false
|
|
191
|
+
};
|
|
192
|
+
if (!isValid) return {
|
|
193
|
+
key: 'customValidation',
|
|
194
|
+
isValid: false
|
|
195
|
+
};
|
|
196
|
+
return {
|
|
197
|
+
key: null,
|
|
198
|
+
isValid: true
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// TODO ::: rename 'receivedValue' and fix
|
|
203
|
+
function validateDatePickerField(receivedValue, required, isValid, min, max, format) {
|
|
204
|
+
const value = receivedValue || '';
|
|
205
|
+
if (!Array.isArray(value)) {
|
|
206
|
+
return validateDateField(value, required, isValid, min, max, format);
|
|
207
|
+
}
|
|
208
|
+
const [start, end] = value;
|
|
209
|
+
const startDateValidation = validateDateField(start || '', required, isValid, min, max, format);
|
|
210
|
+
const endDateValidation = validateDateField(end || '', required, isValid, min, max, format);
|
|
211
|
+
const startFormatted = dayjsWithPlugins(start);
|
|
212
|
+
const isRangeInvalid = dayjsWithPlugins(startFormatted, format).isAfter(dayjsWithPlugins(end, format));
|
|
213
|
+
if (!startDateValidation.isValid) return startDateValidation;
|
|
214
|
+
if (!endDateValidation.isValid) return endDateValidation;
|
|
215
|
+
if (isRangeInvalid) return {
|
|
216
|
+
key: 'isValidRange',
|
|
217
|
+
isValid: false
|
|
218
|
+
};
|
|
219
|
+
return {
|
|
220
|
+
key: null,
|
|
221
|
+
isValid: true
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export { dayjs as a, dayjsWithPlugins as d, isBetween as i, validateDatePickerField as v };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function debounce(callback, wait, immediate) {
|
|
2
|
+
let timeout;
|
|
3
|
+
return function func() {
|
|
4
|
+
const context = this;
|
|
5
|
+
const args = arguments;
|
|
6
|
+
const later = function () {
|
|
7
|
+
timeout = null;
|
|
8
|
+
if (!immediate) callback.apply(context, args);
|
|
9
|
+
};
|
|
10
|
+
const callNow = immediate && !timeout;
|
|
11
|
+
clearTimeout(timeout);
|
|
12
|
+
timeout = setTimeout(later, wait);
|
|
13
|
+
if (callNow) callback.apply(context, args);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { debounce as d };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { s as styleInject } from './style-inject.es-746bb8ed.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = "@import \"https://fonts.googleapis.com/css?family=Open+Sans:400,600,700&display=swap\";:root{--font-family:\"Open Sans\",\"Arial\",\"Helvetica Neue\",sans-serif;--hero:#1473e6;--confirm:#2bc784;--warning:#e6af57;--danger:#e64e48;--note:#fdc625;--message:#8bd779;--background:#fff;--foreground:#3d3d5f;--hero-hover:#1267cf;--hero-sc:#fff;--hero-rgb:20,115,230;--hero-sc-rgb:255,255,255;--confirm-hover:#26b276;--confirm-sc:#fff;--confirm-rgb:43,199,132;--confirm-sc-rgb:255,255,255;--warning-hover:#e3a441;--warning-sc:#fff;--warning-rgb:230,175,87;--warning-sc-rgb:255,255,255;--danger-hover:#e33832;--danger-sc:#fff;--danger-rgb:230,78,72;--danger-sc-rgb:255,255,255;--note-hover:#fdbf0c;--note-sc:#000;--note-rgb:253,198,37;--note-sc-rgb:0,0,0;--message-hover:#7ad165;--message-sc:#000;--message-rgb:139,215,121;--message-sc-rgb:0,0,0;--background-hover:#f2f2f2;--background-sc:#000;--background-rgb:255,255,255;--background-sc-rgb:0,0,0;--foreground-hover:#33334f;--foreground-sc:#fff;--foreground-rgb:61,61,95;--foreground-sc-rgb:255,255,255}.invert-colors{--background:var(--foreground);--background-hover:var(--foreground-hover);--background-sc:var(--foreground-sc);--background-rgb:var(--foreground-rgb);--background-sc-rgb:var(--foreground-sc-rgb)}*{-webkit-font-smoothing:subpixel-antialiased;-webkit-tap-highlight-color:transparent;background:none;border:0;border-radius:0;margin:0;outline:0;padding:0;vertical-align:top}*,:after,:before{box-sizing:border-box}@media screen and (min-width:1024px){:not(main)::-webkit-scrollbar{height:var(--scrollbar-size,16px);width:var(--scrollbar-size,16px)}:not(main)::-webkit-scrollbar-button,:not(main)::-webkit-scrollbar-corner{display:none}:not(main)::-webkit-scrollbar-thumb{background:rgba(var(--background-sc-rgb),.05) content-box;border:var(--scrollbar-space,4px) solid #0000;border-radius:var(--scrollbar-size,16px)}:not(main)::-webkit-scrollbar-thumb:active,:not(main)::-webkit-scrollbar-thumb:hover{background-color:rgba(var(--background-sc-rgb),.1)}:not(main)::-webkit-scrollbar-track{background:#0000}}a{color:inherit;text-decoration:none;transition:color .3s,background .3s}table{border-collapse:collapse;border-spacing:0;width:100%}img,svg{display:block;max-width:100%}button,input,optgroup,select,textarea{-webkit-appearance:none;appearance:none;color:inherit;display:block;font:inherit}button::input-placeholder,input::input-placeholder,optgroup::input-placeholder,select::input-placeholder,textarea::input-placeholder{font-family:inherit;opacity:1}button:placeholder,input:placeholder,optgroup:placeholder,select:placeholder,textarea:placeholder{font-family:inherit;opacity:1}button::placeholder,input::placeholder,optgroup::placeholder,select::placeholder,textarea::placeholder{font-family:inherit;opacity:1}button:input-placeholder,input:input-placeholder,optgroup:input-placeholder,select:input-placeholder,textarea:input-placeholder{font-family:inherit;opacity:1}html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;background:var(--page-background,#f0f2f5);color:rgba(var(--background-sc-rgb),.75);font:10px/1.15 var(--font-family);height:100%;max-width:100vw}html.view-small{font-size:8.12px}html.view-normal{font-size:9.12px}html #root,html body{width:100%}body{font-size:1.4rem}h1,h2,h3,h4,h5,h6{font-weight:600;line-height:normal}h1{font-size:3.2rem}h1.large{font-size:3.8rem}h2{font-size:2.8rem}h3{font-size:1.8rem}h4{font-size:1.6rem}h5{font-size:1.4rem}h6{font-size:1.2rem}li{display:block}.ellipsis-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.capitalize-text{text-transform:capitalize}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}input::-ms-clear{display:none}.pointer-events-none{pointer-events:none}.cursor-pointer,[data-react-beautiful-dnd-drag-handle=\"0\"]{cursor:pointer}.color-danger{color:var(--danger)!important}.color-confirm{color:var(--confirm)!important}.color-hero{color:var(--hero)!important}::selection{background:rgba(var(--hero-rgb),.15);color:var(--hero)}.vertical-resizing-cursor *{cursor:col-resize!important}.vertical-resizing-cursor :not(:active){pointer-events:none}.cursor-grab{cursor:grab}.cursor-grab:active{cursor:grabbing}.m-rl-2{margin:0 .2rem}.m-tb-2{margin:.2rem 0}.m-t-2{margin-top:.2rem}.m-r-2{margin-inline-end:.2rem}.m-l-2{margin-inline-start:.2rem}.m-b-2{margin-bottom:.2rem}.m-rl-4{margin:0 .4rem}.m-tb-4{margin:.4rem 0}.m-t-4{margin-top:.4rem}.m-r-4{margin-inline-end:.4rem}.m-l-4{margin-inline-start:.4rem}.m-b-4{margin-bottom:.4rem}.m-rl-6{margin:0 .6rem}.m-tb-6{margin:.6rem 0}.m-t-6{margin-top:.6rem}.m-r-6{margin-inline-end:.6rem}.m-l-6{margin-inline-start:.6rem}.m-b-6{margin-bottom:.6rem}.m-rl-8{margin:0 .8rem}.m-tb-8{margin:.8rem 0}.m-t-8{margin-top:.8rem}.m-r-8{margin-inline-end:.8rem}.m-l-8{margin-inline-start:.8rem}.m-b-8{margin-bottom:.8rem}.m-rl-10{margin:0 1rem}.m-tb-10{margin:1rem 0}.m-t-10{margin-top:1rem}.m-r-10{margin-inline-end:1rem}.m-l-10{margin-inline-start:1rem}.m-b-10{margin-bottom:1rem}.m-rl-12{margin:0 1.2rem}.m-tb-12{margin:1.2rem 0}.m-t-12{margin-top:1.2rem}.m-r-12{margin-inline-end:1.2rem}.m-l-12{margin-inline-start:1.2rem}.m-b-12{margin-bottom:1.2rem}.m-rl-14{margin:0 1.4rem}.m-tb-14{margin:1.4rem 0}.m-t-14{margin-top:1.4rem}.m-r-14{margin-inline-end:1.4rem}.m-l-14{margin-inline-start:1.4rem}.m-b-14{margin-bottom:1.4rem}.m-rl-16{margin:0 1.6rem}.m-tb-16{margin:1.6rem 0}.m-t-16{margin-top:1.6rem}.m-r-16{margin-inline-end:1.6rem}.m-l-16{margin-inline-start:1.6rem}.m-b-16{margin-bottom:1.6rem}.m-rl-18{margin:0 1.8rem}.m-tb-18{margin:1.8rem 0}.m-t-18{margin-top:1.8rem}.m-r-18{margin-inline-end:1.8rem}.m-l-18{margin-inline-start:1.8rem}.m-b-18{margin-bottom:1.8rem}.m-rl-20{margin:0 2rem}.m-tb-20{margin:2rem 0}.m-t-20{margin-top:2rem}.m-r-20{margin-inline-end:2rem}.m-l-20{margin-inline-start:2rem}.m-b-20{margin-bottom:2rem}.m-rl-22{margin:0 2.2rem}.m-tb-22{margin:2.2rem 0}.m-t-22{margin-top:2.2rem}.m-r-22{margin-inline-end:2.2rem}.m-l-22{margin-inline-start:2.2rem}.m-b-22{margin-bottom:2.2rem}.m-rl-24{margin:0 2.4rem}.m-tb-24{margin:2.4rem 0}.m-t-24{margin-top:2.4rem}.m-r-24{margin-inline-end:2.4rem}.m-l-24{margin-inline-start:2.4rem}.m-b-24{margin-bottom:2.4rem}.m-rl-26{margin:0 2.6rem}.m-tb-26{margin:2.6rem 0}.m-t-26{margin-top:2.6rem}.m-r-26{margin-inline-end:2.6rem}.m-l-26{margin-inline-start:2.6rem}.m-b-26{margin-bottom:2.6rem}.m-rl-28{margin:0 2.8rem}.m-tb-28{margin:2.8rem 0}.m-t-28{margin-top:2.8rem}.m-r-28{margin-inline-end:2.8rem}.m-l-28{margin-inline-start:2.8rem}.m-b-28{margin-bottom:2.8rem}.m-rl-30{margin:0 3rem}.m-tb-30{margin:3rem 0}.m-t-30{margin-top:3rem}.m-r-30{margin-inline-end:3rem}.m-l-30{margin-inline-start:3rem}.m-b-30{margin-bottom:3rem}.m-rl-32{margin:0 3.2rem}.m-tb-32{margin:3.2rem 0}.m-t-32{margin-top:3.2rem}.m-r-32{margin-inline-end:3.2rem}.m-l-32{margin-inline-start:3.2rem}.m-b-32{margin-bottom:3.2rem}.m-rl-34{margin:0 3.4rem}.m-tb-34{margin:3.4rem 0}.m-t-34{margin-top:3.4rem}.m-r-34{margin-inline-end:3.4rem}.m-l-34{margin-inline-start:3.4rem}.m-b-34{margin-bottom:3.4rem}.m-rl-36{margin:0 3.6rem}.m-tb-36{margin:3.6rem 0}.m-t-36{margin-top:3.6rem}.m-r-36{margin-inline-end:3.6rem}.m-l-36{margin-inline-start:3.6rem}.m-b-36{margin-bottom:3.6rem}.m-rl-38{margin:0 3.8rem}.m-tb-38{margin:3.8rem 0}.m-t-38{margin-top:3.8rem}.m-r-38{margin-inline-end:3.8rem}.m-l-38{margin-inline-start:3.8rem}.m-b-38{margin-bottom:3.8rem}.m-rl-40{margin:0 4rem}.m-tb-40{margin:4rem 0}.m-t-40{margin-top:4rem}.m-r-40{margin-inline-end:4rem}.m-l-40{margin-inline-start:4rem}.m-b-40{margin-bottom:4rem}.m-rl-42{margin:0 4.2rem}.m-tb-42{margin:4.2rem 0}.m-t-42{margin-top:4.2rem}.m-r-42{margin-inline-end:4.2rem}.m-l-42{margin-inline-start:4.2rem}.m-b-42{margin-bottom:4.2rem}.m-rl-44{margin:0 4.4rem}.m-tb-44{margin:4.4rem 0}.m-t-44{margin-top:4.4rem}.m-r-44{margin-inline-end:4.4rem}.m-l-44{margin-inline-start:4.4rem}.m-b-44{margin-bottom:4.4rem}.m-rl-46{margin:0 4.6rem}.m-tb-46{margin:4.6rem 0}.m-t-46{margin-top:4.6rem}.m-r-46{margin-inline-end:4.6rem}.m-l-46{margin-inline-start:4.6rem}.m-b-46{margin-bottom:4.6rem}";
|
|
4
|
+
styleInject(css_248z);
|
package/guid-8ddf77b3.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** UUID generator
|
|
2
|
+
* Function provides "unique" id.
|
|
3
|
+
* Must be used with React iterable components.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const hash = () => Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
|
|
7
|
+
|
|
8
|
+
/** @function guid
|
|
9
|
+
* @description
|
|
10
|
+
* The function generates uuid. It can be used as `key`-s needed for
|
|
11
|
+
* React iterated components
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const guid = () => "".concat(hash() + hash(), "-").concat(hash(), "-").concat(hash(), "-").concat(hash(), "-").concat(hash()).concat(hash()).concat(hash());
|
|
15
|
+
|
|
16
|
+
export { guid as g };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
|
|
2
|
+
import React__default, { useState, useCallback, useRef } from 'react';
|
|
3
|
+
import { p as propTypesExports } from './index-e0af0caf.js';
|
|
4
|
+
import { c as classnames } from './index-6ff23041.js';
|
|
5
|
+
import { c as createSliderWithTooltip, R as Range } from './rangeAndSlider-20599da4.js';
|
|
6
|
+
import { u as useWidth } from './useWidth-9f4647f8.js';
|
|
7
|
+
import './dateValidation-67caec66.js';
|
|
8
|
+
import 'react-dom';
|
|
9
|
+
import './configs-91c86664.js';
|
|
10
|
+
import './globalStyling-9c60a159.js';
|
|
11
|
+
|
|
12
|
+
function useToggle(defaultValue) {
|
|
13
|
+
const [state, setState] = useState(!!defaultValue);
|
|
14
|
+
const toggle = useCallback(value => {
|
|
15
|
+
setState(prev => typeof value === 'undefined' ? !prev : !!value);
|
|
16
|
+
}, []);
|
|
17
|
+
return [state, toggle];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function formatter(value, tooltipType) {
|
|
21
|
+
switch (tooltipType) {
|
|
22
|
+
case 'percentage':
|
|
23
|
+
return "".concat(value, "%");
|
|
24
|
+
case 'currency':
|
|
25
|
+
return "$".concat(value);
|
|
26
|
+
case 'pixel':
|
|
27
|
+
return "".concat(value, "px");
|
|
28
|
+
default:
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const rangeCircleTypes = ['c-type-1', 'c-type-2', 'c-type-3'];
|
|
33
|
+
const RangeWithTooltip = createSliderWithTooltip(Range);
|
|
34
|
+
const isMiddle = (value, max) => value > max / 3;
|
|
35
|
+
const isMax = (value, max) => value >= max * 2 / 3;
|
|
36
|
+
function RangeMolecule(props) {
|
|
37
|
+
const {
|
|
38
|
+
max,
|
|
39
|
+
min,
|
|
40
|
+
step,
|
|
41
|
+
value,
|
|
42
|
+
coloring,
|
|
43
|
+
disabled,
|
|
44
|
+
onChange,
|
|
45
|
+
circleTypes,
|
|
46
|
+
withTooltip,
|
|
47
|
+
defaultValue,
|
|
48
|
+
tooltipType,
|
|
49
|
+
isSmallHandler,
|
|
50
|
+
showCircleOnDrag,
|
|
51
|
+
className,
|
|
52
|
+
circleSizeBasedOnRange,
|
|
53
|
+
...restProps
|
|
54
|
+
} = props;
|
|
55
|
+
const isControlled = ('value' in props);
|
|
56
|
+
const [sliderValue, setSliderValue] = useState(defaultValue);
|
|
57
|
+
const [tooltipVisibility, toggleTooltipVisibility] = useToggle(false);
|
|
58
|
+
const localValue = isControlled ? value : sliderValue;
|
|
59
|
+
const isGradient = coloring === 'gradient-value';
|
|
60
|
+
const leftPercent = localValue[0] * 100 / (max - min);
|
|
61
|
+
const divRef = useRef();
|
|
62
|
+
const sliderWidth = useWidth(divRef);
|
|
63
|
+
const RangeElement = withTooltip ? RangeWithTooltip : Range;
|
|
64
|
+
const setCircleStyles = useCallback(i => {
|
|
65
|
+
const isMaxValue = isMax(localValue[i], max);
|
|
66
|
+
const isMiddleValue = isMiddle(localValue[i], max);
|
|
67
|
+
return classnames(circleTypes[i], {
|
|
68
|
+
'max-coloring': isGradient && isMaxValue,
|
|
69
|
+
'max-size': circleSizeBasedOnRange && isMaxValue,
|
|
70
|
+
'min-coloring': !isMiddleValue && !isMaxValue && isGradient,
|
|
71
|
+
'middle-coloring': isGradient && isMiddleValue && !isMaxValue,
|
|
72
|
+
'middle-size': circleSizeBasedOnRange && !isMaxValue && isMiddleValue
|
|
73
|
+
});
|
|
74
|
+
}, [localValue, max, circleTypes, isGradient, circleSizeBasedOnRange]);
|
|
75
|
+
const handleSliderChange = useCallback(val => {
|
|
76
|
+
if (val[1] <= max && val[0] >= min) {
|
|
77
|
+
!isControlled && setSliderValue(val);
|
|
78
|
+
onChange && onChange(val);
|
|
79
|
+
}
|
|
80
|
+
}, [max, min, isControlled, onChange]);
|
|
81
|
+
const tipFormatter = useCallback(value => formatter(value, tooltipType), [tooltipType]);
|
|
82
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
83
|
+
className: classnames('slider-holder ', className, coloring, {
|
|
84
|
+
disabled,
|
|
85
|
+
'show-on-drag': showCircleOnDrag
|
|
86
|
+
}),
|
|
87
|
+
onMouseEnter: toggleTooltipVisibility,
|
|
88
|
+
onMouseLeave: toggleTooltipVisibility
|
|
89
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
90
|
+
className: classnames('slider-comp', {
|
|
91
|
+
'size-small': isSmallHandler
|
|
92
|
+
}),
|
|
93
|
+
style: {
|
|
94
|
+
'--left': "-".concat(leftPercent, "%"),
|
|
95
|
+
'--sliderWidth': "".concat(sliderWidth, "px")
|
|
96
|
+
}
|
|
97
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
98
|
+
ref: divRef
|
|
99
|
+
}, /*#__PURE__*/React__default.createElement(RangeElement, _extends({
|
|
100
|
+
max: max,
|
|
101
|
+
min: min,
|
|
102
|
+
step: step,
|
|
103
|
+
value: localValue,
|
|
104
|
+
tipProps: {
|
|
105
|
+
prefixCls: 'tooltip-el',
|
|
106
|
+
visible: tooltipVisibility && localValue[1] - localValue[0] > max / 20
|
|
107
|
+
},
|
|
108
|
+
allowCross: false,
|
|
109
|
+
tipFormatter: tipFormatter,
|
|
110
|
+
onChange: handleSliderChange,
|
|
111
|
+
handleStyle: [{
|
|
112
|
+
content: "'".concat(setCircleStyles(0), "'")
|
|
113
|
+
}, {
|
|
114
|
+
content: "'".concat(setCircleStyles(1), "'")
|
|
115
|
+
}]
|
|
116
|
+
}, restProps)))));
|
|
117
|
+
}
|
|
118
|
+
RangeMolecule.propTypes = {
|
|
119
|
+
/**
|
|
120
|
+
* Controlled value.
|
|
121
|
+
*/
|
|
122
|
+
value: propTypesExports.array,
|
|
123
|
+
/**
|
|
124
|
+
* Disabled state.
|
|
125
|
+
*/
|
|
126
|
+
disabled: propTypesExports.bool,
|
|
127
|
+
/**
|
|
128
|
+
* External/Additional className that can be added to 'Range' component.
|
|
129
|
+
*/
|
|
130
|
+
className: propTypesExports.string,
|
|
131
|
+
/**
|
|
132
|
+
* Fires an event on ExtendedInput change((event: Event) => void).
|
|
133
|
+
*/
|
|
134
|
+
onChange: propTypesExports.func,
|
|
135
|
+
/**
|
|
136
|
+
* Show/Hide tooltips on 'Range'.
|
|
137
|
+
*/
|
|
138
|
+
withTooltip: propTypesExports.bool,
|
|
139
|
+
/**
|
|
140
|
+
* Switch on/off small size.
|
|
141
|
+
*/
|
|
142
|
+
isSmallHandler: propTypesExports.bool,
|
|
143
|
+
/**
|
|
144
|
+
* Initial value.
|
|
145
|
+
*/
|
|
146
|
+
defaultValue: propTypesExports.array,
|
|
147
|
+
/**
|
|
148
|
+
* Show/hide circles.
|
|
149
|
+
*/
|
|
150
|
+
showCircleOnDrag: propTypesExports.bool,
|
|
151
|
+
/**
|
|
152
|
+
* Max value.
|
|
153
|
+
*/
|
|
154
|
+
max: propTypesExports.number.isRequired,
|
|
155
|
+
/**
|
|
156
|
+
* Min value.
|
|
157
|
+
*/
|
|
158
|
+
min: propTypesExports.number.isRequired,
|
|
159
|
+
/**
|
|
160
|
+
* Skip steps count.
|
|
161
|
+
*/
|
|
162
|
+
step: propTypesExports.number.isRequired,
|
|
163
|
+
circleSizeBasedOnRange: propTypesExports.bool,
|
|
164
|
+
/**
|
|
165
|
+
* Various circle type.
|
|
166
|
+
*/
|
|
167
|
+
circleTypes: (props, propName, componentName) => {
|
|
168
|
+
const prop = props[propName];
|
|
169
|
+
const isCircleTypes = Array.isArray(prop) && prop.length === 2 && prop.every(item => rangeCircleTypes.includes(item));
|
|
170
|
+
if (!isCircleTypes) {
|
|
171
|
+
return new Error("Invalid prop ".concat(propName, " supplied to ").concat(componentName));
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
/**
|
|
175
|
+
* Various tooltip types.
|
|
176
|
+
*/
|
|
177
|
+
tooltipType: propTypesExports.oneOf(['default', 'percentage', 'currency', 'pixel']),
|
|
178
|
+
/**
|
|
179
|
+
* Various themes/colors for component.
|
|
180
|
+
*/
|
|
181
|
+
coloring: propTypesExports.oneOf(['primary', 'positive-value', 'negative-value', 'gradient-value'])
|
|
182
|
+
};
|
|
183
|
+
RangeMolecule.defaultProps = {
|
|
184
|
+
disabled: false,
|
|
185
|
+
isSmallHandler: true,
|
|
186
|
+
withTooltip: false,
|
|
187
|
+
coloring: 'primary',
|
|
188
|
+
tooltipType: 'default',
|
|
189
|
+
showCircleOnDrag: false,
|
|
190
|
+
circleSizeBasedOnRange: true
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export { RangeMolecule as R, useToggle as u };
|