@ai-matrx/tap-target 0.1.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.
- package/CHANGELOG.md +36 -0
- package/LICENSE +21 -0
- package/README.md +127 -0
- package/dist/buttons.cjs +1155 -0
- package/dist/buttons.cjs.map +1 -0
- package/dist/buttons.d.cts +109 -0
- package/dist/buttons.d.ts +109 -0
- package/dist/buttons.js +1127 -0
- package/dist/buttons.js.map +1 -0
- package/dist/index.cjs +581 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +108 -0
- package/dist/index.d.ts +108 -0
- package/dist/index.js +553 -0
- package/dist/index.js.map +1 -0
- package/dist/link-CkRpHgou.d.cts +40 -0
- package/dist/link-CkRpHgou.d.ts +40 -0
- package/dist/styles.css +110 -0
- package/package.json +96 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
3
|
+
import { T as TapTargetLinkComponent } from './link-CkRpHgou.cjs';
|
|
4
|
+
export { a as TapTargetLinkProps, g as getTapTargetLinkComponent, s as setTapTargetLinkComponent } from './link-CkRpHgou.cjs';
|
|
5
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
6
|
+
|
|
7
|
+
interface TapTargetButtonProps {
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
strokeWidth?: number | undefined;
|
|
11
|
+
onClick?: (() => void) | undefined;
|
|
12
|
+
className?: string | undefined;
|
|
13
|
+
as?: "button" | "label" | undefined;
|
|
14
|
+
htmlFor?: string | undefined;
|
|
15
|
+
ariaLabel?: string | undefined;
|
|
16
|
+
disabled?: boolean | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* When set, the tap button renders as a link instead of a button.
|
|
19
|
+
* - Internal hrefs (e.g. "/tasks") render via the injected link component
|
|
20
|
+
* (`setTapTargetLinkComponent` / the `linkComponent` prop), falling back
|
|
21
|
+
* to a plain `<a>` when none is registered.
|
|
22
|
+
* - External hrefs (http://, https://, mailto:, tel:) render as `<a>`
|
|
23
|
+
* with `target="_blank"` and `rel="noopener noreferrer"` by default.
|
|
24
|
+
* - When combined with `disabled`, the trigger renders as a non-navigable
|
|
25
|
+
* `<span aria-disabled="true">` with the same visual styling.
|
|
26
|
+
*/
|
|
27
|
+
href?: string | undefined;
|
|
28
|
+
/** Override target. Works on both internal links and external anchors. */
|
|
29
|
+
target?: "_blank" | "_self" | "_parent" | "_top" | undefined;
|
|
30
|
+
/** Override rel. Works on both internal links and external anchors. */
|
|
31
|
+
rel?: string | undefined;
|
|
32
|
+
/** Forwarded to the injected link component. Pass `false` to disable prefetching. */
|
|
33
|
+
prefetch?: boolean | null | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Per-instance link component for internal hrefs — overrides the
|
|
36
|
+
* module-level `setTapTargetLinkComponent` registration.
|
|
37
|
+
*/
|
|
38
|
+
linkComponent?: TapTargetLinkComponent | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Tooltip text. Defaults to `ariaLabel` when omitted.
|
|
41
|
+
* Pass `false` to explicitly disable the tooltip.
|
|
42
|
+
*/
|
|
43
|
+
tooltip?: string | false | undefined;
|
|
44
|
+
/** Tooltip placement. Defaults to "top". */
|
|
45
|
+
tooltipSide?: "top" | "right" | "bottom" | "left" | undefined;
|
|
46
|
+
/** Tooltip alignment along its side. Defaults to "center". */
|
|
47
|
+
tooltipAlign?: "start" | "center" | "end" | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Visible caption rendered inline after the icon (`[icon Label]`).
|
|
50
|
+
* Widens the pill automatically. Tooltip defaults to off when set — the
|
|
51
|
+
* label is self-describing. Visible text becomes the accessible name.
|
|
52
|
+
*/
|
|
53
|
+
label?: string | undefined;
|
|
54
|
+
}
|
|
55
|
+
interface TapTargetButtonSolidProps extends TapTargetButtonProps {
|
|
56
|
+
bgColor?: string | undefined;
|
|
57
|
+
iconColor?: string | undefined;
|
|
58
|
+
hoverBgColor?: string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Press-state background. Defaults to `active:brightness-90` which works on
|
|
61
|
+
* any color. Override when using a custom `bgColor` that should darken to a
|
|
62
|
+
* specific shade on press (e.g. `active:bg-primary/60`).
|
|
63
|
+
*/
|
|
64
|
+
activeBgColor?: string | undefined;
|
|
65
|
+
}
|
|
66
|
+
declare const TapTargetButton: react.ForwardRefExoticComponent<TapTargetButtonProps & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
67
|
+
declare const TapTargetButtonTransparent: react.ForwardRefExoticComponent<TapTargetButtonProps & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
68
|
+
declare const TapTargetButtonSolid: react.ForwardRefExoticComponent<TapTargetButtonSolidProps & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
69
|
+
/** Solid destructive pill — delete/remove actions. White-on-red like the
|
|
70
|
+
* primary solid is white-on-blue. Use THIS, never hand-pass bg-destructive
|
|
71
|
+
* with the default (dark) icon color. */
|
|
72
|
+
declare const TapTargetButtonDestructive: react.ForwardRefExoticComponent<TapTargetButtonSolidProps & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
73
|
+
declare const TapTargetButtonForGroup: react.ForwardRefExoticComponent<TapTargetButtonProps & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
74
|
+
declare function TapTargetButtonGroup({ children, className, }: {
|
|
75
|
+
children: React.ReactNode;
|
|
76
|
+
className?: string | undefined;
|
|
77
|
+
}): react.JSX.Element;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Wraps a TapTargetButton (or any tap control) like the button-demo page:
|
|
81
|
+
* no extra padding on the control — only `gap-0.5` before the caption.
|
|
82
|
+
* Tooltip shows the full `label`; the caption truncates at max-w-[52px].
|
|
83
|
+
*/
|
|
84
|
+
declare function TapTargetLabeled({ label, children, hideLabel, toolTipSide, }: {
|
|
85
|
+
label: string;
|
|
86
|
+
children: React.ReactNode;
|
|
87
|
+
hideLabel?: boolean | undefined;
|
|
88
|
+
toolTipSide?: "top" | "bottom" | "left" | "right" | undefined;
|
|
89
|
+
}): react.JSX.Element;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Inlined port of matrx-frontend `components/ui/tooltip.tsx` — the one `@/`
|
|
93
|
+
* import the tap-target components consumed beyond `cn` and `next/link`.
|
|
94
|
+
* Behavior deltas vs. the original, both documented in FEATURE.md:
|
|
95
|
+
* - `useNestedPortalContainer` (a host-specific nested-overlay portal context)
|
|
96
|
+
* is dropped: content portals to the Radix default (document.body).
|
|
97
|
+
* - Everything else — unconditional Root render, popover-token styling — is
|
|
98
|
+
* verbatim.
|
|
99
|
+
*
|
|
100
|
+
* Hosts must mount `TooltipProvider` once near the app root (matrx-frontend
|
|
101
|
+
* already does); `TapTargetLabeled` brings its own provider like the original.
|
|
102
|
+
*/
|
|
103
|
+
declare const TooltipProvider: react.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
104
|
+
declare const Tooltip: react.FC<TooltipPrimitive.TooltipProps>;
|
|
105
|
+
declare const TooltipTrigger: react.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
106
|
+
declare const TooltipContent: react.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
107
|
+
|
|
108
|
+
export { TapTargetButton, TapTargetButtonDestructive, TapTargetButtonForGroup, TapTargetButtonGroup, type TapTargetButtonProps, TapTargetButtonSolid, type TapTargetButtonSolidProps, TapTargetButtonTransparent, TapTargetLabeled, TapTargetLinkComponent, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
3
|
+
import { T as TapTargetLinkComponent } from './link-CkRpHgou.js';
|
|
4
|
+
export { a as TapTargetLinkProps, g as getTapTargetLinkComponent, s as setTapTargetLinkComponent } from './link-CkRpHgou.js';
|
|
5
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
6
|
+
|
|
7
|
+
interface TapTargetButtonProps {
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
strokeWidth?: number | undefined;
|
|
11
|
+
onClick?: (() => void) | undefined;
|
|
12
|
+
className?: string | undefined;
|
|
13
|
+
as?: "button" | "label" | undefined;
|
|
14
|
+
htmlFor?: string | undefined;
|
|
15
|
+
ariaLabel?: string | undefined;
|
|
16
|
+
disabled?: boolean | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* When set, the tap button renders as a link instead of a button.
|
|
19
|
+
* - Internal hrefs (e.g. "/tasks") render via the injected link component
|
|
20
|
+
* (`setTapTargetLinkComponent` / the `linkComponent` prop), falling back
|
|
21
|
+
* to a plain `<a>` when none is registered.
|
|
22
|
+
* - External hrefs (http://, https://, mailto:, tel:) render as `<a>`
|
|
23
|
+
* with `target="_blank"` and `rel="noopener noreferrer"` by default.
|
|
24
|
+
* - When combined with `disabled`, the trigger renders as a non-navigable
|
|
25
|
+
* `<span aria-disabled="true">` with the same visual styling.
|
|
26
|
+
*/
|
|
27
|
+
href?: string | undefined;
|
|
28
|
+
/** Override target. Works on both internal links and external anchors. */
|
|
29
|
+
target?: "_blank" | "_self" | "_parent" | "_top" | undefined;
|
|
30
|
+
/** Override rel. Works on both internal links and external anchors. */
|
|
31
|
+
rel?: string | undefined;
|
|
32
|
+
/** Forwarded to the injected link component. Pass `false` to disable prefetching. */
|
|
33
|
+
prefetch?: boolean | null | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Per-instance link component for internal hrefs — overrides the
|
|
36
|
+
* module-level `setTapTargetLinkComponent` registration.
|
|
37
|
+
*/
|
|
38
|
+
linkComponent?: TapTargetLinkComponent | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Tooltip text. Defaults to `ariaLabel` when omitted.
|
|
41
|
+
* Pass `false` to explicitly disable the tooltip.
|
|
42
|
+
*/
|
|
43
|
+
tooltip?: string | false | undefined;
|
|
44
|
+
/** Tooltip placement. Defaults to "top". */
|
|
45
|
+
tooltipSide?: "top" | "right" | "bottom" | "left" | undefined;
|
|
46
|
+
/** Tooltip alignment along its side. Defaults to "center". */
|
|
47
|
+
tooltipAlign?: "start" | "center" | "end" | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Visible caption rendered inline after the icon (`[icon Label]`).
|
|
50
|
+
* Widens the pill automatically. Tooltip defaults to off when set — the
|
|
51
|
+
* label is self-describing. Visible text becomes the accessible name.
|
|
52
|
+
*/
|
|
53
|
+
label?: string | undefined;
|
|
54
|
+
}
|
|
55
|
+
interface TapTargetButtonSolidProps extends TapTargetButtonProps {
|
|
56
|
+
bgColor?: string | undefined;
|
|
57
|
+
iconColor?: string | undefined;
|
|
58
|
+
hoverBgColor?: string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Press-state background. Defaults to `active:brightness-90` which works on
|
|
61
|
+
* any color. Override when using a custom `bgColor` that should darken to a
|
|
62
|
+
* specific shade on press (e.g. `active:bg-primary/60`).
|
|
63
|
+
*/
|
|
64
|
+
activeBgColor?: string | undefined;
|
|
65
|
+
}
|
|
66
|
+
declare const TapTargetButton: react.ForwardRefExoticComponent<TapTargetButtonProps & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
67
|
+
declare const TapTargetButtonTransparent: react.ForwardRefExoticComponent<TapTargetButtonProps & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
68
|
+
declare const TapTargetButtonSolid: react.ForwardRefExoticComponent<TapTargetButtonSolidProps & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
69
|
+
/** Solid destructive pill — delete/remove actions. White-on-red like the
|
|
70
|
+
* primary solid is white-on-blue. Use THIS, never hand-pass bg-destructive
|
|
71
|
+
* with the default (dark) icon color. */
|
|
72
|
+
declare const TapTargetButtonDestructive: react.ForwardRefExoticComponent<TapTargetButtonSolidProps & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
73
|
+
declare const TapTargetButtonForGroup: react.ForwardRefExoticComponent<TapTargetButtonProps & ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>>;
|
|
74
|
+
declare function TapTargetButtonGroup({ children, className, }: {
|
|
75
|
+
children: React.ReactNode;
|
|
76
|
+
className?: string | undefined;
|
|
77
|
+
}): react.JSX.Element;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Wraps a TapTargetButton (or any tap control) like the button-demo page:
|
|
81
|
+
* no extra padding on the control — only `gap-0.5` before the caption.
|
|
82
|
+
* Tooltip shows the full `label`; the caption truncates at max-w-[52px].
|
|
83
|
+
*/
|
|
84
|
+
declare function TapTargetLabeled({ label, children, hideLabel, toolTipSide, }: {
|
|
85
|
+
label: string;
|
|
86
|
+
children: React.ReactNode;
|
|
87
|
+
hideLabel?: boolean | undefined;
|
|
88
|
+
toolTipSide?: "top" | "bottom" | "left" | "right" | undefined;
|
|
89
|
+
}): react.JSX.Element;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Inlined port of matrx-frontend `components/ui/tooltip.tsx` — the one `@/`
|
|
93
|
+
* import the tap-target components consumed beyond `cn` and `next/link`.
|
|
94
|
+
* Behavior deltas vs. the original, both documented in FEATURE.md:
|
|
95
|
+
* - `useNestedPortalContainer` (a host-specific nested-overlay portal context)
|
|
96
|
+
* is dropped: content portals to the Radix default (document.body).
|
|
97
|
+
* - Everything else — unconditional Root render, popover-token styling — is
|
|
98
|
+
* verbatim.
|
|
99
|
+
*
|
|
100
|
+
* Hosts must mount `TooltipProvider` once near the app root (matrx-frontend
|
|
101
|
+
* already does); `TapTargetLabeled` brings its own provider like the original.
|
|
102
|
+
*/
|
|
103
|
+
declare const TooltipProvider: react.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
104
|
+
declare const Tooltip: react.FC<TooltipPrimitive.TooltipProps>;
|
|
105
|
+
declare const TooltipTrigger: react.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
106
|
+
declare const TooltipContent: react.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
107
|
+
|
|
108
|
+
export { TapTargetButton, TapTargetButtonDestructive, TapTargetButtonForGroup, TapTargetButtonGroup, type TapTargetButtonProps, TapTargetButtonSolid, type TapTargetButtonSolidProps, TapTargetButtonTransparent, TapTargetLabeled, TapTargetLinkComponent, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|