@plenustech/design-system 0.2.4 → 0.2.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/README.md +8 -0
- package/dist/components/actions/ButtonTile/ButtonTile.module.css.cjs +1 -1
- package/dist/components/actions/ButtonTile/ButtonTile.module.css.js +10 -10
- package/dist/components/actions/Toolbar/Toolbar.cjs +1 -1
- package/dist/components/actions/Toolbar/Toolbar.cjs.map +1 -1
- package/dist/components/actions/Toolbar/Toolbar.js +64 -53
- package/dist/components/actions/Toolbar/Toolbar.js.map +1 -1
- package/dist/components/data-display/CodeBlock/syntax.cjs +10 -3
- package/dist/components/data-display/CodeBlock/syntax.cjs.map +1 -1
- package/dist/components/data-display/CodeBlock/syntax.js +68 -48
- package/dist/components/data-display/CodeBlock/syntax.js.map +1 -1
- package/dist/components/data-display/Timeline/Timeline.cjs +1 -1
- package/dist/components/data-display/Timeline/Timeline.cjs.map +1 -1
- package/dist/components/data-display/Timeline/Timeline.js +6 -6
- package/dist/components/data-display/Timeline/Timeline.js.map +1 -1
- package/dist/components/data-display/Timeline/Timeline.module.css.cjs +1 -1
- package/dist/components/data-display/Timeline/Timeline.module.css.js +18 -16
- package/dist/components/data-display/Timeline/Timeline.module.css.js.map +1 -1
- package/dist/components/forms/Checkbox/Checkbox.module.css.cjs +1 -1
- package/dist/components/forms/Checkbox/Checkbox.module.css.js +5 -5
- package/dist/components/forms/CheckboxGroup/CheckboxGroup.module.css.cjs +1 -1
- package/dist/components/forms/CheckboxGroup/CheckboxGroup.module.css.js +1 -1
- package/dist/components/forms/Field/Field.cjs +1 -1
- package/dist/components/forms/Field/Field.cjs.map +1 -1
- package/dist/components/forms/Field/Field.js +22 -22
- package/dist/components/forms/Field/Field.js.map +1 -1
- package/dist/components/forms/Field/Field.module.css.cjs +1 -1
- package/dist/components/forms/Field/Field.module.css.js +19 -17
- package/dist/components/forms/Field/Field.module.css.js.map +1 -1
- package/dist/components/forms/InputText/InputText.cjs +1 -1
- package/dist/components/forms/InputText/InputText.cjs.map +1 -1
- package/dist/components/forms/InputText/InputText.js +24 -24
- package/dist/components/forms/InputText/InputText.js.map +1 -1
- package/dist/components/forms/InputText/InputText.module.css.cjs +1 -1
- package/dist/components/forms/InputText/InputText.module.css.js +9 -7
- package/dist/components/forms/InputText/InputText.module.css.js.map +1 -1
- package/dist/components/forms/RadioGroup/RadioGroup.module.css.cjs +1 -1
- package/dist/components/forms/RadioGroup/RadioGroup.module.css.js +4 -4
- package/dist/components/forms/Select/Select.cjs.map +1 -1
- package/dist/components/forms/Select/Select.js.map +1 -1
- package/dist/components/forms/Switch/Switch.module.css.cjs +1 -1
- package/dist/components/forms/Switch/Switch.module.css.js +6 -6
- package/dist/components/icons/suite.cjs +1 -0
- package/dist/components/icons/suite.js +10894 -0
- package/dist/components/navigation/Pagination/Pagination.cjs +1 -1
- package/dist/components/navigation/Pagination/Pagination.cjs.map +1 -1
- package/dist/components/navigation/Pagination/Pagination.js +71 -44
- package/dist/components/navigation/Pagination/Pagination.js.map +1 -1
- package/dist/components/navigation/Pagination/Pagination.module.css.cjs +1 -1
- package/dist/components/navigation/Pagination/Pagination.module.css.js +18 -14
- package/dist/components/navigation/Pagination/Pagination.module.css.js.map +1 -1
- package/dist/components/overlays/Menu/Menu.cjs +1 -1
- package/dist/components/overlays/Menu/Menu.cjs.map +1 -1
- package/dist/components/overlays/Menu/Menu.js +37 -36
- package/dist/components/overlays/Menu/Menu.js.map +1 -1
- package/dist/components/overlays/Menu/keyShortcuts.cjs +2 -0
- package/dist/components/overlays/Menu/keyShortcuts.cjs.map +1 -0
- package/dist/components/overlays/Menu/keyShortcuts.js +55 -0
- package/dist/components/overlays/Menu/keyShortcuts.js.map +1 -0
- package/dist/components/overlays/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.js +81 -56
- package/dist/components/overlays/Tooltip/Tooltip.js.map +1 -1
- package/dist/design-system.css +1 -1
- package/dist/icons.cjs +2 -0
- package/dist/icons.cjs.map +1 -0
- package/dist/icons.js +2054 -0
- package/dist/icons.js.map +1 -0
- package/dist/types/components/data-display/CodeBlock/syntax.d.ts +1 -1
- package/dist/types/components/data-display/Timeline/Timeline.d.ts +4 -1
- package/dist/types/components/data-display/Timeline/index.d.ts +1 -1
- package/dist/types/components/forms/Field/Field.d.ts +1 -1
- package/dist/types/components/forms/InputText/InputText.d.ts +1 -1
- package/dist/types/components/forms/Select/Select.d.ts +5 -1
- package/dist/types/components/icons/suite.d.ts +2051 -0
- package/dist/types/components/navigation/Pagination/Pagination.d.ts +13 -1
- package/dist/types/components/navigation/Pagination/index.d.ts +1 -1
- package/dist/types/components/overlays/Menu/Menu.d.ts +3 -1
- package/dist/types/components/overlays/Menu/keyShortcuts.d.ts +2 -0
- package/dist/types/components/overlays/Tooltip/Tooltip.d.ts +26 -5
- package/dist/types/icons.d.ts +6 -0
- package/dist/types/index.d.ts +2 -2
- package/package.json +8 -1
|
@@ -6,12 +6,13 @@ const j = {
|
|
|
6
6
|
tsx: "TSX",
|
|
7
7
|
sql: "SQL",
|
|
8
8
|
json: "JSON",
|
|
9
|
-
shell: "Shell"
|
|
9
|
+
shell: "Shell",
|
|
10
|
+
delphi: "Delphi"
|
|
10
11
|
};
|
|
11
12
|
function a(e) {
|
|
12
13
|
return new RegExp(`\\b(?:${e.trim().split(/\s+/).join("|")})\\b`);
|
|
13
14
|
}
|
|
14
|
-
const
|
|
15
|
+
const u = /\/\*[\s\S]*?(?:\*\/|$)/, f = /\/\/.*/, l = /"(?:\\.|[^"\\\n])*"?/, w = /'(?:\\.|[^'\\\n])*'?/, d = /\b(?:0[xX][\da-fA-F_]+|\d[\d_]*(?:\.\d[\d_]*)?(?:[eE][+-]?\d+)?)[lLfFdDn]?\b/, c = /\b[A-Za-z_$][\w$]*(?=\s*\()/, S = /@[A-Za-z_]\w*/, x = a(`
|
|
15
16
|
abstract assert boolean break byte case catch char class const continue default do double else enum extends
|
|
16
17
|
final finally float for goto if implements import instanceof int interface long native new package private
|
|
17
18
|
protected public record return sealed short static strictfp super switch synchronized this throw throws
|
|
@@ -20,7 +21,7 @@ const d = /\/\*[\s\S]*?(?:\*\/|$)/, b = /\/\/.*/, c = /"(?:\\.|[^"\\\n])*"?/, w
|
|
|
20
21
|
async await break case catch class const continue debugger default delete do else export extends finally for
|
|
21
22
|
from function get if import in instanceof let new of return set static super switch this throw try typeof var
|
|
22
23
|
void while with yield true false null undefined
|
|
23
|
-
`,
|
|
24
|
+
`, k = `
|
|
24
25
|
abstract any as asserts bigint boolean declare enum implements infer interface is keyof namespace never number
|
|
25
26
|
object private protected public readonly satisfies string symbol type unique unknown
|
|
26
27
|
`, A = a(`
|
|
@@ -32,93 +33,112 @@ const d = /\/\*[\s\S]*?(?:\*\/|$)/, b = /\/\/.*/, c = /"(?:\\.|[^"\\\n])*"?/, w
|
|
|
32
33
|
`), _ = a(`
|
|
33
34
|
case declare do done elif else esac exit export fi for function if in local readonly return select then until
|
|
34
35
|
while
|
|
36
|
+
`), L = a(`
|
|
37
|
+
absolute abstract and array as asm begin case class const constructor default deprecated destructor dispinterface
|
|
38
|
+
div do downto dynamic else end except exports external false file finalization finally for forward function goto
|
|
39
|
+
helper if implementation implements in inherited initialization inline interface is label library message mod nil
|
|
40
|
+
not object of on operator or out overload override packed platform private procedure program property protected
|
|
41
|
+
public published raise read record reintroduce repeat resourcestring sealed self set shl shr static stdcall strict
|
|
42
|
+
string then threadvar to true try type unit until uses var virtual while with write xor
|
|
35
43
|
`), E = [
|
|
36
|
-
["comment",
|
|
37
|
-
["comment",
|
|
44
|
+
["comment", f],
|
|
45
|
+
["comment", u],
|
|
38
46
|
["string", /`(?:\\[\s\S]|[^`\\])*`?/],
|
|
39
|
-
["string",
|
|
47
|
+
["string", l],
|
|
40
48
|
["string", w],
|
|
41
|
-
["number",
|
|
42
|
-
],
|
|
49
|
+
["number", d]
|
|
50
|
+
], m = [...E, ["keyword", a(y)], ["function", c]], h = [
|
|
43
51
|
...E,
|
|
44
52
|
["annotation", S],
|
|
45
|
-
["keyword", a(y +
|
|
46
|
-
["function",
|
|
47
|
-
],
|
|
53
|
+
["keyword", a(y + k)],
|
|
54
|
+
["function", c]
|
|
55
|
+
], b = [
|
|
48
56
|
[void 0, new RegExp("(?<=>)[^<>{}\\n]+(?=<)")],
|
|
49
57
|
["tag", new RegExp("(?<=<\\/|(?:^|[^\\w$)\\]])<)[A-Za-z][\\w.]*")],
|
|
50
58
|
["attribute", /\b[A-Za-z_][\w-]*(?==[{"'])/]
|
|
51
|
-
],
|
|
59
|
+
], R = {
|
|
52
60
|
java: [
|
|
53
|
-
["comment",
|
|
54
|
-
["comment",
|
|
61
|
+
["comment", f],
|
|
62
|
+
["comment", u],
|
|
55
63
|
["string", /"""[\s\S]*?(?:"""|$)/],
|
|
56
|
-
["string",
|
|
64
|
+
["string", l],
|
|
57
65
|
["string", /'(?:\\.|[^'\\\n])'/],
|
|
58
66
|
["annotation", S],
|
|
59
|
-
["number",
|
|
67
|
+
["number", d],
|
|
60
68
|
["keyword", x],
|
|
61
|
-
["function",
|
|
69
|
+
["function", c]
|
|
62
70
|
],
|
|
63
|
-
javascript:
|
|
64
|
-
jsx: [...
|
|
65
|
-
typescript:
|
|
66
|
-
tsx: [...
|
|
71
|
+
javascript: m,
|
|
72
|
+
jsx: [...b, ...m],
|
|
73
|
+
typescript: h,
|
|
74
|
+
tsx: [...b, ...h],
|
|
67
75
|
sql: [
|
|
68
76
|
["comment", /--.*/],
|
|
69
|
-
["comment",
|
|
77
|
+
["comment", u],
|
|
70
78
|
["string", /'(?:''|[^'])*'?/],
|
|
71
|
-
["number",
|
|
79
|
+
["number", d],
|
|
72
80
|
["keyword", A],
|
|
73
|
-
["function",
|
|
81
|
+
["function", c]
|
|
74
82
|
],
|
|
75
83
|
json: [
|
|
76
84
|
["property", /"(?:\\.|[^"\\\n])*"(?=\s*:)/],
|
|
77
|
-
["string",
|
|
85
|
+
["string", l],
|
|
78
86
|
["number", /-?\b\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/],
|
|
79
87
|
["keyword", /\b(?:true|false|null)\b/]
|
|
80
88
|
],
|
|
81
89
|
shell: [
|
|
82
90
|
["comment", new RegExp("(?<![^\\s;])#.*")],
|
|
83
|
-
["string",
|
|
91
|
+
["string", l],
|
|
84
92
|
["string", w],
|
|
85
93
|
["property", /\$(?:\{[^}\n]*\}|\w+|[@*#?$!])/],
|
|
86
94
|
["keyword", _],
|
|
87
|
-
["number",
|
|
95
|
+
["number", d]
|
|
96
|
+
],
|
|
97
|
+
// A diretiva de compilacao usa a forma do comentario, com `$` na abertura: vem antes dele e sai como anotacao.
|
|
98
|
+
delphi: [
|
|
99
|
+
["annotation", /\{\$[^}]*\}?|\(\*\$[\s\S]*?(?:\*\)|$)/],
|
|
100
|
+
["comment", f],
|
|
101
|
+
["comment", /\{[\s\S]*?(?:\}|$)/],
|
|
102
|
+
["comment", /\(\*[\s\S]*?(?:\*\)|$)/],
|
|
103
|
+
["string", /'(?:''|[^'\n])*'?/],
|
|
104
|
+
["string", /#(?:\$[\da-fA-F]+|\d+)/],
|
|
105
|
+
["number", /\$[\da-fA-F]+\b|%[01]+\b|\b\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/],
|
|
106
|
+
["keyword", L],
|
|
107
|
+
["function", c]
|
|
88
108
|
]
|
|
89
|
-
}, T = /* @__PURE__ */ new Set(["sql"]), g = /* @__PURE__ */ new Map();
|
|
90
|
-
function
|
|
91
|
-
const
|
|
92
|
-
if (
|
|
93
|
-
return
|
|
94
|
-
const
|
|
95
|
-
kinds:
|
|
96
|
-
pattern: new RegExp(
|
|
109
|
+
}, T = /* @__PURE__ */ new Set(["sql", "delphi"]), g = /* @__PURE__ */ new Map();
|
|
110
|
+
function O(e) {
|
|
111
|
+
const s = g.get(e);
|
|
112
|
+
if (s)
|
|
113
|
+
return s;
|
|
114
|
+
const r = R[e], o = T.has(e) ? "gi" : "g", n = {
|
|
115
|
+
kinds: r.map(([t]) => t),
|
|
116
|
+
pattern: new RegExp(r.map(([, t]) => `(${t.source})`).join("|"), o)
|
|
97
117
|
};
|
|
98
118
|
return g.set(e, n), n;
|
|
99
119
|
}
|
|
100
|
-
function
|
|
101
|
-
const { kinds:
|
|
120
|
+
function $(e, s) {
|
|
121
|
+
const { kinds: r, pattern: o } = O(s), n = [];
|
|
102
122
|
let t = 0;
|
|
103
|
-
for (const
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
n.push(
|
|
123
|
+
for (const i of e.matchAll(o)) {
|
|
124
|
+
i.index > t && n.push({ text: e.slice(t, i.index) });
|
|
125
|
+
const p = r[i.slice(1).findIndex((v) => v !== void 0)];
|
|
126
|
+
n.push(p ? { kind: p, text: i[0] } : { text: i[0] }), t = i.index + i[0].length;
|
|
107
127
|
}
|
|
108
128
|
return t < e.length && n.push({ text: e.slice(t) }), n;
|
|
109
129
|
}
|
|
110
|
-
function I(e,
|
|
111
|
-
const
|
|
112
|
-
for (const
|
|
113
|
-
|
|
130
|
+
function I(e, s) {
|
|
131
|
+
const r = [[]];
|
|
132
|
+
for (const o of s ? $(e, s) : [{ text: e }])
|
|
133
|
+
o.text.split(`
|
|
114
134
|
`).forEach((n, t) => {
|
|
115
|
-
t > 0 &&
|
|
135
|
+
t > 0 && r.push([]), n && r[r.length - 1].push({ ...o, text: n });
|
|
116
136
|
});
|
|
117
|
-
return
|
|
137
|
+
return r;
|
|
118
138
|
}
|
|
119
139
|
export {
|
|
120
140
|
j as SYNTAX_LABELS,
|
|
121
|
-
|
|
141
|
+
$ as tokenize,
|
|
122
142
|
I as tokenizeLines
|
|
123
143
|
};
|
|
124
144
|
//# sourceMappingURL=syntax.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syntax.js","sources":["../../../../src/components/data-display/CodeBlock/syntax.ts"],"sourcesContent":["/**\n * Realce de sintaxe por regras lexicas, sem analisador de linguagem: reconhece o\n * que ajuda a ler o trecho — palavra reservada, texto, numero, comentario,\n * anotacao, chamada, propriedade, tag e atributo — e deixa o resto sem cor.\n */\n\nexport type CodeSyntax = 'java' | 'javascript' | 'jsx' | 'typescript' | 'tsx' | 'sql' | 'json' | 'shell';\n\nexport type CodeTokenKind =\n | 'annotation'\n | 'attribute'\n | 'comment'\n | 'function'\n | 'keyword'\n | 'number'\n | 'property'\n | 'string'\n | 'tag';\n\nexport interface CodeToken {\n kind?: CodeTokenKind;\n text: string;\n}\n\n/** Regra sem papel reconhece um trecho para que nenhuma outra o pinte, como o texto entre tags. */\ntype Rule = readonly [CodeTokenKind | undefined, RegExp];\n\ninterface Grammar {\n kinds: readonly (CodeTokenKind | undefined)[];\n pattern: RegExp;\n}\n\nexport const SYNTAX_LABELS: Readonly<Record<CodeSyntax, string>> = {\n java: 'Java',\n javascript: 'JavaScript',\n jsx: 'JSX',\n typescript: 'TypeScript',\n tsx: 'TSX',\n sql: 'SQL',\n json: 'JSON',\n shell: 'Shell',\n};\n\nfunction words(list: string): RegExp {\n return new RegExp(`\\\\b(?:${list.trim().split(/\\s+/).join('|')})\\\\b`);\n}\n\nconst BLOCK_COMMENT = /\\/\\*[\\s\\S]*?(?:\\*\\/|$)/;\nconst LINE_COMMENT = /\\/\\/.*/;\nconst DOUBLE_QUOTED = /\"(?:\\\\.|[^\"\\\\\\n])*\"?/;\nconst SINGLE_QUOTED = /'(?:\\\\.|[^'\\\\\\n])*'?/;\nconst NUMBER = /\\b(?:0[xX][\\da-fA-F_]+|\\d[\\d_]*(?:\\.\\d[\\d_]*)?(?:[eE][+-]?\\d+)?)[lLfFdDn]?\\b/;\nconst CALL = /\\b[A-Za-z_$][\\w$]*(?=\\s*\\()/;\nconst ANNOTATION = /@[A-Za-z_]\\w*/;\n\nconst JAVA_KEYWORDS = words(`\n abstract assert boolean break byte case catch char class const continue default do double else enum extends\n final finally float for goto if implements import instanceof int interface long native new package private\n protected public record return sealed short static strictfp super switch synchronized this throw throws\n transient try var void volatile while yield true false null\n`);\n\nconst JAVASCRIPT_WORDS = `\n async await break case catch class const continue debugger default delete do else export extends finally for\n from function get if import in instanceof let new of return set static super switch this throw try typeof var\n void while with yield true false null undefined\n`;\n\nconst TYPESCRIPT_WORDS = `\n abstract any as asserts bigint boolean declare enum implements infer interface is keyof namespace never number\n object private protected public readonly satisfies string symbol type unique unknown\n`;\n\nconst SQL_KEYWORDS = words(`\n add all alter and as asc begin between by case check column commit constraint create cross database default\n delete desc distinct drop else end exists foreign from full grant group having if in index inner insert into\n is join key left like limit not null offset on or order outer primary procedure references returning revoke\n right rollback schema select set table then transaction trigger true false union unique update values view\n when where with\n`);\n\nconst SHELL_KEYWORDS = words(`\n case declare do done elif else esac exit export fi for function if in local readonly return select then until\n while\n`);\n\nconst JAVASCRIPT_RULES: readonly Rule[] = [\n ['comment', LINE_COMMENT],\n ['comment', BLOCK_COMMENT],\n ['string', /`(?:\\\\[\\s\\S]|[^`\\\\])*`?/],\n ['string', DOUBLE_QUOTED],\n ['string', SINGLE_QUOTED],\n ['number', NUMBER],\n];\n\nconst JAVASCRIPT: readonly Rule[] = [...JAVASCRIPT_RULES, ['keyword', words(JAVASCRIPT_WORDS)], ['function', CALL]];\n\nconst TYPESCRIPT: readonly Rule[] = [\n ...JAVASCRIPT_RULES,\n ['annotation', ANNOTATION],\n ['keyword', words(JAVASCRIPT_WORDS + TYPESCRIPT_WORDS)],\n ['function', CALL],\n];\n\n/**\n * Vem antes das regras da linguagem. O `<` colado a um nome e o generico de `useState<string>`, e nao uma tag; o\n * texto entre `>` e `<` e conteudo, e o numero dentro dele nao e literal.\n */\nconst JSX_RULES: readonly Rule[] = [\n [undefined, /(?<=>)[^<>{}\\n]+(?=<)/],\n ['tag', /(?<=<\\/|(?:^|[^\\w$)\\]])<)[A-Za-z][\\w.]*/],\n ['attribute', /\\b[A-Za-z_][\\w-]*(?==[{\"'])/],\n];\n\nconst RULES: Readonly<Record<CodeSyntax, readonly Rule[]>> = {\n java: [\n ['comment', LINE_COMMENT],\n ['comment', BLOCK_COMMENT],\n ['string', /\"\"\"[\\s\\S]*?(?:\"\"\"|$)/],\n ['string', DOUBLE_QUOTED],\n ['string', /'(?:\\\\.|[^'\\\\\\n])'/],\n ['annotation', ANNOTATION],\n ['number', NUMBER],\n ['keyword', JAVA_KEYWORDS],\n ['function', CALL],\n ],\n javascript: JAVASCRIPT,\n jsx: [...JSX_RULES, ...JAVASCRIPT],\n typescript: TYPESCRIPT,\n tsx: [...JSX_RULES, ...TYPESCRIPT],\n sql: [\n ['comment', /--.*/],\n ['comment', BLOCK_COMMENT],\n ['string', /'(?:''|[^'])*'?/],\n ['number', NUMBER],\n ['keyword', SQL_KEYWORDS],\n ['function', CALL],\n ],\n json: [\n ['property', /\"(?:\\\\.|[^\"\\\\\\n])*\"(?=\\s*:)/],\n ['string', DOUBLE_QUOTED],\n ['number', /-?\\b\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?\\b/],\n ['keyword', /\\b(?:true|false|null)\\b/],\n ],\n shell: [\n ['comment', /(?<![^\\s;])#.*/],\n ['string', DOUBLE_QUOTED],\n ['string', SINGLE_QUOTED],\n ['property', /\\$(?:\\{[^}\\n]*\\}|\\w+|[@*#?$!])/],\n ['keyword', SHELL_KEYWORDS],\n ['number', NUMBER],\n ],\n};\n\n/** O SQL e lido sem distincao de caixa: `select` e `SELECT` sao a mesma palavra. */\nconst CASE_INSENSITIVE: ReadonlySet<CodeSyntax> = new Set(['sql']);\n\nconst grammars = new Map<CodeSyntax, Grammar>();\n\nfunction grammarOf(syntax: CodeSyntax): Grammar {\n const cached = grammars.get(syntax);\n\n if (cached) {\n return cached;\n }\n\n const rules = RULES[syntax];\n const flags = CASE_INSENSITIVE.has(syntax) ? 'gi' : 'g';\n const grammar = {\n kinds: rules.map(([kind]) => kind),\n pattern: new RegExp(rules.map(([, rule]) => `(${rule.source})`).join('|'), flags),\n };\n\n grammars.set(syntax, grammar);\n\n return grammar;\n}\n\nexport function tokenize(code: string, syntax: CodeSyntax): CodeToken[] {\n const { kinds, pattern } = grammarOf(syntax);\n const tokens: CodeToken[] = [];\n let end = 0;\n\n for (const match of code.matchAll(pattern)) {\n if (match.index > end) {\n tokens.push({ text: code.slice(end, match.index) });\n }\n\n const kind = kinds[match.slice(1).findIndex((group) => group !== undefined)];\n\n tokens.push(kind ? { kind, text: match[0] } : { text: match[0] });\n end = match.index + match[0].length;\n }\n\n if (end < code.length) {\n tokens.push({ text: code.slice(end) });\n }\n\n return tokens;\n}\n\n/** As linhas do trecho, cada uma com os seus pedacos: o comentario de bloco que atravessa linhas e partido nelas. */\nexport function tokenizeLines(code: string, syntax?: CodeSyntax): CodeToken[][] {\n const lines: CodeToken[][] = [[]];\n\n for (const token of syntax ? tokenize(code, syntax) : [{ text: code }]) {\n token.text.split('\\n').forEach((part, index) => {\n if (index > 0) {\n lines.push([]);\n }\n\n if (part) {\n lines[lines.length - 1].push({ ...token, text: part });\n }\n });\n }\n\n return lines;\n}\n"],"names":["SYNTAX_LABELS","words","list","BLOCK_COMMENT","LINE_COMMENT","DOUBLE_QUOTED","SINGLE_QUOTED","NUMBER","CALL","ANNOTATION","JAVA_KEYWORDS","JAVASCRIPT_WORDS","TYPESCRIPT_WORDS","SQL_KEYWORDS","SHELL_KEYWORDS","JAVASCRIPT_RULES","JAVASCRIPT","TYPESCRIPT","JSX_RULES","RULES","CASE_INSENSITIVE","grammars","grammarOf","syntax","cached","rules","flags","grammar","kind","rule","tokenize","code","kinds","pattern","tokens","end","match","group","tokenizeLines","lines","token","part","index"],"mappings":"AAgCO,MAAMA,IAAsD;AAAA,EACjE,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,KAAK;AAAA,EACL,YAAY;AAAA,EACZ,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AACT;AAEA,SAASC,EAAMC,GAAsB;AACnC,SAAO,IAAI,OAAO,SAASA,EAAK,KAAA,EAAO,MAAM,KAAK,EAAE,K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* Realce de sintaxe por regras lexicas, sem analisador de linguagem: reconhece o\n * que ajuda a ler o trecho — palavra reservada, texto, numero, comentario,\n * anotacao, chamada, propriedade, tag e atributo — e deixa o resto sem cor.\n */\n\nexport type CodeSyntax = 'java' | 'javascript' | 'jsx' | 'typescript' | 'tsx' | 'sql' | 'json' | 'shell' | 'delphi';\n\nexport type CodeTokenKind =\n | 'annotation'\n | 'attribute'\n | 'comment'\n | 'function'\n | 'keyword'\n | 'number'\n | 'property'\n | 'string'\n | 'tag';\n\nexport interface CodeToken {\n kind?: CodeTokenKind;\n text: string;\n}\n\n/** Regra sem papel reconhece um trecho para que nenhuma outra o pinte, como o texto entre tags. */\ntype Rule = readonly [CodeTokenKind | undefined, RegExp];\n\ninterface Grammar {\n kinds: readonly (CodeTokenKind | undefined)[];\n pattern: RegExp;\n}\n\nexport const SYNTAX_LABELS: Readonly<Record<CodeSyntax, string>> = {\n java: 'Java',\n javascript: 'JavaScript',\n jsx: 'JSX',\n typescript: 'TypeScript',\n tsx: 'TSX',\n sql: 'SQL',\n json: 'JSON',\n shell: 'Shell',\n delphi: 'Delphi',\n};\n\nfunction words(list: string): RegExp {\n return new RegExp(`\\\\b(?:${list.trim().split(/\\s+/).join('|')})\\\\b`);\n}\n\nconst BLOCK_COMMENT = /\\/\\*[\\s\\S]*?(?:\\*\\/|$)/;\nconst LINE_COMMENT = /\\/\\/.*/;\nconst DOUBLE_QUOTED = /\"(?:\\\\.|[^\"\\\\\\n])*\"?/;\nconst SINGLE_QUOTED = /'(?:\\\\.|[^'\\\\\\n])*'?/;\nconst NUMBER = /\\b(?:0[xX][\\da-fA-F_]+|\\d[\\d_]*(?:\\.\\d[\\d_]*)?(?:[eE][+-]?\\d+)?)[lLfFdDn]?\\b/;\nconst CALL = /\\b[A-Za-z_$][\\w$]*(?=\\s*\\()/;\nconst ANNOTATION = /@[A-Za-z_]\\w*/;\n\nconst JAVA_KEYWORDS = words(`\n abstract assert boolean break byte case catch char class const continue default do double else enum extends\n final finally float for goto if implements import instanceof int interface long native new package private\n protected public record return sealed short static strictfp super switch synchronized this throw throws\n transient try var void volatile while yield true false null\n`);\n\nconst JAVASCRIPT_WORDS = `\n async await break case catch class const continue debugger default delete do else export extends finally for\n from function get if import in instanceof let new of return set static super switch this throw try typeof var\n void while with yield true false null undefined\n`;\n\nconst TYPESCRIPT_WORDS = `\n abstract any as asserts bigint boolean declare enum implements infer interface is keyof namespace never number\n object private protected public readonly satisfies string symbol type unique unknown\n`;\n\nconst SQL_KEYWORDS = words(`\n add all alter and as asc begin between by case check column commit constraint create cross database default\n delete desc distinct drop else end exists foreign from full grant group having if in index inner insert into\n is join key left like limit not null offset on or order outer primary procedure references returning revoke\n right rollback schema select set table then transaction trigger true false union unique update values view\n when where with\n`);\n\nconst SHELL_KEYWORDS = words(`\n case declare do done elif else esac exit export fi for function if in local readonly return select then until\n while\n`);\n\nconst DELPHI_KEYWORDS = words(`\n absolute abstract and array as asm begin case class const constructor default deprecated destructor dispinterface\n div do downto dynamic else end except exports external false file finalization finally for forward function goto\n helper if implementation implements in inherited initialization inline interface is label library message mod nil\n not object of on operator or out overload override packed platform private procedure program property protected\n public published raise read record reintroduce repeat resourcestring sealed self set shl shr static stdcall strict\n string then threadvar to true try type unit until uses var virtual while with write xor\n`);\n\nconst JAVASCRIPT_RULES: readonly Rule[] = [\n ['comment', LINE_COMMENT],\n ['comment', BLOCK_COMMENT],\n ['string', /`(?:\\\\[\\s\\S]|[^`\\\\])*`?/],\n ['string', DOUBLE_QUOTED],\n ['string', SINGLE_QUOTED],\n ['number', NUMBER],\n];\n\nconst JAVASCRIPT: readonly Rule[] = [...JAVASCRIPT_RULES, ['keyword', words(JAVASCRIPT_WORDS)], ['function', CALL]];\n\nconst TYPESCRIPT: readonly Rule[] = [\n ...JAVASCRIPT_RULES,\n ['annotation', ANNOTATION],\n ['keyword', words(JAVASCRIPT_WORDS + TYPESCRIPT_WORDS)],\n ['function', CALL],\n];\n\n/**\n * Vem antes das regras da linguagem. O `<` colado a um nome e o generico de `useState<string>`, e nao uma tag; o\n * texto entre `>` e `<` e conteudo, e o numero dentro dele nao e literal.\n */\nconst JSX_RULES: readonly Rule[] = [\n [undefined, /(?<=>)[^<>{}\\n]+(?=<)/],\n ['tag', /(?<=<\\/|(?:^|[^\\w$)\\]])<)[A-Za-z][\\w.]*/],\n ['attribute', /\\b[A-Za-z_][\\w-]*(?==[{\"'])/],\n];\n\nconst RULES: Readonly<Record<CodeSyntax, readonly Rule[]>> = {\n java: [\n ['comment', LINE_COMMENT],\n ['comment', BLOCK_COMMENT],\n ['string', /\"\"\"[\\s\\S]*?(?:\"\"\"|$)/],\n ['string', DOUBLE_QUOTED],\n ['string', /'(?:\\\\.|[^'\\\\\\n])'/],\n ['annotation', ANNOTATION],\n ['number', NUMBER],\n ['keyword', JAVA_KEYWORDS],\n ['function', CALL],\n ],\n javascript: JAVASCRIPT,\n jsx: [...JSX_RULES, ...JAVASCRIPT],\n typescript: TYPESCRIPT,\n tsx: [...JSX_RULES, ...TYPESCRIPT],\n sql: [\n ['comment', /--.*/],\n ['comment', BLOCK_COMMENT],\n ['string', /'(?:''|[^'])*'?/],\n ['number', NUMBER],\n ['keyword', SQL_KEYWORDS],\n ['function', CALL],\n ],\n json: [\n ['property', /\"(?:\\\\.|[^\"\\\\\\n])*\"(?=\\s*:)/],\n ['string', DOUBLE_QUOTED],\n ['number', /-?\\b\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?\\b/],\n ['keyword', /\\b(?:true|false|null)\\b/],\n ],\n shell: [\n ['comment', /(?<![^\\s;])#.*/],\n ['string', DOUBLE_QUOTED],\n ['string', SINGLE_QUOTED],\n ['property', /\\$(?:\\{[^}\\n]*\\}|\\w+|[@*#?$!])/],\n ['keyword', SHELL_KEYWORDS],\n ['number', NUMBER],\n ],\n // A diretiva de compilacao usa a forma do comentario, com `$` na abertura: vem antes dele e sai como anotacao.\n delphi: [\n ['annotation', /\\{\\$[^}]*\\}?|\\(\\*\\$[\\s\\S]*?(?:\\*\\)|$)/],\n ['comment', LINE_COMMENT],\n ['comment', /\\{[\\s\\S]*?(?:\\}|$)/],\n ['comment', /\\(\\*[\\s\\S]*?(?:\\*\\)|$)/],\n ['string', /'(?:''|[^'\\n])*'?/],\n ['string', /#(?:\\$[\\da-fA-F]+|\\d+)/],\n ['number', /\\$[\\da-fA-F]+\\b|%[01]+\\b|\\b\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?\\b/],\n ['keyword', DELPHI_KEYWORDS],\n ['function', CALL],\n ],\n};\n\n/** SQL e Delphi sao lidos sem distincao de caixa: `select` e `SELECT`, `begin` e `Begin` sao a mesma palavra. */\nconst CASE_INSENSITIVE: ReadonlySet<CodeSyntax> = new Set(['sql', 'delphi']);\n\nconst grammars = new Map<CodeSyntax, Grammar>();\n\nfunction grammarOf(syntax: CodeSyntax): Grammar {\n const cached = grammars.get(syntax);\n\n if (cached) {\n return cached;\n }\n\n const rules = RULES[syntax];\n const flags = CASE_INSENSITIVE.has(syntax) ? 'gi' : 'g';\n const grammar = {\n kinds: rules.map(([kind]) => kind),\n pattern: new RegExp(rules.map(([, rule]) => `(${rule.source})`).join('|'), flags),\n };\n\n grammars.set(syntax, grammar);\n\n return grammar;\n}\n\nexport function tokenize(code: string, syntax: CodeSyntax): CodeToken[] {\n const { kinds, pattern } = grammarOf(syntax);\n const tokens: CodeToken[] = [];\n let end = 0;\n\n for (const match of code.matchAll(pattern)) {\n if (match.index > end) {\n tokens.push({ text: code.slice(end, match.index) });\n }\n\n const kind = kinds[match.slice(1).findIndex((group) => group !== undefined)];\n\n tokens.push(kind ? { kind, text: match[0] } : { text: match[0] });\n end = match.index + match[0].length;\n }\n\n if (end < code.length) {\n tokens.push({ text: code.slice(end) });\n }\n\n return tokens;\n}\n\n/** As linhas do trecho, cada uma com os seus pedacos: o comentario de bloco que atravessa linhas e partido nelas. */\nexport function tokenizeLines(code: string, syntax?: CodeSyntax): CodeToken[][] {\n const lines: CodeToken[][] = [[]];\n\n for (const token of syntax ? tokenize(code, syntax) : [{ text: code }]) {\n token.text.split('\\n').forEach((part, index) => {\n if (index > 0) {\n lines.push([]);\n }\n\n if (part) {\n lines[lines.length - 1].push({ ...token, text: part });\n }\n });\n }\n\n return lines;\n}\n"],"names":["SYNTAX_LABELS","words","list","BLOCK_COMMENT","LINE_COMMENT","DOUBLE_QUOTED","SINGLE_QUOTED","NUMBER","CALL","ANNOTATION","JAVA_KEYWORDS","JAVASCRIPT_WORDS","TYPESCRIPT_WORDS","SQL_KEYWORDS","SHELL_KEYWORDS","DELPHI_KEYWORDS","JAVASCRIPT_RULES","JAVASCRIPT","TYPESCRIPT","JSX_RULES","RULES","CASE_INSENSITIVE","grammars","grammarOf","syntax","cached","rules","flags","grammar","kind","rule","tokenize","code","kinds","pattern","tokens","end","match","group","tokenizeLines","lines","token","part","index"],"mappings":"AAgCO,MAAMA,IAAsD;AAAA,EACjE,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,KAAK;AAAA,EACL,YAAY;AAAA,EACZ,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AACV;AAEA,SAASC,EAAMC,GAAsB;AACnC,SAAO,IAAI,OAAO,SAASA,EAAK,KAAA,EAAO,MAAM,KAAK,EAAE,KAAK,GAAG,CAAC,MAAM;AACrE;AAEA,MAAMC,IAAgB,0BAChBC,IAAe,UACfC,IAAgB,wBAChBC,IAAgB,wBAChBC,IAAS,gFACTC,IAAO,+BACPC,IAAa,iBAEbC,IAAgBT,EAAM;AAAA;AAAA;AAAA;AAAA;AAAA,CAK3B,GAEKU,IAAmB;AAAA;AAAA;AAAA;AAAA,GAMnBC,IAAmB;AAAA;AAAA;AAAA,GAKnBC,IAAeZ,EAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAM1B,GAEKa,IAAiBb,EAAM;AAAA;AAAA;AAAA,CAG5B,GAEKc,IAAkBd,EAAM;AAAA;AAAA;AAAA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
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),e=require("./Timeline.module.css.cjs"),m=require("../../icons/icons.cjs");function p({className:r,current:d,items:n,label:i,size:u="md",...o}){const t=n.findIndex(l=>l.key===d);return a.jsx("ol",{...o,"aria-label":i,className:[e.default.timeline,e.default[u],r].filter(Boolean).join(" "),children:n.map((l,c)=>{const s=c<t?"complete":c===t?"current":"upcoming";return a.jsxs("li",{"aria-current":s==="current"?"step":void 0,className:[e.default.item,e.default[s]].join(" "),children:[a.jsx("span",{"aria-hidden":"true",className:e.default.marker,children:s==="complete"?a.jsx(m.IconCheck,{}):a.jsx("span",{className:e.default.dot})}),a.jsxs("span",{className:e.default.text,children:[a.jsx("span",{className:e.default.label,children:l.label}),s==="complete"&&a.jsx("span",{className:e.default.hiddenText,children:", concluído"}),s==="current"&&a.jsx("span",{className:e.default.hiddenText,children:", atual"}),l.description&&a.jsx("span",{className:e.default.description,children:l.description}),l.date&&a.jsx("span",{className:e.default.date,children:l.date})]})]},l.key)})})}exports.Timeline=p;
|
|
2
2
|
//# sourceMappingURL=Timeline.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timeline.cjs","sources":["../../../../src/components/data-display/Timeline/Timeline.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react';\nimport { IconCheck } from '../../icons';\nimport styles from './Timeline.module.css';\n\nexport interface TimelineItem {\n date?: string;\n description?: string;\n key: string;\n label: string;\n}\n\nexport interface TimelineProps extends Omit<ComponentPropsWithRef<'ol'>, 'children'> {\n /** Chave do estado atual. Os anteriores contam como concluídos, os seguintes como por vir. */\n current: string;\n items: readonly TimelineItem[];\n /** Nome da lista, para o leitor de tela. */\n label: string;\n}\n\nexport function Timeline({ className, current, items, label, ...props }: TimelineProps) {\n const currentIndex = items.findIndex((item) => item.key === current);\n\n return (\n <ol {...props} aria-label={label} className={[styles.timeline, className].filter(Boolean).join(' ')}>\n {items.map((item, index) => {\n const state = index < currentIndex ? 'complete' : index === currentIndex ? 'current' : 'upcoming';\n\n return (\n <li\n aria-current={state === 'current' ? 'step' : undefined}\n className={[styles.item, styles[state]].join(' ')}\n key={item.key}\n >\n <span aria-hidden=\"true\" className={styles.marker}>\n {state === 'complete' ? <IconCheck /> : <span className={styles.dot} />}\n </span>\n <span className={styles.text}>\n <span className={styles.label}>{item.label}</span>\n {state === 'complete' && <span className={styles.hiddenText}>, concluído</span>}\n {state === 'current' && <span className={styles.hiddenText}>, atual</span>}\n {item.description && <span className={styles.description}>{item.description}</span>}\n {item.date && <span className={styles.date}>{item.date}</span>}\n </span>\n </li>\n );\n })}\n </ol>\n );\n}\n"],"names":["Timeline","className","current","items","label","props","currentIndex","item","jsx","styles","index","state","jsxs","IconCheck"],"mappings":"+
|
|
1
|
+
{"version":3,"file":"Timeline.cjs","sources":["../../../../src/components/data-display/Timeline/Timeline.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react';\nimport { IconCheck } from '../../icons';\nimport styles from './Timeline.module.css';\n\nexport type TimelineSize = 'sm' | 'md';\n\nexport interface TimelineItem {\n date?: string;\n description?: string;\n key: string;\n label: string;\n}\n\nexport interface TimelineProps extends Omit<ComponentPropsWithRef<'ol'>, 'children'> {\n /** Chave do estado atual. Os anteriores contam como concluídos, os seguintes como por vir. */\n current: string;\n items: readonly TimelineItem[];\n /** Nome da lista, para o leitor de tela. */\n label: string;\n /** `sm` para painéis estreitos: marcador de 16px e rótulo em caption. */\n size?: TimelineSize;\n}\n\nexport function Timeline({ className, current, items, label, size = 'md', ...props }: TimelineProps) {\n const currentIndex = items.findIndex((item) => item.key === current);\n\n return (\n <ol {...props} aria-label={label} className={[styles.timeline, styles[size], className].filter(Boolean).join(' ')}>\n {items.map((item, index) => {\n const state = index < currentIndex ? 'complete' : index === currentIndex ? 'current' : 'upcoming';\n\n return (\n <li\n aria-current={state === 'current' ? 'step' : undefined}\n className={[styles.item, styles[state]].join(' ')}\n key={item.key}\n >\n <span aria-hidden=\"true\" className={styles.marker}>\n {state === 'complete' ? <IconCheck /> : <span className={styles.dot} />}\n </span>\n <span className={styles.text}>\n <span className={styles.label}>{item.label}</span>\n {state === 'complete' && <span className={styles.hiddenText}>, concluído</span>}\n {state === 'current' && <span className={styles.hiddenText}>, atual</span>}\n {item.description && <span className={styles.description}>{item.description}</span>}\n {item.date && <span className={styles.date}>{item.date}</span>}\n </span>\n </li>\n );\n })}\n </ol>\n );\n}\n"],"names":["Timeline","className","current","items","label","size","props","currentIndex","item","jsx","styles","index","state","jsxs","IconCheck"],"mappings":"+LAuBO,SAASA,EAAS,CAAE,UAAAC,EAAW,QAAAC,EAAS,MAAAC,EAAO,MAAAC,EAAO,KAAAC,EAAO,KAAM,GAAGC,GAAwB,CACnG,MAAMC,EAAeJ,EAAM,UAAWK,GAASA,EAAK,MAAQN,CAAO,EAEnE,OACEO,MAAC,KAAA,CAAI,GAAGH,EAAO,aAAYF,EAAO,UAAW,CAACM,EAAAA,QAAO,SAAUA,EAAAA,QAAOL,CAAI,EAAGJ,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,EAC7G,SAAAE,EAAM,IAAI,CAACK,EAAMG,IAAU,CAC1B,MAAMC,EAAQD,EAAQJ,EAAe,WAAaI,IAAUJ,EAAe,UAAY,WAEvF,OACEM,EAAAA,KAAC,KAAA,CACC,eAAcD,IAAU,UAAY,OAAS,OAC7C,UAAW,CAACF,EAAAA,QAAO,KAAMA,EAAAA,QAAOE,CAAK,CAAC,EAAE,KAAK,GAAG,EAGhD,SAAA,CAAAH,MAAC,QAAK,cAAY,OAAO,UAAWC,UAAO,OACxC,SAAAE,IAAU,WAAaH,EAAAA,IAACK,EAAAA,UAAA,EAAU,EAAKL,MAAC,OAAA,CAAK,UAAWC,EAAAA,QAAO,IAAK,EACvE,EACAG,EAAAA,KAAC,OAAA,CAAK,UAAWH,EAAAA,QAAO,KACtB,SAAA,CAAAD,MAAC,OAAA,CAAK,UAAWC,EAAAA,QAAO,MAAQ,WAAK,MAAM,EAC1CE,IAAU,YAAcH,EAAAA,IAAC,QAAK,UAAWC,EAAAA,QAAO,WAAY,SAAA,cAAW,EACvEE,IAAU,WAAaH,EAAAA,IAAC,QAAK,UAAWC,EAAAA,QAAO,WAAY,SAAA,UAAO,EAClEF,EAAK,aAAeC,MAAC,OAAA,CAAK,UAAWC,EAAAA,QAAO,YAAc,WAAK,WAAA,CAAY,EAC3EF,EAAK,MAAQC,MAAC,OAAA,CAAK,UAAWC,EAAAA,QAAO,KAAO,WAAK,IAAA,CAAK,CAAA,CAAA,CACzD,CAAA,CAAA,EAXKF,EAAK,GAAA,CAchB,CAAC,CAAA,CACH,CAEJ"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as a, jsxs as t } from "react/jsx-runtime";
|
|
2
2
|
import e from "./Timeline.module.css.js";
|
|
3
|
-
import { IconCheck as
|
|
4
|
-
function
|
|
5
|
-
const c = s.findIndex((n) => n.key ===
|
|
6
|
-
return /* @__PURE__ */ a("ol", { ...
|
|
3
|
+
import { IconCheck as h } from "../../icons/icons.js";
|
|
4
|
+
function f({ className: i, current: d, items: s, label: o, size: p = "md", ...m }) {
|
|
5
|
+
const c = s.findIndex((n) => n.key === d);
|
|
6
|
+
return /* @__PURE__ */ a("ol", { ...m, "aria-label": o, className: [e.timeline, e[p], i].filter(Boolean).join(" "), children: s.map((n, l) => {
|
|
7
7
|
const r = l < c ? "complete" : l === c ? "current" : "upcoming";
|
|
8
8
|
return /* @__PURE__ */ t(
|
|
9
9
|
"li",
|
|
@@ -11,7 +11,7 @@ function x({ className: i, current: o, items: s, label: d, ...p }) {
|
|
|
11
11
|
"aria-current": r === "current" ? "step" : void 0,
|
|
12
12
|
className: [e.item, e[r]].join(" "),
|
|
13
13
|
children: [
|
|
14
|
-
/* @__PURE__ */ a("span", { "aria-hidden": "true", className: e.marker, children: r === "complete" ? /* @__PURE__ */ a(
|
|
14
|
+
/* @__PURE__ */ a("span", { "aria-hidden": "true", className: e.marker, children: r === "complete" ? /* @__PURE__ */ a(h, {}) : /* @__PURE__ */ a("span", { className: e.dot }) }),
|
|
15
15
|
/* @__PURE__ */ t("span", { className: e.text, children: [
|
|
16
16
|
/* @__PURE__ */ a("span", { className: e.label, children: n.label }),
|
|
17
17
|
r === "complete" && /* @__PURE__ */ a("span", { className: e.hiddenText, children: ", concluído" }),
|
|
@@ -26,6 +26,6 @@ function x({ className: i, current: o, items: s, label: d, ...p }) {
|
|
|
26
26
|
}) });
|
|
27
27
|
}
|
|
28
28
|
export {
|
|
29
|
-
|
|
29
|
+
f as Timeline
|
|
30
30
|
};
|
|
31
31
|
//# sourceMappingURL=Timeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timeline.js","sources":["../../../../src/components/data-display/Timeline/Timeline.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react';\nimport { IconCheck } from '../../icons';\nimport styles from './Timeline.module.css';\n\nexport interface TimelineItem {\n date?: string;\n description?: string;\n key: string;\n label: string;\n}\n\nexport interface TimelineProps extends Omit<ComponentPropsWithRef<'ol'>, 'children'> {\n /** Chave do estado atual. Os anteriores contam como concluídos, os seguintes como por vir. */\n current: string;\n items: readonly TimelineItem[];\n /** Nome da lista, para o leitor de tela. */\n label: string;\n}\n\nexport function Timeline({ className, current, items, label, ...props }: TimelineProps) {\n const currentIndex = items.findIndex((item) => item.key === current);\n\n return (\n <ol {...props} aria-label={label} className={[styles.timeline, className].filter(Boolean).join(' ')}>\n {items.map((item, index) => {\n const state = index < currentIndex ? 'complete' : index === currentIndex ? 'current' : 'upcoming';\n\n return (\n <li\n aria-current={state === 'current' ? 'step' : undefined}\n className={[styles.item, styles[state]].join(' ')}\n key={item.key}\n >\n <span aria-hidden=\"true\" className={styles.marker}>\n {state === 'complete' ? <IconCheck /> : <span className={styles.dot} />}\n </span>\n <span className={styles.text}>\n <span className={styles.label}>{item.label}</span>\n {state === 'complete' && <span className={styles.hiddenText}>, concluído</span>}\n {state === 'current' && <span className={styles.hiddenText}>, atual</span>}\n {item.description && <span className={styles.description}>{item.description}</span>}\n {item.date && <span className={styles.date}>{item.date}</span>}\n </span>\n </li>\n );\n })}\n </ol>\n );\n}\n"],"names":["Timeline","className","current","items","label","props","currentIndex","item","jsx","styles","index","state","jsxs","IconCheck"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Timeline.js","sources":["../../../../src/components/data-display/Timeline/Timeline.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react';\nimport { IconCheck } from '../../icons';\nimport styles from './Timeline.module.css';\n\nexport type TimelineSize = 'sm' | 'md';\n\nexport interface TimelineItem {\n date?: string;\n description?: string;\n key: string;\n label: string;\n}\n\nexport interface TimelineProps extends Omit<ComponentPropsWithRef<'ol'>, 'children'> {\n /** Chave do estado atual. Os anteriores contam como concluídos, os seguintes como por vir. */\n current: string;\n items: readonly TimelineItem[];\n /** Nome da lista, para o leitor de tela. */\n label: string;\n /** `sm` para painéis estreitos: marcador de 16px e rótulo em caption. */\n size?: TimelineSize;\n}\n\nexport function Timeline({ className, current, items, label, size = 'md', ...props }: TimelineProps) {\n const currentIndex = items.findIndex((item) => item.key === current);\n\n return (\n <ol {...props} aria-label={label} className={[styles.timeline, styles[size], className].filter(Boolean).join(' ')}>\n {items.map((item, index) => {\n const state = index < currentIndex ? 'complete' : index === currentIndex ? 'current' : 'upcoming';\n\n return (\n <li\n aria-current={state === 'current' ? 'step' : undefined}\n className={[styles.item, styles[state]].join(' ')}\n key={item.key}\n >\n <span aria-hidden=\"true\" className={styles.marker}>\n {state === 'complete' ? <IconCheck /> : <span className={styles.dot} />}\n </span>\n <span className={styles.text}>\n <span className={styles.label}>{item.label}</span>\n {state === 'complete' && <span className={styles.hiddenText}>, concluído</span>}\n {state === 'current' && <span className={styles.hiddenText}>, atual</span>}\n {item.description && <span className={styles.description}>{item.description}</span>}\n {item.date && <span className={styles.date}>{item.date}</span>}\n </span>\n </li>\n );\n })}\n </ol>\n );\n}\n"],"names":["Timeline","className","current","items","label","size","props","currentIndex","item","jsx","styles","index","state","jsxs","IconCheck"],"mappings":";;;AAuBO,SAASA,EAAS,EAAE,WAAAC,GAAW,SAAAC,GAAS,OAAAC,GAAO,OAAAC,GAAO,MAAAC,IAAO,MAAM,GAAGC,KAAwB;AACnG,QAAMC,IAAeJ,EAAM,UAAU,CAACK,MAASA,EAAK,QAAQN,CAAO;AAEnE,SACE,gBAAAO,EAAC,MAAA,EAAI,GAAGH,GAAO,cAAYF,GAAO,WAAW,CAACM,EAAO,UAAUA,EAAOL,CAAI,GAAGJ,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAC7G,UAAAE,EAAM,IAAI,CAACK,GAAMG,MAAU;AAC1B,UAAMC,IAAQD,IAAQJ,IAAe,aAAaI,MAAUJ,IAAe,YAAY;AAEvF,WACE,gBAAAM;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,gBAAcD,MAAU,YAAY,SAAS;AAAA,QAC7C,WAAW,CAACF,EAAO,MAAMA,EAAOE,CAAK,CAAC,EAAE,KAAK,GAAG;AAAA,QAGhD,UAAA;AAAA,UAAA,gBAAAH,EAAC,UAAK,eAAY,QAAO,WAAWC,EAAO,QACxC,UAAAE,MAAU,aAAa,gBAAAH,EAACK,GAAA,EAAU,IAAK,gBAAAL,EAAC,QAAA,EAAK,WAAWC,EAAO,KAAK,GACvE;AAAA,UACA,gBAAAG,EAAC,QAAA,EAAK,WAAWH,EAAO,MACtB,UAAA;AAAA,YAAA,gBAAAD,EAAC,QAAA,EAAK,WAAWC,EAAO,OAAQ,YAAK,OAAM;AAAA,YAC1CE,MAAU,cAAc,gBAAAH,EAAC,UAAK,WAAWC,EAAO,YAAY,UAAA,eAAW;AAAA,YACvEE,MAAU,aAAa,gBAAAH,EAAC,UAAK,WAAWC,EAAO,YAAY,UAAA,WAAO;AAAA,YAClEF,EAAK,eAAe,gBAAAC,EAAC,QAAA,EAAK,WAAWC,EAAO,aAAc,YAAK,YAAA,CAAY;AAAA,YAC3EF,EAAK,QAAQ,gBAAAC,EAAC,QAAA,EAAK,WAAWC,EAAO,MAAO,YAAK,KAAA,CAAK;AAAA,UAAA,EAAA,CACzD;AAAA,QAAA;AAAA,MAAA;AAAA,MAXKF,EAAK;AAAA,IAAA;AAAA,EAchB,CAAC,EAAA,CACH;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="_timeline_1xvma_2",t="_item_1xvma_12",_="_complete_1xvma_35 _complete_7tv83_37",m="_current_1xvma_43 _current_7tv83_63",n="_marker_1xvma_47 _marker_7tv83_41",o="_dot_1xvma_51",c="_text_1xvma_62",i="_label_1xvma_70 _label_7tv83_92",a="_upcoming_1xvma_74",r="_description_1xvma_78 _description_7tv83_107",s="_date_1xvma_82",d="_hiddenText_1xvma_89 _hiddenText_7tv83_113",l="_sm_1xvma_94",x={timeline:e,item:t,complete:_,current:m,marker:n,dot:o,text:c,label:i,upcoming:a,description:r,date:s,hiddenText:d,sm:l};exports.complete=_;exports.current=m;exports.date=s;exports.default=x;exports.description=r;exports.dot=o;exports.hiddenText=d;exports.item=t;exports.label=i;exports.marker=n;exports.sm=l;exports.text=c;exports.timeline=e;exports.upcoming=a;
|
|
2
2
|
//# sourceMappingURL=Timeline.module.css.cjs.map
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
const t = "
|
|
1
|
+
const t = "_timeline_1xvma_2", _ = "_item_1xvma_12", e = "_complete_1xvma_35 _complete_7tv83_37", m = "_current_1xvma_43 _current_7tv83_63", n = "_marker_1xvma_47 _marker_7tv83_41", c = "_dot_1xvma_51", o = "_text_1xvma_62", a = "_label_1xvma_70 _label_7tv83_92", i = "_upcoming_1xvma_74", s = "_description_1xvma_78 _description_7tv83_107", r = "_date_1xvma_82", x = "_hiddenText_1xvma_89 _hiddenText_7tv83_113", d = "_sm_1xvma_94", v = {
|
|
2
2
|
timeline: t,
|
|
3
3
|
item: _,
|
|
4
4
|
complete: e,
|
|
5
|
-
current:
|
|
5
|
+
current: m,
|
|
6
6
|
marker: n,
|
|
7
7
|
dot: c,
|
|
8
|
-
text:
|
|
9
|
-
label:
|
|
10
|
-
upcoming:
|
|
11
|
-
description:
|
|
12
|
-
date:
|
|
13
|
-
hiddenText:
|
|
8
|
+
text: o,
|
|
9
|
+
label: a,
|
|
10
|
+
upcoming: i,
|
|
11
|
+
description: s,
|
|
12
|
+
date: r,
|
|
13
|
+
hiddenText: x,
|
|
14
|
+
sm: d
|
|
14
15
|
};
|
|
15
16
|
export {
|
|
16
17
|
e as complete,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
m as current,
|
|
19
|
+
r as date,
|
|
20
|
+
v as default,
|
|
21
|
+
s as description,
|
|
21
22
|
c as dot,
|
|
22
|
-
|
|
23
|
+
x as hiddenText,
|
|
23
24
|
_ as item,
|
|
24
|
-
|
|
25
|
+
a as label,
|
|
25
26
|
n as marker,
|
|
26
|
-
|
|
27
|
+
d as sm,
|
|
28
|
+
o as text,
|
|
27
29
|
t as timeline,
|
|
28
|
-
|
|
30
|
+
i as upcoming
|
|
29
31
|
};
|
|
30
32
|
//# sourceMappingURL=Timeline.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timeline.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Timeline.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="_field_thq98_1",e="_control_thq98_8",r="_input_thq98_15",o="_error_thq98_36",_="_text_thq98_76",
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="_field_thq98_1",e="_control_thq98_8",r="_input_thq98_15",o="_error_thq98_36",_="_text_thq98_76",n="_hint_thq98_84 _hint_1ndjk_8",s="_errorMessage_thq98_88 _errorMessage_1ndjk_9",i={field:t,control:e,input:r,error:o,text:_,hint:n,errorMessage:s};exports.control=e;exports.default=i;exports.error=o;exports.errorMessage=s;exports.field=t;exports.hint=n;exports.input=r;exports.text=_;
|
|
2
2
|
//# sourceMappingURL=Checkbox.module.css.cjs.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
const t = "_field_thq98_1", _ = "_control_thq98_8", r = "_input_thq98_15", e = "_error_thq98_36", o = "_text_thq98_76",
|
|
1
|
+
const t = "_field_thq98_1", _ = "_control_thq98_8", r = "_input_thq98_15", e = "_error_thq98_36", o = "_text_thq98_76", n = "_hint_thq98_84 _hint_1ndjk_8", s = "_errorMessage_thq98_88 _errorMessage_1ndjk_9", c = {
|
|
2
2
|
field: t,
|
|
3
3
|
control: _,
|
|
4
4
|
input: r,
|
|
5
5
|
error: e,
|
|
6
6
|
text: o,
|
|
7
|
-
hint:
|
|
8
|
-
errorMessage:
|
|
7
|
+
hint: n,
|
|
8
|
+
errorMessage: s
|
|
9
9
|
};
|
|
10
10
|
export {
|
|
11
11
|
_ as control,
|
|
12
12
|
c as default,
|
|
13
13
|
e as error,
|
|
14
|
-
|
|
14
|
+
s as errorMessage,
|
|
15
15
|
t as field,
|
|
16
|
-
|
|
16
|
+
n as hint,
|
|
17
17
|
r as input,
|
|
18
18
|
o as text
|
|
19
19
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="_group_poytt_2 _group_1nbsm_1",t="_legend_poytt_6 _legend_1nbsm_11",o="_required_poytt_10 _required_1nbsm_20",r="_options_poytt_14",_="_vertical_poytt_19",n="_horizontal_poytt_23",s="_hint_poytt_28
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="_group_poytt_2 _group_1nbsm_1",t="_legend_poytt_6 _legend_1nbsm_11",o="_required_poytt_10 _required_1nbsm_20",r="_options_poytt_14",_="_vertical_poytt_19",n="_horizontal_poytt_23",s="_hint_poytt_28 _hint_1ndjk_8",i="_errorMessage_poytt_32 _errorMessage_1ndjk_9",l={group:e,legend:t,required:o,options:r,vertical:_,horizontal:n,hint:s,errorMessage:i};exports.default=l;exports.errorMessage=i;exports.group=e;exports.hint=s;exports.horizontal=n;exports.legend=t;exports.options=r;exports.required=o;exports.vertical=_;
|
|
2
2
|
//# sourceMappingURL=CheckboxGroup.module.css.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const t = "_group_poytt_2 _group_1nbsm_1", _ = "_legend_poytt_6 _legend_1nbsm_11", o = "_required_poytt_10 _required_1nbsm_20", e = "_options_poytt_14", r = "_vertical_poytt_19", n = "_horizontal_poytt_23", s = "_hint_poytt_28
|
|
1
|
+
const t = "_group_poytt_2 _group_1nbsm_1", _ = "_legend_poytt_6 _legend_1nbsm_11", o = "_required_poytt_10 _required_1nbsm_20", e = "_options_poytt_14", r = "_vertical_poytt_19", n = "_horizontal_poytt_23", s = "_hint_poytt_28 _hint_1ndjk_8", i = "_errorMessage_poytt_32 _errorMessage_1ndjk_9", p = {
|
|
2
2
|
group: t,
|
|
3
3
|
legend: _,
|
|
4
4
|
required: o,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),q=require("react"),e=require("./Field.module.css.cjs"),x=require("../Label/Label.cjs");function y({"aria-describedby":f,className:m,characterCount:i=0,children:j,error:l,hint:a,id:v,label:t,maxLength:n,required:g=!1,showCharacterCount:o=!1,size:c="md",...b}){const B=q.useId(),d=v??`field-${B}`,u=`${d}-message`,r=`${d}-character-count`,N=[f,l||a?u:void 0,o?r:void 0].filter(Boolean).join(" ")||void 0,$=[e.default.control,c==="sm"&&e.default.sm,c==="lg"&&e.default.lg,l&&e.default.invalid].filter(Boolean).join(" ");return s.jsxs("div",{...b,className:[e.default.field,m].filter(Boolean).join(" "),children:[t&&s.jsx(x.Label,{htmlFor:d,required:g,children:t}),j({className:$,describedBy:N,id:d,invalid:!!l}),(l||a)&&s.jsx("span",{className:l?e.default.errorMessage:e.default.hint,id:u,role:l?"alert":void 0,children:l||a}),o&&s.jsx("span",{className:e.default.characterCount,id:r,children:n?`${i}/${n}`:i})]})}exports.Field=y;
|
|
2
2
|
//# sourceMappingURL=Field.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.cjs","sources":["../../../../src/components/forms/Field/Field.tsx"],"sourcesContent":["import { useId, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { Label } from '../Label';\nimport styles from './Field.module.css';\n\nexport type FieldSize = 'sm' | 'md';\n\nexport interface FieldWiring {\n /** O visual dos campos do sistema para o controle — borda, foco, erro e tamanho. A classe do controle vence a dele. */\n className: string;\n describedBy: string | undefined;\n id: string;\n invalid: boolean;\n}\n\nexport interface FieldProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {\n 'aria-describedby'?: string;\n characterCount?: number;\n children: (wiring: FieldWiring) => ReactNode;\n error?: string;\n hint?: string;\n id?: string;\n label?: string;\n maxLength?: number;\n required?: boolean;\n showCharacterCount?: boolean;\n size?: FieldSize;\n}\n\nexport function Field({\n 'aria-describedby': ariaDescribedBy,\n className,\n characterCount = 0,\n children,\n error,\n hint,\n id: providedId,\n label,\n maxLength,\n required = false,\n showCharacterCount = false,\n size = 'md',\n ...props\n}: FieldProps) {\n const generatedId = useId();\n const id = providedId ?? `field-${generatedId}`;\n const messageId = `${id}-message`;\n const characterCountId = `${id}-character-count`;\n const describedBy = [\n ariaDescribedBy,\n error || hint ? messageId : undefined,\n showCharacterCount ? characterCountId : undefined,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n const controlClassName = [styles.control, size === 'sm' && styles.sm, error && styles.invalid].filter(Boolean).join(' ');\n\n return (\n <div {...props} className={[styles.field, className].filter(Boolean).join(' ')}>\n {label && <Label htmlFor={id} required={required}>{label}</Label>}\n {children({ className: controlClassName, describedBy, id, invalid: Boolean(error) })}\n {(error || hint) && (\n <span className={error ? styles.errorMessage : styles.hint} id={messageId} role={error ? 'alert' : undefined}>\n {error || hint}\n </span>\n )}\n {showCharacterCount && (\n <span className={styles.characterCount} id={characterCountId}>\n {maxLength ? `${characterCount}/${maxLength}` : characterCount}\n </span>\n )}\n </div>\n );\n}\n"],"names":["Field","ariaDescribedBy","className","characterCount","children","error","hint","providedId","label","maxLength","required","showCharacterCount","size","props","generatedId","useId","id","messageId","characterCountId","describedBy","controlClassName","styles","jsxs","jsx","Label"],"mappings":"4MA4BO,SAASA,EAAM,CACpB,mBAAoBC,EACpB,UAAAC,EACA,eAAAC,EAAiB,EACjB,SAAAC,EACA,MAAAC,EACA,KAAAC,EACA,GAAIC,EACJ,MAAAC,EACA,UAAAC,EACA,SAAAC,EAAW,GACX,mBAAAC,EAAqB,GACrB,KAAAC,EAAO,KACP,GAAGC,CACL,EAAe,CACb,MAAMC,EAAcC,EAAAA,MAAA,EACdC,EAAKT,GAAc,SAASO,CAAW,GACvCG,EAAY,GAAGD,CAAE,WACjBE,EAAmB,GAAGF,CAAE,mBACxBG,EAAc,CAClBlB,EACAI,GAASC,EAAOW,EAAY,OAC5BN,EAAqBO,EAAmB,MAAA,EAEvC,OAAO,OAAO,EACd,KAAK,GAAG,GAAK,OACVE,EAAmB,CAACC,EAAAA,QAAO,QAAST,IAAS,MAAQS,
|
|
1
|
+
{"version":3,"file":"Field.cjs","sources":["../../../../src/components/forms/Field/Field.tsx"],"sourcesContent":["import { useId, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { Label } from '../Label';\nimport styles from './Field.module.css';\n\nexport type FieldSize = 'sm' | 'md' | 'lg';\n\nexport interface FieldWiring {\n /** O visual dos campos do sistema para o controle — borda, foco, erro e tamanho. A classe do controle vence a dele. */\n className: string;\n describedBy: string | undefined;\n id: string;\n invalid: boolean;\n}\n\nexport interface FieldProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {\n 'aria-describedby'?: string;\n characterCount?: number;\n children: (wiring: FieldWiring) => ReactNode;\n error?: string;\n hint?: string;\n id?: string;\n label?: string;\n maxLength?: number;\n required?: boolean;\n showCharacterCount?: boolean;\n size?: FieldSize;\n}\n\nexport function Field({\n 'aria-describedby': ariaDescribedBy,\n className,\n characterCount = 0,\n children,\n error,\n hint,\n id: providedId,\n label,\n maxLength,\n required = false,\n showCharacterCount = false,\n size = 'md',\n ...props\n}: FieldProps) {\n const generatedId = useId();\n const id = providedId ?? `field-${generatedId}`;\n const messageId = `${id}-message`;\n const characterCountId = `${id}-character-count`;\n const describedBy = [\n ariaDescribedBy,\n error || hint ? messageId : undefined,\n showCharacterCount ? characterCountId : undefined,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n const controlClassName = [styles.control, size === 'sm' && styles.sm, size === 'lg' && styles.lg, error && styles.invalid].filter(Boolean).join(' ');\n\n return (\n <div {...props} className={[styles.field, className].filter(Boolean).join(' ')}>\n {label && <Label htmlFor={id} required={required}>{label}</Label>}\n {children({ className: controlClassName, describedBy, id, invalid: Boolean(error) })}\n {(error || hint) && (\n <span className={error ? styles.errorMessage : styles.hint} id={messageId} role={error ? 'alert' : undefined}>\n {error || hint}\n </span>\n )}\n {showCharacterCount && (\n <span className={styles.characterCount} id={characterCountId}>\n {maxLength ? `${characterCount}/${maxLength}` : characterCount}\n </span>\n )}\n </div>\n );\n}\n"],"names":["Field","ariaDescribedBy","className","characterCount","children","error","hint","providedId","label","maxLength","required","showCharacterCount","size","props","generatedId","useId","id","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AGN,CAAc,IAAIM,CAAS,GAAKN,CAAA,CAClD,CAAA,EAEJ,CAEJ"}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useId as
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as I, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useId as b } from "react";
|
|
3
|
+
import e from "./Field.module.css.js";
|
|
4
4
|
import { Label as h } from "../Label/Label.js";
|
|
5
5
|
function k({
|
|
6
|
-
"aria-describedby":
|
|
7
|
-
className:
|
|
8
|
-
characterCount:
|
|
9
|
-
children:
|
|
10
|
-
error:
|
|
6
|
+
"aria-describedby": f,
|
|
7
|
+
className: p,
|
|
8
|
+
characterCount: a = 0,
|
|
9
|
+
children: v,
|
|
10
|
+
error: s,
|
|
11
11
|
hint: o,
|
|
12
|
-
id:
|
|
13
|
-
label:
|
|
12
|
+
id: g,
|
|
13
|
+
label: d,
|
|
14
14
|
maxLength: n,
|
|
15
15
|
required: j = !1,
|
|
16
16
|
showCharacterCount: c = !1,
|
|
17
|
-
size:
|
|
18
|
-
...
|
|
17
|
+
size: t = "md",
|
|
18
|
+
...B
|
|
19
19
|
}) {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
c ?
|
|
24
|
-
].filter(Boolean).join(" ") || void 0,
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
(
|
|
29
|
-
c && /* @__PURE__ */
|
|
20
|
+
const N = b(), i = g ?? `field-${N}`, m = `${i}-message`, r = `${i}-character-count`, $ = [
|
|
21
|
+
f,
|
|
22
|
+
s || o ? m : void 0,
|
|
23
|
+
c ? r : void 0
|
|
24
|
+
].filter(Boolean).join(" ") || void 0, u = [e.control, t === "sm" && e.sm, t === "lg" && e.lg, s && e.invalid].filter(Boolean).join(" ");
|
|
25
|
+
return /* @__PURE__ */ I("div", { ...B, className: [e.field, p].filter(Boolean).join(" "), children: [
|
|
26
|
+
d && /* @__PURE__ */ l(h, { htmlFor: i, required: j, children: d }),
|
|
27
|
+
v({ className: u, describedBy: $, id: i, invalid: !!s }),
|
|
28
|
+
(s || o) && /* @__PURE__ */ l("span", { className: s ? e.errorMessage : e.hint, id: m, role: s ? "alert" : void 0, children: s || o }),
|
|
29
|
+
c && /* @__PURE__ */ l("span", { className: e.characterCount, id: r, children: n ? `${a}/${n}` : a })
|
|
30
30
|
] });
|
|
31
31
|
}
|
|
32
32
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sources":["../../../../src/components/forms/Field/Field.tsx"],"sourcesContent":["import { useId, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { Label } from '../Label';\nimport styles from './Field.module.css';\n\nexport type FieldSize = 'sm' | 'md';\n\nexport interface FieldWiring {\n /** O visual dos campos do sistema para o controle — borda, foco, erro e tamanho. A classe do controle vence a dele. */\n className: string;\n describedBy: string | undefined;\n id: string;\n invalid: boolean;\n}\n\nexport interface FieldProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {\n 'aria-describedby'?: string;\n characterCount?: number;\n children: (wiring: FieldWiring) => ReactNode;\n error?: string;\n hint?: string;\n id?: string;\n label?: string;\n maxLength?: number;\n required?: boolean;\n showCharacterCount?: boolean;\n size?: FieldSize;\n}\n\nexport function Field({\n 'aria-describedby': ariaDescribedBy,\n className,\n characterCount = 0,\n children,\n error,\n hint,\n id: providedId,\n label,\n maxLength,\n required = false,\n showCharacterCount = false,\n size = 'md',\n ...props\n}: FieldProps) {\n const generatedId = useId();\n const id = providedId ?? `field-${generatedId}`;\n const messageId = `${id}-message`;\n const characterCountId = `${id}-character-count`;\n const describedBy = [\n ariaDescribedBy,\n error || hint ? messageId : undefined,\n showCharacterCount ? characterCountId : undefined,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n const controlClassName = [styles.control, size === 'sm' && styles.sm, error && styles.invalid].filter(Boolean).join(' ');\n\n return (\n <div {...props} className={[styles.field, className].filter(Boolean).join(' ')}>\n {label && <Label htmlFor={id} required={required}>{label}</Label>}\n {children({ className: controlClassName, describedBy, id, invalid: Boolean(error) })}\n {(error || hint) && (\n <span className={error ? styles.errorMessage : styles.hint} id={messageId} role={error ? 'alert' : undefined}>\n {error || hint}\n </span>\n )}\n {showCharacterCount && (\n <span className={styles.characterCount} id={characterCountId}>\n {maxLength ? `${characterCount}/${maxLength}` : characterCount}\n </span>\n )}\n </div>\n );\n}\n"],"names":["Field","ariaDescribedBy","className","characterCount","children","error","hint","providedId","label","maxLength","required","showCharacterCount","size","props","generatedId","useId","id","messageId","characterCountId","describedBy","controlClassName","styles","jsxs","jsx","Label"],"mappings":";;;;AA4BO,SAASA,EAAM;AAAA,EACpB,oBAAoBC;AAAA,EACpB,WAAAC;AAAA,EACA,gBAAAC,IAAiB;AAAA,EACjB,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,IAAIC;AAAA,EACJ,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,oBAAAC,IAAqB;AAAA,EACrB,MAAAC,IAAO;AAAA,EACP,GAAGC;AACL,GAAe;AACb,QAAMC,IAAcC,EAAA,GACdC,IAAKT,KAAc,SAASO,CAAW,IACvCG,IAAY,GAAGD,CAAE,YACjBE,IAAmB,GAAGF,CAAE,oBACxBG,IAAc;AAAA,IAClBlB;AAAA,IACAI,KAASC,IAAOW,IAAY;AAAA,IAC5BN,IAAqBO,IAAmB;AAAA,EAAA,EAEvC,OAAO,OAAO,EACd,KAAK,GAAG,KAAK,QACVE,IAAmB,CAACC,EAAO,SAAST,MAAS,QAAQS,EAAO,IAAIhB,KAASgB,EAAO,OAAO,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;
|
|
1
|
+
{"version":3,"file":"Field.js","sources":["../../../../src/components/forms/Field/Field.tsx"],"sourcesContent":["import { useId, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { Label } from '../Label';\nimport styles from './Field.module.css';\n\nexport type FieldSize = 'sm' | 'md' | 'lg';\n\nexport interface FieldWiring {\n /** O visual dos campos do sistema para o controle — borda, foco, erro e tamanho. A classe do controle vence a dele. */\n className: string;\n describedBy: string | undefined;\n id: string;\n invalid: boolean;\n}\n\nexport interface FieldProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {\n 'aria-describedby'?: string;\n characterCount?: number;\n children: (wiring: FieldWiring) => ReactNode;\n error?: string;\n hint?: string;\n id?: string;\n label?: string;\n maxLength?: number;\n required?: boolean;\n showCharacterCount?: boolean;\n size?: FieldSize;\n}\n\nexport function Field({\n 'aria-describedby': ariaDescribedBy,\n className,\n characterCount = 0,\n children,\n error,\n hint,\n id: providedId,\n label,\n maxLength,\n required = false,\n showCharacterCount = false,\n size = 'md',\n ...props\n}: FieldProps) {\n const generatedId = useId();\n const id = providedId ?? `field-${generatedId}`;\n const messageId = `${id}-message`;\n const characterCountId = `${id}-character-count`;\n const describedBy = [\n ariaDescribedBy,\n error || hint ? messageId : undefined,\n showCharacterCount ? characterCountId : undefined,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n const controlClassName = [styles.control, size === 'sm' && styles.sm, size === 'lg' && styles.lg, error && styles.invalid].filter(Boolean).join(' ');\n\n return (\n <div {...props} className={[styles.field, className].filter(Boolean).join(' ')}>\n {label && <Label htmlFor={id} required={required}>{label}</Label>}\n {children({ className: controlClassName, describedBy, id, invalid: Boolean(error) })}\n {(error || hint) && (\n <span className={error ? styles.errorMessage : styles.hint} id={messageId} role={error ? 'alert' : undefined}>\n {error || hint}\n </span>\n )}\n {showCharacterCount && (\n <span className={styles.characterCount} id={characterCountId}>\n {maxLength ? `${characterCount}/${maxLength}` : characterCount}\n </span>\n )}\n </div>\n );\n}\n"],"names":["Field","ariaDescribedBy","className","characterCount","children","error","hint","providedId","label","maxLength","required","showCharacterCount","size","props","generatedId","useId","id","messageId","characterCountId","describedBy","controlClassName","styles","jsxs","jsx","Label"],"mappings":";;;;AA4BO,S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T,IAAY,GAAGN,CAAc,IAAIM,CAAS,KAAKN,EAAA,CAClD;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="_field_1ndjk_1",n="_hint_1ndjk_8",o="_errorMessage_1ndjk_9",t="_characterCount_1ndjk_10",r="_formValue_1ndjk_31",_="_control_1ndjk_40",s="_invalid_1ndjk_59",l="_sm_1ndjk_77",a="_lg_1ndjk_84",c={field:e,hint:n,errorMessage:o,characterCount:t,formValue:r,control:_,invalid:s,sm:l,lg:a};exports.characterCount=t;exports.control=_;exports.default=c;exports.errorMessage=o;exports.field=e;exports.formValue=r;exports.hint=n;exports.invalid=s;exports.lg=a;exports.sm=l;
|
|
2
2
|
//# sourceMappingURL=Field.module.css.cjs.map
|