@maxio-com/react-ui-components 9.34.1 → 9.34.3

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.
@@ -139,7 +139,7 @@ placeholder.
139
139
  ## Imports
140
140
 
141
141
  ```tsx
142
- import { Body, CopyToClipboard, Flex } from "@maxio-com/react-ui-components";
142
+ import { Body, Button, CopyToClipboard, Dialog, DialogTrigger, Drawer, Flex } from "@maxio-com/react-ui-components";
143
143
  ```
144
144
 
145
145
  ## Prop Types
@@ -157,6 +157,7 @@ import { Body, CopyToClipboard, Flex } from "@maxio-com/react-ui-components";
157
157
  | `resetAfterMs` | `number` | no | `2000` | How long the copied state lasts before reverting, in milliseconds. | TypeLiteral |
158
158
  | `size` | `"sm" \| "md" \| "lg" \| "xs"` | no | `md` | Changes the size of the button. | TypeLiteral |
159
159
  | `tooltipPlacement` | `"left" \| "right" \| "top" \| "bottom" \| "left-start" \| "left-end" \| "right-start" \| "right-end" \| "top-start" \| "top-end" \| "bottom-start" \| "bottom-end"` | no | `top` | Where the tooltip is positioned relative to the button. | TypeLiteral |
160
+ | `usePortal` | `boolean` | no | `true` | Renders the tooltip in a portal (inside the nearest dialog, otherwise at the end of `body`), so the container around the button can neither clip it nor squeeze its width. Set it to `false` to render the tooltip inline, for example inside a custom layer that stacks above `--maxio-z-dropdown`. | TypeLiteral |
160
161
  | `value` | `string` | yes | - | Text written to the clipboard when the button is pressed. | TypeLiteral |
161
162
  | `variant` | `"primary" \| "secondary" \| "tertiary" \| "ghost" \| "subtle"` | no | `ghost` | Button variant. | TypeLiteral |
162
163
 
@@ -193,3 +194,42 @@ const Disabled = () => <CopyToClipboard
193
194
  onCopyError={action('Copy failed')}
194
195
  disabled />;
195
196
  ```
197
+
198
+ ### Inside Containers
199
+
200
+ The tooltip renders in a portal, so a narrow or `overflow` container around
201
+ the button can neither wrap nor clip it. Inside a drawer or modal it stays
202
+ within the dialog, above its content.
203
+
204
+ ```tsx
205
+ const InsideContainers = () => <Flex flexDirection="col" gap={4} alignItems="start">
206
+ <div
207
+ style={{ width: 32, overflow: 'hidden' }}
208
+ className="maxio-border maxio-border-solid maxio-border-tertiary">
209
+ <CopyToClipboard
210
+ value={API_KEY}
211
+ onCopy={action('Copied')}
212
+ onCopyError={action('Copy failed')}
213
+ size="sm"
214
+ copyLabel="Copy invoice URL" />
215
+ </div>
216
+ <DialogTrigger>
217
+ <Button variant="secondary" size="md">Open Drawer
218
+ </Button>
219
+ <Drawer>
220
+ <Dialog title="Invoice details">
221
+ <Flex alignItems="center" justifyContent="between" gap={1}>
222
+ <Body size="sm" as="span">https://acme.chargify.com/invoices/inv_7Hq2
223
+ </Body>
224
+ <CopyToClipboard
225
+ value={API_KEY}
226
+ onCopy={action('Copied')}
227
+ onCopyError={action('Copy failed')}
228
+ size="sm"
229
+ copyLabel="Copy invoice URL" />
230
+ </Flex>
231
+ </Dialog>
232
+ </Drawer>
233
+ </DialogTrigger>
234
+ </Flex>;
235
+ ```
@@ -95,6 +95,8 @@ import { Button } from '@maxio-com/react-ui-components';
95
95
 
96
96
  You can find the correct import path for each component in its Storybook example.
97
97
 
98
+ The React components are styled by the same stylesheet as the HTML/CSS version, so also load `https://ui.maxio.com/$VERSION/styles.css`. Use the stylesheet from the release that ships with your `@maxio-com/react-ui-components` version, and upgrade both together: a newer component can rely on CSS rules an older stylesheet doesn't have.
99
+
98
100
  ## How to Use Storybook
99
101
 
100
102
  This Storybook serves as the source of truth for the Maxio Design System. It includes all available components, along with usage guidelines, examples, and instructions for using them in your projects.
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { CopyToClipboardProps } from './CopyToClipboard.types';
3
- declare const CopyToClipboard: ({ value, copyLabel, copiedLabel, copyErrorLabel, size, variant, disabled, resetAfterMs, tooltipPlacement, onCopy, onCopyError, onClick, className, ...rest }: CopyToClipboardProps) => React.JSX.Element;
3
+ declare const CopyToClipboard: ({ value, copyLabel, copiedLabel, copyErrorLabel, size, variant, disabled, resetAfterMs, tooltipPlacement, usePortal, onCopy, onCopyError, onClick, className, ...rest }: CopyToClipboardProps) => React.JSX.Element;
4
4
  export default CopyToClipboard;
5
5
  //# sourceMappingURL=CopyToClipboard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CopyToClipboard.d.ts","sourceRoot":"","sources":["../../../../../src/components/CopyToClipboard/CopyToClipboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAc/D,QAAA,MAAM,eAAe,GAAI,8JAetB,oBAAoB,sBA6CtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"CopyToClipboard.d.ts","sourceRoot":"","sources":["../../../../../src/components/CopyToClipboard/CopyToClipboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAc/D,QAAA,MAAM,eAAe,GAAI,yKAgBtB,oBAAoB,sBA8CtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -12,6 +12,7 @@ export type CopyToClipboardProps = {
12
12
  disabled?: boolean;
13
13
  resetAfterMs?: number;
14
14
  tooltipPlacement?: Placement;
15
+ usePortal?: boolean;
15
16
  onCopy?: (value: string) => void;
16
17
  onCopyError?: (error: unknown) => void;
17
18
  } & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onCopy' | 'children' | 'value' | 'type'>;
@@ -1 +1 @@
1
- {"version":3,"file":"CopyToClipboard.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/CopyToClipboard/CopyToClipboard.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE,MAAM,MAAM,mBAAmB,GAAG,IAAI,GAAG,IAAI,GA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e,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const portalContainerFor: (trigger: HTMLElement) => HTMLElement;
2
+ export declare const subscribeToPortalChanges: (listener: () => void) => () => void;
3
+ //# sourceMappingURL=portalContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portalContainer.d.ts","sourceRoot":"","sources":["../../../../../src/components/OverlayTrigger/portalContainer.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,kBAAkB,GAAI,SAAS,WAAW,KAAG,WAWzD,CAAC;AAoBF,eAAO,MAAM,wBAAwB,GAAI,UAAU,MAAM,IAAI,eAuB5D,CAAC"}
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import type { Placement, Interactions, OverlayAriaRole } from './types';
2
3
  type OverlayTriggerSettings = {
3
4
  placement?: Placement;
@@ -8,18 +9,18 @@ type OverlayTriggerSettings = {
8
9
  isActive?: boolean;
9
10
  onOverlayUpdate: (isActive: boolean) => void;
10
11
  autoHideMs?: number;
12
+ strategy?: 'absolute' | 'fixed';
13
+ shiftIntoView?: boolean;
11
14
  };
12
- export declare const useOverlayTrigger: ({ placement, isActive, interactions, floatingElementOffset, onOverlayUpdate, autoHideMs, }: OverlayTriggerSettings) => {
15
+ export declare const useOverlayTrigger: ({ placement, isActive, interactions, floatingElementOffset, onOverlayUpdate, autoHideMs, strategy: positionStrategy, shiftIntoView, }: OverlayTriggerSettings) => {
13
16
  isActive: boolean;
14
17
  refs: {
15
18
  floating: (node: HTMLElement | null) => void;
16
19
  reference: (node: import("@floating-ui/react-dom-interactions").ReferenceType | null) => void;
20
+ floatingElement: React.MutableRefObject<HTMLElement | null>;
17
21
  };
18
- floatingElementCSSPosition: {
19
- position: import("@floating-ui/react-dom-interactions").Strategy;
20
- top: number;
21
- left: number;
22
- };
22
+ isReferenceHidden: boolean;
23
+ floatingElementCSSPosition: React.CSSProperties;
23
24
  getReferenceProps: (userProps?: React.HTMLProps<Element> | undefined) => Record<string, unknown>;
24
25
  getFloatingProps: (userProps?: React.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
25
26
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useOverlayTrigger.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useOverlayTrigger/useOverlayTrigger.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAExE,KAAK,sBAAsB,GAAG;IAI5B,SAAS,CAAC,EAAE,SAAS,CAAC;IAItB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAI5B,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC;IAI9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAI/B,IAAI,EAAE,eAAe,CAAC;IAItB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAInB,eAAe,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAI7C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,4FAO/B,sBAAsB;;;;;;;;;;;;;CA0CxB,CAAC"}
1
+ {"version":3,"file":"useOverlayTrigger.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useOverlayTrigger/useOverlayTrigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAa3D,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAIxE,KAAK,sBAAsB,GAAG;IAI5B,SAAS,CAAC,EAAE,SAAS,CAAC;IAItB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAI5B,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC;IAI9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAI/B,IAAI,EAAE,eAAe,CAAC;IAItB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAInB,eAAe,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAI7C,UAAU,CAAC,EAAE,MAAM,CAAC;IAIpB,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAOhC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,uIAS/B,sBAAsB;;;;;;;;;;;CA4FxB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maxio-com/react-ui-components",
3
- "version": "9.34.1",
3
+ "version": "9.34.3",
4
4
  "description": "React UI components",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -49,7 +49,7 @@
49
49
  "@floating-ui/react-dom": "^2.1.9",
50
50
  "@floating-ui/react-dom-interactions": "^0.13.3",
51
51
  "@internationalized/date": "^3.12.3",
52
- "@maxio-com/design-tokens": "^4.3.0",
52
+ "@maxio-com/design-tokens": "^4.3.1",
53
53
  "@react-aria/toast": "3.1.1",
54
54
  "@react-aria/utils": "^3.34.1",
55
55
  "@react-stately/checkbox": "^3.8.1",
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "97b4fc7a93c0d547c3874ee258a67ebff45c7a0c"
68
+ "gitHead": "7889fc2190e563c102af418f03bef92e1ac187fb"
69
69
  }
@@ -173,11 +173,12 @@ type CopyToClipboardProps = {
173
173
  disabled?: boolean;
174
174
  resetAfterMs?: number;
175
175
  tooltipPlacement?: Placement;
176
+ usePortal?: boolean;
176
177
  onCopy?: (value: string) => void;
177
178
  onCopyError?: (error: unknown) => void;
178
179
  } & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onCopy' | 'children' | 'value' | 'type'>;
179
180
 
180
- declare const CopyToClipboard: ({ value, copyLabel, copiedLabel, copyErrorLabel, size, variant, disabled, resetAfterMs, tooltipPlacement, onCopy, onCopyError, onClick, className, ...rest }: CopyToClipboardProps) => React$1.JSX.Element;
181
+ declare const CopyToClipboard: ({ value, copyLabel, copiedLabel, copyErrorLabel, size, variant, disabled, resetAfterMs, tooltipPlacement, usePortal, onCopy, onCopyError, onClick, className, ...rest }: CopyToClipboardProps) => React$1.JSX.Element;
181
182
 
182
183
  type TableSize = 'sm' | 'md' | 'lg';
183
184
  type ColumnAlign = 'left' | 'right';
@@ -328,20 +329,20 @@ type OverlayTriggerSettings = {
328
329
  isActive?: boolean;
329
330
  onOverlayUpdate: (isActive: boolean) => void;
330
331
  autoHideMs?: number;
332
+ strategy?: 'absolute' | 'fixed';
333
+ shiftIntoView?: boolean;
331
334
  };
332
- declare const useOverlayTrigger: ({ placement, isActive, interactions, floatingElementOffset, onOverlayUpdate, autoHideMs, }: OverlayTriggerSettings) => {
335
+ declare const useOverlayTrigger: ({ placement, isActive, interactions, floatingElementOffset, onOverlayUpdate, autoHideMs, strategy: positionStrategy, shiftIntoView, }: OverlayTriggerSettings) => {
333
336
  isActive: boolean;
334
337
  refs: {
335
338
  floating: (node: HTMLElement | null) => void;
336
339
  reference: (node: _floating_ui_react_dom_interactions.ReferenceType | null) => void;
340
+ floatingElement: React$1.MutableRefObject<HTMLElement | null>;
337
341
  };
338
- floatingElementCSSPosition: {
339
- position: _floating_ui_react_dom_interactions.Strategy;
340
- top: number;
341
- left: number;
342
- };
343
- getReferenceProps: (userProps?: React.HTMLProps<Element> | undefined) => Record<string, unknown>;
344
- getFloatingProps: (userProps?: React.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
342
+ isReferenceHidden: boolean;
343
+ floatingElementCSSPosition: React$1.CSSProperties;
344
+ getReferenceProps: (userProps?: React$1.HTMLProps<Element> | undefined) => Record<string, unknown>;
345
+ getFloatingProps: (userProps?: React$1.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
345
346
  };
346
347
 
347
348
  declare function useHover<T extends HTMLElement = HTMLElement>(ref: RefObject<T | null>, mouseLeaveDelay?: number): boolean;