asma-ui-core 3.78.11 → 3.79.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 (44) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/data-display/chip/StyledChip.js +41 -41
  3. package/dist/components/inputs/button/StyledButton.module.js +8 -8
  4. package/dist/components/inputs/checkbox/base-ui/StyledCheckbox.js +45 -42
  5. package/dist/components/inputs/checkbox/base-ui/StyledCheckbox.module.js +8 -8
  6. package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +25 -17
  7. package/dist/components/inputs/field-styles.js +3 -3
  8. package/dist/components/inputs/radio-button/base-ui/StyledRadio.js +34 -31
  9. package/dist/components/inputs/radio-button/base-ui/StyledRadio.module.js +10 -10
  10. package/dist/components/inputs/select/StyledSelect.js +147 -135
  11. package/dist/components/inputs/select/StyledSelectItem.js +29 -19
  12. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +195 -162
  13. package/dist/components/inputs/switch/base-ui/StyledSwitch.module.js +4 -4
  14. package/dist/components/inputs/textarea/StyledTextarea.module.js +4 -4
  15. package/dist/components/navigation/link/StyledLink.js +11 -10
  16. package/dist/components/navigation/link/StyledLink.module.js +5 -5
  17. package/dist/components/navigation/menu/StyledMenuList.js +27 -19
  18. package/dist/components/navigation/tabs/StyledTab.js +7 -7
  19. package/dist/components/utils/accordion/base-ui/StyledAccordion.module.js +3 -3
  20. package/dist/datetime/shared-components/button/StyledButton.module.js +12 -12
  21. package/dist/src/components/inputs/select/StyledSelectItem.d.ts +3 -1
  22. package/dist/src/components/navigation/menu/StyledMenuList.d.ts +3 -1
  23. package/dist/src/table/components/TableRow.d.ts +2 -1
  24. package/dist/src/table/custom-features/focus-rows/types.d.ts +2 -2
  25. package/dist/src/table/hooks/useToggleMenuVisibility.hook.d.ts +14 -1
  26. package/dist/table/components/StyledTable.module.js +52 -52
  27. package/dist/table/components/TableRow.js +92 -80
  28. package/dist/table/components/TableRows.js +10 -8
  29. package/dist/table/components/table-footer/TablePagination.js +77 -64
  30. package/dist/table/components/table-footer/TableRowCountSelect.js +63 -44
  31. package/dist/table/components/table-header/TableHeader.js +72 -64
  32. package/dist/table/custom-features/focus-rows/FocusRowsFeature.js +4 -4
  33. package/dist/table/hooks/useToggleMenuVisibility.hook.js +77 -11
  34. package/dist/table/shared-components/button/StyledButton.module.js +9 -9
  35. package/dist/tailwind.config.d.ts +1 -0
  36. package/package.json +1 -1
  37. package/src/styles/_focus.scss +23 -0
  38. package/src/styles/color-variables/defaultTokens.css +2 -4
  39. package/src/styles/color-variables/fretexTokens.css +6 -7
  40. package/src/styles/color-variables/jadeTokens.css +2 -4
  41. package/src/styles/components-colors/inputVariables.css +2 -2
  42. package/tw-configs/twConfigs.json +1 -0
  43. package/dist/table/shared-components/CheckIcon.js +0 -12
  44. package/dist/table/shared-components/menu-item/index.js +0 -22
@@ -1,10 +1,10 @@
1
- import { cn as b } from "../../../helpers/cn.js";
2
- import { resolveSx as f } from "../../../helpers/sx.js";
1
+ import { cn as x } from "../../../helpers/cn.js";
2
+ import { resolveSx as b } from "../../../helpers/sx.js";
3
3
  import { useTabsContext as u } from "./TabsContext.js";
4
4
  import { useCallback as h } from "react";
5
5
  import { jsx as d } from "react/jsx-runtime";
6
- var k = ({ value: a, label: i, disabled: e, className: s, sx: l, index: m }) => {
7
- const t = u(), o = a !== void 0 ? a : m, r = t ? t.value === o : !1, c = /\btext-(?:xs|sm|base|lg|xl|\[)/.test(s ?? ""), p = /\bfont-(?:thin|extralight|light|normal|medium|semibold|bold|extrabold|black)\b/.test(s ?? ""), x = /\b(?:uppercase|lowercase|capitalize|normal-case)\b/.test(s ?? "");
6
+ var k = ({ value: i, label: a, disabled: e, className: s, sx: l, index: m }) => {
7
+ const t = u(), o = i !== void 0 ? i : m, r = t ? t.value === o : !1, c = /\btext-(?:xs|sm|base|lg|xl|\[)/.test(s ?? ""), f = /\bfont-(?:thin|extralight|light|normal|medium|semibold|bold|extrabold|black)\b/.test(s ?? ""), p = /\b(?:uppercase|lowercase|capitalize|normal-case)\b/.test(s ?? "");
8
8
  return /* @__PURE__ */ d("button", {
9
9
  ref: h((n) => {
10
10
  t?.register(o, n);
@@ -17,12 +17,12 @@ var k = ({ value: a, label: i, disabled: e, className: s, sx: l, index: m }) =>
17
17
  tabIndex: r ? 0 : -1,
18
18
  "data-tab-value": typeof o == "string" || typeof o == "number" ? String(o) : void 0,
19
19
  onClick: (n) => !e && t?.onSelect(n, o),
20
- className: b("inline-flex min-h-12 min-w-[90px] shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-t-lg border-0 bg-transparent px-4 py-3 tracking-normal outline-none transition-colors", !c && (t?.size === "small" ? "text-base" : "text-lg"), !p && (t?.size === "small" || r || e ? "font-semibold" : "font-medium hover:font-semibold focus-visible:font-semibold"), !x && "normal-case", t?.size === "small" && "min-h-10 px-3 py-2", e ? "text-delta-300" : r ? "text-gama-500" : "text-delta-600", !e && "cursor-pointer", "focus-visible:shadow-[inset_0_0_0_2px_var(--colors-gama-400)]", !e && !r && "hover:shadow-[inset_0_-2px_0_0_var(--colors-delta-300)]", s),
20
+ className: x("inline-flex min-h-12 min-w-[90px] shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-t-lg border-0 bg-transparent px-4 py-3 tracking-normal outline-none transition-colors", !c && (t?.size === "small" ? "text-base" : "text-lg"), !f && (t?.size === "small" || r || e ? "font-semibold" : "font-medium hover:font-semibold focus-visible:font-semibold"), !p && "normal-case", t?.size === "small" && "min-h-10 px-3 py-2", e ? "text-delta-300" : r ? "text-gama-500" : "text-delta-600", !e && "cursor-pointer", "focus-visible:shadow-[inset_0_0_0_3px_var(--colors-focus-ring)]", !e && !r && "hover:shadow-[inset_0_-2px_0_0_var(--colors-delta-300)]", s),
21
21
  style: {
22
22
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
23
- ...f(l)
23
+ ...b(l)
24
24
  },
25
- children: i
25
+ children: a
26
26
  });
27
27
  };
28
28
  export {
@@ -1,11 +1,11 @@
1
- var r = "_AccordionRoot_8v0kh_1", _ = "_Trigger_8v0kh_10", e = "_Header_8v0kh_28", o = "_TriggerIcon_8v0kh_58", a = "_TriggerIconRight_8v0kh_69", v = "_Panel_8v0kh_77", g = "_Content_8v0kh_85", n = {
1
+ var r = "_AccordionRoot_kpk99_1", _ = "_Trigger_kpk99_10", e = "_Header_kpk99_28", o = "_TriggerIcon_kpk99_58", a = "_TriggerIconRight_kpk99_69", g = "_Panel_kpk99_77", k = "_Content_kpk99_85", n = {
2
2
  AccordionRoot: r,
3
3
  Trigger: _,
4
4
  Header: e,
5
5
  TriggerIcon: o,
6
6
  TriggerIconRight: a,
7
- Panel: v,
8
- Content: g
7
+ Panel: g,
8
+ Content: k
9
9
  };
10
10
  export {
11
11
  n as default
@@ -1,16 +1,16 @@
1
- var _ = "_contained_89dg9_6", t = "_common_89dg9_6", a = "_medium_89dg9_48", e = "_small_89dg9_53", r = "_large_89dg9_58", d = "_error_89dg9_68", o = "_outlined_89dg9_130", g = "_text_89dg9_254", m = "_textGray_89dg9_378", l = "_textWhite_89dg9_440", u = {
2
- "asma-core-ui-button": "_asma-core-ui-button_89dg9_1",
3
- contained: _,
4
- common: t,
5
- medium: a,
6
- small: e,
1
+ var e = "_contained_efhli_6", _ = "_common_efhli_6", t = "_medium_efhli_56", a = "_small_efhli_61", r = "_large_efhli_66", l = "_error_efhli_76", i = "_outlined_efhli_146", o = "_text_efhli_286", f = "_textGray_efhli_426", h = "_textWhite_efhli_496", m = {
2
+ "asma-core-ui-button": "_asma-core-ui-button_efhli_1",
3
+ contained: e,
4
+ common: _,
5
+ medium: t,
6
+ small: a,
7
7
  large: r,
8
- error: d,
9
- outlined: o,
10
- text: g,
11
- textGray: m,
12
- textWhite: l
8
+ error: l,
9
+ outlined: i,
10
+ text: o,
11
+ textGray: f,
12
+ textWhite: h
13
13
  };
14
14
  export {
15
- u as default
15
+ m as default
16
16
  };
@@ -1,8 +1,10 @@
1
1
  import { MouseEvent, ReactNode } from 'react';
2
2
  export interface StyledSelectItemProps {
3
+ id?: string;
3
4
  value?: unknown;
4
5
  children?: ReactNode;
5
6
  selected?: boolean;
7
+ active?: boolean;
6
8
  disabled?: boolean;
7
9
  className?: string;
8
10
  onClick?: (event: MouseEvent<HTMLLIElement>) => void;
@@ -11,4 +13,4 @@ export interface StyledSelectItemProps {
11
13
  * Option row for `StyledSelect` (replaces MUI `MenuItem` in the select context). `role="option"`
12
14
  * with a leading check column for the selected state. Public props preserved (DEC-003). TASK-402.
13
15
  */
14
- export declare const StyledSelectItem: ({ children, selected, disabled, className, onClick, }: StyledSelectItemProps) => JSX.Element;
16
+ export declare const StyledSelectItem: ({ id, children, selected, active, disabled, className, onClick, }: StyledSelectItemProps) => JSX.Element;
@@ -1,6 +1,8 @@
1
1
  import { KeyboardEvent, MouseEvent, ReactNode } from 'react';
2
2
  export interface StyledMenuListProps {
3
3
  children?: ReactNode;
4
+ id?: string;
5
+ role?: 'menu' | 'listbox';
4
6
  className?: string;
5
7
  /** Focus the first enabled item on mount (MUI Menu autoFocus behaviour). */
6
8
  autoFocus?: boolean;
@@ -13,4 +15,4 @@ export interface StyledMenuListProps {
13
15
  * Keyboard-navigable `role="menu"` list (replaces MUI `MenuList`). Arrow-key / Home / End roving
14
16
  * focus over enabled `[role="menuitem"]` children. TASK-303.
15
17
  */
16
- export declare const StyledMenuList: ({ children, className, autoFocus, disablePadding, onClick, onKeyDown, }: StyledMenuListProps) => JSX.Element;
18
+ export declare const StyledMenuList: ({ children, id, role, className, autoFocus, disablePadding, onClick, onKeyDown, }: StyledMenuListProps) => JSX.Element;
@@ -3,10 +3,11 @@ import { StyledTableProps } from '../types';
3
3
  import { ColumnWindow } from '../hooks/useColumnVirtualizer';
4
4
  export declare function TableRow<TData extends {
5
5
  id: string | number;
6
- }, TCustomData = Record<string, unknown>>({ styledTableProps, row, index, columnWindow: { paddingLeft, paddingRight, indexes }, }: {
6
+ }, TCustomData = Record<string, unknown>>({ styledTableProps, row, index, hasFocusedRow, columnWindow: { paddingLeft, paddingRight, indexes }, }: {
7
7
  styledTableProps: StyledTableProps<TData, TCustomData>;
8
8
  row: Row<TData>;
9
9
  columnWindow: ColumnWindow;
10
10
  index: number;
11
+ hasFocusedRow: boolean;
11
12
  }): JSX.Element;
12
13
  export declare const Checkmark: () => JSX.Element;
@@ -6,8 +6,8 @@ export interface FocusedRow {
6
6
  toggleFocused: () => void;
7
7
  onChangeFocused: (newExpanded: boolean, rowId?: string) => void;
8
8
  isFocused: () => boolean;
9
- focusNextRow: () => void;
10
- focusPrevRow: () => void;
9
+ focusNextRow: () => boolean;
10
+ focusPrevRow: () => boolean;
11
11
  }
12
12
  export interface FocusedRowsOptions {
13
13
  onChangeFocusedRow?: OnChangeFn<string | null>;
@@ -1,8 +1,21 @@
1
+ import { KeyboardEvent, MouseEvent, RefObject } from 'react';
1
2
  interface ToggleMenuVisibility {
2
3
  open: boolean;
3
4
  anchorEl: HTMLElement | SVGSVGElement | null;
4
- handleOpen: (event: React.MouseEvent<HTMLElement | SVGSVGElement>) => void;
5
+ handleOpen: (event: MouseEvent<HTMLElement | SVGSVGElement> | KeyboardEvent<HTMLElement>) => void;
5
6
  handleClose: () => void;
6
7
  }
8
+ interface KeyboardSelectMenu extends ToggleMenuVisibility {
9
+ triggerRef: RefObject<HTMLButtonElement>;
10
+ activeIndex: number | null;
11
+ handleKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => void;
12
+ }
13
+ interface KeyboardSelectMenuOptions {
14
+ optionCount: number;
15
+ selectedIndex: number;
16
+ onSelect: (index: number) => void;
17
+ focusHeaderOnShiftTab?: boolean;
18
+ }
7
19
  export declare const useToggleMenuVisibility: () => ToggleMenuVisibility;
20
+ export declare const useKeyboardSelectMenu: ({ optionCount, selectedIndex, onSelect, focusHeaderOnShiftTab, }: KeyboardSelectMenuOptions) => KeyboardSelectMenu;
8
21
  export {};
@@ -1,58 +1,58 @@
1
- var e = "_tbody_qdh8h_124", _ = "_expanded_row_qdh8h_187", l = "_selected_qdh8h_205", h = "_shadowed_qdh8h_228", t = "_resizer_qdh8h_282", a = "_isResizing_qdh8h_294", d = {
2
- "asma-ui-table-styled-table": "_asma-ui-table-styled-table_qdh8h_1",
3
- "table-wrapper": "_table-wrapper_qdh8h_26",
4
- "table-shell": "_table-shell_qdh8h_33",
5
- "table-wrapper--no-rows": "_table-wrapper--no-rows_qdh8h_39",
6
- "table-wrapper--proxy": "_table-wrapper--proxy_qdh8h_42",
7
- "table-wrapper--proxy-bottom": "_table-wrapper--proxy-bottom_qdh8h_43",
8
- "table-wrapper-fetching": "_table-wrapper-fetching_qdh8h_53",
9
- "table-scroll": "_table-scroll_qdh8h_56",
10
- "table-x--fill-height": "_table-x--fill-height_qdh8h_65",
11
- "table-x": "_table-x_qdh8h_65",
12
- "table-content": "_table-content_qdh8h_80",
13
- "table-header--sticky": "_table-header--sticky_qdh8h_85",
14
- "table-hscroll": "_table-hscroll_qdh8h_90",
15
- "table-hscroll__content": "_table-hscroll__content_qdh8h_100",
16
- "no-rows-overlay-container": "_no-rows-overlay-container_qdh8h_103",
17
- "no-rows-overlay-content": "_no-rows-overlay-content_qdh8h_111",
18
- "styled-table": "_styled-table_qdh8h_115",
1
+ var e = "_tbody_z31fh_124", _ = "_expanded_row_z31fh_174", l = "_selected_z31fh_192", t = "_shadowed_z31fh_217", a = "_resizer_z31fh_274", o = "_isResizing_z31fh_286", h = {
2
+ "asma-ui-table-styled-table": "_asma-ui-table-styled-table_z31fh_1",
3
+ "table-wrapper": "_table-wrapper_z31fh_26",
4
+ "table-shell": "_table-shell_z31fh_33",
5
+ "table-wrapper--no-rows": "_table-wrapper--no-rows_z31fh_39",
6
+ "table-wrapper--proxy": "_table-wrapper--proxy_z31fh_42",
7
+ "table-wrapper--proxy-bottom": "_table-wrapper--proxy-bottom_z31fh_43",
8
+ "table-wrapper-fetching": "_table-wrapper-fetching_z31fh_53",
9
+ "table-scroll": "_table-scroll_z31fh_56",
10
+ "table-x--fill-height": "_table-x--fill-height_z31fh_65",
11
+ "table-x": "_table-x_z31fh_65",
12
+ "table-content": "_table-content_z31fh_80",
13
+ "table-header--sticky": "_table-header--sticky_z31fh_85",
14
+ "table-hscroll": "_table-hscroll_z31fh_90",
15
+ "table-hscroll__content": "_table-hscroll__content_z31fh_100",
16
+ "no-rows-overlay-container": "_no-rows-overlay-container_z31fh_103",
17
+ "no-rows-overlay-content": "_no-rows-overlay-content_z31fh_111",
18
+ "styled-table": "_styled-table_z31fh_115",
19
19
  tbody: e,
20
- "loading-icon": "_loading-icon_qdh8h_129",
21
- "t-row": "_t-row_qdh8h_136",
22
- "t-cell": "_t-cell_qdh8h_136",
23
- "action-cell": "_action-cell_qdh8h_146",
24
- "fixed-cell": "_fixed-cell_qdh8h_150",
25
- "fixed-right-cell": "_fixed-right-cell_qdh8h_153",
20
+ "loading-icon": "_loading-icon_z31fh_129",
21
+ "t-row": "_t-row_z31fh_136",
22
+ "t-cell": "_t-cell_z31fh_136",
23
+ "action-cell": "_action-cell_z31fh_146",
24
+ "fixed-cell": "_fixed-cell_z31fh_150",
25
+ "fixed-right-cell": "_fixed-right-cell_z31fh_153",
26
26
  expanded_row: _,
27
27
  selected: l,
28
- "single-selection": "_single-selection_qdh8h_208",
29
- "action-cell--no-shadow": "_action-cell--no-shadow_qdh8h_225",
30
- shadowed: h,
31
- "shadowed-right": "_shadowed-right_qdh8h_262",
32
- "is-loading": "_is-loading_qdh8h_266",
33
- "action-cell-default-background": "_action-cell-default-background_qdh8h_269",
34
- "fixed-cell-default-background": "_fixed-cell-default-background_qdh8h_272",
35
- "fixed-right-cell-default-background": "_fixed-right-cell-default-background_qdh8h_275",
36
- "sortable-column": "_sortable-column_qdh8h_278",
37
- resizer: t,
38
- isResizing: a,
39
- "hide-table-header": "_hide-table-header_qdh8h_306",
40
- "show-table-header": "_show-table-header_qdh8h_310",
41
- "table-header": "_table-header_qdh8h_85",
42
- "hide-header": "_hide-header_qdh8h_346",
43
- "t-cell__actions": "_t-cell__actions_qdh8h_349",
44
- "t-cell__actions--no-shadow": "_t-cell__actions--no-shadow_qdh8h_357",
45
- "t-cell__fixed": "_t-cell__fixed_qdh8h_361",
46
- "t-cell__fixed-right": "_t-cell__fixed-right_qdh8h_368",
47
- "sort-icon": "_sort-icon_qdh8h_375",
48
- "header-content": "_header-content_qdh8h_379",
49
- "table-footer--sticky": "_table-footer--sticky_qdh8h_394",
50
- "table-footer--inline": "_table-footer--inline_qdh8h_405",
51
- "table-bottom": "_table-bottom_qdh8h_416",
52
- "table-bottom--sticky": "_table-bottom--sticky_qdh8h_430",
53
- "cursor-not-allowed": "_cursor-not-allowed_qdh8h_434",
54
- "select-control": "_select-control_qdh8h_438"
28
+ "single-selection": "_single-selection_z31fh_195",
29
+ "action-cell--no-shadow": "_action-cell--no-shadow_z31fh_213",
30
+ shadowed: t,
31
+ "shadowed-right": "_shadowed-right_z31fh_253",
32
+ "is-loading": "_is-loading_z31fh_258",
33
+ "action-cell-default-background": "_action-cell-default-background_z31fh_261",
34
+ "fixed-cell-default-background": "_fixed-cell-default-background_z31fh_264",
35
+ "fixed-right-cell-default-background": "_fixed-right-cell-default-background_z31fh_267",
36
+ "sortable-column": "_sortable-column_z31fh_270",
37
+ resizer: a,
38
+ isResizing: o,
39
+ "hide-table-header": "_hide-table-header_z31fh_298",
40
+ "show-table-header": "_show-table-header_z31fh_302",
41
+ "table-header": "_table-header_z31fh_85",
42
+ "hide-header": "_hide-header_z31fh_338",
43
+ "t-cell__actions": "_t-cell__actions_z31fh_341",
44
+ "t-cell__actions--no-shadow": "_t-cell__actions--no-shadow_z31fh_350",
45
+ "t-cell__fixed": "_t-cell__fixed_z31fh_355",
46
+ "t-cell__fixed-right": "_t-cell__fixed-right_z31fh_363",
47
+ "sort-icon": "_sort-icon_z31fh_371",
48
+ "header-content": "_header-content_z31fh_375",
49
+ "table-footer--sticky": "_table-footer--sticky_z31fh_406",
50
+ "table-footer--inline": "_table-footer--inline_z31fh_417",
51
+ "table-bottom": "_table-bottom_z31fh_428",
52
+ "table-bottom--sticky": "_table-bottom--sticky_z31fh_442",
53
+ "cursor-not-allowed": "_cursor-not-allowed_z31fh_446",
54
+ "select-control": "_select-control_z31fh_450"
55
55
  };
56
56
  export {
57
- d as default
57
+ h as default
58
58
  };
@@ -1,62 +1,66 @@
1
- import { ACTIONS_COLUMN_ID as O } from "../types.js";
2
- import { useRootContext as ue } from "../context/RootContext.js";
1
+ import { ACTIONS_COLUMN_ID as $ } from "../types.js";
2
+ import { useRootContext as ge } from "../context/RootContext.js";
3
3
  import n from "./StyledTable.module.js";
4
- import { compact as fe } from "../../helpers/arrays.js";
5
- import $ from "clsx";
6
- import { Fragment as he, useCallback as j, useEffect as pe, useLayoutEffect as xe, useMemo as g, useRef as Ce, useState as Re } from "react";
7
- import { Fragment as Se, jsx as s, jsxs as x } from "react/jsx-runtime";
8
- import { useSortable as be } from "@dnd-kit/sortable";
9
- import { flexRender as De } from "@tanstack/react-table";
10
- import { CSS as ke } from "@dnd-kit/utilities";
11
- function Me({ styledTableProps: P, row: t, index: K, columnWindow: { paddingLeft: u, paddingRight: f, indexes: v } }) {
12
- const { loading: V, getRowClassName: l, rowHeight: h, onRowClick: C, expandArrow: Y, enableDnd: N, disableDndForRow: q, tdClassName: I, customSubRowData: w, renderSubRows: G, defaultExpanded: J, actions: R, customActionsNode: Q, textExpandArrow: B, enableMultiRowSelection: X, enableRowSelection: Z, singleSelectionRow: ee } = P, S = q?.(t), { transform: te, transition: ne, setNodeRef: A, isDragging: H } = be({
4
+ import { compact as he } from "../../helpers/arrays.js";
5
+ import j from "clsx";
6
+ import { Fragment as pe, useCallback as q, useEffect as xe, useLayoutEffect as be, useMemo as m, useRef as Ce, useState as Re } from "react";
7
+ import { Fragment as Se, jsx as s, jsxs as b } from "react/jsx-runtime";
8
+ import { useSortable as De } from "@dnd-kit/sortable";
9
+ import { flexRender as ye } from "@tanstack/react-table";
10
+ import { CSS as Ne } from "@dnd-kit/utilities";
11
+ var Fe = (C) => {
12
+ const t = C.closest("table");
13
+ t && Array.from(document.querySelectorAll('a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])')).find((f) => !t.contains(f) && !!(t.compareDocumentPosition(f) & Node.DOCUMENT_POSITION_FOLLOWING))?.focus();
14
+ };
15
+ function Oe({ styledTableProps: C, row: t, index: f, hasFocusedRow: K, columnWindow: { paddingLeft: g, paddingRight: h, indexes: I } }) {
16
+ const { loading: G, getRowClassName: l, rowHeight: p, onRowClick: R, expandArrow: V, enableDnd: T, disableDndForRow: Y, tdClassName: w, customSubRowData: A, renderSubRows: J, defaultExpanded: Q, actions: S, customActionsNode: X, textExpandArrow: B, enableMultiRowSelection: Z, enableRowSelection: ee, singleSelectionRow: te } = C, D = Y?.(t), { transform: ne, transition: oe, setNodeRef: L, isDragging: M } = De({
13
17
  id: t.original.id,
14
- disabled: !N || S
18
+ disabled: !T || D
15
19
  }), ie = {
16
- transform: ke.Transform.toString(te),
17
- transition: ne,
18
- opacity: H ? 0.8 : 1,
19
- zIndex: H ? 1 : 0,
20
+ transform: Ne.Transform.toString(ne),
21
+ transition: oe,
22
+ opacity: M ? 0.8 : 1,
23
+ zIndex: M ? 1 : 0,
20
24
  position: "relative"
21
- }, { isResizing: oe, disableResizingFlag: se } = ue(), b = t.isExpanded(), p = Ce(null), [le, ae] = Re(void 0);
25
+ }, { isResizing: se, disableResizingFlag: le } = ge(), y = t.isExpanded(), x = Ce(null), [ae, ce] = Re(void 0);
26
+ be(() => {
27
+ !y && x.current && ce(x.current.cells[0]?.clientHeight ?? x.current.offsetHeight);
28
+ }, [y]);
29
+ const de = q((e) => {
30
+ x.current = e, D || L(e);
31
+ }, [D, L]), H = y ? ae ?? p : p;
22
32
  xe(() => {
23
- !b && p.current && ae(p.current.cells[0]?.clientHeight ?? p.current.offsetHeight);
24
- }, [b]);
25
- const de = j((e) => {
26
- p.current = e, S || A(e);
27
- }, [S, A]), L = b ? le ?? h : h;
28
- pe(() => {
29
- J && t.getCanExpand() && !t.getIsExpanded() && t.toggleExpand();
33
+ Q && t.getCanExpand() && !t.getIsExpanded() && t.toggleExpand();
30
34
  }, []);
31
- const M = (e) => {
32
- t.getCanExpand() && !Y && t.getToggleExpandedHandler()(), document.getElementById(t.id)?.focus();
33
- const i = window.getSelection()?.type !== "Range" && !oe, o = C instanceof Function;
34
- !o && B && i ? t.toggleExpand() : o && i && C(e, t), se();
35
- }, ce = (e) => {
36
- e.target.classList.contains("MuiModal-backdrop") || e.target.nodeName === "INPUT" || e.target.nodeName === "BUTTON" || e.target.nodeName === "LI" || e.target.closest("li") || M(e);
37
- }, r = t.getVisibleCells().map((e, i, o) => ({
35
+ const O = (e) => {
36
+ t.getCanExpand() && !V && t.getToggleExpandedHandler()(), document.getElementById(t.id)?.focus();
37
+ const o = window.getSelection()?.type !== "Range" && !se, i = R instanceof Function;
38
+ !i && B && o ? t.toggleExpand() : i && o && R(e, t), le();
39
+ }, re = (e) => {
40
+ e.target.classList.contains("MuiModal-backdrop") || e.target.nodeName === "INPUT" || e.target.nodeName === "BUTTON" || e.target.nodeName === "LI" || e.target.closest("li") || O(e);
41
+ }, r = t.getVisibleCells().map((e, o, i) => ({
38
42
  ...e,
39
- left: o.slice(0, i).reduce((d, c) => d + (c.column.getSize() ?? 0), 0)
40
- })), T = g(() => r.filter((e) => !e.column.columnDef.fixedLeft && !e.column.columnDef.fixedRight && e.column.id !== "actions"), [r]), a = g(() => r.filter((e) => !!e.column.columnDef.fixedRight || e.column.id === "actions").map((e, i, o) => ({
43
+ left: i.slice(0, o).reduce((c, d) => c + (d.column.getSize() ?? 0), 0)
44
+ })), U = m(() => r.filter((e) => !e.column.columnDef.fixedLeft && !e.column.columnDef.fixedRight && e.column.id !== "actions"), [r]), a = m(() => r.filter((e) => !!e.column.columnDef.fixedRight || e.column.id === "actions").map((e, o, i) => ({
41
45
  ...e,
42
- right: o.slice(i + 1).reduce((d, c) => d + (c.column.getSize() ?? 0), 0)
43
- })), [r]), z = g(() => a.some((e) => e.column.id === O), [a]), U = !!R || !!Q, W = g(() => a.some((e) => !!e.column.columnDef.fixedRight), [a]), m = g(() => r.filter((e) => e.column.columnDef.fixedLeft), [r]), D = !X && !Z && ee, k = t.getIsSelected() && D, y = C instanceof Function, _ = v.length > 0 ? fe(v.map((e) => T[e])) : T, F = j((e, i) => {
44
- const o = e.column.id === O, d = e.column.columnDef.fixedLeft, c = !!e.column.columnDef.fixedRight, re = e.id === m.at(-1)?.id, me = e.id === a.at(0)?.id && !o, ge = t.isExpanded(), E = i === 0;
46
+ right: i.slice(o + 1).reduce((c, d) => c + (d.column.getSize() ?? 0), 0)
47
+ })), [r]), W = m(() => a.some((e) => e.column.id === $), [a]), _ = !!S || !!X, z = m(() => a.some((e) => !!e.column.columnDef.fixedRight), [a]), u = m(() => r.filter((e) => e.column.columnDef.fixedLeft), [r]), N = !Z && !ee && te, F = t.getIsSelected() && N, k = R instanceof Function, P = I.length > 0 ? he(I.map((e) => U[e])) : U, v = q((e, o) => {
48
+ const i = e.column.id === $, c = e.column.columnDef.fixedLeft, d = !!e.column.columnDef.fixedRight, ue = e.id === u.at(-1)?.id, fe = e.id === a.at(0)?.id && !i, me = t.isExpanded(), E = o === 0;
45
49
  return /* @__PURE__ */ s("td", {
46
- className: $(n["t-cell"], y && "cursor-pointer", I, o && n["action-cell"], o && (!U || W) && n["action-cell--no-shadow"], o && !!R && m.length && n.shadowed, o && (l?.(t) ? l?.(t) : n["action-cell-default-background"]), d && n["fixed-cell"], c && n["fixed-right-cell"], re && n.shadowed, me && n["shadowed-right"], t.getIsSelected() && n.selected, d && (l?.(t) ? l?.(t) : n["fixed-cell-default-background"]), c && (l?.(t) ? l?.(t) : n["fixed-right-cell-default-background"]), ge && n.expanded_row, (!!k || t.isFocused()) && n["single-selection"]),
50
+ className: j(n["t-cell"], k && "cursor-pointer", w, i && n["action-cell"], i && (!_ || z) && n["action-cell--no-shadow"], i && !!S && u.length && n.shadowed, i && (l?.(t) ? l?.(t) : n["action-cell-default-background"]), c && n["fixed-cell"], d && n["fixed-right-cell"], ue && n.shadowed, fe && n["shadowed-right"], t.getIsSelected() && n.selected, c && (l?.(t) ? l?.(t) : n["fixed-cell-default-background"]), d && (l?.(t) ? l?.(t) : n["fixed-right-cell-default-background"]), me && n.expanded_row, !!F && n["single-selection"]),
47
51
  style: {
48
- left: d ? e.left : void 0,
49
- right: c ? e.right + (z ? -1 : 0) : void 0
52
+ left: c ? e.left : void 0,
53
+ right: d ? e.right + (W ? -1 : 0) : void 0
50
54
  },
51
- children: /* @__PURE__ */ x("div", {
55
+ children: /* @__PURE__ */ b("div", {
52
56
  style: {
53
57
  display: "flex",
54
58
  alignItems: "center",
55
59
  minWidth: E ? 32 : void 0,
56
- minHeight: L,
60
+ minHeight: H,
57
61
  position: "relative"
58
62
  },
59
- children: [E && k && /* @__PURE__ */ s("span", {
63
+ children: [E && F && /* @__PURE__ */ s("span", {
60
64
  style: {
61
65
  display: "inline-flex",
62
66
  alignItems: "center",
@@ -65,94 +69,102 @@ function Me({ styledTableProps: P, row: t, index: K, columnWindow: { paddingLeft
65
69
  top: "50%",
66
70
  transform: "translateY(-50%)"
67
71
  },
68
- children: /* @__PURE__ */ s(ye, {})
72
+ children: /* @__PURE__ */ s(ke, {})
69
73
  }), /* @__PURE__ */ s("span", {
70
74
  style: {
71
- marginLeft: E && D ? 30 : 0,
75
+ marginLeft: E && N ? 30 : 0,
72
76
  width: "100%"
73
77
  },
74
- children: De(e.column.columnDef.cell, e.getContext())
78
+ children: ye(e.column.columnDef.cell, e.getContext())
75
79
  })]
76
80
  })
77
81
  }, e.id);
78
82
  }, [
79
- k,
80
- R,
81
- L,
83
+ F,
84
+ S,
85
+ H,
82
86
  l,
83
- y,
84
- z,
87
+ k,
85
88
  W,
86
- m,
89
+ z,
90
+ u,
87
91
  a,
88
92
  t,
89
- U,
90
- D,
91
- I
93
+ _,
94
+ N,
95
+ w
92
96
  ]);
93
- return /* @__PURE__ */ x(he, { children: [/* @__PURE__ */ x("tr", {
97
+ return /* @__PURE__ */ b(pe, { children: [/* @__PURE__ */ b("tr", {
94
98
  "aria-selected": t.getIsSelected() || t.isFocused() ? "true" : "false",
95
- tabIndex: t.isFocused() ? 0 : -1,
96
- "data-index": K,
99
+ tabIndex: t.isFocused() || f === 0 && !K ? 0 : -1,
100
+ "data-index": f,
97
101
  "data-test": t.id,
98
102
  id: t.id,
99
- className: $(n["t-row"], V && n["is-loading"], l?.(t)),
103
+ className: j(n["t-row"], G && n["is-loading"], l?.(t)),
100
104
  style: {
101
- height: h ? `${h}px` : "inherit",
102
- ...N && ie
105
+ height: p ? `${p}px` : "inherit",
106
+ ...T && ie
103
107
  },
104
108
  ref: de,
105
- onMouseUp: ce,
109
+ onFocus: (e) => {
110
+ e.target === e.currentTarget && !t.isFocused() && t.onChangeFocused(!0);
111
+ },
112
+ onMouseUp: re,
106
113
  onMouseDown: (e) => {
107
- e.detail > 1 && !y && B && e.preventDefault();
114
+ e.detail > 1 && !k && B && e.preventDefault();
108
115
  },
109
116
  onKeyDown: (e) => {
110
117
  switch (e.key) {
111
118
  case "Tab":
119
+ if (e.preventDefault(), e.shiftKey) {
120
+ if (t.focusPrevRow()) break;
121
+ e.currentTarget.closest("table")?.querySelector('thead tr[tabindex="0"]')?.focus();
122
+ } else t.focusNextRow() || Fe(e.currentTarget);
123
+ break;
112
124
  case "ArrowDown":
113
- t.focusNextRow(), e.preventDefault();
125
+ t.focusNextRow() && e.preventDefault();
114
126
  break;
115
127
  case "ArrowUp":
116
- t.focusPrevRow(), e.preventDefault();
128
+ t.focusPrevRow() && e.preventDefault();
117
129
  break;
118
130
  case "Enter":
119
- M(e);
131
+ O(e);
120
132
  break;
121
133
  }
122
134
  },
123
135
  children: [
124
- m.map((e, i) => F(e, i)),
125
- u > 0 && /* @__PURE__ */ s("td", {
136
+ u.map((e, o) => v(e, o)),
137
+ g > 0 && /* @__PURE__ */ s("td", {
126
138
  "aria-hidden": !0,
127
139
  className: n["t-cell"],
128
140
  style: {
129
- width: String(u) + "px",
130
- minWidth: String(u) + "px",
131
- maxWidth: String(u) + "px",
141
+ width: String(g) + "px",
142
+ minWidth: String(g) + "px",
143
+ maxWidth: String(g) + "px",
132
144
  padding: 0,
133
145
  border: "none"
134
146
  }
135
147
  }),
136
- _.map((e, i) => F(e, m.length + i)),
137
- f > 0 && /* @__PURE__ */ s("td", {
148
+ P.map((e, o) => v(e, u.length + o)),
149
+ h > 0 && /* @__PURE__ */ s("td", {
138
150
  "aria-hidden": !0,
139
151
  className: n["t-cell"],
140
152
  style: {
141
- width: String(f) + "px",
142
- minWidth: String(f) + "px",
143
- maxWidth: String(f) + "px",
153
+ width: String(h) + "px",
154
+ minWidth: String(h) + "px",
155
+ maxWidth: String(h) + "px",
144
156
  padding: 0,
145
157
  border: "none"
146
158
  }
147
159
  }),
148
- a.map((e, i) => F(e, m.length + _.length + i))
160
+ a.map((e, o) => v(e, u.length + P.length + o))
149
161
  ]
150
- }), t.getIsExpanded() && /* @__PURE__ */ s(Se, { children: w && G?.({
151
- rows: w.get(t.original.id.toString()) ?? [],
162
+ }), t.getIsExpanded() && /* @__PURE__ */ s(Se, { children: A && J?.({
163
+ rows: A.get(t.original.id.toString()) ?? [],
152
164
  row: t.original
153
165
  }) })] }, t.id);
154
166
  }
155
- var ye = () => /* @__PURE__ */ x("svg", {
167
+ var ke = () => /* @__PURE__ */ b("svg", {
156
168
  xmlns: "http://www.w3.org/2000/svg",
157
169
  width: "20",
158
170
  height: "20",
@@ -164,5 +176,5 @@ var ye = () => /* @__PURE__ */ x("svg", {
164
176
  })]
165
177
  });
166
178
  export {
167
- Me as TableRow
179
+ Oe as TableRow
168
180
  };
@@ -1,12 +1,14 @@
1
- import { TableRow as i } from "./TableRow.js";
2
- import { Fragment as m, jsx as t } from "react/jsx-runtime";
3
- function R({ styledTableProps: o, table: r, columnWindow: n }) {
4
- return /* @__PURE__ */ t(m, { children: (o.hideFooter ? r.getExpandedRowModel().rows : r.getRowModel().rows).map((e, d) => /* @__PURE__ */ t(i, {
5
- styledTableProps: o,
6
- row: e,
7
- index: d,
1
+ import { TableRow as m } from "./TableRow.js";
2
+ import { Fragment as w, jsx as t } from "react/jsx-runtime";
3
+ function R({ styledTableProps: e, table: r, columnWindow: n }) {
4
+ const s = e.hideFooter ? r.getExpandedRowModel().rows : r.getRowModel().rows, d = s.some((o) => o.isFocused());
5
+ return /* @__PURE__ */ t(w, { children: s.map((o, i) => /* @__PURE__ */ t(m, {
6
+ styledTableProps: e,
7
+ row: o,
8
+ index: i,
9
+ hasFocusedRow: d,
8
10
  columnWindow: n
9
- }, e.id)) });
11
+ }, o.id)) });
10
12
  }
11
13
  export {
12
14
  R as TableRows