@apipass/design-system 7.0.0 → 7.2.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.
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.js","sources":["../../../../../src/ui/components/DataTable/DataTable.tsx"],"sourcesContent":["import {\n Pagination,\n PermissionGate,\n Search,\n Table,\n TableBody,\n TableCell,\n TableColumn,\n TableHead,\n TableRow,\n} from \"primitives\";\nimport { Flex } from \"layout\";\nimport { IconChevronDown, IconChevronRight } from \"icons\";\nimport type { ReactNode } from \"react\";\nimport { useMemo, useState } from \"react\";\nimport type { Selection, SortDescriptor } from \"react-aria-components\";\nimport \"./datatable.css\";\n\nexport interface Column<T> {\n key: keyof T | string;\n label: string;\n align?: \"start\" | \"center\" | \"right\";\n render?: (item: T) => ReactNode;\n /** When true, the header becomes clickable and the rows can be sorted by this column. */\n sortable?: boolean;\n /** Value used to sort this column. Defaults to `item[key]`. */\n sortValue?: (item: T) => SortableValue;\n}\n\ntype SortableValue = string | number | Date | null | undefined;\n\nconst sortCollator = new Intl.Collator(undefined, { numeric: true, sensitivity: \"base\" });\n\nfunction compareSortableValues(a: SortableValue, b: SortableValue): number {\n if (a == null || b == null) return a == null ? (b == null ? 0 : 1) : -1;\n if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();\n if (typeof a === \"number\" && typeof b === \"number\") return a - b;\n return sortCollator.compare(String(a), String(b));\n}\n\nfunction sortRows<T>(rows: T[], column: Column<T>, direction: SortDescriptor[\"direction\"]): T[] {\n const valueOf = column.sortValue ?? ((item: T) => (item as Record<string, unknown>)[column.key as string] as SortableValue);\n const directionFactor = direction === \"descending\" ? -1 : 1;\n return [...rows].sort((a, b) => compareSortableValues(valueOf(a), valueOf(b)) * directionFactor);\n}\n\nexport interface RowActionDef<T> {\n /** Unique key for this action. */\n key: string;\n /** aria-label for the button. */\n label: string;\n /** Icon element rendered inside the button. */\n icon: ReactNode;\n /** When false, button is disabled and a tooltip with `noAccessLabel` is shown. Default: true. */\n isAllowed?: boolean;\n /** Tooltip text shown when `isAllowed` is false. */\n noAccessLabel?: string;\n /** Called with the row item when the button is pressed. */\n onPress: (item: T) => void;\n}\n\nfunction RowActionButton<T>({\n action,\n item,\n}: {\n action: RowActionDef<T>;\n item: T;\n}) {\n const allowed = action.isAllowed !== false;\n const btn = (\n <button\n type=\"button\"\n className=\"data-table-row-action-btn\"\n aria-label={action.label}\n disabled={!allowed}\n onClick={allowed ? () => action.onPress(item) : undefined}\n >\n {action.icon}\n </button>\n );\n if (allowed) return btn;\n return (\n <PermissionGate isAllowed={false} noAccessLabel={action.noAccessLabel ?? \"\"}>\n {btn}\n </PermissionGate>\n );\n}\n\n// O tipo da linha aninhada é independente de T (não há relação genérica entre linha pai e linhas\n// filhas), então \"any\" é usado deliberadamente como fronteira de erasure de tipo.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype NestedStatus = { status: \"loading\"; data: never[] } | { status: \"loaded\"; data: any[] };\n\nexport interface DataTableProps<T extends { id: string }> {\n columns: Column<T>[];\n data: T[];\n actions?: ReactNode;\n /** Per-row action buttons rendered in a dedicated last column. */\n rowActions?: RowActionDef<T>[] | ((item: T) => RowActionDef<T>[]);\n /** Label for the row actions column header. Defaults to empty string. */\n rowActionsLabel?: string;\n /**\n * When true, renders a selection column before the first data column — a per-row control on\n * every row (see `selectionType`), plus a \"select all\" checkbox in the header when\n * `selectionType` is \"checkbox\". Off by default.\n */\n selectable?: boolean;\n /**\n * Visual style of the built-in selection control. \"checkbox\" (default) allows selecting\n * multiple rows and shows a \"select all\" in the header. \"radio\" restricts selection to a\n * single row (no \"select all\" — there is nothing to select all *to* with one choice) and\n * renders a round control instead of a checkbox.\n */\n selectionType?: \"checkbox\" | \"radio\";\n /** Controlled selection state. Omit to let the table manage its own selection internally. */\n selectedKeys?: Selection;\n onSelectionChange?: (keys: Selection) => void;\n /** Initial sort when the table manages its own sorting. Only columns with `sortable` can be sorted. */\n defaultSortDescriptor?: SortDescriptor;\n /** Controlled sort state. Omit to let the table manage its own sorting internally. */\n sortDescriptor?: SortDescriptor;\n onSortChange?: (descriptor: SortDescriptor) => void;\n searchPlaceholder?: string;\n searchKeys?: (keyof T)[];\n isLoading?: boolean;\n loadingMessage?: string;\n emptyMessage?: string;\n previousLabel?: string;\n nextLabel?: string;\n pageSize?: number;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- linha aninhada é de tipo independente de T\n nestedColumns?: Column<any>[];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- linha aninhada é de tipo independente de T\n getNestedData?: (item: T) => any[] | Promise<any[]>;\n nestedLoadingMessage?: string;\n nestedEmptyMessage?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- linha aninhada é de tipo independente de T\n nestedSearchKeys?: (keyof any)[];\n nestedSearchPlaceholder?: string;\n nestedActions?: (item: T) => ReactNode;\n nestedPageSize?: number;\n}\n\nexport function DataTable<T extends { id: string }>({\n columns,\n data,\n actions,\n rowActions,\n rowActionsLabel = \"\",\n selectable = false,\n selectionType = \"checkbox\",\n selectedKeys,\n onSelectionChange,\n defaultSortDescriptor,\n sortDescriptor: controlledSortDescriptor,\n onSortChange,\n searchPlaceholder = \"Search...\",\n searchKeys = [],\n isLoading = false,\n loadingMessage = \"Loading...\",\n emptyMessage = \"No records found\",\n previousLabel = \"Previous\",\n nextLabel = \"Next\",\n pageSize = 10,\n nestedColumns,\n getNestedData,\n nestedLoadingMessage = \"Loading...\",\n nestedEmptyMessage = \"No records found\",\n nestedSearchKeys,\n nestedSearchPlaceholder,\n nestedActions,\n nestedPageSize,\n}: DataTableProps<T>) {\n const [query, setQuery] = useState(\"\");\n const [page, setPage] = useState(1);\n const [internalSortDescriptor, setInternalSortDescriptor] = useState(defaultSortDescriptor);\n const sortDescriptor = controlledSortDescriptor ?? internalSortDescriptor;\n const [expanded, setExpanded] = useState<Set<string>>(new Set());\n const [nestedCache, setNestedCache] = useState<Map<string, NestedStatus>>(new Map());\n\n const hasNested = !!getNestedData && !!nestedColumns;\n const hasRowActions = !!rowActions;\n\n function setRowExpanded(id: string, isExpanded: boolean) {\n setExpanded((prev) => {\n const next = new Set(prev);\n if (isExpanded) next.add(id);\n else next.delete(id);\n return next;\n });\n }\n\n // A carga fica fora do updater do setExpanded: o React pode chamar updaters mais de uma\n // vez (StrictMode), o que dispararia getNestedData em dobro.\n function toggleRow(item: T) {\n const id = item.id;\n const willExpand = !expanded.has(id);\n setRowExpanded(id, willExpand);\n if (!willExpand || nestedCache.has(id)) return;\n\n const result = getNestedData!(item);\n if (result instanceof Promise) {\n setNestedCache((c) => new Map(c).set(id, { status: \"loading\", data: [] }));\n result.then(\n (rows) => {\n setNestedCache((c) => new Map(c).set(id, { status: \"loaded\", data: rows }));\n },\n () => {\n // Na falha, descarta a entrada e recolhe a linha: expandir de novo refaz a carga,\n // em vez de a linha ficar presa em \"loading\".\n setNestedCache((c) => {\n const next = new Map(c);\n next.delete(id);\n return next;\n });\n setRowExpanded(id, false);\n },\n );\n } else {\n setNestedCache((c) => new Map(c).set(id, { status: \"loaded\", data: result }));\n }\n }\n\n const hasSearch = searchKeys.length > 0;\n const hasToolbar = hasSearch || !!actions;\n\n const filtered = useMemo(() => {\n if (!query.trim() || !hasSearch) return data;\n const lower = query.toLowerCase();\n return data.filter((item) =>\n searchKeys.some((k) =>\n String(item[k] ?? \"\")\n .toLowerCase()\n .includes(lower),\n ),\n );\n }, [data, query, searchKeys, hasSearch]);\n\n const sortColumn = columns.find((col) => col.sortable && String(col.key) === String(sortDescriptor?.column));\n\n const sorted = useMemo(\n () => (sortColumn && sortDescriptor ? sortRows(filtered, sortColumn, sortDescriptor.direction) : filtered),\n [filtered, sortColumn, sortDescriptor],\n );\n\n function handleSortChange(descriptor: SortDescriptor) {\n setInternalSortDescriptor(descriptor);\n setPage(1);\n onSortChange?.(descriptor);\n }\n\n const totalPages = Math.max(1, Math.ceil(sorted.length / pageSize));\n const currentPage = Math.min(page, totalPages);\n const pageData = sorted.slice(\n (currentPage - 1) * pageSize,\n currentPage * pageSize,\n );\n\n function getCell(item: T, col: Column<T>): ReactNode {\n if (col.render) return col.render(item);\n return String((item as Record<string, unknown>)[col.key as string] ?? \"\");\n }\n\n return (\n <Flex direction=\"column\" gap=\"300\" className=\"data-table\">\n {hasToolbar && (\n <div className=\"data-table-toolbar\">\n {hasSearch && (\n <Search\n placeholder={searchPlaceholder}\n onSearch={(v) => {\n setQuery(v);\n setPage(1);\n }}\n className=\"data-table-search\"\n />\n )}\n {actions && <div className=\"data-table-actions\">{actions}</div>}\n </div>\n )}\n\n {isLoading ? (\n <div\n role=\"status\"\n aria-live=\"polite\"\n aria-label={loadingMessage}\n className=\"data-table-status\"\n >\n {loadingMessage}\n </div>\n ) : filtered.length === 0 ? (\n <div role=\"status\" className=\"data-table-status data-table-empty\">\n {emptyMessage}\n </div>\n ) : (\n <Table\n selectionMode={selectable ? (selectionType === \"radio\" ? \"single\" : \"multiple\") : \"none\"}\n selectionType={selectionType}\n selectedKeys={selectedKeys}\n onSelectionChange={onSelectionChange}\n sortDescriptor={sortDescriptor}\n onSortChange={handleSortChange}\n >\n <TableHead>\n {hasNested && <TableColumn className=\"data-table-expand-col\" />}\n {columns.map((col, idx) => (\n <TableColumn\n key={String(col.key)}\n id={String(col.key)}\n align={col.align}\n allowsSorting={col.sortable}\n isRowHeader={idx === 0}\n >\n {col.label}\n </TableColumn>\n ))}\n {hasRowActions && (\n <TableColumn align=\"right\" className=\"data-table-row-actions-col\">\n {rowActionsLabel}\n </TableColumn>\n )}\n </TableHead>\n <TableBody>\n {pageData.flatMap((item) => {\n const isExpanded = expanded.has(item.id);\n const cached = nestedCache.get(item.id);\n const rows: ReactNode[] = [\n <TableRow key={item.id} id={item.id}>\n {hasNested && (\n <TableCell className=\"data-table-expand-cell\">\n <button\n type=\"button\"\n className=\"data-table-expand-btn\"\n aria-label={isExpanded ? \"Collapse row\" : \"Expand row\"}\n aria-expanded={isExpanded}\n onClick={() => toggleRow(item)}\n >\n {isExpanded ? (\n <IconChevronDown size=\"16\" />\n ) : (\n <IconChevronRight size=\"16\" />\n )}\n </button>\n </TableCell>\n )}\n {columns.map((col) => (\n <TableCell key={String(col.key)} align={col.align}>\n {getCell(item, col)}\n </TableCell>\n ))}\n {hasRowActions && (\n <TableCell align=\"right\" className=\"data-table-row-actions-cell\">\n <div className=\"data-table-row-actions\">\n {(typeof rowActions === \"function\"\n ? rowActions(item)\n : rowActions!\n ).map((action) => (\n <RowActionButton key={action.key} action={action} item={item} />\n ))}\n </div>\n </TableCell>\n )}\n </TableRow>,\n ];\n if (isExpanded) {\n rows.push(\n <TableRow key={`${item.id}-nested`} id={`${item.id}-nested`} className=\"data-table-nested-row\">\n <TableCell\n colSpan={\n columns.length +\n (hasNested ? 1 : 0) +\n (selectable ? 1 : 0) +\n (hasRowActions ? 1 : 0)\n }\n className=\"data-table-nested-cell\"\n >\n <DataTable\n columns={nestedColumns!}\n data={cached?.data ?? []}\n isLoading={!cached || cached.status === \"loading\"}\n loadingMessage={nestedLoadingMessage}\n emptyMessage={nestedEmptyMessage}\n searchKeys={nestedSearchKeys}\n searchPlaceholder={nestedSearchPlaceholder}\n actions={nestedActions?.(item)}\n pageSize={nestedPageSize ?? pageSize}\n />\n </TableCell>\n </TableRow>,\n );\n }\n return rows;\n })}\n </TableBody>\n </Table>\n )}\n\n <Pagination\n page={currentPage}\n totalPages={totalPages}\n onPageChange={setPage}\n previousLabel={previousLabel}\n nextLabel={nextLabel}\n />\n </Flex>\n );\n}\n"],"names":["sortCollator","compareSortableValues","a","b","sortRows","rows","column","direction","valueOf","item","directionFactor","RowActionButton","action","allowed","btn","jsx","PermissionGate","DataTable","columns","data","actions","rowActions","rowActionsLabel","selectable","selectionType","selectedKeys","onSelectionChange","defaultSortDescriptor","controlledSortDescriptor","onSortChange","searchPlaceholder","searchKeys","isLoading","loadingMessage","emptyMessage","previousLabel","nextLabel","pageSize","nestedColumns","getNestedData","nestedLoadingMessage","nestedEmptyMessage","nestedSearchKeys","nestedSearchPlaceholder","nestedActions","nestedPageSize","query","setQuery","useState","page","setPage","internalSortDescriptor","setInternalSortDescriptor","sortDescriptor","expanded","setExpanded","nestedCache","setNestedCache","hasNested","hasRowActions","setRowExpanded","id","isExpanded","prev","next","toggleRow","willExpand","result","c","hasSearch","hasToolbar","filtered","useMemo","lower","k","sortColumn","col","sorted","handleSortChange","descriptor","totalPages","currentPage","pageData","getCell","Flex","jsxs","Search","v","Table","TableHead","TableColumn","idx","TableBody","cached","TableRow","TableCell","IconChevronDown","IconChevronRight","Pagination"],"mappings":";;;;;;;;;;AA+BA,MAAMA,KAAe,IAAI,KAAK,SAAS,QAAW,EAAE,SAAS,IAAM,aAAa,QAAQ;AAExF,SAASC,GAAsBC,GAAkBC,GAA0B;AACzE,SAAID,KAAK,QAAQC,KAAK,OAAaD,KAAK,OAAQC,KAAK,OAAO,IAAI,IAAK,KACjED,aAAa,QAAQC,aAAa,OAAaD,EAAE,QAAA,IAAYC,EAAE,QAAA,IAC/D,OAAOD,KAAM,YAAY,OAAOC,KAAM,WAAiBD,IAAIC,IACxDH,GAAa,QAAQ,OAAOE,CAAC,GAAG,OAAOC,CAAC,CAAC;AAClD;AAEA,SAASC,GAAYC,GAAWC,GAAmBC,GAA6C;AAC9F,QAAMC,IAAUF,EAAO,cAAc,CAACG,MAAaA,EAAiCH,EAAO,GAAa,IAClGI,IAAkBH,MAAc,eAAe,KAAK;AAC1D,SAAO,CAAC,GAAGF,CAAI,EAAE,KAAK,CAACH,GAAGC,MAAMF,GAAsBO,EAAQN,CAAC,GAAGM,EAAQL,CAAC,CAAC,IAAIO,CAAe;AACjG;AAiBA,SAASC,GAAmB;AAAA,EAC1B,QAAAC;AAAA,EACA,MAAAH;AACF,GAGG;AACD,QAAMI,IAAUD,EAAO,cAAc,IAC/BE,IACJ,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,WAAU;AAAA,MACV,cAAYH,EAA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ACgF;AAAA,gBAAA;AAAA,kBACC,SACE7E,EAAQ,UACPwC,IAAY,IAAI,MAChBnC,IAAa,IAAI,MACjBoC,IAAgB,IAAI;AAAA,kBAEvB,WAAU;AAAA,kBAEV,UAAA,gBAAA5C;AAAA,oBAACE;AAAA,oBAAA;AAAA,sBACC,SAASqB;AAAA,sBACT,OAAMuD,KAAA,gBAAAA,EAAQ,SAAQ,CAAA;AAAA,sBACtB,WAAW,CAACA,KAAUA,EAAO,WAAW;AAAA,sBACxC,gBAAgBrD;AAAA,sBAChB,cAAcC;AAAA,sBACd,YAAYC;AAAA,sBACZ,mBAAmBC;AAAA,sBACnB,SAASC,KAAA,gBAAAA,EAAgBnC;AAAA,sBACzB,UAAUoC,MAAkBR;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBAC9B;AAAA,cAAA,EACF,GArBa,GAAG5B,EAAK,EAAE,SAsBzB;AAAA,YAAA,GAGGJ;AAAA,UACT,CAAC,EAAA,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAIJ,gBAAAU;AAAA,MAACmF;AAAA,MAAA;AAAA,QACC,MAAMjB;AAAA,QACN,YAAAD;AAAA,QACA,cAAc9B;AAAA,QACd,eAAAf;AAAA,QACA,WAAAC;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"DataTable.js","sources":["../../../../../src/ui/components/DataTable/DataTable.tsx"],"sourcesContent":["import {\n IconButton,\n Pagination,\n PermissionGate,\n Search,\n Table,\n TableBody,\n TableCell,\n TableColumn,\n TableHead,\n TableRow,\n} from \"primitives\";\nimport { Flex } from \"layout\";\nimport { IconChevronDown, IconChevronRight } from \"icons\";\nimport type { ReactNode } from \"react\";\nimport clsx from \"clsx\";\nimport { useMemo, useState } from \"react\";\nimport type { Selection, SortDescriptor } from \"react-aria-components\";\nimport \"./datatable.css\";\n\nexport interface Column<T> {\n key: keyof T | string;\n label: string;\n align?: \"start\" | \"center\" | \"right\";\n render?: (item: T) => ReactNode;\n /** Marks the column that names the row for assistive technology. Defaults to the first column when no column sets it. */\n isRowHeader?: boolean;\n /** When true, the header becomes clickable and the rows can be sorted by this column. */\n sortable?: boolean;\n /** Value used to sort this column. Defaults to `item[key]`. */\n sortValue?: (item: T) => SortableValue;\n}\n\ntype SortableValue = string | number | Date | null | undefined;\n\nconst sortCollator = new Intl.Collator(undefined, { numeric: true, sensitivity: \"base\" });\n\nfunction compareSortableValues(a: SortableValue, b: SortableValue): number {\n if (a == null || b == null) return a == null ? (b == null ? 0 : 1) : -1;\n if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();\n if (typeof a === \"number\" && typeof b === \"number\") return a - b;\n return sortCollator.compare(String(a), String(b));\n}\n\nfunction sortRows<T>(rows: T[], column: Column<T>, direction: SortDescriptor[\"direction\"]): T[] {\n const valueOf = column.sortValue ?? ((item: T) => (item as Record<string, unknown>)[column.key as string] as SortableValue);\n const directionFactor = direction === \"descending\" ? -1 : 1;\n return [...rows].sort((a, b) => compareSortableValues(valueOf(a), valueOf(b)) * directionFactor);\n}\n\nexport interface RowActionDef<T> {\n /** Unique key for this action. */\n key: string;\n /** aria-label for the button. */\n label: string;\n /** Icon element rendered inside the button. */\n icon: ReactNode;\n /** When false, button is disabled and a tooltip with `noAccessLabel` is shown. Default: true. */\n isAllowed?: boolean;\n /** Tooltip text shown when `isAllowed` is false. */\n noAccessLabel?: string;\n /** Called with the row item when the button is pressed. */\n onPress: (item: T) => void;\n}\n\nfunction RowActionButton<T>({\n action,\n item,\n}: {\n action: RowActionDef<T>;\n item: T;\n}) {\n const allowed = action.isAllowed !== false;\n const btn = (\n <IconButton\n variant=\"neutral\"\n size=\"small\"\n aria-label={action.label}\n isDisabled={!allowed}\n onPress={allowed ? () => action.onPress(item) : undefined}\n >\n {action.icon}\n </IconButton>\n );\n if (allowed) return btn;\n return (\n <PermissionGate isAllowed={false} noAccessLabel={action.noAccessLabel ?? \"\"}>\n {btn}\n </PermissionGate>\n );\n}\n\n// O tipo da linha aninhada é independente de T (não há relação genérica entre linha pai e linhas\n// filhas), então \"any\" é usado deliberadamente como fronteira de erasure de tipo.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype NestedStatus = { status: \"loading\"; data: never[] } | { status: \"loaded\"; data: any[] };\n\nexport interface DataTableProps<T extends { id: string }> {\n columns: Column<T>[];\n data: T[];\n actions?: ReactNode;\n /** Per-row action buttons rendered in a dedicated last column. */\n rowActions?: RowActionDef<T>[] | ((item: T) => RowActionDef<T>[]);\n /** Label for the row actions column header. Defaults to empty string. */\n rowActionsLabel?: string;\n /**\n * When true, renders a selection column before the first data column — a per-row control on\n * every row (see `selectionType`), plus a \"select all\" checkbox in the header when\n * `selectionType` is \"checkbox\". Off by default.\n */\n selectable?: boolean;\n /**\n * Visual style of the built-in selection control. \"checkbox\" (default) allows selecting\n * multiple rows and shows a \"select all\" in the header. \"radio\" restricts selection to a\n * single row (no \"select all\" — there is nothing to select all *to* with one choice) and\n * renders a round control instead of a checkbox.\n */\n selectionType?: \"checkbox\" | \"radio\";\n /** Controlled selection state. Omit to let the table manage its own selection internally. */\n selectedKeys?: Selection;\n onSelectionChange?: (keys: Selection) => void;\n /** Initial sort when the table manages its own sorting. Only columns with `sortable` can be sorted. */\n defaultSortDescriptor?: SortDescriptor;\n /** Controlled sort state. Omit to let the table manage its own sorting internally. */\n sortDescriptor?: SortDescriptor;\n onSortChange?: (descriptor: SortDescriptor) => void;\n /** Accessible name of the table. */\n ariaLabel?: string;\n /** Compact row height. Off by default. */\n dense?: boolean;\n /** Alternating row background. Off by default. */\n striped?: boolean;\n /**\n * Caps the height of the table so its rows scroll inside it with a sticky header, keeping the\n * pagination in view. A percentage needs a parent with a defined height. Off by default.\n */\n maxHeight?: number | string;\n searchPlaceholder?: string;\n searchKeys?: (keyof T)[];\n isLoading?: boolean;\n loadingMessage?: string;\n emptyMessage?: string;\n previousLabel?: string;\n nextLabel?: string;\n pageSize?: number;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- linha aninhada é de tipo independente de T\n nestedColumns?: Column<any>[];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- linha aninhada é de tipo independente de T\n getNestedData?: (item: T) => any[] | Promise<any[]>;\n nestedLoadingMessage?: string;\n nestedEmptyMessage?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- linha aninhada é de tipo independente de T\n nestedSearchKeys?: (keyof any)[];\n nestedSearchPlaceholder?: string;\n nestedActions?: (item: T) => ReactNode;\n nestedPageSize?: number;\n}\n\nexport function DataTable<T extends { id: string }>({\n columns,\n data,\n actions,\n rowActions,\n rowActionsLabel = \"\",\n selectable = false,\n selectionType = \"checkbox\",\n selectedKeys,\n onSelectionChange,\n defaultSortDescriptor,\n sortDescriptor: controlledSortDescriptor,\n onSortChange,\n ariaLabel,\n dense,\n striped,\n maxHeight,\n searchPlaceholder = \"Search...\",\n searchKeys = [],\n isLoading = false,\n loadingMessage = \"Loading...\",\n emptyMessage = \"No records found\",\n previousLabel = \"Previous\",\n nextLabel = \"Next\",\n pageSize = 10,\n nestedColumns,\n getNestedData,\n nestedLoadingMessage = \"Loading...\",\n nestedEmptyMessage = \"No records found\",\n nestedSearchKeys,\n nestedSearchPlaceholder,\n nestedActions,\n nestedPageSize,\n}: DataTableProps<T>) {\n const [query, setQuery] = useState(\"\");\n const [page, setPage] = useState(1);\n const [internalSortDescriptor, setInternalSortDescriptor] = useState(defaultSortDescriptor);\n const sortDescriptor = controlledSortDescriptor ?? internalSortDescriptor;\n const [expanded, setExpanded] = useState<Set<string>>(new Set());\n const [nestedCache, setNestedCache] = useState<Map<string, NestedStatus>>(new Map());\n\n const hasNested = !!getNestedData && !!nestedColumns;\n const hasRowActions = !!rowActions;\n\n function setRowExpanded(id: string, isExpanded: boolean) {\n setExpanded((prev) => {\n const next = new Set(prev);\n if (isExpanded) next.add(id);\n else next.delete(id);\n return next;\n });\n }\n\n // A carga fica fora do updater do setExpanded: o React pode chamar updaters mais de uma\n // vez (StrictMode), o que dispararia getNestedData em dobro.\n function toggleRow(item: T) {\n const id = item.id;\n const willExpand = !expanded.has(id);\n setRowExpanded(id, willExpand);\n if (!willExpand || nestedCache.has(id)) return;\n\n const result = getNestedData!(item);\n if (result instanceof Promise) {\n setNestedCache((c) => new Map(c).set(id, { status: \"loading\", data: [] }));\n result.then(\n (rows) => {\n setNestedCache((c) => new Map(c).set(id, { status: \"loaded\", data: rows }));\n },\n () => {\n // Na falha, descarta a entrada e recolhe a linha: expandir de novo refaz a carga,\n // em vez de a linha ficar presa em \"loading\".\n setNestedCache((c) => {\n const next = new Map(c);\n next.delete(id);\n return next;\n });\n setRowExpanded(id, false);\n },\n );\n } else {\n setNestedCache((c) => new Map(c).set(id, { status: \"loaded\", data: result }));\n }\n }\n\n const hasSearch = searchKeys.length > 0;\n const hasExplicitRowHeader = columns.some((col) => col.isRowHeader);\n const hasToolbar = hasSearch || !!actions;\n\n const filtered = useMemo(() => {\n if (!query.trim() || !hasSearch) return data;\n const lower = query.toLowerCase();\n return data.filter((item) =>\n searchKeys.some((k) =>\n String(item[k] ?? \"\")\n .toLowerCase()\n .includes(lower),\n ),\n );\n }, [data, query, searchKeys, hasSearch]);\n\n const sortColumn = columns.find((col) => col.sortable && String(col.key) === String(sortDescriptor?.column));\n\n const sorted = useMemo(\n () => (sortColumn && sortDescriptor ? sortRows(filtered, sortColumn, sortDescriptor.direction) : filtered),\n [filtered, sortColumn, sortDescriptor],\n );\n\n function handleSortChange(descriptor: SortDescriptor) {\n setInternalSortDescriptor(descriptor);\n setPage(1);\n onSortChange?.(descriptor);\n }\n\n const totalPages = Math.max(1, Math.ceil(sorted.length / pageSize));\n const currentPage = Math.min(page, totalPages);\n const pageData = sorted.slice(\n (currentPage - 1) * pageSize,\n currentPage * pageSize,\n );\n\n function getCell(item: T, col: Column<T>): ReactNode {\n if (col.render) return col.render(item);\n return String((item as Record<string, unknown>)[col.key as string] ?? \"\");\n }\n\n return (\n <Flex\n direction=\"column\"\n gap=\"300\"\n className={clsx(\"data-table\", maxHeight !== undefined && \"data-table--fill\")}\n >\n {hasToolbar && (\n <div className=\"data-table-toolbar\">\n {hasSearch && (\n <Search\n placeholder={searchPlaceholder}\n onSearch={(v) => {\n setQuery(v);\n setPage(1);\n }}\n className=\"data-table-search\"\n />\n )}\n {actions && <div className=\"data-table-actions\">{actions}</div>}\n </div>\n )}\n\n {isLoading ? (\n <div\n role=\"status\"\n aria-live=\"polite\"\n aria-label={loadingMessage}\n className=\"data-table-status\"\n >\n {loadingMessage}\n </div>\n ) : filtered.length === 0 ? (\n <div role=\"status\" className=\"data-table-status data-table-empty\">\n {emptyMessage}\n </div>\n ) : (\n <Table\n aria-label={ariaLabel}\n dense={dense}\n striped={striped}\n maxHeight={maxHeight}\n selectionMode={selectable ? (selectionType === \"radio\" ? \"single\" : \"multiple\") : \"none\"}\n selectionType={selectionType}\n selectedKeys={selectedKeys}\n onSelectionChange={onSelectionChange}\n sortDescriptor={sortDescriptor}\n onSortChange={handleSortChange}\n >\n <TableHead>\n {hasNested && <TableColumn className=\"data-table-expand-col\" />}\n {columns.map((col, idx) => (\n <TableColumn\n key={String(col.key)}\n id={String(col.key)}\n align={col.align}\n allowsSorting={col.sortable}\n isRowHeader={hasExplicitRowHeader ? col.isRowHeader : idx === 0}\n >\n {col.label}\n </TableColumn>\n ))}\n {hasRowActions && (\n <TableColumn align=\"right\" className=\"data-table-row-actions-col\">\n {rowActionsLabel}\n </TableColumn>\n )}\n </TableHead>\n <TableBody>\n {pageData.flatMap((item) => {\n const isExpanded = expanded.has(item.id);\n const cached = nestedCache.get(item.id);\n const rows: ReactNode[] = [\n <TableRow key={item.id} id={item.id}>\n {hasNested && (\n <TableCell className=\"data-table-expand-cell\">\n <button\n type=\"button\"\n className=\"data-table-expand-btn\"\n aria-label={isExpanded ? \"Collapse row\" : \"Expand row\"}\n aria-expanded={isExpanded}\n onClick={() => toggleRow(item)}\n >\n {isExpanded ? (\n <IconChevronDown size=\"16\" />\n ) : (\n <IconChevronRight size=\"16\" />\n )}\n </button>\n </TableCell>\n )}\n {columns.map((col) => (\n <TableCell key={String(col.key)} align={col.align}>\n {getCell(item, col)}\n </TableCell>\n ))}\n {hasRowActions && (\n <TableCell align=\"right\" className=\"data-table-row-actions-cell\">\n <div className=\"data-table-row-actions\">\n {(typeof rowActions === \"function\"\n ? rowActions(item)\n : rowActions!\n ).map((action) => (\n <RowActionButton key={action.key} action={action} item={item} />\n ))}\n </div>\n </TableCell>\n )}\n </TableRow>,\n ];\n if (isExpanded) {\n rows.push(\n <TableRow key={`${item.id}-nested`} id={`${item.id}-nested`} className=\"data-table-nested-row\">\n <TableCell\n colSpan={\n columns.length +\n (hasNested ? 1 : 0) +\n (selectable ? 1 : 0) +\n (hasRowActions ? 1 : 0)\n }\n className=\"data-table-nested-cell\"\n >\n <DataTable\n columns={nestedColumns!}\n data={cached?.data ?? []}\n isLoading={!cached || cached.status === \"loading\"}\n loadingMessage={nestedLoadingMessage}\n emptyMessage={nestedEmptyMessage}\n searchKeys={nestedSearchKeys}\n searchPlaceholder={nestedSearchPlaceholder}\n actions={nestedActions?.(item)}\n pageSize={nestedPageSize ?? pageSize}\n />\n </TableCell>\n </TableRow>,\n );\n }\n return rows;\n })}\n </TableBody>\n </Table>\n )}\n\n <Pagination\n page={currentPage}\n totalPages={totalPages}\n onPageChange={setPage}\n previousLabel={previousLabel}\n nextLabel={nextLabel}\n />\n </Flex>\n );\n}\n"],"names":["sortCollator","compareSortableValues","a","b","sortRows","rows","column","direction","valueOf","item","directionFactor","RowActionButton","action","allowed","btn","jsx","IconButton","PermissionGate","DataTable","columns","data","actions","rowActions","rowActionsLabel","selectable","selectionType","selectedKeys","onSelectionChange","defaultSortDescriptor","controlledSortDescriptor","onSortChange","ariaLabel","dense","striped","maxHeight","searchPlaceholder","searchKeys","isLoading","loadingMessage","emptyMessage","previousLabel","nextLabel","pageSize","nestedColumns","getNestedData","nestedLoadingMessage","nestedEmptyMessage","nestedSearchKeys","nestedSearchPlaceholder","nestedActions","nestedPageSize","query","setQuery","useState","page","setPage","internalSortDescriptor","setInternalSortDescriptor","sortDescriptor","expanded","setExpanded","nestedCache","setNestedCache","hasNested","hasRowActions","setRowExpanded","id","isExpanded","prev","next","toggleRow","willExpand","result","c","hasSearch","hasExplicitRowHeader","col","hasToolbar","filtered","useMemo","lower","k","sortColumn","sorted","handleSortChange","descriptor","totalPages","currentPage","pageData","getCell","jsxs","Flex","clsx","Search","v","Table","TableHead","TableColumn","idx","TableBody","cached","TableRow","TableCell","IconChevronDown","IconChevronRight","Pagination"],"mappings":";;;;;;;;;;;;AAmCA,MAAMA,KAAe,IAAI,KAAK,SAAS,QAAW,EAAE,SAAS,IAAM,aAAa,QAAQ;AAExF,SAASC,GAAsBC,GAAkBC,GAA0B;AACzE,SAAID,KAAK,QAAQC,KAAK,OAAaD,KAAK,OAAQC,KAAK,OAAO,IAAI,IAAK,KACjED,aAAa,QAAQC,aAAa,OAAaD,EAAE,QAAA,IAAYC,EAAE,QAAA,IAC/D,OAAOD,KAAM,YAAY,OAAOC,KAAM,WAAiBD,IAAIC,IACxDH,GAAa,QAAQ,OAAOE,CAAC,GAAG,OAAOC,CAAC,CAAC;AAClD;AAEA,SAASC,GAAYC,GAAWC,GAAmBC,GAA6C;AAC9F,QAAMC,IAAUF,EAAO,cAAc,CAACG,MAAaA,EAAiCH,EAAO,GAAa,IAClGI,IAAkBH,MAAc,eAAe,KAAK;AAC1D,SAAO,CAAC,GAAGF,CAAI,EAAE,KAAK,CAACH,GAAGC,MAAMF,GAAsBO,EAAQN,CAAC,GAAGM,EAAQL,CAAC,CAAC,IAAIO,CAAe;AACjG;AAiBA,SAASC,GAAmB;AAAA,EAC1B,QAAAC;AAAA,EACA,MAAAH;AACF,GAGG;AACD,QAAMI,IAAUD,EAAO,cAAc,IAC/BE,IACJ,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,cAAYJ,EAAO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StringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("../../../vendor/clsx/dist/clsx.cjs");;/* empty css */const r=require("../../primitives/Dialog/Dialog.cjs"),n=require("../../layout/Flex/Flex.cjs"),a=require("../../primitives/Button/Button.cjs");function f({isOpen:o,title:s,submitLabel:t="Save",cancelLabel:c="Cancel",isLoading:l=!1,isSubmitDisabled:d=!1,size:u="medium",onSubmit:m,onClose:i,children:x}){return o?e.jsx(r.DialogModal,{isOpen:o,onOpenChange:g=>!g&&i(),children:e.jsxs(r.Dialog,{className:j.clsx("form-modal",`form-modal--${u}`),children:[e.jsxs(n.Flex,{direction:"row",alignPrimary:"space-between",alignSecondary:"center",children:[e.jsx(r.DialogTitle,{children:s}),e.jsx(r.DialogClose,{onPress:i})]}),e.jsx(r.DialogBody,{children:e.jsx(n.Flex,{direction:"column",gap:"300",children:x})}),e.jsxs(n.Flex,{direction:"row",gap:"200",alignPrimary:"end",className:"form-modal-footer",children:[e.jsx(a.Button,{variant:"neutral",onPress:i,isDisabled:l,children:c}),e.jsx(a.Button,{variant:"primary",onPress:m,isDisabled:d||l,children:l?"...":t})]})]})}):null}exports.FormModal=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");;/* empty css */const r=require("../../primitives/Dialog/Dialog.cjs"),n=require("../../layout/Flex/Flex.cjs"),o=require("../../primitives/Button/Button.cjs");function j({isOpen:a,title:s,submitLabel:t="Save",cancelLabel:c="Cancel",isLoading:i=!1,isSubmitDisabled:d=!1,size:u="medium",onSubmit:m,onClose:l,children:x}){return a?e.jsx(r.DialogModal,{isOpen:a,onOpenChange:g=>!g&&l(),children:e.jsxs(r.Dialog,{className:"form-modal",size:u,children:[e.jsxs(n.Flex,{direction:"row",alignPrimary:"space-between",alignSecondary:"center",children:[e.jsx(r.DialogTitle,{children:s}),e.jsx(r.DialogClose,{onPress:l})]}),e.jsx(r.DialogBody,{children:e.jsx(n.Flex,{direction:"column",gap:"300",children:x})}),e.jsxs(n.Flex,{direction:"row",gap:"200",alignPrimary:"end",className:"form-modal-footer",children:[e.jsx(o.Button,{variant:"neutral",onPress:l,isDisabled:i,children:c}),e.jsx(o.Button,{variant:"primary",onPress:m,isDisabled:d||i,children:i?"...":t})]})]})}):null}exports.FormModal=j;
2
2
  //# sourceMappingURL=FormModal.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormModal.cjs","sources":["../../../../../src/ui/components/FormModal/FormModal.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport {\n Button,\n Dialog,\n DialogBody,\n DialogClose,\n DialogModal,\n DialogTitle,\n} from \"primitives\";\nimport { Flex } from \"layout\";\nimport type { ReactNode } from \"react\";\nimport \"./formmodal.css\";\n\nexport type FormModalSize = \"medium\" | \"large\" | \"xlarge\";\n\nexport interface FormModalProps {\n isOpen: boolean;\n title: string;\n submitLabel?: string;\n cancelLabel?: string;\n isLoading?: boolean;\n isSubmitDisabled?: boolean;\n /**\n * Maximum width of the dialog. Defaults to `\"medium\"`, which preserves the\n * previous fixed width. Use `\"large\"`/`\"xlarge\"` for forms that embed wide\n * content such as tables.\n */\n size?: FormModalSize;\n onSubmit: () => void;\n onClose: () => void;\n children: ReactNode;\n}\n\nexport function FormModal({\n isOpen,\n title,\n submitLabel = \"Save\",\n cancelLabel = \"Cancel\",\n isLoading = false,\n isSubmitDisabled = false,\n size = \"medium\",\n onSubmit,\n onClose,\n children,\n}: FormModalProps) {\n if (!isOpen) return null;\n\n return (\n <DialogModal isOpen={isOpen} onOpenChange={(open) => !open && onClose()}>\n <Dialog className={clsx(\"form-modal\", `form-modal--${size}`)}>\n <Flex direction=\"row\" alignPrimary=\"space-between\" alignSecondary=\"center\">\n <DialogTitle>{title}</DialogTitle>\n <DialogClose onPress={onClose} />\n </Flex>\n <DialogBody>\n <Flex direction=\"column\" gap=\"300\">\n {children}\n </Flex>\n </DialogBody>\n <Flex\n direction=\"row\"\n gap=\"200\"\n alignPrimary=\"end\"\n className=\"form-modal-footer\"\n >\n <Button variant=\"neutral\" onPress={onClose} isDisabled={isLoading}>\n {cancelLabel}\n </Button>\n <Button\n variant=\"primary\"\n onPress={onSubmit}\n isDisabled={isSubmitDisabled || isLoading}\n >\n {isLoading ? \"...\" : submitLabel}\n </Button>\n </Flex>\n </Dialog>\n </DialogModal>\n );\n}\n"],"names":["FormModal","isOpen","title","submitLabel","cancelLabel","isLoading","isSubmitDisabled","size","onSubmit","onClose","children","DialogModal","open","jsxs","Dialog","clsx","Flex","jsx","DialogTitle","DialogClose","DialogBody","Button"],"mappings":"kVAiCO,SAASA,EAAU,CACxB,OAAAC,EACA,MAAAC,EACA,YAAAC,EAAc,OACd,YAAAC,EAAc,SACd,UAAAC,EAAY,GACZ,iBAAAC,EAAmB,GACnB,KAAAC,EAAO,SACP,SAAAC,EACA,QAAAC,EACA,SAAAC,CACF,EAAmB,CACjB,OAAKT,QAGFU,cAAA,CAAY,OAAAV,EAAgB,aAAeW,GAAS,CAACA,GAAQH,IAC5D,SAAAI,EAAAA,KAACC,EAAAA,QAAO,UAAWC,OAAK,aAAc,eAAeR,CAAI,EAAE,EACzD,SAAA,CAAAM,OAACG,EAAAA,MAAK,UAAU,MAAM,aAAa,gBAAgB,eAAe,SAChE,SAAA,CAAAC,EAAAA,IAACC,EAAAA,aAAa,SAAAhB,CAAA,CAAM,EACpBe,EAAAA,IAACE,EAAAA,YAAA,CAAY,QAASV,CAAA,CAAS,CAAA,EACjC,EACAQ,EAAAA,IAACG,EAAAA,YACC,SAAAH,EAAAA,IAACD,EAAAA,KAAA,CAAK,UAAU,SAAS,IAAI,MAC1B,SAAAN,CAAA,CACH,CAAA,CACF,EACAG,EAAAA,KAACG,EAAAA,KAAA,CACC,UAAU,MACV,IAAI,MACJ,aAAa,MACb,UAAU,oBAEV,SAAA,CAAAC,EAAAA,IAACI,EAAAA,QAAO,QAAQ,UAAU,QAASZ,EAAS,WAAYJ,EACrD,SAAAD,CAAA,CACH,EACAa,EAAAA,IAACI,EAAAA,OAAA,CACC,QAAQ,UACR,QAASb,EACT,WAAYF,GAAoBD,EAE/B,WAAY,MAAQF,CAAA,CAAA,CACvB,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CACF,EAhCkB,IAkCtB"}
1
+ {"version":3,"file":"FormModal.cjs","sources":["../../../../../src/ui/components/FormModal/FormModal.tsx"],"sourcesContent":["import {\n Button,\n Dialog,\n DialogBody,\n DialogClose,\n DialogModal,\n DialogTitle,\n type DialogSize,\n} from \"primitives\";\nimport { Flex } from \"layout\";\nimport type { ReactNode } from \"react\";\nimport \"./formmodal.css\";\n\nexport type FormModalSize = DialogSize;\n\nexport interface FormModalProps {\n isOpen: boolean;\n title: string;\n submitLabel?: string;\n cancelLabel?: string;\n isLoading?: boolean;\n isSubmitDisabled?: boolean;\n /**\n * Maximum width of the dialog. Defaults to `\"medium\"`, which preserves the\n * previous fixed width. Use `\"large\"`/`\"xlarge\"` for forms that embed wide\n * content such as tables.\n */\n size?: FormModalSize;\n onSubmit: () => void;\n onClose: () => void;\n children: ReactNode;\n}\n\nexport function FormModal({\n isOpen,\n title,\n submitLabel = \"Save\",\n cancelLabel = \"Cancel\",\n isLoading = false,\n isSubmitDisabled = false,\n size = \"medium\",\n onSubmit,\n onClose,\n children,\n}: FormModalProps) {\n if (!isOpen) return null;\n\n return (\n <DialogModal isOpen={isOpen} onOpenChange={(open) => !open && onClose()}>\n <Dialog className=\"form-modal\" size={size}>\n <Flex direction=\"row\" alignPrimary=\"space-between\" alignSecondary=\"center\">\n <DialogTitle>{title}</DialogTitle>\n <DialogClose onPress={onClose} />\n </Flex>\n <DialogBody>\n <Flex direction=\"column\" gap=\"300\">\n {children}\n </Flex>\n </DialogBody>\n <Flex\n direction=\"row\"\n gap=\"200\"\n alignPrimary=\"end\"\n className=\"form-modal-footer\"\n >\n <Button variant=\"neutral\" onPress={onClose} isDisabled={isLoading}>\n {cancelLabel}\n </Button>\n <Button\n variant=\"primary\"\n onPress={onSubmit}\n isDisabled={isSubmitDisabled || isLoading}\n >\n {isLoading ? \"...\" : submitLabel}\n </Button>\n </Flex>\n </Dialog>\n </DialogModal>\n );\n}\n"],"names":["FormModal","isOpen","title","submitLabel","cancelLabel","isLoading","isSubmitDisabled","size","onSubmit","onClose","children","jsx","DialogModal","open","jsxs","Dialog","Flex","DialogTitle","DialogClose","DialogBody","Button"],"mappings":"kSAiCO,SAASA,EAAU,CACxB,OAAAC,EACA,MAAAC,EACA,YAAAC,EAAc,OACd,YAAAC,EAAc,SACd,UAAAC,EAAY,GACZ,iBAAAC,EAAmB,GACnB,KAAAC,EAAO,SACP,SAAAC,EACA,QAAAC,EACA,SAAAC,CACF,EAAmB,CACjB,OAAKT,EAGHU,EAAAA,IAACC,EAAAA,YAAA,CAAY,OAAAX,EAAgB,aAAeY,GAAS,CAACA,GAAQJ,EAAA,EAC5D,SAAAK,EAAAA,KAACC,EAAAA,OAAA,CAAO,UAAU,aAAa,KAAAR,EAC7B,SAAA,CAAAO,OAACE,EAAAA,MAAK,UAAU,MAAM,aAAa,gBAAgB,eAAe,SAChE,SAAA,CAAAL,EAAAA,IAACM,EAAAA,aAAa,SAAAf,CAAA,CAAM,EACpBS,EAAAA,IAACO,EAAAA,YAAA,CAAY,QAAST,CAAA,CAAS,CAAA,EACjC,EACAE,EAAAA,IAACQ,EAAAA,YACC,SAAAR,EAAAA,IAACK,EAAAA,KAAA,CAAK,UAAU,SAAS,IAAI,MAC1B,SAAAN,CAAA,CACH,CAAA,CACF,EACAI,EAAAA,KAACE,EAAAA,KAAA,CACC,UAAU,MACV,IAAI,MACJ,aAAa,MACb,UAAU,oBAEV,SAAA,CAAAL,EAAAA,IAACS,EAAAA,QAAO,QAAQ,UAAU,QAASX,EAAS,WAAYJ,EACrD,SAAAD,CAAA,CACH,EACAO,EAAAA,IAACS,EAAAA,OAAA,CACC,QAAQ,UACR,QAASZ,EACT,WAAYF,GAAoBD,EAE/B,WAAY,MAAQF,CAAA,CAAA,CACvB,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CACF,EAhCkB,IAkCtB"}
@@ -1,10 +1,9 @@
1
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
2
- import { clsx as h } from "../../../vendor/clsx/dist/clsx.js";
1
+ import { jsx as r, jsxs as a } from "react/jsx-runtime";
3
2
  /* empty css */
4
- import { DialogModal as u, Dialog as D, DialogTitle as x, DialogClose as y, DialogBody as P } from "../../primitives/Dialog/Dialog.js";
5
- import { Flex as a } from "../../layout/Flex/Flex.js";
3
+ import { DialogModal as h, Dialog as u, DialogTitle as D, DialogClose as y, DialogBody as P } from "../../primitives/Dialog/Dialog.js";
4
+ import { Flex as o } from "../../layout/Flex/Flex.js";
6
5
  import { Button as n } from "../../primitives/Button/Button.js";
7
- function M({
6
+ function B({
8
7
  isOpen: l,
9
8
  title: m,
10
9
  submitLabel: t = "Save",
@@ -13,24 +12,24 @@ function M({
13
12
  isSubmitDisabled: d = !1,
14
13
  size: s = "medium",
15
14
  onSubmit: f,
16
- onClose: o,
15
+ onClose: i,
17
16
  children: p
18
17
  }) {
19
- return l ? /* @__PURE__ */ r(u, { isOpen: l, onOpenChange: (g) => !g && o(), children: /* @__PURE__ */ i(D, { className: h("form-modal", `form-modal--${s}`), children: [
20
- /* @__PURE__ */ i(a, { direction: "row", alignPrimary: "space-between", alignSecondary: "center", children: [
21
- /* @__PURE__ */ r(x, { children: m }),
22
- /* @__PURE__ */ r(y, { onPress: o })
18
+ return l ? /* @__PURE__ */ r(h, { isOpen: l, onOpenChange: (g) => !g && i(), children: /* @__PURE__ */ a(u, { className: "form-modal", size: s, children: [
19
+ /* @__PURE__ */ a(o, { direction: "row", alignPrimary: "space-between", alignSecondary: "center", children: [
20
+ /* @__PURE__ */ r(D, { children: m }),
21
+ /* @__PURE__ */ r(y, { onPress: i })
23
22
  ] }),
24
- /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(a, { direction: "column", gap: "300", children: p }) }),
25
- /* @__PURE__ */ i(
26
- a,
23
+ /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(o, { direction: "column", gap: "300", children: p }) }),
24
+ /* @__PURE__ */ a(
25
+ o,
27
26
  {
28
27
  direction: "row",
29
28
  gap: "200",
30
29
  alignPrimary: "end",
31
30
  className: "form-modal-footer",
32
31
  children: [
33
- /* @__PURE__ */ r(n, { variant: "neutral", onPress: o, isDisabled: e, children: c }),
32
+ /* @__PURE__ */ r(n, { variant: "neutral", onPress: i, isDisabled: e, children: c }),
34
33
  /* @__PURE__ */ r(
35
34
  n,
36
35
  {
@@ -46,6 +45,6 @@ function M({
46
45
  ] }) }) : null;
47
46
  }
48
47
  export {
49
- M as FormModal
48
+ B as FormModal
50
49
  };
51
50
  //# sourceMappingURL=FormModal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormModal.js","sources":["../../../../../src/ui/components/FormModal/FormModal.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport {\n Button,\n Dialog,\n DialogBody,\n DialogClose,\n DialogModal,\n DialogTitle,\n} from \"primitives\";\nimport { Flex } from \"layout\";\nimport type { ReactNode } from \"react\";\nimport \"./formmodal.css\";\n\nexport type FormModalSize = \"medium\" | \"large\" | \"xlarge\";\n\nexport interface FormModalProps {\n isOpen: boolean;\n title: string;\n submitLabel?: string;\n cancelLabel?: string;\n isLoading?: boolean;\n isSubmitDisabled?: boolean;\n /**\n * Maximum width of the dialog. Defaults to `\"medium\"`, which preserves the\n * previous fixed width. Use `\"large\"`/`\"xlarge\"` for forms that embed wide\n * content such as tables.\n */\n size?: FormModalSize;\n onSubmit: () => void;\n onClose: () => void;\n children: ReactNode;\n}\n\nexport function FormModal({\n isOpen,\n title,\n submitLabel = \"Save\",\n cancelLabel = \"Cancel\",\n isLoading = false,\n isSubmitDisabled = false,\n size = \"medium\",\n onSubmit,\n onClose,\n children,\n}: FormModalProps) {\n if (!isOpen) return null;\n\n return (\n <DialogModal isOpen={isOpen} onOpenChange={(open) => !open && onClose()}>\n <Dialog className={clsx(\"form-modal\", `form-modal--${size}`)}>\n <Flex direction=\"row\" alignPrimary=\"space-between\" alignSecondary=\"center\">\n <DialogTitle>{title}</DialogTitle>\n <DialogClose onPress={onClose} />\n </Flex>\n <DialogBody>\n <Flex direction=\"column\" gap=\"300\">\n {children}\n </Flex>\n </DialogBody>\n <Flex\n direction=\"row\"\n gap=\"200\"\n alignPrimary=\"end\"\n className=\"form-modal-footer\"\n >\n <Button variant=\"neutral\" onPress={onClose} isDisabled={isLoading}>\n {cancelLabel}\n </Button>\n <Button\n variant=\"primary\"\n onPress={onSubmit}\n isDisabled={isSubmitDisabled || isLoading}\n >\n {isLoading ? \"...\" : submitLabel}\n </Button>\n </Flex>\n </Dialog>\n </DialogModal>\n );\n}\n"],"names":["FormModal","isOpen","title","submitLabel","cancelLabel","isLoading","isSubmitDisabled","size","onSubmit","onClose","children","DialogModal","open","jsxs","Dialog","clsx","Flex","jsx","DialogTitle","DialogClose","DialogBody","Button"],"mappings":";;;;;;AAiCO,SAASA,EAAU;AAAA,EACxB,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,aAAAC,IAAc;AAAA,EACd,WAAAC,IAAY;AAAA,EACZ,kBAAAC,IAAmB;AAAA,EACnB,MAAAC,IAAO;AAAA,EACP,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AACF,GAAmB;AACjB,SAAKT,sBAGFU,GAAA,EAAY,QAAAV,GAAgB,cAAc,CAACW,MAAS,CAACA,KAAQH,KAC5D,UAAA,gBAAAI,EAACC,KAAO,WAAWC,EAAK,cAAc,eAAeR,CAAI,EAAE,GACzD,UAAA;AAAA,IAAA,gBAAAM,EAACG,KAAK,WAAU,OAAM,cAAa,iBAAgB,gBAAe,UAChE,UAAA;AAAA,MAAA,gBAAAC,EAACC,KAAa,UAAAhB,EAAA,CAAM;AAAA,MACpB,gBAAAe,EAACE,GAAA,EAAY,SAASV,EAAA,CAAS;AAAA,IAAA,GACjC;AAAA,IACA,gBAAAQ,EAACG,KACC,UAAA,gBAAAH,EAACD,GAAA,EAAK,WAAU,UAAS,KAAI,OAC1B,UAAAN,EAAA,CACH,EAAA,CACF;AAAA,IACA,gBAAAG;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,KAAI;AAAA,QACJ,cAAa;AAAA,QACb,WAAU;AAAA,QAEV,UAAA;AAAA,UAAA,gBAAAC,EAACI,KAAO,SAAQ,WAAU,SAASZ,GAAS,YAAYJ,GACrD,UAAAD,EAAA,CACH;AAAA,UACA,gBAAAa;AAAA,YAACI;AAAA,YAAA;AAAA,cACC,SAAQ;AAAA,cACR,SAASb;AAAA,cACT,YAAYF,KAAoBD;AAAA,cAE/B,cAAY,QAAQF;AAAA,YAAA;AAAA,UAAA;AAAA,QACvB;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,EAAA,CACF,EAAA,CACF,IAhCkB;AAkCtB;"}
1
+ {"version":3,"file":"FormModal.js","sources":["../../../../../src/ui/components/FormModal/FormModal.tsx"],"sourcesContent":["import {\n Button,\n Dialog,\n DialogBody,\n DialogClose,\n DialogModal,\n DialogTitle,\n type DialogSize,\n} from \"primitives\";\nimport { Flex } from \"layout\";\nimport type { ReactNode } from \"react\";\nimport \"./formmodal.css\";\n\nexport type FormModalSize = DialogSize;\n\nexport interface FormModalProps {\n isOpen: boolean;\n title: string;\n submitLabel?: string;\n cancelLabel?: string;\n isLoading?: boolean;\n isSubmitDisabled?: boolean;\n /**\n * Maximum width of the dialog. Defaults to `\"medium\"`, which preserves the\n * previous fixed width. Use `\"large\"`/`\"xlarge\"` for forms that embed wide\n * content such as tables.\n */\n size?: FormModalSize;\n onSubmit: () => void;\n onClose: () => void;\n children: ReactNode;\n}\n\nexport function FormModal({\n isOpen,\n title,\n submitLabel = \"Save\",\n cancelLabel = \"Cancel\",\n isLoading = false,\n isSubmitDisabled = false,\n size = \"medium\",\n onSubmit,\n onClose,\n children,\n}: FormModalProps) {\n if (!isOpen) return null;\n\n return (\n <DialogModal isOpen={isOpen} onOpenChange={(open) => !open && onClose()}>\n <Dialog className=\"form-modal\" size={size}>\n <Flex direction=\"row\" alignPrimary=\"space-between\" alignSecondary=\"center\">\n <DialogTitle>{title}</DialogTitle>\n <DialogClose onPress={onClose} />\n </Flex>\n <DialogBody>\n <Flex direction=\"column\" gap=\"300\">\n {children}\n </Flex>\n </DialogBody>\n <Flex\n direction=\"row\"\n gap=\"200\"\n alignPrimary=\"end\"\n className=\"form-modal-footer\"\n >\n <Button variant=\"neutral\" onPress={onClose} isDisabled={isLoading}>\n {cancelLabel}\n </Button>\n <Button\n variant=\"primary\"\n onPress={onSubmit}\n isDisabled={isSubmitDisabled || isLoading}\n >\n {isLoading ? \"...\" : submitLabel}\n </Button>\n </Flex>\n </Dialog>\n </DialogModal>\n );\n}\n"],"names":["FormModal","isOpen","title","submitLabel","cancelLabel","isLoading","isSubmitDisabled","size","onSubmit","onClose","children","jsx","DialogModal","open","jsxs","Dialog","Flex","DialogTitle","DialogClose","DialogBody","Button"],"mappings":";;;;;AAiCO,SAASA,EAAU;AAAA,EACxB,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,aAAAC,IAAc;AAAA,EACd,WAAAC,IAAY;AAAA,EACZ,kBAAAC,IAAmB;AAAA,EACnB,MAAAC,IAAO;AAAA,EACP,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AACF,GAAmB;AACjB,SAAKT,IAGH,gBAAAU,EAACC,GAAA,EAAY,QAAAX,GAAgB,cAAc,CAACY,MAAS,CAACA,KAAQJ,EAAA,GAC5D,UAAA,gBAAAK,EAACC,GAAA,EAAO,WAAU,cAAa,MAAAR,GAC7B,UAAA;AAAA,IAAA,gBAAAO,EAACE,KAAK,WAAU,OAAM,cAAa,iBAAgB,gBAAe,UAChE,UAAA;AAAA,MAAA,gBAAAL,EAACM,KAAa,UAAAf,EAAA,CAAM;AAAA,MACpB,gBAAAS,EAACO,GAAA,EAAY,SAAST,EAAA,CAAS;AAAA,IAAA,GACjC;AAAA,IACA,gBAAAE,EAACQ,KACC,UAAA,gBAAAR,EAACK,GAAA,EAAK,WAAU,UAAS,KAAI,OAC1B,UAAAN,EAAA,CACH,EAAA,CACF;AAAA,IACA,gBAAAI;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,KAAI;AAAA,QACJ,cAAa;AAAA,QACb,WAAU;AAAA,QAEV,UAAA;AAAA,UAAA,gBAAAL,EAACS,KAAO,SAAQ,WAAU,SAASX,GAAS,YAAYJ,GACrD,UAAAD,EAAA,CACH;AAAA,UACA,gBAAAO;AAAA,YAACS;AAAA,YAAA;AAAA,cACC,SAAQ;AAAA,cACR,SAASZ;AAAA,cACT,YAAYF,KAAoBD;AAAA,cAE/B,cAAY,QAAQF;AAAA,YAAA;AAAA,UAAA;AAAA,QACvB;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,EAAA,CACF,EAAA,CACF,IAhCkB;AAkCtB;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),l=require("../../../vendor/clsx/dist/clsx.cjs"),t=require("react-aria-components");;/* empty css */const m=require("../../icons/IconX.cjs"),r=require("../Text/Text.cjs"),c=require("../IconButton/IconButton.cjs"),j=require("../Button/Button.cjs"),N=require("../../hooks/useOverlayPortal.cjs");function u({className:o,type:e="card",...a}){const i=l.clsx(o,"dialog",`dialog-type-${e}`);return s.jsx(t.Dialog,{className:i,...a})}const y=({onPress:o})=>s.jsx(c.IconButton,{className:"dialog-close","aria-label":"Dismiss dialog",onPress:o,variant:"subtle",size:"small",children:s.jsx(m.IconX,{})});function g({...o}){return s.jsx(t.DialogTrigger,{...o})}function B({label:o,icon:e,variant:a,children:i,...n}){return s.jsxs(g,{children:[e?s.jsx(c.IconButton,{variant:a,"aria-label":o,children:e}):s.jsx(j.Button,{variant:a,children:o}),s.jsx(d,{isDismissable:!0,children:s.jsx(u,{...n,children:i})})]})}function T({className:o,...e}){const a=l.clsx(o,"dialog-title");return s.jsx(r.TextHeading,{...e,slot:"title",className:a})}function b({className:o,...e}){const a=l.clsx(o,"dialog-description");return s.jsx(r.Text,{...e,className:a})}function p({bleed:o,className:e,...a}){const i=l.clsx(e,"dialog-body",o&&"dialog-body-bleed");return s.jsx("div",{...a,className:i})}function d({children:o,className:e,isDismissable:a,UNSTABLE_portalContainer:i,...n}){const x=l.clsx(e,"dialog-backdrop"),D=N.useOverlayPortalContainer();return s.jsx(t.ModalOverlay,{className:x,isDismissable:a,...n,UNSTABLE_portalContainer:i??D,children:s.jsx(t.Modal,{className:"dialog-container",children:o})})}exports.Dialog=u;exports.DialogBody=p;exports.DialogButton=B;exports.DialogClose=y;exports.DialogDescription=b;exports.DialogModal=d;exports.DialogTitle=T;exports.DialogTrigger=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("../../../vendor/clsx/dist/clsx.cjs"),n=require("react-aria-components");;/* empty css */const m=require("../../icons/IconX.cjs"),r=require("../Text/Text.cjs"),c=require("../IconButton/IconButton.cjs"),j=require("../Button/Button.cjs"),N=require("../../hooks/useOverlayPortal.cjs");function u({className:o,type:s="card",size:i="medium",...a}){const l=t.clsx(o,"dialog",`dialog-type-${s}`,`dialog-size-${i}`);return e.jsx(n.Dialog,{className:l,...a})}const y=({onPress:o})=>e.jsx(c.IconButton,{className:"dialog-close","aria-label":"Dismiss dialog",onPress:o,variant:"subtle",size:"small",children:e.jsx(m.IconX,{})});function g({...o}){return e.jsx(n.DialogTrigger,{...o})}function B({label:o,icon:s,variant:i,children:a,...l}){return e.jsxs(g,{children:[s?e.jsx(c.IconButton,{variant:i,"aria-label":o,children:s}):e.jsx(j.Button,{variant:i,children:o}),e.jsx(d,{isDismissable:!0,children:e.jsx(u,{...l,children:a})})]})}function T({className:o,...s}){const i=t.clsx(o,"dialog-title");return e.jsx(r.TextHeading,{...s,slot:"title",className:i})}function b({className:o,...s}){const i=t.clsx(o,"dialog-description");return e.jsx(r.Text,{...s,className:i})}function p({bleed:o,className:s,...i}){const a=t.clsx(s,"dialog-body",o&&"dialog-body-bleed");return e.jsx("div",{...i,className:a})}function d({children:o,className:s,isDismissable:i,UNSTABLE_portalContainer:a,...l}){const x=t.clsx(s,"dialog-backdrop"),D=N.useOverlayPortalContainer();return e.jsx(n.ModalOverlay,{className:x,isDismissable:i,...l,UNSTABLE_portalContainer:a??D,children:e.jsx(n.Modal,{className:"dialog-container",children:o})})}exports.Dialog=u;exports.DialogBody=p;exports.DialogButton=B;exports.DialogClose=y;exports.DialogDescription=b;exports.DialogModal=d;exports.DialogTitle=T;exports.DialogTrigger=g;
2
2
  //# sourceMappingURL=Dialog.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.cjs","sources":["../../../../../src/ui/primitives/Dialog/Dialog.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconX } from \"icons\";\nimport {\n Button,\n ButtonProps,\n IconButton,\n IconButtonProps,\n Text,\n TextHeading,\n type TextHeadingProps,\n type TextProps,\n} from \"primitives\";\nimport {\n Dialog as RACDialog,\n DialogTrigger as RACDialogTrigger,\n Modal as RACModal,\n ModalOverlay as RACModalOverlay,\n type DialogProps as RACDialogProps,\n type DialogTriggerProps as RACDialogTriggerProps,\n type ModalOverlayProps as RACModalOverlayProps,\n} from \"react-aria-components\";\nimport \"./dialog.css\";\n\nexport type DialogProps = RACDialogProps & {\n type?: \"sheet\" | \"card\";\n};\nexport function Dialog({ className, type = \"card\", ...props }: DialogProps) {\n const classNames = clsx(className, \"dialog\", `dialog-type-${type}`);\n return <RACDialog className={classNames} {...props} />;\n}\n\nexport type DialogCloseProps = Pick<IconButtonProps, \"onPress\">;\nexport const DialogClose = ({ onPress }: DialogCloseProps) => (\n <IconButton\n className=\"dialog-close\"\n aria-label=\"Dismiss dialog\"\n onPress={onPress}\n variant=\"subtle\"\n size=\"small\"\n >\n <IconX />\n </IconButton>\n);\n\nexport type DialogTriggerProps = RACDialogTriggerProps;\nexport function DialogTrigger({ ...props }: DialogTriggerProps) {\n return <RACDialogTrigger {...props} />;\n}\n\nexport interface DialogButtonProps\n extends DialogProps,\n Omit<DialogTriggerProps, \"children\"> {\n label: string;\n variant?: ButtonProps[\"variant\"];\n icon?: React.ReactNode;\n}\nexport function DialogButton({\n label,\n icon,\n variant,\n children,\n ...props\n}: DialogButtonProps) {\n return (\n <DialogTrigger>\n {icon ? (\n <IconButton variant={variant} aria-label={label}>\n {icon}\n </IconButton>\n ) : (\n <Button variant={variant}>{label}</Button>\n )}\n <DialogModal isDismissable>\n <Dialog {...props}>{children}</Dialog>\n </DialogModal>\n </DialogTrigger>\n );\n}\n\nexport type DialogTitleProps = TextHeadingProps;\nexport function DialogTitle({ className, ...props }: DialogTitleProps) {\n const classNames = clsx(className, \"dialog-title\");\n return <TextHeading {...props} slot=\"title\" className={classNames} />;\n}\n\nexport type DialogDescriptionProps = TextProps;\nexport function DialogDescription({\n className,\n ...props\n}: DialogDescriptionProps) {\n const classNames = clsx(className, \"dialog-description\");\n return <Text {...props} className={classNames} />;\n}\n\nexport type DialogBodyProps = {\n bleed?: boolean;\n} & React.ComponentPropsWithoutRef<\"div\">;\nexport function DialogBody({ bleed, className, ...props }: DialogBodyProps) {\n const classNames = clsx(\n className,\n \"dialog-body\",\n bleed && \"dialog-body-bleed\",\n );\n return <div {...props} className={classNames} />;\n}\n\nexport type DialogModalProps = RACModalOverlayProps;\nexport function DialogModal({\n children,\n className,\n isDismissable,\n UNSTABLE_portalContainer,\n ...props\n}: DialogModalProps) {\n const classNames = clsx(className, \"dialog-backdrop\");\n // Sem um container explícito, o RAC faz portal no document.body — fora da\n // shadow root do MFE, onde o CSS do DS não alcança, e o dialog abre sem\n // estilo. Ver OverlayPortalProvider em ui/hooks/useOverlayPortal.\n const portalContainer = useOverlayPortalContainer();\n return (\n <RACModalOverlay\n className={classNames}\n isDismissable={isDismissable}\n {...props}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer ?? portalContainer}\n >\n <RACModal className={\"dialog-container\"}>{children}</RACModal>\n </RACModalOverlay>\n );\n}\n"],"names":["Dialog","className","type","props","classNames","clsx","jsx","RACDialog","DialogClose","onPress","IconButton","IconX","DialogTrigger","RACDialogTrigger","DialogButton","label","icon","variant","children","Button","DialogModal","DialogTitle","TextHeading","DialogDescription","Text","DialogBody","bleed","isDismissable","UNSTABLE_portalContainer","portalContainer","useOverlayPortalContainer","RACModalOverlay","RACModal"],"mappings":"qaA2BO,SAASA,EAAO,CAAE,UAAAC,EAAW,KAAAC,EAAO,OAAQ,GAAGC,GAAsB,CAC1E,MAAMC,EAAaC,EAAAA,KAAKJ,EAAW,SAAU,eAAeC,CAAI,EAAE,EAClE,OAAOI,EAAAA,IAACC,EAAAA,OAAA,CAAU,UAAWH,EAAa,GAAGD,EAAO,CACtD,CAGO,MAAMK,EAAc,CAAC,CAAE,QAAAC,CAAA,IAC5BH,EAAAA,IAACI,EAAAA,WAAA,CACC,UAAU,eACV,aAAW,iBACX,QAAAD,EACA,QAAQ,SACR,KAAK,QAEL,eAACE,EAAAA,MAAA,CAAA,CAAM,CAAA,CACT,EAIK,SAASC,EAAc,CAAE,GAAGT,GAA6B,CAC9D,OAAOG,MAACO,EAAAA,cAAA,CAAkB,GAAGV,CAAA,CAAO,CACtC,CASO,SAASW,EAAa,CAC3B,MAAAC,EACA,KAAAC,EACA,QAAAC,EACA,SAAAC,EACA,GAAGf,CACL,EAAsB,CACpB,cACGS,EAAA,CACE,SAAA,CAAAI,EACCV,EAAAA,IAACI,EAAAA,WAAA,CAAW,QAAAO,EAAkB,aAAYF,EACvC,WACH,EAEAT,EAAAA,IAACa,EAAAA,OAAA,CAAO,QAAAF,EAAmB,SAAAF,EAAM,EAEnCT,EAAAA,IAACc,GAAY,cAAa,GACxB,eAACpB,EAAA,CAAQ,GAAGG,EAAQ,SAAAe,CAAA,CAAS,CAAA,CAC/B,CAAA,EACF,CAEJ,CAGO,SAASG,EAAY,CAAE,UAAApB,EAAW,GAAGE,GAA2B,CACrE,MAAMC,EAAaC,EAAAA,KAAKJ,EAAW,cAAc,EACjD,aAAQqB,EAAAA,YAAA,CAAa,GAAGnB,EAAO,KAAK,QAAQ,UAAWC,EAAY,CACrE,CAGO,SAASmB,EAAkB,CAChC,UAAAtB,EACA,GAAGE,CACL,EAA2B,CACzB,MAAMC,EAAaC,EAAAA,KAAKJ,EAAW,oBAAoB,EACvD,OAAOK,EAAAA,IAACkB,EAAAA,KAAA,CAAM,GAAGrB,EAAO,UAAWC,EAAY,CACjD,CAKO,SAASqB,EAAW,CAAE,MAAAC,EAAO,UAAAzB,EAAW,GAAGE,GAA0B,CAC1E,MAAMC,EAAaC,EAAAA,KACjBJ,EACA,cACAyB,GAAS,mBAAA,EAEX,OAAOpB,EAAAA,IAAC,MAAA,CAAK,GAAGH,EAAO,UAAWC,EAAY,CAChD,CAGO,SAASgB,EAAY,CAC1B,SAAAF,EACA,UAAAjB,EACA,cAAA0B,EACA,yBAAAC,EACA,GAAGzB,CACL,EAAqB,CACnB,MAAMC,EAAaC,EAAAA,KAAKJ,EAAW,iBAAiB,EAI9C4B,EAAkBC,EAAAA,0BAAA,EACxB,OACExB,EAAAA,IAACyB,EAAAA,aAAA,CACC,UAAW3B,EACX,cAAAuB,EACC,GAAGxB,EACJ,yBAA0ByB,GAA4BC,EAEtD,SAAAvB,EAAAA,IAAC0B,EAAAA,MAAA,CAAS,UAAW,mBAAqB,SAAAd,CAAA,CAAS,CAAA,CAAA,CAGzD"}
1
+ {"version":3,"file":"Dialog.cjs","sources":["../../../../../src/ui/primitives/Dialog/Dialog.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconX } from \"icons\";\nimport {\n Button,\n ButtonProps,\n IconButton,\n IconButtonProps,\n Text,\n TextHeading,\n type TextHeadingProps,\n type TextProps,\n} from \"primitives\";\nimport {\n Dialog as RACDialog,\n DialogTrigger as RACDialogTrigger,\n Modal as RACModal,\n ModalOverlay as RACModalOverlay,\n type DialogProps as RACDialogProps,\n type DialogTriggerProps as RACDialogTriggerProps,\n type ModalOverlayProps as RACModalOverlayProps,\n} from \"react-aria-components\";\nimport \"./dialog.css\";\n\nexport type DialogSize = \"medium\" | \"large\" | \"xlarge\";\n\nexport type DialogProps = RACDialogProps & {\n type?: \"sheet\" | \"card\";\n size?: DialogSize;\n};\nexport function Dialog({\n className,\n type = \"card\",\n size = \"medium\",\n ...props\n}: DialogProps) {\n const classNames = clsx(\n className,\n \"dialog\",\n `dialog-type-${type}`,\n `dialog-size-${size}`,\n );\n return <RACDialog className={classNames} {...props} />;\n}\n\nexport type DialogCloseProps = Pick<IconButtonProps, \"onPress\">;\nexport const DialogClose = ({ onPress }: DialogCloseProps) => (\n <IconButton\n className=\"dialog-close\"\n aria-label=\"Dismiss dialog\"\n onPress={onPress}\n variant=\"subtle\"\n size=\"small\"\n >\n <IconX />\n </IconButton>\n);\n\nexport type DialogTriggerProps = RACDialogTriggerProps;\nexport function DialogTrigger({ ...props }: DialogTriggerProps) {\n return <RACDialogTrigger {...props} />;\n}\n\nexport interface DialogButtonProps\n extends DialogProps,\n Omit<DialogTriggerProps, \"children\"> {\n label: string;\n variant?: ButtonProps[\"variant\"];\n icon?: React.ReactNode;\n}\nexport function DialogButton({\n label,\n icon,\n variant,\n children,\n ...props\n}: DialogButtonProps) {\n return (\n <DialogTrigger>\n {icon ? (\n <IconButton variant={variant} aria-label={label}>\n {icon}\n </IconButton>\n ) : (\n <Button variant={variant}>{label}</Button>\n )}\n <DialogModal isDismissable>\n <Dialog {...props}>{children}</Dialog>\n </DialogModal>\n </DialogTrigger>\n );\n}\n\nexport type DialogTitleProps = TextHeadingProps;\nexport function DialogTitle({ className, ...props }: DialogTitleProps) {\n const classNames = clsx(className, \"dialog-title\");\n return <TextHeading {...props} slot=\"title\" className={classNames} />;\n}\n\nexport type DialogDescriptionProps = TextProps;\nexport function DialogDescription({\n className,\n ...props\n}: DialogDescriptionProps) {\n const classNames = clsx(className, \"dialog-description\");\n return <Text {...props} className={classNames} />;\n}\n\nexport type DialogBodyProps = {\n bleed?: boolean;\n} & React.ComponentPropsWithoutRef<\"div\">;\nexport function DialogBody({ bleed, className, ...props }: DialogBodyProps) {\n const classNames = clsx(\n className,\n \"dialog-body\",\n bleed && \"dialog-body-bleed\",\n );\n return <div {...props} className={classNames} />;\n}\n\nexport type DialogModalProps = RACModalOverlayProps;\nexport function DialogModal({\n children,\n className,\n isDismissable,\n UNSTABLE_portalContainer,\n ...props\n}: DialogModalProps) {\n const classNames = clsx(className, \"dialog-backdrop\");\n // Sem um container explícito, o RAC faz portal no document.body — fora da\n // shadow root do MFE, onde o CSS do DS não alcança, e o dialog abre sem\n // estilo. Ver OverlayPortalProvider em ui/hooks/useOverlayPortal.\n const portalContainer = useOverlayPortalContainer();\n return (\n <RACModalOverlay\n className={classNames}\n isDismissable={isDismissable}\n {...props}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer ?? portalContainer}\n >\n <RACModal className={\"dialog-container\"}>{children}</RACModal>\n </RACModalOverlay>\n );\n}\n"],"names":["Dialog","className","type","size","props","classNames","clsx","jsx","RACDialog","DialogClose","onPress","IconButton","IconX","DialogTrigger","RACDialogTrigger","DialogButton","label","icon","variant","children","Button","DialogModal","DialogTitle","TextHeading","DialogDescription","Text","DialogBody","bleed","isDismissable","UNSTABLE_portalContainer","portalContainer","useOverlayPortalContainer","RACModalOverlay","RACModal"],"mappings":"qaA8BO,SAASA,EAAO,CACrB,UAAAC,EACA,KAAAC,EAAO,OACP,KAAAC,EAAO,SACP,GAAGC,CACL,EAAgB,CACd,MAAMC,EAAaC,EAAAA,KACjBL,EACA,SACA,eAAeC,CAAI,GACnB,eAAeC,CAAI,EAAA,EAErB,OAAOI,EAAAA,IAACC,EAAAA,OAAA,CAAU,UAAWH,EAAa,GAAGD,EAAO,CACtD,CAGO,MA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AY,CAChD,CAGO,SAASgB,EAAY,CAC1B,SAAAF,EACA,UAAAlB,EACA,cAAA2B,EACA,yBAAAC,EACA,GAAGzB,CACL,EAAqB,CACnB,MAAMC,EAAaC,EAAAA,KAAKL,EAAW,iBAAiB,EAI9C6B,EAAkBC,EAAAA,0BAAA,EACxB,OACExB,EAAAA,IAACyB,EAAAA,aAAA,CACC,UAAW3B,EACX,cAAAuB,EACC,GAAGxB,EACJ,yBAA0ByB,GAA4BC,EAEtD,SAAAvB,EAAAA,IAAC0B,EAAAA,MAAA,CAAS,UAAW,mBAAqB,SAAAd,CAAA,CAAS,CAAA,CAAA,CAGzD"}
@@ -1,17 +1,27 @@
1
1
  import { jsx as a, jsxs as m } from "react/jsx-runtime";
2
- import { clsx as s } from "../../../vendor/clsx/dist/clsx.js";
3
- import { Dialog as g, DialogTrigger as d, ModalOverlay as u, Modal as p } from "react-aria-components";
2
+ import { clsx as t } from "../../../vendor/clsx/dist/clsx.js";
3
+ import { Dialog as d, DialogTrigger as g, ModalOverlay as u, Modal as p } from "react-aria-components";
4
4
  /* empty css */
5
5
  import { IconX as f } from "../../icons/IconX.js";
6
6
  import { TextHeading as D, Text as N } from "../Text/Text.js";
7
7
  import { IconButton as e } from "../IconButton/IconButton.js";
8
8
  import { Button as b } from "../Button/Button.js";
9
9
  import { useOverlayPortalContainer as T } from "../../hooks/useOverlayPortal.js";
10
- function h({ className: o, type: i = "card", ...l }) {
11
- const r = s(o, "dialog", `dialog-type-${i}`);
12
- return /* @__PURE__ */ a(g, { className: r, ...l });
10
+ function h({
11
+ className: o,
12
+ type: i = "card",
13
+ size: l = "medium",
14
+ ...r
15
+ }) {
16
+ const s = t(
17
+ o,
18
+ "dialog",
19
+ `dialog-type-${i}`,
20
+ `dialog-size-${l}`
21
+ );
22
+ return /* @__PURE__ */ a(d, { className: s, ...r });
13
23
  }
14
- const z = ({ onPress: o }) => /* @__PURE__ */ a(
24
+ const k = ({ onPress: o }) => /* @__PURE__ */ a(
15
25
  e,
16
26
  {
17
27
  className: "dialog-close",
@@ -23,33 +33,33 @@ const z = ({ onPress: o }) => /* @__PURE__ */ a(
23
33
  }
24
34
  );
25
35
  function x({ ...o }) {
26
- return /* @__PURE__ */ a(d, { ...o });
36
+ return /* @__PURE__ */ a(g, { ...o });
27
37
  }
28
38
  function A({
29
39
  label: o,
30
40
  icon: i,
31
41
  variant: l,
32
42
  children: r,
33
- ...t
43
+ ...s
34
44
  }) {
35
45
  return /* @__PURE__ */ m(x, { children: [
36
46
  i ? /* @__PURE__ */ a(e, { variant: l, "aria-label": o, children: i }) : /* @__PURE__ */ a(b, { variant: l, children: o }),
37
- /* @__PURE__ */ a(y, { isDismissable: !0, children: /* @__PURE__ */ a(h, { ...t, children: r }) })
47
+ /* @__PURE__ */ a(y, { isDismissable: !0, children: /* @__PURE__ */ a(h, { ...s, children: r }) })
38
48
  ] });
39
49
  }
40
50
  function E({ className: o, ...i }) {
41
- const l = s(o, "dialog-title");
51
+ const l = t(o, "dialog-title");
42
52
  return /* @__PURE__ */ a(D, { ...i, slot: "title", className: l });
43
53
  }
44
54
  function H({
45
55
  className: o,
46
56
  ...i
47
57
  }) {
48
- const l = s(o, "dialog-description");
58
+ const l = t(o, "dialog-description");
49
59
  return /* @__PURE__ */ a(N, { ...i, className: l });
50
60
  }
51
61
  function L({ bleed: o, className: i, ...l }) {
52
- const r = s(
62
+ const r = t(
53
63
  i,
54
64
  "dialog-body",
55
65
  o && "dialog-body-bleed"
@@ -61,15 +71,15 @@ function y({
61
71
  className: i,
62
72
  isDismissable: l,
63
73
  UNSTABLE_portalContainer: r,
64
- ...t
74
+ ...s
65
75
  }) {
66
- const n = s(i, "dialog-backdrop"), c = T();
76
+ const n = t(i, "dialog-backdrop"), c = T();
67
77
  return /* @__PURE__ */ a(
68
78
  u,
69
79
  {
70
80
  className: n,
71
81
  isDismissable: l,
72
- ...t,
82
+ ...s,
73
83
  UNSTABLE_portalContainer: r ?? c,
74
84
  children: /* @__PURE__ */ a(p, { className: "dialog-container", children: o })
75
85
  }
@@ -79,7 +89,7 @@ export {
79
89
  h as Dialog,
80
90
  L as DialogBody,
81
91
  A as DialogButton,
82
- z as DialogClose,
92
+ k as DialogClose,
83
93
  H as DialogDescription,
84
94
  y as DialogModal,
85
95
  E as DialogTitle,
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sources":["../../../../../src/ui/primitives/Dialog/Dialog.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconX } from \"icons\";\nimport {\n Button,\n ButtonProps,\n IconButton,\n IconButtonProps,\n Text,\n TextHeading,\n type TextHeadingProps,\n type TextProps,\n} from \"primitives\";\nimport {\n Dialog as RACDialog,\n DialogTrigger as RACDialogTrigger,\n Modal as RACModal,\n ModalOverlay as RACModalOverlay,\n type DialogProps as RACDialogProps,\n type DialogTriggerProps as RACDialogTriggerProps,\n type ModalOverlayProps as RACModalOverlayProps,\n} from \"react-aria-components\";\nimport \"./dialog.css\";\n\nexport type DialogProps = RACDialogProps & {\n type?: \"sheet\" | \"card\";\n};\nexport function Dialog({ className, type = \"card\", ...props }: DialogProps) {\n const classNames = clsx(className, \"dialog\", `dialog-type-${type}`);\n return <RACDialog className={classNames} {...props} />;\n}\n\nexport type DialogCloseProps = Pick<IconButtonProps, \"onPress\">;\nexport const DialogClose = ({ onPress }: DialogCloseProps) => (\n <IconButton\n className=\"dialog-close\"\n aria-label=\"Dismiss dialog\"\n onPress={onPress}\n variant=\"subtle\"\n size=\"small\"\n >\n <IconX />\n </IconButton>\n);\n\nexport type DialogTriggerProps = RACDialogTriggerProps;\nexport function DialogTrigger({ ...props }: DialogTriggerProps) {\n return <RACDialogTrigger {...props} />;\n}\n\nexport interface DialogButtonProps\n extends DialogProps,\n Omit<DialogTriggerProps, \"children\"> {\n label: string;\n variant?: ButtonProps[\"variant\"];\n icon?: React.ReactNode;\n}\nexport function DialogButton({\n label,\n icon,\n variant,\n children,\n ...props\n}: DialogButtonProps) {\n return (\n <DialogTrigger>\n {icon ? (\n <IconButton variant={variant} aria-label={label}>\n {icon}\n </IconButton>\n ) : (\n <Button variant={variant}>{label}</Button>\n )}\n <DialogModal isDismissable>\n <Dialog {...props}>{children}</Dialog>\n </DialogModal>\n </DialogTrigger>\n );\n}\n\nexport type DialogTitleProps = TextHeadingProps;\nexport function DialogTitle({ className, ...props }: DialogTitleProps) {\n const classNames = clsx(className, \"dialog-title\");\n return <TextHeading {...props} slot=\"title\" className={classNames} />;\n}\n\nexport type DialogDescriptionProps = TextProps;\nexport function DialogDescription({\n className,\n ...props\n}: DialogDescriptionProps) {\n const classNames = clsx(className, \"dialog-description\");\n return <Text {...props} className={classNames} />;\n}\n\nexport type DialogBodyProps = {\n bleed?: boolean;\n} & React.ComponentPropsWithoutRef<\"div\">;\nexport function DialogBody({ bleed, className, ...props }: DialogBodyProps) {\n const classNames = clsx(\n className,\n \"dialog-body\",\n bleed && \"dialog-body-bleed\",\n );\n return <div {...props} className={classNames} />;\n}\n\nexport type DialogModalProps = RACModalOverlayProps;\nexport function DialogModal({\n children,\n className,\n isDismissable,\n UNSTABLE_portalContainer,\n ...props\n}: DialogModalProps) {\n const classNames = clsx(className, \"dialog-backdrop\");\n // Sem um container explícito, o RAC faz portal no document.body — fora da\n // shadow root do MFE, onde o CSS do DS não alcança, e o dialog abre sem\n // estilo. Ver OverlayPortalProvider em ui/hooks/useOverlayPortal.\n const portalContainer = useOverlayPortalContainer();\n return (\n <RACModalOverlay\n className={classNames}\n isDismissable={isDismissable}\n {...props}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer ?? portalContainer}\n >\n <RACModal className={\"dialog-container\"}>{children}</RACModal>\n </RACModalOverlay>\n );\n}\n"],"names":["Dialog","className","type","props","classNames","clsx","jsx","RACDialog","DialogClose","onPress","IconButton","IconX","DialogTrigger","RACDialogTrigger","DialogButton","label","icon","variant","children","Button","DialogModal","DialogTitle","TextHeading","DialogDescription","Text","DialogBody","bleed","isDismissable","U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C,WAAAtB;AAAA,EACA,GAAGE;AACL,GAA2B;AACzB,QAAMC,IAAaC,EAAKJ,GAAW,oBAAoB;AACvD,SAAO,gBAAAK,EAACkB,GAAA,EAAM,GAAGrB,GAAO,WAAWC,GAAY;AACjD;AAKO,SAASqB,EAAW,EAAE,OAAAC,GAAO,WAAAzB,GAAW,GAAGE,KAA0B;AAC1E,QAAMC,IAAaC;AAAA,IACjBJ;AAAA,IACA;AAAA,IACAyB,KAAS;AAAA,EAAA;AAEX,SAAO,gBAAApB,EAAC,OAAA,EAAK,GAAGH,GAAO,WAAWC,GAAY;AAChD;AAGO,SAASgB,EAAY;AAAA,EAC1B,UAAAF;AAAA,EACA,WAAAjB;AAAA,EACA,eAAA0B;AAAA,EACA,0BAAAC;AAAA,EACA,GAAGzB;AACL,GAAqB;AACnB,QAAMC,IAAaC,EAAKJ,GAAW,iBAAiB,GAI9C4B,IAAkBC,EAAA;AACxB,SACE,gBAAAxB;AAAA,IAACyB;AAAAA,IAAA;AAAA,MACC,WAAW3B;AAAA,MACX,eAAAuB;AAAA,MACC,GAAGxB;AAAA,MACJ,0BAA0ByB,KAA4BC;AAAA,MAEtD,UAAA,gBAAAvB,EAAC0B,GAAA,EAAS,WAAW,oBAAqB,UAAAd,EAAA,CAAS;AAAA,IAAA;AAAA,EAAA;AAGzD;"}
1
+ {"version":3,"file":"Dialog.js","sources":["../../../../../src/ui/primitives/Dialog/Dialog.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconX } from \"icons\";\nimport {\n Button,\n ButtonProps,\n IconButton,\n IconButtonProps,\n Text,\n TextHeading,\n type TextHeadingProps,\n type TextProps,\n} from \"primitives\";\nimport {\n Dialog as RACDialog,\n DialogTrigger as RACDialogTrigger,\n Modal as RACModal,\n ModalOverlay as RACModalOverlay,\n type DialogProps as RACDialogProps,\n type DialogTriggerProps as RACDialogTriggerProps,\n type ModalOverlayProps as RACModalOverlayProps,\n} from \"react-aria-components\";\nimport \"./dialog.css\";\n\nexport type DialogSize = \"medium\" | \"large\" | \"xlarge\";\n\nexport type DialogProps = RACDialogProps & {\n type?: \"sheet\" | \"card\";\n size?: DialogSize;\n};\nexport function Dialog({\n className,\n type = \"card\",\n size = \"medium\",\n ...props\n}: DialogProps) {\n const classNames = clsx(\n className,\n \"dialog\",\n `dialog-type-${type}`,\n `dialog-size-${size}`,\n );\n return <RACDialog className={classNames} {...props} />;\n}\n\nexport type DialogCloseProps = Pick<IconButtonProps, \"onPress\">;\nexport const DialogClose = ({ onPress }: DialogCloseProps) => (\n <IconButton\n className=\"dialog-close\"\n aria-label=\"Dismiss dialog\"\n onPress={onPress}\n variant=\"subtle\"\n size=\"small\"\n >\n <IconX />\n </IconButton>\n);\n\nexport type DialogTriggerProps = RACDialogTriggerProps;\nexport function DialogTrigger({ ...props }: DialogTriggerProps) {\n return <RACDialogTrigger {...props} />;\n}\n\nexport interface DialogButtonProps\n extends DialogProps,\n Omit<DialogTriggerProps, \"children\"> {\n label: string;\n variant?: ButtonProps[\"variant\"];\n icon?: React.ReactNode;\n}\nexport function DialogButton({\n label,\n icon,\n variant,\n children,\n ...props\n}: DialogButtonProps) {\n return (\n <DialogTrigger>\n {icon ? (\n <IconButton variant={variant} aria-label={label}>\n {icon}\n </IconButton>\n ) : (\n <Button variant={variant}>{label}</Button>\n )}\n <DialogModal isDismissable>\n <Dialog {...props}>{children}</Dialog>\n </DialogModal>\n </DialogTrigger>\n );\n}\n\nexport type DialogTitleProps = TextHeadingProps;\nexport function DialogTitle({ className, ...props }: DialogTitleProps) {\n const classNames = clsx(className, \"dialog-title\");\n return <TextHeading {...props} slot=\"title\" className={classNames} />;\n}\n\nexport type DialogDescriptionProps = TextProps;\nexport function DialogDescription({\n className,\n ...props\n}: DialogDescriptionProps) {\n const classNames = clsx(className, \"dialog-description\");\n return <Text {...props} className={classNames} />;\n}\n\nexport type DialogBodyProps = {\n bleed?: boolean;\n} & React.ComponentPropsWithoutRef<\"div\">;\nexport function DialogBody({ bleed, className, ...props }: DialogBodyProps) {\n const classNames = clsx(\n className,\n \"dialog-body\",\n bleed && \"dialog-body-bleed\",\n );\n return <div {...props} className={classNames} />;\n}\n\nexport type DialogModalProps = RACModalOverlayProps;\nexport function DialogModal({\n children,\n className,\n isDismissable,\n UNSTABLE_portalContainer,\n ...props\n}: DialogModalProps) {\n const classNames = clsx(className, \"dialog-backdrop\");\n // Sem um container explícito, o RAC faz portal no document.body — fora da\n // shadow root do MFE, onde o CSS do DS não alcança, e o dialog abre sem\n // estilo. Ver OverlayPortalProvider em ui/hooks/useOverlayPortal.\n const portalContainer = useOverlayPortalContainer();\n return (\n <RACModalOverlay\n className={classNames}\n isDismissable={isDismissable}\n {...props}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer ?? portalContainer}\n >\n <RACModal className={\"dialog-container\"}>{children}</RACModal>\n </RACModalOverlay>\n );\n}\n"],"names":["Dialog","className","type","size","props","classNames","clsx","jsx","RACDialog","DialogClose","onPress","IconButton","IconX","DialogTrigger","RACDialogTrigger","DialogButton","label","icon","variant","children","Button","DialogModal","DialogTitle","TextHeading","DialogDescription","Text","DialogBody","bleed","isDismissable","UNSTABLE_portalContainer","portalContainer","useOverlayPortalContainer","RACModalOverlay","RACModal"],"mappings":";;;;;;;;;AA8BO,SAASA,EAAO;AAAA,EACrB,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,MAAAC,IAAO;AAAA,EACP,GAAGC;AACL,GAAgB;AACd,QAAMC,IAAaC;AAAA,IACjBL;AAAA,IACA;AAAA,IACA,eAAeC,CAAI;AAAA,IACnB,eAAeC,CAAI;AAAA,EAAA;AAErB,SAAO,gBAAAI,EAACC,GAAA,EAAU,WAAWH,GAAa,GAAGD,GAAO;AACtD;AAGO,MAAMK,IAAc,CAAC,EAAE,SAAAC,EAAA,MAC5B,gBAAAH;AAAA,EAACI;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,cAAW;AAAA,IACX,SAAAD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AA,EACA,WAAAlB;AAAA,EACA,eAAA2B;AAAA,EACA,0BAAAC;AAAA,EACA,GAAGzB;AACL,GAAqB;AACnB,QAAMC,IAAaC,EAAKL,GAAW,iBAAiB,GAI9C6B,IAAkBC,EAAA;AACxB,SACE,gBAAAxB;AAAA,IAACyB;AAAAA,IAAA;AAAA,MACC,WAAW3B;AAAA,MACX,eAAAuB;AAAA,MACC,GAAGxB;AAAA,MACJ,0BAA0ByB,KAA4BC;AAAA,MAEtD,UAAA,gBAAAvB,EAAC0B,GAAA,EAAS,WAAW,oBAAqB,UAAAd,EAAA,CAAS;AAAA,IAAA;AAAA,EAAA;AAGzD;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),r=require("../../../vendor/clsx/dist/clsx.cjs"),h=require("react-aria-components");;/* empty css */const i=require("../Fieldset/Fieldset.cjs");function x({className:e,...c}){const t=r.clsx(e,"switch-group");return s.jsx("div",{...c,className:t})}function j({children:e,className:c,label:t,description:n,errorMessage:o,...u}){const d=r.clsx(c,"switch-field"),l=t||(typeof e=="string"?e:void 0);return s.jsx(h.Switch,{className:d,...u,children:s.jsxs(s.Fragment,{children:[s.jsx(i.Label,{children:l}),s.jsx(a,{}),n&&s.jsx(i.Description,{children:n}),s.jsx(i.FieldError,{children:o}),l!==e&&e]})})}function a({className:e,...c}){const t=r.clsx(e,"sds-switch");return s.jsx("div",{className:t,...c,children:s.jsx("span",{"aria-hidden":"true",className:"switch-icon"})})}exports.Switch=a;exports.SwitchField=j;exports.SwitchGroup=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),r=require("../../../vendor/clsx/dist/clsx.cjs"),x=require("react-aria-components");;/* empty css */const i=require("../Fieldset/Fieldset.cjs");function w({className:e,...t}){const c=r.clsx(e,"switch-group");return s.jsx("div",{...t,className:c})}function j({children:e,className:t,label:c,description:n,errorMessage:o,labelPosition:u="start",...d}){const h=r.clsx(t,"switch-field",`switch-field-label-${u}`),l=c||(typeof e=="string"?e:void 0);return s.jsx(x.Switch,{className:h,...d,children:s.jsxs(s.Fragment,{children:[s.jsx(i.Label,{children:l}),s.jsx(a,{}),n&&s.jsx(i.Description,{children:n}),s.jsx(i.FieldError,{children:o}),l!==e&&e]})})}function a({className:e,...t}){const c=r.clsx(e,"sds-switch");return s.jsx("div",{className:c,...t,children:s.jsx("span",{"aria-hidden":"true",className:"switch-icon"})})}exports.Switch=a;exports.SwitchField=j;exports.SwitchGroup=w;
2
2
  //# sourceMappingURL=Switch.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.cjs","sources":["../../../../../src/ui/primitives/Switch/Switch.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { Description, FieldError, Label, SharedFieldProps } from \"primitives\";\nimport type React from \"react\";\nimport {\n Switch as RACSwitch,\n type SwitchProps as RACSwitchProps,\n} from \"react-aria-components\";\nimport \"./switch.css\";\n\nexport type SwitchGroupProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function SwitchGroup({ className, ...props }: SwitchGroupProps) {\n const classNames = clsx(className, \"switch-group\");\n return <div {...props} className={classNames} />;\n}\n\nexport type SwitchFieldProps = RACSwitchProps & SharedFieldProps;\nexport function SwitchField({\n children,\n className,\n label,\n description,\n errorMessage,\n ...props\n}: SwitchFieldProps) {\n const classNames = clsx(className, \"switch-field\");\n const labelText: string | undefined =\n label || (typeof children === \"string\" ? children : undefined);\n return (\n <RACSwitch className={classNames} {...props}>\n <>\n <Label>{labelText}</Label>\n <Switch />\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n {labelText !== children && children}\n </>\n </RACSwitch>\n );\n}\n\nexport type SwitchProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function Switch({ className, ...props }: SwitchProps) {\n const classNames = clsx(className, \"sds-switch\");\n return (\n <div className={classNames} {...props}>\n <span aria-hidden=\"true\" className=\"switch-icon\" />\n </div>\n );\n}\n"],"names":["SwitchGroup","className","props","classNames","clsx","jsx","SwitchField","children","label","description","errorMessage","labelText","RACSwitch","jsxs","Fragment","Label","Switch","Description","FieldError"],"mappings":"gRAUO,SAASA,EAAY,CAAE,UAAAC,EAAW,GAAGC,GAA2B,CACrE,MAAMC,EAAaC,EAAAA,KAAKH,EAAW,cAAc,EACjD,OAAOI,EAAAA,IAAC,MAAA,CAAK,GAAGH,EAAO,UAAWC,EAAY,CAChD,CAGO,SAASG,EAAY,CAC1B,SAAAC,EACA,UAAAN,EACA,MAAAO,EACA,YAAAC,EACA,aAAAC,EACA,GAAGR,CACL,EAAqB,CACnB,MAAMC,EAAaC,EAAAA,KAAKH,EAAW,cAAc,EAC3CU,EACJH,IAAU,OAAOD,GAAa,SAAWA,EAAW,QACtD,aACGK,EAAAA,OAAA,CAAU,UAAWT,EAAa,GAAGD,EACpC,SAAAW,EAAAA,KAAAC,EAAAA,SAAA,CACE,SAAA,CAAAT,EAAAA,IAACU,EAAAA,OAAO,SAAAJ,CAAA,CAAU,QACjBK,EAAA,EAAO,EACPP,GAAeJ,EAAAA,IAACY,EAAAA,YAAA,CAAa,SAAAR,CAAA,CAAY,EAC1CJ,EAAAA,IAACa,EAAAA,YAAY,SAAAR,CAAA,CAAa,EACzBC,IAAcJ,GAAYA,CAAA,CAAA,CAC7B,CAAA,CACF,CAEJ,CAGO,SAASS,EAAO,CAAE,UAAAf,EAAW,GAAGC,GAAsB,CAC3D,MAAMC,EAAaC,EAAAA,KAAKH,EAAW,YAAY,EAC/C,OACEI,EAAAA,IAAC,MAAA,CAAI,UAAWF,EAAa,GAAGD,EAC9B,SAAAG,EAAAA,IAAC,OAAA,CAAK,cAAY,OAAO,UAAU,aAAA,CAAc,EACnD,CAEJ"}
1
+ {"version":3,"file":"Switch.cjs","sources":["../../../../../src/ui/primitives/Switch/Switch.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { Description, FieldError, Label, SharedFieldProps } from \"primitives\";\nimport type React from \"react\";\nimport {\n Switch as RACSwitch,\n type SwitchProps as RACSwitchProps,\n} from \"react-aria-components\";\nimport \"./switch.css\";\n\nexport type SwitchGroupProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function SwitchGroup({ className, ...props }: SwitchGroupProps) {\n const classNames = clsx(className, \"switch-group\");\n return <div {...props} className={classNames} />;\n}\n\nexport type SwitchFieldLabelPosition = \"start\" | \"end\";\n\nexport type SwitchFieldProps = RACSwitchProps &\n SharedFieldProps & {\n labelPosition?: SwitchFieldLabelPosition;\n };\nexport function SwitchField({\n children,\n className,\n label,\n description,\n errorMessage,\n labelPosition = \"start\",\n ...props\n}: SwitchFieldProps) {\n const classNames = clsx(\n className,\n \"switch-field\",\n `switch-field-label-${labelPosition}`,\n );\n const labelText: string | undefined =\n label || (typeof children === \"string\" ? children : undefined);\n return (\n <RACSwitch className={classNames} {...props}>\n <>\n <Label>{labelText}</Label>\n <Switch />\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n {labelText !== children && children}\n </>\n </RACSwitch>\n );\n}\n\nexport type SwitchProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function Switch({ className, ...props }: SwitchProps) {\n const classNames = clsx(className, \"sds-switch\");\n return (\n <div className={classNames} {...props}>\n <span aria-hidden=\"true\" className=\"switch-icon\" />\n </div>\n );\n}\n"],"names":["SwitchGroup","className","props","classNames","clsx","jsx","SwitchField","children","label","description","errorMessage","labelPosition","labelText","RACSwitch","jsxs","Fragment","Label","Switch","Description","FieldError"],"mappings":"gRAUO,SAASA,EAAY,CAAE,UAAAC,EAAW,GAAGC,GAA2B,CACrE,MAAMC,EAAaC,EAAAA,KAAKH,EAAW,cAAc,EACjD,OAAOI,EAAAA,IAAC,MAAA,CAAK,GAAGH,EAAO,UAAWC,EAAY,CAChD,CAQO,SAASG,EAAY,CAC1B,SAAAC,EACA,UAAAN,EACA,MAAAO,EACA,YAAAC,EACA,aAAAC,EACA,cAAAC,EAAgB,QAChB,GAAGT,CACL,EAAqB,CACnB,MAAMC,EAAaC,EAAAA,KACjBH,EACA,eACA,sBAAsBU,CAAa,EAAA,EAE/BC,EACJJ,IAAU,OAAOD,GAAa,SAAWA,EAAW,QACtD,aACGM,EAAAA,OAAA,CAAU,UAAWV,EAAa,GAAGD,EACpC,SAAAY,EAAAA,KAAAC,EAAAA,SAAA,CACE,SAAA,CAAAV,EAAAA,IAACW,EAAAA,OAAO,SAAAJ,CAAA,CAAU,QACjBK,EAAA,EAAO,EACPR,GAAeJ,EAAAA,IAACa,EAAAA,YAAA,CAAa,SAAAT,CAAA,CAAY,EAC1CJ,EAAAA,IAACc,EAAAA,YAAY,SAAAT,CAAA,CAAa,EACzBE,IAAcL,GAAYA,CAAA,CAAA,CAC7B,CAAA,CACF,CAEJ,CAGO,SAASU,EAAO,CAAE,UAAAhB,EAAW,GAAGC,GAAsB,CAC3D,MAAMC,EAAaC,EAAAA,KAAKH,EAAW,YAAY,EAC/C,OACEI,EAAAA,IAAC,MAAA,CAAI,UAAWF,EAAa,GAAGD,EAC9B,SAAAG,EAAAA,IAAC,OAAA,CAAK,cAAY,OAAO,UAAU,aAAA,CAAc,EACnD,CAEJ"}
@@ -1,36 +1,41 @@
1
- import { jsx as i, jsxs as m, Fragment as h } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as h, Fragment as d } from "react/jsx-runtime";
2
2
  import { clsx as r } from "../../../vendor/clsx/dist/clsx.js";
3
- import { Switch as d } from "react-aria-components";
3
+ import { Switch as f } from "react-aria-components";
4
4
  /* empty css */
5
- import { Label as p, Description as f, FieldError as u } from "../Fieldset/Fieldset.js";
6
- function F({ className: s, ...t }) {
5
+ import { Label as p, Description as w, FieldError as u } from "../Fieldset/Fieldset.js";
6
+ function F({ className: s, ...i }) {
7
7
  const c = r(s, "switch-group");
8
- return /* @__PURE__ */ i("div", { ...t, className: c });
8
+ return /* @__PURE__ */ t("div", { ...i, className: c });
9
9
  }
10
- function b({
10
+ function j({
11
11
  children: s,
12
- className: t,
12
+ className: i,
13
13
  label: c,
14
14
  description: e,
15
- errorMessage: a,
16
- ...n
15
+ errorMessage: o,
16
+ labelPosition: n = "start",
17
+ ...l
17
18
  }) {
18
- const l = r(t, "switch-field"), o = c || (typeof s == "string" ? s : void 0);
19
- return /* @__PURE__ */ i(d, { className: l, ...n, children: /* @__PURE__ */ m(h, { children: [
20
- /* @__PURE__ */ i(p, { children: o }),
21
- /* @__PURE__ */ i(w, {}),
22
- e && /* @__PURE__ */ i(f, { children: e }),
23
- /* @__PURE__ */ i(u, { children: a }),
24
- o !== s && s
19
+ const m = r(
20
+ i,
21
+ "switch-field",
22
+ `switch-field-label-${n}`
23
+ ), a = c || (typeof s == "string" ? s : void 0);
24
+ return /* @__PURE__ */ t(f, { className: m, ...l, children: /* @__PURE__ */ h(d, { children: [
25
+ /* @__PURE__ */ t(p, { children: a }),
26
+ /* @__PURE__ */ t(N, {}),
27
+ e && /* @__PURE__ */ t(w, { children: e }),
28
+ /* @__PURE__ */ t(u, { children: o }),
29
+ a !== s && s
25
30
  ] }) });
26
31
  }
27
- function w({ className: s, ...t }) {
32
+ function N({ className: s, ...i }) {
28
33
  const c = r(s, "sds-switch");
29
- return /* @__PURE__ */ i("div", { className: c, ...t, children: /* @__PURE__ */ i("span", { "aria-hidden": "true", className: "switch-icon" }) });
34
+ return /* @__PURE__ */ t("div", { className: c, ...i, children: /* @__PURE__ */ t("span", { "aria-hidden": "true", className: "switch-icon" }) });
30
35
  }
31
36
  export {
32
- w as Switch,
33
- b as SwitchField,
37
+ N as Switch,
38
+ j as SwitchField,
34
39
  F as SwitchGroup
35
40
  };
36
41
  //# sourceMappingURL=Switch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.js","sources":["../../../../../src/ui/primitives/Switch/Switch.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { Description, FieldError, Label, SharedFieldProps } from \"primitives\";\nimport type React from \"react\";\nimport {\n Switch as RACSwitch,\n type SwitchProps as RACSwitchProps,\n} from \"react-aria-components\";\nimport \"./switch.css\";\n\nexport type SwitchGroupProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function SwitchGroup({ className, ...props }: SwitchGroupProps) {\n const classNames = clsx(className, \"switch-group\");\n return <div {...props} className={classNames} />;\n}\n\nexport type SwitchFieldProps = RACSwitchProps & SharedFieldProps;\nexport function SwitchField({\n children,\n className,\n label,\n description,\n errorMessage,\n ...props\n}: SwitchFieldProps) {\n const classNames = clsx(className, \"switch-field\");\n const labelText: string | undefined =\n label || (typeof children === \"string\" ? children : undefined);\n return (\n <RACSwitch className={classNames} {...props}>\n <>\n <Label>{labelText}</Label>\n <Switch />\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n {labelText !== children && children}\n </>\n </RACSwitch>\n );\n}\n\nexport type SwitchProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function Switch({ className, ...props }: SwitchProps) {\n const classNames = clsx(className, \"sds-switch\");\n return (\n <div className={classNames} {...props}>\n <span aria-hidden=\"true\" className=\"switch-icon\" />\n </div>\n );\n}\n"],"names":["SwitchGroup","className","props","classNames","clsx","jsx","SwitchField","children","label","description","errorMessage","labelText","RACSwitch","jsxs","Fragment","Label","Switch","Description","FieldError"],"mappings":";;;;;AAUO,SAASA,EAAY,EAAE,WAAAC,GAAW,GAAGC,KAA2B;AACrE,QAAMC,IAAaC,EAAKH,GAAW,cAAc;AACjD,SAAO,gBAAAI,EAAC,OAAA,EAAK,GAAGH,GAAO,WAAWC,GAAY;AAChD;AAGO,SAASG,EAAY;AAAA,EAC1B,UAAAC;AAAA,EACA,WAAAN;AAAA,EACA,OAAAO;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,GAAGR;AACL,GAAqB;AACnB,QAAMC,IAAaC,EAAKH,GAAW,cAAc,GAC3CU,IACJH,MAAU,OAAOD,KAAa,WAAWA,IAAW;AACtD,2BACGK,GAAA,EAAU,WAAWT,GAAa,GAAGD,GACpC,UAAA,gBAAAW,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAT,EAACU,KAAO,UAAAJ,EAAA,CAAU;AAAA,sBACjBK,GAAA,EAAO;AAAA,IACPP,KAAe,gBAAAJ,EAACY,GAAA,EAAa,UAAAR,EAAA,CAAY;AAAA,IAC1C,gBAAAJ,EAACa,KAAY,UAAAR,EAAA,CAAa;AAAA,IACzBC,MAAcJ,KAAYA;AAAA,EAAA,EAAA,CAC7B,EAAA,CACF;AAEJ;AAGO,SAASS,EAAO,EAAE,WAAAf,GAAW,GAAGC,KAAsB;AAC3D,QAAMC,IAAaC,EAAKH,GAAW,YAAY;AAC/C,SACE,gBAAAI,EAAC,OAAA,EAAI,WAAWF,GAAa,GAAGD,GAC9B,UAAA,gBAAAG,EAAC,QAAA,EAAK,eAAY,QAAO,WAAU,cAAA,CAAc,GACnD;AAEJ;"}
1
+ {"version":3,"file":"Switch.js","sources":["../../../../../src/ui/primitives/Switch/Switch.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { Description, FieldError, Label, SharedFieldProps } from \"primitives\";\nimport type React from \"react\";\nimport {\n Switch as RACSwitch,\n type SwitchProps as RACSwitchProps,\n} from \"react-aria-components\";\nimport \"./switch.css\";\n\nexport type SwitchGroupProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function SwitchGroup({ className, ...props }: SwitchGroupProps) {\n const classNames = clsx(className, \"switch-group\");\n return <div {...props} className={classNames} />;\n}\n\nexport type SwitchFieldLabelPosition = \"start\" | \"end\";\n\nexport type SwitchFieldProps = RACSwitchProps &\n SharedFieldProps & {\n labelPosition?: SwitchFieldLabelPosition;\n };\nexport function SwitchField({\n children,\n className,\n label,\n description,\n errorMessage,\n labelPosition = \"start\",\n ...props\n}: SwitchFieldProps) {\n const classNames = clsx(\n className,\n \"switch-field\",\n `switch-field-label-${labelPosition}`,\n );\n const labelText: string | undefined =\n label || (typeof children === \"string\" ? children : undefined);\n return (\n <RACSwitch className={classNames} {...props}>\n <>\n <Label>{labelText}</Label>\n <Switch />\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n {labelText !== children && children}\n </>\n </RACSwitch>\n );\n}\n\nexport type SwitchProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function Switch({ className, ...props }: SwitchProps) {\n const classNames = clsx(className, \"sds-switch\");\n return (\n <div className={classNames} {...props}>\n <span aria-hidden=\"true\" className=\"switch-icon\" />\n </div>\n );\n}\n"],"names":["SwitchGroup","className","props","classNames","clsx","jsx","SwitchField","children","label","description","errorMessage","labelPosition","labelText","RACSwitch","jsxs","Fragment","Label","Switch","Description","FieldError"],"mappings":";;;;;AAUO,SAASA,EAAY,EAAE,WAAAC,GAAW,GAAGC,KAA2B;AACrE,QAAMC,IAAaC,EAAKH,GAAW,cAAc;AACjD,SAAO,gBAAAI,EAAC,OAAA,EAAK,GAAGH,GAAO,WAAWC,GAAY;AAChD;AAQO,SAASG,EAAY;AAAA,EAC1B,UAAAC;AAAA,EACA,WAAAN;AAAA,EACA,OAAAO;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,GAAGT;AACL,GAAqB;AACnB,QAAMC,IAAaC;AAAA,IACjBH;AAAA,IACA;AAAA,IACA,sBAAsBU,CAAa;AAAA,EAAA,GAE/BC,IACJJ,MAAU,OAAOD,KAAa,WAAWA,IAAW;AACtD,2BACGM,GAAA,EAAU,WAAWV,GAAa,GAAGD,GACpC,UAAA,gBAAAY,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAV,EAACW,KAAO,UAAAJ,EAAA,CAAU;AAAA,sBACjBK,GAAA,EAAO;AAAA,IACPR,KAAe,gBAAAJ,EAACa,GAAA,EAAa,UAAAT,EAAA,CAAY;AAAA,IAC1C,gBAAAJ,EAACc,KAAY,UAAAT,EAAA,CAAa;AAAA,IACzBE,MAAcL,KAAYA;AAAA,EAAA,EAAA,CAC7B,EAAA,CACF;AAEJ;AAGO,SAASU,EAAO,EAAE,WAAAhB,GAAW,GAAGC,KAAsB;AAC3D,QAAMC,IAAaC,EAAKH,GAAW,YAAY;AAC/C,SACE,gBAAAI,EAAC,OAAA,EAAI,WAAWF,GAAa,GAAGD,GAC9B,UAAA,gBAAAG,EAAC,QAAA,EAAK,eAAY,QAAO,WAAU,cAAA,CAAc,GACnD;AAEJ;"}
@@ -6,6 +6,8 @@ export interface Column<T> {
6
6
  label: string;
7
7
  align?: "start" | "center" | "right";
8
8
  render?: (item: T) => ReactNode;
9
+ /** Marks the column that names the row for assistive technology. Defaults to the first column when no column sets it. */
10
+ isRowHeader?: boolean;
9
11
  /** When true, the header becomes clickable and the rows can be sorted by this column. */
10
12
  sortable?: boolean;
11
13
  /** Value used to sort this column. Defaults to `item[key]`. */
@@ -57,6 +59,17 @@ export interface DataTableProps<T extends {
57
59
  /** Controlled sort state. Omit to let the table manage its own sorting internally. */
58
60
  sortDescriptor?: SortDescriptor;
59
61
  onSortChange?: (descriptor: SortDescriptor) => void;
62
+ /** Accessible name of the table. */
63
+ ariaLabel?: string;
64
+ /** Compact row height. Off by default. */
65
+ dense?: boolean;
66
+ /** Alternating row background. Off by default. */
67
+ striped?: boolean;
68
+ /**
69
+ * Caps the height of the table so its rows scroll inside it with a sticky header, keeping the
70
+ * pagination in view. A percentage needs a parent with a defined height. Off by default.
71
+ */
72
+ maxHeight?: number | string;
60
73
  searchPlaceholder?: string;
61
74
  searchKeys?: (keyof T)[];
62
75
  isLoading?: boolean;
@@ -76,5 +89,5 @@ export interface DataTableProps<T extends {
76
89
  }
77
90
  export declare function DataTable<T extends {
78
91
  id: string;
79
- }>({ columns, data, actions, rowActions, rowActionsLabel, selectable, selectionType, selectedKeys, onSelectionChange, defaultSortDescriptor, sortDescriptor: controlledSortDescriptor, onSortChange, searchPlaceholder, searchKeys, isLoading, loadingMessage, emptyMessage, previousLabel, nextLabel, pageSize, nestedColumns, getNestedData, nestedLoadingMessage, nestedEmptyMessage, nestedSearchKeys, nestedSearchPlaceholder, nestedActions, nestedPageSize, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
92
+ }>({ columns, data, actions, rowActions, rowActionsLabel, selectable, selectionType, selectedKeys, onSelectionChange, defaultSortDescriptor, sortDescriptor: controlledSortDescriptor, onSortChange, ariaLabel, dense, striped, maxHeight, searchPlaceholder, searchKeys, isLoading, loadingMessage, emptyMessage, previousLabel, nextLabel, pageSize, nestedColumns, getNestedData, nestedLoadingMessage, nestedEmptyMessage, nestedSearchKeys, nestedSearchPlaceholder, nestedActions, nestedPageSize, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
80
93
  export {};
@@ -1,6 +1,7 @@
1
+ import { type DialogSize } from "primitives";
1
2
  import type { ReactNode } from "react";
2
3
  import "./formmodal.css";
3
- export type FormModalSize = "medium" | "large" | "xlarge";
4
+ export type FormModalSize = DialogSize;
4
5
  export interface FormModalProps {
5
6
  isOpen: boolean;
6
7
  title: string;