@grazziotin/react-components-next 1.0.1 → 2.1.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.
- package/dist/accessibility/index.d.mts +136 -0
- package/dist/accessibility/index.d.ts +136 -0
- package/dist/accessibility/index.js +138 -0
- package/dist/accessibility/index.js.map +1 -0
- package/dist/accessibility/index.mjs +127 -0
- package/dist/accessibility/index.mjs.map +1 -0
- package/dist/{chunk-4DIPDYEU.mjs → chunk-BWW3F4R4.mjs} +42 -3
- package/dist/chunk-BWW3F4R4.mjs.map +1 -0
- package/dist/functions/index.d.mts +36 -1
- package/dist/functions/index.d.ts +36 -1
- package/dist/functions/index.js +36 -0
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/ui/index.d.mts +210 -4
- package/dist/ui/index.d.ts +210 -4
- package/dist/ui/index.js +500 -0
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +888 -2
- package/dist/ui/index.mjs.map +1 -1
- package/package.json +8 -9
- package/dist/chunk-4DIPDYEU.mjs.map +0 -1
- package/dist/chunk-XNWAGZVV.mjs +0 -467
- package/dist/chunk-XNWAGZVV.mjs.map +0 -1
- package/dist/index.d.mts +0 -10
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -582
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -29
- package/dist/index.mjs.map +0 -1
|
@@ -35,4 +35,39 @@ declare function formatCpfCnpj(data?: string): string;
|
|
|
35
35
|
*/
|
|
36
36
|
declare function formatPhoneBr(phone?: string): string;
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Formata um valor como moeda brasileira (BRL).
|
|
40
|
+
*
|
|
41
|
+
* - **string** — máscara de input: remove não dígitos, divide por 100 (centavos)
|
|
42
|
+
* - **number** — valor já em reais
|
|
43
|
+
*
|
|
44
|
+
* @param value - Valor digitado ou numérico em reais
|
|
45
|
+
* @returns Valor formatado (ex.: `R$ 1.234,56`) ou string vazia se ausente
|
|
46
|
+
* @example
|
|
47
|
+
* formatPriceBrl("123456") // "R$ 1.234,56" (input)
|
|
48
|
+
* formatPriceBrl(1234.56) // "R$ 1.234,56" (número)
|
|
49
|
+
* formatPriceBrl(0) // "R$ 0,00"
|
|
50
|
+
*/
|
|
51
|
+
declare function formatPriceBrl(value?: string | number | null): string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Formata máscara de item 170 (até 12 dígitos) no padrão `00.00.00.00.0.000`.
|
|
55
|
+
* Remove caracteres não numéricos antes de formatar.
|
|
56
|
+
* @param item - Valor com ou sem formatação
|
|
57
|
+
* @returns Item formatado ou string vazia se ausente
|
|
58
|
+
* @example
|
|
59
|
+
* formatItem170("123456789012") // "12.34.56.78.9.012"
|
|
60
|
+
*/
|
|
61
|
+
declare function formatItem170(item?: string): string;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Formata máscara de item 150 (até 10 dígitos) no padrão `00.00.00.0.000`.
|
|
65
|
+
* Remove caracteres não numéricos antes de formatar.
|
|
66
|
+
* @param item - Valor com ou sem formatação
|
|
67
|
+
* @returns Item formatado ou string vazia se ausente
|
|
68
|
+
* @example
|
|
69
|
+
* formatItem150("1234567890") // "12.34.56.7.890"
|
|
70
|
+
*/
|
|
71
|
+
declare function formatItem150(item?: string): string;
|
|
72
|
+
|
|
73
|
+
export { cn, formatCpfCnpj, formatItem150, formatItem170, formatPhoneBr, formatPriceBrl, nvl };
|
|
@@ -35,4 +35,39 @@ declare function formatCpfCnpj(data?: string): string;
|
|
|
35
35
|
*/
|
|
36
36
|
declare function formatPhoneBr(phone?: string): string;
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Formata um valor como moeda brasileira (BRL).
|
|
40
|
+
*
|
|
41
|
+
* - **string** — máscara de input: remove não dígitos, divide por 100 (centavos)
|
|
42
|
+
* - **number** — valor já em reais
|
|
43
|
+
*
|
|
44
|
+
* @param value - Valor digitado ou numérico em reais
|
|
45
|
+
* @returns Valor formatado (ex.: `R$ 1.234,56`) ou string vazia se ausente
|
|
46
|
+
* @example
|
|
47
|
+
* formatPriceBrl("123456") // "R$ 1.234,56" (input)
|
|
48
|
+
* formatPriceBrl(1234.56) // "R$ 1.234,56" (número)
|
|
49
|
+
* formatPriceBrl(0) // "R$ 0,00"
|
|
50
|
+
*/
|
|
51
|
+
declare function formatPriceBrl(value?: string | number | null): string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Formata máscara de item 170 (até 12 dígitos) no padrão `00.00.00.00.0.000`.
|
|
55
|
+
* Remove caracteres não numéricos antes de formatar.
|
|
56
|
+
* @param item - Valor com ou sem formatação
|
|
57
|
+
* @returns Item formatado ou string vazia se ausente
|
|
58
|
+
* @example
|
|
59
|
+
* formatItem170("123456789012") // "12.34.56.78.9.012"
|
|
60
|
+
*/
|
|
61
|
+
declare function formatItem170(item?: string): string;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Formata máscara de item 150 (até 10 dígitos) no padrão `00.00.00.0.000`.
|
|
65
|
+
* Remove caracteres não numéricos antes de formatar.
|
|
66
|
+
* @param item - Valor com ou sem formatação
|
|
67
|
+
* @returns Item formatado ou string vazia se ausente
|
|
68
|
+
* @example
|
|
69
|
+
* formatItem150("1234567890") // "12.34.56.7.890"
|
|
70
|
+
*/
|
|
71
|
+
declare function formatItem150(item?: string): string;
|
|
72
|
+
|
|
73
|
+
export { cn, formatCpfCnpj, formatItem150, formatItem170, formatPhoneBr, formatPriceBrl, nvl };
|
package/dist/functions/index.js
CHANGED
|
@@ -46,9 +46,45 @@ function formatPhoneBr(phone) {
|
|
|
46
46
|
return digits.replace(/(\d{2})(\d{5})(\d+)/, "($1) $2-$3");
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
// src/functions/format-price-brl/format-price-brl.ts
|
|
50
|
+
function formatPriceBrl(value) {
|
|
51
|
+
if (value === void 0 || value === null) return "";
|
|
52
|
+
if (typeof value === "string") {
|
|
53
|
+
const digits = removeDigits(value);
|
|
54
|
+
if (!digits) return "";
|
|
55
|
+
const price = Number(digits) / 100;
|
|
56
|
+
if (Number.isNaN(price)) return "";
|
|
57
|
+
return price.toLocaleString("pt-BR", {
|
|
58
|
+
style: "currency",
|
|
59
|
+
currency: "BRL"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (Number.isNaN(value)) return "";
|
|
63
|
+
return value.toLocaleString("pt-BR", { style: "currency", currency: "BRL" });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/functions/format-item-170/format-item-170.ts
|
|
67
|
+
function formatItem170(item) {
|
|
68
|
+
if (!item) return "";
|
|
69
|
+
const digits = removeDigits(item).slice(0, 12);
|
|
70
|
+
if (!digits) return "";
|
|
71
|
+
return digits.replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{2})\.(\d)(\d{1,3})$/, "$1.$2.$3");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// src/functions/format-item-150/format-item-150.ts
|
|
75
|
+
function formatItem150(item) {
|
|
76
|
+
if (!item) return "";
|
|
77
|
+
const digits = removeDigits(item).slice(0, 10);
|
|
78
|
+
if (!digits) return "";
|
|
79
|
+
return digits.replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{2})\.(\d)(\d{1,3})$/, "$1.$2.$3");
|
|
80
|
+
}
|
|
81
|
+
|
|
49
82
|
exports.cn = cn;
|
|
50
83
|
exports.formatCpfCnpj = formatCpfCnpj;
|
|
84
|
+
exports.formatItem150 = formatItem150;
|
|
85
|
+
exports.formatItem170 = formatItem170;
|
|
51
86
|
exports.formatPhoneBr = formatPhoneBr;
|
|
87
|
+
exports.formatPriceBrl = formatPriceBrl;
|
|
52
88
|
exports.nvl = nvl;
|
|
53
89
|
//# sourceMappingURL=index.js.map
|
|
54
90
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/functions/cn/cn.ts","../../src/functions/nvl/nvl.ts","../../src/core/remove-digits.ts","../../src/functions/format-cpf-cnpj/format-cpf-cnpj.ts","../../src/functions/format-phone-br/format-phone-br.ts"],"names":["twMerge","clsx"],"mappings":";;;;;;AAIO,SAAS,MAAM,MAAA,EAA8B;AAClD,EAAA,OAAOA,qBAAA,CAAQC,SAAA,CAAK,MAAM,CAAC,CAAA;AAC7B;;;ACIO,SAAS,GAAA,CAAO,OAA6B,YAAA,EAAoB;AACtE,EAAA,OAAO,KAAA,IAAA,IAAA,GAAA,KAAA,GAAS,YAAA;AAClB;;;ACXO,SAAS,aAAa,KAAA,EAAuB;AAClD,EAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAA;AAChC;;;ACOO,SAAS,cAAc,IAAA,EAAuB;AACnD,EAAA,IAAI,CAAC,MAAM,OAAO,EAAA;AAClB,EAAA,MAAM,KAAA,GAAQ,aAAa,IAAI,CAAA;AAE/B,EAAA,IAAI,CAAC,OAAO,OAAO,EAAA;AACnB,EAAA,IAAI,KAAA,CAAM,UAAU,EAAA,EAAI;AACtB,IAAA,MAAM,GAAA,GAAM,KAAA,CAAM,KAAA,CAAM,CAAA,EAAG,EAAE,CAAA;AAC7B,IAAA,OAAO,GAAA,CACJ,OAAA,CAAQ,aAAA,EAAe,OAAO,CAAA,CAC9B,OAAA,CAAQ,aAAA,EAAe,OAAO,CAAA,CAC9B,OAAA,CAAQ,mBAAA,EAAqB,OAAO,CAAA;AAAA,EACzC;AAEA,EAAA,MAAM,IAAA,GAAO,KAAA,CAAM,KAAA,CAAM,CAAA,EAAG,EAAE,CAAA;AAC9B,EAAA,OAAO,IAAA,CACJ,OAAA,CAAQ,cAAA,EAAgB,OAAO,EAC/B,OAAA,CAAQ,uBAAA,EAAyB,UAAU,CAAA,CAC3C,QAAQ,eAAA,EAAiB,QAAQ,CAAA,CACjC,OAAA,CAAQ,eAAe,OAAO,CAAA;AACnC;;;ACnBO,SAAS,cAAc,KAAA,EAAwB;AACpD,EAAA,IAAI,CAAC,OAAO,OAAO,EAAA;AACnB,EAAA,MAAM,SAAS,YAAA,CAAa,KAAK,CAAA,CAAE,KAAA,CAAM,GAAG,EAAE,CAAA;AAE9C,EAAA,IAAI,CAAC,QAAQ,OAAO,EAAA;AACpB,EAAA,IAAI,MAAA,CAAO,MAAA,IAAU,CAAA,EAAG,OAAO,MAAA;AAC/B,EAAA,IAAI,MAAA,CAAO,UAAU,CAAA,EAAG;AACtB,IAAA,OAAO,MAAA,CAAO,OAAA,CAAQ,cAAA,EAAgB,SAAS,CAAA;AAAA,EACjD;AACA,EAAA,IAAI,MAAA,CAAO,UAAU,EAAA,EAAI;AACvB,IAAA,OAAO,MAAA,CAAO,OAAA,CAAQ,qBAAA,EAAuB,YAAY,CAAA;AAAA,EAC3D;AACA,EAAA,OAAO,MAAA,CAAO,OAAA,CAAQ,qBAAA,EAAuB,YAAY,CAAA;AAC3D","file":"index.js","sourcesContent":["import { twMerge } from \"tailwind-merge\";\r\nimport { clsx } from \"clsx\";\r\nimport type { ClassValue } from \"./utils/interfaces\";\r\n\r\nexport function cn(...values: ClassValue[]): string {\r\n return twMerge(clsx(values));\r\n}\r\n","/**\r\n * Função NVL (Null Value Logic) - retorna valor padrão se o valor for null/undefined\r\n * @param {T | null | undefined} value - Valor a ser verificado\r\n * @param {T} defaultValue - Valor padrão a ser retornado se value for null/undefined\r\n * @returns {T} Value se não for null/undefined, senão defaultValue\r\n * @template T - Tipo do valor\r\n * @example\r\n * nvl(null, 'padrão') // Retorna: 'padrão'\r\n * nvl('valor', 'padrão') // Retorna: 'valor'\r\n */\r\nexport function nvl<T>(value: T | null | undefined, defaultValue: T): T {\r\n return value ?? defaultValue;\r\n}\r\n","/** Remove tudo que não for dígito. */\r\nexport function removeDigits(value: string): string {\r\n return value.replace(/\\D/g, \"\");\r\n}\r\n","import { removeDigits } from \"../../core/remove-digits\";\r\n\r\n/**\r\n * Formata CPF (até 11 dígitos) ou CNPJ (12–14 dígitos) conforme o tamanho.\r\n * @param data - Valor com ou sem formatação\r\n * @returns CPF `000.000.000-00` ou CNPJ `00.000.000/0000-00`; string vazia se ausente\r\n * @example\r\n * formatCpfCnpj(\"12345678901\") // \"123.456.789-01\"\r\n * formatCpfCnpj(\"12345678000199\") // \"12.345.678/0001-99\"\r\n */\r\nexport function formatCpfCnpj(data?: string): string {\r\n if (!data) return \"\";\r\n const value = removeDigits(data);\r\n\r\n if (!value) return \"\";\r\n if (value.length <= 11) {\r\n const cpf = value.slice(0, 11);\r\n return cpf\r\n .replace(/(\\d{3})(\\d)/, \"$1.$2\")\r\n .replace(/(\\d{3})(\\d)/, \"$1.$2\")\r\n .replace(/(\\d{3})(\\d{1,2})$/, \"$1-$2\");\r\n }\r\n\r\n const cnpj = value.slice(0, 14);\r\n return cnpj\r\n .replace(/^(\\d{2})(\\d)/, \"$1.$2\")\r\n .replace(/^(\\d{2})\\.(\\d{3})(\\d)/, \"$1.$2.$3\")\r\n .replace(/\\.(\\d{3})(\\d)/, \".$1/$2\")\r\n .replace(/(\\d{4})(\\d)/, \"$1-$2\");\r\n}\r\n","import { removeDigits } from \"../../core/remove-digits\";\r\n\r\n/**\r\n * Formata telefone brasileiro (até 11 dígitos): fixo `(00) 0000-0000` ou celular `(00) 00000-0000`.\r\n * @param phone - Valor com ou sem formatação\r\n * @returns Telefone formatado ou string vazia se ausente\r\n * @example\r\n * formatPhoneBr(\"11987654321\") // \"(11) 98765-4321\"\r\n * formatPhoneBr(\"1133334444\") // \"(11) 3333-4444\"\r\n */\r\nexport function formatPhoneBr(phone?: string): string {\r\n if (!phone) return \"\";\r\n const digits = removeDigits(phone).slice(0, 11);\r\n\r\n if (!digits) return \"\";\r\n if (digits.length <= 2) return digits;\r\n if (digits.length <= 6) {\r\n return digits.replace(/(\\d{2})(\\d+)/, \"($1) $2\");\r\n }\r\n if (digits.length <= 10) {\r\n return digits.replace(/(\\d{2})(\\d{4})(\\d+)/, \"($1) $2-$3\");\r\n }\r\n return digits.replace(/(\\d{2})(\\d{5})(\\d+)/, \"($1) $2-$3\");\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/functions/cn/cn.ts","../../src/functions/nvl/nvl.ts","../../src/core/remove-digits.ts","../../src/functions/format-cpf-cnpj/format-cpf-cnpj.ts","../../src/functions/format-phone-br/format-phone-br.ts","../../src/functions/format-price-brl/format-price-brl.ts","../../src/functions/format-item-170/format-item-170.ts","../../src/functions/format-item-150/format-item-150.ts"],"names":["twMerge","clsx"],"mappings":"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","file":"index.js","sourcesContent":["import { twMerge } from \"tailwind-merge\";\r\nimport { clsx } from \"clsx\";\r\nimport type { ClassValue } from \"./utils/interfaces\";\r\n\r\nexport function cn(...values: ClassValue[]): string {\r\n return twMerge(clsx(values));\r\n}\r\n","/**\r\n * Função NVL (Null Value Logic) - retorna valor padrão se o valor for null/undefined\r\n * @param {T | null | undefined} value - Valor a ser verificado\r\n * @param {T} defaultValue - Valor padrão a ser retornado se value for null/undefined\r\n * @returns {T} Value se não for null/undefined, senão defaultValue\r\n * @template T - Tipo do valor\r\n * @example\r\n * nvl(null, 'padrão') // Retorna: 'padrão'\r\n * nvl('valor', 'padrão') // Retorna: 'valor'\r\n */\r\nexport function nvl<T>(value: T | null | undefined, defaultValue: T): T {\r\n return value ?? defaultValue;\r\n}\r\n","/** Remove tudo que não for dígito. */\r\nexport function removeDigits(value: string): string {\r\n return value.replace(/\\D/g, \"\");\r\n}\r\n\r\n/** Remove tudo que não for número. */\r\nexport function removeNonDigits(value: string) {\r\n return value.replaceAll(/\\d/g, \"\");\r\n}\r\n\r\n/** Remove tudo que não for letra. */\r\nexport function removeTextOnly(value: string) {\r\n return value.replaceAll(/[^\\p{L}]/gu, \"\");\r\n}\r\n","import { removeDigits } from \"../../core/remove-digits\";\r\n\r\n/**\r\n * Formata CPF (até 11 dígitos) ou CNPJ (12–14 dígitos) conforme o tamanho.\r\n * @param data - Valor com ou sem formatação\r\n * @returns CPF `000.000.000-00` ou CNPJ `00.000.000/0000-00`; string vazia se ausente\r\n * @example\r\n * formatCpfCnpj(\"12345678901\") // \"123.456.789-01\"\r\n * formatCpfCnpj(\"12345678000199\") // \"12.345.678/0001-99\"\r\n */\r\nexport function formatCpfCnpj(data?: string): string {\r\n if (!data) return \"\";\r\n const value = removeDigits(data);\r\n\r\n if (!value) return \"\";\r\n if (value.length <= 11) {\r\n const cpf = value.slice(0, 11);\r\n return cpf\r\n .replace(/(\\d{3})(\\d)/, \"$1.$2\")\r\n .replace(/(\\d{3})(\\d)/, \"$1.$2\")\r\n .replace(/(\\d{3})(\\d{1,2})$/, \"$1-$2\");\r\n }\r\n\r\n const cnpj = value.slice(0, 14);\r\n return cnpj\r\n .replace(/^(\\d{2})(\\d)/, \"$1.$2\")\r\n .replace(/^(\\d{2})\\.(\\d{3})(\\d)/, \"$1.$2.$3\")\r\n .replace(/\\.(\\d{3})(\\d)/, \".$1/$2\")\r\n .replace(/(\\d{4})(\\d)/, \"$1-$2\");\r\n}\r\n","import { removeDigits } from \"../../core/remove-digits\";\r\n\r\n/**\r\n * Formata telefone brasileiro (até 11 dígitos): fixo `(00) 0000-0000` ou celular `(00) 00000-0000`.\r\n * @param phone - Valor com ou sem formatação\r\n * @returns Telefone formatado ou string vazia se ausente\r\n * @example\r\n * formatPhoneBr(\"11987654321\") // \"(11) 98765-4321\"\r\n * formatPhoneBr(\"1133334444\") // \"(11) 3333-4444\"\r\n */\r\nexport function formatPhoneBr(phone?: string): string {\r\n if (!phone) return \"\";\r\n const digits = removeDigits(phone).slice(0, 11);\r\n\r\n if (!digits) return \"\";\r\n if (digits.length <= 2) return digits;\r\n if (digits.length <= 6) {\r\n return digits.replace(/(\\d{2})(\\d+)/, \"($1) $2\");\r\n }\r\n if (digits.length <= 10) {\r\n return digits.replace(/(\\d{2})(\\d{4})(\\d+)/, \"($1) $2-$3\");\r\n }\r\n return digits.replace(/(\\d{2})(\\d{5})(\\d+)/, \"($1) $2-$3\");\r\n}\r\n","import { removeDigits } from \"../../core/remove-digits\";\r\n\r\n/**\r\n * Formata um valor como moeda brasileira (BRL).\r\n *\r\n * - **string** — máscara de input: remove não dígitos, divide por 100 (centavos)\r\n * - **number** — valor já em reais\r\n *\r\n * @param value - Valor digitado ou numérico em reais\r\n * @returns Valor formatado (ex.: `R$ 1.234,56`) ou string vazia se ausente\r\n * @example\r\n * formatPriceBrl(\"123456\") // \"R$ 1.234,56\" (input)\r\n * formatPriceBrl(1234.56) // \"R$ 1.234,56\" (número)\r\n * formatPriceBrl(0) // \"R$ 0,00\"\r\n */\r\nexport function formatPriceBrl(value?: string | number | null): string {\r\n if (value === undefined || value === null) return \"\";\r\n\r\n if (typeof value === \"string\") {\r\n const digits = removeDigits(value);\r\n if (!digits) return \"\";\r\n const price = Number(digits) / 100;\r\n if (Number.isNaN(price)) return \"\";\r\n return price.toLocaleString(\"pt-BR\", {\r\n style: \"currency\",\r\n currency: \"BRL\",\r\n });\r\n }\r\n\r\n if (Number.isNaN(value)) return \"\";\r\n return value.toLocaleString(\"pt-BR\", { style: \"currency\", currency: \"BRL\" });\r\n}\r\n","import { removeDigits } from \"../../core/remove-digits\";\r\n\r\n/**\r\n * Formata máscara de item 170 (até 12 dígitos) no padrão `00.00.00.00.0.000`.\r\n * Remove caracteres não numéricos antes de formatar.\r\n * @param item - Valor com ou sem formatação\r\n * @returns Item formatado ou string vazia se ausente\r\n * @example\r\n * formatItem170(\"123456789012\") // \"12.34.56.78.9.012\"\r\n */\r\nexport function formatItem170(item?: string): string {\r\n if (!item) return \"\";\r\n const digits = removeDigits(item).slice(0, 12);\r\n if (!digits) return \"\";\r\n\r\n return digits\r\n .replace(/(\\d{2})(\\d)/, \"$1.$2\")\r\n .replace(/(\\d{2})(\\d)/, \"$1.$2\")\r\n .replace(/(\\d{2})(\\d)/, \"$1.$2\")\r\n .replace(/(\\d{2})(\\d)/, \"$1.$2\")\r\n .replace(/(\\d{2})\\.(\\d)(\\d{1,3})$/, \"$1.$2.$3\");\r\n}\r\n","import { removeDigits } from \"../../core/remove-digits\";\r\n\r\n/**\r\n * Formata máscara de item 150 (até 10 dígitos) no padrão `00.00.00.0.000`.\r\n * Remove caracteres não numéricos antes de formatar.\r\n * @param item - Valor com ou sem formatação\r\n * @returns Item formatado ou string vazia se ausente\r\n * @example\r\n * formatItem150(\"1234567890\") // \"12.34.56.7.890\"\r\n */\r\nexport function formatItem150(item?: string): string {\r\n if (!item) return \"\";\r\n const digits = removeDigits(item).slice(0, 10);\r\n if (!digits) return \"\";\r\n\r\n return digits\r\n .replace(/(\\d{2})(\\d)/, \"$1.$2\")\r\n .replace(/(\\d{2})(\\d)/, \"$1.$2\")\r\n .replace(/(\\d{2})(\\d)/, \"$1.$2\")\r\n .replace(/(\\d{2})\\.(\\d)(\\d{1,3})$/, \"$1.$2.$3\");\r\n}\r\n"]}
|
package/dist/functions/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { cn, formatCpfCnpj, formatPhoneBr, nvl } from '../chunk-
|
|
1
|
+
export { cn, formatCpfCnpj, formatItem150, formatItem170, formatPhoneBr, formatPriceBrl, nvl } from '../chunk-BWW3F4R4.mjs';
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
3
3
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
2
|
-
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-600:oklch(57.7% .245 27.325);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-800:oklch(44.8% .119 151.328);--color-teal-500:oklch(70.4% .14 182.503);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-4{margin-top:calc(var(--spacing) * 4)}.block{display:block}.block\!{display:block!important}.flex{display:flex}.hidden{display:none}.inline-block{display:inline-block}.table{display:table}.min-h-\[210px\]\!{min-height:210px!important}.min-h-screen{min-height:100vh}.max-w-3xl{max-width:var(--container-3xl)}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.border-collapse{border-collapse:collapse}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.truncate\!{text-overflow:ellipsis!important;white-space:nowrap!important;overflow:hidden!important}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-green-500{border-color:var(--color-green-500)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-green-50{background-color:var(--color-green-50)}.bg-green-100{background-color:var(--color-green-100)}.bg-red-600{background-color:var(--color-red-600)}.bg-teal-500{background-color:var(--color-teal-500)}.p-4{padding:calc(var(--spacing) * 4)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0{padding-block:calc(var(--spacing) * 0)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.text-center{text-align:center}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-sm\!{font-size:var(--text-sm)!important;line-height:var(--tw-leading,var(--text-sm--line-height))!important}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-xs\!{font-size:var(--text-xs)!important;line-height:var(--tw-leading,var(--text-xs--line-height))!important}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.font-semibold\!{--tw-font-weight:var(--font-weight-semibold)!important;font-weight:var(--font-weight-semibold)!important}.text-black{color:var(--color-black)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-900{color:var(--color-gray-900)}.text-green-400{color:var(--color-green-400)}.text-green-800{color:var(--color-green-800)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.underline{text-decoration-line:underline}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}
|
|
2
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-x-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-600:oklch(57.7% .245 27.325);--color-red-900:oklch(39.6% .141 25.723);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-900:oklch(41.4% .112 45.904);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-800:oklch(44.8% .119 151.328);--color-green-900:oklch(39.3% .095 152.535);--color-teal-500:oklch(70.4% .14 182.503);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-900:oklch(37.9% .146 265.522);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--container-5xl:64rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-md:.375rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.ml-1{margin-left:calc(var(--spacing) * 1)}.block{display:block}.block\!{display:block!important}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.h-5{height:calc(var(--spacing) * 5)}.h-15{height:calc(var(--spacing) * 15)}.h-full{height:100%}.min-h-\[210px\]\!{min-height:210px!important}.min-h-screen{min-height:100vh}.w-2{width:calc(var(--spacing) * 2)}.w-5{width:calc(var(--spacing) * 5)}.w-80{width:calc(var(--spacing) * 80)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-5xl{max-width:var(--container-5xl)}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-2{gap:calc(var(--spacing) * 2)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-x-4>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 4) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-x-reverse)))}.truncate\!{text-overflow:ellipsis!important;white-space:nowrap!important;overflow:hidden!important}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-tl-md{border-top-left-radius:var(--radius-md)}.rounded-bl-md{border-bottom-left-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-amber-200{border-color:var(--color-amber-200)}.border-blue-200{border-color:var(--color-blue-200)}.border-gray-200{border-color:var(--color-gray-200)}.border-green-200{border-color:var(--color-green-200)}.border-green-500{border-color:var(--color-green-500)}.border-red-200{border-color:var(--color-red-200)}.bg-\(--primary-color\){background-color:var(--primary-color)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-green-50{background-color:var(--color-green-50)}.bg-green-100{background-color:var(--color-green-100)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-600{background-color:var(--color-red-600)}.bg-teal-500{background-color:var(--color-teal-500)}.bg-white{background-color:var(--color-white)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pr-5{padding-right:calc(var(--spacing) * 5)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pl-5{padding-left:calc(var(--spacing) * 5)}.text-center{text-align:center}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-sm\!{font-size:var(--text-sm)!important;line-height:var(--tw-leading,var(--text-sm--line-height))!important}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-xs\!{font-size:var(--text-xs)!important;line-height:var(--tw-leading,var(--text-xs--line-height))!important}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.font-semibold\!{--tw-font-weight:var(--font-weight-semibold)!important;font-weight:var(--font-weight-semibold)!important}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.text-amber-900{color:var(--color-amber-900)}.text-black{color:var(--color-black)}.text-black\/80{color:#000c}@supports (color:color-mix(in lab, red, red)){.text-black\/80{color:color-mix(in oklab, var(--color-black) 80%, transparent)}}.text-blue-900{color:var(--color-blue-900)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-900{color:var(--color-gray-900)}.text-green-400{color:var(--color-green-400)}.text-green-800{color:var(--color-green-800)}.text-green-900{color:var(--color-green-900)}.text-red-900{color:var(--color-red-900)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.shadow-\[0_2px_6px_-1px_rgba\(0\,0\,0\,\.16\)\,0_6px_18px_-1px_rgba\(0\,0\,0\,\.06\)\]{--tw-shadow:0 2px 6px -1px var(--tw-shadow-color,#00000029), 0 6px 18px -1px var(--tw-shadow-color,#0000000f);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.select-none{-webkit-user-select:none;user-select:none}.disabled\:opacity-50:disabled{opacity:.5}}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}
|
package/dist/ui/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _mui_material from '@mui/material';
|
|
2
|
-
import { CSSProperties, Breakpoint, TabProps as TabProps$1, TabsProps as TabsProps$1 } from '@mui/material';
|
|
2
|
+
import { CSSProperties, Breakpoint, TabProps as TabProps$1, TabsProps as TabsProps$1, TextFieldProps, AutocompleteProps, AutocompleteChangeReason, AutocompleteChangeDetails } from '@mui/material';
|
|
3
3
|
import * as react from 'react';
|
|
4
|
-
import react__default, { ComponentPropsWithoutRef } from 'react';
|
|
4
|
+
import react__default, { ComponentPropsWithoutRef, Dispatch, SetStateAction, SubmitEventHandler, ReactElement } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { DataGridProps } from '@mui/x-data-grid';
|
|
7
7
|
import * as _emotion_styled from '@emotion/styled';
|
|
@@ -311,6 +311,212 @@ declare const Tabs: _emotion_styled.StyledComponent<_mui_material.TabsOwnProps &
|
|
|
311
311
|
* <Tab label="Configurações" color="#00B2A6" />
|
|
312
312
|
* ```
|
|
313
313
|
*/
|
|
314
|
-
declare const Tab: _emotion_styled.StyledComponent<_mui_material.TabOwnProps & Omit<_mui_material.ButtonBaseOwnProps, keyof _mui_material.TabOwnProps> & Omit<_mui_material.ButtonBaseOwnProps, "tabIndex" | "type" | "touchRippleRef" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "nativeButton" | "onFocusVisible" | "TouchRippleProps" | keyof _mui_material.TabOwnProps> & _mui_material_OverridableComponent.CommonProps & Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "
|
|
314
|
+
declare const Tab: _emotion_styled.StyledComponent<_mui_material.TabOwnProps & Omit<_mui_material.ButtonBaseOwnProps, keyof _mui_material.TabOwnProps> & Omit<_mui_material.ButtonBaseOwnProps, "tabIndex" | "type" | "touchRippleRef" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "nativeButton" | "onFocusVisible" | "TouchRippleProps" | keyof _mui_material.TabOwnProps> & _mui_material_OverridableComponent.CommonProps & Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style" | "label" | "className" | "tabIndex" | "children" | "icon" | "sx" | "type" | "classes" | "disabled" | "touchRippleRef" | "value" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "nativeButton" | "onFocusVisible" | "TouchRippleProps" | "disableFocusRipple" | "iconPosition" | "wrapped"> & _mui_system.MUIStyledCommonProps<_mui_material.Theme> & TabColorProps, {}, {}>;
|
|
315
315
|
|
|
316
|
-
|
|
316
|
+
type InputType = TextFieldProps["type"] | "cpf-cnpj" | "numeric" | "price" | "text-only" | "text-no-number" | "item-170" | "item-150";
|
|
317
|
+
type InputProps = Omit<TextFieldProps, "color" | "type" | "size"> & {
|
|
318
|
+
/**
|
|
319
|
+
* Cor do input.
|
|
320
|
+
*/
|
|
321
|
+
color?: string;
|
|
322
|
+
/**
|
|
323
|
+
* Se true, exibe um botão de toggle para mostrar/ocultar a senha.
|
|
324
|
+
*/
|
|
325
|
+
isPassword?: boolean;
|
|
326
|
+
/**
|
|
327
|
+
* Aceita os tipos padrão do TextField e tipos customizados do projeto.
|
|
328
|
+
* Padrão: `"text"`.
|
|
329
|
+
*/
|
|
330
|
+
type?: InputType;
|
|
331
|
+
/**
|
|
332
|
+
* Tamanho do campo conforme o MUI TextField.
|
|
333
|
+
* Padrão: `"small"`.
|
|
334
|
+
*/
|
|
335
|
+
size?: TextFieldProps["size"];
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Campo de texto baseado no MUI TextField, com máscaras e tipos customizados do projeto.
|
|
340
|
+
*/
|
|
341
|
+
declare const Input: ({ color, onChange, isPassword, type, size, ...rest }: Readonly<InputProps>) => react_jsx_runtime.JSX.Element;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Propriedades de layout em grid para o campo do {@link InputSelect}.
|
|
345
|
+
*/
|
|
346
|
+
interface InputSelectGridProps {
|
|
347
|
+
/**
|
|
348
|
+
* Ordem de exibição do input.
|
|
349
|
+
*/
|
|
350
|
+
order?: number;
|
|
351
|
+
/**
|
|
352
|
+
* Tamanho do grid para o input.
|
|
353
|
+
*/
|
|
354
|
+
xs?: number;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Propriedades do componente {@link InputSelect}.
|
|
358
|
+
*
|
|
359
|
+
* Estende o Autocomplete do MUI, substituindo `renderInput` pelo {@link Input} do projeto
|
|
360
|
+
* e tipando `onChange` conforme seleção única ou múltipla.
|
|
361
|
+
*
|
|
362
|
+
* @template T - Tipo dos itens de opções no seletor.
|
|
363
|
+
* @template M - Valor booleano que define se a seleção pode ser múltipla.
|
|
364
|
+
*/
|
|
365
|
+
interface InputSelectProps<T, M extends boolean = false> extends Omit<AutocompleteProps<T, M, boolean | undefined, boolean | undefined>, "renderInput" | "onChange"> {
|
|
366
|
+
/**
|
|
367
|
+
* Propriedades repassadas ao {@link Input} interno.
|
|
368
|
+
* Aceita label, color, type, máscaras e demais props do TextField do projeto.
|
|
369
|
+
*/
|
|
370
|
+
input?: InputProps & InputSelectGridProps;
|
|
371
|
+
/**
|
|
372
|
+
* Opções exibidas no seletor.
|
|
373
|
+
*/
|
|
374
|
+
options: T[];
|
|
375
|
+
/**
|
|
376
|
+
* Retorna a string exibida como rótulo de uma opção.
|
|
377
|
+
* @param data - Item da lista `options`.
|
|
378
|
+
*/
|
|
379
|
+
optionLabel: (data: T) => string;
|
|
380
|
+
/**
|
|
381
|
+
* Define se o seletor permite múltiplas seleções.
|
|
382
|
+
* Padrão: `false`.
|
|
383
|
+
*/
|
|
384
|
+
multiple?: M;
|
|
385
|
+
/**
|
|
386
|
+
* Callback disparado quando o valor do seletor é alterado.
|
|
387
|
+
* @param event - Evento que disparou a alteração.
|
|
388
|
+
* @param value - Novo valor (`T | null` ou `T[]` quando `multiple`).
|
|
389
|
+
* @param reason - Motivo da alteração (MUI `AutocompleteChangeReason`).
|
|
390
|
+
* @param details - Detalhes adicionais da alteração (opcional).
|
|
391
|
+
*/
|
|
392
|
+
onChange?: (event: React.SyntheticEvent, value: M extends true ? T[] : T | null, reason: AutocompleteChangeReason, details?: AutocompleteChangeDetails<T>) => void;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Componente InputSelect que encapsula o Autocomplete do Material-UI com o {@link Input} do projeto.
|
|
397
|
+
*
|
|
398
|
+
* Permite a seleção de uma ou mais opções com base nos parâmetros fornecidos.
|
|
399
|
+
* É configurável via props do Autocomplete do MUI, com campo de entrada customizável
|
|
400
|
+
* através de `input` (mesmas props do {@link Input}: cor, label, máscaras, etc.).
|
|
401
|
+
*
|
|
402
|
+
* @template T - Tipo dos itens de opções exibidos no seletor.
|
|
403
|
+
* @template M - Define se o seletor permite múltiplas seleções. Padrão: `false` (seletor único).
|
|
404
|
+
*
|
|
405
|
+
* @param props - Propriedades do componente. Detalhes em {@link InputSelectProps}.
|
|
406
|
+
* @param props.multiple - Se `true`, permite selecionar várias opções. Padrão: `false`.
|
|
407
|
+
* @param props.optionLabel - Função que recebe uma opção e retorna o rótulo exibido.
|
|
408
|
+
* @param props.onChange - Callback ao alterar o valor (evento, valor, motivo e detalhes).
|
|
409
|
+
* @param props.input - Props repassadas ao {@link Input} interno (label, color, type, etc.).
|
|
410
|
+
* @param props.options - Lista de opções disponíveis no seletor.
|
|
411
|
+
* @param props.rest - Demais props do Autocomplete do MUI (exceto `renderInput` e `onChange`).
|
|
412
|
+
*
|
|
413
|
+
* @returns Autocomplete com campo de entrada personalizado.
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* ```tsx
|
|
417
|
+
* const options = [
|
|
418
|
+
* { id: 1, label: "Opção 1" },
|
|
419
|
+
* { id: 2, label: "Opção 2" },
|
|
420
|
+
* ];
|
|
421
|
+
*
|
|
422
|
+
* <InputSelect
|
|
423
|
+
* options={options}
|
|
424
|
+
* optionLabel={(option) => option.label}
|
|
425
|
+
* input={{ label: "Selecione", color: "#00b2a6" }}
|
|
426
|
+
* onChange={(_event, value) => console.log("Valor selecionado:", value)}
|
|
427
|
+
* multiple
|
|
428
|
+
* />
|
|
429
|
+
* ```
|
|
430
|
+
*/
|
|
431
|
+
declare function InputSelect<T, M extends boolean = false>({ multiple, optionLabel, onChange, input, ...rest }: Readonly<InputSelectProps<T, M>>): react_jsx_runtime.JSX.Element;
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Propriedades do componente {@link FilterCard}.
|
|
435
|
+
*/
|
|
436
|
+
interface FilterCardProps {
|
|
437
|
+
/** Título do cartão de filtros. */
|
|
438
|
+
title?: string;
|
|
439
|
+
/** Indica se o botão de filtros deve ser exibido. */
|
|
440
|
+
renderFilter: boolean;
|
|
441
|
+
/** Controla a abertura do drawer de filtros. */
|
|
442
|
+
setOpen: Dispatch<SetStateAction<boolean>>;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* {@link Input} no grid do drawer de filtros.
|
|
446
|
+
* Inclui `order` e `xs` para posicionamento no grid responsivo.
|
|
447
|
+
*/
|
|
448
|
+
type FilterInputProps = InputProps & InputSelectGridProps;
|
|
449
|
+
/**
|
|
450
|
+
* {@link InputSelect} tipado no grid do drawer.
|
|
451
|
+
* Use {@link filterInputSelect} para inferir `T` por campo sem casts.
|
|
452
|
+
*/
|
|
453
|
+
type FilterInputSelectItem<T, M extends boolean = false> = InputSelectProps<T, M> & InputSelectGridProps;
|
|
454
|
+
/**
|
|
455
|
+
* Campo {@link InputSelect} no drawer com tipos heterogêneos.
|
|
456
|
+
* Cada item pode ter `options` de um tipo diferente na mesma lista.
|
|
457
|
+
*/
|
|
458
|
+
type FilterInputSelectField<M extends boolean = false> = InputSelectProps<unknown, M> & InputSelectGridProps;
|
|
459
|
+
/**
|
|
460
|
+
* Lista de campos {@link InputSelect} no drawer.
|
|
461
|
+
* Cada item pode ter tipo de opção e seleção única/múltipla diferentes.
|
|
462
|
+
*/
|
|
463
|
+
type FilterInputSelectProps = (FilterInputSelectField<false> | FilterInputSelectField<true>)[];
|
|
464
|
+
/** Campo do drawer: {@link Input} ou {@link InputSelect}. */
|
|
465
|
+
type FilterDrawerField = FilterInputProps | FilterInputSelectField<false> | FilterInputSelectField<true>;
|
|
466
|
+
/**
|
|
467
|
+
* Propriedades do componente {@link FilterDrawer}.
|
|
468
|
+
*/
|
|
469
|
+
interface FilterDrawerProps {
|
|
470
|
+
/** Drawer aberto. */
|
|
471
|
+
open?: boolean;
|
|
472
|
+
/** Controla a abertura do drawer. */
|
|
473
|
+
setOpen: Dispatch<SetStateAction<boolean>>;
|
|
474
|
+
/** Campos {@link Input}. */
|
|
475
|
+
inputs?: FilterInputProps[];
|
|
476
|
+
/** Campos {@link InputSelect}. */
|
|
477
|
+
inputSelect?: FilterInputSelectProps;
|
|
478
|
+
/** Callback ao limpar filtros. */
|
|
479
|
+
onClear?: () => void;
|
|
480
|
+
/** Callback ao submeter o formulário de filtros. */
|
|
481
|
+
onSubmit?: SubmitEventHandler<HTMLFormElement>;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Propriedades do componente {@link Filter}.
|
|
485
|
+
*
|
|
486
|
+
* Combina título do card com campos e callbacks do drawer.
|
|
487
|
+
*/
|
|
488
|
+
interface FilterProps extends Omit<FilterCardProps, "renderFilter" | "setOpen">, Omit<FilterDrawerProps, "open" | "setOpen"> {
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Filtro com card de título e drawer contendo {@link Input} e {@link InputSelect}.
|
|
493
|
+
*
|
|
494
|
+
* O card exibe o título da página/relatório e um botão para abrir o drawer quando
|
|
495
|
+
* há campos em `inputs` ou `inputSelect`. O drawer renderiza os campos em grid
|
|
496
|
+
* responsivo, com ações de limpar e pesquisar.
|
|
497
|
+
*
|
|
498
|
+
* @param props - Propriedades do componente. Detalhes em {@link FilterProps}.
|
|
499
|
+
* @param props.title - Título exibido no card.
|
|
500
|
+
* @param props.inputs - Campos de texto/máscara ({@link Input}).
|
|
501
|
+
* @param props.inputSelect - Campos de seleção ({@link InputSelect}).
|
|
502
|
+
* @param props.onClear - Callback ao limpar filtros.
|
|
503
|
+
* @param props.onSubmit - Callback ao pesquisar.
|
|
504
|
+
* @returns Elemento React com card e drawer de filtros.
|
|
505
|
+
*/
|
|
506
|
+
declare const Filter: ({ title, inputs, onClear, onSubmit, inputSelect, }: FilterProps) => ReactElement;
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Define um campo {@link InputSelect} no filter preservando a inferência de `T`.
|
|
510
|
+
* Permite montar listas com tipos de opção diferentes sem union nem `as`.
|
|
511
|
+
*
|
|
512
|
+
* @example
|
|
513
|
+
* filterInputSelect({
|
|
514
|
+
* options: networks,
|
|
515
|
+
* optionLabel: (v) => v.desRede,
|
|
516
|
+
* input: { label: "Rede" },
|
|
517
|
+
* order: 1,
|
|
518
|
+
* })
|
|
519
|
+
*/
|
|
520
|
+
declare function filterInputSelect<T extends object, M extends boolean = false>(props: InputSelectProps<T, M> & InputSelectGridProps): M extends true ? FilterInputSelectField<true> : FilterInputSelectField<false>;
|
|
521
|
+
|
|
522
|
+
export { Card, type CardClassName, type CardProps, DataTable, type DataTableProps, Dialog, type DialogProps, Filter, type FilterCardProps, type FilterDrawerField, type FilterDrawerProps, type FilterInputProps, type FilterInputSelectField, type FilterInputSelectItem, type FilterInputSelectProps, type FilterProps, Input, type InputProps, InputSelect, type InputSelectGridProps, type InputSelectProps, type InputType, Tab, type TabColorProps, type TabProps, Tabs, type TabsProps, filterInputSelect };
|