@panneau/lists 5.0.0-alpha.16 → 5.0.0-alpha.17

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 (42) hide show
  1. package/dist/ListView.d.ts +7 -1
  2. package/dist/ListView.d.ts.map +1 -1
  3. package/dist/ListView.js +37 -31
  4. package/dist/ListView.js.map +1 -1
  5. package/dist/actions/ActionButton.d.ts +7 -1
  6. package/dist/actions/ActionButton.d.ts.map +1 -1
  7. package/dist/actions/ActionButton.js +74 -72
  8. package/dist/actions/ActionButton.js.map +1 -1
  9. package/dist/actions/Actions.css +12 -0
  10. package/dist/actions/Actions.module.js +6 -2
  11. package/dist/actions/Actions.module.js.map +1 -1
  12. package/dist/actions/RowActions.d.ts +21 -4
  13. package/dist/actions/RowActions.d.ts.map +1 -1
  14. package/dist/actions/RowActions.js +149 -84
  15. package/dist/actions/RowActions.js.map +1 -1
  16. package/dist/actions/fit.d.ts +25 -0
  17. package/dist/actions/fit.d.ts.map +1 -0
  18. package/dist/actions/fit.js +197 -0
  19. package/dist/actions/fit.js.map +1 -0
  20. package/dist/actions/icons.d.ts +5 -0
  21. package/dist/actions/icons.d.ts.map +1 -1
  22. package/dist/actions/icons.js +15 -1
  23. package/dist/actions/icons.js.map +1 -1
  24. package/dist/displays/Displays.css +6 -1
  25. package/dist/displays/Displays.module.js +4 -2
  26. package/dist/displays/Displays.module.js.map +1 -1
  27. package/dist/displays/displays.d.ts +3 -2
  28. package/dist/displays/displays.d.ts.map +1 -1
  29. package/dist/displays/displays.js +91 -39
  30. package/dist/displays/displays.js.map +1 -1
  31. package/dist/layouts/CardsLayout.d.ts.map +1 -1
  32. package/dist/layouts/CardsLayout.js +90 -93
  33. package/dist/layouts/CardsLayout.js.map +1 -1
  34. package/dist/layouts/GalleryLayout.css +7 -0
  35. package/dist/layouts/GalleryLayout.d.ts.map +1 -1
  36. package/dist/layouts/GalleryLayout.js +76 -53
  37. package/dist/layouts/GalleryLayout.js.map +1 -1
  38. package/dist/layouts/GalleryLayout.module.js.map +1 -1
  39. package/dist/layouts/TableLayout.d.ts.map +1 -1
  40. package/dist/layouts/TableLayout.js +120 -93
  41. package/dist/layouts/TableLayout.js.map +1 -1
  42. package/package.json +7 -7
@@ -1,7 +1,8 @@
1
- import { getActionIcon } from "./icons.js";
1
+ import Actions_module_default from "./Actions.module.js";
2
+ import { getActionIcon, getActionTone } from "./icons.js";
2
3
  import { c } from "react/compiler-runtime";
3
4
  import { getActionLabel } from "@panneau/intl";
4
- import { Button, LinkButton, usePanneauIntl } from "@panneau/ui";
5
+ import { Button, LinkButton, Tooltip, usePanneauIntl } from "@panneau/ui";
5
6
  import { jsx } from "react/jsx-runtime";
6
7
  //#region src/actions/ActionButton.tsx
7
8
  /** Whether a link leaves the admin: it opens in a new tab. */
@@ -10,93 +11,94 @@ function isExternal(href) {
10
11
  }
11
12
  /** An action as a button, or as a link for a `link` action with a URL. */
12
13
  function ActionButton(t0) {
13
- const $ = c(29);
14
- const { action, icons, href, onPress, isPending: t1, isDisabled: t2, size: t3, "aria-label": ariaLabel } = t0;
14
+ const $ = c(27);
15
+ const { action, icons, href, onPress, isPending: t1, isDisabled: t2, size: t3, iconOnly: t4, "aria-label": ariaLabel } = t0;
15
16
  const isPending = t1 === void 0 ? false : t1;
16
17
  const isDisabled = t2 === void 0 ? false : t2;
17
18
  const size = t3 === void 0 ? "sm" : t3;
19
+ const iconOnly = t4 === void 0 ? false : t4;
18
20
  const intl = usePanneauIntl();
19
- let t4;
21
+ let t5;
20
22
  if ($[0] !== action || $[1] !== icons) {
21
- t4 = getActionIcon(action, icons);
23
+ t5 = getActionIcon(action, icons);
22
24
  $[0] = action;
23
25
  $[1] = icons;
24
- $[2] = t4;
25
- } else t4 = $[2];
26
- const icon = t4;
27
- let t5;
26
+ $[2] = t5;
27
+ } else t5 = $[2];
28
+ const icon = t5;
29
+ let t6;
28
30
  if ($[3] !== action || $[4] !== intl) {
29
- t5 = getActionLabel(action, intl);
31
+ t6 = getActionLabel(action, intl);
30
32
  $[3] = action;
31
33
  $[4] = intl;
32
- $[5] = t5;
33
- } else t5 = $[5];
34
- const label = t5;
35
- const variant = action.destructive === true ? "danger" : size === "sm" ? "ghost" : "secondary";
36
- if (href !== null) {
37
- let t6;
38
- if ($[6] !== icon) {
39
- t6 = icon !== void 0 ? { icon } : {};
40
- $[6] = icon;
41
- $[7] = t6;
42
- } else t6 = $[7];
43
- let t7;
44
- if ($[8] !== href) {
45
- t7 = isExternal(href);
46
- $[8] = href;
47
- $[9] = t7;
48
- } else t7 = $[9];
49
- let t8;
50
- if ($[10] !== ariaLabel || $[11] !== href || $[12] !== label || $[13] !== size || $[14] !== t6 || $[15] !== t7 || $[16] !== variant) {
51
- t8 = /* @__PURE__ */ jsx(LinkButton, {
52
- href,
53
- size,
54
- variant,
55
- ...t6,
56
- external: t7,
57
- "aria-label": ariaLabel,
58
- children: label
59
- });
60
- $[10] = ariaLabel;
61
- $[11] = href;
62
- $[12] = label;
63
- $[13] = size;
64
- $[14] = t6;
65
- $[15] = t7;
66
- $[16] = variant;
67
- $[17] = t8;
68
- } else t8 = $[17];
69
- return t8;
70
- }
71
- let t6;
72
- if ($[18] !== icon) {
73
- t6 = icon !== void 0 ? { icon } : {};
74
- $[18] = icon;
75
- $[19] = t6;
76
- } else t6 = $[19];
34
+ $[5] = t6;
35
+ } else t6 = $[5];
36
+ const label = t6;
37
+ const destructive = action.destructive === true;
38
+ const inRow = size === "sm";
77
39
  let t7;
78
- if ($[20] !== ariaLabel || $[21] !== isDisabled || $[22] !== isPending || $[23] !== label || $[24] !== onPress || $[25] !== size || $[26] !== t6 || $[27] !== variant) {
79
- t7 = /* @__PURE__ */ jsx(Button, {
40
+ if ($[6] !== action || $[7] !== destructive || $[8] !== inRow) {
41
+ t7 = inRow ? getActionTone(action) : destructive ? "danger" : "neutral";
42
+ $[6] = action;
43
+ $[7] = destructive;
44
+ $[8] = inRow;
45
+ $[9] = t7;
46
+ } else t7 = $[9];
47
+ const tone = t7;
48
+ const appearance = inRow ? "subtle" : destructive ? "solid" : "outline";
49
+ const onlyIcon = iconOnly && icon !== void 0;
50
+ const name = ariaLabel ?? (onlyIcon ? label : void 0);
51
+ let t8;
52
+ if ($[10] !== appearance || $[11] !== href || $[12] !== icon || $[13] !== isDisabled || $[14] !== isPending || $[15] !== label || $[16] !== name || $[17] !== onPress || $[18] !== onlyIcon || $[19] !== size || $[20] !== tone) {
53
+ t8 = href !== null ? /* @__PURE__ */ jsx(LinkButton, {
54
+ href,
55
+ size,
56
+ tone,
57
+ appearance,
58
+ ...icon !== void 0 ? { icon } : {},
59
+ external: isExternal(href),
60
+ "aria-label": name,
61
+ className: onlyIcon ? Actions_module_default.iconOnly : void 0,
62
+ children: onlyIcon ? null : label
63
+ }) : /* @__PURE__ */ jsx(Button, {
80
64
  size,
81
- variant,
82
- ...t6,
65
+ tone,
66
+ appearance,
67
+ ...icon !== void 0 ? { icon } : {},
83
68
  isPending,
84
69
  isDisabled,
85
- "aria-label": ariaLabel,
70
+ "aria-label": name,
71
+ className: onlyIcon ? Actions_module_default.iconOnly : void 0,
86
72
  onPress,
87
- children: label
73
+ children: onlyIcon ? null : label
88
74
  });
89
- $[20] = ariaLabel;
90
- $[21] = isDisabled;
91
- $[22] = isPending;
75
+ $[10] = appearance;
76
+ $[11] = href;
77
+ $[12] = icon;
78
+ $[13] = isDisabled;
79
+ $[14] = isPending;
80
+ $[15] = label;
81
+ $[16] = name;
82
+ $[17] = onPress;
83
+ $[18] = onlyIcon;
84
+ $[19] = size;
85
+ $[20] = tone;
86
+ $[21] = t8;
87
+ } else t8 = $[21];
88
+ const button = t8;
89
+ let t9;
90
+ if ($[22] !== button || $[23] !== label || $[24] !== name || $[25] !== onlyIcon) {
91
+ t9 = onlyIcon ? /* @__PURE__ */ jsx(Tooltip, {
92
+ content: name ?? label,
93
+ children: button
94
+ }) : button;
95
+ $[22] = button;
92
96
  $[23] = label;
93
- $[24] = onPress;
94
- $[25] = size;
95
- $[26] = t6;
96
- $[27] = variant;
97
- $[28] = t7;
98
- } else t7 = $[28];
99
- return t7;
97
+ $[24] = name;
98
+ $[25] = onlyIcon;
99
+ $[26] = t9;
100
+ } else t9 = $[26];
101
+ return t9;
100
102
  }
101
103
  //#endregion
102
104
  export { ActionButton };
@@ -1 +1 @@
1
- {"version":3,"file":"ActionButton.js","names":["getActionLabel","Action","Button","LinkButton","usePanneauIntl","ActionIcons","getActionIcon","ActionButtonProps","action","icons","href","onPress","isPending","isDisabled","size","isExternal","test","ActionButton","t0","$","_c","t1","t2","t3","ariaLabel","undefined","intl","t4","icon","t5","label","variant","destructive","t6","t7","t8","_c"],"sources":["../../src/actions/ActionButton.tsx"],"sourcesContent":["import { getActionLabel } from '@panneau/intl';\nimport type { Action } from '@panneau/protocol';\nimport { Button, LinkButton, usePanneauIntl } from '@panneau/ui';\n\nimport { type ActionIcons, getActionIcon } from './icons';\n\nexport interface ActionButtonProps {\n action: Action;\n /** Icons of actions by id, over the icon the action names. */\n icons?: ActionIcons | undefined;\n /** The link of a `link` action. Links go through React Aria, so an app's router handles them. */\n href: string | null;\n onPress: () => void;\n isPending?: boolean;\n isDisabled?: boolean;\n size?: 'sm' | 'md';\n /** Accessible label, when the label alone isn't enough (`Edit Ada Lovelace`). */\n 'aria-label'?: string;\n}\n\n/** Whether a link leaves the admin: it opens in a new tab. */\nfunction isExternal(href: string): boolean {\n return /^https?:\\/\\//.test(href);\n}\n\n/** An action as a button, or as a link for a `link` action with a URL. */\nexport function ActionButton({\n action,\n icons,\n href,\n onPress,\n isPending = false,\n isDisabled = false,\n size = 'sm',\n 'aria-label': ariaLabel,\n}: ActionButtonProps) {\n const intl = usePanneauIntl();\n const icon = getActionIcon(action, icons);\n const label = getActionLabel(action, intl);\n // Small actions sit in rows, as ghost buttons; others beside the buttons of a toolbar.\n const variant = action.destructive === true ? 'danger' : size === 'sm' ? 'ghost' : 'secondary';\n if (href !== null) {\n return (\n <LinkButton\n href={href}\n size={size}\n variant={variant}\n {...(icon !== undefined ? { icon } : {})}\n external={isExternal(href)}\n aria-label={ariaLabel}\n >\n {label}\n </LinkButton>\n );\n }\n return (\n <Button\n size={size}\n variant={variant}\n {...(icon !== undefined ? { icon } : {})}\n isPending={isPending}\n isDisabled={isDisabled}\n aria-label={ariaLabel}\n onPress={onPress}\n >\n {label}\n </Button>\n );\n}\n"],"mappings":";;;;;;;AAqBA,SAASe,WAAWL,MAAuB;CACvC,OAAO,eAAeM,KAAKN,IAAI;AACnC;;AAGA,SAAOO,aAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAsB,MAAA,EAAAZ,QAAAC,OAAAC,MAAAC,SAAAC,WAAAS,IAAAR,YAAAS,IAAAR,MAAAS,IAAA,cAAAC,cAAAN;CAKzB,MAAAN,YAAAS,OAAAI,KAAAA,IAAA,QAAAJ;CACA,MAAAR,aAAAS,OAAAG,KAAAA,IAAA,QAAAH;CACA,MAAAR,OAAAS,OAAAE,KAAAA,IAAA,OAAAF;CAGA,MAAAG,OAAatB,eAAe;CAAE,IAAAuB;CAAA,IAAAR,EAAA,OAAAX,UAAAW,EAAA,OAAAV,OAAA;EACjBkB,KAAArB,cAAcE,QAAQC,KAAK;EAACU,EAAA,KAAAX;EAAAW,EAAA,KAAAV;EAAAU,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAzC,MAAAS,OAAaD;CAA6B,IAAAE;CAAA,IAAAV,EAAA,OAAAX,UAAAW,EAAA,OAAAO,MAAA;EAC5BG,KAAA7B,eAAeQ,QAAQkB,IAAI;EAACP,EAAA,KAAAX;EAAAW,EAAA,KAAAO;EAAAP,EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAA1C,MAAAW,QAAcD;CAEd,MAAAE,UAAgBvB,OAAMwB,gBAAiB,OAAvB,WAAyClB,SAAS,OAAT,UAAA;CACzD,IAAIJ,SAAS,MAAI;EAAA,IAAAuB;EAAA,IAAAd,EAAA,OAAAS,MAAA;G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E,CAAA;EAUEX,EAAA,MAAAK;EAAAL,EAAA,MAAAN;EAAAM,EAAA,MAAAP;EAAAO,EAAA,MAAAW;EAAAX,EAAA,MAAAR;EAAAQ,EAAA,MAAAL;EAAAK,EAAA,MAAAc;EAAAd,EAAA,MAAAY;EAAAZ,EAAA,MAAAe;CAAA,OAAAA,KAAAf,EAAA;CAAA,OAVTe;AAUS"}
1
+ {"version":3,"file":"ActionButton.js","names":["getActionLabel","Action","Button","LinkButton","Tooltip","usePanneauIntl","styles","ActionIcons","getActionIcon","getActionTone","ActionButtonProps","action","icons","href","onPress","isPending","isDisabled","size","iconOnly","isExternal","test","ActionButton","t0","$","_c","t1","t2","t3","t4","ariaLabel","undefined","intl","t5","icon","t6","label","destructive","inRow","t7","tone","appearance","onlyIcon","name","t8","button","t9","_c","styles"],"sources":["../../src/actions/ActionButton.tsx"],"sourcesContent":["import { getActionLabel } from '@panneau/intl';\nimport type { Action } from '@panneau/protocol';\nimport { Button, LinkButton, Tooltip, usePanneauIntl } from '@panneau/ui';\n\nimport styles from './Actions.module.css';\nimport { type ActionIcons, getActionIcon, getActionTone } from './icons';\n\nexport interface ActionButtonProps {\n action: Action;\n /** Icons of actions by id, over the icon the action names. */\n icons?: ActionIcons | undefined;\n /** The link of a `link` action. Links go through React Aria, so an app's router handles them. */\n href: string | null;\n onPress: () => void;\n isPending?: boolean;\n isDisabled?: boolean;\n size?: 'sm' | 'md';\n /**\n * Only the icon, in the color of the action, with the label as its accessible name and\n * tooltip, as rows show their actions (decision 0060). An action without an icon keeps its\n * label.\n */\n iconOnly?: boolean;\n /** Accessible label, when the label alone isn't enough (`Edit Ada Lovelace`). */\n 'aria-label'?: string;\n}\n\n/** Whether a link leaves the admin: it opens in a new tab. */\nfunction isExternal(href: string): boolean {\n return /^https?:\\/\\//.test(href);\n}\n\n/** An action as a button, or as a link for a `link` action with a URL. */\nexport function ActionButton({\n action,\n icons,\n href,\n onPress,\n isPending = false,\n isDisabled = false,\n size = 'sm',\n iconOnly = false,\n 'aria-label': ariaLabel,\n}: ActionButtonProps) {\n const intl = usePanneauIntl();\n const icon = getActionIcon(action, icons);\n const label = getActionLabel(action, intl);\n const destructive = action.destructive === true;\n // In rows, the color of the action, tinted (decision 0060); beside the buttons of a toolbar,\n // outlined (solid when it destroys).\n const inRow = size === 'sm';\n const tone = inRow ? getActionTone(action) : destructive ? 'danger' : 'neutral';\n const appearance = inRow ? 'subtle' : destructive ? 'solid' : 'outline';\n const onlyIcon = iconOnly && icon !== undefined;\n const name = ariaLabel ?? (onlyIcon ? label : undefined);\n const button =\n href !== null ? (\n <LinkButton\n href={href}\n size={size}\n tone={tone}\n appearance={appearance}\n {...(icon !== undefined ? { icon } : {})}\n external={isExternal(href)}\n aria-label={name}\n className={onlyIcon ? styles.iconOnly : undefined}\n >\n {onlyIcon ? null : label}\n </LinkButton>\n ) : (\n <Button\n size={size}\n tone={tone}\n appearance={appearance}\n {...(icon !== undefined ? { icon } : {})}\n isPending={isPending}\n isDisabled={isDisabled}\n aria-label={name}\n className={onlyIcon ? styles.iconOnly : undefined}\n onPress={onPress}\n >\n {onlyIcon ? null : label}\n </Button>\n );\n return onlyIcon ? <Tooltip content={name ?? label}>{button}</Tooltip> : button;\n}\n"],"mappings":";;;;;;;;AA4BA,SAASmB,WAAWN,MAAuB;CACvC,OAAO,eAAeO,KAAKP,IAAI;AACnC;;AAGA,SAAOQ,aAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAsB,MAAA,EAAAb,QAAAC,OAAAC,MAAAC,SAAAC,WAAAU,IAAAT,YAAAU,IAAAT,MAAAU,IAAAT,UAAAU,IAAA,cAAAC,cAAAP;CAKzB,MAAAP,YAAAU,OAAAK,KAAAA,IAAA,QAAAL;CACA,MAAAT,aAAAU,OAAAI,KAAAA,IAAA,QAAAJ;CACA,MAAAT,OAAAU,OAAAG,KAAAA,IAAA,OAAAH;CACA,MAAAT,WAAAU,OAAAE,KAAAA,IAAA,QAAAF;CAGA,MAA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square. Doubled: over the padding of the button. */
27
+ .panneau-actions-icon-only.panneau-actions-icon-only {
28
+ width: var(--panneau-control-height-sm);
29
+ padding: 0;
30
+ }
31
+
32
+ /* The place of an action that other rows have: the rows' actions line up (decision 0060). */
33
+ .panneau-actions-placeholder {
34
+ display: inline-flex;
35
+ visibility: hidden;
36
+ }
@@ -4,13 +4,17 @@ var row = "panneau-actions-row";
4
4
  var toolbar = "panneau-actions-toolbar";
5
5
  var message = "panneau-actions-message";
6
6
  var skipped = "panneau-actions-skipped";
7
+ var iconOnly = "panneau-actions-icon-only";
8
+ var placeholder = "panneau-actions-placeholder";
7
9
  var Actions_module_default = {
8
10
  row,
9
11
  toolbar,
10
12
  message,
11
- skipped
13
+ skipped,
14
+ iconOnly,
15
+ placeholder
12
16
  };
13
17
  //#endregion
14
- export { Actions_module_default as default, message, row, skipped, toolbar };
18
+ export { Actions_module_default as default, iconOnly, message, placeholder, row, skipped, toolbar };
15
19
 
16
20
  //# sourceMappingURL=Actions.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.module.js","names":[],"sources":["../../src/actions/Actions.module.css"],"sourcesContent":["/* The actions of a row wrap where they don't fit, in a narrow list or a card. */\n.row {\n display: inline-flex;\n flex-wrap: wrap;\n max-width: 100%;\n align-items: center;\n gap: var(--panneau-space-2);\n}\n\n.toolbar {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--panneau-space-2);\n}\n\n.message {\n margin: 0;\n}\n\n.skipped {\n margin: var(--panneau-space-2) 0 0;\n color: var(--panneau-color-warning);\n}\n"],"mappings":""}
1
+ {"version":3,"file":"Actions.module.js","names":[],"sources":["../../src/actions/Actions.module.css"],"sourcesContent":["/* The actions of a row wrap where they don't fit, in a narrow list or a card. */\n.row {\n display: inline-flex;\n flex-wrap: wrap;\n max-width: 100%;\n align-items: center;\n gap: var(--panneau-space-2);\n}\n\n.toolbar {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--panneau-space-2);\n}\n\n.message {\n margin: 0;\n}\n\n.skipped {\n margin: var(--panneau-space-2) 0 0;\n color: var(--panneau-color-warning);\n}\n\n/* An action shown by its icon alone, square. Doubled: over the padding of the button. */\n.iconOnly.iconOnly {\n width: var(--panneau-control-height-sm);\n padding: 0;\n}\n\n/* The place of an action that other rows have: the rows' actions line up (decision 0060). */\n.placeholder {\n display: inline-flex;\n visibility: hidden;\n}\n"],"mappings":""}
@@ -4,16 +4,33 @@ import { type ActionIcons } from './icons.js';
4
4
  export interface RowActionsProps {
5
5
  /** The label of the item, for the accessible names of its actions. */
6
6
  itemLabel: string;
7
- /** Actions shown as buttons, with their links (`getItemActions()` of `@panneau/core`). */
7
+ /** Actions placed in `row`, with their links (`selectItemActions()` of `@panneau/core`). */
8
8
  actions: readonly ItemAction[];
9
- /** Actions in the overflow menu. */
9
+ /** Actions placed in `menu`: icons too while they fit, the first to go in the menu. */
10
10
  menu: readonly ItemAction[];
11
11
  /** Id of the action that is running on this item, if any. */
12
12
  pending: string | null;
13
13
  onRun: (action: Action) => void;
14
14
  /** Icons of actions by id, over the icon the action names. */
15
15
  icons?: ActionIcons | undefined;
16
+ /**
17
+ * The actions of every row of the list, in order (`orderRowActions()`): a row keeps the place
18
+ * of those it doesn't have, so the actions of the rows line up. Without it, its own.
19
+ */
20
+ slots?: readonly ItemAction[] | undefined;
21
+ /** The id of the main action of rows, which keeps its label (`show` or `edit`). */
22
+ primary?: string | null | undefined;
16
23
  }
17
- /** The actions of a row: buttons, then an overflow menu. */
18
- export declare function RowActions({ itemLabel, actions, menu, pending, onRun, icons }: RowActionsProps): import("react").JSX.Element;
24
+ /**
25
+ * The actions of a row in their order: those placed in `row`, then those placed in `menu`, and
26
+ * those that destroy last. The last ones are the first to go in the menu.
27
+ */
28
+ export declare function orderRowActions(actions: readonly ItemAction[], menu: readonly ItemAction[]): ItemAction[];
29
+ /**
30
+ * The actions of a row (decision 0060): their icons, in their colors, with their labels as names
31
+ * and tooltips, but the main action, which keeps its label while the row has room; and when the
32
+ * icons don't fit, the last ones in an overflow menu, which never holds a single action. How they fit is the same for every row of the list (`RowActionsFit`), and a
33
+ * row keeps the place of the actions of other rows that it doesn't have, so they line up.
34
+ */
35
+ export declare function RowActions({ itemLabel, actions, menu, pending, onRun, icons, slots, primary, }: RowActionsProps): import("react").JSX.Element;
19
36
  //# sourceMappingURL=RowActions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RowActions.d.ts","sourceRoot":"","sources":["../../src/actions/RowActions.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAMhD,OAAO,EAAE,KAAK,WAAW,EAAiB,MAAM,SAAS,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC5B,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,0FAA0F;IAC1F,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IAC/B,oCAAoC;IACpC,IAAI,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5B,6DAA6D;IAC7D,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,8DAA8D;IAC9D,KAAK,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CACnC;AAED,4DAA4D;AAC5D,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,eAAe,+BAyD9F"}
1
+ {"version":3,"file":"RowActions.d.ts","sourceRoot":"","sources":["../../src/actions/RowActions.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAOhD,OAAO,EAAE,KAAK,WAAW,EAAiB,MAAM,SAAS,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC5B,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,4FAA4F;IAC5F,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IAC/B,uFAAuF;IACvF,IAAI,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5B,6DAA6D;IAC7D,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,8DAA8D;IAC9D,KAAK,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,CAAC;IAC1C,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACvC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC3B,OAAO,EAAE,SAAS,UAAU,EAAE,EAC9B,IAAI,EAAE,SAAS,UAAU,EAAE,GAC5B,UAAU,EAAE,CASd;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACvB,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAO,EACP,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAc,GACjB,EAAE,eAAe,+BA0FjB"}
@@ -1,105 +1,170 @@
1
1
  import { messages } from "../messages.js";
2
2
  import Actions_module_default from "./Actions.module.js";
3
3
  import { getActionIcon } from "./icons.js";
4
+ import { RowActionsFit } from "./fit.js";
4
5
  import { ActionButton } from "./ActionButton.js";
5
6
  import { c } from "react/compiler-runtime";
6
7
  import { getActionLabel } from "@panneau/intl";
7
8
  import { IconButton, Menu, MenuItem, MenuTrigger, usePanneauIntl } from "@panneau/ui";
8
9
  import { jsx, jsxs } from "react/jsx-runtime";
9
10
  import { Ellipsis } from "lucide-react";
11
+ import { use } from "react";
10
12
  //#region src/actions/RowActions.tsx
11
- /** The actions of a row: buttons, then an overflow menu. */
13
+ /**
14
+ * The actions of a row in their order: those placed in `row`, then those placed in `menu`, and
15
+ * those that destroy last. The last ones are the first to go in the menu.
16
+ */
17
+ function orderRowActions(actions, menu) {
18
+ const all = [...actions, ...menu].filter((entry, index, list) => list.findIndex((other) => other.action.id === entry.action.id) === index);
19
+ return [...all.filter(({ action }) => action.destructive !== true), ...all.filter(({ action }) => action.destructive === true)];
20
+ }
21
+ /**
22
+ * The actions of a row (decision 0060): their icons, in their colors, with their labels as names
23
+ * and tooltips, but the main action, which keeps its label while the row has room; and when the
24
+ * icons don't fit, the last ones in an overflow menu, which never holds a single action. How they fit is the same for every row of the list (`RowActionsFit`), and a
25
+ * row keeps the place of the actions of other rows that it doesn't have, so they line up.
26
+ */
12
27
  function RowActions(t0) {
13
- const $ = c(23);
14
- const { itemLabel, actions, menu, pending, onRun, icons } = t0;
28
+ const $ = c(30);
29
+ const { itemLabel, actions, menu, pending, onRun, icons, slots, primary: t1 } = t0;
30
+ const primary = t1 === void 0 ? null : t1;
15
31
  const intl = usePanneauIntl();
16
- let t1;
17
- if ($[0] !== actions || $[1] !== icons || $[2] !== intl || $[3] !== itemLabel || $[4] !== onRun || $[5] !== pending) {
18
- let t2;
19
- if ($[7] !== icons || $[8] !== intl || $[9] !== itemLabel || $[10] !== onRun || $[11] !== pending) {
20
- t2 = (t3) => {
21
- const { action, href } = t3;
22
- return /* @__PURE__ */ jsx(ActionButton, {
23
- action,
24
- icons,
25
- href,
26
- isPending: pending === action.id,
27
- isDisabled: pending !== null && pending !== action.id,
28
- "aria-label": intl.formatMessage(messages.actionOnItem, {
29
- action: getActionLabel(action, intl),
30
- item: itemLabel
31
- }),
32
- onPress: () => onRun(action)
33
- }, action.id);
32
+ const level = use(RowActionsFit);
33
+ let t2;
34
+ if ($[0] !== actions || $[1] !== icons || $[2] !== intl || $[3] !== itemLabel || $[4] !== level || $[5] !== menu || $[6] !== onRun || $[7] !== pending || $[8] !== primary || $[9] !== slots) {
35
+ const own = orderRowActions(actions, menu);
36
+ let t3;
37
+ if ($[11] !== slots) {
38
+ t3 = (t4) => {
39
+ const { action } = t4;
40
+ return slots?.some((slot) => slot.action.id === action.id) !== true;
34
41
  };
35
- $[7] = icons;
36
- $[8] = intl;
37
- $[9] = itemLabel;
38
- $[10] = onRun;
39
- $[11] = pending;
40
- $[12] = t2;
41
- } else t2 = $[12];
42
- t1 = actions.map(t2);
42
+ $[11] = slots;
43
+ $[12] = t3;
44
+ } else t3 = $[12];
45
+ const all = [...slots ?? [], ...own.filter(t3)];
46
+ const find = (slot_0) => own.find((t4) => {
47
+ const { action: action_0 } = t4;
48
+ return action_0.id === slot_0.action.id;
49
+ });
50
+ const inMenu = level >= 2 && all.length >= 2 ? Math.min(level, all.length) : 0;
51
+ const shown = all.slice(0, all.length - inMenu);
52
+ const overflow = all.slice(all.length - inMenu).flatMap((slot_1) => find(slot_1) ?? []);
53
+ let t5;
54
+ if ($[13] !== intl || $[14] !== itemLabel) {
55
+ t5 = (action_1) => intl.formatMessage(messages.actionOnItem, {
56
+ action: getActionLabel(action_1, intl),
57
+ item: itemLabel
58
+ });
59
+ $[13] = intl;
60
+ $[14] = itemLabel;
61
+ $[15] = t5;
62
+ } else t5 = $[15];
63
+ const name = t5;
64
+ let t6;
65
+ if ($[16] !== icons || $[17] !== level || $[18] !== name || $[19] !== onRun || $[20] !== pending || $[21] !== primary) {
66
+ t6 = (entry) => /* @__PURE__ */ jsx(ActionButton, {
67
+ action: entry.action,
68
+ icons,
69
+ href: entry.href,
70
+ iconOnly: level >= 1 || entry.action.id !== primary,
71
+ isPending: pending === entry.action.id,
72
+ isDisabled: pending !== null && pending !== entry.action.id,
73
+ "aria-label": name(entry.action),
74
+ onPress: () => onRun(entry.action)
75
+ }, entry.action.id);
76
+ $[16] = icons;
77
+ $[17] = level;
78
+ $[18] = name;
79
+ $[19] = onRun;
80
+ $[20] = pending;
81
+ $[21] = primary;
82
+ $[22] = t6;
83
+ } else t6 = $[22];
84
+ const button = t6;
85
+ const placeholder = _temp;
86
+ let t7;
87
+ if ($[23] !== intl || $[24] !== itemLabel) {
88
+ t7 = intl.formatMessage(messages.itemActions, { item: itemLabel });
89
+ $[23] = intl;
90
+ $[24] = itemLabel;
91
+ $[25] = t7;
92
+ } else t7 = $[25];
93
+ const t8 = overflow.length >= 2;
94
+ const t9 = pending !== null && overflow.some((t10) => {
95
+ const { action: action_2 } = t10;
96
+ return action_2.id === pending;
97
+ });
98
+ let t11;
99
+ if ($[26] !== t7 || $[27] !== t8 || $[28] !== t9) {
100
+ t11 = /* @__PURE__ */ jsx(IconButton, {
101
+ icon: Ellipsis,
102
+ size: "sm",
103
+ appearance: "subtle",
104
+ label: t7,
105
+ showTooltip: t8,
106
+ isPending: t9
107
+ });
108
+ $[26] = t7;
109
+ $[27] = t8;
110
+ $[28] = t9;
111
+ $[29] = t11;
112
+ } else t11 = $[29];
113
+ const menuButton = t11;
114
+ t2 = /* @__PURE__ */ jsxs("div", {
115
+ className: Actions_module_default.row,
116
+ "data-row-actions": all.length,
117
+ children: [shown.map((slot_2) => {
118
+ const entry_0 = find(slot_2);
119
+ return entry_0 !== void 0 ? button(entry_0) : placeholder(slot_2.action.id, button({
120
+ ...slot_2,
121
+ href: null
122
+ }));
123
+ }), overflow.length >= 2 ? /* @__PURE__ */ jsxs(MenuTrigger, { children: [menuButton, /* @__PURE__ */ jsx(Menu, {
124
+ placement: "bottom end",
125
+ onAction: (key_0) => {
126
+ const entry_1 = overflow.find((t12) => {
127
+ const { action: action_3 } = t12;
128
+ return action_3.id === key_0;
129
+ });
130
+ if (entry_1 !== void 0 && entry_1.href === null) onRun(entry_1.action);
131
+ },
132
+ children: overflow.map((t13) => {
133
+ const { action: action_4, href } = t13;
134
+ const icon = getActionIcon(action_4, icons);
135
+ return /* @__PURE__ */ jsx(MenuItem, {
136
+ id: action_4.id,
137
+ isDanger: action_4.destructive === true,
138
+ ...icon !== void 0 ? { icon } : {},
139
+ ...href !== null ? { href } : {},
140
+ children: getActionLabel(action_4, intl)
141
+ }, action_4.id);
142
+ })
143
+ })] }) : overflow.length === 1 && overflow[0] !== void 0 ? button(overflow[0]) : inMenu > 0 ? placeholder("menu", menuButton) : null]
144
+ });
43
145
  $[0] = actions;
44
146
  $[1] = icons;
45
147
  $[2] = intl;
46
148
  $[3] = itemLabel;
47
- $[4] = onRun;
48
- $[5] = pending;
49
- $[6] = t1;
50
- } else t1 = $[6];
51
- let t2;
52
- if ($[13] !== icons || $[14] !== intl || $[15] !== itemLabel || $[16] !== menu || $[17] !== onRun || $[18] !== pending) {
53
- t2 = menu.length > 0 ? /* @__PURE__ */ jsxs(MenuTrigger, { children: [/* @__PURE__ */ jsx(IconButton, {
54
- icon: Ellipsis,
55
- size: "sm",
56
- label: intl.formatMessage(messages.itemActions, { item: itemLabel }),
57
- isPending: pending !== null && menu.some((t3) => {
58
- const { action: action_0 } = t3;
59
- return action_0.id === pending;
60
- })
61
- }), /* @__PURE__ */ jsx(Menu, {
62
- placement: "bottom end",
63
- onAction: (key) => {
64
- const entry = menu.find((t4) => {
65
- const { action: action_1 } = t4;
66
- return action_1.id === key;
67
- });
68
- if (entry !== void 0 && entry.href === null) onRun(entry.action);
69
- },
70
- children: menu.map((t5) => {
71
- const { action: action_2, href: href_0 } = t5;
72
- const icon = getActionIcon(action_2, icons);
73
- return /* @__PURE__ */ jsx(MenuItem, {
74
- id: action_2.id,
75
- isDanger: action_2.destructive === true,
76
- ...icon !== void 0 ? { icon } : {},
77
- ...href_0 !== null ? { href: href_0 } : {},
78
- children: getActionLabel(action_2, intl)
79
- }, action_2.id);
80
- })
81
- })] }) : null;
82
- $[13] = icons;
83
- $[14] = intl;
84
- $[15] = itemLabel;
85
- $[16] = menu;
86
- $[17] = onRun;
87
- $[18] = pending;
88
- $[19] = t2;
89
- } else t2 = $[19];
90
- let t3;
91
- if ($[20] !== t1 || $[21] !== t2) {
92
- t3 = /* @__PURE__ */ jsxs("div", {
93
- className: Actions_module_default.row,
94
- children: [t1, t2]
95
- });
96
- $[20] = t1;
97
- $[21] = t2;
98
- $[22] = t3;
99
- } else t3 = $[22];
100
- return t3;
149
+ $[4] = level;
150
+ $[5] = menu;
151
+ $[6] = onRun;
152
+ $[7] = pending;
153
+ $[8] = primary;
154
+ $[9] = slots;
155
+ $[10] = t2;
156
+ } else t2 = $[10];
157
+ return t2;
158
+ }
159
+ function _temp(key, content) {
160
+ return /* @__PURE__ */ jsx("span", {
161
+ className: Actions_module_default.placeholder,
162
+ "aria-hidden": "true",
163
+ inert: true,
164
+ children: content
165
+ }, key);
101
166
  }
102
167
  //#endregion
103
- export { RowActions };
168
+ export { RowActions, orderRowActions };
104
169
 
105
170
  //# sourceMappingURL=RowActions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RowActions.js","names":["Ellipsis","ItemAction","getActionLabel","Action","IconButton","Menu","MenuItem","MenuTrigger","usePanneauIntl","messages","ActionButton","styles","ActionIcons","getActionIcon","RowActionsProps","itemLabel","actions","menu","pending","onRun","action","icons","RowActions","t0","$","_c","intl","t1","t2","t3","href","id","formatMessage","actionOnItem","item","map","length","itemActions","some","action_0","key","entry","find","t4","action_1","undefined","t5","action_2","href_0","icon","destructive","row","_c","styles"],"sources":["../../src/actions/RowActions.tsx"],"sourcesContent":["import { Ellipsis } from 'lucide-react';\n\nimport type { ItemAction } from '@panneau/core';\nimport { getActionLabel } from '@panneau/intl';\nimport type { Action } from '@panneau/protocol';\nimport { IconButton, Menu, MenuItem, MenuTrigger, usePanneauIntl } from '@panneau/ui';\n\nimport { messages } from '../messages';\nimport { ActionButton } from './ActionButton';\nimport styles from './Actions.module.css';\nimport { type ActionIcons, getActionIcon } from './icons';\n\nexport interface RowActionsProps {\n /** The label of the item, for the accessible names of its actions. */\n itemLabel: string;\n /** Actions shown as buttons, with their links (`getItemActions()` of `@panneau/core`). */\n actions: readonly ItemAction[];\n /** Actions in the overflow menu. */\n menu: readonly ItemAction[];\n /** Id of the action that is running on this item, if any. */\n pending: string | null;\n onRun: (action: Action) => void;\n /** Icons of actions by id, over the icon the action names. */\n icons?: ActionIcons | undefined;\n}\n\n/** The actions of a row: buttons, then an overflow menu. */\nexport function RowActions({ itemLabel, actions, menu, pending, onRun, icons }: RowActionsProps) {\n const intl = usePanneauIntl();\n return (\n <div className={styles.row}>\n {actions.map(({ action, href }) => (\n <ActionButton\n key={action.id}\n action={action}\n icons={icons}\n href={href}\n isPending={pending === action.id}\n isDisabled={pending !== null && pending !== action.id}\n aria-label={intl.formatMessage(messages.actionOnItem, {\n action: getActionLabel(action, intl),\n item: itemLabel,\n })}\n onPress={() => onRun(action)}\n />\n ))}\n {menu.length > 0 ? (\n <MenuTrigger>\n <IconButton\n icon={Ellipsis}\n size=\"sm\"\n label={intl.formatMessage(messages.itemActions, { item: itemLabel })}\n isPending={\n pending !== null && menu.some(({ action }) => action.id === pending)\n }\n />\n <Menu\n placement=\"bottom end\"\n onAction={(key) => {\n const entry = menu.find(({ action }) => action.id === key);\n if (entry !== undefined && entry.href === null) {\n onRun(entry.action);\n }\n }}\n >\n {menu.map(({ action, href }) => {\n const icon = getActionIcon(action, icons);\n return (\n <MenuItem\n key={action.id}\n id={action.id}\n isDanger={action.destructive === true}\n {...(icon !== undefined ? { icon } : {})}\n {...(href !== null ? { href } : {})}\n >\n {getActionLabel(action, intl)}\n </MenuItem>\n );\n })}\n </Menu>\n </MenuTrigger>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AA2BA,SAAOsB,WAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAoB,MAAA,EAAAV,WAAAC,SAAAC,MAAAC,SAAAC,OAAAE,UAAAE;CACvB,MAAAG,OAAalB,eAAe;CAAE,IAAAmB;CAAA,IAAAH,EAAA,OAAAR,WAAAQ,EAAA,OAAAH,SAAAG,EAAA,OAAAE,QAAAF,EAAA,OAAAT,aAAAS,EAAA,OAAAL,SAAAK,EAAA,OAAAN,SAAA;EAAA,IAAAU;EAAA,IAAAJ,EAA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enuItem","MenuTrigger","usePanneauIntl","messages","ActionButton","styles","RowActionsFit","ActionIcons","getActionIcon","RowActionsProps","itemLabel","actions","menu","pending","onRun","action","icons","slots","primary","orderRowActions","all","filter","entry","index","list","findIndex","other","id","destructive","RowActions","t0","$","_c","t1","undefined","intl","level","t2","own","t3","t4","some","slot","find","slot_0","action_0","inMenu","length","Math","min","shown","slice","overflow","flatMap","slot_1","t5","action_1","formatMessage","actionOnItem","item","name","t6","href","button","placeholder","_temp","t7","itemActions","t8","t9","t10","action_2","t11","menuButton","row","map","slot_2","entry_0","key_0","entry_1","t12","action_3","key","t13","action_4","icon","content","_c","styles"],"sources":["../../src/actions/RowActions.tsx"],"sourcesContent":["import { Ellipsis } from 'lucide-react';\nimport { type ReactNode, use } from 'react';\n\nimport type { ItemAction } from '@panneau/core';\nimport { getActionLabel } from '@panneau/intl';\nimport type { Action } from '@panneau/protocol';\nimport { IconButton, Menu, MenuItem, MenuTrigger, usePanneauIntl } from '@panneau/ui';\n\nimport { messages } from '../messages';\nimport { ActionButton } from './ActionButton';\nimport styles from './Actions.module.css';\nimport { RowActionsFit } from './fit';\nimport { type ActionIcons, getActionIcon } from './icons';\n\nexport interface RowActionsProps {\n /** The label of the item, for the accessible names of its actions. */\n itemLabel: string;\n /** Actions placed in `row`, with their links (`selectItemActions()` of `@panneau/core`). */\n actions: readonly ItemAction[];\n /** Actions placed in `menu`: icons too while they fit, the first to go in the menu. */\n menu: readonly ItemAction[];\n /** Id of the action that is running on this item, if any. */\n pending: string | null;\n onRun: (action: Action) => void;\n /** Icons of actions by id, over the icon the action names. */\n icons?: ActionIcons | undefined;\n /**\n * The actions of every row of the list, in order (`orderRowActions()`): a row keeps the place\n * of those it doesn't have, so the actions of the rows line up. Without it, its own.\n */\n slots?: readonly ItemAction[] | undefined;\n /** The id of the main action of rows, which keeps its label (`show` or `edit`). */\n primary?: string | null | undefined;\n}\n\n/**\n * The actions of a row in their order: those placed in `row`, then those placed in `menu`, and\n * those that destroy last. The last ones are the first to go in the menu.\n */\nexport function orderRowActions(\n actions: readonly ItemAction[],\n menu: readonly ItemAction[],\n): ItemAction[] {\n const all = [...actions, ...menu].filter(\n (entry, index, list) =>\n list.findIndex((other) => other.action.id === entry.action.id) === index,\n );\n return [\n ...all.filter(({ action }) => action.destructive !== true),\n ...all.filter(({ action }) => action.destructive === true),\n ];\n}\n\n/**\n * The actions of a row (decision 0060): their icons, in their colors, with their labels as names\n * and tooltips, but the main action, which keeps its label while the row has room; and when the\n * icons don't fit, the last ones in an overflow menu, which never holds a single action. How they fit is the same for every row of the list (`RowActionsFit`), and a\n * row keeps the place of the actions of other rows that it doesn't have, so they line up.\n */\nexport function RowActions({\n itemLabel,\n actions,\n menu,\n pending,\n onRun,\n icons,\n slots,\n primary = null,\n}: RowActionsProps) {\n const intl = usePanneauIntl();\n const level = use(RowActionsFit);\n const own = orderRowActions(actions, menu);\n const all = [\n ...(slots ?? []),\n ...own.filter(({ action }) => slots?.some((slot) => slot.action.id === action.id) !== true),\n ];\n const find = (slot: ItemAction) => own.find(({ action }) => action.id === slot.action.id);\n const inMenu = level >= 2 && all.length >= 2 ? Math.min(level, all.length) : 0;\n const shown = all.slice(0, all.length - inMenu);\n const overflow = all.slice(all.length - inMenu).flatMap((slot) => find(slot) ?? []);\n const name = (action: Action) =>\n intl.formatMessage(messages.actionOnItem, {\n action: getActionLabel(action, intl),\n item: itemLabel,\n });\n const button = (entry: ItemAction) => (\n <ActionButton\n key={entry.action.id}\n action={entry.action}\n icons={icons}\n href={entry.href}\n iconOnly={level >= 1 || entry.action.id !== primary}\n isPending={pending === entry.action.id}\n isDisabled={pending !== null && pending !== entry.action.id}\n aria-label={name(entry.action)}\n onPress={() => onRun(entry.action)}\n />\n );\n // The place of an action of other rows: the same button, unseen and out of reach\n const placeholder = (key: string, content: ReactNode) => (\n <span key={key} className={styles.placeholder} aria-hidden=\"true\" inert>\n {content}\n </span>\n );\n const menuButton = (\n <IconButton\n icon={Ellipsis}\n size=\"sm\"\n appearance=\"subtle\"\n label={intl.formatMessage(messages.itemActions, { item: itemLabel })}\n showTooltip={overflow.length >= 2}\n isPending={pending !== null && overflow.some(({ action }) => action.id === pending)}\n />\n );\n return (\n <div className={styles.row} data-row-actions={all.length}>\n {shown.map((slot) => {\n const entry = find(slot);\n return entry !== undefined\n ? button(entry)\n : placeholder(slot.action.id, button({ ...slot, href: null }));\n })}\n {overflow.length >= 2 ? (\n <MenuTrigger>\n {menuButton}\n <Menu\n placement=\"bottom end\"\n onAction={(key) => {\n const entry = overflow.find(({ action }) => action.id === key);\n if (entry !== undefined && entry.href === null) {\n onRun(entry.action);\n }\n }}\n >\n {overflow.map(({ action, href }) => {\n const icon = getActionIcon(action, icons);\n return (\n <MenuItem\n key={action.id}\n id={action.id}\n isDanger={action.destructive === true}\n {...(icon !== undefined ? { icon } : {})}\n {...(href !== null ? { href } : {})}\n >\n {getActionLabel(action, intl)}\n </MenuItem>\n );\n })}\n </Menu>\n </MenuTrigger>\n ) : overflow.length === 1 && overflow[0] !== undefined ? (\n // A single action is no menu: its button, in the menu's place\n button(overflow[0])\n ) : inMenu > 0 ? (\n placeholder('menu', menuButton)\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAuCA,SAAgB2B,gBACZR,SACAC,MACY;CACZ,MAAMQ,MAAM,CAAC,GAAGT,SAAS,GAAGC,IAAI,CAAC,CAACS,QAC7BC,OAAOC,OAAOC,SACXA,KAAKC,WAAWC,UAAUA,MAAMX,OAAOY,OAAOL,MAAMP,OAAOY,EAAE,MAAMJ,KAC3E;CACA,OAAO,CACH,GAAGH,IAAIC,QAAQ,EAAEN,aAAaA,OAAOa,gBAAgB,IAAI,GACzD,GAAGR,IAAIC,QAAQ,EAAEN,aAAaA,OAAOa,gBAAgB,IAAI,CAAC;AAElE;;;;;;;AAQA,SAAOC,WAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAoB,MAAA,EAAAtB,WAAAC,SAAAC,MAAA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AAa7E,cAAcO,UAAQC,KAAK;KAAE,OAEtC,oBAAC,UAAD;MAEQ,IAAAD,SAAMY;MACA,UAAAZ,SAAMa,gBAAiB;MAAI,GAChCyD,SAASnD,KAAAA,IAAT,EAAAmD,KAAiC,IAAjC,CAAiC;MAAC,GAClCvB,SAAS,OAAT,EAAAA,KAA4B,IAA5B,CAA4B;MAEhClE,UAAAA,eAAemB,UAAQoB,IAAI;KAPvB,GACApB,SAAMY,EADN;IAQE,CAElB;GAtBA,CAAA,CAFG,EAAA,CAAA,IA2BZyB,SAAQL,WAAY,KAAKK,SAAQ,OAAQlB,KAAAA,IAEzC6B,OAAOX,SAAQ,EAGZ,IAFHN,SAAS,IACTkB,YAAY,QAAQS,UACjB,IAFH,IAGF;;EAAA1C,EAAA,KAAApB;EAAAoB,EAAA,KAAAf;EAAAe,EAAA,KAAAI;EAAAJ,EAAA,KAAArB;EAAAqB,EAAA,KAAAK;EAAAL,EAAA,KAAAnB;EAAAmB,EAAA,KAAAjB;EAAAiB,EAAA,KAAAlB;EAAAkB,EAAA,KAAAb;EAAAa,EAAA,KAAAd;EAAAc,EAAA,MAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OAzCNM;AAyCM;AAjGP,SAAA4B,MAAAiB,KAAAI,SAAA;CAAA,OAyCC,oBAAA,QAAA;EAA2B,WAAAjF,uBAAM2D;EAA0B,eAAA;EAAO,OAAA;EAC7DsB,UAAAA;CACE,GAFIJ,GAEJ;AAAA"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * How the actions of rows fit (decision 0060), the same for every row of a list: `0`, every
3
+ * action as an icon but the main one, with its label; `1`, every action as an icon; `n` from 2,
4
+ * the last `n` actions of each row in its menu.
5
+ */
6
+ export declare const RowActionsFit: import("react").Context<number>;
7
+ /** What the fit of a list depends on, besides its width: its items and its columns. */
8
+ export declare function fitContent(items: readonly {
9
+ id: string;
10
+ }[], columns: readonly {
11
+ id: string;
12
+ }[]): string;
13
+ /**
14
+ * Fits the actions of the rows of a list in the room they have (decision 0060). It draws each
15
+ * level in turn, from every action as an icon but the main one, labelled, then the main one as an
16
+ * icon too, then a menu of two actions, three…, while the next one may help, and keeps the best:
17
+ * where the actions crowd least (the list overflows, the actions of a row wrap or take more than
18
+ * 40% of it), then, on rows of five actions or more, where the rows are shortest (their content
19
+ * wraps or is cut less), then the fewest actions in the menu.
20
+ *
21
+ * @returns the level, and a callback ref for the element to measure: the list, which holds the
22
+ * actions.
23
+ */
24
+ export declare function useRowActionsFit(content: string): [level: number, measure: (element: HTMLElement | null) => void];
25
+ //# sourceMappingURL=fit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fit.d.ts","sourceRoot":"","sources":["../../src/actions/fit.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,aAAa,iCAAmB,CAAC;AAE9C,uFAAuF;AACvF,wBAAgB,UAAU,CACtB,KAAK,EAAE,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,EAChC,OAAO,EAAE,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,GACnC,MAAM,CAER;AAgKD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,MAAM,GAChB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC,CA8BjE"}