@codezee/sixtify-brahma 0.2.44 → 0.2.46

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 (26) hide show
  1. package/package.json +1 -1
  2. package/packages/shared-components/dist/Actions/DownloadIconAction.d.ts.map +1 -1
  3. package/packages/shared-components/dist/Actions/DownloadIconAction.js +3 -1
  4. package/packages/shared-components/dist/FilterList/FilterListV2.d.ts.map +1 -1
  5. package/packages/shared-components/dist/FilterList/FilterListV2.js +18 -2
  6. package/packages/shared-components/dist/FormFields/Autocomplete/Autocomplete.d.ts.map +1 -1
  7. package/packages/shared-components/dist/FormFields/Autocomplete/Autocomplete.js +2 -2
  8. package/packages/shared-components/dist/FormFields/DateRangePicker/DateRangePicker.d.ts.map +1 -1
  9. package/packages/shared-components/dist/FormFields/DateRangePicker/DateRangePicker.js +3 -2
  10. package/packages/shared-components/dist/FormFields/DateRangeSelector/DateRangeSelector.d.ts +10 -0
  11. package/packages/shared-components/dist/FormFields/DateRangeSelector/DateRangeSelector.d.ts.map +1 -0
  12. package/packages/shared-components/dist/FormFields/DateRangeSelector/DateRangeSelector.js +51 -0
  13. package/packages/shared-components/dist/FormFields/DateRangeSelector/index.d.ts +2 -0
  14. package/packages/shared-components/dist/FormFields/DateRangeSelector/index.d.ts.map +1 -0
  15. package/packages/shared-components/dist/FormFields/DateRangeSelector/index.js +17 -0
  16. package/packages/shared-components/dist/FormFields/FileUpload/FileNames.d.ts.map +1 -1
  17. package/packages/shared-components/dist/FormFields/FileUpload/FileNames.js +1 -1
  18. package/packages/shared-components/dist/FormFields/index.d.ts +1 -0
  19. package/packages/shared-components/dist/FormFields/index.d.ts.map +1 -1
  20. package/packages/shared-components/dist/FormFields/index.js +1 -0
  21. package/packages/shared-components/dist/utils/index.d.ts +1 -0
  22. package/packages/shared-components/dist/utils/index.d.ts.map +1 -1
  23. package/packages/shared-components/dist/utils/index.js +1 -0
  24. package/packages/shared-components/dist/utils/regex.d.ts +3 -0
  25. package/packages/shared-components/dist/utils/regex.d.ts.map +1 -0
  26. package/packages/shared-components/dist/utils/regex.js +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codezee/sixtify-brahma",
3
- "version": "0.2.44",
3
+ "version": "0.2.46",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/hardikranpariya/sixtify-brahma.git"
@@ -1 +1 @@
1
- {"version":3,"file":"DownloadIconAction.d.ts","sourceRoot":"","sources":["../../src/Actions/DownloadIconAction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKrD,MAAM,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAEtD,eAAO,MAAM,kBAAkB,GAAI,OAAO,uBAAuB,4CAQhE,CAAC"}
1
+ {"version":3,"file":"DownloadIconAction.d.ts","sourceRoot":"","sources":["../../src/Actions/DownloadIconAction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKrD,MAAM,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAEtD,eAAO,MAAM,kBAAkB,GAAI,OAAO,uBAAuB,4CAShE,CAAC"}
@@ -6,6 +6,8 @@ const material_1 = require("@mui/material");
6
6
  const Svgs_1 = require("../Svgs");
7
7
  const Tooltip_1 = require("../Tooltip");
8
8
  const DownloadIconAction = (props) => {
9
- return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { toolTipLabel: "Download", children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { ...props, children: (0, jsx_runtime_1.jsx)(Svgs_1.SvgDownload, {}) }) }));
9
+ return (
10
+ // TODO: Need to add margin top to set the UI in sync with the design
11
+ (0, jsx_runtime_1.jsx)(material_1.IconButton, { ...props, children: (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { toolTipLabel: "Download", children: (0, jsx_runtime_1.jsx)(Svgs_1.SvgDownload, {}) }) }));
10
12
  };
11
13
  exports.DownloadIconAction = DownloadIconAction;
@@ -1 +1 @@
1
- {"version":3,"file":"FilterListV2.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterListV2.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAenD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,EACjB,eAAe,EAAE,cAAc,EAAE,GAChC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAiB7B;AAED,eAAO,MAAM,YAAY,GAAI,8EAO1B,iBAAiB,4CA0lBnB,CAAC"}
1
+ {"version":3,"file":"FilterListV2.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterListV2.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAgBnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,EACjB,eAAe,EAAE,cAAc,EAAE,GAChC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAiB7B;AAED,eAAO,MAAM,YAAY,GAAI,8EAO1B,iBAAiB,4CAgnBnB,CAAC"}
@@ -31,6 +31,7 @@ const Switch_1 = require("../FormFields/Switch");
31
31
  const PadBox_1 = require("../PadBox");
32
32
  const Toast_1 = require("../Toast");
33
33
  const Tooltip_1 = require("../Tooltip");
34
+ const utils_1 = require("../utils");
34
35
  const FilterPopupWrapper_1 = require("./FilterPopupWrapper");
35
36
  const GetFilterPopupComponent_1 = require("./GetFilterPopupComponent");
36
37
  const getFormData_1 = require("./getFormData");
@@ -192,6 +193,18 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
192
193
  return ((0, lodash_1.isEmpty)(dirtyFields) ||
193
194
  Object.keys(formData).every((key) => !formData[key]));
194
195
  }, [formData, dirtyFields]);
196
+ function formatKeyValue(keyValue) {
197
+ if (Array.isArray(keyValue)) {
198
+ return keyValue.join(", ");
199
+ }
200
+ if (utils_1.monthYearRegex.test(keyValue)) {
201
+ return luxon_1.DateTime.fromFormat(keyValue, "yyyy-MM").toFormat("MMM yyyy");
202
+ }
203
+ if (utils_1.isoDateRegex.test(keyValue)) {
204
+ return luxon_1.DateTime.fromFormat(keyValue, "yyyy-MM-dd").toFormat("dd-MM-yyyy");
205
+ }
206
+ return keyValue;
207
+ }
195
208
  const renderChips = (data) => {
196
209
  return Object.entries(data).map(([key, value]) => {
197
210
  if (typeof value !== "boolean" && !value) {
@@ -199,14 +212,17 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
199
212
  }
200
213
  const item = getFilterItem(key);
201
214
  const keyValue = item && (0, getFormData_1.getFormValue)(value, item);
202
- if (typeof value !== "boolean" && !keyValue) {
215
+ const formattedValue = formatKeyValue(typeof keyValue === "object"
216
+ ? JSON.stringify(keyValue)
217
+ : String(keyValue));
218
+ if (typeof value !== "boolean" && !formattedValue) {
203
219
  return;
204
220
  }
205
221
  return ((0, jsx_runtime_1.jsx)(FilterPill_1.FilterPill, { ref: filterPopupAnchorElm, label: (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip
206
222
  // eslint-disable-next-line sonarjs/no-base-to-string
207
223
  , {
208
224
  // eslint-disable-next-line sonarjs/no-base-to-string
209
- toolTipLabel: `${keyValue}`, children: `${item?.label}: ${keyValue}` }), onDelete: () => handleDelete(key), onClick: (e) => {
225
+ toolTipLabel: `${formattedValue}`, children: `${item?.label}: ${formattedValue}` }), onDelete: () => handleDelete(key), onClick: (e) => {
210
226
  if (key === "company_id" &&
211
227
  filterListItems?.some(({ required }) => required)) {
212
228
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../src/FormFields/Autocomplete/Autocomplete.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,IAAI,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAmB/E,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,iBAAiB,CAAC;AAOzB,MAAM,MAAM,MAAM,GAAG;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC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L,QAAgB,EAChB,QAAgB,EAChB,OAAY,EACZ,KAAK,EACL,OAAe,EACf,UAAU,EACV,KAAK,EACL,SAAiB,EACjB,WAAgB,EAChB,QAAQ,EACR,mBAA2B,EAC3B,eAAsB,EACtB,YAAoB,EACpB,kBAA0B,EAC1B,mBAA2B,EAC3B,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CAgatB"}
@@ -142,7 +142,7 @@ function Autocomplete({ control, defaultValue, name, required = false, label, mu
142
142
  }
143
143
  }
144
144
  }, disableCloseOnSelect: shouldCloseOnSelect, disabled: disabled, freeSolo: freeSolo, ...restProps, ...restField, renderTags: (value, getTagProps) => value.map((option, index) => {
145
- const { key, ...tagProps } = getTagProps({ index });
145
+ const { key, disabled, ...tagProps } = getTagProps({ index });
146
146
  const label = typeof option === "string" ? option : option.label;
147
147
  let avatarContent = "";
148
148
  let avatar = undefined;
@@ -156,7 +156,7 @@ function Autocomplete({ control, defaultValue, name, required = false, label, mu
156
156
  }
157
157
  avatar = option.avatar ? ((0, jsx_runtime_1.jsx)(material_1.Avatar, { src: option.avatar, alt: option.label })) : ((0, jsx_runtime_1.jsx)(material_1.Avatar, { children: avatarContent }));
158
158
  }
159
- return ((0, jsx_runtime_1.jsx)(material_1.Chip, { avatar: avatar, label: label, ...tagProps }, key));
159
+ return ((0, jsx_runtime_1.jsx)(material_1.Chip, { avatar: avatar, label: label, disabled: disabled, ...tagProps }, key));
160
160
  }), renderOption: (props, option, { selected }) => {
161
161
  if (renderOption) {
162
162
  return renderOption(props, option, { selected });
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/FormFields/DateRangePicker/DateRangePicker.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIvE,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,WAAW,IACpD,kBAAkB,CAAC,CAAC,CAAC,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB,CAAC;AAEJ,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,EACrD,OAAO,EACP,YAAY,EACZ,QAAgB,EAChB,KAAK,EACL,IAAI,EACJ,KAAa,EACb,UAAU,EACV,OAAe,EACf,QAAgB,EAChB,KAAK,GACN,EAAE,oBAAoB,CAAC,CAAC,CAAC,2CAkEzB"}
1
+ {"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/FormFields/DateRangePicker/DateRangePicker.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIvE,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,WAAW,IACpD,kBAAkB,CAAC,CAAC,CAAC,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB,CAAC;AAEJ,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,EACrD,OAAO,EACP,YAAY,EACZ,QAAgB,EAChB,KAAK,EACL,IAAI,EACJ,KAAa,EACb,UAAU,EACV,OAAe,EACf,QAAgB,EAChB,KAAK,GACN,EAAE,oBAAoB,CAAC,CAAC,CAAC,2CAkEzB"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DateRangePicker = DateRangePicker;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
+ const luxon_1 = require("luxon");
6
7
  const react_1 = require("react");
7
8
  const react_date_range_1 = require("react-date-range");
8
9
  const react_hook_form_1 = require("react-hook-form");
@@ -31,8 +32,8 @@ function DateRangePicker({ control, defaultValue, disabled = false, label, name,
31
32
  key: selectedRange.key,
32
33
  },
33
34
  ]);
34
- const startDate = new Date(selectedRange.startDate.toUTCString()).toISOString();
35
- const endDate = new Date(selectedRange.endDate.toUTCString()).toISOString();
35
+ const startDate = luxon_1.DateTime.fromJSDate(selectedRange.startDate).toISODate();
36
+ const endDate = luxon_1.DateTime.fromJSDate(selectedRange.endDate).toISODate();
36
37
  onChange([startDate, endDate]);
37
38
  }
38
39
  }, months: 1, direction: "horizontal", calendarFocus: "backwards", staticRanges: [], inputRanges: [], moveRangeOnFirstSelection: false, preventSnapRefocus: true }), error && (0, jsx_runtime_1.jsx)(material_1.Typography, { color: "red", children: helperText })] }));
@@ -0,0 +1,10 @@
1
+ import type { Control, FieldValues, Path, UseFormSetValue, UseFormWatch } from "react-hook-form";
2
+ type DateRangeSelectorProps<T extends FieldValues> = {
3
+ name: Path<T>;
4
+ watch: UseFormWatch<T>;
5
+ control: Control<T>;
6
+ setValue: UseFormSetValue<T>;
7
+ };
8
+ export declare function DateRangeSelector<T extends FieldValues>({ name, watch, control, setValue, }: Readonly<DateRangeSelectorProps<T>>): import("react/jsx-runtime").JSX.Element;
9
+ export {};
10
+ //# sourceMappingURL=DateRangeSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateRangeSelector.d.ts","sourceRoot":"","sources":["../../../src/FormFields/DateRangeSelector/DateRangeSelector.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,IAAI,EAEJ,eAAe,EACf,YAAY,EACb,MAAM,iBAAiB,CAAC;AAUzB,KAAK,sBAAsB,CAAC,CAAC,SAAS,WAAW,IAAI;IACnD,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACd,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;CAC9B,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,WAAW,EAAE,EACvD,IAAI,EACJ,KAAK,EACL,OAAO,EACP,QAAQ,GACT,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,2CAoFrC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DateRangeSelector = DateRangeSelector;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const MoreVert_1 = __importDefault(require("@mui/icons-material/MoreVert"));
9
+ const material_1 = require("@mui/material");
10
+ const luxon_1 = require("luxon");
11
+ const react_1 = require("react");
12
+ const PadBox_1 = require("../../PadBox");
13
+ const utils_1 = require("../../utils");
14
+ const DateRangePicker_1 = require("../DateRangePicker");
15
+ function DateRangeSelector({ name, watch, control, setValue, }) {
16
+ const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
17
+ const [showCustom, setShowCustom] = (0, react_1.useState)(false);
18
+ const dateField = watch(name);
19
+ function castDateRangeToPathValue(dateField) {
20
+ return dateField;
21
+ }
22
+ function setRange(days) {
23
+ if (!showCustom) {
24
+ const fromDate = luxon_1.DateTime.now()
25
+ .minus({ days: 1 + days })
26
+ .toISODate();
27
+ const toDate = luxon_1.DateTime.now().minus({ days: 1 }).toISODate();
28
+ setValue(name, castDateRangeToPathValue([fromDate, toDate]));
29
+ setAnchorEl(null);
30
+ }
31
+ }
32
+ const defaultRanges = [
33
+ { title: "Last 7 days", onClick: () => setRange(7) },
34
+ { title: "Last 14 days", onClick: () => setRange(14) },
35
+ { title: "Last 30 days", onClick: () => setRange(30) },
36
+ { title: "Custom", onClick: () => setShowCustom(true) },
37
+ ];
38
+ (0, react_1.useMemo)(() => {
39
+ if (showCustom && Array.isArray(dateField)) {
40
+ setValue(name, castDateRangeToPathValue(dateField));
41
+ }
42
+ }, [showCustom, name]);
43
+ function handleClick(event) {
44
+ setAnchorEl(event.currentTarget);
45
+ }
46
+ function handleClose() {
47
+ setAnchorEl(null);
48
+ setShowCustom(false);
49
+ }
50
+ return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "body2", children: [(0, utils_1.formatDate)(dateField[0] ?? "", "dd MMM yyyy"), " -", (0, utils_1.formatDate)(dateField[1] ?? "", "dd MMM yyyy")] }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { component: "div", onClick: handleClick, children: (0, jsx_runtime_1.jsx)(MoreVert_1.default, { fontSize: "small" }) }), !!anchorEl && ((0, jsx_runtime_1.jsx)(material_1.Popover, { open: true, anchorEl: anchorEl, onClose: handleClose, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: (0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "8px" }, children: showCustom ? ((0, jsx_runtime_1.jsx)(DateRangePicker_1.DateRangePicker, { name: name, control: control })) : (defaultRanges.map((item) => ((0, jsx_runtime_1.jsx)(material_1.ListItemButton, { sx: { width: "100%", textAlign: "center" }, onClick: item.onClick, children: item.title }, item.title)))) }) }))] }));
51
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./DateRangeSelector";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/FormFields/DateRangeSelector/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./DateRangeSelector"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"FileNames.d.ts","sourceRoot":"","sources":["../../../src/FormFields/FileUpload/FileNames.tsx"],"names":[],"mappings":"AAYA,KAAK,cAAc,GAAG;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,0CAIvB,cAAc,4CA8EhB,CAAC"}
1
+ {"version":3,"file":"FileNames.d.ts","sourceRoot":"","sources":["../../../src/FormFields/FileUpload/FileNames.tsx"],"names":[],"mappings":"AAYA,KAAK,cAAc,GAAG;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,0CAIvB,cAAc,4CA+EhB,CAAC"}
@@ -35,6 +35,6 @@ const FileNames = ({ fileNames, previewEnabled = false, onDelete, }) => {
35
35
  const dialogRenderer = {
36
36
  viewAttachment: selectedFile && ((0, jsx_runtime_1.jsx)(ViewFilePreviewDialog_1.ViewFilePreviewDialog, { open: openedDialog === "viewAttachment", onClose: onDialogClose, fileName: selectedFile })),
37
37
  };
38
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [names.map((name, index) => ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "5x", alignItems: "center", maxWidth: "80%", overflow: "hidden", children: [(0, jsx_runtime_1.jsx)(icons_material_1.AttachFile, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, { maxWidth: "100%", textOverflow: "clip", children: name })] }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", children: [previewEnabled && ((0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: () => fileNames[index] && handlePreviewClick(fileNames[index]), children: (0, jsx_runtime_1.jsx)(icons_material_1.VisibilityOutlined, {}) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: () => onDelete(index), children: (0, jsx_runtime_1.jsx)(DeleteOutlineOutlined_1.default, {}) })] })] }, (0, uuid_1.v4)()))), openedDialog && dialogRenderer[openedDialog]] }));
38
+ return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "5px", maxHeight: "120px", overflow: "auto", children: [names.map((name, index) => ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "5x", alignItems: "center", maxWidth: "80%", overflow: "hidden", children: [(0, jsx_runtime_1.jsx)(icons_material_1.AttachFile, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, { maxWidth: "100%", textOverflow: "clip", children: name })] }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", children: [previewEnabled && ((0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: () => fileNames[index] && handlePreviewClick(fileNames[index]), children: (0, jsx_runtime_1.jsx)(icons_material_1.VisibilityOutlined, {}) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: () => onDelete(index), children: (0, jsx_runtime_1.jsx)(DeleteOutlineOutlined_1.default, {}) })] })] }, (0, uuid_1.v4)()))), openedDialog && dialogRenderer[openedDialog]] }));
39
39
  };
40
40
  exports.FileNames = FileNames;
@@ -1,6 +1,7 @@
1
1
  export * from "./Autocomplete";
2
2
  export * from "./CheckBox";
3
3
  export * from "./DatePicker";
4
+ export * from "./DateRangeSelector";
4
5
  export * from "./DateRangePicker";
5
6
  export * from "./DateTimePicker";
6
7
  export * from "./FileUpload";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/FormFields/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/FormFields/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Autocomplete"), exports);
18
18
  __exportStar(require("./CheckBox"), exports);
19
19
  __exportStar(require("./DatePicker"), exports);
20
+ __exportStar(require("./DateRangeSelector"), exports);
20
21
  __exportStar(require("./DateRangePicker"), exports);
21
22
  __exportStar(require("./DateTimePicker"), exports);
22
23
  __exportStar(require("./FileUpload"), exports);
@@ -3,6 +3,7 @@ export * from "./date";
3
3
  export * from "./download";
4
4
  export * from "./file";
5
5
  export * from "./hooks/useDialogActions";
6
+ export * from "./regex";
6
7
  export * from "./theme/colorPaletteUI";
7
8
  export * from "./theme/theme";
8
9
  export * from "./urlToNestedObject";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,0BAA0B,CAAC;AACzC,cAAc,SAAS,CAAC;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC"}
@@ -19,6 +19,7 @@ __exportStar(require("./date"), exports);
19
19
  __exportStar(require("./download"), exports);
20
20
  __exportStar(require("./file"), exports);
21
21
  __exportStar(require("./hooks/useDialogActions"), exports);
22
+ __exportStar(require("./regex"), exports);
22
23
  __exportStar(require("./theme/colorPaletteUI"), exports);
23
24
  __exportStar(require("./theme/theme"), exports);
24
25
  __exportStar(require("./urlToNestedObject"), exports);
@@ -0,0 +1,3 @@
1
+ export declare const monthYearRegex: RegExp;
2
+ export declare const isoDateRegex: RegExp;
3
+ //# sourceMappingURL=regex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regex.d.ts","sourceRoot":"","sources":["../../src/utils/regex.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,QAAkB,CAAC;AAE9C,eAAO,MAAM,YAAY,QAAwB,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isoDateRegex = exports.monthYearRegex = void 0;
4
+ exports.monthYearRegex = /^\d{4}-\d{2}$/;
5
+ exports.isoDateRegex = /^\d{4}-\d{2}-\d{2}$/;