neatkit 0.7.0 → 0.8.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 (154) hide show
  1. package/dist/Avatar-Belo7qAY.cjs +1 -0
  2. package/dist/Avatar-DjDCFqNG.js +55 -0
  3. package/dist/Avatar.cjs +1 -1
  4. package/dist/Avatar.js +2 -52
  5. package/dist/Boundary.cjs +1 -0
  6. package/dist/Boundary.js +176 -0
  7. package/dist/{Button-BAsLfA0D.js → Button-Chv4O66e.js} +35 -35
  8. package/dist/Button-DCKtFvSo.cjs +1 -0
  9. package/dist/Button.cjs +1 -1
  10. package/dist/Button.js +1 -1
  11. package/dist/Checkbox.cjs +1 -1
  12. package/dist/Checkbox.js +213 -2
  13. package/dist/Code-ClkozPlv.js +227 -0
  14. package/dist/Code-JDb4VFl7.cjs +4 -0
  15. package/dist/Code.cjs +1 -1
  16. package/dist/Code.js +1 -1
  17. package/dist/{Icon-uQmpr5P2.js → Icon-BoEUoOk7.js} +144 -177
  18. package/dist/Icon-DJ4BigRz.cjs +1 -0
  19. package/dist/Icon.cjs +1 -1
  20. package/dist/Icon.js +2 -35
  21. package/dist/Input.cjs +1 -1
  22. package/dist/Input.js +70 -79
  23. package/dist/Markdown.cjs +1 -31
  24. package/dist/Markdown.js +461 -18062
  25. package/dist/Modal.cjs +1 -1
  26. package/dist/Modal.js +100 -122
  27. package/dist/PinInput.cjs +1 -1
  28. package/dist/PinInput.js +1 -1
  29. package/dist/Popover.cjs +1 -1
  30. package/dist/Popover.js +106 -106
  31. package/dist/Radio.cjs +1 -1
  32. package/dist/Radio.js +86 -41
  33. package/dist/Select.cjs +1 -1
  34. package/dist/Select.js +326 -315
  35. package/dist/Sidebar.cjs +1 -0
  36. package/dist/Sidebar.js +475 -0
  37. package/dist/Skeleton.cjs +1 -1
  38. package/dist/Skeleton.js +20 -16
  39. package/dist/Switch.cjs +1 -1
  40. package/dist/Switch.js +1 -1
  41. package/dist/Table-B30TBckZ.js +402 -0
  42. package/dist/Table-DceR12X9.cjs +1 -0
  43. package/dist/Table.cjs +1 -1
  44. package/dist/Table.js +1 -1
  45. package/dist/TextArea.cjs +1 -1
  46. package/dist/TextArea.js +1 -1
  47. package/dist/Tooltip-B4bajPtk.cjs +1 -0
  48. package/dist/Tooltip-BVqdnKK_.js +231 -0
  49. package/dist/Tooltip.cjs +1 -1
  50. package/dist/Tooltip.js +2 -3
  51. package/dist/aria-Bntn6ad_.cjs +1 -0
  52. package/dist/aria-CeA9QfD1.js +15 -0
  53. package/dist/components/Boundary/Boundary.d.ts +65 -0
  54. package/dist/components/Boundary/contexts/BoundaryContext.d.ts +28 -0
  55. package/dist/components/Boundary/hooks/useBoundary.d.ts +19 -0
  56. package/dist/components/Boundary/hooks/useBoundaryWidth.d.ts +23 -0
  57. package/dist/components/Boundary/index.d.ts +2 -0
  58. package/dist/components/Boundary/utils/width.d.ts +11 -0
  59. package/dist/components/Checkbox/Checkbox.d.ts +9 -1
  60. package/dist/components/{CheckboxGroup → Checkbox/components}/CheckboxGroup.d.ts +2 -2
  61. package/dist/components/Checkbox/index.d.ts +1 -0
  62. package/dist/components/Checkbox/utils/checkbox-option.d.ts +17 -0
  63. package/dist/components/Icon/Icon.d.ts +1 -0
  64. package/dist/components/Icon/index.d.ts +0 -33
  65. package/dist/components/Input/Input.d.ts +1 -9
  66. package/dist/components/Modal/Modal.d.ts +0 -4
  67. package/dist/components/PinInput/PinInput.d.ts +1 -1
  68. package/dist/components/Popover/Popover.d.ts +2 -6
  69. package/dist/components/Portal/Portal.d.ts +11 -8
  70. package/dist/components/Portal/hooks/useDismissableLayer.d.ts +2 -0
  71. package/dist/components/Portal/hooks/useFloatingPosition.d.ts +4 -3
  72. package/dist/components/Portal/hooks/useFocusTrap.d.ts +2 -0
  73. package/dist/components/Portal/hooks/useScrollLock.d.ts +9 -3
  74. package/dist/components/Portal/utils/boundary-focus.d.ts +23 -0
  75. package/dist/components/Portal/utils/floating-position.d.ts +43 -9
  76. package/dist/components/Portal/utils/overlay-stack.d.ts +22 -10
  77. package/dist/components/Portal/utils/scroll-container.d.ts +13 -0
  78. package/dist/components/Radio/Radio.d.ts +9 -1
  79. package/dist/components/{RadioGroup → Radio/components}/RadioGroup.d.ts +9 -2
  80. package/dist/components/Radio/index.d.ts +1 -0
  81. package/dist/components/Select/Select.d.ts +0 -2
  82. package/dist/components/Select/utils/listbox-position.d.ts +28 -0
  83. package/dist/components/Sidebar/Sidebar.d.ts +108 -0
  84. package/dist/components/Sidebar/components/SidebarFooter.d.ts +19 -0
  85. package/dist/components/Sidebar/components/SidebarGroup.d.ts +42 -0
  86. package/dist/components/Sidebar/components/SidebarItem.d.ts +43 -0
  87. package/dist/components/Sidebar/components/SidebarOverlay.d.ts +38 -0
  88. package/dist/components/Sidebar/components/SidebarPanel.d.ts +47 -0
  89. package/dist/components/Sidebar/components/SidebarTrigger.d.ts +47 -0
  90. package/dist/components/Sidebar/components/SidebarUser.d.ts +59 -0
  91. package/dist/components/Sidebar/hooks/usePresentation.d.ts +14 -0
  92. package/dist/components/Sidebar/hooks/useSidebar.d.ts +9 -0
  93. package/dist/components/Sidebar/index.d.ts +2 -0
  94. package/dist/components/Sidebar/utils/state.d.ts +62 -0
  95. package/dist/components/Skeleton/Skeleton.d.ts +21 -5
  96. package/dist/components/Table/Table.d.ts +9 -49
  97. package/dist/components/Table/contexts/TableContext.d.ts +4 -0
  98. package/dist/components/Table/index.d.ts +1 -1
  99. package/dist/components/Tooltip/Tooltip.d.ts +10 -4
  100. package/dist/components/Tooltip/TooltipProvider.d.ts +1 -1
  101. package/dist/components/Tooltip/index.d.ts +0 -1
  102. package/dist/effects-D5CWf-Pl.js +8 -0
  103. package/dist/effects-D85L_7zM.cjs +1 -0
  104. package/dist/floating-position-5wJ5G5IT.js +48 -0
  105. package/dist/floating-position-Cy9xxdH4.cjs +1 -0
  106. package/dist/style.css +1 -1
  107. package/dist/tokens.d.ts +1 -0
  108. package/dist/useFloatingPosition-BBEUHPqy.cjs +1 -0
  109. package/dist/useFloatingPosition-CMirP2-2.js +43 -0
  110. package/dist/useFocusTrap-BrFZdMqQ.cjs +1 -0
  111. package/dist/useFocusTrap-DhVnlboe.js +136 -0
  112. package/dist/usePresence-B5RYv4e1.cjs +1 -0
  113. package/dist/usePresence-CqegYqy4.js +221 -0
  114. package/dist/useScrollLock-Drd7OZRC.js +62 -0
  115. package/dist/useScrollLock-Dy8MZaSn.cjs +1 -0
  116. package/dist/utils/aria.d.ts +9 -0
  117. package/dist/utils/effects.d.ts +12 -0
  118. package/package.json +11 -16
  119. package/dist/Button-D7JUO6Fs.cjs +0 -1
  120. package/dist/Checkbox-BvXM9VyY.js +0 -68
  121. package/dist/Checkbox-VQifZrZZ.cjs +0 -1
  122. package/dist/CheckboxGroup.cjs +0 -1
  123. package/dist/CheckboxGroup.js +0 -144
  124. package/dist/Code-BP2ZCmUf.js +0 -7446
  125. package/dist/Code-eispVOW3.cjs +0 -6
  126. package/dist/Content.cjs +0 -1
  127. package/dist/Content.js +0 -144
  128. package/dist/Icon-D8IZceys.cjs +0 -1
  129. package/dist/RadioGroup.cjs +0 -1
  130. package/dist/RadioGroup.js +0 -51
  131. package/dist/RadioGroupContext-BX9KnDek.cjs +0 -1
  132. package/dist/RadioGroupContext-DbKM4zPZ.js +0 -5
  133. package/dist/Table-83unQQOi.cjs +0 -1
  134. package/dist/Table-Cw8u-pEW.js +0 -403
  135. package/dist/Tooltip-BB82wNOE.cjs +0 -1
  136. package/dist/Tooltip-CqWK_GRD.js +0 -236
  137. package/dist/aria-DHnOMyYp.js +0 -10
  138. package/dist/aria-DKxpE8cA.cjs +0 -1
  139. package/dist/components/CheckboxGroup/index.d.ts +0 -2
  140. package/dist/components/Content/Content.d.ts +0 -60
  141. package/dist/components/Content/hooks/useContentLayout.d.ts +0 -18
  142. package/dist/components/Content/index.d.ts +0 -2
  143. package/dist/components/Content/utils/layout.d.ts +0 -11
  144. package/dist/components/RadioGroup/index.d.ts +0 -2
  145. package/dist/useFloatingPosition-CxzhAvy8.js +0 -73
  146. package/dist/useFloatingPosition-D1FqYy0l.cjs +0 -1
  147. package/dist/useFocusTrap--cgjy78G.cjs +0 -1
  148. package/dist/useFocusTrap-Da4nEash.js +0 -134
  149. package/dist/usePresence-DSPt6aKi.js +0 -210
  150. package/dist/usePresence-qe92UTvK.cjs +0 -1
  151. /package/dist/components/{CheckboxGroup → Checkbox}/contexts/CheckboxGroupContext.d.ts +0 -0
  152. /package/dist/components/{CheckboxGroup → Checkbox}/hooks/useCheckboxGroup.d.ts +0 -0
  153. /package/dist/components/{RadioGroup → Radio}/contexts/RadioGroupContext.d.ts +0 -0
  154. /package/dist/components/{RadioGroup → Radio}/hooks/useRadioGroup.d.ts +0 -0
@@ -1,14 +1,22 @@
1
1
  import { type HTMLAttributes } from "react";
2
2
  import "./styles/skeleton.css";
3
3
  /** A type representing the silhouette drawn by Skeleton. */
4
- export type SkeletonShape = "rectangle" | "circle";
4
+ export type SkeletonShape = "rectangle" | "ellipse";
5
5
  /** A type representing properties for the Skeleton component. */
6
6
  export type SkeletonProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
7
7
  /** The silhouette drawn by the loading placeholder. */
8
8
  shape?: SkeletonShape;
9
- /** The CSS-compatible width of the loading placeholder. */
9
+ /**
10
+ * The CSS-compatible width of the loading placeholder.
11
+ *
12
+ * Placeholders otherwise fill their container.
13
+ */
10
14
  width?: number | string;
11
- /** The CSS-compatible height of the loading placeholder. */
15
+ /**
16
+ * The CSS-compatible height of the loading placeholder.
17
+ *
18
+ * Placeholders otherwise match the height of the surrounding text.
19
+ */
12
20
  height?: number | string;
13
21
  };
14
22
  /**
@@ -22,9 +30,17 @@ export type SkeletonProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
22
30
  declare const Skeleton: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
23
31
  /** The silhouette drawn by the loading placeholder. */
24
32
  shape?: SkeletonShape;
25
- /** The CSS-compatible width of the loading placeholder. */
33
+ /**
34
+ * The CSS-compatible width of the loading placeholder.
35
+ *
36
+ * Placeholders otherwise fill their container.
37
+ */
26
38
  width?: number | string;
27
- /** The CSS-compatible height of the loading placeholder. */
39
+ /**
40
+ * The CSS-compatible height of the loading placeholder.
41
+ *
42
+ * Placeholders otherwise match the height of the surrounding text.
43
+ */
28
44
  height?: number | string;
29
45
  } & import("react").RefAttributes<HTMLDivElement>>;
30
46
  export default Skeleton;
@@ -34,6 +34,12 @@ export type TableFootProps = HTMLAttributes<HTMLTableSectionElement> & {
34
34
  };
35
35
  /** Shared native properties for every Table.Row configuration. */
36
36
  type TableRowBaseProps = Omit<HTMLAttributes<HTMLTableRowElement>, "aria-label" | "children" | "onClick"> & {
37
+ /**
38
+ * The controls operating on this row.
39
+ *
40
+ * Each action is keyed by its label, so labels must be unique per row.
41
+ */
42
+ actions?: readonly TableRowAction[];
37
43
  /** The cells rendered inside the Table row. */
38
44
  children: ReactNode;
39
45
  };
@@ -103,7 +109,7 @@ type TableHeaderCellOwnProps = {
103
109
  };
104
110
  /** A type representing properties for the Table.HeaderCell component. */
105
111
  export type TableHeaderCellProps = Omit<ThHTMLAttributes<HTMLTableCellElement>, "align" | "children"> & TableHeaderCellOwnProps;
106
- /** A type representing properties for the Table.ActionHeaderCell component. */
112
+ /** A type representing properties for the Table action header cell. */
107
113
  export type TableActionHeaderCellProps = Omit<TableHeaderCellProps, "align">;
108
114
  /** A type representing properties for the Table.Cell component. */
109
115
  export type TableCellProps = Omit<TdHTMLAttributes<HTMLTableCellElement>, "align" | "children"> & {
@@ -118,26 +124,15 @@ export type TableCellProps = Omit<TdHTMLAttributes<HTMLTableCellElement>, "align
118
124
  /** The primitive value displayed or passed to the format function. */
119
125
  value?: TableCellValue;
120
126
  };
121
- /** A type representing properties for the Table.Action component. */
122
- export type TableActionProps = Omit<ButtonProps<"button">, "as" | "children" | "className" | "fullWidth" | "icon" | "iconAlignment" | "shape" | "style" | "textAlignment" | "type" | "variant"> & {
127
+ /** A type representing one consistently styled Table row action. */
128
+ export type TableRowAction = Omit<ButtonProps<"button">, "as" | "children" | "className" | "fullWidth" | "icon" | "iconAlignment" | "shape" | "style" | "textAlignment" | "type" | "variant"> & {
123
129
  /** The icon identifying the row action. */
124
130
  icon: IconType;
125
131
  /** The short Tooltip label and base accessible name for the row action. */
126
132
  label: string;
127
133
  };
128
- /** A type representing properties for the Table.ActionCell component. */
129
- export type TableActionCellProps = Omit<TdHTMLAttributes<HTMLTableCellElement>, "align" | "children"> & {
130
- /** The consistently styled row actions rendered inside the cell. */
131
- children?: ReactNode;
132
- };
133
134
  /** A type representing the complete compound Table component. */
134
135
  type TableComponent = typeof TableRoot & {
135
- /** A consistently styled control operating on one Table row. */
136
- Action: typeof TableAction;
137
- /** The cell containing persistent row-level actions. */
138
- ActionCell: typeof TableActionCell;
139
- /** The header cell labelling the row-actions column. */
140
- ActionHeaderCell: typeof TableActionHeaderCell;
141
136
  /** The body section containing Table data rows. */
142
137
  Body: typeof TableBody;
143
138
  /** A standard Table data cell. */
@@ -209,15 +204,6 @@ declare const TableRow: import("react").ForwardRefExoticComponent<TableRowProps
209
204
  * @returns The rendered Table column header.
210
205
  */
211
206
  declare const TableHeaderCell: import("react").ForwardRefExoticComponent<Omit<ThHTMLAttributes<HTMLTableCellElement>, "children" | "align"> & TableHeaderCellOwnProps & import("react").RefAttributes<HTMLTableCellElement>>;
212
- /**
213
- * Renders the header for a row-actions column.
214
- *
215
- * @param props - The native header properties and optional visible label.
216
- * @param forwardedReference - The reference assigned to the header cell.
217
- *
218
- * @returns The rendered Table actions header.
219
- */
220
- declare const TableActionHeaderCell: import("react").ForwardRefExoticComponent<TableActionHeaderCellProps & import("react").RefAttributes<HTMLTableCellElement>>;
221
207
  /**
222
208
  * Renders a data cell with optional value formatting and truncation.
223
209
  *
@@ -238,32 +224,6 @@ declare const TableCell: import("react").ForwardRefExoticComponent<Omit<TdHTMLAt
238
224
  /** The primitive value displayed or passed to the format function. */
239
225
  value?: TableCellValue;
240
226
  } & import("react").RefAttributes<HTMLTableCellElement>>;
241
- /**
242
- * Renders one consistently styled control operating on a Table row.
243
- *
244
- * @param props - The short label, icon, and native button properties.
245
- * @param forwardedReference - The reference assigned to the action button.
246
- *
247
- * @returns The rendered Table row action.
248
- */
249
- declare const TableAction: import("react").ForwardRefExoticComponent<Omit<ButtonProps<"button">, "className" | "style" | "children" | "icon" | "variant" | "type" | "as" | "shape" | "fullWidth" | "iconAlignment" | "textAlignment"> & {
250
- /** The icon identifying the row action. */
251
- icon: IconType;
252
- /** The short Tooltip label and base accessible name for the row action. */
253
- label: string;
254
- } & import("react").RefAttributes<HTMLButtonElement>>;
255
- /**
256
- * Renders the cell containing controls for one Table row.
257
- *
258
- * @param props - The native cell properties and composed Table actions.
259
- * @param forwardedReference - The reference assigned to the action cell.
260
- *
261
- * @returns The rendered Table action cell.
262
- */
263
- declare const TableActionCell: import("react").ForwardRefExoticComponent<Omit<TdHTMLAttributes<HTMLTableCellElement>, "children" | "align"> & {
264
- /** The consistently styled row actions rendered inside the cell. */
265
- children?: ReactNode;
266
- } & import("react").RefAttributes<HTMLTableCellElement>>;
267
227
  /**
268
228
  * Renders a semantic Table inside a keyboard-scrollable surface.
269
229
  *
@@ -0,0 +1,4 @@
1
+ /** A type representing the section a Table row belongs to. */
2
+ export type TableSection = "head" | "body" | "foot";
3
+ /** The internal context naming the section a row is rendered inside. */
4
+ export declare const TableSectionContext: import("react").Context<TableSection>;
@@ -1,2 +1,2 @@
1
1
  export { default } from "./Table";
2
- export type { TableActionCellProps, TableActionHeaderCellProps, TableActionProps, TableBodyProps, TableCellAlignment, TableCellProps, TableCellValue, TableFootProps, TableHeaderCellProps, TableHeadProps, TableProps, TableRowProps, } from "./Table";
2
+ export type { TableBodyProps, TableCellAlignment, TableCellProps, TableCellValue, TableFootProps, TableHeaderCellProps, TableHeadProps, TableProps, TableRowAction, TableRowProps, } from "./Table";
@@ -1,5 +1,6 @@
1
1
  import { type CSSProperties, type ReactElement, type ReactNode } from "react";
2
2
  import type { FloatingPlacement } from "../Portal/utils/floating-position";
3
+ import TooltipProvider from "./TooltipProvider";
3
4
  import "./styles/tooltip.css";
4
5
  /** A type representing the preferred placement of a Tooltip. */
5
6
  export type TooltipPlacement = FloatingPlacement;
@@ -30,10 +31,8 @@ export type TooltipProps = {
30
31
  disabled?: boolean;
31
32
  /** The callback invoked whenever the Tooltip opens or closes. */
32
33
  onOpenChange?: (open: boolean) => void;
33
- /** The preferred placement before viewport collision handling. */
34
+ /** The preferred placement before collision handling. */
34
35
  placement?: TooltipPlacement;
35
- /** The optional element receiving the Tooltip portal. */
36
- portalContainer?: Element | null;
37
36
  /** The inline styles applied to the trigger element. */
38
37
  style?: CSSProperties;
39
38
  };
@@ -50,5 +49,12 @@ export type TooltipProps = {
50
49
  *
51
50
  * @returns The trigger and its portal-backed Tooltip description.
52
51
  */
53
- declare const Tooltip: import("react").ForwardRefExoticComponent<TooltipProps & import("react").RefAttributes<HTMLElement>>;
52
+ declare const TooltipRoot: import("react").ForwardRefExoticComponent<TooltipProps & import("react").RefAttributes<HTMLElement>>;
53
+ /** A type representing the complete compound Tooltip component. */
54
+ type TooltipComponent = typeof TooltipRoot & {
55
+ /** The provider supplying shared behavior to descendant Tooltips. */
56
+ Provider: typeof TooltipProvider;
57
+ };
58
+ /** The compound Tooltip component and its shared-behavior provider. */
59
+ declare const Tooltip: TooltipComponent;
54
60
  export default Tooltip;
@@ -6,7 +6,7 @@ type TooltipContextValue = {
6
6
  };
7
7
  /** Shared Tooltip behavior remains optional for standalone usage. */
8
8
  export declare const TooltipContext: import("react").Context<TooltipContextValue | null>;
9
- /** A type representing properties for the TooltipProvider component. */
9
+ /** A type representing properties for the Tooltip.Provider component. */
10
10
  export type TooltipProviderProps = {
11
11
  /** The Tooltip-bearing interface receiving shared behavior. */
12
12
  children: ReactNode;
@@ -1,4 +1,3 @@
1
1
  export { default } from "./Tooltip";
2
2
  export type { TooltipPlacement, TooltipProps } from "./Tooltip";
3
- export { default as TooltipProvider } from "./TooltipProvider";
4
3
  export type { TooltipProviderProps } from "./TooltipProvider";
@@ -0,0 +1,8 @@
1
+ import { createContext as o, useEffect as t, useLayoutEffect as e } from "react";
2
+ const n = o(
3
+ void 0
4
+ ), s = typeof window > "u" ? t : e;
5
+ export {
6
+ n as B,
7
+ s as u
8
+ };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("react"),e=t.createContext(void 0),o=typeof window>"u"?t.useEffect:t.useLayoutEffect;exports.BoundaryContext=e;exports.useIsomorphicLayoutEffect=o;
@@ -0,0 +1,48 @@
1
+ const P = {
2
+ bottom: "top",
3
+ left: "right",
4
+ right: "left",
5
+ top: "bottom"
6
+ };
7
+ function O(e, h) {
8
+ const t = Math.min(12, h / 2);
9
+ return Math.min(Math.max(t, e), h - t);
10
+ }
11
+ function _(e) {
12
+ return P[e];
13
+ }
14
+ function a(e, h) {
15
+ return h === "left" || h === "right" ? e.width : e.height;
16
+ }
17
+ function I(e, h, t) {
18
+ const f = Math.max(e.left, 0), m = Math.max(e.top, 0), i = Math.min(e.right, h), M = Math.min(e.bottom, t);
19
+ return i <= f || M <= m ? e : { bottom: M, left: f, right: i, top: m };
20
+ }
21
+ function T(e, h, t, f, m) {
22
+ const i = {
23
+ bottom: m.bottom - t.bottom - h * 2,
24
+ left: t.left - m.left - h * 2,
25
+ right: m.right - t.right - h * 2,
26
+ top: t.top - m.top - h * 2
27
+ }, M = _(e), E = a(f, e), o = i[e] < E && i[M] > i[e] ? M : e;
28
+ let l = t.left + (t.width - f.width) / 2, c = t.top + (t.height - f.height) / 2;
29
+ o === "top" ? c = t.top - f.height - h : o === "bottom" ? c = t.bottom + h : o === "left" ? l = t.left - f.width - h : l = t.right + h;
30
+ const w = m.left + h, x = m.top + h;
31
+ return l = Math.min(
32
+ Math.max(w, l),
33
+ Math.max(w, m.right - h - f.width)
34
+ ), c = Math.min(
35
+ Math.max(x, c),
36
+ Math.max(x, m.bottom - h - f.height)
37
+ ), { arrowOffset: o === "top" || o === "bottom" ? O(
38
+ t.left + t.width / 2 - l,
39
+ f.width
40
+ ) : O(
41
+ t.top + t.height / 2 - c,
42
+ f.height
43
+ ), left: l, placement: o, top: c };
44
+ }
45
+ export {
46
+ T as c,
47
+ I as g
48
+ };
@@ -0,0 +1 @@
1
+ "use strict";const a={bottom:"top",left:"right",right:"left",top:"bottom"};function x(i,h){const t=Math.min(12,h/2);return Math.min(Math.max(t,i),h-t)}function E(i){return a[i]}function _(i,h){return h==="left"||h==="right"?i.width:i.height}function A(i,h,t){const e=Math.max(i.left,0),f=Math.max(i.top,0),m=Math.min(i.right,h),M=Math.min(i.bottom,t);return m<=e||M<=f?i:{bottom:M,left:e,right:m,top:f}}function F(i,h,t,e,f){const m={bottom:f.bottom-t.bottom-h*2,left:t.left-f.left-h*2,right:f.right-t.right-h*2,top:t.top-f.top-h*2},M=E(i),P=_(e,i),o=m[i]<P&&m[M]>m[i]?M:i;let l=t.left+(t.width-e.width)/2,c=t.top+(t.height-e.height)/2;o==="top"?c=t.top-e.height-h:o==="bottom"?c=t.bottom+h:o==="left"?l=t.left-e.width-h:l=t.right+h;const w=f.left+h,O=f.top+h;return l=Math.min(Math.max(w,l),Math.max(w,f.right-h-e.width)),c=Math.min(Math.max(O,c),Math.max(O,f.bottom-h-e.height)),{arrowOffset:o==="top"||o==="bottom"?x(t.left+t.width/2-l,e.width):x(t.top+t.height/2-c,e.height),left:l,placement:o,top:c}}exports.calculateFloatingPosition=F;exports.getVisibleBounds=A;