@treeal/ds 0.1.0 → 0.1.2

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.
Files changed (116) hide show
  1. package/dist/assets/style.css +1 -1
  2. package/dist/components/Select/Select.d.ts +24 -0
  3. package/dist/components/Select/Select.d.ts.map +1 -0
  4. package/dist/components/Select/index.d.ts +3 -0
  5. package/dist/components/Select/index.d.ts.map +1 -0
  6. package/dist/components/Tab/Tab.d.ts +22 -0
  7. package/dist/components/Tab/Tab.d.ts.map +1 -0
  8. package/dist/components/Tab/index.d.ts +3 -0
  9. package/dist/components/Tab/index.d.ts.map +1 -0
  10. package/dist/components/index.d.ts +5 -0
  11. package/dist/components/index.d.ts.map +1 -1
  12. package/dist/index.cjs.js +1 -1
  13. package/dist/index.cjs10.js +1 -1
  14. package/dist/index.cjs10.js.map +1 -1
  15. package/dist/index.cjs11.js +1 -1
  16. package/dist/index.cjs11.js.map +1 -1
  17. package/dist/index.cjs12.js +1 -1
  18. package/dist/index.cjs12.js.map +1 -1
  19. package/dist/index.cjs13.js +1 -1
  20. package/dist/index.cjs13.js.map +1 -1
  21. package/dist/index.cjs14.js +1 -1
  22. package/dist/index.cjs14.js.map +1 -1
  23. package/dist/index.cjs15.js +1 -1
  24. package/dist/index.cjs15.js.map +1 -1
  25. package/dist/index.cjs16.js +1 -1
  26. package/dist/index.cjs16.js.map +1 -1
  27. package/dist/index.cjs17.js +1 -1
  28. package/dist/index.cjs18.js +1 -1
  29. package/dist/index.cjs19.js +1 -1
  30. package/dist/index.cjs20.js +1 -1
  31. package/dist/index.cjs21.js +1 -1
  32. package/dist/index.cjs22.js +1 -1
  33. package/dist/index.cjs23.js +1 -1
  34. package/dist/index.cjs24.js +2 -0
  35. package/dist/index.cjs24.js.map +1 -0
  36. package/dist/index.cjs25.js +2 -0
  37. package/dist/index.cjs25.js.map +1 -0
  38. package/dist/index.cjs26.js +2 -0
  39. package/dist/index.cjs26.js.map +1 -0
  40. package/dist/index.cjs27.js +2 -0
  41. package/dist/index.cjs27.js.map +1 -0
  42. package/dist/index.cjs28.js +2 -0
  43. package/dist/index.cjs28.js.map +1 -0
  44. package/dist/index.cjs3.js +1 -1
  45. package/dist/index.cjs3.js.map +1 -1
  46. package/dist/index.cjs4.js +1 -1
  47. package/dist/index.cjs4.js.map +1 -1
  48. package/dist/index.cjs5.js +1 -1
  49. package/dist/index.cjs5.js.map +1 -1
  50. package/dist/index.cjs6.js +1 -1
  51. package/dist/index.cjs6.js.map +1 -1
  52. package/dist/index.cjs7.js +1 -1
  53. package/dist/index.cjs7.js.map +1 -1
  54. package/dist/index.cjs8.js +1 -1
  55. package/dist/index.cjs8.js.map +1 -1
  56. package/dist/index.cjs9.js +1 -1
  57. package/dist/index.cjs9.js.map +1 -1
  58. package/dist/index.esm.js +29 -24
  59. package/dist/index.esm.js.map +1 -1
  60. package/dist/index.esm10.js +66 -226
  61. package/dist/index.esm10.js.map +1 -1
  62. package/dist/index.esm11.js +221 -160
  63. package/dist/index.esm11.js.map +1 -1
  64. package/dist/index.esm12.js +157 -73
  65. package/dist/index.esm12.js.map +1 -1
  66. package/dist/index.esm13.js +54 -209
  67. package/dist/index.esm13.js.map +1 -1
  68. package/dist/index.esm14.js +90 -23
  69. package/dist/index.esm14.js.map +1 -1
  70. package/dist/index.esm15.js +35 -31
  71. package/dist/index.esm15.js.map +1 -1
  72. package/dist/index.esm16.js +219 -61
  73. package/dist/index.esm16.js.map +1 -1
  74. package/dist/index.esm17.js +38 -60
  75. package/dist/index.esm17.js.map +1 -1
  76. package/dist/index.esm18.js +22 -38
  77. package/dist/index.esm18.js.map +1 -1
  78. package/dist/index.esm19.js +102 -22
  79. package/dist/index.esm19.js.map +1 -1
  80. package/dist/index.esm20.js +22 -20
  81. package/dist/index.esm20.js.map +1 -1
  82. package/dist/index.esm21.js +20 -48
  83. package/dist/index.esm21.js.map +1 -1
  84. package/dist/index.esm22.js +59 -21
  85. package/dist/index.esm22.js.map +1 -1
  86. package/dist/index.esm23.js +60 -102
  87. package/dist/index.esm23.js.map +1 -1
  88. package/dist/index.esm24.js +26 -0
  89. package/dist/index.esm24.js.map +1 -0
  90. package/dist/index.esm25.js +52 -0
  91. package/dist/index.esm25.js.map +1 -0
  92. package/dist/index.esm26.js +34 -0
  93. package/dist/index.esm26.js.map +1 -0
  94. package/dist/index.esm27.js +26 -0
  95. package/dist/index.esm27.js.map +1 -0
  96. package/dist/index.esm28.js +16 -0
  97. package/dist/index.esm28.js.map +1 -0
  98. package/dist/index.esm3.js +89 -53
  99. package/dist/index.esm3.js.map +1 -1
  100. package/dist/index.esm4.js +58 -111
  101. package/dist/index.esm4.js.map +1 -1
  102. package/dist/index.esm5.js +106 -60
  103. package/dist/index.esm5.js.map +1 -1
  104. package/dist/index.esm6.js +60 -28
  105. package/dist/index.esm6.js.map +1 -1
  106. package/dist/index.esm7.js +26 -171
  107. package/dist/index.esm7.js.map +1 -1
  108. package/dist/index.esm8.js +167 -54
  109. package/dist/index.esm8.js.map +1 -1
  110. package/dist/index.esm9.js +62 -71
  111. package/dist/index.esm9.js.map +1 -1
  112. package/package.json +1 -1
  113. package/dist/index.cjs2.js +0 -2
  114. package/dist/index.cjs2.js.map +0 -1
  115. package/dist/index.esm2.js +0 -98
  116. package/dist/index.esm2.js.map +0 -1
@@ -1,93 +1,177 @@
1
- import { jsx as n, jsxs as d } from "react/jsx-runtime";
2
- import S from "react";
3
- import e from "./index.esm21.js";
4
- function u(t, o) {
5
- return t < o ? "Complete" : t === o ? "Active" : "Default";
6
- }
7
- function g(t, o) {
8
- return t === 0 ? "Start" : t === o - 1 ? "End" : "Step";
9
- }
10
- function j() {
11
- return /* @__PURE__ */ d(
1
+ import { jsxs as a, jsx as n } from "react/jsx-runtime";
2
+ import r from "./index.esm21.js";
3
+ const f = { xs: 12, md: 20, lg: 24 }, v = ({ s: i }) => /* @__PURE__ */ a("svg", { width: i, height: i, viewBox: "0 0 12 12", fill: "currentColor", "aria-hidden": "true", children: [
4
+ /* @__PURE__ */ n("circle", { cx: "2", cy: "6", r: "1.25" }),
5
+ /* @__PURE__ */ n("circle", { cx: "6", cy: "6", r: "1.25" }),
6
+ /* @__PURE__ */ n("circle", { cx: "10", cy: "6", r: "1.25" })
7
+ ] }), m = ({ s: i }) => (
8
+ // Arrows/Chevron Left single chevron «
9
+ /* @__PURE__ */ n(
10
+ "svg",
11
+ {
12
+ width: i,
13
+ height: i,
14
+ viewBox: "0 0 12 12",
15
+ fill: "none",
16
+ stroke: "currentColor",
17
+ strokeWidth: "1.5",
18
+ strokeLinecap: "round",
19
+ strokeLinejoin: "round",
20
+ "aria-hidden": "true",
21
+ children: /* @__PURE__ */ n("polyline", { points: "7.5,2 4,6 7.5,10" })
22
+ }
23
+ )
24
+ ), y = ({ s: i }) => (
25
+ // Arrows/Chevron Right — single chevron »
26
+ /* @__PURE__ */ n(
27
+ "svg",
28
+ {
29
+ width: i,
30
+ height: i,
31
+ viewBox: "0 0 12 12",
32
+ fill: "none",
33
+ stroke: "currentColor",
34
+ strokeWidth: "1.5",
35
+ strokeLinecap: "round",
36
+ strokeLinejoin: "round",
37
+ "aria-hidden": "true",
38
+ children: /* @__PURE__ */ n("polyline", { points: "4.5,2 8,6 4.5,10" })
39
+ }
40
+ )
41
+ ), x = ({ s: i }) => (
42
+ // Arrows/Chevrons Left — double chevron «
43
+ /* @__PURE__ */ a(
12
44
  "svg",
13
45
  {
14
- width: "24",
15
- height: "24",
16
- viewBox: "0 0 24 24",
46
+ width: i,
47
+ height: i,
48
+ viewBox: "0 0 12 12",
17
49
  fill: "none",
18
50
  stroke: "currentColor",
19
- strokeWidth: "2.5",
51
+ strokeWidth: "1.5",
20
52
  strokeLinecap: "round",
21
53
  strokeLinejoin: "round",
22
54
  "aria-hidden": "true",
23
55
  children: [
24
- /* @__PURE__ */ n("polyline", { points: "2,12.5 6,16.5 13,9.5" }),
25
- /* @__PURE__ */ n("polyline", { points: "9,12.5 13,16.5 21,9.5" })
56
+ /* @__PURE__ */ n("polyline", { points: "6.5,2 3,6 6.5,10" }),
57
+ /* @__PURE__ */ n("polyline", { points: "9.5,2 6,6 9.5,10" })
26
58
  ]
27
59
  }
28
- );
29
- }
30
- function N({ steps: t, current: o }) {
31
- return /* @__PURE__ */ n("div", { className: e.minified, role: "list", "aria-label": "Steps", children: t.map((m, a) => {
32
- const i = u(a, o), s = a === t.length - 1, c = [
33
- e.minDot,
34
- i === "Default" ? e.minDefault : "",
35
- i === "Active" ? e.minActive : "",
36
- i === "Complete" ? e.minComplete : ""
37
- ].filter(Boolean).join(" "), r = [
38
- e.minConnector,
39
- i === "Complete" ? e.minConnectorComplete : e.minConnectorDefault
40
- ].join(" ");
41
- return /* @__PURE__ */ d(S.Fragment, { children: [
42
- /* @__PURE__ */ n(
43
- "div",
44
- {
45
- role: "listitem",
46
- className: c,
47
- "aria-label": `Step ${a + 1}: ${m.label}${i === "Active" ? " (current)" : i === "Complete" ? " (completed)" : ""}`,
48
- "aria-current": i === "Active" ? "step" : void 0
49
- }
50
- ),
51
- !s && /* @__PURE__ */ n("div", { className: r, "aria-hidden": "true" })
52
- ] }, a);
53
- }) });
60
+ )
61
+ ), C = ({ s: i }) => (
62
+ // Arrows/Chevrons Right double chevron »
63
+ /* @__PURE__ */ a(
64
+ "svg",
65
+ {
66
+ width: i,
67
+ height: i,
68
+ viewBox: "0 0 12 12",
69
+ fill: "none",
70
+ stroke: "currentColor",
71
+ strokeWidth: "1.5",
72
+ strokeLinecap: "round",
73
+ strokeLinejoin: "round",
74
+ "aria-hidden": "true",
75
+ children: [
76
+ /* @__PURE__ */ n("polyline", { points: "2.5,2 6,6 2.5,10" }),
77
+ /* @__PURE__ */ n("polyline", { points: "5.5,2 9,6 5.5,10" })
78
+ ]
79
+ }
80
+ )
81
+ );
82
+ function L(i, o) {
83
+ return o <= 7 ? Array.from({ length: o }, (t, d) => d + 1) : i <= 4 ? [1, 2, 3, 4, 5, "", o] : i >= o - 3 ? [1, "…", o - 4, o - 3, o - 2, o - 1, o] : [1, "", i - 1, i, i + 1, "…", o];
54
84
  }
55
- function k({ steps: t, current: o, minified: m = !1, className: a }) {
56
- const i = [e.steps, a].filter(Boolean).join(" ");
57
- if (m)
58
- return /* @__PURE__ */ n("div", { className: i, children: /* @__PURE__ */ n(N, { steps: t, current: o }) });
59
- const s = t.length;
60
- return /* @__PURE__ */ n(
85
+ function w({
86
+ sizes: i = "xs",
87
+ currentPage: o = 1,
88
+ totalPages: t = 10,
89
+ withControls: d = !1,
90
+ withEdges: u = !1,
91
+ onChange: h,
92
+ className: p
93
+ }) {
94
+ const s = f[i], b = L(o, t), c = (e) => {
95
+ e < 1 || e > t || e === o || h == null || h(e);
96
+ }, l = (e) => [r.item, r[i], e].filter(Boolean).join(" ");
97
+ return /* @__PURE__ */ a(
61
98
  "nav",
62
99
  {
63
- className: i,
64
- "aria-label": "Steps",
65
- children: t.map((c, r) => {
66
- const l = u(r, o), f = g(r, s), h = l === "Active" || l === "Complete", C = s - r, v = [
67
- e.item,
68
- e[`type${f}`],
69
- e[`state${l}`]
70
- ].join(" "), p = h ? e.textLight : e.textDark;
71
- return /* @__PURE__ */ d(
72
- "div",
100
+ role: "navigation",
101
+ "aria-label": "Pagination",
102
+ className: [r.pagination, p].filter(Boolean).join(" "),
103
+ children: [
104
+ u && /* @__PURE__ */ n(
105
+ "button",
73
106
  {
74
- className: v,
75
- style: { zIndex: C },
76
- role: "listitem",
77
- "aria-current": l === "Active" ? "step" : void 0,
78
- "aria-label": `Step ${r + 1} of ${s}: ${c.label}${l === "Active" ? " (current)" : l === "Complete" ? " (completed)" : ""}`,
79
- children: [
80
- /* @__PURE__ */ n("span", { className: [e.label, p].join(" "), children: c.label }),
81
- l === "Complete" ? /* @__PURE__ */ n("span", { className: [e.checkIcon, p].join(" "), children: /* @__PURE__ */ n(j, {}) }) : /* @__PURE__ */ n("span", { className: [e.num, p].join(" "), children: String(r + 1).padStart(2, "0") })
82
- ]
83
- },
84
- r
85
- );
86
- })
107
+ className: l(r.control),
108
+ onClick: () => c(1),
109
+ disabled: o === 1,
110
+ "aria-label": "First page",
111
+ type: "button",
112
+ children: /* @__PURE__ */ n(x, { s })
113
+ }
114
+ ),
115
+ d && /* @__PURE__ */ n(
116
+ "button",
117
+ {
118
+ className: l(r.control),
119
+ onClick: () => c(o - 1),
120
+ disabled: o === 1,
121
+ "aria-label": "Previous page",
122
+ type: "button",
123
+ children: /* @__PURE__ */ n(m, { s })
124
+ }
125
+ ),
126
+ b.map(
127
+ (e, k) => e === "…" ? /* @__PURE__ */ n(
128
+ "span",
129
+ {
130
+ className: l(r.dots),
131
+ "aria-hidden": "true",
132
+ children: /* @__PURE__ */ n(v, { s })
133
+ },
134
+ `dots-${k}`
135
+ ) : /* @__PURE__ */ n(
136
+ "button",
137
+ {
138
+ className: l(e === o ? r.active : r.inactive),
139
+ onClick: () => c(e),
140
+ "aria-label": `Page ${e}`,
141
+ "aria-current": e === o ? "page" : void 0,
142
+ type: "button",
143
+ children: e
144
+ },
145
+ e
146
+ )
147
+ ),
148
+ d && /* @__PURE__ */ n(
149
+ "button",
150
+ {
151
+ className: l(r.control),
152
+ onClick: () => c(o + 1),
153
+ disabled: o === t,
154
+ "aria-label": "Next page",
155
+ type: "button",
156
+ children: /* @__PURE__ */ n(y, { s })
157
+ }
158
+ ),
159
+ u && /* @__PURE__ */ n(
160
+ "button",
161
+ {
162
+ className: l(r.control),
163
+ onClick: () => c(t),
164
+ disabled: o === t,
165
+ "aria-label": "Last page",
166
+ type: "button",
167
+ children: /* @__PURE__ */ n(C, { s })
168
+ }
169
+ )
170
+ ]
87
171
  }
88
172
  );
89
173
  }
90
174
  export {
91
- k as Steps
175
+ w as Pagination
92
176
  };
93
177
  //# sourceMappingURL=index.esm12.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm12.js","sources":["../components/Steps/Steps.tsx"],"sourcesContent":["import React from 'react';\nimport styles from './Steps.module.css';\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\nexport interface StepItem {\n label: string;\n description?: string;\n}\n\nexport interface StepsProps {\n steps: StepItem[];\n /** 0-based index of the currently active step */\n current: number;\n /** Compact dot version — for mobile or tight spaces */\n minified?: boolean;\n className?: string;\n}\n\ntype StepState = 'Default' | 'Active' | 'Complete';\ntype StepType = 'Start' | 'Step' | 'End';\n\n// ─── Helpers ──────────────────────────────────────────────────────────────────\n\nfunction getState(index: number, current: number): StepState {\n if (index < current) return 'Complete';\n if (index === current) return 'Active';\n return 'Default';\n}\n\nfunction getType(index: number, total: number): StepType {\n if (index === 0) return 'Start';\n if (index === total - 1) return 'End';\n return 'Step';\n}\n\n// ─── Double-check icon (tabler:checks) — inline SVG ──────────────────────────\n\nfunction IconChecks() {\n return (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n {/* left check */}\n <polyline points=\"2,12.5 6,16.5 13,9.5\" />\n {/* right check (shifted) */}\n <polyline points=\"9,12.5 13,16.5 21,9.5\" />\n </svg>\n );\n}\n\n// ─── Minified (dots) version ──────────────────────────────────────────────────\n\nfunction MinifiedSteps({ steps, current }: Pick<StepsProps, 'steps' | 'current'>) {\n return (\n <div className={styles.minified} role=\"list\" aria-label=\"Steps\">\n {steps.map((step, i) => {\n const state = getState(i, current);\n const isLast = i === steps.length - 1;\n\n const dotClass = [\n styles.minDot,\n state === 'Default' ? styles.minDefault : '',\n state === 'Active' ? styles.minActive : '',\n state === 'Complete' ? styles.minComplete : '',\n ]\n .filter(Boolean)\n .join(' ');\n\n // Connector color: complete if the step TO THE LEFT is complete\n const connectorClass = [\n styles.minConnector,\n state === 'Complete' ? styles.minConnectorComplete : styles.minConnectorDefault,\n ].join(' ');\n\n return (\n <React.Fragment key={i}>\n <div\n role=\"listitem\"\n className={dotClass}\n aria-label={`Step ${i + 1}: ${step.label}${\n state === 'Active' ? ' (current)' : state === 'Complete' ? ' (completed)' : ''\n }`}\n aria-current={state === 'Active' ? 'step' : undefined}\n />\n {!isLast && <div className={connectorClass} aria-hidden=\"true\" />}\n </React.Fragment>\n );\n })}\n </div>\n );\n}\n\n// ─── Full Steps ───────────────────────────────────────────────────────────────\n\nexport function Steps({ steps, current, minified = false, className }: StepsProps) {\n const wrapperClass = [styles.steps, className].filter(Boolean).join(' ');\n\n if (minified) {\n return (\n <div className={wrapperClass}>\n <MinifiedSteps steps={steps} current={current} />\n </div>\n );\n }\n\n const total = steps.length;\n\n return (\n <nav\n className={wrapperClass}\n aria-label=\"Steps\"\n >\n {steps.map((step, i) => {\n const state = getState(i, current);\n const type = getType(i, total);\n const isLight = state === 'Active' || state === 'Complete';\n\n /*\n * z-index stacking: first item (Start) is highest.\n * Its arrow paints on top of the next item's notch,\n * creating the connected-chevron effect.\n */\n const zIndex = total - i;\n\n const itemClass = [\n styles.item,\n styles[`type${type}`],\n styles[`state${state}`],\n ].join(' ');\n\n const textClass = isLight ? styles.textLight : styles.textDark;\n\n return (\n <div\n key={i}\n className={itemClass}\n style={{ zIndex }}\n role=\"listitem\"\n aria-current={state === 'Active' ? 'step' : undefined}\n aria-label={`Step ${i + 1} of ${total}: ${step.label}${\n state === 'Active' ? ' (current)' : state === 'Complete' ? ' (completed)' : ''\n }`}\n >\n {/* Label */}\n <span className={[styles.label, textClass].join(' ')}>\n {step.label}\n </span>\n\n {/* Number (Default / Active) or check icon (Complete) */}\n {state === 'Complete' ? (\n <span className={[styles.checkIcon, textClass].join(' ')}>\n <IconChecks />\n </span>\n ) : (\n <span className={[styles.num, textClass].join(' ')}>\n {String(i + 1).padStart(2, '0')}\n </span>\n )}\n </div>\n );\n })}\n </nav>\n );\n}\n"],"names":["getState","index","current","getType","total","IconChecks","jsxs","jsx","MinifiedSteps","steps","styles","step","i","state","isLast","dotClass","connectorClass","React","Steps","minified","className","wrapperClass","type","isLight","zIndex","itemClass","textClass"],"mappings":";;;AAwBA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AAA,YACL,gBAAcX,MAAU,WAAW,SAAS;AAAA,YAC5C,cAAY,QAAQD,IAAI,CAAC,OAAOR,CAAK,KAAKO,EAAK,KAAK,GAClDE,MAAU,WAAW,eAAeA,MAAU,aAAa,iBAAiB,EAC9E;AAAA,YAGA,UAAA;AAAA,cAAA,gBAAAN,EAAC,QAAA,EAAK,WAAW,CAACG,EAAO,OAAOgB,CAAS,EAAE,KAAK,GAAG,GAChD,UAAAf,EAAK,MAAA,CACR;AAAA,cAGCE,MAAU,aACT,gBAAAN,EAAC,QAAA,EAAK,WAAW,CAACG,EAAO,WAAWgB,CAAS,EAAE,KAAK,GAAG,GACrD,UAAA,gBAAAnB,EAACF,KAAW,GACd,IAEA,gBAAAE,EAAC,QAAA,EAAK,WAAW,CAACG,EAAO,KAAKgB,CAAS,EAAE,KAAK,GAAG,GAC9C,UAAA,OAAOd,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG,EAAA,CAChC;AAAA,YAAA;AAAA,UAAA;AAAA,UAtBGA;AAAA,QAAA;AAAA,MA0BX,CAAC;AAAA,IAAA;AAAA,EAAA;AAGP;"}
1
+ {"version":3,"file":"index.esm12.js","sources":["../components/Pagination/Pagination.tsx"],"sourcesContent":["import React from 'react';\nimport styles from './Pagination.module.css';\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\nexport type PaginationSize = 'xs' | 'md' | 'lg';\n\nexport interface PaginationProps {\n sizes?: PaginationSize;\n currentPage?: number;\n totalPages?: number;\n /** Show previous / next chevron buttons */\n withControls?: boolean;\n /** Show first / last double-chevron buttons */\n withEdges?: boolean;\n onChange?: (page: number) => void;\n className?: string;\n}\n\n// ─── Icon size lookup (xs=12, md=20, lg=24 — from Figma) ─────────────────────\n\nconst ICON_SIZE: Record<PaginationSize, number> = { xs: 12, md: 20, lg: 24 };\n\n// ─── SVG icons (inline, no external dependency) ──────────────────────────────\n\nconst IconDots = ({ s }: { s: number }) => (\n <svg width={s} height={s} viewBox=\"0 0 12 12\" fill=\"currentColor\" aria-hidden=\"true\">\n {/* System/Dots — 3 horizontal dots */}\n <circle cx=\"2\" cy=\"6\" r=\"1.25\" />\n <circle cx=\"6\" cy=\"6\" r=\"1.25\" />\n <circle cx=\"10\" cy=\"6\" r=\"1.25\" />\n </svg>\n);\n\nconst IconChevronLeft = ({ s }: { s: number }) => (\n // Arrows/Chevron Left — single chevron «\n <svg width={s} height={s} viewBox=\"0 0 12 12\" fill=\"none\" stroke=\"currentColor\"\n strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n <polyline points=\"7.5,2 4,6 7.5,10\" />\n </svg>\n);\n\nconst IconChevronRight = ({ s }: { s: number }) => (\n // Arrows/Chevron Right — single chevron »\n <svg width={s} height={s} viewBox=\"0 0 12 12\" fill=\"none\" stroke=\"currentColor\"\n strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n <polyline points=\"4.5,2 8,6 4.5,10\" />\n </svg>\n);\n\nconst IconChevronsLeft = ({ s }: { s: number }) => (\n // Arrows/Chevrons Left — double chevron «\n <svg width={s} height={s} viewBox=\"0 0 12 12\" fill=\"none\" stroke=\"currentColor\"\n strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n <polyline points=\"6.5,2 3,6 6.5,10\" />\n <polyline points=\"9.5,2 6,6 9.5,10\" />\n </svg>\n);\n\nconst IconChevronsRight = ({ s }: { s: number }) => (\n // Arrows/Chevrons Right — double chevron »\n <svg width={s} height={s} viewBox=\"0 0 12 12\" fill=\"none\" stroke=\"currentColor\"\n strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n <polyline points=\"2.5,2 6,6 2.5,10\" />\n <polyline points=\"5.5,2 9,6 5.5,10\" />\n </svg>\n);\n\n// ─── Page range algorithm ─────────────────────────────────────────────────────\n// Produces an array like: [1, 2, 3, 4, 5, '…', 10]\n// or: [1, '…', 4, 5, 6, '…', 10]\n// Matches the Figma design: first 5 visible, dots, last page\n\ntype PageItem = number | '…';\n\nfunction buildRange(current: number, total: number): PageItem[] {\n if (total <= 7) {\n return Array.from({ length: total }, (_, i) => i + 1);\n }\n\n // Near the start — show first 5, dots, last\n if (current <= 4) {\n return [1, 2, 3, 4, 5, '…', total];\n }\n\n // Near the end — show first, dots, last 5\n if (current >= total - 3) {\n return [1, '…', total - 4, total - 3, total - 2, total - 1, total];\n }\n\n // Middle — first, dots, (current-1), current, (current+1), dots, last\n return [1, '…', current - 1, current, current + 1, '…', total];\n}\n\n// ─── Component ────────────────────────────────────────────────────────────────\n\nexport function Pagination({\n sizes = 'xs',\n currentPage = 1,\n totalPages = 10,\n withControls = false,\n withEdges = false,\n onChange,\n className,\n}: PaginationProps) {\n const iconSize = ICON_SIZE[sizes];\n const pages = buildRange(currentPage, totalPages);\n\n const go = (page: number) => {\n if (page < 1 || page > totalPages || page === currentPage) return;\n onChange?.(page);\n };\n\n const itemClass = (extra: string) =>\n [styles.item, styles[sizes], extra].filter(Boolean).join(' ');\n\n return (\n <nav\n role=\"navigation\"\n aria-label=\"Pagination\"\n className={[styles.pagination, className].filter(Boolean).join(' ')}\n >\n {/* First page button («) */}\n {withEdges && (\n <button\n className={itemClass(styles.control)}\n onClick={() => go(1)}\n disabled={currentPage === 1}\n aria-label=\"First page\"\n type=\"button\"\n >\n <IconChevronsLeft s={iconSize} />\n </button>\n )}\n\n {/* Previous button (‹) */}\n {withControls && (\n <button\n className={itemClass(styles.control)}\n onClick={() => go(currentPage - 1)}\n disabled={currentPage === 1}\n aria-label=\"Previous page\"\n type=\"button\"\n >\n <IconChevronLeft s={iconSize} />\n </button>\n )}\n\n {/* Page numbers + dots */}\n {pages.map((page, i) =>\n page === '…' ? (\n <span\n key={`dots-${i}`}\n className={itemClass(styles.dots)}\n aria-hidden=\"true\"\n >\n <IconDots s={iconSize} />\n </span>\n ) : (\n <button\n key={page}\n className={itemClass(page === currentPage ? styles.active : styles.inactive)}\n onClick={() => go(page)}\n aria-label={`Page ${page}`}\n aria-current={page === currentPage ? 'page' : undefined}\n type=\"button\"\n >\n {page}\n </button>\n )\n )}\n\n {/* Next button (›) */}\n {withControls && (\n <button\n className={itemClass(styles.control)}\n onClick={() => go(currentPage + 1)}\n disabled={currentPage === totalPages}\n aria-label=\"Next page\"\n type=\"button\"\n >\n <IconChevronRight s={iconSize} />\n </button>\n )}\n\n {/* Last page button (») */}\n {withEdges && (\n <button\n className={itemClass(styles.control)}\n onClick={() => go(totalPages)}\n disabled={currentPage === totalPages}\n aria-label=\"Last page\"\n type=\"button\"\n >\n <IconChevronsRight s={iconSize} />\n </button>\n )}\n </nav>\n );\n}\n"],"names":["ICON_SIZE","IconDots","s","jsx","IconChevronLeft","IconChevronRight","IconChevronsLeft","jsxs","IconChevronsRight","buildRange","current","total","_","i","Pagination","sizes","currentPage","totalPages","withControls","withEdges","onChange","className","iconSize","pages","go","page","itemClass","extra","styles"],"mappings":";;AAqBA,MAAMA,IAA4C,EAAE,IAAI,IAAI,IAAI,IAAI,IAAI,GAAA,GAIlEC,IAAW,CAAC,EAAE,GAAAC,EAAA,wBACjB,OAAA,EAAI,OAAOA,GAAG,QAAQA,GAAG,SAAQ,aAAY,MAAK,gBAAe,eAAY,QAE5E,UAAA;AAAA,EAAA,gBAAAC,EAAC,YAAO,IAAG,KAAK,IAAG,KAAI,GAAE,QAAO;AAAA,oBAC/B,UAAA,EAAO,IAAG,KAAK,IAAG,KAAI,GAAE,QAAO;AAAA,oBAC/B,UAAA,EAAO,IAAG,MAAK,IAAG,KAAI,GAAE,OAAA,CAAO;AAAA,GAClC,GAGIC,IAAkB,CAAC,EAAE,GAAAF,EAAA;AAAA;AAAA,EAEzB,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MAAI,OAAOD;AAAA,MAAG,QAAQA;AAAA,MAAG,SAAQ;AAAA,MAAY,MAAK;AAAA,MAAO,QAAO;AAAA,MAC/D,aAAY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EAAGR,IAAc,CAAC;AAAA,YACjC,UAAUA,MAAgBC;AAAA,YAC1B,cAAW;AAAA,YACX,MAAK;AAAA,YAEL,UAAA,gBAAAd,EAACE,GAAA,EAAiBiB,EAAG,CAAU;AAAA,UAAA;AAAA,QAAA;AAAA,QAKlCH,KACC,gBAAAhB;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWuB,EAAUE,EAAO,OAAO;AAAA,YACnC,SAAS,MAAMJ,EAAGP,CAAU;AAAA,YAC5B,UAAUD,MAAgBC;AAAA,YAC1B,cAAW;AAAA,YACX,MAAK;AAAA,YAEL,UAAA,gBAAAd,EAACK,GAAA,EAAkBc,EAAG,CAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MAClC;AAAA,IAAA;AAAA,EAAA;AAIR;"}
@@ -1,222 +1,67 @@
1
- import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
- import { useRef as L, useState as w } from "react";
3
- import r from "./index.esm16.js";
4
- const y = () => /* @__PURE__ */ a("svg", { viewBox: "0 0 12 12", width: "12", height: "12", "aria-hidden": "true", children: [
5
- /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ a("linearGradient", { id: "fileGrad", x1: "0%", y1: "100%", x2: "100%", y2: "0%", children: [
6
- /* @__PURE__ */ e("stop", { offset: "0%", stopColor: "#2970FF" }),
7
- /* @__PURE__ */ e("stop", { offset: "100%", stopColor: "#0040C1" })
8
- ] }) }),
9
- /* @__PURE__ */ e(
10
- "path",
11
- {
12
- fill: "url(#fileGrad)",
13
- d: "M2 0h5.5L10 2.5V12H2V0zm5 0v3h3L7 0zM3 5h6v1H3V5zm0 2h6v1H3V7zm0 2h4v1H3V9z"
14
- }
15
- )
16
- ] }), b = () => /* @__PURE__ */ e("svg", { viewBox: "0 0 12 12", width: "12", height: "12", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ e("path", { d: "M8.707.293a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414L9.414 5.1 6.9 2.586 8.707.293zM0 9.5V12h2.5l7-7L7 2.5l-7 7zM1.5 10.5v-.793l5.5-5.5.793.793-5.5 5.5H1.5z" }) }), D = () => /* @__PURE__ */ e("svg", { viewBox: "0 0 12 12", width: "12", height: "12", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ e("path", { d: "M6 2C3.27 2 1 4 1 6s2.27 4 5 4 5-2 5-4-2.27-4-5-4zm0 7a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-5a2 2 0 1 0 0 4 2 2 0 0 0 0-4z" }) }), I = () => /* @__PURE__ */ e("svg", { viewBox: "0 0 12 12", width: "12", height: "12", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ e("path", { d: "M4 1V0h4v1h3v1H1V1h3zM2 3h8l-.8 8H2.8L2 3zm2 1v6h1V4H4zm2 0v6h1V4H6z" }) }), W = () => /* @__PURE__ */ a("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", "aria-hidden": "true", children: [
17
- /* @__PURE__ */ e(
18
- "rect",
19
- {
20
- x: "18",
21
- y: "10",
22
- width: "10",
23
- height: "13",
24
- rx: "1.5",
25
- fill: "#DBE8FF",
26
- stroke: "#B2C9FF",
27
- strokeWidth: "0.5",
28
- transform: "rotate(12 18 10)"
29
- }
30
- ),
31
- /* @__PURE__ */ e(
32
- "rect",
33
- {
34
- x: "4",
35
- y: "10",
36
- width: "10",
37
- height: "13",
38
- rx: "1.5",
39
- fill: "#DBE8FF",
40
- stroke: "#B2C9FF",
41
- strokeWidth: "0.5",
42
- transform: "rotate(-12 4 10)"
43
- }
44
- ),
45
- /* @__PURE__ */ e("rect", { x: "10", y: "7", width: "12", height: "16", rx: "1.5", fill: "#FFFFFF", stroke: "#B2C9FF", strokeWidth: "1" }),
46
- /* @__PURE__ */ e("path", { d: "M13 12h6M13 15h6M13 18h4", stroke: "#B2C9FF", strokeWidth: "1", strokeLinecap: "round" }),
47
- /* @__PURE__ */ e("circle", { cx: "23", cy: "23", r: "5", fill: "#2970FF" }),
48
- /* @__PURE__ */ e("path", { d: "M23 26v-6M20.5 22.5L23 20l2.5 2.5", stroke: "#FFF", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
49
- ] }), H = () => /* @__PURE__ */ a("svg", { width: "96", height: "64", viewBox: "0 0 96 64", fill: "none", "aria-hidden": "true", children: [
50
- /* @__PURE__ */ a("g", { transform: "rotate(15 70 35)", children: [
51
- /* @__PURE__ */ e("rect", { x: "55", y: "18", width: "28", height: "36", rx: "3", fill: "#DBE8FF", stroke: "#B2C9FF", strokeWidth: "1" }),
52
- /* @__PURE__ */ e("path", { d: "M61 28h16M61 34h16M61 40h10", stroke: "#B2C9FF", strokeWidth: "1.5", strokeLinecap: "round" })
53
- ] }),
54
- /* @__PURE__ */ a("g", { transform: "rotate(-15 26 35)", children: [
55
- /* @__PURE__ */ e("rect", { x: "13", y: "18", width: "28", height: "36", rx: "3", fill: "#DBE8FF", stroke: "#B2C9FF", strokeWidth: "1" }),
56
- /* @__PURE__ */ e("path", { d: "M19 28h16M19 34h16M19 40h10", stroke: "#B2C9FF", strokeWidth: "1.5", strokeLinecap: "round" })
57
- ] }),
58
- /* @__PURE__ */ e("rect", { x: "30", y: "8", width: "36", height: "48", rx: "3", fill: "#FFFFFF", stroke: "#B2C9FF", strokeWidth: "1.5" }),
59
- /* @__PURE__ */ e("path", { d: "M38 22h20M38 30h20M38 38h14", stroke: "#B2C9FF", strokeWidth: "1.5", strokeLinecap: "round" }),
60
- /* @__PURE__ */ e("circle", { cx: "76", cy: "50", r: "10", fill: "#2970FF" }),
61
- /* @__PURE__ */ e("path", { d: "M76 55v-10M71 48l5-5 5 5", stroke: "#FFF", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
62
- ] });
63
- function V({ file: t, size: n, onEdit: s, onPreview: o, onRemove: l }) {
64
- const h = t.state === "loading" || t.indicator === "loader", c = n === "LG" && t.indicator !== "loader";
65
- return /* @__PURE__ */ a(
66
- "div",
67
- {
68
- className: [
69
- r.fileItem,
70
- n === "LG" ? r.fileItemLg : r.fileItemMd
71
- ].join(" "),
72
- children: [
73
- /* @__PURE__ */ e("div", { className: r.fileBadge, children: /* @__PURE__ */ e(y, {}) }),
74
- /* @__PURE__ */ a("div", { className: r.fileContent, children: [
75
- /* @__PURE__ */ a("div", { className: r.fileHeader, children: [
76
- /* @__PURE__ */ a("div", { className: r.fileTexts, children: [
77
- /* @__PURE__ */ e("p", { className: r.fileName, children: t.name }),
78
- /* @__PURE__ */ e("p", { className: r.fileSize, children: t.size })
79
- ] }),
80
- h ? /* @__PURE__ */ e("div", { className: r.spinner, role: "status", "aria-label": "Uploading…" }) : /* @__PURE__ */ a("div", { className: r.actions, children: [
81
- /* @__PURE__ */ e(
82
- "button",
83
- {
84
- className: r.actionBtn,
85
- onClick: () => s == null ? void 0 : s(t.id),
86
- "aria-label": `Edit ${t.name}`,
87
- type: "button",
88
- children: /* @__PURE__ */ e(b, {})
89
- }
90
- ),
91
- /* @__PURE__ */ e(
92
- "button",
93
- {
94
- className: r.actionBtn,
95
- onClick: () => o == null ? void 0 : o(t.id),
96
- "aria-label": `Preview ${t.name}`,
97
- type: "button",
98
- children: /* @__PURE__ */ e(D, {})
99
- }
100
- ),
101
- /* @__PURE__ */ e(
102
- "button",
103
- {
104
- className: r.actionBtn,
105
- onClick: () => l == null ? void 0 : l(t.id),
106
- "aria-label": `Remove ${t.name}`,
107
- type: "button",
108
- children: /* @__PURE__ */ e(I, {})
109
- }
110
- )
111
- ] })
112
- ] }),
113
- c && /* @__PURE__ */ a("div", { className: r.progressRow, children: [
114
- /* @__PURE__ */ e("div", { className: r.progressTrack, children: /* @__PURE__ */ e(
115
- "div",
116
- {
117
- className: r.progressFill,
118
- style: { width: `${Math.min(100, Math.max(0, t.progress))}%` },
119
- role: "progressbar",
120
- "aria-valuenow": t.progress,
121
- "aria-valuemin": 0,
122
- "aria-valuemax": 100
123
- }
124
- ) }),
125
- /* @__PURE__ */ a("p", { className: r.progressLabel, children: [
126
- t.progress,
127
- "%"
128
- ] })
129
- ] })
130
- ] })
131
- ]
132
- }
133
- );
1
+ import { jsxs as n, jsx as r } from "react/jsx-runtime";
2
+ import { useId as N } from "react";
3
+ import e from "./index.esm27.js";
4
+ function B() {
5
+ return /* @__PURE__ */ r("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M5 7.5l5 5 5-5", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) });
134
6
  }
135
- function $({
136
- size: t = "LG",
137
- type: n = "multiple",
138
- status: s = "default",
139
- files: o = [],
140
- onDrop: l,
141
- onRemove: h,
142
- onEdit: c,
143
- onPreview: u,
144
- accept: f,
7
+ function g({
8
+ options: u,
9
+ value: d,
10
+ placeholder: m = "Selecione",
11
+ label: t,
12
+ message: o,
13
+ state: c = "Default",
14
+ onChange: s,
15
+ id: f,
145
16
  className: v
146
17
  }) {
147
- const m = L(null), [k, p] = w(!1), M = (i) => {
148
- i.preventDefault(), p(!0);
149
- }, x = (i) => {
150
- i.preventDefault(), p(!1);
151
- }, N = (i) => {
152
- i.preventDefault(), p(!1);
153
- const d = Array.from(i.dataTransfer.files);
154
- d.length && (l == null || l(d));
155
- }, B = (i) => {
156
- const d = Array.from(i.target.files ?? []);
157
- d.length && (l == null || l(d)), i.target.value = "";
158
- }, g = () => {
159
- var i;
160
- return (i = m.current) == null ? void 0 : i.click();
161
- }, z = n === "single" && s === "active" && o.length > 0, C = [
162
- r.dropzone,
163
- t === "MD" ? r.dropzoneMd : r.dropzoneLg,
164
- k ? r.dropzoneDragging : ""
165
- ].filter(Boolean).join(" "), F = n === "multiple" ? "Drop your files here, or" : "Drop your file here, or";
166
- return /* @__PURE__ */ a("div", { className: [r.wrapper, v].filter(Boolean).join(" "), children: [
167
- /* @__PURE__ */ e(
168
- "input",
18
+ const p = N(), i = f ?? p, h = c === "Disabled", a = c === "Error", b = [
19
+ e.field,
20
+ a ? e.error : "",
21
+ v
22
+ ].filter(Boolean).join(" "), j = [
23
+ e.select,
24
+ d ? "" : e.placeholder
25
+ ].filter(Boolean).join(" ");
26
+ return /* @__PURE__ */ n("div", { className: e.wrapper, children: [
27
+ t && /* @__PURE__ */ r(
28
+ "label",
169
29
  {
170
- ref: m,
171
- type: "file",
172
- multiple: n === "multiple",
173
- accept: f,
174
- onChange: B,
175
- style: { display: "none" },
176
- "aria-hidden": "true",
177
- tabIndex: -1
30
+ htmlFor: i,
31
+ className: [e.label, h ? e.labelDisabled : ""].filter(Boolean).join(" "),
32
+ children: t
178
33
  }
179
34
  ),
180
- !z && /* @__PURE__ */ a(
181
- "div",
35
+ /* @__PURE__ */ n("div", { className: b, children: [
36
+ /* @__PURE__ */ n(
37
+ "select",
38
+ {
39
+ id: i,
40
+ className: j,
41
+ value: d ?? "",
42
+ disabled: h,
43
+ "aria-invalid": a,
44
+ "aria-describedby": o ? `${i}-message` : void 0,
45
+ onChange: (l) => s == null ? void 0 : s(l.target.value),
46
+ children: [
47
+ /* @__PURE__ */ r("option", { value: "", disabled: !0, hidden: !0, children: m }),
48
+ u.map((l) => /* @__PURE__ */ r("option", { value: l.value, children: l.label }, l.value))
49
+ ]
50
+ }
51
+ ),
52
+ /* @__PURE__ */ r("span", { className: e.chevron, children: /* @__PURE__ */ r(B, {}) })
53
+ ] }),
54
+ o && /* @__PURE__ */ r(
55
+ "p",
182
56
  {
183
- className: C,
184
- onClick: g,
185
- onDragOver: M,
186
- onDragLeave: x,
187
- onDrop: N,
188
- role: "button",
189
- tabIndex: 0,
190
- "aria-label": `${F} browse`,
191
- onKeyDown: (i) => {
192
- (i.key === " " || i.key === "Enter") && g();
193
- },
194
- children: [
195
- t === "MD" ? /* @__PURE__ */ e("div", { className: r.dropzoneIconMd, children: /* @__PURE__ */ e(W, {}) }) : /* @__PURE__ */ e("div", { className: r.dropzoneIconLg, children: /* @__PURE__ */ e(H, {}) }),
196
- /* @__PURE__ */ a("div", { className: r.dropzoneContent, children: [
197
- /* @__PURE__ */ a("div", { className: r.dropzoneTitleRow, children: [
198
- /* @__PURE__ */ e("p", { className: r.dropzoneTitle, children: F }),
199
- /* @__PURE__ */ e("span", { className: r.dropzoneBrowse, "aria-hidden": "true", children: "browse" })
200
- ] }),
201
- /* @__PURE__ */ e("p", { className: r.dropzoneSubtitle, children: "JPG, PNG, PDF (Max 800×400px – 2Mo)" })
202
- ] })
203
- ]
57
+ id: `${i}-message`,
58
+ className: [e.message, a ? e.messageError : ""].filter(Boolean).join(" "),
59
+ children: o
204
60
  }
205
- ),
206
- s === "active" && o.length > 0 && /* @__PURE__ */ e("div", { className: r.fileList, children: o.map((i) => /* @__PURE__ */ e(
207
- V,
208
- {
209
- file: i,
210
- size: t,
211
- onEdit: c,
212
- onPreview: u,
213
- onRemove: h
214
- },
215
- i.id
216
- )) })
61
+ )
217
62
  ] });
218
63
  }
219
64
  export {
220
- $ as Upload
65
+ g as Select
221
66
  };
222
67
  //# sourceMappingURL=index.esm13.js.map