@akad/design-system 0.1.0-beta.4 → 0.1.0-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akad/design-system",
3
- "version": "0.1.0-beta.4",
3
+ "version": "0.1.0-beta.5",
4
4
  "main": "react/react.js",
5
5
  "types": "react/main.d.ts",
6
6
  "author": "Gabriel Mule <gabemule@gmail.com>",
@@ -1,3 +1,9 @@
1
+ import { MaskedOptions } from 'imask';
2
+
3
+ interface MaskedDynamic {
4
+ value: string;
5
+ compiledMasks: MaskedOptions[];
6
+ }
1
7
  declare const maskConfig: {
2
8
  currency: {
3
9
  mask: string;
@@ -26,5 +32,11 @@ declare const maskConfig: {
26
32
  maxLength: number;
27
33
  }[];
28
34
  };
35
+ 'phone-br': {
36
+ mask: {
37
+ mask: string;
38
+ }[];
39
+ dispatch: (appended: string, dynamicMasked: MaskedDynamic) => Partial<Pick<import('imask').Masked<any>, "mask" | "parent" | "prepare" | "prepareChar" | "validate" | "commit" | "format" | "parse" | "overwrite" | "eager" | "skipInvalid" | "autofix">>;
40
+ };
29
41
  };
30
42
  export default maskConfig;
@@ -1,3 +1,5 @@
1
1
  import { default as Ajv } from 'ajv';
2
2
 
3
3
  export declare const createAjvInstance: () => Ajv;
4
+ export declare function emailValidator(email: string): boolean;
5
+ export declare function phoneBrValidator(phone: string): boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -4029,7 +4029,7 @@ const Ua = {
4029
4029
  padFractionalZeros: !0,
4030
4030
  normalizeZeros: !1,
4031
4031
  radix: ",",
4032
- mapToRadix: ["."]
4032
+ mapToRadix: [","]
4033
4033
  }
4034
4034
  }
4035
4035
  }
@@ -4050,6 +4050,10 @@ const Ua = {
4050
4050
  // Tamanho máximo do CNPJ
4051
4051
  }
4052
4052
  ]
4053
+ },
4054
+ "phone-br": {
4055
+ mask: [{ mask: "(00) 0000-0000" }, { mask: "(00) 00000-0000" }],
4056
+ dispatch: (t, e) => (e.value + t).replace(/\D/g, "").length <= 10 ? e.compiledMasks[0] : e.compiledMasks[1]
4053
4057
  }
4054
4058
  }, Xa = {
4055
4059
  Top: "top",
@@ -5878,7 +5882,7 @@ const Dr = {
5878
5882
  required: !0
5879
5883
  }
5880
5884
  }
5881
- }, Lp = ({
5885
+ }, zp = ({
5882
5886
  length: t,
5883
5887
  current: e = Dr.props.current.default
5884
5888
  }) => {
@@ -6556,7 +6560,7 @@ const Si = {
6556
6560
  o && !s && o(d);
6557
6561
  };
6558
6562
  return /* @__PURE__ */ P("div", { className: l, id: n, onClick: () => c(a), children: i });
6559
- }, zp = ({
6563
+ }, qp = ({
6560
6564
  tabs: t,
6561
6565
  color: e,
6562
6566
  selectedTab: r = zt.props.selectedTab.default,
@@ -6728,7 +6732,7 @@ const ki = (t, e) => {
6728
6732
  } catch {
6729
6733
  return { isObj: !1, parsedObj: void 0 };
6730
6734
  }
6731
- }, qp = (t) => {
6735
+ }, Up = (t) => {
6732
6736
  const e = /^[0-9]+$/.test(t);
6733
6737
  if (t === "true" || t === "false")
6734
6738
  return JSON.parse(t);
@@ -11713,7 +11717,7 @@ const Rp = /* @__PURE__ */ hn(Pp), Wi = {
11713
11717
  },
11714
11718
  "phone-br": {
11715
11719
  type: "string",
11716
- validate: "/^[0-9]{11}$/"
11720
+ validate: xp
11717
11721
  },
11718
11722
  cpf: {
11719
11723
  type: "string",
@@ -11737,7 +11741,10 @@ const Rp = /* @__PURE__ */ hn(Pp), Wi = {
11737
11741
  ), t;
11738
11742
  };
11739
11743
  function Mp(t) {
11740
- return !!t.replace(/[^\w@.-]+/g, "").match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/);
11744
+ if (t.length > 254)
11745
+ return !1;
11746
+ const [e, r] = t.split("@");
11747
+ return !e || !r || e.length > 64 || e.startsWith(".") || e.endsWith(".") || e.includes("..") || !/^[a-zA-Z0-9!#$%&'+-/=?^_{|}~.]+$/.test(e) ? !1 : /^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\.[a-zA-Z]{2,}$/.test(r);
11741
11748
  }
11742
11749
  function jp(t) {
11743
11750
  return t = t.replace(/[^\d]+/g, ""), t.length == 11 ? gu(t) : t.length == 14 ? yu(t) : !1;
@@ -11766,7 +11773,13 @@ function yu(t) {
11766
11773
  a += Number(s.charAt(r - l)) * i--, i < 2 && (i = 9);
11767
11774
  return o = a % 11 < 2 ? 0 : 11 - a % 11, String(o) == n.charAt(1);
11768
11775
  }
11769
- const Up = ({
11776
+ function xp(t) {
11777
+ if (!t)
11778
+ return !1;
11779
+ const e = t.replace(/\D/g, ""), r = e.slice(0, 2), s = e.slice(2), n = /^[1-9]\d$/.test(r), i = !/^(\d)\1*$/.test(s) && (s.startsWith("9") && s.length === 9 || !s.startsWith("9") && s.length === 8 && /^[23457]/.test(s));
11780
+ return n && i;
11781
+ }
11782
+ const Hp = ({
11770
11783
  formSchema: t,
11771
11784
  initialValue: e = {}
11772
11785
  }) => {
@@ -12063,7 +12076,7 @@ const Up = ({
12063
12076
  ajv: E
12064
12077
  };
12065
12078
  };
12066
- function Hp(t) {
12079
+ function Kp(t) {
12067
12080
  const e = (n) => typeof window < "u" ? window.matchMedia(n).matches : !1, [r, s] = Z(e(t));
12068
12081
  return $e(() => {
12069
12082
  const n = window.matchMedia(t);
@@ -12075,7 +12088,7 @@ function Hp(t) {
12075
12088
  };
12076
12089
  }, [t]), r;
12077
12090
  }
12078
- const Kp = () => {
12091
+ const Gp = () => {
12079
12092
  const [t, e] = Z([]);
12080
12093
  function r(n) {
12081
12094
  const a = { ...n, id: Date.now().toString() };
@@ -12094,7 +12107,7 @@ const Kp = () => {
12094
12107
  addNotification: r,
12095
12108
  removeNotification: s
12096
12109
  };
12097
- }, Gp = (t = [], e = 0) => {
12110
+ }, Wp = (t = [], e = 0) => {
12098
12111
  const [r, s] = Z(e), [n, a] = Z(t), i = Ke(() => n.length - 1, [n]), o = Ke(
12099
12112
  () => r + 1 <= i && !n[r + 1].disabled,
12100
12113
  [r, i, n]
@@ -12190,7 +12203,7 @@ export {
12190
12203
  ro as DsHR,
12191
12204
  to as DsHeading,
12192
12205
  Ae as DsIcon,
12193
- Lp as DsIndicator,
12206
+ zp as DsIndicator,
12194
12207
  _o as DsInlineEditable,
12195
12208
  Ur as DsInput,
12196
12209
  fo as DsLoading,
@@ -12206,7 +12219,7 @@ export {
12206
12219
  fl as DsStepper,
12207
12220
  nl as DsSubtitle,
12208
12221
  pl as DsTable,
12209
- zp as DsTabs,
12222
+ qp as DsTabs,
12210
12223
  go as DsTextArea,
12211
12224
  Sr as DsTooltip,
12212
12225
  ko as DsTwoColumns,
@@ -12217,9 +12230,9 @@ export {
12217
12230
  wi as getSchemaProperties,
12218
12231
  _s as isEqual,
12219
12232
  _l as isValidObject,
12220
- qp as parseOptionValue,
12221
- Up as useForm,
12222
- Hp as useMediaQuery,
12223
- Kp as useNotification,
12224
- Gp as useStepper
12233
+ Up as parseOptionValue,
12234
+ Hp as useForm,
12235
+ Kp as useMediaQuery,
12236
+ Gp as useNotification,
12237
+ Wp as useStepper
12225
12238
  };