@commercelayer/app-elements 0.0.3 → 0.0.5

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.
@@ -1,8 +1,8 @@
1
1
  import * as de from "react";
2
2
  import le, { useRef as W, useState as a, useEffect as z, useCallback as B, forwardRef as ce } from "react";
3
- import { _ as ve, a as s, h as Oe, b as O, c as Se, u as _e, S as he, d as me, s as ge } from "./overrides-679fa915.js";
3
+ import { _ as ve, a as s, h as Oe, b as O, c as Se, u as _e, S as he, d as me, s as ge } from "./overrides-224cfb45.js";
4
4
  import "react-dom";
5
- import "./main-e7c75433.js";
5
+ import "./main-79e44ba7.js";
6
6
  import "@commercelayer/sdk";
7
7
  var ye = ["defaultOptions", "cacheOptions", "loadOptions", "options", "isLoading", "onInputChange", "filterOption"];
8
8
  function Ce(t) {
@@ -1,6 +1,6 @@
1
1
  import * as Y from "react";
2
2
  import h, { forwardRef as Gi, createElement as Yu, Component as Lu, createRef as Au } from "react";
3
- import { I as ju, r as Bu, a as O, b as Zi, t as L, c as D, g as Io, d as fn, e as Fu, s as pn, f as Ji, h as Hu, i as Wu, j as Uu, l as aa, k as qu, m as ia, n as Vu, o as Ku, p as J, q as eu, u as Qu, v as ua, w as zu, x as Xu, X as Gu } from "./main-e7c75433.js";
3
+ import { I as ju, r as Bu, a as O, b as Zi, t as L, c as D, g as Io, d as fn, e as Fu, s as pn, f as Ji, h as Hu, i as Wu, j as Uu, l as aa, k as qu, m as ia, n as Vu, o as Ku, p as J, q as eu, u as Qu, v as ua, w as zu, x as Xu, X as Gu } from "./main-79e44ba7.js";
4
4
  import * as Zu from "react-dom";
5
5
  import Ju, { findDOMNode as es } from "react-dom";
6
6
  import "@commercelayer/sdk";
@@ -7654,34 +7654,43 @@ const Ry = Gi(
7654
7654
  ...y
7655
7655
  }, m) => {
7656
7656
  const v = r ?? Cy();
7657
- return /* @__PURE__ */ h.createElement(zu, { ...y, className: o }, /* @__PURE__ */ h.createElement("div", { className: "relative" }, /* @__PURE__ */ h.createElement(
7658
- Ey,
7657
+ return /* @__PURE__ */ h.createElement(
7658
+ zu,
7659
7659
  {
7660
- ref: m,
7661
- selected: e,
7662
- onChange: t,
7663
- dateFormat: v,
7664
- placeholderText: s === !0 ? v.toLowerCase() : a,
7665
- minDate: i,
7666
- openToDate: e ?? i,
7667
- className: J(
7668
- "block w-full px-4 py-2 h-10 placeholder:text-gray-400 font-medium",
7669
- "rounded outline-0",
7670
- "transition duration-500 ease-in-out focus:outline-0 focus:border-primary-light",
7671
- Xu(d),
7672
- n
7673
- )
7674
- }
7675
- ), /* @__PURE__ */ h.createElement("div", { className: "absolute top-0 bottom-0 right-4 flex items-center pointer-events-none touch-none" }, /* @__PURE__ */ h.createElement(rs, null)), e != null && c === !0 ? /* @__PURE__ */ h.createElement(
7676
- "button",
7677
- {
7678
- className: "absolute top-0 bottom-0 right-11 flex items-center",
7679
- onClick: () => {
7680
- t(null);
7681
- }
7660
+ ...y,
7661
+ className: o,
7662
+ hint: l,
7663
+ label: u
7682
7664
  },
7683
- /* @__PURE__ */ h.createElement(Gu, null)
7684
- ) : null));
7665
+ /* @__PURE__ */ h.createElement("div", { className: "relative" }, /* @__PURE__ */ h.createElement(
7666
+ Ey,
7667
+ {
7668
+ ref: m,
7669
+ selected: e,
7670
+ onChange: t,
7671
+ dateFormat: v,
7672
+ placeholderText: s === !0 ? v.toLowerCase() : a,
7673
+ minDate: i,
7674
+ openToDate: e ?? i,
7675
+ className: J(
7676
+ "block w-full px-4 py-2.5 placeholder:text-gray-400 font-medium",
7677
+ "rounded outline-0",
7678
+ "transition duration-500 ease-in-out focus:outline-0 focus:border-primary-light",
7679
+ Xu(d),
7680
+ n
7681
+ )
7682
+ }
7683
+ ), /* @__PURE__ */ h.createElement("div", { className: "absolute top-0 bottom-0 right-4 flex items-center pointer-events-none touch-none" }, /* @__PURE__ */ h.createElement(rs, null)), e != null && c === !0 ? /* @__PURE__ */ h.createElement(
7684
+ "button",
7685
+ {
7686
+ className: "absolute top-0 bottom-0 right-11 flex items-center",
7687
+ onClick: () => {
7688
+ t(null);
7689
+ }
7690
+ },
7691
+ /* @__PURE__ */ h.createElement(Gu, null)
7692
+ ) : null)
7693
+ );
7685
7694
  }
7686
7695
  );
7687
7696
  Ry.displayName = "InputDateComponent";
@@ -1,8 +1,8 @@
1
1
  import * as r from "react";
2
2
  import a, { forwardRef as s } from "react";
3
- import { u as m, S as c, d as p, s as i } from "./overrides-679fa915.js";
3
+ import { u as m, S as c, d as p, s as i } from "./overrides-224cfb45.js";
4
4
  import "react-dom";
5
- import "./main-e7c75433.js";
5
+ import "./main-79e44ba7.js";
6
6
  import "@commercelayer/sdk";
7
7
  var l = /* @__PURE__ */ s(function(e, t) {
8
8
  var o = m(e);
@@ -1,18 +1,37 @@
1
- /**
2
- * Format the date as nice string
3
- * @returns a nice string representation. Example: 'Jul 21, 2022' or 'Jul 21, 2022 · 1:16 PM' if includeTime
4
- */
5
- export declare function formatDate({ isoDate, includeTime, timezone }: {
1
+ declare type Format = 'full' | 'noTime' | 'noYear';
2
+ declare type FormatDateOptions = {
6
3
  /**
7
4
  * JavaScript ISO date string. Example '2022-10-06T11:59:30.371Z'
8
5
  */
9
6
  isoDate?: string;
10
- /**
11
- * Boolean value to include time in returned string: Example: 'Oct 26, 2022 · 4:16 PM'
12
- */
13
- includeTime?: boolean;
14
7
  /**
15
8
  * Set a specific timezone, when not passed default value is 'UTC'
16
9
  */
17
10
  timezone?: string;
18
- }): string;
11
+ } & ({
12
+ /**
13
+ * How to format the date:
14
+ * - full `Feb 28, 2023 · 5:30 PM`
15
+ * - noTime `Feb 28, 2023`
16
+ * - noYear `Feb 28`
17
+ * @default noTime
18
+ */
19
+ format?: Format;
20
+ } | {
21
+ /**
22
+ * When set as `custom` a `customTemplate` is required
23
+ */
24
+ format: 'custom';
25
+ /**
26
+ * Custom template to override the default one ('LLL dd, yyyy').
27
+ * @link https://date-fns.org/v2.29.3/docs/format
28
+ */
29
+ customTemplate: string;
30
+ });
31
+ /**
32
+ * Format the date as nice string also specifying a custom timezone
33
+ * @param opts a set of `FormatDateOptions`
34
+ * @returns a nice string representation. Example: 'Jul 21, 2022' or 'Jul 21, 2022 · 1:16 PM' if includeTime
35
+ */
36
+ export declare function formatDate({ isoDate, timezone, ...opts }: FormatDateOptions): string;
37
+ export {};