@xola/ui-kit 3.6.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -19
- package/build/components/Alert.js +29 -0
- package/build/components/Animation/FadeIn.js +40 -0
- package/build/components/Animation/SlideDown.js +25 -0
- package/build/components/Avatar.js +28 -0
- package/build/components/Badge.js +51 -0
- package/build/components/BottomSheet.js +114 -0
- package/build/components/Breadcrumb.js +33 -0
- package/build/components/Breakdown.js +81 -0
- package/build/components/Buttons/Button.js +89 -0
- package/build/components/Buttons/ButtonGroup.js +58 -0
- package/build/components/Buttons/SecondaryButton.js +31 -0
- package/build/components/Buttons/SubmitButton.js +89 -0
- package/build/components/Buttons/ToggleButton.js +33 -0
- package/build/components/Charts/BaseChartOptions.js +95 -0
- package/build/components/Charts/HistogramOptions.js +69 -0
- package/build/components/Charts/PieOptions.js +55 -0
- package/build/components/Counter.js +20 -0
- package/build/components/DatePicker/DatePicker.helpers.js +33 -0
- package/build/components/DatePicker/DatePicker.js +214 -0
- package/build/components/DatePicker/DatePickerPopover.js +90 -0
- package/build/components/DatePicker/Day.js +43 -0
- package/build/components/DatePicker/LocalizedDayPicker.js +17 -0
- package/build/components/DatePicker/MonthGrid.js +39 -0
- package/build/components/DatePicker/MonthPicker.js +33 -0
- package/build/components/DatePicker/MonthSelector.js +46 -0
- package/build/components/DatePicker/MonthYearSelector.js +23 -0
- package/build/components/DatePicker/NavbarElement.js +34 -0
- package/build/components/DatePicker/RangeDatePicker.js +111 -0
- package/build/components/DatePicker/RelativeDateRange.js +290 -0
- package/build/components/DatePicker/UpcomingDatePicker.js +31 -0
- package/build/components/Dot/Dot.js +29 -0
- package/build/components/Dot/DotProgress.js +15 -0
- package/build/components/Drawer.js +134 -0
- package/build/components/Forms/BaseInput.js +57 -0
- package/build/components/Forms/Checkbox.js +37 -0
- package/build/components/Forms/Checkbox.module.css.js +7 -0
- package/build/components/Forms/ComboBox.js +41 -0
- package/build/components/Forms/FormGroup.js +10 -0
- package/build/components/Forms/InlineValuePopover.js +41 -0
- package/build/components/Forms/Input.js +17 -0
- package/build/components/Forms/Label.js +23 -0
- package/build/components/Forms/RangeSlider.js +58 -0
- package/build/components/Forms/Select.js +7 -0
- package/build/components/Forms/Switch.js +70 -0
- package/build/components/Forms/Textarea.js +42 -0
- package/build/components/Forms/ValuePopoverText.js +7 -0
- package/build/components/GooglePlacesAutocomplete.js +112 -0
- package/build/components/HeaderToolbar.js +41 -0
- package/build/components/ImageUpload.js +83 -0
- package/build/components/Key.js +33 -0
- package/build/components/Logo.js +17 -0
- package/build/components/Modal.js +141 -0
- package/build/components/Popover/Popover.js +53 -0
- package/build/components/Popover/Popover.module.css.js +7 -0
- package/build/components/Popover/PopoverList.js +57 -0
- package/build/components/Popover/PopoverScroll.module.css.js +4 -0
- package/build/components/Provider.js +16 -0
- package/build/components/Screens/Login.js +115 -0
- package/build/components/Search.js +144 -0
- package/build/components/Sidebar/Sidebar.Account.js +49 -0
- package/build/components/Sidebar/Sidebar.Button.js +47 -0
- package/build/components/Sidebar/Sidebar.Footer.js +10 -0
- package/build/components/Sidebar/Sidebar.Heading.js +13 -0
- package/build/components/Sidebar/Sidebar.Link.js +92 -0
- package/build/components/Sidebar/Sidebar.Menu.js +54 -0
- package/build/components/Sidebar/Sidebar.Menu.module.css.js +7 -0
- package/build/components/Sidebar/Sidebar.Notifications.js +107 -0
- package/build/components/Sidebar/Sidebar.js +212 -0
- package/build/components/Sidebar/SidebarContext.js +15 -0
- package/build/components/Sidebar/SidebarScroll.module.css.js +4 -0
- package/build/components/Sidebar/sidebarWidth.js +41 -0
- package/build/components/Sidebar/useSidebarWidthState.js +115 -0
- package/build/components/Skeleton.js +28 -0
- package/build/components/Skeleton.module.css.js +7 -0
- package/build/components/Spinner.js +35 -0
- package/build/components/Table.js +107 -0
- package/build/components/Tabs/Tabs.Panel.js +11 -0
- package/build/components/Tabs/Tabs.Tab.js +42 -0
- package/build/components/Tabs/Tabs.js +28 -0
- package/build/components/Tag.js +41 -0
- package/build/components/Tooltip.js +22 -0
- package/build/components/Utilities/Currency.js +56 -0
- package/build/components/Utilities/Number.js +17 -0
- package/build/components/Utilities/Phone.js +25 -0
- package/build/helpers/browser.js +9 -0
- package/build/helpers/children.js +6 -0
- package/build/helpers/classnames.js +8 -0
- package/build/helpers/environment.js +10 -0
- package/build/helpers/flash.js +86 -0
- package/build/hooks/useIsClient.js +10 -0
- package/build/hooks/useIsMobile.js +8 -0
- package/build/hooks/useViewportHeight.js +9 -0
- package/build/icons/src/AnnounceIcon.js +12 -0
- package/build/icons/src/BellIcon.js +26 -0
- package/build/icons/src/CalendarIcon.js +15 -0
- package/build/icons/src/CheckIcon.js +7 -0
- package/build/icons/src/ChevronDownIcon.js +7 -0
- package/build/icons/src/ChevronLeftIcon.js +7 -0
- package/build/icons/src/ChevronRightIcon.js +7 -0
- package/build/icons/src/CircleNotch.js +5 -0
- package/build/icons/src/CloseIcon.js +13 -0
- package/build/icons/src/DownArrowIcon.js +15 -0
- package/build/icons/src/ImageIcon.js +26 -0
- package/build/icons/src/SearchIcon.js +15 -0
- package/build/icons/src/TrashIcon.js +19 -0
- package/build/icons/src/WarningDiamondIcon.js +26 -0
- package/build/icons/src/helpers/icon.js +7 -0
- package/build/icons/src/helpers/iconSizes.js +13 -0
- package/build/icons/src/images/XolaLogoSimple.js +13 -0
- package/build/index.js +155 -0
- package/build/style.css +1 -1
- package/build/theme.js +374 -0
- package/build/utils/avatar.js +8 -0
- package/build/utils/currency.js +11 -0
- package/build/utils/date.js +46 -0
- package/build/utils/numbers.js +19 -0
- package/build/utils/phone.js +15 -0
- package/build/utils/userLocale.js +6 -0
- package/index.d.ts +132 -79
- package/package.json +76 -45
- package/postcss.config.js +1 -1
- package/skills/README.md +27 -0
- package/skills/migrate-2.6-to-3.7/SKILL.md +110 -0
- package/tailwind.config.js +9 -5
- package/build/ui-kit.es.js +0 -16771
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import E from "prop-types";
|
|
2
|
+
import T from "react";
|
|
3
|
+
import { Button as O } from "../Buttons/Button.js";
|
|
4
|
+
import { Select as I } from "../Forms/Select.js";
|
|
5
|
+
import { now as l, toDate as t } from "../../utils/date.js";
|
|
6
|
+
const e = {
|
|
7
|
+
// Day
|
|
8
|
+
YESTERDAY: "P1D,yesterday",
|
|
9
|
+
TODAY: "P1D,today",
|
|
10
|
+
NEXT_DAY: "P1D,next day",
|
|
11
|
+
// Week
|
|
12
|
+
LAST_WEEK: "P1W,last week",
|
|
13
|
+
TRAILING_WEEK: "P1W,-1 week",
|
|
14
|
+
THIS_WEEK: "P1W,this week",
|
|
15
|
+
NEXT_WEEK: "P1W,next week",
|
|
16
|
+
LEADING_WEEK: "P1W,+1 week",
|
|
17
|
+
// Month
|
|
18
|
+
LAST_MONTH: "P1M,first day of last month",
|
|
19
|
+
TRAILING_MONTH: "P1M,-1 month",
|
|
20
|
+
THIS_MONTH: "P1M,first day of this month",
|
|
21
|
+
NEXT_MONTH: "P1M,next month",
|
|
22
|
+
LEADING_MONTH: "P1M,+1 month",
|
|
23
|
+
// Quarter
|
|
24
|
+
LAST_QUARTER: "P3M,first day of last quarter",
|
|
25
|
+
TRAILING_QUARTER: "P3M,-3 months",
|
|
26
|
+
THIS_QUARTER: "P3M,first day of this quarter",
|
|
27
|
+
NEXT_QUARTER: "P3M,next quarter",
|
|
28
|
+
LEADING_QUARTER: "P3M,+3 months",
|
|
29
|
+
// Year
|
|
30
|
+
LAST_YEAR: "P1Y,first day of January last year",
|
|
31
|
+
TRAILING_YEAR: "P1Y,-1 year",
|
|
32
|
+
THIS_YEAR: "P1Y,first day of this year",
|
|
33
|
+
NEXT_YEAR: "P1Y,next year",
|
|
34
|
+
LEADING_YEAR: "P1Y,+1 year"
|
|
35
|
+
}, n = {
|
|
36
|
+
// Day
|
|
37
|
+
[e.YESTERDAY]: "Yesterday",
|
|
38
|
+
[e.TODAY]: "Today",
|
|
39
|
+
[e.NEXT_DAY]: "Next Day",
|
|
40
|
+
// Week
|
|
41
|
+
[e.LAST_WEEK]: "Last Week",
|
|
42
|
+
[e.TRAILING_WEEK]: "Trailing Week",
|
|
43
|
+
[e.THIS_WEEK]: "This Week",
|
|
44
|
+
[e.NEXT_WEEK]: "Next Week",
|
|
45
|
+
[e.LEADING_WEEK]: "Leading Week",
|
|
46
|
+
// Month
|
|
47
|
+
[e.LAST_MONTH]: "Last Month",
|
|
48
|
+
[e.TRAILING_MONTH]: "Trailing Month",
|
|
49
|
+
[e.THIS_MONTH]: "This Month",
|
|
50
|
+
[e.NEXT_MONTH]: "Next Month",
|
|
51
|
+
[e.LEADING_MONTH]: "Leading Month",
|
|
52
|
+
// Quarter
|
|
53
|
+
[e.LAST_QUARTER]: "Last Quarter",
|
|
54
|
+
[e.TRAILING_QUARTER]: "Trailing Quarter",
|
|
55
|
+
[e.THIS_QUARTER]: "This Quarter",
|
|
56
|
+
[e.NEXT_QUARTER]: "Next Quarter",
|
|
57
|
+
[e.LEADING_QUARTER]: "Leading Quarter",
|
|
58
|
+
// Year
|
|
59
|
+
[e.LAST_YEAR]: "Last Year",
|
|
60
|
+
[e.TRAILING_YEAR]: "Trailing Year",
|
|
61
|
+
[e.THIS_YEAR]: "This Year",
|
|
62
|
+
[e.NEXT_YEAR]: "Next Year",
|
|
63
|
+
[e.LEADING_YEAR]: "Leading Year"
|
|
64
|
+
}, y = {
|
|
65
|
+
day: {
|
|
66
|
+
label: "Day",
|
|
67
|
+
rangeOptions: [
|
|
68
|
+
{ value: e.YESTERDAY, label: n[e.YESTERDAY] },
|
|
69
|
+
{ value: e.TODAY, label: n[e.TODAY] },
|
|
70
|
+
{ value: e.NEXT_DAY, label: n[e.NEXT_DAY] }
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
week: {
|
|
74
|
+
label: "Week",
|
|
75
|
+
rangeOptions: [
|
|
76
|
+
{ value: e.LAST_WEEK, label: n[e.LAST_WEEK] },
|
|
77
|
+
{ value: e.TRAILING_WEEK, label: n[e.TRAILING_WEEK] },
|
|
78
|
+
{ value: e.THIS_WEEK, label: n[e.THIS_WEEK] },
|
|
79
|
+
{ value: e.NEXT_WEEK, label: n[e.NEXT_WEEK] },
|
|
80
|
+
{ value: e.LEADING_WEEK, label: n[e.LEADING_WEEK] }
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
month: {
|
|
84
|
+
label: "Month",
|
|
85
|
+
rangeOptions: [
|
|
86
|
+
{ value: e.LAST_MONTH, label: n[e.LAST_MONTH] },
|
|
87
|
+
{ value: e.TRAILING_MONTH, label: n[e.TRAILING_MONTH] },
|
|
88
|
+
{ value: e.THIS_MONTH, label: n[e.THIS_MONTH] },
|
|
89
|
+
{ value: e.NEXT_MONTH, label: n[e.NEXT_MONTH] },
|
|
90
|
+
{ value: e.LEADING_MONTH, label: n[e.LEADING_MONTH] }
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
quarter: {
|
|
94
|
+
label: "Quarter",
|
|
95
|
+
rangeOptions: [
|
|
96
|
+
{ value: e.LAST_QUARTER, label: n[e.LAST_QUARTER] },
|
|
97
|
+
{ value: e.TRAILING_QUARTER, label: n[e.TRAILING_QUARTER] },
|
|
98
|
+
{ value: e.THIS_QUARTER, label: n[e.THIS_QUARTER] },
|
|
99
|
+
{ value: e.NEXT_QUARTER, label: n[e.NEXT_QUARTER] },
|
|
100
|
+
{ value: e.LEADING_QUARTER, label: n[e.LEADING_QUARTER] }
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
year: {
|
|
104
|
+
label: "Year",
|
|
105
|
+
rangeOptions: [
|
|
106
|
+
{ value: e.LAST_YEAR, label: n[e.LAST_YEAR] },
|
|
107
|
+
{ value: e.TRAILING_YEAR, label: n[e.TRAILING_YEAR] },
|
|
108
|
+
{ value: e.THIS_YEAR, label: n[e.THIS_YEAR] },
|
|
109
|
+
{ value: e.NEXT_YEAR, label: n[e.NEXT_YEAR] },
|
|
110
|
+
{ value: e.LEADING_YEAR, label: n[e.LEADING_YEAR] }
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
}, L = (a, r, A) => r ? a : a.filter((f) => !A.has(f.value)), m = /* @__PURE__ */ new Set([
|
|
114
|
+
e.NEXT_DAY,
|
|
115
|
+
e.NEXT_WEEK,
|
|
116
|
+
e.NEXT_MONTH,
|
|
117
|
+
e.NEXT_QUARTER,
|
|
118
|
+
e.NEXT_YEAR,
|
|
119
|
+
e.LEADING_WEEK,
|
|
120
|
+
e.LEADING_MONTH,
|
|
121
|
+
e.LEADING_QUARTER,
|
|
122
|
+
e.LEADING_YEAR
|
|
123
|
+
]), Y = {
|
|
124
|
+
[e.YESTERDAY]: (a) => {
|
|
125
|
+
const r = l(null, a).subtract(1, "day");
|
|
126
|
+
return {
|
|
127
|
+
from: t(r.startOf("day")),
|
|
128
|
+
to: t(r.endOf("day"), !1)
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
[e.TODAY]: (a) => ({
|
|
132
|
+
from: t(l(null, a).startOf("day")),
|
|
133
|
+
to: t(l(null, a).endOf("day"), !1)
|
|
134
|
+
}),
|
|
135
|
+
[e.NEXT_DAY]: (a) => {
|
|
136
|
+
const r = l(null, a).add(1, "day");
|
|
137
|
+
return {
|
|
138
|
+
from: t(r.startOf("day")),
|
|
139
|
+
to: t(r.endOf("day"), !1)
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
[e.LAST_WEEK]: (a) => {
|
|
143
|
+
const r = l(null, a).subtract(7, "day");
|
|
144
|
+
return {
|
|
145
|
+
from: t(r.startOf("week")),
|
|
146
|
+
to: t(r.endOf("week"), !1)
|
|
147
|
+
};
|
|
148
|
+
},
|
|
149
|
+
[e.TRAILING_WEEK]: (a) => ({
|
|
150
|
+
from: t(l(null, a).subtract(7, "day").startOf("day")),
|
|
151
|
+
to: t(l(null, a).subtract(1, "day").endOf("day"), !1)
|
|
152
|
+
}),
|
|
153
|
+
[e.THIS_WEEK]: (a) => ({
|
|
154
|
+
from: t(l(null, a).startOf("week")),
|
|
155
|
+
to: t(l(null, a).endOf("week"), !1)
|
|
156
|
+
}),
|
|
157
|
+
[e.NEXT_WEEK]: (a) => {
|
|
158
|
+
const r = l(null, a).add(1, "week");
|
|
159
|
+
return {
|
|
160
|
+
from: t(r.startOf("week")),
|
|
161
|
+
to: t(r.endOf("week"), !1)
|
|
162
|
+
};
|
|
163
|
+
},
|
|
164
|
+
[e.LEADING_WEEK]: (a) => {
|
|
165
|
+
const r = l(null, a);
|
|
166
|
+
return {
|
|
167
|
+
from: t(r.startOf("day")),
|
|
168
|
+
to: t(r.add(1, "week").subtract(1, "day").endOf("day"), !1)
|
|
169
|
+
};
|
|
170
|
+
},
|
|
171
|
+
[e.LAST_MONTH]: (a) => {
|
|
172
|
+
const r = l(null, a).subtract(1, "month");
|
|
173
|
+
return {
|
|
174
|
+
from: t(r.startOf("month")),
|
|
175
|
+
to: t(r.endOf("month"), !1)
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
[e.TRAILING_MONTH]: (a) => ({
|
|
179
|
+
from: t(l(null, a).subtract(1, "month").startOf("day")),
|
|
180
|
+
to: t(l(null, a).subtract(1, "day").endOf("day"), !1)
|
|
181
|
+
}),
|
|
182
|
+
[e.THIS_MONTH]: (a) => ({
|
|
183
|
+
from: t(l(null, a).startOf("month")),
|
|
184
|
+
to: t(l(null, a).endOf("month"), !1)
|
|
185
|
+
}),
|
|
186
|
+
[e.NEXT_MONTH]: (a) => {
|
|
187
|
+
const r = l(null, a).add(1, "month");
|
|
188
|
+
return {
|
|
189
|
+
from: t(r.startOf("month")),
|
|
190
|
+
to: t(r.endOf("month"), !1)
|
|
191
|
+
};
|
|
192
|
+
},
|
|
193
|
+
[e.LEADING_MONTH]: (a) => {
|
|
194
|
+
const r = l(null, a);
|
|
195
|
+
return {
|
|
196
|
+
from: t(r.startOf("day")),
|
|
197
|
+
to: t(r.add(1, "month").subtract(1, "day").endOf("day"), !1)
|
|
198
|
+
};
|
|
199
|
+
},
|
|
200
|
+
[e.LAST_QUARTER]: (a) => ({
|
|
201
|
+
from: t(l(null, a).startOf("quarter").subtract(3, "month").startOf("month")),
|
|
202
|
+
to: t(l(null, a).endOf("quarter").subtract(3, "month").endOf("month"), !1)
|
|
203
|
+
}),
|
|
204
|
+
[e.TRAILING_QUARTER]: (a) => ({
|
|
205
|
+
from: t(l(null, a).subtract(3, "month").startOf("day")),
|
|
206
|
+
to: t(l(null, a).subtract(1, "day").endOf("day"), !1)
|
|
207
|
+
}),
|
|
208
|
+
[e.THIS_QUARTER]: (a) => ({
|
|
209
|
+
from: t(l(null, a).startOf("Q")),
|
|
210
|
+
to: t(l(null, a).endOf("Q"), !1)
|
|
211
|
+
}),
|
|
212
|
+
[e.NEXT_QUARTER]: (a) => {
|
|
213
|
+
const r = l(null, a).add(1, "quarter");
|
|
214
|
+
return {
|
|
215
|
+
from: t(r.startOf("quarter")),
|
|
216
|
+
to: t(r.endOf("quarter"), !1)
|
|
217
|
+
};
|
|
218
|
+
},
|
|
219
|
+
[e.LEADING_QUARTER]: (a) => {
|
|
220
|
+
const r = l(null, a);
|
|
221
|
+
return {
|
|
222
|
+
from: t(r.startOf("day")),
|
|
223
|
+
to: t(r.add(3, "month").subtract(1, "day").endOf("day"), !1)
|
|
224
|
+
// Сегодня + 3 месяца
|
|
225
|
+
};
|
|
226
|
+
},
|
|
227
|
+
[e.LAST_YEAR]: (a) => {
|
|
228
|
+
const r = l(null, a).subtract(1, "year");
|
|
229
|
+
return {
|
|
230
|
+
from: t(r.startOf("year")),
|
|
231
|
+
to: t(r.endOf("year"), !1)
|
|
232
|
+
};
|
|
233
|
+
},
|
|
234
|
+
[e.TRAILING_YEAR]: (a) => ({
|
|
235
|
+
from: t(l(null, a).subtract(1, "year").startOf("day")),
|
|
236
|
+
to: t(l(null, a).subtract(1, "day").endOf("day"), !1)
|
|
237
|
+
}),
|
|
238
|
+
[e.THIS_YEAR]: (a) => ({
|
|
239
|
+
from: t(l(null, a).startOf("year")),
|
|
240
|
+
to: t(l(null, a).endOf("year"), !1)
|
|
241
|
+
}),
|
|
242
|
+
[e.NEXT_YEAR]: (a) => {
|
|
243
|
+
const r = l(null, a).add(1, "year");
|
|
244
|
+
return {
|
|
245
|
+
from: t(r.startOf("year")),
|
|
246
|
+
to: t(r.endOf("year"), !1)
|
|
247
|
+
};
|
|
248
|
+
},
|
|
249
|
+
[e.LEADING_YEAR]: (a) => {
|
|
250
|
+
const r = l(null, a);
|
|
251
|
+
return {
|
|
252
|
+
from: t(r.startOf("day")),
|
|
253
|
+
to: t(r.add(1, "year").subtract(1, "day").endOf("day"), !1)
|
|
254
|
+
// Сегодня + 1 год
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
}, c = ({
|
|
258
|
+
ranges: a = ["day", "week", "month", "quarter", "year"],
|
|
259
|
+
value: r,
|
|
260
|
+
// TODO: Prop name (showApply) doesn't match rule (^(is|has|should)[A-Z]([A-Za-z0-9]?)+)
|
|
261
|
+
showApply: A = !0,
|
|
262
|
+
onChange: f,
|
|
263
|
+
onSubmit: R,
|
|
264
|
+
timezoneName: _,
|
|
265
|
+
isFutureDatesAllowed: N = !1
|
|
266
|
+
// This prop used to be able to select Future Dates in RelativeDateRange,
|
|
267
|
+
}) => {
|
|
268
|
+
const d = (u) => {
|
|
269
|
+
const s = u.target.value, o = Y[s](_);
|
|
270
|
+
f(s, o);
|
|
271
|
+
};
|
|
272
|
+
return /* @__PURE__ */ T.createElement("div", { className: "flex space-x-2" }, /* @__PURE__ */ T.createElement(I, { size: "medium", value: r, className: "pr-8 leading-5", onChange: d }, /* @__PURE__ */ T.createElement("option", { value: "" }, "Relative Date Range"), a.map((u) => {
|
|
273
|
+
const s = y[u];
|
|
274
|
+
return /* @__PURE__ */ T.createElement("optgroup", { key: u, label: s.label }, L(s.rangeOptions, N, m).map((o) => /* @__PURE__ */ T.createElement("option", { key: o.value, value: o.value }, o.label)));
|
|
275
|
+
})), A && /* @__PURE__ */ T.createElement(O, { onClick: R }, "Apply"));
|
|
276
|
+
};
|
|
277
|
+
c.propTypes = {
|
|
278
|
+
ranges: E.arrayOf(E.oneOf(["day", "week", "month", "quarter", "year"])),
|
|
279
|
+
onChange: E.func.isRequired,
|
|
280
|
+
onSubmit: E.func.isRequired,
|
|
281
|
+
showApply: E.bool,
|
|
282
|
+
value: E.string,
|
|
283
|
+
timezoneName: E.string,
|
|
284
|
+
isFutureDatesAllowed: E.bool
|
|
285
|
+
};
|
|
286
|
+
export {
|
|
287
|
+
c as RelativeDateRange,
|
|
288
|
+
n as rangeLabels,
|
|
289
|
+
e as rangeOptions
|
|
290
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import o from "dayjs";
|
|
2
|
+
import l from "prop-types";
|
|
3
|
+
import t from "react";
|
|
4
|
+
import s from "../../helpers/classnames.js";
|
|
5
|
+
const b = ({ value: m, upcomingDates: e, onChange: a, onMonthChange: i }) => /* @__PURE__ */ t.createElement("div", { className: "rounded-l-lg border-r border-gray pt-8" }, /* @__PURE__ */ t.createElement("p", { className: "mb-2 px-6 text-lg font-bold" }, "Upcoming"), (e == null ? void 0 : e.length) > 0 ? /* @__PURE__ */ t.createElement("div", { className: "mt-5" }, e == null ? void 0 : e.map((r) => {
|
|
6
|
+
const n = o(r).isSame(o(m), "day"), d = o(r).format();
|
|
7
|
+
return /* @__PURE__ */ t.createElement(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
key: d,
|
|
11
|
+
className: s(
|
|
12
|
+
"mx-6 mt-3 flex min-w-40 cursor-pointer items-center justify-center",
|
|
13
|
+
"rounded border border-gray py-3 hover:border-blue hover:bg-blue hover:text-white",
|
|
14
|
+
{ "border-blue bg-blue text-white": n }
|
|
15
|
+
),
|
|
16
|
+
onClick: (c) => {
|
|
17
|
+
a(r, {}, c), i(r);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
o(r).format("ddd DD MMMM")
|
|
21
|
+
);
|
|
22
|
+
})) : /* @__PURE__ */ t.createElement("div", { className: "mx-6 mt-7 max-w-40 items-center justify-center rounded bg-yellow-lighter p-3" }, "There is no future availability for this product."));
|
|
23
|
+
b.propTypes = {
|
|
24
|
+
value: l.objectOf(Date),
|
|
25
|
+
upcomingDates: l.arrayOf(Date).isRequired,
|
|
26
|
+
onChange: l.func.isRequired,
|
|
27
|
+
onMonthChange: l.func.isRequired
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
b as UpcomingDatePicker
|
|
31
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import r from "prop-types";
|
|
2
|
+
import c from "react";
|
|
3
|
+
import t from "../../helpers/classnames.js";
|
|
4
|
+
const e = {
|
|
5
|
+
primary: "bg-primary",
|
|
6
|
+
secondary: "bg-secondary",
|
|
7
|
+
success: "bg-success",
|
|
8
|
+
warning: "bg-warning",
|
|
9
|
+
danger: "bg-danger",
|
|
10
|
+
caution: "bg-caution"
|
|
11
|
+
}, i = {
|
|
12
|
+
small: "h-1 w-1",
|
|
13
|
+
medium: "h-1.5 w-1.5",
|
|
14
|
+
large: "h-2 w-2",
|
|
15
|
+
xlarge: "h-8 w-8"
|
|
16
|
+
}, m = ({ color: o = "primary", size: s = "medium", className: n, ...a }) => /* @__PURE__ */ c.createElement(
|
|
17
|
+
"span",
|
|
18
|
+
{
|
|
19
|
+
className: t("ui-dot", "inline-block rounded-full text-white", e[o], i[s], n),
|
|
20
|
+
...a
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
m.propTypes = {
|
|
24
|
+
className: r.string,
|
|
25
|
+
color: r.oneOf(Object.keys(e))
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
m as Dot
|
|
29
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { range as i } from "lodash-es";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import m from "react";
|
|
4
|
+
import { Dot as n } from "./Dot.js";
|
|
5
|
+
const a = ({ current: e, total: r }) => r <= 1 ? null : /* @__PURE__ */ m.createElement("div", { className: "w-full space-x-2 text-center" }, i(0, r).map((o) => {
|
|
6
|
+
const s = e <= 0 ? 0 : e >= r ? e - 1 : e, p = o === s ? "primary" : "secondary";
|
|
7
|
+
return /* @__PURE__ */ m.createElement(n, { key: o, color: p, size: "medium" });
|
|
8
|
+
}));
|
|
9
|
+
a.propTypes = {
|
|
10
|
+
total: t.number.isRequired,
|
|
11
|
+
current: t.number.isRequired
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
a as DotProgress
|
|
15
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Transition as o, Dialog as s } from "@headlessui/react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import e, { forwardRef as g, Fragment as m } from "react";
|
|
4
|
+
import { isIosBrowser as v } from "../helpers/browser.js";
|
|
5
|
+
import r from "../helpers/classnames.js";
|
|
6
|
+
import { useViewportHeight as E } from "../hooks/useViewportHeight.js";
|
|
7
|
+
import { Button as b } from "./Buttons/Button.js";
|
|
8
|
+
import { CloseIcon as T } from "../icons/src/CloseIcon.js";
|
|
9
|
+
const N = {
|
|
10
|
+
small: "w-72",
|
|
11
|
+
medium: "w-85",
|
|
12
|
+
large: "w-110",
|
|
13
|
+
xl: "w-200",
|
|
14
|
+
"2xl": "w-screen md:max-w-screen-md 2xl:max-w-screen-lg"
|
|
15
|
+
// This was the old size
|
|
16
|
+
}, c = g(
|
|
17
|
+
({
|
|
18
|
+
isOpen: n = !1,
|
|
19
|
+
title: u,
|
|
20
|
+
size: x = "medium",
|
|
21
|
+
content: p,
|
|
22
|
+
sideIndent: w = 0,
|
|
23
|
+
onClose: i,
|
|
24
|
+
classNames: a = {},
|
|
25
|
+
position: l = "right"
|
|
26
|
+
}, h) => {
|
|
27
|
+
const d = E(), y = v();
|
|
28
|
+
return /* @__PURE__ */ e.createElement(o.Root, { ref: h, show: n, as: m }, /* @__PURE__ */ e.createElement(
|
|
29
|
+
s,
|
|
30
|
+
{
|
|
31
|
+
as: "div",
|
|
32
|
+
className: r("ui-drawer fixed inset-0 z-10 overflow-hidden", a.dialog),
|
|
33
|
+
onClose: i
|
|
34
|
+
},
|
|
35
|
+
/* @__PURE__ */ e.createElement(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: r(
|
|
39
|
+
"flex",
|
|
40
|
+
y ? `h-[${d}px] max-h-[${d}px] w-full` : "h-screen w-full"
|
|
41
|
+
)
|
|
42
|
+
},
|
|
43
|
+
/* @__PURE__ */ e.createElement(
|
|
44
|
+
o.Child,
|
|
45
|
+
{
|
|
46
|
+
as: m,
|
|
47
|
+
enter: "ease-out duration-500",
|
|
48
|
+
enterFrom: "opacity-0",
|
|
49
|
+
enterTo: "opacity-100",
|
|
50
|
+
leave: "ease-in duration-200",
|
|
51
|
+
leaveFrom: "opacity-100",
|
|
52
|
+
leaveTo: "opacity-0"
|
|
53
|
+
},
|
|
54
|
+
/* @__PURE__ */ e.createElement(
|
|
55
|
+
s.Overlay,
|
|
56
|
+
{
|
|
57
|
+
className: r(
|
|
58
|
+
"ui-drawer-overlay fixed inset-0 bg-black bg-opacity-80 transition-opacity",
|
|
59
|
+
a.overlay
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ e.createElement(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
style: {
|
|
68
|
+
[l === "right" ? "right" : "left"]: `${w ?? 0}px`
|
|
69
|
+
},
|
|
70
|
+
className: r(
|
|
71
|
+
"ui-drawer-container",
|
|
72
|
+
"fixed inset-y-0 flex max-w-full",
|
|
73
|
+
a.dialogContent
|
|
74
|
+
)
|
|
75
|
+
},
|
|
76
|
+
/* @__PURE__ */ e.createElement(
|
|
77
|
+
o.Child,
|
|
78
|
+
{
|
|
79
|
+
as: m,
|
|
80
|
+
enter: "ease-out duration-500",
|
|
81
|
+
enterFrom: l === "right" ? "translate-x-full" : "-translate-x-full",
|
|
82
|
+
enterTo: "translate-x-0",
|
|
83
|
+
leave: "transform transition ease-out-in duration-500",
|
|
84
|
+
leaveFrom: l === "right" ? "-translate-x-full" : "translate-x-full",
|
|
85
|
+
leaveTo: l === "right" ? "translate-x-full" : "-translate-x-full"
|
|
86
|
+
},
|
|
87
|
+
/* @__PURE__ */ e.createElement("div", { className: "flex" }, l === "right" ? /* @__PURE__ */ e.createElement(f, { onClose: i }) : null, /* @__PURE__ */ e.createElement(
|
|
88
|
+
"div",
|
|
89
|
+
{
|
|
90
|
+
className: r(
|
|
91
|
+
"flex h-full w-full flex-col overflow-y-auto bg-white px-4 py-8 shadow-xl sm:px-6",
|
|
92
|
+
N[x],
|
|
93
|
+
a.children
|
|
94
|
+
)
|
|
95
|
+
},
|
|
96
|
+
/* @__PURE__ */ e.createElement("div", { className: "ui-drawer-header w-full" }, /* @__PURE__ */ e.createElement(s.Title, null, u)),
|
|
97
|
+
/* @__PURE__ */ e.createElement("div", { className: r("ui-drawer-body relative mt-3 flex-1", a.content) }, p)
|
|
98
|
+
), l === "left" ? /* @__PURE__ */ e.createElement(f, { onClose: i }) : null)
|
|
99
|
+
)
|
|
100
|
+
)
|
|
101
|
+
)
|
|
102
|
+
));
|
|
103
|
+
}
|
|
104
|
+
), f = ({ onClose: n }) => /* @__PURE__ */ e.createElement(
|
|
105
|
+
b,
|
|
106
|
+
{
|
|
107
|
+
size: "small",
|
|
108
|
+
variant: "link",
|
|
109
|
+
className: r(
|
|
110
|
+
"m-2.5 inline-flex !h-10 !w-10 items-center justify-center !rounded-full bg-white !px-1.5 !text-black"
|
|
111
|
+
),
|
|
112
|
+
onClick: n
|
|
113
|
+
},
|
|
114
|
+
/* @__PURE__ */ e.createElement(T, { size: "medium" })
|
|
115
|
+
);
|
|
116
|
+
c.displayName = "Drawer";
|
|
117
|
+
c.propTypes = {
|
|
118
|
+
isOpen: t.bool.isRequired,
|
|
119
|
+
title: t.oneOfType([t.arrayOf(t.node), t.node]),
|
|
120
|
+
content: t.oneOfType([t.arrayOf(t.node), t.node]).isRequired,
|
|
121
|
+
onClose: t.func.isRequired,
|
|
122
|
+
classNames: t.object,
|
|
123
|
+
position: t.string,
|
|
124
|
+
sideIndent: t.number
|
|
125
|
+
};
|
|
126
|
+
c.defaultProps = {
|
|
127
|
+
title: "",
|
|
128
|
+
classNames: {},
|
|
129
|
+
position: "right",
|
|
130
|
+
sideIndent: 0
|
|
131
|
+
};
|
|
132
|
+
export {
|
|
133
|
+
c as Drawer
|
|
134
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { isString as l, isEmpty as n } from "lodash-es";
|
|
2
|
+
import e from "prop-types";
|
|
3
|
+
import s, { forwardRef as h } from "react";
|
|
4
|
+
import E from "../../helpers/classnames.js";
|
|
5
|
+
import { Dot as k } from "../Dot/Dot.js";
|
|
6
|
+
const p = {
|
|
7
|
+
small: "px-3 py-1.5 text-sm leading-sm",
|
|
8
|
+
// 30px
|
|
9
|
+
medium: "px-3 py-2.5 text-base leading-base",
|
|
10
|
+
// 40px
|
|
11
|
+
large: "px-5 py-3.5 text-md leading-md"
|
|
12
|
+
// 50px
|
|
13
|
+
}, a = h(
|
|
14
|
+
({ as: m, size: d = "medium", isError: g, className: c, isRequired: f, value: r, prefix: i, suffix: o, ...u }, y) => {
|
|
15
|
+
const b = () => {
|
|
16
|
+
if (!l(r)) return;
|
|
17
|
+
let t = r;
|
|
18
|
+
return i && (t = t.replace(new RegExp(`^${i}`), "")), o && (t = t.replace(new RegExp(`${o}$`), "")), t.replaceAll(/[^.\S]+/g, "").replace(/[\p{Sc}]/u, "");
|
|
19
|
+
}, x = l(r) ? n(b()) : n(r == null ? void 0 : r.toString());
|
|
20
|
+
return /* @__PURE__ */ s.createElement("div", { className: "relative flex w-full items-center" }, /* @__PURE__ */ s.createElement(
|
|
21
|
+
m,
|
|
22
|
+
{
|
|
23
|
+
ref: y,
|
|
24
|
+
className: E(
|
|
25
|
+
"w-full rounded text-gray-darker placeholder-gray-dark hover:placeholder-gray-darker disabled:text-gray",
|
|
26
|
+
"border hover:border-black hover:bg-gray-lighter focus:text-black active:text-black disabled:bg-gray-lighter",
|
|
27
|
+
p[d],
|
|
28
|
+
g ? "!focus:border-danger !border-danger focus:ring-0 focus:ring-danger" : "border-gray-light focus:border-primary focus:ring-0 focus:ring-primary",
|
|
29
|
+
c
|
|
30
|
+
),
|
|
31
|
+
value: r,
|
|
32
|
+
...u
|
|
33
|
+
}
|
|
34
|
+
), f && x && /* @__PURE__ */ s.createElement(k, { className: "absolute right-3", color: "danger" }));
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
a.displayName = "BaseInput";
|
|
38
|
+
a.propTypes = {
|
|
39
|
+
as: e.oneOfType([e.string, e.elementType]),
|
|
40
|
+
size: e.oneOf(Object.keys(p)),
|
|
41
|
+
className: e.string,
|
|
42
|
+
isError: e.bool,
|
|
43
|
+
isRequired: e.bool,
|
|
44
|
+
value: e.oneOfType([e.string, e.number]),
|
|
45
|
+
prefix: e.string,
|
|
46
|
+
suffix: e.string
|
|
47
|
+
};
|
|
48
|
+
a.defaultProps = {
|
|
49
|
+
as: "input",
|
|
50
|
+
size: "medium",
|
|
51
|
+
className: "",
|
|
52
|
+
isError: !1,
|
|
53
|
+
isRequired: !1
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
a as BaseInput
|
|
57
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import e from "prop-types";
|
|
2
|
+
import r, { useId as n } from "react";
|
|
3
|
+
import t from "../../helpers/classnames.js";
|
|
4
|
+
import s from "./Checkbox.module.css.js";
|
|
5
|
+
const b = ({ label: o, className: l, classNames: c = {}, ...i }) => {
|
|
6
|
+
const a = n("checkbox");
|
|
7
|
+
return /* @__PURE__ */ r.createElement("div", { className: t("ui-checkbox", l, "flex items-center") }, /* @__PURE__ */ r.createElement(
|
|
8
|
+
"input",
|
|
9
|
+
{
|
|
10
|
+
type: "checkbox",
|
|
11
|
+
className: t(
|
|
12
|
+
"ui-checkbox-input",
|
|
13
|
+
c.checkbox,
|
|
14
|
+
s.checkbox,
|
|
15
|
+
"h-4 w-4 rounded !border-primary text-white transition-colors disabled:border-none disabled:bg-gray-light disabled:text-gray-light"
|
|
16
|
+
),
|
|
17
|
+
...i,
|
|
18
|
+
id: a
|
|
19
|
+
}
|
|
20
|
+
), o ? /* @__PURE__ */ r.createElement(
|
|
21
|
+
"label",
|
|
22
|
+
{
|
|
23
|
+
htmlFor: a,
|
|
24
|
+
className: t("ui-checkbox-label", c.label, "ml-2 leading-none text-gray-darker")
|
|
25
|
+
},
|
|
26
|
+
o
|
|
27
|
+
) : null);
|
|
28
|
+
};
|
|
29
|
+
b.propTypes = {
|
|
30
|
+
label: e.node.isRequired,
|
|
31
|
+
className: e.string,
|
|
32
|
+
classNames: e.shape({ checkbox: e.string, label: e.string }),
|
|
33
|
+
onChange: e.func
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
b as Checkbox
|
|
37
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import n from "prop-types";
|
|
2
|
+
import o, { forwardRef as i, useRef as m, useState as f, useEffect as u } from "react";
|
|
3
|
+
import b, { components as p } from "react-select";
|
|
4
|
+
import d from "react-select/creatable";
|
|
5
|
+
import x from "../../helpers/classnames.js";
|
|
6
|
+
import { Tooltip as E } from "../Tooltip.js";
|
|
7
|
+
/* empty css */
|
|
8
|
+
const s = i(({ isCreatable: e = !1, className: t = "", isError: l = !1, ...r }, a) => {
|
|
9
|
+
const c = e ? d : b;
|
|
10
|
+
return /* @__PURE__ */ o.createElement(
|
|
11
|
+
c,
|
|
12
|
+
{
|
|
13
|
+
ref: a,
|
|
14
|
+
className: x("ui-combo-box", l && "border-danger", t),
|
|
15
|
+
classNamePrefix: "ui-combo-box",
|
|
16
|
+
components: e ? {
|
|
17
|
+
IndicatorsContainer: () => null,
|
|
18
|
+
Menu: () => null,
|
|
19
|
+
MultiValueLabel: y
|
|
20
|
+
} : null,
|
|
21
|
+
...r
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
s.displayName = "ComboBox";
|
|
26
|
+
const { MultiValueLabel: T } = p, y = (e) => {
|
|
27
|
+
const t = m(null), [l, r] = f(!0);
|
|
28
|
+
return u(() => {
|
|
29
|
+
if (t.current) {
|
|
30
|
+
const a = t.current.offsetWidth > t.current.offsetParent.offsetWidth;
|
|
31
|
+
r(!a);
|
|
32
|
+
}
|
|
33
|
+
}, [e.data.label]), /* @__PURE__ */ o.createElement(T, { ...e }, /* @__PURE__ */ o.createElement(E, { disabled: l, maxWidth: "none", content: /* @__PURE__ */ o.createElement("span", null, e.data.label) }, /* @__PURE__ */ o.createElement("span", { ref: t }, e.data.label)));
|
|
34
|
+
};
|
|
35
|
+
s.propTypes = {
|
|
36
|
+
className: n.string,
|
|
37
|
+
isError: n.bool
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
s as ComboBox
|
|
41
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import m from "prop-types";
|
|
2
|
+
import e from "react";
|
|
3
|
+
import p from "../../helpers/classnames.js";
|
|
4
|
+
const t = ({ className: r, ...o }) => /* @__PURE__ */ e.createElement("div", { className: p("ui-form-group", "mb-4", r), ...o });
|
|
5
|
+
t.propTypes = {
|
|
6
|
+
className: m.string
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
t as FormGroup
|
|
10
|
+
};
|