@wrdagency/blockout 0.1.6 → 0.1.8

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 { FC, ReactNode } from 'react';
2
2
  export type CommonProps = {
3
- label?: string;
3
+ label?: ReactNode;
4
4
  className?: string;
5
- help?: string;
5
+ help?: ReactNode;
6
6
  prefix?: ReactNode;
7
7
  suffix?: ReactNode;
8
8
  required?: boolean;
@@ -1,35 +1,35 @@
1
1
  import { jsx as x } from "react/jsx-runtime";
2
2
  import { forwardRef as V } from "react";
3
- import { parseDateString as f, getComponentMaxValue as v, getComponentMinValue as D, getComponentMaxLength as M, getComponentPlaceholder as w, formatDateString as F } from "./types.js";
4
- const j = V((r, m) => {
3
+ import { parseDateString as f, getComponentMaxValue as v, getComponentMinValue as D, getComponentMaxLength as M, getComponentPlaceholder as w, getComponentAutocomplete as F, formatDateString as L } from "./types.js";
4
+ const A = V((m, r) => {
5
5
  const {
6
6
  component: e,
7
7
  dataFormat: t,
8
- viewFormat: L,
8
+ viewFormat: P,
9
9
  value: p,
10
10
  onChangeValue: l,
11
11
  autoComplete: u,
12
12
  ...c
13
- } = r, n = f(p, t), s = n[e], i = w(e), o = D(e), a = v(e), g = M(e), C = (d) => {
13
+ } = m, o = f(p, t), s = o[e], i = w(e), n = D(e), a = v(e), g = M(e), C = (d) => {
14
14
  const h = {
15
- ...n,
15
+ ...o,
16
16
  [e]: d.currentTarget.value
17
17
  };
18
- l(F(h, t));
18
+ l(L(h, t));
19
19
  };
20
20
  return /* @__PURE__ */ x(
21
21
  "input",
22
22
  {
23
- ref: m,
23
+ ref: r,
24
24
  value: s,
25
25
  className: "component-date-control__input",
26
26
  inputMode: "numeric",
27
- autoComplete: u + "-" + e,
27
+ autoComplete: F(u, e),
28
28
  placeholder: i,
29
29
  step: 1,
30
30
  maxLength: g,
31
- "aria-valuemin": o,
32
- min: o,
31
+ "aria-valuemin": n,
32
+ min: n,
33
33
  max: a,
34
34
  "aria-valuemax": a,
35
35
  onChange: C,
@@ -38,5 +38,5 @@ const j = V((r, m) => {
38
38
  );
39
39
  });
40
40
  export {
41
- j as DateComponentInput
41
+ A as DateComponentInput
42
42
  };
@@ -12,3 +12,4 @@ export declare function getComponentMaxLength(component: DateComponent): 4 | 2;
12
12
  export declare function getComponentMinValue(component: DateComponent): 1 | 0 | 1900;
13
13
  export declare function getComponentMaxValue(component: DateComponent): 12 | 31 | 99 | 3000;
14
14
  export declare function getComponentPlaceholder(component: DateComponent): "DD" | "MM" | "YY" | "YYYY";
15
+ export declare function getComponentAutocomplete(prefix: string | undefined, component: DateComponent): string;
@@ -1,32 +1,32 @@
1
- function i() {
1
+ function l() {
2
2
  return {
3
3
  components: ["fullYear", "month", "day"],
4
4
  separator: "-"
5
5
  };
6
6
  }
7
- function l(e, r) {
8
- const { separator: n, components: a } = r, u = (e || "").split(n);
7
+ function i(e, t) {
8
+ const { separator: n, components: a } = t, u = (e || "").split(n);
9
9
  return a.reduce(
10
- (t, o, c) => ({
11
- ...t,
10
+ (r, o, c) => ({
11
+ ...r,
12
12
  [o]: u[c]
13
13
  }),
14
14
  {}
15
15
  );
16
16
  }
17
- function f(e, r) {
18
- const { separator: n, components: a } = r, u = /\D/g;
19
- return a.map(function(t) {
20
- return (e[t] || "").replace(u, "").substring(0, s(t));
17
+ function f(e, t) {
18
+ const { separator: n, components: a } = t, u = /\D/g;
19
+ return a.map(function(r) {
20
+ return (e[r] || "").replace(u, "").substring(0, s(r));
21
21
  }).join(n);
22
22
  }
23
23
  function s(e) {
24
24
  return e === "fullYear" ? 4 : 2;
25
25
  }
26
- function p(e) {
26
+ function m(e) {
27
27
  return e === "year" ? 0 : e === "fullYear" ? 1900 : 1;
28
28
  }
29
- function g(e) {
29
+ function p(e) {
30
30
  switch (e) {
31
31
  case "day":
32
32
  return 31;
@@ -38,7 +38,7 @@ function g(e) {
38
38
  return 3e3;
39
39
  }
40
40
  }
41
- function m(e) {
41
+ function g(e) {
42
42
  switch (e) {
43
43
  case "day":
44
44
  return "DD";
@@ -50,12 +50,25 @@ function m(e) {
50
50
  return "YYYY";
51
51
  }
52
52
  }
53
+ function Y(e, t) {
54
+ switch (t) {
55
+ case "day":
56
+ return `${e}-day`;
57
+ case "month":
58
+ return `${e}-month`;
59
+ case "year":
60
+ return `${e}-year`;
61
+ case "fullYear":
62
+ return `${e}-year`;
63
+ }
64
+ }
53
65
  export {
54
66
  f as formatDateString,
67
+ Y as getComponentAutocomplete,
55
68
  s as getComponentMaxLength,
56
- g as getComponentMaxValue,
57
- p as getComponentMinValue,
58
- m as getComponentPlaceholder,
59
- i as getDefaultFormat,
60
- l as parseDateString
69
+ p as getComponentMaxValue,
70
+ m as getComponentMinValue,
71
+ g as getComponentPlaceholder,
72
+ l as getDefaultFormat,
73
+ i as parseDateString
61
74
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrdagency/blockout",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "A React component library created by WRD.agency",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",