@sbkbs/ui 1.0.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/MIGRATION.md +96 -0
  3. package/README.md +221 -115
  4. package/dist/assets/favicon/apple-touch-icon.png +0 -0
  5. package/dist/assets/favicon/favicon-96x96.png +0 -0
  6. package/dist/assets/favicon/favicon.ico +0 -0
  7. package/dist/assets/favicon/favicon.svg +1 -0
  8. package/dist/assets/favicon/site.webmanifest +21 -0
  9. package/dist/assets/favicon/web-app-manifest-192x192.png +0 -0
  10. package/dist/assets/favicon/web-app-manifest-512x512.png +0 -0
  11. package/dist/base.css +38 -0
  12. package/dist/components/Accordion/Accordion.d.ts +13 -1
  13. package/dist/components/Accordion/Accordion.js +100 -52
  14. package/dist/components/Accordion/Accordion.js.map +1 -1
  15. package/dist/components/Alert/Alert.d.ts +17 -4
  16. package/dist/components/Alert/Alert.js +64 -20
  17. package/dist/components/Alert/Alert.js.map +1 -1
  18. package/dist/components/Avatar/Avatar.d.ts +12 -6
  19. package/dist/components/Avatar/Avatar.js +66 -0
  20. package/dist/components/Avatar/Avatar.js.map +1 -0
  21. package/dist/components/Badge/Badge.d.ts +11 -2
  22. package/dist/components/Badge/Badge.js +42 -30
  23. package/dist/components/Badge/Badge.js.map +1 -1
  24. package/dist/components/Breadcrumb/Breadcrumb.d.ts +5 -2
  25. package/dist/components/Breadcrumb/Breadcrumb.js +23 -16
  26. package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
  27. package/dist/components/Button/Button.d.ts +10 -8
  28. package/dist/components/Button/Button.js +73 -114
  29. package/dist/components/Button/Button.js.map +1 -1
  30. package/dist/components/Card/Card.d.ts +33 -3
  31. package/dist/components/Card/Card.js +91 -30
  32. package/dist/components/Card/Card.js.map +1 -1
  33. package/dist/components/Checkbox/Checkbox.d.ts +4 -1
  34. package/dist/components/Checkbox/Checkbox.js +32 -31
  35. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  36. package/dist/components/Chip/Chip.d.ts +7 -1
  37. package/dist/components/Chip/Chip.js +19 -9
  38. package/dist/components/Chip/Chip.js.map +1 -1
  39. package/dist/components/Combobox/Combobox.d.ts +10 -2
  40. package/dist/components/Combobox/Combobox.js +146 -133
  41. package/dist/components/Combobox/Combobox.js.map +1 -1
  42. package/dist/components/Divider/Divider.d.ts +7 -1
  43. package/dist/components/Divider/Divider.js +28 -12
  44. package/dist/components/Divider/Divider.js.map +1 -1
  45. package/dist/components/DropdownMenu/DropdownMenu.d.ts +33 -0
  46. package/dist/components/DropdownMenu/DropdownMenu.js +147 -0
  47. package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -0
  48. package/dist/components/EmptyState/EmptyState.d.ts +7 -1
  49. package/dist/components/EmptyState/EmptyState.js +28 -19
  50. package/dist/components/EmptyState/EmptyState.js.map +1 -1
  51. package/dist/components/Field/Field.d.ts +21 -0
  52. package/dist/components/Field/Field.js +35 -0
  53. package/dist/components/Field/Field.js.map +1 -0
  54. package/dist/components/FileUpload/FileUpload.d.ts +9 -2
  55. package/dist/components/FileUpload/FileUpload.js +128 -102
  56. package/dist/components/FileUpload/FileUpload.js.map +1 -1
  57. package/dist/components/Footer/Footer.d.ts +19 -6
  58. package/dist/components/Footer/Footer.js +47 -115
  59. package/dist/components/Footer/Footer.js.map +1 -1
  60. package/dist/components/GlassPanel/GlassPanel.d.ts +18 -0
  61. package/dist/components/GlassPanel/GlassPanel.js +39 -0
  62. package/dist/components/GlassPanel/GlassPanel.js.map +1 -0
  63. package/dist/components/Header/Header.d.ts +25 -14
  64. package/dist/components/Header/Header.js +88 -148
  65. package/dist/components/Header/Header.js.map +1 -1
  66. package/dist/components/Highlight/Highlight.d.ts +13 -0
  67. package/dist/components/Highlight/Highlight.js +18 -0
  68. package/dist/components/Highlight/Highlight.js.map +1 -0
  69. package/dist/components/Icon/Icon.d.ts +21 -0
  70. package/dist/components/Icon/Icon.js +31 -0
  71. package/dist/components/Icon/Icon.js.map +1 -0
  72. package/dist/components/IconButton/IconButton.d.ts +12 -0
  73. package/dist/components/IconButton/IconButton.js +49 -0
  74. package/dist/components/IconButton/IconButton.js.map +1 -0
  75. package/dist/components/Input/Input.d.ts +3 -2
  76. package/dist/components/Input/Input.js +51 -69
  77. package/dist/components/Input/Input.js.map +1 -1
  78. package/dist/components/Layout/Layout.d.ts +2 -0
  79. package/dist/components/Layout/Layout.js +24 -18
  80. package/dist/components/Layout/Layout.js.map +1 -1
  81. package/dist/components/Logo/Logo.d.ts +27 -0
  82. package/dist/components/Logo/Logo.js +107 -0
  83. package/dist/components/Logo/Logo.js.map +1 -0
  84. package/dist/components/MiniCard/MiniCard.d.ts +21 -0
  85. package/dist/components/MiniCard/MiniCard.js +90 -0
  86. package/dist/components/MiniCard/MiniCard.js.map +1 -0
  87. package/dist/components/Modal/Modal.d.ts +16 -3
  88. package/dist/components/Modal/Modal.js +124 -93
  89. package/dist/components/Modal/Modal.js.map +1 -1
  90. package/dist/components/Navigation/Navigation.d.ts +1 -0
  91. package/dist/components/Navigation/Navigation.js +14 -14
  92. package/dist/components/Navigation/Navigation.js.map +1 -1
  93. package/dist/components/NumberInput/NumberInput.d.ts +5 -2
  94. package/dist/components/NumberInput/NumberInput.js +98 -128
  95. package/dist/components/NumberInput/NumberInput.js.map +1 -1
  96. package/dist/components/PageHeader/PageHeader.d.ts +8 -1
  97. package/dist/components/PageHeader/PageHeader.js +26 -25
  98. package/dist/components/PageHeader/PageHeader.js.map +1 -1
  99. package/dist/components/Pagination/Pagination.d.ts +15 -2
  100. package/dist/components/Pagination/Pagination.js +68 -34
  101. package/dist/components/Pagination/Pagination.js.map +1 -1
  102. package/dist/components/Paragraph/Paragraph.d.ts +8 -2
  103. package/dist/components/Paragraph/Paragraph.js +39 -36
  104. package/dist/components/Paragraph/Paragraph.js.map +1 -1
  105. package/dist/components/Popover/Popover.d.ts +12 -1
  106. package/dist/components/Popover/Popover.js +49 -37
  107. package/dist/components/Popover/Popover.js.map +1 -1
  108. package/dist/components/ProgressBar/ProgressBar.d.ts +12 -6
  109. package/dist/components/ProgressBar/ProgressBar.js +71 -0
  110. package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
  111. package/dist/components/Radio/Radio.d.ts +2 -1
  112. package/dist/components/Radio/Radio.js +27 -31
  113. package/dist/components/Radio/Radio.js.map +1 -1
  114. package/dist/components/SectionHeader/SectionHeader.d.ts +6 -1
  115. package/dist/components/SectionHeader/SectionHeader.js +14 -12
  116. package/dist/components/SectionHeader/SectionHeader.js.map +1 -1
  117. package/dist/components/Select/Select.d.ts +6 -2
  118. package/dist/components/Select/Select.js +47 -35
  119. package/dist/components/Select/Select.js.map +1 -1
  120. package/dist/components/SideNav/SideNav.d.ts +55 -0
  121. package/dist/components/SideNav/SideNav.js +141 -0
  122. package/dist/components/SideNav/SideNav.js.map +1 -0
  123. package/dist/components/Skeleton/Skeleton.d.ts +12 -1
  124. package/dist/components/Skeleton/Skeleton.js +33 -18
  125. package/dist/components/Skeleton/Skeleton.js.map +1 -1
  126. package/dist/components/Spinner/Spinner.d.ts +11 -3
  127. package/dist/components/Spinner/Spinner.js +57 -0
  128. package/dist/components/Spinner/Spinner.js.map +1 -0
  129. package/dist/components/Stepper/Stepper.d.ts +1 -1
  130. package/dist/components/Stepper/Stepper.js +41 -53
  131. package/dist/components/Stepper/Stepper.js.map +1 -1
  132. package/dist/components/Subtitle/Subtitle.d.ts +9 -3
  133. package/dist/components/Subtitle/Subtitle.js +29 -35
  134. package/dist/components/Subtitle/Subtitle.js.map +1 -1
  135. package/dist/components/Switch/Switch.d.ts +2 -1
  136. package/dist/components/Switch/Switch.js +45 -33
  137. package/dist/components/Switch/Switch.js.map +1 -1
  138. package/dist/components/Table/Table.d.ts +19 -1
  139. package/dist/components/Table/Table.js +48 -11
  140. package/dist/components/Table/Table.js.map +1 -1
  141. package/dist/components/Tabs/Tabs.d.ts +16 -2
  142. package/dist/components/Tabs/Tabs.js +80 -44
  143. package/dist/components/Tabs/Tabs.js.map +1 -1
  144. package/dist/components/Tag/Tag.d.ts +8 -1
  145. package/dist/components/Tag/Tag.js +27 -12
  146. package/dist/components/Tag/Tag.js.map +1 -1
  147. package/dist/components/Textarea/Textarea.d.ts +3 -1
  148. package/dist/components/Textarea/Textarea.js +36 -40
  149. package/dist/components/Textarea/Textarea.js.map +1 -1
  150. package/dist/components/Title/Title.d.ts +9 -3
  151. package/dist/components/Title/Title.js +42 -42
  152. package/dist/components/Title/Title.js.map +1 -1
  153. package/dist/components/Toast/Toast.d.ts +39 -11
  154. package/dist/components/Toast/Toast.js +130 -76
  155. package/dist/components/Toast/Toast.js.map +1 -1
  156. package/dist/components/Tooltip/Tooltip.d.ts +12 -2
  157. package/dist/components/Tooltip/Tooltip.js +50 -32
  158. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  159. package/dist/components/Typography/weight.d.ts +9 -0
  160. package/dist/components/Typography/weight.js +5 -0
  161. package/dist/components/Typography/weight.js.map +1 -0
  162. package/dist/fonts.css +8 -0
  163. package/dist/index.cjs +2 -0
  164. package/dist/index.cjs.map +1 -0
  165. package/dist/index.d.ts +55 -43
  166. package/dist/index.js +118 -83
  167. package/dist/index.js.map +1 -1
  168. package/dist/reset.css +9 -0
  169. package/dist/styles.css +1 -0
  170. package/dist/tailwind.css +153 -0
  171. package/dist/theme/ThemeProvider.d.ts +21 -3
  172. package/dist/theme/ThemeProvider.js +57 -18
  173. package/dist/theme/ThemeProvider.js.map +1 -1
  174. package/dist/theme/tokens.d.ts +43 -0
  175. package/dist/theme/tokens.js +39 -0
  176. package/dist/theme/tokens.js.map +1 -0
  177. package/dist/theme.css +327 -294
  178. package/dist/tokens.css +327 -0
  179. package/dist/utils/cn.d.ts +2 -2
  180. package/dist/utils/cn.js +19 -4
  181. package/dist/utils/cn.js.map +1 -1
  182. package/dist/utils/styles.d.ts +37 -0
  183. package/dist/utils/styles.js +35 -0
  184. package/dist/utils/styles.js.map +1 -0
  185. package/package.json +140 -117
  186. package/dist/components/Accordion/Accordion.stories.d.ts +0 -7
  187. package/dist/components/Alert/Alert.stories.d.ts +0 -8
  188. package/dist/components/Badge/Badge.stories.d.ts +0 -8
  189. package/dist/components/Breadcrumb/Breadcrumb.stories.d.ts +0 -8
  190. package/dist/components/Button/Button.stories.d.ts +0 -7
  191. package/dist/components/Card/Card.stories.d.ts +0 -8
  192. package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -7
  193. package/dist/components/Combobox/Combobox.stories.d.ts +0 -9
  194. package/dist/components/Feedback/Feedback.stories.d.ts +0 -5
  195. package/dist/components/FileUpload/FileUpload.stories.d.ts +0 -10
  196. package/dist/components/Input/Input.stories.d.ts +0 -9
  197. package/dist/components/Modal/Modal.stories.d.ts +0 -8
  198. package/dist/components/NumberInput/NumberInput.stories.d.ts +0 -8
  199. package/dist/components/Pagination/Pagination.stories.d.ts +0 -8
  200. package/dist/components/Radio/Radio.stories.d.ts +0 -7
  201. package/dist/components/Select/Select.stories.d.ts +0 -8
  202. package/dist/components/Stepper/Stepper.stories.d.ts +0 -8
  203. package/dist/components/Switch/Switch.stories.d.ts +0 -8
  204. package/dist/components/Tabs/Tabs.stories.d.ts +0 -8
  205. package/dist/components/Textarea/Textarea.stories.d.ts +0 -7
  206. package/dist/components/Toast/Toast.stories.d.ts +0 -8
  207. package/dist/oficios-ui.css +0 -1
  208. package/dist/oficios-ui.umd.cjs +0 -2
  209. package/dist/oficios-ui.umd.cjs.map +0 -1
  210. package/dist/sbk-icon.png +0 -0
@@ -1,36 +1,37 @@
1
- import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
- import l from "react";
3
- import { cn as m } from "../../utils/cn.js";
4
- const d = l.forwardRef(
5
- ({ label: t, helperText: r, className: i, id: a, ...c }, n) => {
6
- const s = a || `checkbox-${Math.random().toString(36).slice(2, 9)}`;
7
- return /* @__PURE__ */ o(
8
- "label",
9
- {
10
- className: m("inline-flex cursor-pointer items-start gap-2", i),
11
- htmlFor: s,
12
- children: [
13
- /* @__PURE__ */ e(
14
- "input",
15
- {
16
- ref: n,
17
- className: "mt-0.5 h-4 w-4 rounded border-[var(--md-outline-variant)] bg-[var(--md-surface)] text-[var(--md-primary)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--border-color-focus)]",
18
- id: s,
19
- type: "checkbox",
20
- ...c
21
- }
22
- ),
23
- /* @__PURE__ */ o("span", { className: "grid gap-0.5", children: [
24
- t && /* @__PURE__ */ e("span", { className: "text-sm text-[var(--text-primary)]", children: t }),
25
- r && /* @__PURE__ */ e("span", { className: "text-xs text-[var(--text-muted)]", children: r })
26
- ] })
27
- ]
28
- }
29
- );
1
+ import { jsxs as l, jsx as i } from "react/jsx-runtime";
2
+ import x, { useId as h, useRef as b, useImperativeHandle as g, useEffect as N } from "react";
3
+ import { cn as k } from "../../utils/cn.js";
4
+ import { choiceControl as v } from "../../utils/styles.js";
5
+ const I = x.forwardRef(
6
+ ({ label: a, helperText: r, error: e, indeterminate: o = !1, className: d, id: m, disabled: c, ...f }, p) => {
7
+ const u = h(), t = m ?? u, s = b(null);
8
+ g(p, () => s.current), N(() => {
9
+ s.current && (s.current.indeterminate = o);
10
+ }, [o]);
11
+ const n = e ? `${t}-error` : r ? `${t}-helper` : void 0;
12
+ return /* @__PURE__ */ l("div", { className: k("inline-flex items-start gap-2", c && "opacity-60", d), children: [
13
+ /* @__PURE__ */ i(
14
+ "input",
15
+ {
16
+ ref: s,
17
+ "aria-describedby": n,
18
+ "aria-invalid": e ? !0 : void 0,
19
+ className: v,
20
+ disabled: c,
21
+ id: t,
22
+ type: "checkbox",
23
+ ...f
24
+ }
25
+ ),
26
+ /* @__PURE__ */ l("span", { className: "grid gap-0.5", children: [
27
+ a && /* @__PURE__ */ i("label", { className: "cursor-pointer text-sm font-light text-sbk-fg", htmlFor: t, children: a }),
28
+ e ? /* @__PURE__ */ i("span", { className: "text-xs font-semibold text-sbk-error-fg", id: n, role: "alert", children: e }) : r && /* @__PURE__ */ i("span", { className: "text-xs font-light text-sbk-fg-muted", id: n, children: r })
29
+ ] })
30
+ ] });
30
31
  }
31
32
  );
32
- d.displayName = "Checkbox";
33
+ I.displayName = "Checkbox";
33
34
  export {
34
- d as Checkbox
35
+ I as Checkbox
35
36
  };
36
37
  //# sourceMappingURL=Checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {\n helperText?: string;\n label?: string;\n}\n\nexport const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(\n ({ label, helperText, className, id, ...props }, ref) => {\n const inputId = id || `checkbox-${Math.random().toString(36).slice(2, 9)}`;\n\n return (\n <label\n className={cn('inline-flex cursor-pointer items-start gap-2', className)}\n htmlFor={inputId}\n >\n <input\n ref={ref}\n className=\"mt-0.5 h-4 w-4 rounded border-[var(--md-outline-variant)] bg-[var(--md-surface)] text-[var(--md-primary)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--border-color-focus)]\"\n id={inputId}\n type=\"checkbox\"\n {...props}\n />\n <span className=\"grid gap-0.5\">\n {label && <span className=\"text-sm text-[var(--text-primary)]\">{label}</span>}\n {helperText && <span className=\"text-xs text-[var(--text-muted)]\">{helperText}</span>}\n </span>\n </label>\n );\n },\n);\n\nCheckbox.displayName = 'Checkbox';\n"],"names":["Checkbox","React","label","helperText","className","id","props","ref","inputId","jsxs","cn","jsx"],"mappings":";;;AAQO,MAAMA,IAAWC,EAAM;AAAA,EAC5B,CAAC,EAAE,OAAAC,GAAO,YAAAC,GAAY,WAAAC,GAAW,IAAAC,GAAI,GAAGC,EAAA,GAASC,MAAQ;AACvD,UAAMC,IAAUH,KAAM,YAAY,KAAK,OAAA,EAAS,SAAS,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;AAExE,WACE,gBAAAI;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWC,EAAG,gDAAgDN,CAAS;AAAA,QACvE,SAASI;AAAA,QAET,UAAA;AAAA,UAAA,gBAAAG;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAAJ;AAAA,cACA,WAAU;AAAA,cACV,IAAIC;AAAA,cACJ,MAAK;AAAA,cACJ,GAAGF;AAAA,YAAA;AAAA,UAAA;AAAA,UAEN,gBAAAG,EAAC,QAAA,EAAK,WAAU,gBACb,UAAA;AAAA,YAAAP,KAAS,gBAAAS,EAAC,QAAA,EAAK,WAAU,sCAAsC,UAAAT,GAAM;AAAA,YACrEC,KAAc,gBAAAQ,EAAC,QAAA,EAAK,WAAU,oCAAoC,UAAAR,EAAA,CAAW;AAAA,UAAA,EAAA,CAChF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEAH,EAAS,cAAc;"}
1
+ {"version":3,"file":"Checkbox.js","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import React, { useEffect, useId, useImperativeHandle, useRef } from 'react';\r\nimport { cn } from '../../utils/cn';\r\nimport { choiceControl } from '../../utils/styles';\r\n\r\nexport interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {\r\n error?: string;\r\n helperText?: string;\r\n /** Estado intermediário (ex.: \"selecionar todos\" parcial). */\r\n indeterminate?: boolean;\r\n label?: React.ReactNode;\r\n}\r\n\r\nexport const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(\r\n ({ label, helperText, error, indeterminate = false, className, id, disabled, ...props }, ref) => {\r\n const autoId = useId();\r\n const inputId = id ?? autoId;\r\n const innerRef = useRef<HTMLInputElement>(null);\r\n useImperativeHandle(ref, () => innerRef.current as HTMLInputElement);\r\n\r\n useEffect(() => {\r\n if (innerRef.current) innerRef.current.indeterminate = indeterminate;\r\n }, [indeterminate]);\r\n\r\n const hintId = error ? `${inputId}-error` : helperText ? `${inputId}-helper` : undefined;\r\n\r\n return (\r\n <div className={cn('inline-flex items-start gap-2', disabled && 'opacity-60', className)}>\r\n <input\r\n ref={innerRef}\r\n aria-describedby={hintId}\r\n aria-invalid={error ? true : undefined}\r\n className={choiceControl}\r\n disabled={disabled}\r\n id={inputId}\r\n type=\"checkbox\"\r\n {...props}\r\n />\r\n <span className=\"grid gap-0.5\">\r\n {label && (\r\n <label className=\"cursor-pointer text-sm font-light text-sbk-fg\" htmlFor={inputId}>\r\n {label}\r\n </label>\r\n )}\r\n {error ? (\r\n <span className=\"text-xs font-semibold text-sbk-error-fg\" id={hintId} role=\"alert\">\r\n {error}\r\n </span>\r\n ) : (\r\n helperText && (\r\n <span className=\"text-xs font-light text-sbk-fg-muted\" id={hintId}>\r\n {helperText}\r\n </span>\r\n )\r\n )}\r\n </span>\r\n </div>\r\n );\r\n },\r\n);\r\n\r\nCheckbox.displayName = 'Checkbox';\r\n"],"names":["Checkbox","React","label","helperText","error","indeterminate","className","id","disabled","props","ref","autoId","useId","inputId","innerRef","useRef","useImperativeHandle","useEffect","hintId","jsxs","cn","jsx","choiceControl"],"mappings":";;;;AAYO,MAAMA,IAAWC,EAAM;AAAA,EAC5B,CAAC,EAAE,OAAAC,GAAO,YAAAC,GAAY,OAAAC,GAAO,eAAAC,IAAgB,IAAO,WAAAC,GAAW,IAAAC,GAAI,UAAAC,GAAU,GAAGC,EAAA,GAASC,MAAQ;AAC/F,UAAMC,IAASC,EAAA,GACTC,IAAUN,KAAMI,GAChBG,IAAWC,EAAyB,IAAI;AAC9C,IAAAC,EAAoBN,GAAK,MAAMI,EAAS,OAA2B,GAEnEG,EAAU,MAAM;AACd,MAAIH,EAAS,YAASA,EAAS,QAAQ,gBAAgBT;AAAA,IACzD,GAAG,CAACA,CAAa,CAAC;AAElB,UAAMa,IAASd,IAAQ,GAAGS,CAAO,WAAWV,IAAa,GAAGU,CAAO,YAAY;AAE/E,WACE,gBAAAM,EAAC,SAAI,WAAWC,EAAG,iCAAiCZ,KAAY,cAAcF,CAAS,GACrF,UAAA;AAAA,MAAA,gBAAAe;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,KAAKP;AAAA,UACL,oBAAkBI;AAAA,UAClB,gBAAcd,IAAQ,KAAO;AAAA,UAC7B,WAAWkB;AAAA,UACX,UAAAd;AAAA,UACA,IAAIK;AAAA,UACJ,MAAK;AAAA,UACJ,GAAGJ;AAAA,QAAA;AAAA,MAAA;AAAA,MAEN,gBAAAU,EAAC,QAAA,EAAK,WAAU,gBACb,UAAA;AAAA,QAAAjB,uBACE,SAAA,EAAM,WAAU,iDAAgD,SAASW,GACvE,UAAAX,GACH;AAAA,QAEDE,IACC,gBAAAiB,EAAC,QAAA,EAAK,WAAU,2CAA0C,IAAIH,GAAQ,MAAK,SACxE,UAAAd,EAAA,CACH,IAEAD,KACE,gBAAAkB,EAAC,QAAA,EAAK,WAAU,wCAAuC,IAAIH,GACxD,UAAAf,EAAA,CACH;AAAA,MAAA,EAAA,CAGN;AAAA,IAAA,GACF;AAAA,EAEJ;AACF;AAEAH,EAAS,cAAc;"}
@@ -1,5 +1,11 @@
1
1
  import type React from 'react';
2
2
  export interface ChipProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
3
+ icon?: React.ReactNode;
4
+ /** Estado de seleção (filtro ativo), anunciado via aria-pressed. */
3
5
  selected?: boolean;
4
6
  }
5
- export declare const Chip: React.FC<ChipProps>;
7
+ /** Filtro rápido alternável (toggle button). */
8
+ export declare const Chip: {
9
+ ({ selected, icon, className, children, ...props }: ChipProps): import("react/jsx-runtime").JSX.Element;
10
+ displayName: string;
11
+ };
@@ -1,19 +1,29 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import { cn as n } from "../../utils/cn.js";
3
- const b = ({ selected: r = !1, className: e, children: o, ...t }) => /* @__PURE__ */ a(
1
+ import { jsxs as a, jsx as s } from "react/jsx-runtime";
2
+ import { Check as n } from "lucide-react";
3
+ import { cn as b } from "../../utils/cn.js";
4
+ import { focusRing as l, transitionColors as d, buttonReset as p } from "../../utils/styles.js";
5
+ const m = ({ selected: r = !1, icon: e, className: i, children: o, ...t }) => /* @__PURE__ */ a(
4
6
  "button",
5
7
  {
6
- className: n(
7
- "inline-flex items-center rounded-full border px-3 py-1.5 text-sm transition",
8
- r ? "border-[var(--md-primary)] bg-[color:color-mix(in_srgb,var(--md-primary)_16%,transparent)] text-[var(--md-on-surface)]" : "border-[var(--border-color)] bg-[var(--bg-secondary)] text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]",
9
- e
8
+ "aria-pressed": r,
9
+ className: b(
10
+ p,
11
+ "inline-flex cursor-pointer items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:size-4",
12
+ d,
13
+ l,
14
+ r ? "border-sbk-primary bg-sbk-primary-subtle font-semibold text-sbk-fg-heading" : "border-sbk-line-strong bg-sbk-surface font-light text-sbk-fg hover:bg-sbk-surface-hover",
15
+ i
10
16
  ),
11
17
  type: "button",
12
18
  ...t,
13
- children: o
19
+ children: [
20
+ r ? /* @__PURE__ */ s(n, { "aria-hidden": "true" }) : e && /* @__PURE__ */ s("span", { "aria-hidden": "true", className: "inline-flex", children: e }),
21
+ o
22
+ ]
14
23
  }
15
24
  );
25
+ m.displayName = "Chip";
16
26
  export {
17
- b as Chip
27
+ m as Chip
18
28
  };
19
29
  //# sourceMappingURL=Chip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.js","sources":["../../../src/components/Chip/Chip.tsx"],"sourcesContent":["import type React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport interface ChipProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n selected?: boolean;\n}\n\nexport const Chip: React.FC<ChipProps> = ({ selected = false, className, children, ...props }) => {\n return (\n <button\n className={cn(\n 'inline-flex items-center rounded-full border px-3 py-1.5 text-sm transition',\n selected\n ? 'border-[var(--md-primary)] bg-[color:color-mix(in_srgb,var(--md-primary)_16%,transparent)] text-[var(--md-on-surface)]'\n : 'border-[var(--border-color)] bg-[var(--bg-secondary)] text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]',\n className,\n )}\n type=\"button\"\n {...props}\n >\n {children}\n </button>\n );\n};\n"],"names":["Chip","selected","className","children","props","jsx","cn"],"mappings":";;AAOO,MAAMA,IAA4B,CAAC,EAAE,UAAAC,IAAW,IAAO,WAAAC,GAAW,UAAAC,GAAU,GAAGC,QAElF,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC;AAAA,MACT;AAAA,MACAL,IACI,2HACA;AAAA,MACJC;AAAA,IAAA;AAAA,IAEF,MAAK;AAAA,IACJ,GAAGE;AAAA,IAEH,UAAAD;AAAA,EAAA;AAAA;"}
1
+ {"version":3,"file":"Chip.js","sources":["../../../src/components/Chip/Chip.tsx"],"sourcesContent":["import type React from 'react';\r\nimport { Check } from 'lucide-react';\r\nimport { cn } from '../../utils/cn';\r\nimport { buttonReset, focusRing, transitionColors } from '../../utils/styles';\r\n\r\nexport interface ChipProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\r\n icon?: React.ReactNode;\r\n /** Estado de seleção (filtro ativo), anunciado via aria-pressed. */\r\n selected?: boolean;\r\n}\r\n\r\n/** Filtro rápido alternável (toggle button). */\r\nexport const Chip = ({ selected = false, icon, className, children, ...props }: ChipProps) => (\r\n <button\r\n aria-pressed={selected}\r\n className={cn(\r\n buttonReset,\r\n 'inline-flex cursor-pointer items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:size-4',\r\n transitionColors,\r\n focusRing,\r\n selected\r\n ? 'border-sbk-primary bg-sbk-primary-subtle font-semibold text-sbk-fg-heading'\r\n : 'border-sbk-line-strong bg-sbk-surface font-light text-sbk-fg hover:bg-sbk-surface-hover',\r\n className,\r\n )}\r\n type=\"button\"\r\n {...props}\r\n >\r\n {selected ? (\r\n <Check aria-hidden=\"true\" />\r\n ) : (\r\n icon && (\r\n <span aria-hidden=\"true\" className=\"inline-flex\">\r\n {icon}\r\n </span>\r\n )\r\n )}\r\n {children}\r\n </button>\r\n);\r\n\r\nChip.displayName = 'Chip';\r\n"],"names":["Chip","selected","icon","className","children","props","jsxs","cn","buttonReset","transitionColors","focusRing","jsx","Check"],"mappings":";;;;AAYO,MAAMA,IAAO,CAAC,EAAE,UAAAC,IAAW,IAAO,MAAAC,GAAM,WAAAC,GAAW,UAAAC,GAAU,GAAGC,EAAA,MACrE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,gBAAcL;AAAA,IACd,WAAWM;AAAA,MACTC;AAAA,MACA;AAAA,MACAC;AAAA,MACAC;AAAA,MACAT,IACI,+EACA;AAAA,MACJE;AAAA,IAAA;AAAA,IAEF,MAAK;AAAA,IACJ,GAAGE;AAAA,IAEH,UAAA;AAAA,MAAAJ,IACC,gBAAAU,EAACC,GAAA,EAAM,eAAY,OAAA,CAAO,IAE1BV,KACE,gBAAAS,EAAC,QAAA,EAAK,eAAY,QAAO,WAAU,eAChC,UAAAT,GACH;AAAA,MAGHE;AAAA,IAAA;AAAA,EAAA;AACH;AAGFJ,EAAK,cAAc;"}
@@ -6,12 +6,20 @@ export interface ComboboxOption {
6
6
  export interface ComboboxProps {
7
7
  className?: string;
8
8
  disabled?: boolean;
9
+ /** Texto exibido quando o filtro não encontra opções. */
10
+ emptyText?: string;
9
11
  error?: string;
10
12
  helperText?: string;
11
- label?: string;
13
+ id?: string;
14
+ label?: React.ReactNode;
12
15
  onChange?: (value: string) => void;
13
16
  options: ComboboxOption[];
14
17
  placeholder?: string;
18
+ required?: boolean;
15
19
  value?: string;
16
20
  }
17
- export declare const Combobox: React.FC<ComboboxProps>;
21
+ /** Campo com busca e lista de opções (padrão ARIA combobox + listbox). */
22
+ export declare const Combobox: {
23
+ ({ label, helperText, error, options, value, onChange, placeholder, emptyText, disabled, required, id, className, }: ComboboxProps): import("react/jsx-runtime").JSX.Element;
24
+ displayName: string;
25
+ };
@@ -1,143 +1,156 @@
1
- import { jsxs as $, jsx as t } from "react/jsx-runtime";
2
- import { useState as w, useRef as y, useEffect as R } from "react";
3
- import { cn as c } from "../../utils/cn.js";
4
- const S = ({
5
- label: g,
6
- helperText: m,
7
- error: o,
8
- options: v,
9
- value: f,
10
- onChange: p,
11
- placeholder: z = "Selecione ou pesquise...",
12
- disabled: E = !1,
13
- className: L
1
+ import { jsx as l, jsxs as b } from "react/jsx-runtime";
2
+ import { useId as O, useState as v, useRef as z, useEffect as L } from "react";
3
+ import { ChevronDown as Q, Check as F } from "lucide-react";
4
+ import { cn as y } from "../../utils/cn.js";
5
+ import { describedBy as H, fieldSize as U, fieldControl as V } from "../../utils/styles.js";
6
+ import { Field as G } from "../Field/Field.js";
7
+ const J = ({
8
+ label: $,
9
+ helperText: k,
10
+ error: c,
11
+ options: u,
12
+ value: h,
13
+ onChange: f,
14
+ placeholder: R = "Selecione ou pesquise...",
15
+ emptyText: S = "Nenhum resultado encontrado.",
16
+ disabled: A = !1,
17
+ required: x,
18
+ id: M,
19
+ className: j
14
20
  }) => {
15
- const [b, u] = w(""), [n, s] = w(!1), [l, i] = w(-1), x = y(null), N = y(null), I = y(null), h = v.find((e) => e.value === f), d = b ? v.filter((e) => e.label.toLowerCase().includes(b.toLowerCase())) : v, M = n ? b : (h == null ? void 0 : h.label) ?? "";
16
- R(() => {
17
- const e = (r) => {
18
- x.current && !x.current.contains(r.target) && (s(!1), u(""));
21
+ const B = O(), a = M ?? B, w = `${a}-list`, [D, g] = v(""), [r, d] = v(!1), [s, n] = v(-1), N = z(null), E = z(null), m = u.find((e) => e.value === h), I = D.trim().toLocaleLowerCase("pt-BR"), i = I ? u.filter((e) => e.label.toLocaleLowerCase("pt-BR").includes(I)) : u, p = () => {
22
+ d(!1), g(""), n(-1);
23
+ };
24
+ L(() => {
25
+ if (!r) return;
26
+ const e = (t) => {
27
+ var o;
28
+ (o = N.current) != null && o.contains(t.target) || p();
19
29
  };
20
30
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
21
- }, []);
22
- const k = (e) => {
23
- var r;
24
- p == null || p(e.value), u(""), s(!1), (r = N.current) == null || r.blur();
25
- }, A = (e) => {
26
- if (!n) {
27
- (e.key === "ArrowDown" || e.key === "Enter") && (s(!0), i(0), e.preventDefault());
31
+ }, [r]), L(() => {
32
+ var e, t, o;
33
+ s < 0 || (o = (t = (e = E.current) == null ? void 0 : e.querySelector(`[data-index="${s}"]`)) == null ? void 0 : t.scrollIntoView) == null || o.call(t, { block: "nearest" });
34
+ }, [s]);
35
+ const C = (e) => {
36
+ f == null || f(e.value), p();
37
+ }, q = (e) => {
38
+ if (!r) {
39
+ (e.key === "ArrowDown" || e.key === "Enter") && (e.preventDefault(), d(!0), n(0));
28
40
  return;
29
41
  }
30
- e.key === "ArrowDown" ? (e.preventDefault(), i((r) => Math.min(r + 1, d.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), i((r) => Math.max(r - 1, 0))) : e.key === "Enter" ? (e.preventDefault(), l >= 0 && d[l] && k(d[l])) : e.key === "Escape" && (s(!1), u(""));
31
- }, a = `combobox-${Math.random().toString(36).slice(2, 9)}`, D = `${a}-list`;
32
- return /* @__PURE__ */ $("div", { className: c("flex flex-col gap-[var(--spacing-xs)]", L), ref: x, children: [
33
- g && /* @__PURE__ */ t(
34
- "label",
35
- {
36
- className: "text-[var(--font-size-sm)] font-[var(--font-weight-semibold)] text-[var(--md-on-surface)]",
37
- htmlFor: a,
38
- children: g
39
- }
40
- ),
41
- /* @__PURE__ */ $("div", { className: "relative", children: [
42
- /* @__PURE__ */ t(
43
- "input",
44
- {
45
- ref: N,
46
- "aria-activedescendant": l >= 0 ? `${a}-option-${l}` : void 0,
47
- "aria-autocomplete": "list",
48
- "aria-controls": D,
49
- "aria-describedby": o ? `${a}-error` : m ? `${a}-helper` : void 0,
50
- "aria-expanded": n,
51
- "aria-invalid": o ? !0 : void 0,
52
- autoComplete: "off",
53
- className: c(
54
- "w-full rounded-[var(--border-radius-md)] border border-[var(--md-outline-variant)] bg-[var(--md-surface)] px-3.5 py-2 text-[var(--font-size-base)] text-[var(--md-on-surface)] outline-none transition placeholder:text-[var(--md-on-surface-variant)] placeholder:opacity-70 focus:border-[var(--border-color-focus)] focus:[box-shadow:0_0_0_0.1875rem_rgba(47,93,140,0.15)] disabled:cursor-not-allowed disabled:opacity-60",
55
- o && "border-[var(--md-error)]"
56
- ),
57
- disabled: E,
58
- id: a,
59
- placeholder: z,
60
- role: "combobox",
61
- type: "text",
62
- value: M,
63
- onChange: (e) => {
64
- u(e.target.value), s(!0), i(0);
65
- },
66
- onFocus: () => s(!0),
67
- onKeyDown: A
68
- }
69
- ),
70
- /* @__PURE__ */ t(
71
- "span",
72
- {
73
- "aria-hidden": "true",
74
- className: c(
75
- "pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-[var(--text-muted)] transition",
76
- n && "rotate-180"
77
- ),
78
- children: /* @__PURE__ */ t(
79
- "svg",
80
- {
81
- className: "h-4 w-4",
82
- fill: "none",
83
- stroke: "currentColor",
84
- strokeWidth: "2",
85
- viewBox: "0 0 24 24",
86
- children: /* @__PURE__ */ t("path", { d: "m6 9 6 6 6-6", strokeLinecap: "round", strokeLinejoin: "round" })
87
- }
88
- )
89
- }
90
- ),
91
- n && d.length > 0 && /* @__PURE__ */ t(
92
- "ul",
93
- {
94
- ref: I,
95
- className: "absolute z-[var(--z-index-dropdown)] mt-1 max-h-60 w-full overflow-auto rounded-[var(--border-radius-md)] border border-[var(--md-outline-variant)] bg-[var(--md-surface)] py-1 shadow-[var(--shadow-md)]",
96
- id: D,
97
- role: "listbox",
98
- children: d.map((e, r) => /* @__PURE__ */ t(
99
- "li",
100
- {
101
- "aria-selected": e.value === f,
102
- className: c(
103
- "cursor-pointer px-3.5 py-2 text-sm transition",
104
- r === l ? "bg-[var(--md-primary)] text-[var(--md-on-primary)]" : e.value === f ? "bg-[var(--bg-tertiary)] text-[var(--text-primary)]" : "text-[var(--text-primary)] hover:bg-[var(--bg-hover)]"
105
- ),
106
- id: `${a}-option-${r}`,
107
- role: "option",
108
- onMouseDown: (C) => {
109
- C.preventDefault(), k(e);
110
- },
111
- onMouseEnter: () => i(r),
112
- children: e.label
42
+ if (e.key === "ArrowDown")
43
+ e.preventDefault(), n((t) => Math.min(t + 1, i.length - 1));
44
+ else if (e.key === "ArrowUp")
45
+ e.preventDefault(), n((t) => Math.max(t - 1, 0));
46
+ else if (e.key === "Home")
47
+ e.preventDefault(), n(0);
48
+ else if (e.key === "End")
49
+ e.preventDefault(), n(i.length - 1);
50
+ else if (e.key === "Enter") {
51
+ e.preventDefault();
52
+ const t = i[s];
53
+ t && C(t);
54
+ } else (e.key === "Escape" || e.key === "Tab") && p();
55
+ };
56
+ return /* @__PURE__ */ l(
57
+ G,
58
+ {
59
+ className: j,
60
+ error: c,
61
+ helperText: k,
62
+ id: a,
63
+ label: $,
64
+ required: x,
65
+ children: /* @__PURE__ */ b("div", { ref: N, className: "relative", children: [
66
+ /* @__PURE__ */ l(
67
+ "input",
68
+ {
69
+ "aria-activedescendant": r && s >= 0 ? `${a}-option-${s}` : void 0,
70
+ "aria-autocomplete": "list",
71
+ "aria-controls": w,
72
+ "aria-describedby": H(a, c, k),
73
+ "aria-expanded": r,
74
+ "aria-invalid": c ? !0 : void 0,
75
+ autoComplete: "off",
76
+ className: y(V, U.md, "pr-10"),
77
+ disabled: A,
78
+ id: a,
79
+ onChange: (e) => {
80
+ g(e.target.value), d(!0), n(0);
113
81
  },
114
- e.value
115
- ))
116
- }
117
- ),
118
- n && d.length === 0 && /* @__PURE__ */ t("div", { className: "absolute z-[var(--z-index-dropdown)] mt-1 w-full rounded-[var(--border-radius-md)] border border-[var(--md-outline-variant)] bg-[var(--md-surface)] px-3.5 py-3 text-sm text-[var(--text-muted)] shadow-[var(--shadow-md)]", children: "Nenhum resultado encontrado." })
119
- ] }),
120
- o && /* @__PURE__ */ t(
121
- "span",
122
- {
123
- className: "text-[var(--font-size-xs)] text-[var(--md-error)]",
124
- id: `${a}-error`,
125
- role: "alert",
126
- children: o
127
- }
128
- ),
129
- m && !o && /* @__PURE__ */ t(
130
- "span",
131
- {
132
- className: "text-[var(--font-size-xs)] text-[var(--md-on-surface-variant)]",
133
- id: `${a}-helper`,
134
- children: m
135
- }
136
- )
137
- ] });
82
+ onClick: () => d(!0),
83
+ onKeyDown: q,
84
+ placeholder: R,
85
+ required: x,
86
+ role: "combobox",
87
+ type: "text",
88
+ value: r ? D : (m == null ? void 0 : m.label) ?? ""
89
+ }
90
+ ),
91
+ /* @__PURE__ */ l(
92
+ Q,
93
+ {
94
+ "aria-hidden": "true",
95
+ className: y(
96
+ "pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 text-sbk-fg-muted transition-transform motion-reduce:transition-none",
97
+ r && "rotate-180"
98
+ )
99
+ }
100
+ ),
101
+ r && /* @__PURE__ */ b(
102
+ "ul",
103
+ {
104
+ ref: E,
105
+ className: "absolute z-[var(--sbk-z-dropdown)] mt-1 max-h-60 w-full overflow-auto rounded-sbk-sm border border-sbk-line bg-sbk-surface py-1 shadow-sbk-md animate-sbk-fade-in",
106
+ id: w,
107
+ role: "listbox",
108
+ children: [
109
+ i.length === 0 && /* @__PURE__ */ l(
110
+ "li",
111
+ {
112
+ "aria-disabled": "true",
113
+ className: "px-3.5 py-2.5 text-sm font-light text-sbk-fg-muted",
114
+ role: "option",
115
+ "aria-selected": !1,
116
+ children: S
117
+ }
118
+ ),
119
+ i.map((e, t) => {
120
+ const o = e.value === h;
121
+ return /* @__PURE__ */ b(
122
+ "li",
123
+ {
124
+ "aria-selected": o,
125
+ className: y(
126
+ "flex cursor-pointer items-center justify-between gap-2 px-3.5 py-2 text-sm font-light text-sbk-fg",
127
+ t === s && "bg-sbk-surface-hover",
128
+ o && "font-semibold text-sbk-primary"
129
+ ),
130
+ "data-index": t,
131
+ id: `${a}-option-${t}`,
132
+ onMouseDown: (K) => {
133
+ K.preventDefault(), C(e);
134
+ },
135
+ onMouseEnter: () => n(t),
136
+ role: "option",
137
+ children: [
138
+ e.label,
139
+ o && /* @__PURE__ */ l(F, { "aria-hidden": "true", className: "size-4" })
140
+ ]
141
+ },
142
+ e.value
143
+ );
144
+ })
145
+ ]
146
+ }
147
+ )
148
+ ] })
149
+ }
150
+ );
138
151
  };
139
- S.displayName = "Combobox";
152
+ J.displayName = "Combobox";
140
153
  export {
141
- S as Combobox
154
+ J as Combobox
142
155
  };
143
156
  //# sourceMappingURL=Combobox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Combobox.js","sources":["../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { cn } from '../../utils/cn';\n\nexport interface ComboboxOption {\n label: string;\n value: string;\n}\n\nexport interface ComboboxProps {\n className?: string;\n disabled?: boolean;\n error?: string;\n helperText?: string;\n label?: string;\n onChange?: (value: string) => void;\n options: ComboboxOption[];\n placeholder?: string;\n value?: string;\n}\n\nexport const Combobox: React.FC<ComboboxProps> = ({\n label,\n helperText,\n error,\n options,\n value,\n onChange,\n placeholder = 'Selecione ou pesquise...',\n disabled = false,\n className,\n}) => {\n const [query, setQuery] = useState('');\n const [isOpen, setIsOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState(-1);\n const containerRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const listRef = useRef<HTMLUListElement>(null);\n\n const selectedOption = options.find((o) => o.value === value);\n\n const filtered = query\n ? options.filter((o) => o.label.toLowerCase().includes(query.toLowerCase()))\n : options;\n\n const displayValue = isOpen ? query : (selectedOption?.label ?? '');\n\n // Fechar ao clicar fora\n useEffect(() => {\n const handleClickOutside = (e: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(e.target as Node)) {\n setIsOpen(false);\n setQuery('');\n }\n };\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }, []);\n\n const handleSelect = (option: ComboboxOption) => {\n onChange?.(option.value);\n setQuery('');\n setIsOpen(false);\n inputRef.current?.blur();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (!isOpen) {\n if (e.key === 'ArrowDown' || e.key === 'Enter') {\n setIsOpen(true);\n setActiveIndex(0);\n e.preventDefault();\n }\n return;\n }\n\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n setActiveIndex((i) => Math.min(i + 1, filtered.length - 1));\n } else if (e.key === 'ArrowUp') {\n e.preventDefault();\n setActiveIndex((i) => Math.max(i - 1, 0));\n } else if (e.key === 'Enter') {\n e.preventDefault();\n if (activeIndex >= 0 && filtered[activeIndex]) {\n handleSelect(filtered[activeIndex]);\n }\n } else if (e.key === 'Escape') {\n setIsOpen(false);\n setQuery('');\n }\n };\n\n const inputId = `combobox-${Math.random().toString(36).slice(2, 9)}`;\n const listId = `${inputId}-list`;\n\n return (\n <div className={cn('flex flex-col gap-[var(--spacing-xs)]', className)} ref={containerRef}>\n {label && (\n <label\n className=\"text-[var(--font-size-sm)] font-[var(--font-weight-semibold)] text-[var(--md-on-surface)]\"\n htmlFor={inputId}\n >\n {label}\n </label>\n )}\n <div className=\"relative\">\n <input\n ref={inputRef}\n aria-activedescendant={activeIndex >= 0 ? `${inputId}-option-${activeIndex}` : undefined}\n aria-autocomplete=\"list\"\n aria-controls={listId}\n aria-describedby={\n error ? `${inputId}-error` : helperText ? `${inputId}-helper` : undefined\n }\n aria-expanded={isOpen}\n aria-invalid={error ? true : undefined}\n autoComplete=\"off\"\n className={cn(\n 'w-full rounded-[var(--border-radius-md)] border border-[var(--md-outline-variant)] bg-[var(--md-surface)] px-3.5 py-2 text-[var(--font-size-base)] text-[var(--md-on-surface)] outline-none transition placeholder:text-[var(--md-on-surface-variant)] placeholder:opacity-70 focus:border-[var(--border-color-focus)] focus:[box-shadow:0_0_0_0.1875rem_rgba(47,93,140,0.15)] disabled:cursor-not-allowed disabled:opacity-60',\n error && 'border-[var(--md-error)]',\n )}\n disabled={disabled}\n id={inputId}\n placeholder={placeholder}\n role=\"combobox\"\n type=\"text\"\n value={displayValue}\n onChange={(e) => {\n setQuery(e.target.value);\n setIsOpen(true);\n setActiveIndex(0);\n }}\n onFocus={() => setIsOpen(true)}\n onKeyDown={handleKeyDown}\n />\n {/* Chevron */}\n <span\n aria-hidden=\"true\"\n className={cn(\n 'pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-[var(--text-muted)] transition',\n isOpen && 'rotate-180',\n )}\n >\n <svg\n className=\"h-4 w-4\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"m6 9 6 6 6-6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n </span>\n\n {/* Dropdown */}\n {isOpen && filtered.length > 0 && (\n <ul\n ref={listRef}\n className=\"absolute z-[var(--z-index-dropdown)] mt-1 max-h-60 w-full overflow-auto rounded-[var(--border-radius-md)] border border-[var(--md-outline-variant)] bg-[var(--md-surface)] py-1 shadow-[var(--shadow-md)]\"\n id={listId}\n role=\"listbox\"\n >\n {filtered.map((option, index) => (\n <li\n aria-selected={option.value === value}\n className={cn(\n 'cursor-pointer px-3.5 py-2 text-sm transition',\n index === activeIndex\n ? 'bg-[var(--md-primary)] text-[var(--md-on-primary)]'\n : option.value === value\n ? 'bg-[var(--bg-tertiary)] text-[var(--text-primary)]'\n : 'text-[var(--text-primary)] hover:bg-[var(--bg-hover)]',\n )}\n id={`${inputId}-option-${index}`}\n key={option.value}\n role=\"option\"\n onMouseDown={(e) => {\n e.preventDefault();\n handleSelect(option);\n }}\n onMouseEnter={() => setActiveIndex(index)}\n >\n {option.label}\n </li>\n ))}\n </ul>\n )}\n {isOpen && filtered.length === 0 && (\n <div className=\"absolute z-[var(--z-index-dropdown)] mt-1 w-full rounded-[var(--border-radius-md)] border border-[var(--md-outline-variant)] bg-[var(--md-surface)] px-3.5 py-3 text-sm text-[var(--text-muted)] shadow-[var(--shadow-md)]\">\n Nenhum resultado encontrado.\n </div>\n )}\n </div>\n {error && (\n <span\n className=\"text-[var(--font-size-xs)] text-[var(--md-error)]\"\n id={`${inputId}-error`}\n role=\"alert\"\n >\n {error}\n </span>\n )}\n {helperText && !error && (\n <span\n className=\"text-[var(--font-size-xs)] text-[var(--md-on-surface-variant)]\"\n id={`${inputId}-helper`}\n >\n {helperText}\n </span>\n )}\n </div>\n );\n};\n\nCombobox.displayName = 'Combobox';\n"],"names":["Combobox","label","helperText","error","options","value","onChange","placeholder","disabled","className","query","setQuery","useState","isOpen","setIsOpen","activeIndex","setActiveIndex","containerRef","useRef","inputRef","listRef","selectedOption","o","filtered","displayValue","useEffect","handleClickOutside","e","handleSelect","option","_a","handleKeyDown","i","inputId","listId","jsxs","cn","jsx","index"],"mappings":";;;AAoBO,MAAMA,IAAoC,CAAC;AAAA,EAChD,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,UAAAC,IAAW;AAAA,EACX,WAAAC;AACF,MAAM;AACJ,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAS,EAAE,GAC/B,CAACC,GAAQC,CAAS,IAAIF,EAAS,EAAK,GACpC,CAACG,GAAaC,CAAc,IAAIJ,EAAS,EAAE,GAC3CK,IAAeC,EAAuB,IAAI,GAC1CC,IAAWD,EAAyB,IAAI,GACxCE,IAAUF,EAAyB,IAAI,GAEvCG,IAAiBjB,EAAQ,KAAK,CAACkB,MAAMA,EAAE,UAAUjB,CAAK,GAEtDkB,IAAWb,IACbN,EAAQ,OAAO,CAACkB,MAAMA,EAAE,MAAM,YAAA,EAAc,SAASZ,EAAM,YAAA,CAAa,CAAC,IACzEN,GAEEoB,IAAeX,IAASH,KAASW,KAAA,gBAAAA,EAAgB,UAAS;AAGhE,EAAAI,EAAU,MAAM;AACd,UAA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EAAS,SAAS,KAC3B,gBAAAc;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,KAAKjB;AAAA,UACL,WAAU;AAAA,UACV,IAAIc;AAAA,UACJ,MAAK;AAAA,UAEJ,UAAAX,EAAS,IAAI,CAACM,GAAQS,MACrB,gBAAAD;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,iBAAeR,EAAO,UAAUxB;AAAA,cAChC,WAAW+B;AAAA,gBACT;AAAA,gBACAE,MAAUvB,IACN,uDACAc,EAAO,UAAUxB,IACf,uDACA;AAAA,cAAA;AAAA,cAER,IAAI,GAAG4B,CAAO,WAAWK,CAAK;AAAA,cAE9B,MAAK;AAAA,cACL,aAAa,CAACX,MAAM;AAClB,gBAAAA,EAAE,eAAA,GACFC,EAAaC,CAAM;AAAA,cACrB;AAAA,cACA,cAAc,MAAMb,EAAesB,CAAK;AAAA,cAEvC,UAAAT,EAAO;AAAA,YAAA;AAAA,YARHA,EAAO;AAAA,UAAA,CAUf;AAAA,QAAA;AAAA,MAAA;AAAA,MAGJhB,KAAUU,EAAS,WAAW,uBAC5B,OAAA,EAAI,WAAU,8NAA6N,UAAA,+BAAA,CAE5O;AAAA,IAAA,GAEJ;AAAA,IACCpB,KACC,gBAAAkC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,IAAI,GAAGJ,CAAO;AAAA,QACd,MAAK;AAAA,QAEJ,UAAA9B;AAAA,MAAA;AAAA,IAAA;AAAA,IAGJD,KAAc,CAACC,KACd,gBAAAkC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,IAAI,GAAGJ,CAAO;AAAA,QAEb,UAAA/B;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GAEJ;AAEJ;AAEAF,EAAS,cAAc;"}
1
+ {"version":3,"file":"Combobox.js","sources":["../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import React, { useEffect, useId, useRef, useState } from 'react';\r\nimport { Check, ChevronDown } from 'lucide-react';\r\nimport { cn } from '../../utils/cn';\r\nimport { describedBy, fieldControl, fieldSize } from '../../utils/styles';\r\nimport { Field } from '../Field/Field';\r\n\r\nexport interface ComboboxOption {\r\n label: string;\r\n value: string;\r\n}\r\n\r\nexport interface ComboboxProps {\r\n className?: string;\r\n disabled?: boolean;\r\n /** Texto exibido quando o filtro não encontra opções. */\r\n emptyText?: string;\r\n error?: string;\r\n helperText?: string;\r\n id?: string;\r\n label?: React.ReactNode;\r\n onChange?: (value: string) => void;\r\n options: ComboboxOption[];\r\n placeholder?: string;\r\n required?: boolean;\r\n value?: string;\r\n}\r\n\r\n/** Campo com busca e lista de opções (padrão ARIA combobox + listbox). */\r\nexport const Combobox = ({\r\n label,\r\n helperText,\r\n error,\r\n options,\r\n value,\r\n onChange,\r\n placeholder = 'Selecione ou pesquise...',\r\n emptyText = 'Nenhum resultado encontrado.',\r\n disabled = false,\r\n required,\r\n id,\r\n className,\r\n}: ComboboxProps) => {\r\n const autoId = useId();\r\n const inputId = id ?? autoId;\r\n const listId = `${inputId}-list`;\r\n const [query, setQuery] = useState('');\r\n const [isOpen, setIsOpen] = useState(false);\r\n const [activeIndex, setActiveIndex] = useState(-1);\r\n const containerRef = useRef<HTMLDivElement>(null);\r\n const listRef = useRef<HTMLUListElement>(null);\r\n\r\n const selectedOption = options.find((o) => o.value === value);\r\n const normalizedQuery = query.trim().toLocaleLowerCase('pt-BR');\r\n const filtered = normalizedQuery\r\n ? options.filter((o) => o.label.toLocaleLowerCase('pt-BR').includes(normalizedQuery))\r\n : options;\r\n\r\n const close = () => {\r\n setIsOpen(false);\r\n setQuery('');\r\n setActiveIndex(-1);\r\n };\r\n\r\n useEffect(() => {\r\n if (!isOpen) return;\r\n const handleClickOutside = (e: MouseEvent) => {\r\n if (!containerRef.current?.contains(e.target as Node)) close();\r\n };\r\n document.addEventListener('mousedown', handleClickOutside);\r\n return () => document.removeEventListener('mousedown', handleClickOutside);\r\n }, [isOpen]);\r\n\r\n useEffect(() => {\r\n if (activeIndex < 0) return;\r\n listRef.current\r\n ?.querySelector(`[data-index=\"${activeIndex}\"]`)\r\n ?.scrollIntoView?.({ block: 'nearest' });\r\n }, [activeIndex]);\r\n\r\n const handleSelect = (option: ComboboxOption) => {\r\n onChange?.(option.value);\r\n close();\r\n };\r\n\r\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\r\n if (!isOpen) {\r\n if (e.key === 'ArrowDown' || e.key === 'Enter') {\r\n e.preventDefault();\r\n setIsOpen(true);\r\n setActiveIndex(0);\r\n }\r\n return;\r\n }\r\n if (e.key === 'ArrowDown') {\r\n e.preventDefault();\r\n setActiveIndex((i) => Math.min(i + 1, filtered.length - 1));\r\n } else if (e.key === 'ArrowUp') {\r\n e.preventDefault();\r\n setActiveIndex((i) => Math.max(i - 1, 0));\r\n } else if (e.key === 'Home') {\r\n e.preventDefault();\r\n setActiveIndex(0);\r\n } else if (e.key === 'End') {\r\n e.preventDefault();\r\n setActiveIndex(filtered.length - 1);\r\n } else if (e.key === 'Enter') {\r\n e.preventDefault();\r\n const option = filtered[activeIndex];\r\n if (option) handleSelect(option);\r\n } else if (e.key === 'Escape' || e.key === 'Tab') {\r\n close();\r\n }\r\n };\r\n\r\n return (\r\n <Field\r\n className={className}\r\n error={error}\r\n helperText={helperText}\r\n id={inputId}\r\n label={label}\r\n required={required}\r\n >\r\n <div ref={containerRef} className=\"relative\">\r\n <input\r\n aria-activedescendant={\r\n isOpen && activeIndex >= 0 ? `${inputId}-option-${activeIndex}` : undefined\r\n }\r\n aria-autocomplete=\"list\"\r\n aria-controls={listId}\r\n aria-describedby={describedBy(inputId, error, helperText)}\r\n aria-expanded={isOpen}\r\n aria-invalid={error ? true : undefined}\r\n autoComplete=\"off\"\r\n className={cn(fieldControl, fieldSize.md, 'pr-10')}\r\n disabled={disabled}\r\n id={inputId}\r\n onChange={(e) => {\r\n setQuery(e.target.value);\r\n setIsOpen(true);\r\n setActiveIndex(0);\r\n }}\r\n onClick={() => setIsOpen(true)}\r\n onKeyDown={handleKeyDown}\r\n placeholder={placeholder}\r\n required={required}\r\n role=\"combobox\"\r\n type=\"text\"\r\n value={isOpen ? query : (selectedOption?.label ?? '')}\r\n />\r\n <ChevronDown\r\n aria-hidden=\"true\"\r\n className={cn(\r\n 'pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 text-sbk-fg-muted transition-transform motion-reduce:transition-none',\r\n isOpen && 'rotate-180',\r\n )}\r\n />\r\n\r\n {isOpen && (\r\n <ul\r\n ref={listRef}\r\n className=\"absolute z-[var(--sbk-z-dropdown)] mt-1 max-h-60 w-full overflow-auto rounded-sbk-sm border border-sbk-line bg-sbk-surface py-1 shadow-sbk-md animate-sbk-fade-in\"\r\n id={listId}\r\n role=\"listbox\"\r\n >\r\n {filtered.length === 0 && (\r\n <li\r\n aria-disabled=\"true\"\r\n className=\"px-3.5 py-2.5 text-sm font-light text-sbk-fg-muted\"\r\n role=\"option\"\r\n aria-selected={false}\r\n >\r\n {emptyText}\r\n </li>\r\n )}\r\n {filtered.map((option, index) => {\r\n const selected = option.value === value;\r\n return (\r\n <li\r\n key={option.value}\r\n aria-selected={selected}\r\n className={cn(\r\n 'flex cursor-pointer items-center justify-between gap-2 px-3.5 py-2 text-sm font-light text-sbk-fg',\r\n index === activeIndex && 'bg-sbk-surface-hover',\r\n selected && 'font-semibold text-sbk-primary',\r\n )}\r\n data-index={index}\r\n id={`${inputId}-option-${index}`}\r\n onMouseDown={(e) => {\r\n e.preventDefault();\r\n handleSelect(option);\r\n }}\r\n onMouseEnter={() => setActiveIndex(index)}\r\n role=\"option\"\r\n >\r\n {option.label}\r\n {selected && <Check aria-hidden=\"true\" className=\"size-4\" />}\r\n </li>\r\n );\r\n })}\r\n </ul>\r\n )}\r\n </div>\r\n </Field>\r\n );\r\n};\r\n\r\nCombobox.displayName = 'Combobox';\r\n"],"names":["Combobox","label","helperText","error","options","value","onChange","placeholder","emptyText","disabled","required","id","className","autoId","useId","inputId","listId","query","setQuery","useState","isOpen","setIsOpen","activeIndex","setActiveIndex","containerRef","useRef","listRef","selectedOption","o","normalizedQuery","filtered","close","useEffect","handleClickOutside","e","_a","_c","_b","handleSelect","option","handleKeyDown","i","jsx","Field","jsxs","describedBy","cn","fieldControl","fieldSize","ChevronDown","index","selected","Check"],"mappings":";;;;;;AA4BO,MAAMA,IAAW,CAAC;AAAA,EACvB,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,WAAAC,IAAY;AAAA,EACZ,UAAAC,IAAW;AAAA,EACX,UAAAC;AAAA,EACA,IAAAC;AAAA,EACA,WAAAC;AACF,MAAqB;AACnB,QAAMC,IAASC,EAAA,GACTC,IAAUJ,KAAME,GAChBG,IAAS,GAAGD,CAAO,SACnB,CAACE,GAAOC,CAAQ,IAAIC,EAAS,EAAE,GAC/B,CAACC,GAAQC,CAAS,IAAIF,EAAS,EAAK,GACpC,CAACG,GAAaC,CAAc,IAAIJ,EAAS,EAAE,GAC3CK,IAAeC,EAAuB,IAAI,GAC1CC,IAAUD,EAAyB,IAAI,GAEvCE,IAAiBvB,EAAQ,KAAK,CAACwB,MAAMA,EAAE,UAAUvB,CAAK,GACtDwB,IAAkBZ,EAAM,KAAA,EAAO,kBAAkB,OAAO,GACxDa,IAAWD,IACbzB,EAAQ,OAAO,CAACwB,MAAMA,EAAE,MAAM,kBAAkB,OAAO,EAAE,SAASC,CAAe,CAAC,IAClFzB,GAEE2B,IAAQ,MAAM;AAClB,IAAAV,EAAU,EAAK,GACfH,EAAS,EAAE,GACXK,EAAe,EAAE;AAAA,EACnB;AAEA,EAAAS,EAAU,MAAM;AACd,QAAI,CAACZ,EAAQ;AACb,UAAMa,IAAqB,CAACC,MAAkB;;AAC5C,OAAKC,IAAAX,EAAa,YAAb,QAAAW,EAAsB,SAASD,EAAE,WAAiBH,EAAA;AAAA,IACzD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Ac;AAAA,kBACd,WAAU;AAAA,kBACV,MAAK;AAAA,kBACL,iBAAe;AAAA,kBAEd,UAAAlC;AAAA,gBAAA;AAAA,cAAA;AAAA,cAGJsB,EAAS,IAAI,CAACS,GAAQW,MAAU;AAC/B,sBAAMC,IAAWZ,EAAO,UAAUlC;AAClC,uBACE,gBAAAuC;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBAEC,iBAAeO;AAAA,oBACf,WAAWL;AAAA,sBACT;AAAA,sBACAI,MAAU5B,KAAe;AAAA,sBACzB6B,KAAY;AAAA,oBAAA;AAAA,oBAEd,cAAYD;AAAA,oBACZ,IAAI,GAAGnC,CAAO,WAAWmC,CAAK;AAAA,oBAC9B,aAAa,CAAChB,MAAM;AAClB,sBAAAA,EAAE,eAAA,GACFI,EAAaC,CAAM;AAAA,oBACrB;AAAA,oBACA,cAAc,MAAMhB,EAAe2B,CAAK;AAAA,oBACxC,MAAK;AAAA,oBAEJ,UAAA;AAAA,sBAAAX,EAAO;AAAA,sBACPY,KAAY,gBAAAT,EAACU,GAAA,EAAM,eAAY,QAAO,WAAU,SAAA,CAAS;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAjBrDb,EAAO;AAAA,gBAAA;AAAA,cAoBlB,CAAC;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH,EAAA,CAEJ;AAAA,IAAA;AAAA,EAAA;AAGN;AAEAvC,EAAS,cAAc;"}
@@ -1,5 +1,11 @@
1
1
  import type React from 'react';
2
2
  export interface DividerProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ /** Texto central (ex.: "ou"). Apenas na orientação horizontal. */
4
+ label?: React.ReactNode;
3
5
  orientation?: 'horizontal' | 'vertical';
4
6
  }
5
- export declare const Divider: React.FC<DividerProps>;
7
+ /** Linha divisória funcional (brand book: linhas conduzem o olhar, não decoram). */
8
+ export declare const Divider: {
9
+ ({ orientation, label, className, ...props }: DividerProps): import("react/jsx-runtime").JSX.Element;
10
+ displayName: string;
11
+ };
@@ -1,22 +1,38 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { cn as a } from "../../utils/cn.js";
3
- const p = ({
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import { cn as l } from "../../utils/cn.js";
3
+ const n = ({
4
4
  orientation: r = "horizontal",
5
- className: o,
6
- ...l
7
- }) => /* @__PURE__ */ t(
5
+ label: s,
6
+ className: a,
7
+ ...i
8
+ }) => s && r === "horizontal" ? /* @__PURE__ */ t(
8
9
  "div",
9
10
  {
10
- className: a(
11
- "bg-[var(--border-color)]",
12
- r === "horizontal" ? "h-px w-full" : "h-full w-px",
13
- o
11
+ "aria-orientation": "horizontal",
12
+ className: l("flex items-center gap-3", a),
13
+ role: "separator",
14
+ ...i,
15
+ children: [
16
+ /* @__PURE__ */ e("span", { className: "h-px flex-1 bg-sbk-line" }),
17
+ /* @__PURE__ */ e("span", { className: "text-xs font-light text-sbk-fg-muted", children: s }),
18
+ /* @__PURE__ */ e("span", { className: "h-px flex-1 bg-sbk-line" })
19
+ ]
20
+ }
21
+ ) : /* @__PURE__ */ e(
22
+ "div",
23
+ {
24
+ "aria-orientation": r,
25
+ className: l(
26
+ "shrink-0 bg-sbk-line",
27
+ r === "horizontal" ? "h-px w-full" : "h-full w-px self-stretch",
28
+ a
14
29
  ),
15
30
  role: "separator",
16
- ...l
31
+ ...i
17
32
  }
18
33
  );
34
+ n.displayName = "Divider";
19
35
  export {
20
- p as Divider
36
+ n as Divider
21
37
  };
22
38
  //# sourceMappingURL=Divider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Divider.js","sources":["../../../src/components/Divider/Divider.tsx"],"sourcesContent":["import type React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport interface DividerProps extends React.HTMLAttributes<HTMLDivElement> {\n orientation?: 'horizontal' | 'vertical';\n}\n\nexport const Divider: React.FC<DividerProps> = ({\n orientation = 'horizontal',\n className,\n ...props\n}) => {\n return (\n <div\n className={cn(\n 'bg-[var(--border-color)]',\n orientation === 'horizontal' ? 'h-px w-full' : 'h-full w-px',\n className,\n )}\n role=\"separator\"\n {...props}\n />\n );\n};\n"],"names":["Divider","orientation","className","props","jsx","cn"],"mappings":";;AAOO,MAAMA,IAAkC,CAAC;AAAA,EAC9C,aAAAC,IAAc;AAAA,EACd,WAAAC;AAAA,EACA,GAAGC;AACL,MAEI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC;AAAA,MACT;AAAA,MACAJ,MAAgB,eAAe,gBAAgB;AAAA,MAC/CC;AAAA,IAAA;AAAA,IAEF,MAAK;AAAA,IACJ,GAAGC;AAAA,EAAA;AAAA;"}
1
+ {"version":3,"file":"Divider.js","sources":["../../../src/components/Divider/Divider.tsx"],"sourcesContent":["import type React from 'react';\r\nimport { cn } from '../../utils/cn';\r\n\r\nexport interface DividerProps extends React.HTMLAttributes<HTMLDivElement> {\r\n /** Texto central (ex.: \"ou\"). Apenas na orientação horizontal. */\r\n label?: React.ReactNode;\r\n orientation?: 'horizontal' | 'vertical';\r\n}\r\n\r\n/** Linha divisória funcional (brand book: linhas conduzem o olhar, não decoram). */\r\nexport const Divider = ({\r\n orientation = 'horizontal',\r\n label,\r\n className,\r\n ...props\r\n}: DividerProps) => {\r\n if (label && orientation === 'horizontal') {\r\n return (\r\n <div\r\n aria-orientation=\"horizontal\"\r\n className={cn('flex items-center gap-3', className)}\r\n role=\"separator\"\r\n {...props}\r\n >\r\n <span className=\"h-px flex-1 bg-sbk-line\" />\r\n <span className=\"text-xs font-light text-sbk-fg-muted\">{label}</span>\r\n <span className=\"h-px flex-1 bg-sbk-line\" />\r\n </div>\r\n );\r\n }\r\n return (\r\n <div\r\n aria-orientation={orientation}\r\n className={cn(\r\n 'shrink-0 bg-sbk-line',\r\n orientation === 'horizontal' ? 'h-px w-full' : 'h-full w-px self-stretch',\r\n className,\r\n )}\r\n role=\"separator\"\r\n {...props}\r\n />\r\n );\r\n};\r\n\r\nDivider.displayName = 'Divider';\r\n"],"names":["Divider","orientation","label","className","props","jsxs","cn","jsx"],"mappings":";;AAUO,MAAMA,IAAU,CAAC;AAAA,EACtB,aAAAC,IAAc;AAAA,EACd,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,MACMF,KAASD,MAAgB,eAEzB,gBAAAI;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,oBAAiB;AAAA,IACjB,WAAWC,EAAG,2BAA2BH,CAAS;AAAA,IAClD,MAAK;AAAA,IACJ,GAAGC;AAAA,IAEJ,UAAA;AAAA,MAAA,gBAAAG,EAAC,QAAA,EAAK,WAAU,0BAAA,CAA0B;AAAA,MAC1C,gBAAAA,EAAC,QAAA,EAAK,WAAU,wCAAwC,UAAAL,GAAM;AAAA,MAC9D,gBAAAK,EAAC,QAAA,EAAK,WAAU,0BAAA,CAA0B;AAAA,IAAA;AAAA,EAAA;AAAA,IAK9C,gBAAAA;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,oBAAkBN;AAAA,IAClB,WAAWK;AAAA,MACT;AAAA,MACAL,MAAgB,eAAe,gBAAgB;AAAA,MAC/CE;AAAA,IAAA;AAAA,IAEF,MAAK;AAAA,IACJ,GAAGC;AAAA,EAAA;AAAA;AAKVJ,EAAQ,cAAc;"}