@trackunit/react-form-components 0.0.15 → 0.0.18-alpha-47c0e3bbca.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.
Files changed (3) hide show
  1. package/index.cjs +3 -6
  2. package/index.js +3 -6
  3. package/package.json +4 -4
package/index.cjs CHANGED
@@ -286,12 +286,9 @@ const CheckboxWrapper = tailwindStyledComponents.tw.span `
286
286
  const DateInput = React.forwardRef((_a, ref) => {
287
287
  var { min, max, defaultValue, value } = _a, rest = __rest(_a, ["min", "max", "defaultValue", "value"]);
288
288
  const formatDateToInputString = (date) => date instanceof Date ? dateFns.format(date, "yyyy-MM-dd") : date;
289
- // @ts-ignore
290
- // Chrome needs it's default icon to have datepicker functionality.
291
- // window.chrome doesn't exist in TS but is available on chrome browsers.
292
- // If it fails it will just show our icon.
293
- const hideOnChrome = () => (window.chrome !== null && typeof window.chrome !== "undefined" ? "hidden" : "");
294
- return (jsxRuntime.jsx(BaseInput, Object.assign({ type: "date", value: formatDateToInputString(value), defaultValue: formatDateToInputString(defaultValue), min: formatDateToInputString(min), max: formatDateToInputString(max), ref: ref, suffix: jsxRuntime.jsx(reactComponents.Icon, { dataTestId: "calendar", name: "CalendarIcon", size: "medium", type: "solid", className: hideOnChrome() }) }, rest)));
289
+ // Chrome and Firefox need their default icon to have datepicker functionality.
290
+ const showIcon = !/Chrome/.test(navigator.userAgent) && !/Firefox/.test(navigator.userAgent);
291
+ return (jsxRuntime.jsx(BaseInput, Object.assign({ type: "date", value: formatDateToInputString(value), defaultValue: formatDateToInputString(defaultValue), min: formatDateToInputString(min), max: formatDateToInputString(max), ref: ref, suffix: showIcon && jsxRuntime.jsx(reactComponents.Icon, { dataTestId: "calendar", name: "CalendarIcon", size: "medium", type: "solid" }) }, rest)));
295
292
  });
296
293
 
297
294
  /**
package/index.js CHANGED
@@ -256,12 +256,9 @@ const CheckboxWrapper = tw.span `
256
256
  const DateInput = forwardRef((_a, ref) => {
257
257
  var { min, max, defaultValue, value } = _a, rest = __rest(_a, ["min", "max", "defaultValue", "value"]);
258
258
  const formatDateToInputString = (date) => date instanceof Date ? format(date, "yyyy-MM-dd") : date;
259
- // @ts-ignore
260
- // Chrome needs it's default icon to have datepicker functionality.
261
- // window.chrome doesn't exist in TS but is available on chrome browsers.
262
- // If it fails it will just show our icon.
263
- const hideOnChrome = () => (window.chrome !== null && typeof window.chrome !== "undefined" ? "hidden" : "");
264
- return (jsx(BaseInput, Object.assign({ type: "date", value: formatDateToInputString(value), defaultValue: formatDateToInputString(defaultValue), min: formatDateToInputString(min), max: formatDateToInputString(max), ref: ref, suffix: jsx(Icon, { dataTestId: "calendar", name: "CalendarIcon", size: "medium", type: "solid", className: hideOnChrome() }) }, rest)));
259
+ // Chrome and Firefox need their default icon to have datepicker functionality.
260
+ const showIcon = !/Chrome/.test(navigator.userAgent) && !/Firefox/.test(navigator.userAgent);
261
+ return (jsx(BaseInput, Object.assign({ type: "date", value: formatDateToInputString(value), defaultValue: formatDateToInputString(defaultValue), min: formatDateToInputString(min), max: formatDateToInputString(max), ref: ref, suffix: showIcon && jsx(Icon, { dataTestId: "calendar", name: "CalendarIcon", size: "medium", type: "solid" }) }, rest)));
265
262
  });
266
263
 
267
264
  /**
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@trackunit/react-form-components",
3
- "version": "0.0.15",
3
+ "version": "0.0.18-alpha-47c0e3bbca.0",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "dependencies": {
7
- "@trackunit/i18n-library-translation": "0.0.42",
8
- "@trackunit/react-components": "0.1.82",
9
- "@trackunit/tailwind-styled-components": "0.0.55",
7
+ "@trackunit/i18n-library-translation": "0.0.44-alpha-47c0e3bbca.0",
8
+ "@trackunit/react-components": "0.1.83-alpha-47c0e3bbca.0",
9
+ "@trackunit/tailwind-styled-components": "0.0.56-alpha-47c0e3bbca.0",
10
10
  "date-fns": "2.29.3",
11
11
  "libphonenumber-js": "1.10.26",
12
12
  "react": "18.2.0",