@oliasoft-open-source/react-ui-library 5.0.1 → 5.0.2-beta-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/dist/index.js CHANGED
@@ -27698,7 +27698,7 @@ function requireCookie() {
27698
27698
  }
27699
27699
  return new Date(Date.UTC(year, month, dayOfMonth, hour, minute, second));
27700
27700
  }
27701
- function formatDate(date2) {
27701
+ function formatDate2(date2) {
27702
27702
  validators2.validate(validators2.isDate(date2), date2);
27703
27703
  return date2.toUTCString();
27704
27704
  }
@@ -28109,7 +28109,7 @@ function requireCookie() {
28109
28109
  let str = this.cookieString();
28110
28110
  if (this.expires != Infinity) {
28111
28111
  if (this.expires instanceof Date) {
28112
- str += `; Expires=${formatDate(this.expires)}`;
28112
+ str += `; Expires=${formatDate2(this.expires)}`;
28113
28113
  } else {
28114
28114
  str += `; Expires=${this.expires}`;
28115
28115
  }
@@ -28700,7 +28700,7 @@ function requireCookie() {
28700
28700
  cookie.Store = Store;
28701
28701
  cookie.MemoryCookieStore = MemoryCookieStore;
28702
28702
  cookie.parseDate = parseDate;
28703
- cookie.formatDate = formatDate;
28703
+ cookie.formatDate = formatDate2;
28704
28704
  cookie.parse = parse2;
28705
28705
  cookie.fromJSON = fromJSON;
28706
28706
  cookie.domainMatch = domainMatch;
@@ -168886,6 +168886,68 @@ const SelectCell = ({
168886
168886
  }
168887
168887
  );
168888
168888
  };
168889
+ function formatDate(value, showTime) {
168890
+ if (!value) {
168891
+ return null;
168892
+ }
168893
+ const date2 = new Date(value);
168894
+ const formattedDate = date2.toLocaleDateString(void 0, {
168895
+ year: "numeric",
168896
+ month: "short",
168897
+ day: "2-digit",
168898
+ hour: showTime ? "2-digit" : void 0,
168899
+ minute: showTime ? "2-digit" : void 0
168900
+ });
168901
+ return formattedDate;
168902
+ }
168903
+ const Date$1 = (props) => {
168904
+ const { children, showTime } = props;
168905
+ const formattedDate = formatDate(children, showTime);
168906
+ return formattedDate;
168907
+ };
168908
+ const DateInput = (props) => {
168909
+ const { value, error: error2, tooltip: tooltip2 } = props;
168910
+ const stringValue = value;
168911
+ const tooltipText = value || error2 || tooltip2 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
168912
+ value && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Date$1, { children: stringValue }) }),
168913
+ (error2 || tooltip2) && /* @__PURE__ */ jsx("div", { children: error2 || tooltip2 })
168914
+ ] }) : null;
168915
+ return /* @__PURE__ */ jsx(Input$1, { type: "date", ...props, tooltip: tooltipText });
168916
+ };
168917
+ const DateInputCell = ({
168918
+ cell: cell2,
168919
+ columnAlignment,
168920
+ testId
168921
+ }) => {
168922
+ return /* @__PURE__ */ jsx(
168923
+ DateInput,
168924
+ {
168925
+ name: cell2.name,
168926
+ value: cell2.value,
168927
+ onChange: (ev) => {
168928
+ var _a2;
168929
+ return (_a2 = cell2.onChange) == null ? void 0 : _a2.call(cell2, ev);
168930
+ },
168931
+ onFocus: cell2.onFocus,
168932
+ onBlur: cell2.onBlur,
168933
+ onPaste: (ev) => {
168934
+ var _a2;
168935
+ return (_a2 = cell2.onPaste) == null ? void 0 : _a2.call(cell2, ev);
168936
+ },
168937
+ placeholder: cell2.placeholder,
168938
+ error: cell2.error,
168939
+ warning: cell2.warning,
168940
+ disabled: cell2.disabled,
168941
+ isInTable: true,
168942
+ maxTooltipWidth: cell2.maxTooltipWidth,
168943
+ right: columnAlignment === Align.RIGHT,
168944
+ selectOnFocus: cell2.selectOnFocus,
168945
+ testId,
168946
+ tabIndex: cell2.disabled ? -1 : 0,
168947
+ tooltip: cell2.tooltip
168948
+ }
168949
+ );
168950
+ };
168889
168951
  const InputCellWrapper = ({
168890
168952
  cell: cell2,
168891
168953
  columnAlignment,
@@ -168912,7 +168974,14 @@ const InputCellWrapper = ({
168912
168974
  columnAlignment,
168913
168975
  testId
168914
168976
  }
168915
- ) : cell2.type === "DateInput" ? /* @__PURE__ */ jsx(InputCell, { cell: cell2, testId, type: "date" }) : cell2.type === "Select" ? /* @__PURE__ */ jsx(
168977
+ ) : cell2.type === "DateInput" ? /* @__PURE__ */ jsx(
168978
+ DateInputCell,
168979
+ {
168980
+ cell: cell2,
168981
+ columnAlignment,
168982
+ testId
168983
+ }
168984
+ ) : cell2.type === "Select" ? /* @__PURE__ */ jsx(
168916
168985
  SelectCell,
168917
168986
  {
168918
168987
  cell: cell2,