zaravand-ui 7.1.0 → 7.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +9 -0
  2. package/dist/components/Accordion/Accordion.variant.cjs +1 -1
  3. package/dist/components/Accordion/Accordion.variant.js +1 -1
  4. package/dist/components/DatePicker/DatePicker.cjs +1 -1
  5. package/dist/components/DatePicker/DatePicker.js +1 -1
  6. package/dist/components/Dialog/DialogDragHandle.cjs +1 -1
  7. package/dist/components/Dialog/DialogDragHandle.js +1 -1
  8. package/dist/components/Input/Input.variant.cjs +1 -1
  9. package/dist/components/Input/Input.variant.js +1 -1
  10. package/dist/components/Pagination/Pagination.variant.cjs +1 -1
  11. package/dist/components/Pagination/Pagination.variant.js +1 -1
  12. package/dist/components/Select/Select.cjs +1 -1
  13. package/dist/components/Select/Select.js +1 -1
  14. package/dist/components/Select/Select.variant.cjs +1 -1
  15. package/dist/components/Select/Select.variant.d.cts +1 -1
  16. package/dist/components/Select/Select.variant.d.ts +1 -1
  17. package/dist/components/Select/Select.variant.js +1 -1
  18. package/dist/components/Table/Table.cjs +1 -1
  19. package/dist/components/Table/Table.interface.d.cts +41 -0
  20. package/dist/components/Table/Table.interface.d.ts +41 -0
  21. package/dist/components/Table/Table.js +335 -318
  22. package/dist/components/Table/Table.utils.cjs +1 -1
  23. package/dist/components/Table/Table.utils.d.cts +2 -0
  24. package/dist/components/Table/Table.utils.d.ts +2 -0
  25. package/dist/components/Table/Table.utils.js +20 -16
  26. package/dist/components/Table/Table.variant.cjs +1 -1
  27. package/dist/components/Table/Table.variant.js +2 -2
  28. package/dist/components/Table/TableActionsContext.cjs +1 -0
  29. package/dist/components/Table/TableActionsContext.d.cts +26 -0
  30. package/dist/components/Table/TableActionsContext.d.ts +26 -0
  31. package/dist/components/Table/TableActionsContext.js +5 -0
  32. package/dist/components/Table/TableParts.cjs +1 -1
  33. package/dist/components/Table/TableParts.js +56 -34
  34. package/dist/components/Table/TableRowActions.cjs +1 -0
  35. package/dist/components/Table/TableRowActions.d.cts +14 -0
  36. package/dist/components/Table/TableRowActions.d.ts +14 -0
  37. package/dist/components/Table/TableRowActions.js +110 -0
  38. package/dist/components/Tabs/Tabs.variant.cjs +1 -1
  39. package/dist/components/Tabs/Tabs.variant.js +4 -4
  40. package/dist/components/Textarea/Textarea.variant.cjs +1 -1
  41. package/dist/components/Textarea/Textarea.variant.js +1 -1
  42. package/dist/components/TimePicker/TimePicker.variant.cjs +1 -1
  43. package/dist/components/TimePicker/TimePicker.variant.js +2 -2
  44. package/dist/components/VerticalTabs/VerticalTabs.cjs +1 -1
  45. package/dist/components/VerticalTabs/VerticalTabs.js +1 -1
  46. package/dist/components/VerticalTabs/VerticalTabs.variant.cjs +1 -1
  47. package/dist/components/VerticalTabs/VerticalTabs.variant.js +5 -5
  48. package/dist/index.cjs +1 -1
  49. package/dist/index.css +1 -1
  50. package/dist/index.d.cts +2 -1
  51. package/dist/index.d.ts +2 -1
  52. package/dist/index.js +9 -8
  53. package/dist/shared/theme.cjs +1 -1
  54. package/dist/shared/theme.d.cts +1 -1
  55. package/dist/shared/theme.d.ts +1 -1
  56. package/dist/shared/theme.js +28 -26
  57. package/dist/shared/themeChannels.cjs +1 -0
  58. package/dist/shared/themeChannels.d.cts +3 -0
  59. package/dist/shared/themeChannels.d.ts +3 -0
  60. package/dist/shared/themeChannels.js +20 -0
  61. package/package.json +7 -3
@@ -54,7 +54,26 @@ export type TablePrintHandler = (input: TablePrintHandlerInput) => void | Promis
54
54
  export type TableAction = {
55
55
  icon: React.ReactNode;
56
56
  onClick: (input: TableRowActionInput) => void | Promise<void>;
57
+ /** Shown as the button's tooltip and accessible name; on phones it is the label in the sheet. */
57
58
  tooltip: string;
59
+ /** Added to the action's button (colour, size, hover...). Has no effect in the phone sheet. */
60
+ className?: string;
61
+ /** Greys the action out. */
62
+ disabled?: boolean;
63
+ /** Draws the action in the danger colour. */
64
+ danger?: boolean;
65
+ /** Leaves the action out (handy for per-row conditions). */
66
+ hidden?: boolean;
67
+ };
68
+ /** What a consumer may change about the built-in edit / delete actions of `TableRowActions`. */
69
+ export type TableDefaultActionOptions = {
70
+ /** Replaces the built-in icon. */
71
+ icon?: React.ReactNode;
72
+ /** Replaces the built-in tooltip (`messages.common.edit` / `messages.common.delete`). */
73
+ tooltip?: string;
74
+ className?: string;
75
+ disabled?: boolean;
76
+ hidden?: boolean;
58
77
  };
59
78
  export type TableCellSelectChangeHandlerInput = {
60
79
  row: DynamicTableRow;
@@ -271,6 +290,28 @@ export type TableRowProps = Omit<React.ComponentPropsWithoutRef<"tr">, "slot"> &
271
290
  /** Rendered as `data-slot`. */
272
291
  slot?: "table-row" | "table-loading-row";
273
292
  };
293
+ export type TableRowActionsProps = {
294
+ /**
295
+ * The row these actions belong to. A hand-written table does not hand its rows to the `Table`,
296
+ * so the handlers receive exactly what is given here (`row` falls back to `{}`, `rowIndex` to `0`).
297
+ */
298
+ row?: DynamicTableRow;
299
+ rowIndex?: number;
300
+ rowId?: TableRowId;
301
+ /** Shows the built-in edit action (pencil). */
302
+ onEdit?: TableEditRowHandler;
303
+ /** Shows the built-in delete action (trash, danger colour). */
304
+ onDelete?: TableDeleteRowHandler;
305
+ /** Custom icon / tooltip / class for the built-in edit action. */
306
+ editAction?: TableDefaultActionOptions;
307
+ /** Custom icon / tooltip / class for the built-in delete action. */
308
+ deleteAction?: TableDefaultActionOptions;
309
+ /** Extra actions with their own icon, tooltip and handler; placed between edit and delete. */
310
+ actions?: TableAction[];
311
+ /** Added to the actions cell. */
312
+ className?: string;
313
+ };
314
+ export type TableActionsHeadProps = Omit<TableHeadProps, "align">;
274
315
  export type TableHeadProps = Omit<React.ComponentPropsWithoutRef<"th">, "align"> & {
275
316
  align?: TableColumnAlign;
276
317
  /** @deprecated Use the standard `aria-sort` attribute. */
@@ -54,7 +54,26 @@ export type TablePrintHandler = (input: TablePrintHandlerInput) => void | Promis
54
54
  export type TableAction = {
55
55
  icon: React.ReactNode;
56
56
  onClick: (input: TableRowActionInput) => void | Promise<void>;
57
+ /** Shown as the button's tooltip and accessible name; on phones it is the label in the sheet. */
57
58
  tooltip: string;
59
+ /** Added to the action's button (colour, size, hover...). Has no effect in the phone sheet. */
60
+ className?: string;
61
+ /** Greys the action out. */
62
+ disabled?: boolean;
63
+ /** Draws the action in the danger colour. */
64
+ danger?: boolean;
65
+ /** Leaves the action out (handy for per-row conditions). */
66
+ hidden?: boolean;
67
+ };
68
+ /** What a consumer may change about the built-in edit / delete actions of `TableRowActions`. */
69
+ export type TableDefaultActionOptions = {
70
+ /** Replaces the built-in icon. */
71
+ icon?: React.ReactNode;
72
+ /** Replaces the built-in tooltip (`messages.common.edit` / `messages.common.delete`). */
73
+ tooltip?: string;
74
+ className?: string;
75
+ disabled?: boolean;
76
+ hidden?: boolean;
58
77
  };
59
78
  export type TableCellSelectChangeHandlerInput = {
60
79
  row: DynamicTableRow;
@@ -271,6 +290,28 @@ export type TableRowProps = Omit<React.ComponentPropsWithoutRef<"tr">, "slot"> &
271
290
  /** Rendered as `data-slot`. */
272
291
  slot?: "table-row" | "table-loading-row";
273
292
  };
293
+ export type TableRowActionsProps = {
294
+ /**
295
+ * The row these actions belong to. A hand-written table does not hand its rows to the `Table`,
296
+ * so the handlers receive exactly what is given here (`row` falls back to `{}`, `rowIndex` to `0`).
297
+ */
298
+ row?: DynamicTableRow;
299
+ rowIndex?: number;
300
+ rowId?: TableRowId;
301
+ /** Shows the built-in edit action (pencil). */
302
+ onEdit?: TableEditRowHandler;
303
+ /** Shows the built-in delete action (trash, danger colour). */
304
+ onDelete?: TableDeleteRowHandler;
305
+ /** Custom icon / tooltip / class for the built-in edit action. */
306
+ editAction?: TableDefaultActionOptions;
307
+ /** Custom icon / tooltip / class for the built-in delete action. */
308
+ deleteAction?: TableDefaultActionOptions;
309
+ /** Extra actions with their own icon, tooltip and handler; placed between edit and delete. */
310
+ actions?: TableAction[];
311
+ /** Added to the actions cell. */
312
+ className?: string;
313
+ };
314
+ export type TableActionsHeadProps = Omit<TableHeadProps, "align">;
274
315
  export type TableHeadProps = Omit<React.ComponentPropsWithoutRef<"th">, "align"> & {
275
316
  align?: TableColumnAlign;
276
317
  /** @deprecated Use the standard `aria-sort` attribute. */