@manakind/ui-core 0.32.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/ark-native-input.d.ts +65 -0
  2. package/dist/ark-native-input.d.ts.map +1 -0
  3. package/dist/ark-native-input.js +72 -0
  4. package/dist/ark-native-input.js.map +1 -0
  5. package/dist/badge/badge.css +6 -0
  6. package/dist/badge/badge.d.ts +4 -3
  7. package/dist/badge/badge.d.ts.map +1 -1
  8. package/dist/badge/badge.js.map +1 -1
  9. package/dist/checkbox/checkbox.d.ts.map +1 -1
  10. package/dist/checkbox/checkbox.js +11 -27
  11. package/dist/checkbox/checkbox.js.map +1 -1
  12. package/dist/icon-defaults.d.ts +1 -1
  13. package/dist/icon-defaults.d.ts.map +1 -1
  14. package/dist/icon-defaults.js.map +1 -1
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +1 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/radio-group/radio-group.d.ts.map +1 -1
  20. package/dist/radio-group/radio-group.js +7 -21
  21. package/dist/radio-group/radio-group.js.map +1 -1
  22. package/dist/segment-group/segment-group.d.ts.map +1 -1
  23. package/dist/segment-group/segment-group.js +7 -26
  24. package/dist/segment-group/segment-group.js.map +1 -1
  25. package/dist/switch/switch.d.ts.map +1 -1
  26. package/dist/switch/switch.js +11 -24
  27. package/dist/switch/switch.js.map +1 -1
  28. package/dist/table/index.d.ts +3 -0
  29. package/dist/table/index.d.ts.map +1 -0
  30. package/dist/table/index.js +2 -0
  31. package/dist/table/index.js.map +1 -0
  32. package/dist/table/table.css +189 -0
  33. package/dist/table/table.css.d.ts +2 -0
  34. package/dist/table/table.d.ts +144 -0
  35. package/dist/table/table.d.ts.map +1 -0
  36. package/dist/table/table.js +95 -0
  37. package/dist/table/table.js.map +1 -0
  38. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table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O;IACf,MAAM,GAAG,GAAG,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,KAAK,CAAC;IAC7D,MAAM,OAAO,GAAG,EAAE,CAChB,gBAAgB,EAChB,GAAG,IAAI,qBAAqB,EAC5B,OAAO,IAAI,yBAAyB,EACpC,SAAS,IAAI,4BAA4B,EACzC,SAAS,CACV,CAAC;IACF,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,CACL,aAAI,SAAS,EAAE,OAAO,EAAE,KAAK,EAAC,KAAK,KAAK,KAAK,YAC1C,QAAQ,GACN,CACN,CAAC;IACJ,CAAC;IACD,OAAO,CACL,aAAI,SAAS,EAAE,OAAO,KAAM,KAAK,YAC9B,QAAQ,GACN,CACN,CAAC;AACJ,CAAC;AAID;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAyB;IACvF,OAAO,CACL,aAAI,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,yBAAyB,EAAE,SAAS,CAAC,KAAM,KAAK,YAClF,eAAM,SAAS,EAAC,mBAAmB,YAAE,QAAQ,GAAQ,GAClD,CACN,CAAC;AACJ,CAAC;AAOD;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAmB;IACpF,OAAO,CACL,aAAI,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,iBAAiB,EAAE,SAAS,CAAC,KAAM,KAAK,YACzE,aAAI,SAAS,EAAC,gBAAgB,EAAC,OAAO,EAAE,OAAO,YAC5C,QAAQ,GACN,GACF,CACN,CAAC;AACJ,CAAC","sourcesContent":["import { type ComponentProps, type ReactNode, useId } from 'react';\nimport './table.css';\nimport { cx } from '../cx';\nimport { Icon } from '../icon/icon';\nimport { useIconDefaults } from '../icon-defaults';\nimport { ScrollArea } from '../scroll-area/scroll-area';\n\n/** Where a column's content sits: text at the start, numbers at the end. */\nexport type TableAlign = 'start' | 'end';\n\n/** A sortable column's state. `none` is sortable but not the sort in force. */\nexport type TableSort = 'ascending' | 'descending' | 'none';\n\nexport interface TableProps extends ComponentProps<'div'> {\n /**\n * The table's name, required: it names the table for a screen reader and\n * the scroll region around it, which takes keyboard focus so a table wider\n * than its column can be scrolled with the arrow keys.\n */\n label: string;\n /** Tint every other body row, so a long row is easier to follow across. */\n striped?: boolean;\n /**\n * Highlight the body row under the pointer, to read it across or compare\n * it with its neighbours. Not a sign that the row is clickable: a row that\n * opens something puts a link in its first cell.\n */\n rowHover?: boolean;\n /**\n * What sits above the table: a {@link TableToolbar} with the table's\n * actions (add a row, history), and optionally a search or filter at its\n * start.\n */\n toolbar?: ReactNode;\n /** The rows are loading: marks the table busy while skeleton rows stand in. */\n busy?: boolean;\n}\n\n/**\n * Rows and columns of data in a real `<table>`, so a screen reader can move\n * by row and column and announce each cell's column.\n *\n * A structural primitive, styled against the `--ds-table-*` contract. It\n * holds no data and no sorting of its own: the product passes the rows in\n * the order it wants and owns the sort and filter state, which on a server-\n * paged list is the only place it can live.\n *\n * Compose with {@link TableHead}, {@link TableBody} and {@link TableFoot},\n * made of {@link TableRow}s holding {@link TableHeaderCell}s and\n * {@link TableCell}s; {@link TableActionsCell} holds a row's icon buttons and\n * {@link TableEmpty} stands in for the rows when there are none.\n *\n * The table scrolls sideways inside its box when its columns don't fit, so a\n * phone keeps every column instead of squeezing them. `className` and the\n * other props go to that box, which holds the toolbar and the table.\n */\nexport function Table({\n label,\n striped = false,\n rowHover = false,\n toolbar,\n busy = false,\n className,\n children,\n ...props\n}: TableProps) {\n return (\n <div\n className={cx(\n 'ds-table',\n striped && 'ds-table--striped',\n rowHover && 'ds-table--row-hover',\n className,\n )}\n {...props}\n >\n {toolbar}\n <ScrollArea axis=\"x\" className=\"ds-table__scroll\" label={label}>\n <table aria-busy={busy || undefined} aria-label={label} className=\"ds-table__table\">\n {children}\n </table>\n </ScrollArea>\n </div>\n );\n}\n\nexport interface TableToolbarProps extends ComponentProps<'div'> {\n /** What sits at the start of the row: a search or a filter for the whole table. */\n start?: ReactNode;\n}\n\n/**\n * The row above a table: its actions at the end (add a row, history,\n * export), and optionally a search or filter at the start. Pass it to\n * {@link Table}'s `toolbar`.\n */\nexport function TableToolbar({ start, className, children, ...props }: TableToolbarProps) {\n return (\n <div className={cx('ds-table__toolbar', className)} {...props}>\n {start ? <div className=\"ds-table__toolbar-start\">{start}</div> : null}\n <div className=\"ds-table__toolbar-actions\">{children}</div>\n </div>\n );\n}\n\nexport type TableHeadProps = ComponentProps<'thead'>;\n\n/** The column heads: a {@link TableRow} of {@link TableHeaderCell}s. */\nexport function TableHead({ className, children, ...props }: TableHeadProps) {\n return (\n <thead className={cx('ds-table__head', className)} {...props}>\n {children}\n </thead>\n );\n}\n\nexport type TableBodyProps = ComponentProps<'tbody'>;\n\n/** The data rows. */\nexport function TableBody({ className, children, ...props }: TableBodyProps) {\n return (\n <tbody className={cx('ds-table__body', className)} {...props}>\n {children}\n </tbody>\n );\n}\n\nexport type TableFootProps = ComponentProps<'tfoot'>;\n\n/** A totals row under the data, set apart by a rule and the footer weight. */\nexport function TableFoot({ className, children, ...props }: TableFootProps) {\n return (\n <tfoot className={cx('ds-table__foot', className)} {...props}>\n {children}\n </tfoot>\n );\n}\n\nexport type TableRowProps = ComponentProps<'tr'>;\n\n/** One row of cells. */\nexport function TableRow({ className, children, ...props }: TableRowProps) {\n return (\n <tr className={cx('ds-table__row', className)} {...props}>\n {children}\n </tr>\n );\n}\n\n/** A sortable column's state and its handler, which come together or not at all. */\ntype TableHeaderCellSorting =\n | { sort?: undefined; onSortChange?: undefined }\n | {\n /**\n * Makes the column sortable and says how it is sorted now. The head\n * becomes a button, and the sorted column carries `aria-sort`.\n */\n sort: TableSort;\n /**\n * Called with the direction a press asks for: `ascending` from an\n * unsorted or descending column, `descending` from an ascending one.\n * The product sorts its rows and passes the new `sort` back.\n */\n onSortChange: (next: Exclude<TableSort, 'none'>) => void;\n };\n\nexport type TableHeaderCellProps = Omit<ComponentProps<'th'>, 'align'> &\n TableHeaderCellSorting & {\n /** Where the head sits: at the end over a column of numbers. Defaults to `start`. */\n align?: TableAlign;\n /**\n * A control after the label that filters this column, typically an\n * `IconButton` opening a `Popover`. It stays outside the sort button, so\n * opening the filter never re-sorts, and out of the column's name.\n */\n filter?: ReactNode;\n };\n\nconst ARIA_SORT = { ascending: 'ascending', descending: 'descending', none: undefined } as const;\n\n/**\n * A column's head, a `th` scoped to its column, in the small-caps label\n * style. With `sort` it is a button that re-sorts the column; with `filter`\n * it carries the column's filter control beside the label. The column is\n * named by its label alone, so each of its cells is announced with that.\n */\nexport function TableHeaderCell({\n align = 'start',\n sort,\n onSortChange,\n filter,\n className,\n children,\n ...props\n}: TableHeaderCellProps) {\n const icons = useIconDefaults();\n const labelId = useId();\n const text = (\n <span className=\"ds-table__header-label\" id={labelId}>\n {children}\n </span>\n );\n const label =\n sort === undefined ? (\n text\n ) : (\n <button\n className=\"ds-table__sort\"\n data-sort={sort}\n onClick={() => onSortChange(sort === 'ascending' ? 'descending' : 'ascending')}\n type=\"button\"\n >\n {text}\n <span aria-hidden=\"true\" className=\"ds-table__sort-indicator\">\n <Icon decorative size=\"sm\" source={icons.chevronRight} />\n {sort === 'none' ? <Icon decorative size=\"sm\" source={icons.chevronRight} /> : null}\n </span>\n </button>\n );\n return (\n <th\n aria-labelledby={labelId}\n aria-sort={sort === undefined ? undefined : ARIA_SORT[sort]}\n className={cx('ds-table__header-cell', align === 'end' && 'ds-table__cell--end', className)}\n scope=\"col\"\n {...props}\n >\n <span className=\"ds-table__header-content\">\n {label}\n {filter}\n </span>\n </th>\n );\n}\n\nexport interface TableCellProps extends Omit<ComponentProps<'td'>, 'align'> {\n /** Where the content sits. Defaults to `start`; `numeric` puts it at the end. */\n align?: TableAlign;\n /**\n * A number: set at the end of the cell with tabular figures, so a column\n * of amounts lines up digit under digit. Format it (currency, decimals)\n * before passing it in.\n */\n numeric?: boolean;\n /**\n * The cell that names its row, rendered as a `th` scoped to the row, so a\n * screen reader announces it with each of the row's other cells.\n */\n rowHeader?: boolean;\n}\n\n/**\n * One cell of data: text by default, a number with `numeric`, or the row's\n * name with `rowHeader`. A date, a status (`Badge`) or a link to the row's\n * page (`Link`) goes inside as content.\n */\nexport function TableCell({\n align,\n numeric = false,\n rowHeader = false,\n className,\n children,\n ...props\n}: TableCellProps) {\n const end = (align ?? (numeric ? 'end' : 'start')) === 'end';\n const classes = cx(\n 'ds-table__cell',\n end && 'ds-table__cell--end',\n numeric && 'ds-table__cell--numeric',\n rowHeader && 'ds-table__cell--row-header',\n className,\n );\n if (rowHeader) {\n return (\n <th className={classes} scope=\"row\" {...props}>\n {children}\n </th>\n );\n }\n return (\n <td className={classes} {...props}>\n {children}\n </td>\n );\n}\n\nexport type TableActionsCellProps = Omit<TableCellProps, 'align' | 'numeric' | 'rowHeader'>;\n\n/**\n * The row's actions at the end of the row: up to two `IconButton`s, and an\n * `ActionMenu` for any more, so the column stays narrow. Name each button\n * after its row (\"Delete Stratechery\"), since the column head can't.\n */\nexport function TableActionsCell({ className, children, ...props }: TableActionsCellProps) {\n return (\n <td className={cx('ds-table__cell', 'ds-table__cell--actions', className)} {...props}>\n <span className=\"ds-table__actions\">{children}</span>\n </td>\n );\n}\n\nexport interface TableEmptyProps extends ComponentProps<'tr'> {\n /** How many columns the table has, so the message spans all of them. */\n colSpan: number;\n}\n\n/**\n * Stands in for the body's rows when there are none: one row whose single\n * cell spans every column, holding an `EmptyState` that says why.\n */\nexport function TableEmpty({ colSpan, className, children, ...props }: TableEmptyProps) {\n return (\n <tr className={cx('ds-table__row', 'ds-table__empty', className)} {...props}>\n <td className=\"ds-table__cell\" colSpan={colSpan}>\n {children}\n </td>\n </tr>\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manakind/ui-core",
3
- "version": "0.32.0",
3
+ "version": "0.34.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -396,7 +396,7 @@
396
396
  },
397
397
  "devDependencies": {
398
398
  "@manakind/ds-config": "*",
399
- "@manakind/manuia-tokens": "0.30.0",
399
+ "@manakind/manuia-tokens": "0.32.0",
400
400
  "@testing-library/jest-dom": "^6.9.1",
401
401
  "@testing-library/react": "^16.3.2",
402
402
  "@testing-library/user-event": "^14.6.1",