@dilicorp/ui 0.0.44 → 0.0.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.
@@ -4,7 +4,9 @@ export declare type SupportedDateFormat = 'dd/MM/yyyy';
4
4
  export declare type InputDatepickerProps = {
5
5
  value: string;
6
6
  name: string;
7
- onChange: (name: string, value: string) => void;
7
+ id?: string;
8
+ placeholder?: string;
9
+ onChange?: (name: string, value: string) => void;
8
10
  locale?: SupportedLanguages;
9
11
  dateFormat?: SupportedDateFormat;
10
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"input-datepicker.d.ts","sourceRoot":"","sources":["../../src/atoms/input-datepicker.tsx"],"names":[],"mappings":";AAQA,oBAAY,kBAAkB,GAAG,OAAO,GAAC,OAAO,GAAC,OAAO,GAAC,OAAO,CAAA;AAChE,oBAAY,mBAAmB,GAAG,YAAY,CAAA;AAO9C,oBAAY,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/C,MAAM,CAAC,EAAE,kBAAkB,CAAA;IAC3B,UAAU,CAAC,EAAE,mBAAmB,CAAA;CACjC,CAAA;AAGD,eAAO,MAAM,eAAe,UAAW,oBAAoB,gBAyC1D,CAAA"}
1
+ {"version":3,"file":"input-datepicker.d.ts","sourceRoot":"","sources":["../../src/atoms/input-datepicker.tsx"],"names":[],"mappings":";AAQA,oBAAY,kBAAkB,GAAG,OAAO,GAAC,OAAO,GAAC,OAAO,GAAC,OAAO,CAAA;AAChE,oBAAY,mBAAmB,GAAG,YAAY,CAAA;AAO9C,oBAAY,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAChD,MAAM,CAAC,EAAE,kBAAkB,CAAA;IAC3B,UAAU,CAAC,EAAE,mBAAmB,CAAA;CACjC,CAAA;AAGD,eAAO,MAAM,eAAe,UAAW,oBAAoB,gBA8C1D,CAAA"}
@@ -11,16 +11,16 @@ registerLocale('es-CO', es);
11
11
  registerLocale('en-US', en);
12
12
  // example use https://reactdatepicker.com
13
13
  export const InputDatepicker = (props) => {
14
- const { name, value, onChange, locale = 'pt-BR', dateFormat = 'dd/MM/yyyy' } = props;
14
+ const { name, id = name, value, onChange, locale = 'pt-BR', dateFormat = 'dd/MM/yyyy', placeholder = 'DD/MM/YYYY' } = props;
15
15
  const [date, setDate] = React.useState(dateHelper.stringToDate(value));
16
16
  const handleDateSelect = (currentDate) => {
17
17
  if (onChange) {
18
18
  onChange(name, dateHelper.dateToString(currentDate) || '');
19
- setDate(currentDate);
20
19
  }
20
+ setDate(currentDate);
21
21
  };
22
22
  const mask = [/\d/, /\d/, '/', /\d/, /\d/, '/', /\d/, /\d/, /\d/, /\d/];
23
- return (React.createElement(ReactDatePicker, { locale: locale, dateFormat: dateFormat, className: "form-control", selected: date, onChange: handleDateSelect, placeholderText: "DD/MM/YYYY",
23
+ return (React.createElement(ReactDatePicker, { name: name, id: id, locale: locale, dateFormat: dateFormat, className: "form-control", selected: date, onChange: handleDateSelect, placeholderText: placeholder, autoComplete: "off",
24
24
  // showMonthDropdown
25
25
  // useShortMonthInDropdown
26
26
  showYearDropdown: true, yearDropdownItemNumber: 5, scrollableYearDropdown: true, tabIndex: 2, customInput: React.createElement(MaskedTextInput, { type: "text", mask: mask }) }));
@@ -1,9 +1,12 @@
1
1
  import React from 'react';
2
+ import { SupportedDateFormat, SupportedLanguages } from '../../../atoms/input-datepicker';
2
3
  declare type FilterDatepickerProps = {
3
4
  name: string;
4
5
  id?: string;
5
6
  value?: string;
6
7
  placeholder?: string;
8
+ locale?: SupportedLanguages;
9
+ dateFormat?: SupportedDateFormat;
7
10
  };
8
11
  export declare const FilterDatepicker: React.FC<FilterDatepickerProps>;
9
12
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"filter-datepicker.d.ts","sourceRoot":"","sources":["../../../../src/components/page-list/filters/filter-datepicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,aAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA6B5D,CAAA"}
1
+ {"version":3,"file":"filter-datepicker.d.ts","sourceRoot":"","sources":["../../../../src/components/page-list/filters/filter-datepicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAmB,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAE1G,aAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,kBAAkB,CAAA;IAC3B,UAAU,CAAC,EAAE,mBAAmB,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAkB5D,CAAA"}
@@ -1,15 +1,10 @@
1
1
  import React from 'react';
2
- import Datepicker from 'react-datepicker';
3
- import dateHelper from '../../../utils/date-helper';
2
+ import { InputDatepicker } from '../../../atoms/input-datepicker';
4
3
  export const FilterDatepicker = (props) => {
5
- const { name, id = name, value, placeholder } = props;
6
- const [date, setDate] = React.useState(dateHelper.stringToDate(value));
7
- const handleChange = (currentDate) => {
8
- setDate(currentDate);
9
- };
4
+ const { name, id = name, value = '', placeholder } = props;
10
5
  return (React.createElement("div", { className: "form-group" },
11
6
  Boolean(placeholder) && React.createElement("label", { className: "form-label", htmlFor: name },
12
7
  placeholder,
13
8
  ":"),
14
- React.createElement(Datepicker, { name: name, id: id, placeholderText: placeholder, selected: date, locale: "pt_br", className: "form-control", dateFormat: "dd/MM/yyyy", autoComplete: "off", onChange: handleChange })));
9
+ React.createElement(InputDatepicker, Object.assign({}, props, { value: value, id: id }))));
15
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dilicorp/ui",
3
- "version": "0.0.44",
3
+ "version": "0.0.46",
4
4
  "description": "A simple UI design for Dilicorp",
5
5
  "repository": {
6
6
  "type": "git",