@fpkit/acss 1.0.0-beta.1 → 2.0.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/README.md +92 -0
- package/docs/README.md +325 -0
- package/docs/guides/accessibility.md +764 -0
- package/docs/guides/architecture.md +705 -0
- package/docs/guides/composition.md +688 -0
- package/docs/guides/css-variables.md +522 -0
- package/docs/guides/storybook.md +828 -0
- package/docs/guides/testing.md +817 -0
- package/docs/testing/focus-indicator-testing.md +437 -0
- package/libs/{chunk-7XPFW7CB.js → chunk-43TK2ICH.js} +2 -2
- package/libs/chunk-5PJYLVFY.cjs +17 -0
- package/libs/chunk-5PJYLVFY.cjs.map +1 -0
- package/libs/chunk-E4OSROCA.cjs +17 -0
- package/libs/chunk-E4OSROCA.cjs.map +1 -0
- package/libs/chunk-KVKQLRJG.js +10 -0
- package/libs/chunk-KVKQLRJG.js.map +1 -0
- package/libs/{chunk-QVW6W76L.cjs → chunk-MGPWZRBX.cjs} +3 -3
- package/libs/chunk-NNTBIHSD.js +8 -0
- package/libs/chunk-NNTBIHSD.js.map +1 -0
- package/libs/{chunk-X3JCTEPD.js → chunk-QKHPHMG2.js} +2 -2
- package/libs/{chunk-T4T6GWYQ.cjs → chunk-R7NLLZU2.cjs} +3 -3
- package/libs/{chunk-X5LGFCWG.js → chunk-UJAQVHWC.js} +3 -3
- package/libs/{chunk-DKTHCQ5P.cjs → chunk-X5RKCLDC.cjs} +3 -3
- package/libs/components/breadcrumbs/breadcrumb.cjs +5 -5
- package/libs/components/breadcrumbs/breadcrumb.d.cts +1 -1
- package/libs/components/breadcrumbs/breadcrumb.d.ts +1 -1
- package/libs/components/breadcrumbs/breadcrumb.js +2 -2
- package/libs/components/button.cjs +3 -3
- package/libs/components/button.d.cts +1 -1
- package/libs/components/button.d.ts +1 -1
- package/libs/components/button.js +1 -1
- package/libs/components/buttons/button.css +1 -1
- package/libs/components/buttons/button.css.map +1 -1
- package/libs/components/buttons/button.min.css +2 -2
- package/libs/components/dialog/dialog.cjs +4 -4
- package/libs/components/dialog/dialog.js +2 -2
- package/libs/components/icons/icon.d.cts +32 -32
- package/libs/components/icons/icon.d.ts +32 -32
- package/libs/components/link/link.cjs +11 -3
- package/libs/components/link/link.d.cts +131 -3
- package/libs/components/link/link.d.ts +131 -3
- package/libs/components/link/link.js +1 -1
- package/libs/components/list/list.css +1 -1
- package/libs/components/list/list.min.css +1 -1
- package/libs/components/modal.cjs +3 -3
- package/libs/components/modal.js +2 -2
- package/libs/hooks.cjs +3 -3
- package/libs/hooks.d.cts +1 -1
- package/libs/hooks.d.ts +1 -1
- package/libs/hooks.js +2 -2
- package/libs/index.cjs +12 -12
- package/libs/index.css +1 -1
- package/libs/index.css.map +1 -1
- package/libs/index.d.cts +237 -2
- package/libs/index.d.ts +237 -2
- package/libs/index.js +5 -5
- package/package.json +4 -3
- package/src/components/README.mdx +1 -1
- package/src/components/breadcrumbs/breadcrumb.test.tsx +1 -2
- package/src/components/buttons/README.mdx +19 -9
- package/src/components/buttons/button.scss +5 -0
- package/src/components/buttons/button.stories.tsx +8 -5
- package/src/components/buttons/button.tsx +19 -15
- package/src/components/cards/card.stories.tsx +1 -1
- package/src/components/details/details.stories.tsx +1 -1
- package/src/components/form/form.stories.tsx +1 -1
- package/src/components/form/input.stories.tsx +1 -1
- package/src/components/form/select.stories.tsx +1 -1
- package/src/components/heading/README.mdx +292 -0
- package/src/components/icons/icon.stories.tsx +1 -1
- package/src/components/link/link.stories.tsx +205 -8
- package/src/components/link/link.test.tsx +1 -1
- package/src/components/link/link.tsx +22 -0
- package/src/components/link/link.types.ts +11 -3
- package/src/components/list/list.scss +1 -1
- package/src/components/nav/nav.stories.tsx +1 -1
- package/src/components/ui.stories.tsx +53 -19
- package/src/docs/accessibility.mdx +484 -0
- package/src/docs/composition.mdx +549 -0
- package/src/docs/css-variables.mdx +380 -0
- package/src/docs/fpkit-developer.mdx +623 -0
- package/src/introduction.mdx +356 -0
- package/src/styles/buttons/button.css +4 -0
- package/src/styles/buttons/button.css.map +1 -1
- package/src/styles/index.css +9 -3
- package/src/styles/index.css.map +1 -1
- package/src/styles/list/list.css +1 -1
- package/src/styles/utilities/_disabled.scss +5 -4
- package/libs/chunk-33PNJ4LO.cjs +0 -15
- package/libs/chunk-33PNJ4LO.cjs.map +0 -1
- package/libs/chunk-GT77BX4L.cjs +0 -17
- package/libs/chunk-GT77BX4L.cjs.map +0 -1
- package/libs/chunk-OVWLQYMK.js +0 -10
- package/libs/chunk-OVWLQYMK.js.map +0 -1
- package/libs/chunk-UEPAWMDF.js +0 -8
- package/libs/chunk-UEPAWMDF.js.map +0 -1
- package/libs/link-5192f411.d.ts +0 -323
- /package/libs/{chunk-7XPFW7CB.js.map → chunk-43TK2ICH.js.map} +0 -0
- /package/libs/{chunk-QVW6W76L.cjs.map → chunk-MGPWZRBX.cjs.map} +0 -0
- /package/libs/{chunk-X3JCTEPD.js.map → chunk-QKHPHMG2.js.map} +0 -0
- /package/libs/{chunk-T4T6GWYQ.cjs.map → chunk-R7NLLZU2.cjs.map} +0 -0
- /package/libs/{chunk-X5LGFCWG.js.map → chunk-UJAQVHWC.js.map} +0 -0
- /package/libs/{chunk-DKTHCQ5P.cjs.map → chunk-X5RKCLDC.cjs.map} +0 -0
package/libs/link-5192f411.d.ts
DELETED
|
@@ -1,323 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { U as UI } from './ui-d01b50d4.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Props for the Link component.
|
|
6
|
-
*
|
|
7
|
-
* The Link component renders accessible anchor elements with enhanced security,
|
|
8
|
-
* styling variants, and WCAG 2.1 AA compliance. It supports both traditional
|
|
9
|
-
* text links and button-styled links for call-to-action scenarios.
|
|
10
|
-
*
|
|
11
|
-
* ## Accessibility Considerations
|
|
12
|
-
*
|
|
13
|
-
* - External links automatically include `rel="noopener noreferrer"` for security
|
|
14
|
-
* - Links should have descriptive text or `aria-label` for screen readers
|
|
15
|
-
* - Focus indicators must meet WCAG 2.4.7 contrast requirements (3:1 minimum)
|
|
16
|
-
* - Button-styled links maintain semantic `<a>` element for proper navigation
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```tsx
|
|
20
|
-
* // Basic link
|
|
21
|
-
* <Link href="/about">About Us</Link>
|
|
22
|
-
*
|
|
23
|
-
* // External link with prefetch
|
|
24
|
-
* <Link href="https://example.com" target="_blank" prefetch>
|
|
25
|
-
* Visit Example
|
|
26
|
-
* </Link>
|
|
27
|
-
*
|
|
28
|
-
* // Button-styled link
|
|
29
|
-
* <Link href="/signup" btnStyle="primary">
|
|
30
|
-
* <b>Sign Up Now</b>
|
|
31
|
-
* </Link>
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
type LinkProps = {
|
|
35
|
-
/**
|
|
36
|
-
* The URL that the hyperlink points to.
|
|
37
|
-
* Can be relative or absolute, internal or external.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```tsx
|
|
41
|
-
* href="/products"
|
|
42
|
-
* href="https://example.com"
|
|
43
|
-
* href="mailto:hello@example.com"
|
|
44
|
-
* href="tel:+1234567890"
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
href?: string;
|
|
48
|
-
/**
|
|
49
|
-
* Where to display the linked URL.
|
|
50
|
-
*
|
|
51
|
-
* - `_self` (default): Current browsing context
|
|
52
|
-
* - `_blank`: New tab/window (automatically adds security attributes)
|
|
53
|
-
* - `_parent`: Parent browsing context
|
|
54
|
-
* - `_top`: Top-level browsing context
|
|
55
|
-
*
|
|
56
|
-
* Note: When `target="_blank"`, `rel="noopener noreferrer"` is automatically
|
|
57
|
-
* added for security unless explicitly overridden.
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```tsx
|
|
61
|
-
* target="_blank" // Opens in new tab with security
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
target?: string;
|
|
65
|
-
/**
|
|
66
|
-
* Relationship between current document and linked URL.
|
|
67
|
-
*
|
|
68
|
-
* Common values:
|
|
69
|
-
* - `noopener`: Prevents window.opener access (security)
|
|
70
|
-
* - `noreferrer`: Prevents referrer header (privacy)
|
|
71
|
-
* - `nofollow`: Hints search engines not to follow (SEO)
|
|
72
|
-
* - `prefetch`: Hints to prefetch the resource (performance)
|
|
73
|
-
*
|
|
74
|
-
* Note: For `target="_blank"`, this component automatically merges
|
|
75
|
-
* `noopener noreferrer` with any user-provided values for security.
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```tsx
|
|
79
|
-
* rel="nofollow noopener"
|
|
80
|
-
* rel="author"
|
|
81
|
-
* ```
|
|
82
|
-
*/
|
|
83
|
-
rel?: string;
|
|
84
|
-
/**
|
|
85
|
-
* Content to display inside the link.
|
|
86
|
-
*
|
|
87
|
-
* For accessibility, ensure link text is descriptive and meaningful.
|
|
88
|
-
* Avoid generic text like "click here" or "read more" without context.
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* ```tsx
|
|
92
|
-
* // ✅ Good: Descriptive link text
|
|
93
|
-
* <Link href="/products">View all products</Link>
|
|
94
|
-
*
|
|
95
|
-
* // ❌ Bad: Generic link text without context
|
|
96
|
-
* <Link href="/products">Click here</Link>
|
|
97
|
-
*
|
|
98
|
-
* // ✅ Good: Icon with accessible label
|
|
99
|
-
* <Link href="/home" aria-label="Return to homepage">
|
|
100
|
-
* <HomeIcon aria-hidden="true" />
|
|
101
|
-
* </Link>
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
children: React.ReactNode;
|
|
105
|
-
/**
|
|
106
|
-
* Inline CSS styles to apply to the link element.
|
|
107
|
-
* Can be used to override CSS custom properties.
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
* ```tsx
|
|
111
|
-
* styles={{
|
|
112
|
-
* '--link-color': '#ff0000',
|
|
113
|
-
* '--link-decoration': 'underline',
|
|
114
|
-
* }}
|
|
115
|
-
* ```
|
|
116
|
-
*/
|
|
117
|
-
styles?: React.CSSProperties;
|
|
118
|
-
/**
|
|
119
|
-
* Hints to the browser to prefetch the linked resource.
|
|
120
|
-
*
|
|
121
|
-
* When `true` and `target="_blank"`, adds `rel="prefetch"` along with
|
|
122
|
-
* security attributes. This can improve perceived performance but should
|
|
123
|
-
* be used judiciously as it consumes bandwidth.
|
|
124
|
-
*
|
|
125
|
-
* Note: Browser support varies. Modern browsers may ignore this hint.
|
|
126
|
-
*
|
|
127
|
-
* @default false
|
|
128
|
-
* @example
|
|
129
|
-
* ```tsx
|
|
130
|
-
* <Link href="/next-page" prefetch>Next Page</Link>
|
|
131
|
-
* ```
|
|
132
|
-
*/
|
|
133
|
-
prefetch?: boolean;
|
|
134
|
-
/**
|
|
135
|
-
* Applies button-like styling to the link.
|
|
136
|
-
*
|
|
137
|
-
* When set, the link renders with button styling including padding,
|
|
138
|
-
* borders, and hover effects while maintaining semantic anchor behavior.
|
|
139
|
-
*
|
|
140
|
-
* Common values:
|
|
141
|
-
* - `"btn"`: Standard button styling
|
|
142
|
-
* - `"pill"`: Rounded pill button styling
|
|
143
|
-
*
|
|
144
|
-
* Alternative: Wrap children in `<b>` or `<i>` tags for automatic styling:
|
|
145
|
-
* - `<b>`: Applies button styling
|
|
146
|
-
* - `<i>`: Applies pill styling
|
|
147
|
-
*
|
|
148
|
-
* @example
|
|
149
|
-
* ```tsx
|
|
150
|
-
* // Using btnStyle prop
|
|
151
|
-
* <Link href="/signup" btnStyle="btn">Sign Up</Link>
|
|
152
|
-
*
|
|
153
|
-
* // Using child wrapper (automatic detection)
|
|
154
|
-
* <Link href="/signup"><b>Sign Up</b></Link>
|
|
155
|
-
* <Link href="/signup"><i>Pill Button</i></Link>
|
|
156
|
-
* ```
|
|
157
|
-
*/
|
|
158
|
-
btnStyle?: string;
|
|
159
|
-
/**
|
|
160
|
-
* Event handler called when the link is clicked or activated.
|
|
161
|
-
*
|
|
162
|
-
* **Recommended for most use cases**, especially analytics and tracking.
|
|
163
|
-
* This event fires for:
|
|
164
|
-
* - Mouse clicks
|
|
165
|
-
* - Touch/tap interactions
|
|
166
|
-
* - Keyboard activation (Enter key)
|
|
167
|
-
* - Assistive technology activation
|
|
168
|
-
*
|
|
169
|
-
* Use `onClick` when you need to track ALL user activations, including
|
|
170
|
-
* keyboard users. This ensures full accessibility coverage.
|
|
171
|
-
*
|
|
172
|
-
* @param event - The mouse event
|
|
173
|
-
* @example
|
|
174
|
-
* ```tsx
|
|
175
|
-
* // ✅ RECOMMENDED: onClick tracks all activation methods
|
|
176
|
-
* <Link
|
|
177
|
-
* href="/products"
|
|
178
|
-
* onClick={(e) => {
|
|
179
|
-
* trackEvent('link_click', { href: '/products' });
|
|
180
|
-
* }}
|
|
181
|
-
* >
|
|
182
|
-
* Products
|
|
183
|
-
* </Link>
|
|
184
|
-
* ```
|
|
185
|
-
*/
|
|
186
|
-
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
187
|
-
/**
|
|
188
|
-
* Event handler called when a pointer device button is pressed on the link.
|
|
189
|
-
*
|
|
190
|
-
* Use this for specific pointer interactions like:
|
|
191
|
-
* - Drag-and-drop detection
|
|
192
|
-
* - Touch gesture recognition
|
|
193
|
-
* - Distinguishing input types (mouse vs touch vs pen)
|
|
194
|
-
* - Providing early visual feedback before click completes
|
|
195
|
-
*
|
|
196
|
-
* **⚠️ Accessibility Note**: Unlike `onClick`, this does NOT fire for
|
|
197
|
-
* keyboard activation (Enter key). If you need to track all user interactions
|
|
198
|
-
* including keyboard users, use `onClick` instead.
|
|
199
|
-
*
|
|
200
|
-
* @param event - The pointer event
|
|
201
|
-
* @example
|
|
202
|
-
* ```tsx
|
|
203
|
-
* // Use onPointerDown for pointer-specific interactions
|
|
204
|
-
* <Link
|
|
205
|
-
* href="/products"
|
|
206
|
-
* onPointerDown={(e) => {
|
|
207
|
-
* // Distinguish between mouse (2), touch (5), and pen (3)
|
|
208
|
-
* console.log('Pointer type:', e.pointerType);
|
|
209
|
-
* }}
|
|
210
|
-
* >
|
|
211
|
-
* Products
|
|
212
|
-
* </Link>
|
|
213
|
-
* ```
|
|
214
|
-
*
|
|
215
|
-
* @example
|
|
216
|
-
* ```tsx
|
|
217
|
-
* // ✅ Use both handlers together for comprehensive tracking
|
|
218
|
-
* <Link
|
|
219
|
-
* href="/products"
|
|
220
|
-
* onClick={(e) => trackAllActivations(e)}
|
|
221
|
-
* onPointerDown={(e) => provideFeedback(e)}
|
|
222
|
-
* >
|
|
223
|
-
* Products
|
|
224
|
-
* </Link>
|
|
225
|
-
* ```
|
|
226
|
-
*/
|
|
227
|
-
onPointerDown?: (event: React.PointerEvent<HTMLAnchorElement>) => void;
|
|
228
|
-
} & React.ComponentProps<typeof UI> & React.ComponentPropsWithoutRef<"a">;
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Link - A semantic, accessible anchor component with enhanced security and styling.
|
|
232
|
-
*
|
|
233
|
-
* The Link component renders accessible `<a>` elements with automatic security
|
|
234
|
-
* attributes for external links, customizable styling variants, and full WCAG 2.1
|
|
235
|
-
* AA compliance. It supports traditional text links, button-styled links, and
|
|
236
|
-
* programmatic focus management via ref forwarding.
|
|
237
|
-
*
|
|
238
|
-
* ## Features
|
|
239
|
-
*
|
|
240
|
-
* - 🔒 **Automatic Security**: External links get `rel="noopener noreferrer"`
|
|
241
|
-
* - ♿ **WCAG 2.1 AA Compliant**: Accessible focus indicators and semantic HTML
|
|
242
|
-
* - 🎨 **Flexible Styling**: Text links, button links, and pill variants
|
|
243
|
-
* - ⚡ **Performance**: Optional prefetch hints for faster navigation
|
|
244
|
-
* - 🎯 **Ref Forwarding**: Direct DOM access for focus management and scroll
|
|
245
|
-
* - 🧪 **Type-Safe**: Full TypeScript support with comprehensive prop types
|
|
246
|
-
*
|
|
247
|
-
* ## Accessibility
|
|
248
|
-
*
|
|
249
|
-
* - ✅ Semantic `<a>` element for proper keyboard navigation
|
|
250
|
-
* - ✅ Focus indicators meet WCAG 2.4.7 (3:1 contrast ratio)
|
|
251
|
-
* - ✅ Screen readers announce link purpose and destination
|
|
252
|
-
* - ✅ External links include security attributes automatically
|
|
253
|
-
* - ✅ Supports `aria-label` for icon-only or ambiguous links
|
|
254
|
-
* - ✅ Ref forwarding enables skip-link patterns
|
|
255
|
-
*
|
|
256
|
-
* @example
|
|
257
|
-
* // Basic internal link
|
|
258
|
-
* <Link href="/about">About Us</Link>
|
|
259
|
-
*
|
|
260
|
-
* @example
|
|
261
|
-
* // External link with automatic security
|
|
262
|
-
* <Link href="https://example.com" target="_blank">
|
|
263
|
-
* Visit Example
|
|
264
|
-
* </Link>
|
|
265
|
-
*
|
|
266
|
-
* @example
|
|
267
|
-
* // Button-styled call-to-action link
|
|
268
|
-
* <Link href="/signup">
|
|
269
|
-
* <b>Get Started</b>
|
|
270
|
-
* </Link>
|
|
271
|
-
*
|
|
272
|
-
* @example
|
|
273
|
-
* // Icon-only link with accessible label
|
|
274
|
-
* <Link href="/settings" aria-label="Open settings">
|
|
275
|
-
* <SettingsIcon aria-hidden="true" />
|
|
276
|
-
* </Link>
|
|
277
|
-
*
|
|
278
|
-
* @example
|
|
279
|
-
* // Analytics tracking with onClick (includes keyboard users)
|
|
280
|
-
* <Link
|
|
281
|
-
* href="/products"
|
|
282
|
-
* onClick={(e) => trackEvent('link_click', { href: '/products' })}
|
|
283
|
-
* >
|
|
284
|
-
* Browse Products
|
|
285
|
-
* </Link>
|
|
286
|
-
*
|
|
287
|
-
* @example
|
|
288
|
-
* // Skip link with ref forwarding for focus management
|
|
289
|
-
* const mainRef = useRef<HTMLAnchorElement>(null);
|
|
290
|
-
*
|
|
291
|
-
* <Link ref={mainRef} href="#main-content">
|
|
292
|
-
* Skip to main content
|
|
293
|
-
* </Link>
|
|
294
|
-
*
|
|
295
|
-
* @example
|
|
296
|
-
* // Custom styled link with CSS variables
|
|
297
|
-
* <Link
|
|
298
|
-
* href="/products"
|
|
299
|
-
* styles={{
|
|
300
|
-
* '--link-color': '#0066cc',
|
|
301
|
-
* '--link-decoration': 'underline',
|
|
302
|
-
* }}
|
|
303
|
-
* >
|
|
304
|
-
* Browse Products
|
|
305
|
-
* </Link>
|
|
306
|
-
*
|
|
307
|
-
* @example
|
|
308
|
-
* // ✅ GOOD: Descriptive link text
|
|
309
|
-
* <Link href="/docs/installation">
|
|
310
|
-
* Read installation guide
|
|
311
|
-
* </Link>
|
|
312
|
-
*
|
|
313
|
-
* @example
|
|
314
|
-
* // ❌ BAD: Generic link text (poor for screen readers)
|
|
315
|
-
* <Link href="/docs/installation">
|
|
316
|
-
* Click here
|
|
317
|
-
* </Link>
|
|
318
|
-
*
|
|
319
|
-
* @see {@link LinkProps} for complete prop documentation
|
|
320
|
-
*/
|
|
321
|
-
declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
322
|
-
|
|
323
|
-
export { Link as L, LinkProps as a };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|