@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.
- package/CHANGELOG.md +57 -0
- package/MIGRATION.md +96 -0
- package/README.md +221 -115
- package/dist/assets/favicon/apple-touch-icon.png +0 -0
- package/dist/assets/favicon/favicon-96x96.png +0 -0
- package/dist/assets/favicon/favicon.ico +0 -0
- package/dist/assets/favicon/favicon.svg +1 -0
- package/dist/assets/favicon/site.webmanifest +21 -0
- package/dist/assets/favicon/web-app-manifest-192x192.png +0 -0
- package/dist/assets/favicon/web-app-manifest-512x512.png +0 -0
- package/dist/base.css +38 -0
- package/dist/components/Accordion/Accordion.d.ts +13 -1
- package/dist/components/Accordion/Accordion.js +100 -52
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Alert/Alert.d.ts +17 -4
- package/dist/components/Alert/Alert.js +64 -20
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/Avatar/Avatar.d.ts +12 -6
- package/dist/components/Avatar/Avatar.js +66 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Badge/Badge.d.ts +11 -2
- package/dist/components/Badge/Badge.js +42 -30
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +5 -2
- package/dist/components/Breadcrumb/Breadcrumb.js +23 -16
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/Button/Button.d.ts +10 -8
- package/dist/components/Button/Button.js +73 -114
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Card/Card.d.ts +33 -3
- package/dist/components/Card/Card.js +91 -30
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +4 -1
- package/dist/components/Checkbox/Checkbox.js +32 -31
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Chip/Chip.d.ts +7 -1
- package/dist/components/Chip/Chip.js +19 -9
- package/dist/components/Chip/Chip.js.map +1 -1
- package/dist/components/Combobox/Combobox.d.ts +10 -2
- package/dist/components/Combobox/Combobox.js +146 -133
- package/dist/components/Combobox/Combobox.js.map +1 -1
- package/dist/components/Divider/Divider.d.ts +7 -1
- package/dist/components/Divider/Divider.js +28 -12
- package/dist/components/Divider/Divider.js.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +33 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +147 -0
- package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -0
- package/dist/components/EmptyState/EmptyState.d.ts +7 -1
- package/dist/components/EmptyState/EmptyState.js +28 -19
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/Field/Field.d.ts +21 -0
- package/dist/components/Field/Field.js +35 -0
- package/dist/components/Field/Field.js.map +1 -0
- package/dist/components/FileUpload/FileUpload.d.ts +9 -2
- package/dist/components/FileUpload/FileUpload.js +128 -102
- package/dist/components/FileUpload/FileUpload.js.map +1 -1
- package/dist/components/Footer/Footer.d.ts +19 -6
- package/dist/components/Footer/Footer.js +47 -115
- package/dist/components/Footer/Footer.js.map +1 -1
- package/dist/components/GlassPanel/GlassPanel.d.ts +18 -0
- package/dist/components/GlassPanel/GlassPanel.js +39 -0
- package/dist/components/GlassPanel/GlassPanel.js.map +1 -0
- package/dist/components/Header/Header.d.ts +25 -14
- package/dist/components/Header/Header.js +88 -148
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/Highlight/Highlight.d.ts +13 -0
- package/dist/components/Highlight/Highlight.js +18 -0
- package/dist/components/Highlight/Highlight.js.map +1 -0
- package/dist/components/Icon/Icon.d.ts +21 -0
- package/dist/components/Icon/Icon.js +31 -0
- package/dist/components/Icon/Icon.js.map +1 -0
- package/dist/components/IconButton/IconButton.d.ts +12 -0
- package/dist/components/IconButton/IconButton.js +49 -0
- package/dist/components/IconButton/IconButton.js.map +1 -0
- package/dist/components/Input/Input.d.ts +3 -2
- package/dist/components/Input/Input.js +51 -69
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Layout/Layout.d.ts +2 -0
- package/dist/components/Layout/Layout.js +24 -18
- package/dist/components/Layout/Layout.js.map +1 -1
- package/dist/components/Logo/Logo.d.ts +27 -0
- package/dist/components/Logo/Logo.js +107 -0
- package/dist/components/Logo/Logo.js.map +1 -0
- package/dist/components/MiniCard/MiniCard.d.ts +21 -0
- package/dist/components/MiniCard/MiniCard.js +90 -0
- package/dist/components/MiniCard/MiniCard.js.map +1 -0
- package/dist/components/Modal/Modal.d.ts +16 -3
- package/dist/components/Modal/Modal.js +124 -93
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Navigation/Navigation.d.ts +1 -0
- package/dist/components/Navigation/Navigation.js +14 -14
- package/dist/components/Navigation/Navigation.js.map +1 -1
- package/dist/components/NumberInput/NumberInput.d.ts +5 -2
- package/dist/components/NumberInput/NumberInput.js +98 -128
- package/dist/components/NumberInput/NumberInput.js.map +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts +8 -1
- package/dist/components/PageHeader/PageHeader.js +26 -25
- package/dist/components/PageHeader/PageHeader.js.map +1 -1
- package/dist/components/Pagination/Pagination.d.ts +15 -2
- package/dist/components/Pagination/Pagination.js +68 -34
- package/dist/components/Pagination/Pagination.js.map +1 -1
- package/dist/components/Paragraph/Paragraph.d.ts +8 -2
- package/dist/components/Paragraph/Paragraph.js +39 -36
- package/dist/components/Paragraph/Paragraph.js.map +1 -1
- package/dist/components/Popover/Popover.d.ts +12 -1
- package/dist/components/Popover/Popover.js +49 -37
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +12 -6
- package/dist/components/ProgressBar/ProgressBar.js +71 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
- package/dist/components/Radio/Radio.d.ts +2 -1
- package/dist/components/Radio/Radio.js +27 -31
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.d.ts +6 -1
- package/dist/components/SectionHeader/SectionHeader.js +14 -12
- package/dist/components/SectionHeader/SectionHeader.js.map +1 -1
- package/dist/components/Select/Select.d.ts +6 -2
- package/dist/components/Select/Select.js +47 -35
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/SideNav/SideNav.d.ts +55 -0
- package/dist/components/SideNav/SideNav.js +141 -0
- package/dist/components/SideNav/SideNav.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.d.ts +12 -1
- package/dist/components/Skeleton/Skeleton.js +33 -18
- package/dist/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/Spinner/Spinner.d.ts +11 -3
- package/dist/components/Spinner/Spinner.js +57 -0
- package/dist/components/Spinner/Spinner.js.map +1 -0
- package/dist/components/Stepper/Stepper.d.ts +1 -1
- package/dist/components/Stepper/Stepper.js +41 -53
- package/dist/components/Stepper/Stepper.js.map +1 -1
- package/dist/components/Subtitle/Subtitle.d.ts +9 -3
- package/dist/components/Subtitle/Subtitle.js +29 -35
- package/dist/components/Subtitle/Subtitle.js.map +1 -1
- package/dist/components/Switch/Switch.d.ts +2 -1
- package/dist/components/Switch/Switch.js +45 -33
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Table/Table.d.ts +19 -1
- package/dist/components/Table/Table.js +48 -11
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +16 -2
- package/dist/components/Tabs/Tabs.js +80 -44
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tag/Tag.d.ts +8 -1
- package/dist/components/Tag/Tag.js +27 -12
- package/dist/components/Tag/Tag.js.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts +3 -1
- package/dist/components/Textarea/Textarea.js +36 -40
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/Title/Title.d.ts +9 -3
- package/dist/components/Title/Title.js +42 -42
- package/dist/components/Title/Title.js.map +1 -1
- package/dist/components/Toast/Toast.d.ts +39 -11
- package/dist/components/Toast/Toast.js +130 -76
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +12 -2
- package/dist/components/Tooltip/Tooltip.js +50 -32
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Typography/weight.d.ts +9 -0
- package/dist/components/Typography/weight.js +5 -0
- package/dist/components/Typography/weight.js.map +1 -0
- package/dist/fonts.css +8 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +55 -43
- package/dist/index.js +118 -83
- package/dist/index.js.map +1 -1
- package/dist/reset.css +9 -0
- package/dist/styles.css +1 -0
- package/dist/tailwind.css +153 -0
- package/dist/theme/ThemeProvider.d.ts +21 -3
- package/dist/theme/ThemeProvider.js +57 -18
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/tokens.d.ts +43 -0
- package/dist/theme/tokens.js +39 -0
- package/dist/theme/tokens.js.map +1 -0
- package/dist/theme.css +327 -294
- package/dist/tokens.css +327 -0
- package/dist/utils/cn.d.ts +2 -2
- package/dist/utils/cn.js +19 -4
- package/dist/utils/cn.js.map +1 -1
- package/dist/utils/styles.d.ts +37 -0
- package/dist/utils/styles.js +35 -0
- package/dist/utils/styles.js.map +1 -0
- package/package.json +140 -117
- package/dist/components/Accordion/Accordion.stories.d.ts +0 -7
- package/dist/components/Alert/Alert.stories.d.ts +0 -8
- package/dist/components/Badge/Badge.stories.d.ts +0 -8
- package/dist/components/Breadcrumb/Breadcrumb.stories.d.ts +0 -8
- package/dist/components/Button/Button.stories.d.ts +0 -7
- package/dist/components/Card/Card.stories.d.ts +0 -8
- package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -7
- package/dist/components/Combobox/Combobox.stories.d.ts +0 -9
- package/dist/components/Feedback/Feedback.stories.d.ts +0 -5
- package/dist/components/FileUpload/FileUpload.stories.d.ts +0 -10
- package/dist/components/Input/Input.stories.d.ts +0 -9
- package/dist/components/Modal/Modal.stories.d.ts +0 -8
- package/dist/components/NumberInput/NumberInput.stories.d.ts +0 -8
- package/dist/components/Pagination/Pagination.stories.d.ts +0 -8
- package/dist/components/Radio/Radio.stories.d.ts +0 -7
- package/dist/components/Select/Select.stories.d.ts +0 -8
- package/dist/components/Stepper/Stepper.stories.d.ts +0 -8
- package/dist/components/Switch/Switch.stories.d.ts +0 -8
- package/dist/components/Tabs/Tabs.stories.d.ts +0 -8
- package/dist/components/Textarea/Textarea.stories.d.ts +0 -7
- package/dist/components/Toast/Toast.stories.d.ts +0 -8
- package/dist/oficios-ui.css +0 -1
- package/dist/oficios-ui.umd.cjs +0 -2
- package/dist/oficios-ui.umd.cjs.map +0 -1
- package/dist/sbk-icon.png +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import type React from 'react';\nimport { useEffect, useId, useRef, useState } from 'react';\nimport { cn } from '../../utils/cn';\n\nexport interface PopoverProps {\n children: React.ReactNode;\n content: React.ReactNode;\n defaultOpen?: boolean;\n}\n\nexport const Popover
|
|
1
|
+
{"version":3,"file":"Popover.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import type React from 'react';\r\nimport { useEffect, useId, useRef, useState } from 'react';\r\nimport { cn } from '../../utils/cn';\r\nimport { buttonReset } from '../../utils/styles';\r\n\r\nexport interface PopoverProps {\r\n align?: 'start' | 'center' | 'end';\r\n children: React.ReactNode;\r\n /** Classe do botão gatilho. */\r\n className?: string;\r\n content: React.ReactNode;\r\n defaultOpen?: boolean;\r\n /** Controle externo do estado aberto. */\r\n open?: boolean;\r\n onOpenChange?: (open: boolean) => void;\r\n variant?: 'default' | 'glass';\r\n}\r\n\r\nconst ALIGN = { start: 'left-0', center: 'left-1/2 -translate-x-1/2', end: 'right-0' } as const;\r\n\r\n/** Painel flutuante não modal ancorado a um gatilho. Fecha com Esc e clique fora. */\r\nexport const Popover = ({\r\n children,\r\n content,\r\n defaultOpen = false,\r\n open: controlledOpen,\r\n onOpenChange,\r\n align = 'center',\r\n variant = 'default',\r\n className,\r\n}: PopoverProps) => {\r\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);\r\n const open = controlledOpen ?? uncontrolledOpen;\r\n const containerRef = useRef<HTMLDivElement>(null);\r\n const triggerRef = useRef<HTMLButtonElement>(null);\r\n const panelRef = useRef<HTMLDivElement>(null);\r\n const popoverId = useId();\r\n\r\n const setOpen = (next: boolean) => {\r\n if (controlledOpen === undefined) setUncontrolledOpen(next);\r\n onOpenChange?.(next);\r\n };\r\n const setOpenRef = useRef(setOpen);\r\n setOpenRef.current = setOpen;\r\n\r\n useEffect(() => {\r\n if (!open) return;\r\n panelRef.current\r\n ?.querySelector<HTMLElement>(\r\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\r\n )\r\n ?.focus();\r\n\r\n const onClickOutside = (event: MouseEvent) => {\r\n if (!containerRef.current?.contains(event.target as Node)) setOpenRef.current(false);\r\n };\r\n const onKeyDown = (event: KeyboardEvent) => {\r\n if (event.key === 'Escape') {\r\n setOpenRef.current(false);\r\n triggerRef.current?.focus();\r\n }\r\n };\r\n document.addEventListener('mousedown', onClickOutside);\r\n document.addEventListener('keydown', onKeyDown);\r\n return () => {\r\n document.removeEventListener('mousedown', onClickOutside);\r\n document.removeEventListener('keydown', onKeyDown);\r\n };\r\n }, [open]);\r\n\r\n return (\r\n <div ref={containerRef} className=\"relative inline-flex\">\r\n <button\r\n ref={triggerRef}\r\n aria-controls={open ? popoverId : undefined}\r\n aria-expanded={open}\r\n aria-haspopup=\"dialog\"\r\n className={cn(buttonReset, 'inline-flex cursor-pointer', className)}\r\n onClick={() => setOpen(!open)}\r\n type=\"button\"\r\n >\r\n {children}\r\n </button>\r\n {open && (\r\n <div\r\n ref={panelRef}\r\n className={cn(\r\n 'absolute top-full z-[var(--sbk-z-dropdown)] mt-2 w-max max-w-sm rounded-sbk-md p-4 text-sm font-light text-sbk-fg animate-sbk-fade-in',\r\n variant === 'glass'\r\n ? 'sbk-glass sbk-glass-strong'\r\n : 'border border-sbk-line bg-sbk-surface shadow-sbk-md',\r\n ALIGN[align],\r\n )}\r\n id={popoverId}\r\n role=\"dialog\"\r\n tabIndex={-1}\r\n >\r\n {content}\r\n </div>\r\n )}\r\n </div>\r\n );\r\n};\r\n\r\nPopover.displayName = 'Popover';\r\n"],"names":["ALIGN","Popover","children","content","defaultOpen","controlledOpen","onOpenChange","align","variant","className","uncontrolledOpen","setUncontrolledOpen","useState","open","containerRef","useRef","triggerRef","panelRef","popoverId","useId","setOpen","next","setOpenRef","useEffect","_b","_a","onClickOutside","event","onKeyDown","jsxs","jsx","cn","buttonReset"],"mappings":";;;;AAkBA,MAAMA,IAAQ,EAAE,OAAO,UAAU,QAAQ,6BAA6B,KAAK,UAAA,GAG9DC,IAAU,CAAC;AAAA,EACtB,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,MAAMC;AAAA,EACN,cAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,SAAAC,IAAU;AAAA,EACV,WAAAC;AACF,MAAoB;AAClB,QAAM,CAACC,GAAkBC,CAAmB,IAAIC,EAASR,CAAW,GAC9DS,IAAOR,KAAkBK,GACzBI,IAAeC,EAAuB,IAAI,GAC1CC,IAAaD,EAA0B,IAAI,GAC3CE,IAAWF,EAAuB,IAAI,GACtCG,IAAYC,EAAA,GAEZC,IAAU,CAACC,MAAkB;AACjC,IAAIhB,MAAmB,UAAWM,EAAoBU,CAAI,GAC1Df,KAAA,QAAAA,EAAee;AAAA,EACjB,GACMC,IAAaP,EAAOK,CAAO;AACjC,SAAAE,EAAW,UAAUF,GAErBG,EAAU,MAAM;;AACd,QAAI,CAACV,EAAM;AACX,KAAAW,KAAAC,IAAAR,EAAS,YAAT,gBAAAQ,EACI;AAAA,MACA;AAAA,UAFJ,QAAAD,EAII;AAEJ,UAAME,IAAiB,CAACC,MAAsB;;AAC5C,OAAKF,IAAAX,EAAa,YAAb,QAAAW,EAAsB,SAASE,EAAM,WAAiBL,EAAW,QAAQ,EAAK;AAAA,IACrF,GACMM,IAAY,CAACD,MAAyB;;AAC1C,MAAIA,EAAM,QAAQ,aAChBL,EAAW,QAAQ,EAAK,IACxBG,IAAAT,EAAW,YAAX,QAAAS,EAAoB;AAAA,IAExB;AACA,oBAAS,iBAAiB,aAAaC,CAAc,GACrD,SAAS,iBAAiB,WAAWE,CAAS,GACvC,MAAM;AACX,eAAS,oBAAoB,aAAaF,CAAc,GACxD,SAAS,oBAAoB,WAAWE,CAAS;AAAA,IACnD;AAAA,EACF,GAAG,CAACf,CAAI,CAAC,GAGP,gBAAAgB,EAAC,OAAA,EAAI,KAAKf,GAAc,WAAU,wBAChC,UAAA;AAAA,IAAA,gBAAAgB;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKd;AAAA,QACL,iBAAeH,IAAOK,IAAY;AAAA,QAClC,iBAAeL;AAAA,QACf,iBAAc;AAAA,QACd,WAAWkB,EAAGC,GAAa,8BAA8BvB,CAAS;AAAA,QAClE,SAAS,MAAMW,EAAQ,CAACP,CAAI;AAAA,QAC5B,MAAK;AAAA,QAEJ,UAAAX;AAAA,MAAA;AAAA,IAAA;AAAA,IAEFW,KACC,gBAAAiB;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKb;AAAA,QACL,WAAWc;AAAA,UACT;AAAA,UACAvB,MAAY,UACR,+BACA;AAAA,UACJR,EAAMO,CAAK;AAAA,QAAA;AAAA,QAEb,IAAIW;AAAA,QACJ,MAAK;AAAA,QACL,UAAU;AAAA,QAET,UAAAf;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GAEJ;AAEJ;AAEAF,EAAQ,cAAc;"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
export interface ProgressBarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
/**
|
|
3
|
+
/** Barra animada sem valor conhecido (carregamento em andamento). */
|
|
4
|
+
indeterminate?: boolean;
|
|
5
|
+
/** Label acessível. Obrigatório quando não houver texto visível associado. */
|
|
4
6
|
label?: string;
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
+
/** Exibe o percentual ao lado da barra. */
|
|
8
|
+
showValue?: boolean;
|
|
7
9
|
size?: 'sm' | 'md' | 'lg';
|
|
8
10
|
tone?: 'primary' | 'success' | 'warning' | 'error' | 'info';
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
+
/** Valor atual (0 a 100). Ignorado quando `indeterminate`. */
|
|
12
|
+
value?: number;
|
|
11
13
|
}
|
|
12
|
-
|
|
14
|
+
/** Barra de progresso determinada ou indeterminada ("bar load"). */
|
|
15
|
+
export declare const ProgressBar: {
|
|
16
|
+
({ value, indeterminate, size, tone, label, showValue, className, ...props }: ProgressBarProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { cn as r } from "../../utils/cn.js";
|
|
3
|
+
const b = { sm: "h-1", md: "h-2", lg: "h-3" }, l = {
|
|
4
|
+
primary: "bg-sbk-primary",
|
|
5
|
+
success: "bg-sbk-success",
|
|
6
|
+
warning: "bg-sbk-warning",
|
|
7
|
+
error: "bg-sbk-error",
|
|
8
|
+
info: "bg-sbk-info"
|
|
9
|
+
}, f = ({
|
|
10
|
+
value: n = 0,
|
|
11
|
+
indeterminate: s = !1,
|
|
12
|
+
size: t = "md",
|
|
13
|
+
tone: i = "primary",
|
|
14
|
+
label: d,
|
|
15
|
+
showValue: m = !1,
|
|
16
|
+
className: u,
|
|
17
|
+
...c
|
|
18
|
+
}) => {
|
|
19
|
+
const a = Math.min(100, Math.max(0, n));
|
|
20
|
+
return /* @__PURE__ */ o("div", { className: r("flex items-center gap-2", u), ...c, children: [
|
|
21
|
+
/* @__PURE__ */ e(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
"aria-busy": s || void 0,
|
|
25
|
+
"aria-label": d,
|
|
26
|
+
"aria-valuemax": s ? void 0 : 100,
|
|
27
|
+
"aria-valuemin": s ? void 0 : 0,
|
|
28
|
+
"aria-valuenow": s ? void 0 : a,
|
|
29
|
+
className: r(
|
|
30
|
+
"relative flex-1 overflow-hidden rounded-full bg-sbk-surface-sunken",
|
|
31
|
+
b[t]
|
|
32
|
+
),
|
|
33
|
+
role: "progressbar",
|
|
34
|
+
children: s ? /* @__PURE__ */ e(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: r(
|
|
38
|
+
"absolute inset-y-0 left-0 w-2/5 rounded-full animate-sbk-indeterminate motion-reduce:w-full motion-reduce:animate-pulse",
|
|
39
|
+
l[i]
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
) : /* @__PURE__ */ e(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
className: r(
|
|
46
|
+
"h-full rounded-full transition-[width] duration-300 motion-reduce:transition-none",
|
|
47
|
+
l[i]
|
|
48
|
+
),
|
|
49
|
+
style: { width: `${a}%` }
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
m && !s && /* @__PURE__ */ o(
|
|
55
|
+
"span",
|
|
56
|
+
{
|
|
57
|
+
"aria-hidden": "true",
|
|
58
|
+
className: "w-10 shrink-0 text-right text-xs font-semibold text-sbk-fg-muted",
|
|
59
|
+
children: [
|
|
60
|
+
a,
|
|
61
|
+
"%"
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
] });
|
|
66
|
+
};
|
|
67
|
+
f.displayName = "ProgressBar";
|
|
68
|
+
export {
|
|
69
|
+
f as ProgressBar
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=ProgressBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","sources":["../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import type React from 'react';\r\nimport { cn } from '../../utils/cn';\r\n\r\nexport interface ProgressBarProps extends React.HTMLAttributes<HTMLDivElement> {\r\n /** Barra animada sem valor conhecido (carregamento em andamento). */\r\n indeterminate?: boolean;\r\n /** Label acessível. Obrigatório quando não houver texto visível associado. */\r\n label?: string;\r\n /** Exibe o percentual ao lado da barra. */\r\n showValue?: boolean;\r\n size?: 'sm' | 'md' | 'lg';\r\n tone?: 'primary' | 'success' | 'warning' | 'error' | 'info';\r\n /** Valor atual (0 a 100). Ignorado quando `indeterminate`. */\r\n value?: number;\r\n}\r\n\r\nconst SIZE_CLASS = { sm: 'h-1', md: 'h-2', lg: 'h-3' } as const;\r\n\r\nconst TONE_CLASS: Record<NonNullable<ProgressBarProps['tone']>, string> = {\r\n primary: 'bg-sbk-primary',\r\n success: 'bg-sbk-success',\r\n warning: 'bg-sbk-warning',\r\n error: 'bg-sbk-error',\r\n info: 'bg-sbk-info',\r\n};\r\n\r\n/** Barra de progresso determinada ou indeterminada (\"bar load\"). */\r\nexport const ProgressBar = ({\r\n value = 0,\r\n indeterminate = false,\r\n size = 'md',\r\n tone = 'primary',\r\n label,\r\n showValue = false,\r\n className,\r\n ...props\r\n}: ProgressBarProps) => {\r\n const clamped = Math.min(100, Math.max(0, value));\r\n\r\n return (\r\n <div className={cn('flex items-center gap-2', className)} {...props}>\r\n <div\r\n aria-busy={indeterminate || undefined}\r\n aria-label={label}\r\n aria-valuemax={indeterminate ? undefined : 100}\r\n aria-valuemin={indeterminate ? undefined : 0}\r\n aria-valuenow={indeterminate ? undefined : clamped}\r\n className={cn(\r\n 'relative flex-1 overflow-hidden rounded-full bg-sbk-surface-sunken',\r\n SIZE_CLASS[size],\r\n )}\r\n role=\"progressbar\"\r\n >\r\n {indeterminate ? (\r\n <div\r\n className={cn(\r\n 'absolute inset-y-0 left-0 w-2/5 rounded-full animate-sbk-indeterminate motion-reduce:w-full motion-reduce:animate-pulse',\r\n TONE_CLASS[tone],\r\n )}\r\n />\r\n ) : (\r\n <div\r\n className={cn(\r\n 'h-full rounded-full transition-[width] duration-300 motion-reduce:transition-none',\r\n TONE_CLASS[tone],\r\n )}\r\n style={{ width: `${clamped}%` }}\r\n />\r\n )}\r\n </div>\r\n {showValue && !indeterminate && (\r\n <span\r\n aria-hidden=\"true\"\r\n className=\"w-10 shrink-0 text-right text-xs font-semibold text-sbk-fg-muted\"\r\n >\r\n {clamped}%\r\n </span>\r\n )}\r\n </div>\r\n );\r\n};\r\n\r\nProgressBar.displayName = 'ProgressBar';\r\n"],"names":["SIZE_CLASS","TONE_CLASS","ProgressBar","value","indeterminate","size","tone","label","showValue","className","props","clamped","jsxs","cn","jsx"],"mappings":";;AAgBA,MAAMA,IAAa,EAAE,IAAI,OAAO,IAAI,OAAO,IAAI,MAAA,GAEzCC,IAAoE;AAAA,EACxE,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AACR,GAGaC,IAAc,CAAC;AAAA,EAC1B,OAAAC,IAAQ;AAAA,EACR,eAAAC,IAAgB;AAAA,EAChB,MAAAC,IAAO;AAAA,EACP,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,WAAAC;AAAA,EACA,GAAGC;AACL,MAAwB;AACtB,QAAMC,IAAU,KAAK,IAAI,KAAK,KAAK,IAAI,GAAGR,CAAK,CAAC;AAEhD,SACE,gBAAAS,EAAC,SAAI,WAAWC,EAAG,2BAA2BJ,CAAS,GAAI,GAAGC,GAC5D,UAAA;AAAA,IAAA,gBAAAI;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,aAAWV,KAAiB;AAAA,QAC5B,cAAYG;AAAA,QACZ,iBAAeH,IAAgB,SAAY;AAAA,QAC3C,iBAAeA,IAAgB,SAAY;AAAA,QAC3C,iBAAeA,IAAgB,SAAYO;AAAA,QAC3C,WAAWE;AAAA,UACT;AAAA,UACAb,EAAWK,CAAI;AAAA,QAAA;AAAA,QAEjB,MAAK;AAAA,QAEJ,UAAAD,IACC,gBAAAU;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWD;AAAA,cACT;AAAA,cACAZ,EAAWK,CAAI;AAAA,YAAA;AAAA,UACjB;AAAA,QAAA,IAGF,gBAAAQ;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWD;AAAA,cACT;AAAA,cACAZ,EAAWK,CAAI;AAAA,YAAA;AAAA,YAEjB,OAAO,EAAE,OAAO,GAAGK,CAAO,IAAA;AAAA,UAAI;AAAA,QAAA;AAAA,MAChC;AAAA,IAAA;AAAA,IAGHH,KAAa,CAACJ,KACb,gBAAAQ;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,eAAY;AAAA,QACZ,WAAU;AAAA,QAET,UAAA;AAAA,UAAAD;AAAA,UAAQ;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACX,GAEJ;AAEJ;AAEAT,EAAY,cAAc;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
3
3
|
helperText?: string;
|
|
4
|
-
label?:
|
|
4
|
+
label?: React.ReactNode;
|
|
5
5
|
}
|
|
6
|
+
/** Radio individual. Agrupe com <fieldset> + <legend> e o mesmo `name`. */
|
|
6
7
|
export declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,36 +1,32 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { cn as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
] })
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
);
|
|
1
|
+
import { jsxs as e, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import p, { useId as f } from "react";
|
|
3
|
+
import { cn as a } from "../../utils/cn.js";
|
|
4
|
+
import { choiceControl as u } from "../../utils/styles.js";
|
|
5
|
+
const h = p.forwardRef(
|
|
6
|
+
({ label: r, helperText: i, className: d, id: n, disabled: s, ...c }, m) => {
|
|
7
|
+
const l = f(), t = n ?? l;
|
|
8
|
+
return /* @__PURE__ */ e("div", { className: a("inline-flex items-start gap-2", s && "opacity-60", d), children: [
|
|
9
|
+
/* @__PURE__ */ o(
|
|
10
|
+
"input",
|
|
11
|
+
{
|
|
12
|
+
ref: m,
|
|
13
|
+
"aria-describedby": i ? `${t}-helper` : void 0,
|
|
14
|
+
className: a(u, "rounded-full"),
|
|
15
|
+
disabled: s,
|
|
16
|
+
id: t,
|
|
17
|
+
type: "radio",
|
|
18
|
+
...c
|
|
19
|
+
}
|
|
20
|
+
),
|
|
21
|
+
/* @__PURE__ */ e("span", { className: "grid gap-0.5", children: [
|
|
22
|
+
r && /* @__PURE__ */ o("label", { className: "cursor-pointer text-sm font-light text-sbk-fg", htmlFor: t, children: r }),
|
|
23
|
+
i && /* @__PURE__ */ o("span", { className: "text-xs font-light text-sbk-fg-muted", id: `${t}-helper`, children: i })
|
|
24
|
+
] })
|
|
25
|
+
] });
|
|
30
26
|
}
|
|
31
27
|
);
|
|
32
|
-
|
|
28
|
+
h.displayName = "Radio";
|
|
33
29
|
export {
|
|
34
|
-
|
|
30
|
+
h as Radio
|
|
35
31
|
};
|
|
36
32
|
//# sourceMappingURL=Radio.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","sources":["../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {\n helperText?: string;\n label?:
|
|
1
|
+
{"version":3,"file":"Radio.js","sources":["../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import React, { useId } from 'react';\r\nimport { cn } from '../../utils/cn';\r\nimport { choiceControl } from '../../utils/styles';\r\n\r\nexport interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {\r\n helperText?: string;\r\n label?: React.ReactNode;\r\n}\r\n\r\n/** Radio individual. Agrupe com <fieldset> + <legend> e o mesmo `name`. */\r\nexport const Radio = React.forwardRef<HTMLInputElement, RadioProps>(\r\n ({ label, helperText, className, id, disabled, ...props }, ref) => {\r\n const autoId = useId();\r\n const inputId = id ?? autoId;\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={ref}\r\n aria-describedby={helperText ? `${inputId}-helper` : undefined}\r\n className={cn(choiceControl, 'rounded-full')}\r\n disabled={disabled}\r\n id={inputId}\r\n type=\"radio\"\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 {helperText && (\r\n <span className=\"text-xs font-light text-sbk-fg-muted\" id={`${inputId}-helper`}>\r\n {helperText}\r\n </span>\r\n )}\r\n </span>\r\n </div>\r\n );\r\n },\r\n);\r\n\r\nRadio.displayName = 'Radio';\r\n"],"names":["Radio","React","label","helperText","className","id","disabled","props","ref","autoId","useId","inputId","jsxs","cn","jsx","choiceControl"],"mappings":";;;;AAUO,MAAMA,IAAQC,EAAM;AAAA,EACzB,CAAC,EAAE,OAAAC,GAAO,YAAAC,GAAY,WAAAC,GAAW,IAAAC,GAAI,UAAAC,GAAU,GAAGC,EAAA,GAASC,MAAQ;AACjE,UAAMC,IAASC,EAAA,GACTC,IAAUN,KAAMI;AAEtB,WACE,gBAAAG,EAAC,SAAI,WAAWC,EAAG,iCAAiCP,KAAY,cAAcF,CAAS,GACrF,UAAA;AAAA,MAAA,gBAAAU;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,KAAAN;AAAA,UACA,oBAAkBL,IAAa,GAAGQ,CAAO,YAAY;AAAA,UACrD,WAAWE,EAAGE,GAAe,cAAc;AAAA,UAC3C,UAAAT;AAAA,UACA,IAAIK;AAAA,UACJ,MAAK;AAAA,UACJ,GAAGJ;AAAA,QAAA;AAAA,MAAA;AAAA,MAEN,gBAAAK,EAAC,QAAA,EAAK,WAAU,gBACb,UAAA;AAAA,QAAAV,uBACE,SAAA,EAAM,WAAU,iDAAgD,SAASS,GACvE,UAAAT,GACH;AAAA,QAEDC,uBACE,QAAA,EAAK,WAAU,wCAAuC,IAAI,GAAGQ,CAAO,WAClE,UAAAR,EAAA,CACH;AAAA,MAAA,EAAA,CAEJ;AAAA,IAAA,GACF;AAAA,EAEJ;AACF;AAEAH,EAAM,cAAc;"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
export interface SectionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
3
3
|
actions?: React.ReactNode;
|
|
4
|
+
/** Nível do título. Padrão: h2. */
|
|
5
|
+
as?: 'h2' | 'h3' | 'h4';
|
|
4
6
|
subtitle?: React.ReactNode;
|
|
5
7
|
title: React.ReactNode;
|
|
6
8
|
}
|
|
7
|
-
export declare const SectionHeader:
|
|
9
|
+
export declare const SectionHeader: {
|
|
10
|
+
({ title, subtitle, actions, as: Tag, className, ...props }: SectionHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cn as
|
|
3
|
-
const
|
|
1
|
+
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { cn as d } from "../../utils/cn.js";
|
|
3
|
+
const n = ({
|
|
4
4
|
title: a,
|
|
5
5
|
subtitle: t,
|
|
6
|
-
actions:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
actions: s,
|
|
7
|
+
as: m = "h2",
|
|
8
|
+
className: l,
|
|
9
|
+
...r
|
|
10
|
+
}) => /* @__PURE__ */ i("div", { className: d("flex flex-wrap items-start justify-between gap-4", l), ...r, children: [
|
|
11
|
+
/* @__PURE__ */ i("div", { className: "grid min-w-0 gap-1", children: [
|
|
12
|
+
/* @__PURE__ */ e(m, { className: "m-0 text-xl font-semibold leading-tight text-sbk-fg-heading", children: a }),
|
|
13
|
+
t && /* @__PURE__ */ e("p", { className: "m-0 text-sm font-light text-sbk-fg-muted", children: t })
|
|
13
14
|
] }),
|
|
14
|
-
|
|
15
|
+
s && /* @__PURE__ */ e("div", { className: "flex shrink-0 items-center gap-2", children: s })
|
|
15
16
|
] });
|
|
17
|
+
n.displayName = "SectionHeader";
|
|
16
18
|
export {
|
|
17
|
-
|
|
19
|
+
n as SectionHeader
|
|
18
20
|
};
|
|
19
21
|
//# sourceMappingURL=SectionHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionHeader.js","sources":["../../../src/components/SectionHeader/SectionHeader.tsx"],"sourcesContent":["import type React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport interface SectionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n actions?: React.ReactNode;\n subtitle?: React.ReactNode;\n title: React.ReactNode;\n}\n\nexport const SectionHeader
|
|
1
|
+
{"version":3,"file":"SectionHeader.js","sources":["../../../src/components/SectionHeader/SectionHeader.tsx"],"sourcesContent":["import type React from 'react';\r\nimport { cn } from '../../utils/cn';\r\n\r\nexport interface SectionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\r\n actions?: React.ReactNode;\r\n /** Nível do título. Padrão: h2. */\r\n as?: 'h2' | 'h3' | 'h4';\r\n subtitle?: React.ReactNode;\r\n title: React.ReactNode;\r\n}\r\n\r\nexport const SectionHeader = ({\r\n title,\r\n subtitle,\r\n actions,\r\n as: Tag = 'h2',\r\n className,\r\n ...props\r\n}: SectionHeaderProps) => (\r\n <div className={cn('flex flex-wrap items-start justify-between gap-4', className)} {...props}>\r\n <div className=\"grid min-w-0 gap-1\">\r\n <Tag className=\"m-0 text-xl font-semibold leading-tight text-sbk-fg-heading\">{title}</Tag>\r\n {subtitle && <p className=\"m-0 text-sm font-light text-sbk-fg-muted\">{subtitle}</p>}\r\n </div>\r\n {actions && <div className=\"flex shrink-0 items-center gap-2\">{actions}</div>}\r\n </div>\r\n);\r\n\r\nSectionHeader.displayName = 'SectionHeader';\r\n"],"names":["SectionHeader","title","subtitle","actions","Tag","className","props","jsxs","cn","jsx"],"mappings":";;AAWO,MAAMA,IAAgB,CAAC;AAAA,EAC5B,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,IAAIC,IAAM;AAAA,EACV,WAAAC;AAAA,EACA,GAAGC;AACL,MACE,gBAAAC,EAAC,SAAI,WAAWC,EAAG,oDAAoDH,CAAS,GAAI,GAAGC,GACrF,UAAA;AAAA,EAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,sBACb,UAAA;AAAA,IAAA,gBAAAE,EAACL,GAAA,EAAI,WAAU,+DAA+D,UAAAH,GAAM;AAAA,IACnFC,KAAY,gBAAAO,EAAC,KAAA,EAAE,WAAU,4CAA4C,UAAAP,EAAA,CAAS;AAAA,EAAA,GACjF;AAAA,EACCC,KAAW,gBAAAM,EAAC,OAAA,EAAI,WAAU,oCAAoC,UAAAN,EAAA,CAAQ;AAAA,EAAA,CACzE;AAGFH,EAAc,cAAc;"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type FieldSize } from '../../utils/styles';
|
|
2
3
|
export interface SelectOption {
|
|
4
|
+
disabled?: boolean;
|
|
3
5
|
label: string;
|
|
4
6
|
value: string;
|
|
5
7
|
}
|
|
6
8
|
export interface SelectProps extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
7
9
|
error?: string;
|
|
8
10
|
helperText?: string;
|
|
9
|
-
label?:
|
|
11
|
+
label?: React.ReactNode;
|
|
10
12
|
options: SelectOption[];
|
|
11
|
-
|
|
13
|
+
/** Opção vazia inicial (ex.: "Selecione..."). */
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
size?: FieldSize;
|
|
12
16
|
}
|
|
13
17
|
export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
@@ -1,45 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { jsx as i, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import b, { useId as h } from "react";
|
|
3
|
+
import { ChevronDown as y } from "lucide-react";
|
|
4
|
+
import { cn as N } from "../../utils/cn.js";
|
|
5
|
+
import { describedBy as x, fieldSize as I, fieldControl as S } from "../../utils/styles.js";
|
|
6
|
+
import { Field as g } from "../Field/Field.js";
|
|
7
|
+
const j = b.forwardRef(
|
|
8
|
+
({
|
|
9
|
+
label: o,
|
|
10
|
+
helperText: t,
|
|
11
|
+
error: a,
|
|
12
|
+
options: n,
|
|
13
|
+
placeholder: d,
|
|
14
|
+
size: c = "md",
|
|
15
|
+
className: m,
|
|
16
|
+
id: p,
|
|
17
|
+
required: l,
|
|
18
|
+
...u
|
|
19
|
+
}, f) => {
|
|
20
|
+
const v = h(), r = p ?? v;
|
|
21
|
+
return /* @__PURE__ */ i(g, { error: a, helperText: t, id: r, label: o, required: l, children: /* @__PURE__ */ s("div", { className: "relative", children: [
|
|
22
|
+
/* @__PURE__ */ s(
|
|
21
23
|
"select",
|
|
22
24
|
{
|
|
23
|
-
ref:
|
|
24
|
-
"aria-describedby": r
|
|
25
|
-
"aria-invalid":
|
|
26
|
-
className:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
ref: f,
|
|
26
|
+
"aria-describedby": x(r, a, t),
|
|
27
|
+
"aria-invalid": a ? !0 : void 0,
|
|
28
|
+
className: N(
|
|
29
|
+
S,
|
|
30
|
+
I[c],
|
|
31
|
+
"cursor-pointer appearance-none pr-10",
|
|
32
|
+
m
|
|
31
33
|
),
|
|
32
|
-
id:
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
id: r,
|
|
35
|
+
required: l,
|
|
36
|
+
...u,
|
|
37
|
+
children: [
|
|
38
|
+
d && /* @__PURE__ */ i("option", { disabled: !0, value: "", children: d }),
|
|
39
|
+
n.map((e) => /* @__PURE__ */ i("option", { disabled: e.disabled, value: e.value, children: e.label }, e.value))
|
|
40
|
+
]
|
|
35
41
|
}
|
|
36
42
|
),
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
/* @__PURE__ */ i(
|
|
44
|
+
y,
|
|
45
|
+
{
|
|
46
|
+
"aria-hidden": "true",
|
|
47
|
+
className: "pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 text-sbk-fg-muted"
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] }) });
|
|
39
51
|
}
|
|
40
52
|
);
|
|
41
|
-
|
|
53
|
+
j.displayName = "Select";
|
|
42
54
|
export {
|
|
43
|
-
|
|
55
|
+
j as Select
|
|
44
56
|
};
|
|
45
57
|
//# sourceMappingURL=Select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport interface SelectOption {\n label: string;\n value: string;\n}\n\nexport interface SelectProps extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'size'> {\n error?: string;\n helperText?: string;\n label?:
|
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import React, { useId } from 'react';\r\nimport { ChevronDown } from 'lucide-react';\r\nimport { cn } from '../../utils/cn';\r\nimport { describedBy, fieldControl, fieldSize, type FieldSize } from '../../utils/styles';\r\nimport { Field } from '../Field/Field';\r\n\r\nexport interface SelectOption {\r\n disabled?: boolean;\r\n label: string;\r\n value: string;\r\n}\r\n\r\nexport interface SelectProps extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'size'> {\r\n error?: string;\r\n helperText?: string;\r\n label?: React.ReactNode;\r\n options: SelectOption[];\r\n /** Opção vazia inicial (ex.: \"Selecione...\"). */\r\n placeholder?: string;\r\n size?: FieldSize;\r\n}\r\n\r\nexport const Select = React.forwardRef<HTMLSelectElement, SelectProps>(\r\n (\r\n {\r\n label,\r\n helperText,\r\n error,\r\n options,\r\n placeholder,\r\n size = 'md',\r\n className,\r\n id,\r\n required,\r\n ...props\r\n },\r\n ref,\r\n ) => {\r\n const autoId = useId();\r\n const selectId = id ?? autoId;\r\n\r\n return (\r\n <Field error={error} helperText={helperText} id={selectId} label={label} required={required}>\r\n <div className=\"relative\">\r\n <select\r\n ref={ref}\r\n aria-describedby={describedBy(selectId, error, helperText)}\r\n aria-invalid={error ? true : undefined}\r\n className={cn(\r\n fieldControl,\r\n fieldSize[size],\r\n 'cursor-pointer appearance-none pr-10',\r\n className,\r\n )}\r\n id={selectId}\r\n required={required}\r\n {...props}\r\n >\r\n {placeholder && (\r\n <option disabled value=\"\">\r\n {placeholder}\r\n </option>\r\n )}\r\n {options.map((option) => (\r\n <option key={option.value} disabled={option.disabled} value={option.value}>\r\n {option.label}\r\n </option>\r\n ))}\r\n </select>\r\n <ChevronDown\r\n aria-hidden=\"true\"\r\n className=\"pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 text-sbk-fg-muted\"\r\n />\r\n </div>\r\n </Field>\r\n );\r\n },\r\n);\r\n\r\nSelect.displayName = 'Select';\r\n"],"names":["Select","React","label","helperText","error","options","placeholder","size","className","id","required","props","ref","autoId","useId","selectId","jsx","Field","jsxs","describedBy","cn","fieldControl","fieldSize","option","ChevronDown"],"mappings":";;;;;;AAsBO,MAAMA,IAASC,EAAM;AAAA,EAC1B,CACE;AAAA,IACE,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,OAAAC;AAAA,IACA,SAAAC;AAAA,IACA,aAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,WAAAC;AAAA,IACA,IAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAMC,IAASC,EAAA,GACTC,IAAWN,KAAMI;AAEvB,WACE,gBAAAG,EAACC,GAAA,EAAM,OAAAb,GAAc,YAAAD,GAAwB,IAAIY,GAAU,OAAAb,GAAc,UAAAQ,GACvE,UAAA,gBAAAQ,EAAC,OAAA,EAAI,WAAU,YACb,UAAA;AAAA,MAAA,gBAAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,KAAAN;AAAA,UACA,oBAAkBO,EAAYJ,GAAUX,GAAOD,CAAU;AAAA,UACzD,gBAAcC,IAAQ,KAAO;AAAA,UAC7B,WAAWgB;AAAA,YACTC;AAAA,YACAC,EAAUf,CAAI;AAAA,YACd;AAAA,YACAC;AAAA,UAAA;AAAA,UAEF,IAAIO;AAAA,UACJ,UAAAL;AAAA,UACC,GAAGC;AAAA,UAEH,UAAA;AAAA,YAAAL,uBACE,UAAA,EAAO,UAAQ,IAAC,OAAM,IACpB,UAAAA,GACH;AAAA,YAEDD,EAAQ,IAAI,CAACkB,MACZ,gBAAAP,EAAC,YAA0B,UAAUO,EAAO,UAAU,OAAOA,EAAO,OACjE,UAAAA,EAAO,MAAA,GADGA,EAAO,KAEpB,CACD;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,MAEH,gBAAAP;AAAA,QAACQ;AAAA,QAAA;AAAA,UACC,eAAY;AAAA,UACZ,WAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IACZ,EAAA,CACF,EAAA,CACF;AAAA,EAEJ;AACF;AAEAxB,EAAO,cAAc;"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export interface SideNavItem {
|
|
3
|
+
/** Contador ou etiqueta à direita (ex.: pendências). */
|
|
4
|
+
badge?: React.ReactNode;
|
|
5
|
+
/** Subitens: o item vira um grupo expansível. */
|
|
6
|
+
children?: SideNavItem[];
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
href?: string;
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
}
|
|
14
|
+
export interface SideNavSection {
|
|
15
|
+
id: string;
|
|
16
|
+
items: SideNavItem[];
|
|
17
|
+
/** Título da seção (ex.: "Cadastros"). */
|
|
18
|
+
title?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface SideNavLinkRenderProps {
|
|
21
|
+
'aria-current'?: 'page';
|
|
22
|
+
children: React.ReactNode;
|
|
23
|
+
className: string;
|
|
24
|
+
href: string;
|
|
25
|
+
onClick?: () => void;
|
|
26
|
+
title?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface SideNavProps {
|
|
29
|
+
/** Item ativo (recebe aria-current="page"). */
|
|
30
|
+
activeId?: string;
|
|
31
|
+
'aria-label'?: string;
|
|
32
|
+
className?: string;
|
|
33
|
+
/** Modo compacto: somente ícones, com o label disponível como tooltip nativo e para leitores de tela. */
|
|
34
|
+
collapsed?: boolean;
|
|
35
|
+
/** Grupos abertos inicialmente. Por padrão, abre o grupo que contém o item ativo. */
|
|
36
|
+
defaultOpenIds?: string[];
|
|
37
|
+
footer?: React.ReactNode;
|
|
38
|
+
header?: React.ReactNode;
|
|
39
|
+
/** Itens simples, ou `sections` para agrupar com títulos. */
|
|
40
|
+
items?: SideNavItem[];
|
|
41
|
+
onNavigate?: (item: SideNavItem) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Renderização customizada de links (integração com React Router, Next.js etc.).
|
|
44
|
+
* Ex.: `renderLink={({ href, ...p }) => <NavLink to={href} {...p} />}`
|
|
45
|
+
*/
|
|
46
|
+
renderLink?: (props: SideNavLinkRenderProps) => React.ReactNode;
|
|
47
|
+
sections?: SideNavSection[];
|
|
48
|
+
/** `light`: superfície clara. `dark`: verde escuro. `glass`: Liquid Glass. */
|
|
49
|
+
variant?: 'light' | 'dark' | 'glass';
|
|
50
|
+
}
|
|
51
|
+
/** Menu de navegação lateral (Navigator): seções, grupos expansíveis, ícones, badges e modo compacto. */
|
|
52
|
+
export declare const SideNav: {
|
|
53
|
+
({ items, sections, activeId, collapsed, defaultOpenIds, onNavigate, renderLink, header, footer, variant, className, "aria-label": ariaLabel, }: SideNavProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
displayName: string;
|
|
55
|
+
};
|