@ai-matrx/tap-target 0.2.7 → 0.2.8
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 +4 -0
- package/dist/buttons.cjs +238 -719
- package/dist/buttons.cjs.map +1 -1
- package/dist/buttons.d.cts +1 -1
- package/dist/buttons.d.ts +1 -1
- package/dist/buttons.js +243 -725
- package/dist/buttons.js.map +1 -1
- package/dist/index.cjs +13 -524
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -96
- package/dist/index.d.ts +1 -96
- package/dist/index.js +12 -526
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -159
- package/package.json +1 -1
- package/dist/link-CkRpHgou.d.cts +0 -40
- package/dist/link-CkRpHgou.d.ts +0 -40
package/dist/styles.css
CHANGED
|
@@ -1,160 +1,2 @@
|
|
|
1
|
-
/*
|
|
2
|
-
import "@ai-matrx/tap-target/styles.css";
|
|
3
|
-
Extracted VERBATIM from matrx-frontend app/globals.css (where it lives inside
|
|
4
|
-
`@layer components`; shipped unlayered here so it wins against unlayered host
|
|
5
|
-
CSS without requiring a layer-order declaration). Until the C9 swap removes
|
|
6
|
-
the matrx-frontend originals, any change here ships in BOTH places. */
|
|
7
|
-
|
|
8
|
-
/* @ai-matrx/design-system's stylesheet is REQUIRED by this one, not merely
|
|
9
|
-
recommended (0.2.1). Two reasons, and neither is optional:
|
|
10
|
-
1. `LoadingTapButton`'s spinner wears `matrx-spin`, whose keyframe and rule
|
|
11
|
-
are DEFINED THERE. Copying those four lines here would make a second
|
|
12
|
-
source of truth for one animation — the exact twin census row 19i
|
|
13
|
-
exists to kill — so the sheet is imported instead.
|
|
14
|
-
2. This package already renders design-system components (Tooltip), so
|
|
15
|
-
every correct host loads it anyway.
|
|
16
|
-
`@ai-matrx/design-system` is a real `dependencies` entry of this package, so
|
|
17
|
-
this bare specifier resolves from a plain `npm install @ai-matrx/tap-target`
|
|
18
|
-
with nothing else in the host's manifest. A host that already imports the
|
|
19
|
-
design-system sheet itself loses nothing: bundlers resolve both to one file.
|
|
20
|
-
NOTE: `@import` must lead the file — keep any future rules BELOW it. */
|
|
1
|
+
/* Compatibility entry: tap geometry lives in the design system. */
|
|
21
2
|
@import "@ai-matrx/design-system/styles.css";
|
|
22
|
-
|
|
23
|
-
/* =========================================================================
|
|
24
|
-
TapTargetButton — SINGLE SOURCE OF TRUTH for tap-button geometry + feedback.
|
|
25
|
-
This is the ONLY place these are defined (previously also duplicated in
|
|
26
|
-
styles/shell.css, which caused the same button to resolve differently
|
|
27
|
-
inside vs outside the shell). Consumed exclusively by
|
|
28
|
-
components/icons/TapTargetButton.tsx. To resize or retune EVERY tap button
|
|
29
|
-
in the app, edit HERE — nowhere else.
|
|
30
|
-
|
|
31
|
-
Structure per button:
|
|
32
|
-
.matrx-tap-target — outer 44px invisible touch target = the interactive
|
|
33
|
-
element (<button>/<a>/<label>). It owns the tap
|
|
34
|
-
hygiene (touch-action + tap-highlight) so it applies
|
|
35
|
-
to the WHOLE 44px target AND to the link variants —
|
|
36
|
-
the iOS gray flash paints on the anchor, not the
|
|
37
|
-
inner pill, so putting it on the pill never worked.
|
|
38
|
-
.matrx-tap-pill — inner 28px visible pill. Geometry + press feedback.
|
|
39
|
-
Each variant layers ONLY its decoration on top (glass
|
|
40
|
-
border / solid fill / hover bg) — the size is identical
|
|
41
|
-
across glass / transparent / solid, guaranteed here.
|
|
42
|
-
.matrx-tap-icon — 14px icon.
|
|
43
|
-
.matrx-tap-*-inline — wider auto-width geometry when `label` is set on
|
|
44
|
-
TapTargetButton (icon + caption on one row).
|
|
45
|
-
The `-sm` classes (32 / 20px) are the slimmer geometry used inside groups.
|
|
46
|
-
========================================================================= */
|
|
47
|
-
.matrx-tap-target {
|
|
48
|
-
display: flex;
|
|
49
|
-
height: 2.75rem; /* 44px outer tap target */
|
|
50
|
-
width: 2.75rem;
|
|
51
|
-
flex-shrink: 0; /* a tap target never squishes under flex pressure —
|
|
52
|
-
flexible neighbors (truncating labels) absorb it */
|
|
53
|
-
align-items: center;
|
|
54
|
-
justify-content: center;
|
|
55
|
-
background-color: transparent;
|
|
56
|
-
cursor: pointer;
|
|
57
|
-
outline: none;
|
|
58
|
-
touch-action: manipulation; /* kills the 300ms mobile tap delay */
|
|
59
|
-
-webkit-tap-highlight-color: transparent; /* kills the iOS gray tap flash */
|
|
60
|
-
}
|
|
61
|
-
.matrx-tap-target:disabled {
|
|
62
|
-
opacity: 0.4;
|
|
63
|
-
pointer-events: none;
|
|
64
|
-
}
|
|
65
|
-
.matrx-tap-target-sm {
|
|
66
|
-
height: 2rem; /* 32px */
|
|
67
|
-
width: 2rem;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.matrx-tap-pill {
|
|
71
|
-
display: flex;
|
|
72
|
-
height: 1.75rem; /* 28px visible pill */
|
|
73
|
-
width: 1.75rem;
|
|
74
|
-
align-items: center;
|
|
75
|
-
justify-content: center;
|
|
76
|
-
border-radius: 9999px;
|
|
77
|
-
transition:
|
|
78
|
-
background-color 150ms ease,
|
|
79
|
-
transform 100ms ease;
|
|
80
|
-
}
|
|
81
|
-
.matrx-tap-pill:active {
|
|
82
|
-
transform: scale(0.92);
|
|
83
|
-
}
|
|
84
|
-
.matrx-tap-pill-sm {
|
|
85
|
-
height: 1.25rem; /* 20px */
|
|
86
|
-
width: 1.25rem;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.matrx-tap-icon {
|
|
90
|
-
height: 0.875rem; /* 14px */
|
|
91
|
-
width: 0.875rem;
|
|
92
|
-
flex-shrink: 0;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/* Inline label — icon + text on one row inside the pill */
|
|
96
|
-
.matrx-tap-target-inline {
|
|
97
|
-
width: auto;
|
|
98
|
-
min-width: 2.75rem;
|
|
99
|
-
padding-inline: 0.25rem;
|
|
100
|
-
}
|
|
101
|
-
.matrx-tap-pill-inline {
|
|
102
|
-
width: auto;
|
|
103
|
-
gap: 0.375rem;
|
|
104
|
-
padding-inline: 0.625rem;
|
|
105
|
-
}
|
|
106
|
-
.matrx-tap-label {
|
|
107
|
-
font-size: 0.75rem;
|
|
108
|
-
font-weight: 500;
|
|
109
|
-
line-height: 1;
|
|
110
|
-
white-space: nowrap;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.matrx-tap-target-inline-sm {
|
|
114
|
-
width: auto;
|
|
115
|
-
min-width: 2rem;
|
|
116
|
-
padding-inline: 0.125rem;
|
|
117
|
-
}
|
|
118
|
-
.matrx-tap-pill-inline-sm {
|
|
119
|
-
width: auto;
|
|
120
|
-
gap: 0.25rem;
|
|
121
|
-
padding-inline: 0.5rem;
|
|
122
|
-
}
|
|
123
|
-
.matrx-tap-pill-inline-sm .matrx-tap-label {
|
|
124
|
-
font-size: 0.625rem;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/* Icon-only on phones, icon + caption from `sm` upward. Keep this geometry
|
|
128
|
-
in the canonical tap system so responsive header actions never hand-roll
|
|
129
|
-
smaller targets or duplicate controls at each breakpoint. */
|
|
130
|
-
.matrx-tap-label-mobile-icon-only {
|
|
131
|
-
display: none;
|
|
132
|
-
}
|
|
133
|
-
@media (min-width: 40rem) {
|
|
134
|
-
.matrx-tap-target-mobile-icon-only {
|
|
135
|
-
width: auto;
|
|
136
|
-
min-width: 2.75rem;
|
|
137
|
-
padding-inline: 0.25rem;
|
|
138
|
-
}
|
|
139
|
-
.matrx-tap-pill-mobile-icon-only {
|
|
140
|
-
width: auto;
|
|
141
|
-
gap: 0.375rem;
|
|
142
|
-
padding-inline: 0.625rem;
|
|
143
|
-
}
|
|
144
|
-
.matrx-tap-target-mobile-icon-only-sm {
|
|
145
|
-
width: auto;
|
|
146
|
-
min-width: 2rem;
|
|
147
|
-
padding-inline: 0.125rem;
|
|
148
|
-
}
|
|
149
|
-
.matrx-tap-pill-mobile-icon-only-sm {
|
|
150
|
-
width: auto;
|
|
151
|
-
gap: 0.25rem;
|
|
152
|
-
padding-inline: 0.5rem;
|
|
153
|
-
}
|
|
154
|
-
.matrx-tap-pill-mobile-icon-only-sm .matrx-tap-label {
|
|
155
|
-
font-size: 0.625rem;
|
|
156
|
-
}
|
|
157
|
-
.matrx-tap-label-mobile-icon-only {
|
|
158
|
-
display: inline;
|
|
159
|
-
}
|
|
160
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-matrx/tap-target",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "The AI Matrx tap-target button system: an invisible 44x44 touch ring over a 32x32 visible pill, glass/transparent/solid/group variants with correct ref forwarding for Radix asChild triggers, inline labels, link/label/button trigger resolution with an injectable link component, tooltip wiring, and ~60 pre-composed one-tag buttons.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
package/dist/link-CkRpHgou.d.cts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ComponentType, ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The injectable link seam — the package's replacement for the original
|
|
5
|
-
* hard `next/link` import.
|
|
6
|
-
*
|
|
7
|
-
* Internal hrefs (anything NOT matching `http(s):`, `mailto:`, `tel:`) render
|
|
8
|
-
* through the link component resolved here; external hrefs always render a
|
|
9
|
-
* plain `<a target="_blank" rel="noopener noreferrer">`, exactly like the
|
|
10
|
-
* original. When nothing is registered and no per-instance `linkComponent`
|
|
11
|
-
* prop is given, internal hrefs fall back to a plain `<a>` (no prefetch, no
|
|
12
|
-
* client-side routing — still a working link).
|
|
13
|
-
*/
|
|
14
|
-
interface TapTargetLinkProps {
|
|
15
|
-
href: string;
|
|
16
|
-
target?: "_blank" | "_self" | "_parent" | "_top" | undefined;
|
|
17
|
-
rel?: string | undefined;
|
|
18
|
-
/** Router prefetch hint (next/link semantics). Plain `<a>` fallback ignores it. */
|
|
19
|
-
prefetch?: boolean | null | undefined;
|
|
20
|
-
"aria-label"?: string | undefined;
|
|
21
|
-
className?: string | undefined;
|
|
22
|
-
children?: ReactNode;
|
|
23
|
-
}
|
|
24
|
-
type TapTargetLinkComponent = ComponentType<TapTargetLinkProps>;
|
|
25
|
-
/**
|
|
26
|
-
* Register the app's link component once at startup (e.g. `next/link`):
|
|
27
|
-
*
|
|
28
|
-
* ```tsx
|
|
29
|
-
* import Link from "next/link";
|
|
30
|
-
* import { setTapTargetLinkComponent } from "@ai-matrx/tap-target";
|
|
31
|
-
* setTapTargetLinkComponent(Link);
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* Pass `null` to unregister (plain `<a>` fallback resumes).
|
|
35
|
-
*/
|
|
36
|
-
declare function setTapTargetLinkComponent(component: TapTargetLinkComponent | null): void;
|
|
37
|
-
/** The currently registered link component, or `null` when none is set. */
|
|
38
|
-
declare function getTapTargetLinkComponent(): TapTargetLinkComponent | null;
|
|
39
|
-
|
|
40
|
-
export { type TapTargetLinkComponent as T, type TapTargetLinkProps as a, getTapTargetLinkComponent as g, setTapTargetLinkComponent as s };
|
package/dist/link-CkRpHgou.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ComponentType, ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The injectable link seam — the package's replacement for the original
|
|
5
|
-
* hard `next/link` import.
|
|
6
|
-
*
|
|
7
|
-
* Internal hrefs (anything NOT matching `http(s):`, `mailto:`, `tel:`) render
|
|
8
|
-
* through the link component resolved here; external hrefs always render a
|
|
9
|
-
* plain `<a target="_blank" rel="noopener noreferrer">`, exactly like the
|
|
10
|
-
* original. When nothing is registered and no per-instance `linkComponent`
|
|
11
|
-
* prop is given, internal hrefs fall back to a plain `<a>` (no prefetch, no
|
|
12
|
-
* client-side routing — still a working link).
|
|
13
|
-
*/
|
|
14
|
-
interface TapTargetLinkProps {
|
|
15
|
-
href: string;
|
|
16
|
-
target?: "_blank" | "_self" | "_parent" | "_top" | undefined;
|
|
17
|
-
rel?: string | undefined;
|
|
18
|
-
/** Router prefetch hint (next/link semantics). Plain `<a>` fallback ignores it. */
|
|
19
|
-
prefetch?: boolean | null | undefined;
|
|
20
|
-
"aria-label"?: string | undefined;
|
|
21
|
-
className?: string | undefined;
|
|
22
|
-
children?: ReactNode;
|
|
23
|
-
}
|
|
24
|
-
type TapTargetLinkComponent = ComponentType<TapTargetLinkProps>;
|
|
25
|
-
/**
|
|
26
|
-
* Register the app's link component once at startup (e.g. `next/link`):
|
|
27
|
-
*
|
|
28
|
-
* ```tsx
|
|
29
|
-
* import Link from "next/link";
|
|
30
|
-
* import { setTapTargetLinkComponent } from "@ai-matrx/tap-target";
|
|
31
|
-
* setTapTargetLinkComponent(Link);
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* Pass `null` to unregister (plain `<a>` fallback resumes).
|
|
35
|
-
*/
|
|
36
|
-
declare function setTapTargetLinkComponent(component: TapTargetLinkComponent | null): void;
|
|
37
|
-
/** The currently registered link component, or `null` when none is set. */
|
|
38
|
-
declare function getTapTargetLinkComponent(): TapTargetLinkComponent | null;
|
|
39
|
-
|
|
40
|
-
export { type TapTargetLinkComponent as T, type TapTargetLinkProps as a, getTapTargetLinkComponent as g, setTapTargetLinkComponent as s };
|