@fpkit/acss 0.5.11 โ 0.5.13
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 +514 -18
- package/libs/chunk-23ANBDCR.js +8 -0
- package/libs/chunk-23ANBDCR.js.map +1 -0
- package/libs/chunk-2LTJ7HHX.cjs +18 -0
- package/libs/chunk-2LTJ7HHX.cjs.map +1 -0
- package/libs/chunk-2Y7W75TT.js +9 -0
- package/libs/chunk-2Y7W75TT.js.map +1 -0
- package/libs/chunk-3MKLDCKQ.cjs +31 -0
- package/libs/chunk-3MKLDCKQ.cjs.map +1 -0
- package/libs/chunk-5M57K4SW.js +8 -0
- package/libs/chunk-5M57K4SW.js.map +1 -0
- package/libs/chunk-5S4ORA4C.cjs +15 -0
- package/libs/chunk-5S4ORA4C.cjs.map +1 -0
- package/libs/chunk-772NRB75.js +9 -0
- package/libs/chunk-772NRB75.js.map +1 -0
- package/libs/chunk-AHDJGCG5.cjs +15 -0
- package/libs/chunk-AHDJGCG5.cjs.map +1 -0
- package/libs/chunk-B7F5FS6D.cjs +16 -0
- package/libs/chunk-B7F5FS6D.cjs.map +1 -0
- package/libs/chunk-BHRQBJRY.js +8 -0
- package/libs/chunk-BHRQBJRY.js.map +1 -0
- package/libs/chunk-D4YLRWAO.cjs +18 -0
- package/libs/chunk-D4YLRWAO.cjs.map +1 -0
- package/libs/chunk-ETFLFC2S.js +10 -0
- package/libs/chunk-ETFLFC2S.js.map +1 -0
- package/libs/chunk-G55UJ53G.cjs +16 -0
- package/libs/chunk-G55UJ53G.cjs.map +1 -0
- package/libs/chunk-GZ4QFPRY.js +9 -0
- package/libs/chunk-GZ4QFPRY.js.map +1 -0
- package/libs/chunk-IYUN2EW3.cjs +15 -0
- package/libs/chunk-IYUN2EW3.cjs.map +1 -0
- package/libs/chunk-J32EZPYD.cjs +15 -0
- package/libs/chunk-J32EZPYD.cjs.map +1 -0
- package/libs/chunk-JJ43O4Y5.js +8 -0
- package/libs/chunk-JJ43O4Y5.js.map +1 -0
- package/libs/chunk-KUKIVRC2.js +7 -0
- package/libs/chunk-KUKIVRC2.js.map +1 -0
- package/libs/chunk-L75OQKEI.cjs +13 -0
- package/libs/chunk-L75OQKEI.cjs.map +1 -0
- package/libs/chunk-LT5KZ2QW.cjs +22 -0
- package/libs/chunk-LT5KZ2QW.cjs.map +1 -0
- package/libs/chunk-M5RRNTVX.cjs +15 -0
- package/libs/chunk-M5RRNTVX.cjs.map +1 -0
- package/libs/chunk-NGTJDDFO.js +8 -0
- package/libs/chunk-NGTJDDFO.js.map +1 -0
- package/libs/chunk-OK5QEIMD.cjs +17 -0
- package/libs/chunk-OK5QEIMD.cjs.map +1 -0
- package/libs/chunk-P2DC76ZZ.cjs +18 -0
- package/libs/chunk-P2DC76ZZ.cjs.map +1 -0
- package/libs/chunk-P7TTEYCD.js +7 -0
- package/libs/chunk-P7TTEYCD.js.map +1 -0
- package/libs/chunk-PQ2K3BM6.cjs +17 -0
- package/libs/chunk-PQ2K3BM6.cjs.map +1 -0
- package/libs/chunk-QLZWHAMK.js +8 -0
- package/libs/chunk-QLZWHAMK.js.map +1 -0
- package/libs/chunk-RIVUMPOG.js +8 -0
- package/libs/chunk-RIVUMPOG.js.map +1 -0
- package/libs/chunk-ROZI23GS.cjs +15 -0
- package/libs/chunk-ROZI23GS.cjs.map +1 -0
- package/libs/chunk-S7BABR7Z.cjs +13 -0
- package/libs/chunk-S7BABR7Z.cjs.map +1 -0
- package/libs/chunk-SMYRLO3E.js +8 -0
- package/libs/chunk-SMYRLO3E.js.map +1 -0
- package/libs/chunk-TYRCEX2L.js +8 -0
- package/libs/chunk-TYRCEX2L.js.map +1 -0
- package/libs/chunk-VUH3FXGJ.js +11 -0
- package/libs/chunk-VUH3FXGJ.js.map +1 -0
- package/libs/chunk-XBA562WW.js +8 -0
- package/libs/chunk-XBA562WW.js.map +1 -0
- package/libs/chunk-XTQKWY7W.cjs +32 -0
- package/libs/chunk-XTQKWY7W.cjs.map +1 -0
- package/libs/chunk-ZANSFMTD.js +9 -0
- package/libs/chunk-ZANSFMTD.js.map +1 -0
- package/libs/component-props-a8a2f97e.d.ts +38 -0
- package/libs/components/alert/alert.css +1 -1
- package/libs/components/alert/alert.css.map +1 -1
- package/libs/components/alert/alert.min.css +2 -2
- package/libs/components/badge/badge.css +1 -1
- package/libs/components/badge/badge.css.map +1 -1
- package/libs/components/badge/badge.min.css +2 -2
- package/libs/components/breadcrumbs/breadcrumb.cjs +24 -0
- package/libs/components/breadcrumbs/breadcrumb.cjs.map +1 -0
- package/libs/components/breadcrumbs/breadcrumb.d.cts +290 -0
- package/libs/components/breadcrumbs/breadcrumb.d.ts +290 -0
- package/libs/components/breadcrumbs/breadcrumb.js +5 -0
- package/libs/components/breadcrumbs/breadcrumb.js.map +1 -0
- package/libs/components/button.cjs +19 -0
- package/libs/components/button.cjs.map +1 -0
- package/libs/components/button.d.cts +16 -0
- package/libs/components/button.d.ts +16 -0
- package/libs/components/button.js +4 -0
- package/libs/components/button.js.map +1 -0
- 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/card.cjs +31 -0
- package/libs/components/card.cjs.map +1 -0
- package/libs/components/card.d.cts +302 -0
- package/libs/components/card.d.ts +302 -0
- package/libs/components/card.js +4 -0
- package/libs/components/card.js.map +1 -0
- package/libs/components/cards/card.css +1 -1
- package/libs/components/cards/card.css.map +1 -1
- package/libs/components/cards/card.min.css +2 -2
- package/libs/components/details/details.css +1 -1
- package/libs/components/details/details.css.map +1 -1
- package/libs/components/details/details.min.css +2 -2
- package/libs/components/dialog/dialog.cjs +22 -0
- package/libs/components/dialog/dialog.cjs.map +1 -0
- package/libs/components/dialog/dialog.css +1 -1
- package/libs/components/dialog/dialog.css.map +1 -1
- package/libs/components/dialog/dialog.d.cts +105 -0
- package/libs/components/dialog/dialog.d.ts +105 -0
- package/libs/components/dialog/dialog.js +7 -0
- package/libs/components/dialog/dialog.js.map +1 -0
- package/libs/components/dialog/dialog.min.css +2 -2
- package/libs/components/form/fields.cjs +19 -0
- package/libs/components/form/fields.cjs.map +1 -0
- package/libs/components/form/fields.d.cts +24 -0
- package/libs/components/form/fields.d.ts +24 -0
- package/libs/components/form/fields.js +4 -0
- package/libs/components/form/fields.js.map +1 -0
- package/libs/components/form/inputs.cjs +19 -0
- package/libs/components/form/inputs.cjs.map +1 -0
- package/libs/components/form/inputs.d.cts +2 -0
- package/libs/components/form/inputs.d.ts +2 -0
- package/libs/components/form/inputs.js +4 -0
- package/libs/components/form/inputs.js.map +1 -0
- package/libs/components/form/textarea.cjs +19 -0
- package/libs/components/form/textarea.cjs.map +1 -0
- package/libs/components/form/textarea.d.cts +29 -0
- package/libs/components/form/textarea.d.ts +29 -0
- package/libs/components/form/textarea.js +4 -0
- package/libs/components/form/textarea.js.map +1 -0
- package/libs/components/heading/heading.cjs +10 -0
- package/libs/components/heading/heading.cjs.map +1 -0
- package/libs/components/heading/heading.d.cts +3 -0
- package/libs/components/heading/heading.d.ts +3 -0
- package/libs/components/heading/heading.js +4 -0
- package/libs/components/heading/heading.js.map +1 -0
- package/libs/components/icons/icon.cjs +19 -0
- package/libs/components/icons/icon.cjs.map +1 -0
- package/libs/{icons-31ace3de.d.ts โ components/icons/icon.d.cts} +151 -61
- package/libs/components/icons/icon.d.ts +445 -0
- package/libs/components/icons/icon.js +4 -0
- package/libs/components/icons/icon.js.map +1 -0
- package/libs/components/images/img.css +1 -1
- package/libs/components/images/img.css.map +1 -1
- package/libs/components/images/img.min.css +2 -2
- package/libs/components/link/link.cjs +19 -0
- package/libs/components/link/link.cjs.map +1 -0
- package/libs/components/link/link.d.cts +19 -0
- package/libs/components/link/link.d.ts +19 -0
- package/libs/components/link/link.js +4 -0
- package/libs/components/link/link.js.map +1 -0
- package/libs/components/list/list.cjs +23 -0
- package/libs/components/list/list.cjs.map +1 -0
- package/libs/components/list/list.d.cts +39 -0
- package/libs/components/list/list.d.ts +39 -0
- package/libs/components/list/list.js +4 -0
- package/libs/components/list/list.js.map +1 -0
- package/libs/components/modal.cjs +14 -0
- package/libs/components/modal.cjs.map +1 -0
- package/libs/components/modal.d.cts +35 -0
- package/libs/components/modal.d.ts +35 -0
- package/libs/components/modal.js +5 -0
- package/libs/components/modal.js.map +1 -0
- package/libs/components/nav/nav.cjs +28 -0
- package/libs/components/nav/nav.cjs.map +1 -0
- package/libs/components/nav/nav.d.cts +44 -0
- package/libs/components/nav/nav.d.ts +44 -0
- package/libs/components/nav/nav.js +5 -0
- package/libs/components/nav/nav.js.map +1 -0
- package/libs/components/popover/popover.cjs +23 -0
- package/libs/components/popover/popover.cjs.map +1 -0
- package/libs/components/popover/popover.d.cts +40 -0
- package/libs/components/popover/popover.d.ts +40 -0
- package/libs/components/popover/popover.js +4 -0
- package/libs/components/popover/popover.js.map +1 -0
- package/libs/components/tables/table.cjs +21 -0
- package/libs/components/tables/table.cjs.map +1 -0
- package/libs/components/tables/table.d.cts +36 -0
- package/libs/components/tables/table.d.ts +36 -0
- package/libs/components/tables/table.js +4 -0
- package/libs/components/tables/table.js.map +1 -0
- package/libs/components/text/text.cjs +23 -0
- package/libs/components/text/text.cjs.map +1 -0
- package/libs/components/text/text.d.cts +30 -0
- package/libs/components/text/text.d.ts +30 -0
- package/libs/components/text/text.js +4 -0
- package/libs/components/text/text.js.map +1 -0
- package/libs/heading-3648c538.d.ts +250 -0
- package/libs/hooks.cjs +7 -0
- package/libs/hooks.d.cts +5 -0
- package/libs/hooks.d.ts +5 -0
- package/libs/hooks.js +3 -0
- package/libs/icons.cjs +3 -2
- package/libs/icons.d.cts +3 -1
- package/libs/icons.d.ts +3 -1
- package/libs/icons.js +2 -1
- package/libs/index.cjs +174 -62
- package/libs/index.cjs.map +1 -1
- package/libs/index.css +1 -1
- package/libs/index.css.map +1 -1
- package/libs/index.d.cts +529 -446
- package/libs/index.d.ts +529 -446
- package/libs/index.js +36 -7
- package/libs/index.js.map +1 -1
- package/libs/inputs-f3a216db.d.ts +45 -0
- package/libs/ui-645f95b5.d.ts +285 -0
- package/package.json +2 -2
- package/src/components/README-UI.mdx +416 -0
- package/src/components/alert/ACCESSIBILITY.md +319 -0
- package/src/components/alert/README.mdx +475 -19
- package/src/components/alert/alert.scss +113 -6
- package/src/components/alert/alert.stories.tsx +372 -0
- package/src/components/alert/alert.test.tsx +762 -0
- package/src/components/alert/alert.tsx +331 -66
- package/src/components/alert/views/alert-actions.tsx +13 -0
- package/src/components/alert/views/alert-content.tsx +17 -0
- package/src/components/alert/views/alert-icon.tsx +53 -0
- package/src/components/alert/views/alert-screen-reader-text.tsx +30 -0
- package/src/components/alert/views/alert-title.tsx +23 -0
- package/src/components/alert/views/alert-view.tsx +158 -0
- package/src/components/alert/views/index.ts +12 -0
- package/src/components/badge/badge.mdx +186 -49
- package/src/components/badge/badge.scss +20 -2
- package/src/components/badge/badge.stories.tsx +160 -14
- package/src/components/badge/badge.test.tsx +179 -0
- package/src/components/badge/badge.tsx +97 -4
- package/src/components/breadcrumbs/README.mdx +364 -45
- package/src/components/breadcrumbs/__snapshots__/breadcrumb.test.tsx.snap +152 -0
- package/src/components/breadcrumbs/breadcrumb.stories.tsx +7 -3
- package/src/components/breadcrumbs/breadcrumb.test.tsx +490 -0
- package/src/components/breadcrumbs/breadcrumb.tsx +427 -170
- package/src/components/button.ts +2 -0
- package/src/components/buttons/button.scss +34 -31
- package/src/components/buttons/button.stories.tsx +35 -0
- package/src/components/card.ts +2 -0
- package/src/components/cards/README.mdx +657 -0
- package/src/components/cards/card.scss +22 -0
- package/src/components/cards/card.stories.tsx +167 -5
- package/src/components/cards/card.test.tsx +360 -20
- package/src/components/cards/card.tsx +200 -79
- package/src/components/cards/card.types.ts +135 -0
- package/src/components/cards/card.utils.ts +79 -0
- package/src/components/details/ACCESSIBILITY-REVIEW-LIVE.md +1050 -0
- package/src/components/details/ACCESSIBILITY-REVIEW.md +502 -0
- package/src/components/details/README.mdx +437 -69
- package/src/components/details/details.scss +16 -0
- package/src/components/details/details.test.tsx +385 -0
- package/src/components/details/details.tsx +101 -69
- package/src/components/details/details.types.ts +76 -0
- package/src/components/dialog/README.mdx +513 -110
- package/src/components/dialog/dialog-modal.tsx +79 -56
- package/src/components/dialog/dialog.scss +53 -3
- package/src/components/dialog/dialog.stories.tsx +10 -7
- package/src/components/dialog/dialog.test.tsx +450 -0
- package/src/components/dialog/dialog.tsx +69 -59
- package/src/components/dialog/dialog.types.ts +133 -0
- package/src/components/dialog/views/dialog-footer.tsx +54 -11
- package/src/components/dialog/views/dialog-header.tsx +20 -15
- package/src/components/heading/heading.stories.tsx +44 -4
- package/src/components/heading/heading.tsx +89 -23
- package/src/components/icons/README.mdx +332 -0
- package/src/components/icons/icon.stories.tsx +74 -1
- package/src/components/icons/icon.tsx +89 -1
- package/src/components/icons/types.ts +47 -0
- package/src/components/images/README.mdx +340 -24
- package/src/components/images/img.scss +19 -3
- package/src/components/images/img.stories.tsx +424 -15
- package/src/components/images/img.test.tsx +354 -25
- package/src/components/images/img.tsx +186 -63
- package/src/components/images/img.types.ts +211 -0
- package/src/components/modal.ts +1 -0
- package/src/components/title/MIGRATION.md +199 -0
- package/src/components/title/README.md +326 -0
- package/src/components/title/README.mdx +452 -0
- package/src/components/title/title.stories.tsx +393 -0
- package/src/components/title/title.test.tsx +251 -0
- package/src/components/title/title.tsx +219 -0
- package/src/components/ui.stories.tsx +894 -0
- package/src/components/ui.test.tsx +559 -0
- package/src/components/ui.tsx +266 -15
- package/src/components/word-count/README.md +240 -0
- package/src/hooks.ts +1 -0
- package/src/index.ts +51 -19
- package/src/sass/_properties.scss +1 -0
- package/src/styles/alert/alert.css +94 -4
- package/src/styles/alert/alert.css.map +1 -1
- package/src/styles/badge/badge.css +20 -2
- package/src/styles/badge/badge.css.map +1 -1
- package/src/styles/buttons/button.css +31 -31
- package/src/styles/buttons/button.css.map +1 -1
- package/src/styles/cards/card.css +16 -0
- package/src/styles/cards/card.css.map +1 -1
- package/src/styles/details/details.css +19 -0
- package/src/styles/details/details.css.map +1 -1
- package/src/styles/dialog/dialog.css +43 -2
- package/src/styles/dialog/dialog.css.map +1 -1
- package/src/styles/images/img.css +15 -3
- package/src/styles/images/img.css.map +1 -1
- package/src/styles/index.css +240 -43
- package/src/styles/index.css.map +1 -1
- package/src/test/setup.d.ts +9 -0
- package/src/test/setup.ts +53 -1
- package/libs/chunk-PWVRDQ3R.js +0 -8
- package/libs/chunk-PWVRDQ3R.js.map +0 -1
- package/libs/chunk-SVS4MX3U.cjs +0 -31
- package/libs/chunk-SVS4MX3U.cjs.map +0 -1
- package/src/components/cards/README.md +0 -80
- package/src/components/dialog/hooks/useClickOutside.ts +0 -33
package/README.md
CHANGED
|
@@ -1,37 +1,533 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @fpkit/acss
|
|
2
2
|
|
|
3
|
-
A lightweight React
|
|
3
|
+
A lightweight React UI library for building modern and accessible components that leverage CSS custom properties for reactive styles. Built with TypeScript and designed for optimal tree-shaking and bundle size optimization.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://badge.fury.io/js/@fpkit%2Facss)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
[๐ **Storybook Documentation**](https://fpkit.netlify.app/?path=/story/guides-introduction--page) | [๐ฏ **Component Playground**](https://fpkit.netlify.app/)
|
|
9
|
+
|
|
10
|
+
## โจ Features
|
|
11
|
+
|
|
12
|
+
- **๐ฏ Dual Export Strategy**: Choose between convenience (barrel exports) or optimization (individual imports)
|
|
13
|
+
- **๐ฆ Tree-Shakable**: Import only the components you need
|
|
14
|
+
- **โฟ Accessible**: Built with accessibility best practices
|
|
15
|
+
- **๐จ CSS Custom Properties**: Reactive styling with CSS variables
|
|
16
|
+
- **๐ฑ Responsive**: Mobile-first design approach
|
|
17
|
+
- **โก TypeScript**: Full type safety and excellent DX
|
|
18
|
+
- **๐ง Headless**: Minimal styling, maximum customization
|
|
19
|
+
|
|
20
|
+
## โฟ Accessibility
|
|
21
|
+
|
|
22
|
+
FPKit is built with accessibility as a core principle, following WCAG 2.1 AA standards. All components support ARIA attributes and provide guidance for creating accessible applications.
|
|
23
|
+
|
|
24
|
+
### Accessibility Features
|
|
25
|
+
|
|
26
|
+
- **Semantic HTML** - Components use appropriate semantic elements by default
|
|
27
|
+
- **ARIA Support** - Full support for ARIA attributes on all components
|
|
28
|
+
- **Keyboard Navigation** - All interactive elements are keyboard accessible
|
|
29
|
+
- **Screen Reader Friendly** - Proper labeling and announcements for assistive technologies
|
|
30
|
+
- **Focus Management** - Visible focus indicators and programmatic focus control
|
|
31
|
+
|
|
32
|
+
### Testing for Accessibility
|
|
33
|
+
|
|
34
|
+
We recommend the following tools for testing accessibility in your applications:
|
|
35
|
+
|
|
36
|
+
#### Automated Testing
|
|
6
37
|
|
|
7
38
|
```bash
|
|
8
|
-
|
|
39
|
+
# Install recommended packages
|
|
40
|
+
npm install --save-dev eslint-plugin-jsx-a11y jest-axe @testing-library/react
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**ESLint Plugin** - Catch accessibility issues during development:
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
// .eslintrc.js
|
|
47
|
+
{
|
|
48
|
+
"extends": ["plugin:jsx-a11y/recommended"],
|
|
49
|
+
"plugins": ["jsx-a11y"]
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**jest-axe** - Automated accessibility testing in unit tests:
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import { render } from '@testing-library/react';
|
|
57
|
+
import { axe, toHaveNoViolations } from 'jest-axe';
|
|
58
|
+
import { Button } from '@fpkit/acss/button';
|
|
59
|
+
|
|
60
|
+
expect.extend(toHaveNoViolations);
|
|
61
|
+
|
|
62
|
+
test('Button should have no accessibility violations', async () => {
|
|
63
|
+
const { container } = render(
|
|
64
|
+
<Button type="button" aria-label="Submit form">
|
|
65
|
+
Submit
|
|
66
|
+
</Button>
|
|
67
|
+
);
|
|
68
|
+
const results = await axe(container);
|
|
69
|
+
expect(results).toHaveNoViolations();
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### Manual Testing Checklist
|
|
74
|
+
|
|
75
|
+
When building components with FPKit, verify:
|
|
76
|
+
|
|
77
|
+
- [ ] **Keyboard Navigation** - All interactive elements are reachable and operable via keyboard
|
|
78
|
+
- [ ] **Screen Reader** - Test with VoiceOver (macOS), NVDA (Windows), or JAWS
|
|
79
|
+
- [ ] **Focus Indicators** - Visible focus states meet 3:1 contrast ratio (WCAG 2.4.7)
|
|
80
|
+
- [ ] **Accessible Names** - All interactive elements have accessible names (via text, `aria-label`, or `aria-labelledby`)
|
|
81
|
+
- [ ] **Color Contrast** - Text meets 4.5:1 contrast ratio for normal text, 3:1 for large text
|
|
82
|
+
- [ ] **Semantic Structure** - Proper heading hierarchy and landmark regions
|
|
83
|
+
|
|
84
|
+
### UI Component Accessibility
|
|
85
|
+
|
|
86
|
+
The foundational [UI component](https://fpkit.netlify.app/?path=/story/fp-ui--accessible-interactive-elements) demonstrates best practices:
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import { UI } from '@fpkit/acss';
|
|
90
|
+
|
|
91
|
+
// โ
Good: Accessible button with aria-label
|
|
92
|
+
<UI as="button" aria-label="Close dialog" onClick={handleClose}>
|
|
93
|
+
<CloseIcon />
|
|
94
|
+
</UI>
|
|
95
|
+
|
|
96
|
+
// โ
Good: Semantic link with descriptive text
|
|
97
|
+
<UI as="a" href="/products">
|
|
98
|
+
View all products
|
|
99
|
+
</UI>
|
|
100
|
+
|
|
101
|
+
// โ Bad: Button without accessible name
|
|
102
|
+
<UI as="button" onClick={handleClose}>
|
|
103
|
+
<CloseIcon />
|
|
104
|
+
</UI>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
See the [UI component Storybook stories](https://fpkit.netlify.app/?path=/story/fp-ui--accessibility-patterns) for more examples and anti-patterns to avoid.
|
|
108
|
+
|
|
109
|
+
## ๐ฆ Installation
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm install @fpkit/acss
|
|
113
|
+
# or
|
|
114
|
+
yarn add @fpkit/acss
|
|
115
|
+
# or
|
|
116
|
+
pnpm add @fpkit/acss
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## ๐ Quick Start
|
|
120
|
+
|
|
121
|
+
### Option 1: Barrel Imports (Convenience)
|
|
122
|
+
|
|
123
|
+
Perfect for rapid prototyping and when bundle size isn't critical:
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
import { Button, Card, Input, Modal } from '@fpkit/acss';
|
|
127
|
+
import '@fpkit/acss/styles';
|
|
128
|
+
|
|
129
|
+
function App() {
|
|
130
|
+
return (
|
|
131
|
+
<div>
|
|
132
|
+
<Card>
|
|
133
|
+
<Card.Title>Welcome to FPKit</Card.Title>
|
|
134
|
+
<Card.Content>
|
|
135
|
+
<Input type="text" placeholder="Enter your name" />
|
|
136
|
+
<Button type="button">Submit</Button>
|
|
137
|
+
</Card.Content>
|
|
138
|
+
</Card>
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
9
142
|
```
|
|
10
143
|
|
|
11
|
-
###
|
|
144
|
+
### Option 2: Individual Imports (Tree-Shaking)
|
|
12
145
|
|
|
13
|
-
|
|
14
|
-
import { FP, Badge } from @fpkit/fp
|
|
146
|
+
Optimal for production builds and bundle size optimization:
|
|
15
147
|
|
|
16
|
-
|
|
148
|
+
```tsx
|
|
149
|
+
import { Button } from '@fpkit/acss/button';
|
|
150
|
+
import { Card } from '@fpkit/acss/card';
|
|
151
|
+
import { Input } from '@fpkit/acss/input';
|
|
152
|
+
import '@fpkit/acss/styles';
|
|
153
|
+
|
|
154
|
+
function App() {
|
|
17
155
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
156
|
+
<div>
|
|
157
|
+
<Card>
|
|
158
|
+
<Card.Title>Welcome to FPKit</Card.Title>
|
|
159
|
+
<Card.Content>
|
|
160
|
+
<Input type="text" placeholder="Enter your name" />
|
|
161
|
+
<Button type="button">Submit</Button>
|
|
162
|
+
</Card.Content>
|
|
163
|
+
</Card>
|
|
164
|
+
</div>
|
|
165
|
+
);
|
|
23
166
|
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## ๐งฉ Core Components
|
|
170
|
+
|
|
171
|
+
### Button
|
|
172
|
+
|
|
173
|
+
Accessible button component with multiple variants:
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
// Barrel import
|
|
177
|
+
import { Button } from '@fpkit/acss';
|
|
178
|
+
|
|
179
|
+
// Individual import
|
|
180
|
+
import { Button } from '@fpkit/acss/button';
|
|
181
|
+
|
|
182
|
+
// Usage
|
|
183
|
+
<Button type="button" onClick={() => console.log('clicked')}>
|
|
184
|
+
Click me
|
|
185
|
+
</Button>
|
|
186
|
+
|
|
187
|
+
// With TypeScript
|
|
188
|
+
import { Button, type ButtonProps } from '@fpkit/acss/button';
|
|
189
|
+
|
|
190
|
+
const buttonProps: ButtonProps = {
|
|
191
|
+
type: 'submit',
|
|
192
|
+
disabled: false,
|
|
193
|
+
children: 'Submit Form'
|
|
194
|
+
};
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Card
|
|
198
|
+
|
|
199
|
+
Flexible card component with composable parts:
|
|
200
|
+
|
|
201
|
+
```tsx
|
|
202
|
+
// Individual import
|
|
203
|
+
import { Card } from '@fpkit/acss/card';
|
|
204
|
+
|
|
205
|
+
// Usage
|
|
206
|
+
<Card>
|
|
207
|
+
<Card.Title>Card Title</Card.Title>
|
|
208
|
+
<Card.Content>
|
|
209
|
+
<p>This is the card content area.</p>
|
|
210
|
+
</Card.Content>
|
|
211
|
+
<Card.Footer>
|
|
212
|
+
<Button type="button">Action</Button>
|
|
213
|
+
</Card.Footer>
|
|
214
|
+
</Card>
|
|
215
|
+
|
|
216
|
+
// Custom styling
|
|
217
|
+
<Card classes="custom-card" styles={{ padding: '2rem' }}>
|
|
218
|
+
<Card.Title>Styled Card</Card.Title>
|
|
219
|
+
<Card.Content>Content with custom styling</Card.Content>
|
|
220
|
+
</Card>
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Modal
|
|
224
|
+
|
|
225
|
+
Accessible modal dialog with focus management:
|
|
226
|
+
|
|
227
|
+
```tsx
|
|
228
|
+
import { Modal } from '@fpkit/acss/modal';
|
|
229
|
+
|
|
230
|
+
<Modal
|
|
231
|
+
openChild="Open Modal"
|
|
232
|
+
closeChild="Close"
|
|
233
|
+
modalHeader={<h2>Modal Title</h2>}
|
|
234
|
+
modalFooter={
|
|
235
|
+
<div>
|
|
236
|
+
<Button type="button">Cancel</Button>
|
|
237
|
+
<Button type="button">Confirm</Button>
|
|
238
|
+
</div>
|
|
239
|
+
}
|
|
240
|
+
>
|
|
241
|
+
<p>Modal content goes here.</p>
|
|
242
|
+
</Modal>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Input
|
|
246
|
+
|
|
247
|
+
Form input component with validation support:
|
|
248
|
+
|
|
249
|
+
```tsx
|
|
250
|
+
import { Input } from '@fpkit/acss/input';
|
|
251
|
+
|
|
252
|
+
<Input
|
|
253
|
+
type="email"
|
|
254
|
+
placeholder="Enter your email"
|
|
255
|
+
required
|
|
256
|
+
aria-label="Email address"
|
|
257
|
+
/>
|
|
258
|
+
|
|
259
|
+
// With field wrapper
|
|
260
|
+
import { Field } from '@fpkit/acss';
|
|
261
|
+
|
|
262
|
+
<Field>
|
|
263
|
+
<Field.Label>Email Address</Field.Label>
|
|
264
|
+
<Input type="email" placeholder="you@example.com" />
|
|
265
|
+
<Field.Error>Please enter a valid email</Field.Error>
|
|
266
|
+
</Field>
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Navigation
|
|
270
|
+
|
|
271
|
+
Semantic navigation components:
|
|
272
|
+
|
|
273
|
+
```tsx
|
|
274
|
+
import { Nav, NavList, NavItem } from '@fpkit/acss';
|
|
24
275
|
|
|
25
|
-
|
|
276
|
+
<Nav>
|
|
277
|
+
<NavList>
|
|
278
|
+
<NavItem>
|
|
279
|
+
<Link href="/">Home</Link>
|
|
280
|
+
</NavItem>
|
|
281
|
+
<NavItem>
|
|
282
|
+
<Link href="/about">About</Link>
|
|
283
|
+
</NavItem>
|
|
284
|
+
<NavItem>
|
|
285
|
+
<Link href="/contact">Contact</Link>
|
|
286
|
+
</NavItem>
|
|
287
|
+
</NavList>
|
|
288
|
+
</Nav>
|
|
26
289
|
```
|
|
27
290
|
|
|
28
|
-
###
|
|
291
|
+
### Text & Typography
|
|
292
|
+
|
|
293
|
+
Semantic text components:
|
|
294
|
+
|
|
295
|
+
```tsx
|
|
296
|
+
import { Text, Heading } from '@fpkit/acss';
|
|
297
|
+
|
|
298
|
+
<Heading as="h1" size="xl">
|
|
299
|
+
Page Title
|
|
300
|
+
</Heading>
|
|
301
|
+
|
|
302
|
+
<Text as="p" size="lg">
|
|
303
|
+
This is a paragraph with large text.
|
|
304
|
+
</Text>
|
|
305
|
+
|
|
306
|
+
<Text as="span" variant="muted">
|
|
307
|
+
Muted text for secondary information.
|
|
308
|
+
</Text>
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## ๐จ Styling & Theming
|
|
312
|
+
|
|
313
|
+
FPKit uses CSS custom properties for theming and styling:
|
|
314
|
+
|
|
315
|
+
```css
|
|
316
|
+
/* Global theme variables */
|
|
317
|
+
:root {
|
|
318
|
+
--fp-color-primary: #007bff;
|
|
319
|
+
--fp-color-secondary: #6c757d;
|
|
320
|
+
--fp-spacing-sm: 0.5rem;
|
|
321
|
+
--fp-spacing-md: 1rem;
|
|
322
|
+
--fp-spacing-lg: 1.5rem;
|
|
323
|
+
--fp-border-radius: 0.375rem;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/* Component-specific styling */
|
|
327
|
+
.custom-button {
|
|
328
|
+
--fp-button-bg: var(--fp-color-primary);
|
|
329
|
+
--fp-button-color: white;
|
|
330
|
+
--fp-button-padding: var(--fp-spacing-md);
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Component Styling
|
|
335
|
+
|
|
336
|
+
```tsx
|
|
337
|
+
// Inline styles
|
|
338
|
+
<Button styles={{ backgroundColor: 'red', color: 'white' }}>
|
|
339
|
+
Styled Button
|
|
340
|
+
</Button>
|
|
341
|
+
|
|
342
|
+
// CSS classes
|
|
343
|
+
<Card classes="shadow-lg border-rounded">
|
|
344
|
+
<Card.Content>Styled card</Card.Content>
|
|
345
|
+
</Card>
|
|
346
|
+
|
|
347
|
+
// Data attributes for CSS targeting
|
|
348
|
+
<Button data-variant="primary" data-size="large">
|
|
349
|
+
Data Attribute Styling
|
|
350
|
+
</Button>
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
## ๐ ๏ธ Framework Integration
|
|
354
|
+
|
|
355
|
+
### Next.js
|
|
356
|
+
|
|
357
|
+
```tsx
|
|
358
|
+
// pages/_app.tsx
|
|
359
|
+
import '@fpkit/acss/styles';
|
|
360
|
+
import type { AppProps } from 'next/app';
|
|
361
|
+
|
|
362
|
+
export default function App({ Component, pageProps }: AppProps) {
|
|
363
|
+
return <Component {...pageProps} />;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// pages/index.tsx
|
|
367
|
+
import { Button } from '@fpkit/acss/button';
|
|
368
|
+
import { Card } from '@fpkit/acss/card';
|
|
369
|
+
|
|
370
|
+
export default function Home() {
|
|
371
|
+
return (
|
|
372
|
+
<main>
|
|
373
|
+
<Card>
|
|
374
|
+
<Card.Title>Next.js + FPKit</Card.Title>
|
|
375
|
+
<Card.Content>
|
|
376
|
+
<Button type="button">Get Started</Button>
|
|
377
|
+
</Card.Content>
|
|
378
|
+
</Card>
|
|
379
|
+
</main>
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Vite + React
|
|
385
|
+
|
|
386
|
+
```tsx
|
|
387
|
+
// main.tsx
|
|
388
|
+
import React from 'react';
|
|
389
|
+
import ReactDOM from 'react-dom/client';
|
|
390
|
+
import '@fpkit/acss/styles';
|
|
391
|
+
import App from './App.tsx';
|
|
392
|
+
|
|
393
|
+
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
394
|
+
<React.StrictMode>
|
|
395
|
+
<App />
|
|
396
|
+
</React.StrictMode>,
|
|
397
|
+
);
|
|
398
|
+
|
|
399
|
+
// App.tsx
|
|
400
|
+
import { Button, Card } from '@fpkit/acss';
|
|
401
|
+
|
|
402
|
+
function App() {
|
|
403
|
+
return (
|
|
404
|
+
<Card>
|
|
405
|
+
<Card.Title>Vite + React + FPKit</Card.Title>
|
|
406
|
+
<Card.Content>
|
|
407
|
+
<Button type="button">Hello World</Button>
|
|
408
|
+
</Card.Content>
|
|
409
|
+
</Card>
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
export default App;
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
## ๐ Available Components
|
|
417
|
+
|
|
418
|
+
### Core UI Components
|
|
419
|
+
|
|
420
|
+
- **Button** - Accessible button with variants
|
|
421
|
+
- **Card** - Flexible card container with composable parts
|
|
422
|
+
- **Modal** - Accessible modal dialog
|
|
423
|
+
- **Dialog** - General purpose dialog component
|
|
424
|
+
- **Input** - Form input with validation
|
|
425
|
+
- **Field** - Form field wrapper with label and error
|
|
426
|
+
- **Link** - Accessible link component
|
|
427
|
+
- **List** - Semantic list components
|
|
428
|
+
|
|
429
|
+
### Layout Components
|
|
430
|
+
|
|
431
|
+
- **Box** - Generic container component
|
|
432
|
+
- **Nav** - Navigation components
|
|
433
|
+
- **Landmarks** - Semantic landmark components
|
|
434
|
+
|
|
435
|
+
### Typography
|
|
436
|
+
|
|
437
|
+
- **Text** - Semantic text component
|
|
438
|
+
- **Heading** - Heading component with sizes
|
|
439
|
+
|
|
440
|
+
### Media
|
|
441
|
+
|
|
442
|
+
- **Icon** - SVG icon component
|
|
443
|
+
- **Image** - Responsive image component
|
|
444
|
+
|
|
445
|
+
### Data Display
|
|
446
|
+
|
|
447
|
+
- **Table** - Accessible table components
|
|
448
|
+
- **Tag** - Tag/badge component
|
|
449
|
+
- **Badge** - Status badge component
|
|
450
|
+
|
|
451
|
+
### Specialized
|
|
452
|
+
|
|
453
|
+
- **TextToSpeech** - Text-to-speech component
|
|
454
|
+
- **Popover** - Popover/tooltip component
|
|
455
|
+
- **Breadcrumb** - Navigation breadcrumbs
|
|
456
|
+
|
|
457
|
+
## ๐ฏ Import Strategies
|
|
458
|
+
|
|
459
|
+
### When to Use Barrel Imports
|
|
460
|
+
|
|
461
|
+
- Rapid prototyping
|
|
462
|
+
- Small applications
|
|
463
|
+
- When using many components
|
|
464
|
+
- Development/testing environments
|
|
465
|
+
|
|
466
|
+
### When to Use Individual Imports
|
|
467
|
+
|
|
468
|
+
- Production applications
|
|
469
|
+
- Performance-critical apps
|
|
470
|
+
- When using few components
|
|
471
|
+
- Library/package development
|
|
472
|
+
|
|
473
|
+
### Bundle Size Comparison
|
|
474
|
+
|
|
475
|
+
```bash
|
|
476
|
+
# Barrel import (all components)
|
|
477
|
+
import { Button, Card, Modal } from '@fpkit/acss';
|
|
478
|
+
# Bundle size: ~45KB (example)
|
|
479
|
+
|
|
480
|
+
# Individual imports (tree-shaken)
|
|
481
|
+
import { Button } from '@fpkit/acss/button';
|
|
482
|
+
import { Card } from '@fpkit/acss/card';
|
|
483
|
+
import { Modal } from '@fpkit/acss/modal';
|
|
484
|
+
# Bundle size: ~12KB (example)
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
## ๐ง TypeScript Support
|
|
488
|
+
|
|
489
|
+
Full TypeScript support with comprehensive type definitions:
|
|
490
|
+
|
|
491
|
+
```tsx
|
|
492
|
+
import { Button, type ButtonProps } from '@fpkit/acss/button';
|
|
493
|
+
import { Card, type CardProps } from '@fpkit/acss/card';
|
|
494
|
+
|
|
495
|
+
// Type-safe props
|
|
496
|
+
const buttonProps: ButtonProps = {
|
|
497
|
+
type: 'button',
|
|
498
|
+
onClick: (e) => console.log(e),
|
|
499
|
+
children: 'Click me'
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
// Component with proper typing
|
|
503
|
+
const MyButton: React.FC<ButtonProps> = (props) => {
|
|
504
|
+
return <Button {...props} />;
|
|
505
|
+
};
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
## ๐งช Testing
|
|
509
|
+
|
|
510
|
+
Components are designed for easy testing:
|
|
511
|
+
|
|
512
|
+
```tsx
|
|
513
|
+
import { render, screen } from '@testing-library/react';
|
|
514
|
+
import { Button } from '@fpkit/acss/button';
|
|
515
|
+
|
|
516
|
+
test('renders button with text', () => {
|
|
517
|
+
render(<Button type="button">Click me</Button>);
|
|
518
|
+
expect(screen.getByRole('button', { name: /click me/i })).toBeInTheDocument();
|
|
519
|
+
});
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
## ๐ค Contributing
|
|
523
|
+
|
|
524
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
29
525
|
|
|
30
|
-
|
|
526
|
+
## ๐ License
|
|
31
527
|
|
|
32
528
|
MIT License
|
|
33
529
|
|
|
34
|
-
Copyright (c)
|
|
530
|
+
Copyright (c) 2024 Shawn Sandy
|
|
35
531
|
|
|
36
532
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
37
533
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -45,7 +541,7 @@ copies or substantial portions of the Software.
|
|
|
45
541
|
|
|
46
542
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
47
543
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
48
|
-
FITNESS FOR A PARTICULAR PURPOSE AND
|
|
544
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
49
545
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
50
546
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
51
547
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { b } from './chunk-GCGKYLDG.js';
|
|
2
|
+
import e from 'react';
|
|
3
|
+
|
|
4
|
+
var P={display:"block",position:"absolute",background:"#000",border:"1px solid #010101",padding:"10px",color:"#fff",transition:"opacity .5s ease-in-out"},o=({children:n,popoverTrigger:l,styles:a,...d})=>{let t=e.useRef(null),r=e.useRef(null),{isVisible:p,popoverPosition:s,handlePointerEvent:v,handlePointerLeave:c}=b(t,r),f={opacity:p?1:0,top:s.top,left:s.left,zIndex:999};return e.createElement(e.Fragment,null,e.createElement("div",{ref:t,onPointerEnter:v,onPointerLeave:c,...d},l),p&&e.createElement("div",{ref:r,style:{...f,...a}},n))},x=o;o.displayName="Popover";o.styles=P;
|
|
5
|
+
|
|
6
|
+
export { P as a, o as b, x as c };
|
|
7
|
+
//# sourceMappingURL=out.js.map
|
|
8
|
+
//# sourceMappingURL=chunk-23ANBDCR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/popover/popover.tsx"],"names":["React","defaultStyles","Popover","children","popoverTrigger","styles","props","hoverRef","popOverRef","isVisible","popoverPosition","handlePointerEvent","handlePointerLeave","use_popover_default","popoverStyles","popover_default"],"mappings":"wCAAA,OAAOA,MAAW,QAeX,IAAMC,EAAgB,CAC3B,QAAS,QACT,SAAU,WACV,WAAY,OACZ,OAAQ,oBACR,QAAS,OACT,MAAO,OACP,WAAY,yBACd,EAsBaC,EAAU,CAAC,CACtB,SAAAC,EACA,eAAAC,EACA,OAAAC,EACA,GAAGC,CACL,IAAiC,CAC/B,IAAMC,EAAWP,EAAM,OAAO,IAAI,EAC5BQ,EAAaR,EAAM,OAAO,IAAI,EAC9B,CAAE,UAAAS,EAAW,gBAAAC,EAAiB,mBAAAC,EAAoB,mBAAAC,CAAmB,EACzEC,EAAWN,EAAUC,CAAU,EAC3BM,EAAgB,CACpB,QAASL,EAAY,EAAI,EACzB,IAAKC,EAAgB,IACrB,KAAMA,EAAgB,KAEtB,OAAQ,GACV,EAEA,OACEV,EAAA,cAAAA,EAAA,cACEA,EAAA,cAAC,OACC,IAAKO,EACL,eAAgBI,EAChB,eAAgBC,EACf,GAAGN,GAEHF,CACH,EACCK,GACCT,EAAA,cAAC,OAAI,IAAKQ,EAAY,MAAO,CAAE,GAAGM,EAAe,GAAGT,CAAO,GACxDF,CACH,CAEJ,CAEJ,EAEOY,EAAQb,EACfA,EAAQ,YAAc,UACtBA,EAAQ,OAASD","sourcesContent":["import React from 'react'\nimport usePopover from '#hooks/popover/use-popover'\n\n/**\n * Interface for props accepted by the Popover component\n *\n * @property {ReactNode} children - The content to show in the popover\n * @property {ReactNode} [content] - Optional alternative content for popover\n */\nexport type PopoverProps = {\n children: React.ReactNode\n popoverTrigger: React.ReactNode\n styles?: {}\n}\n\nexport const defaultStyles = {\n display: 'block',\n position: 'absolute',\n background: '#000',\n border: '1px solid #010101',\n padding: '10px',\n color: '#fff',\n transition: 'opacity .5s ease-in-out',\n} as React.CSSProperties\n\n/**\n * Popover component to display popover content.\n *\n * @param props - The props for the component\n * @param props.children - The content to show in the popover\n * @param props.popoverTrigger - The element that triggers the popover on hover\n *\n * @returns JSX.Element - The rendered JSX element for the Popover\n * @example - <Popover popoverTrigger={<button>Hover here</button>}>Popover content</Popover>\n *\n * The component uses the usePopover hook to handle popover visibility and positioning.\n *\n * It renders the triggerElement, and conditionally renders the popover content\n * positioned absolutely when visible.\n *\n * Inline styles handle visuals like background, border, padding, etc.\n *\n * Transforms and opacity animate the enter/exit transition of the popover.\n */\n\nexport const Popover = ({\n children,\n popoverTrigger,\n styles,\n ...props\n}: PopoverProps): JSX.Element => {\n const hoverRef = React.useRef(null)\n const popOverRef = React.useRef(null)\n const { isVisible, popoverPosition, handlePointerEvent, handlePointerLeave } =\n usePopover(hoverRef, popOverRef)\n const popoverStyles = {\n opacity: isVisible ? 1 : 0,\n top: popoverPosition.top,\n left: popoverPosition.left,\n // transform: `translateY(${isVisible ? '0px' : '-50px'})`,\n zIndex: 999,\n } as React.CSSProperties\n\n return (\n <>\n <div\n ref={hoverRef}\n onPointerEnter={handlePointerEvent}\n onPointerLeave={handlePointerLeave}\n {...props}\n >\n {popoverTrigger}\n </div>\n {isVisible && (\n <div ref={popOverRef} style={{ ...popoverStyles, ...styles }}>\n {children}\n </div>\n )}\n </>\n )\n}\n\nexport default Popover\nPopover.displayName = 'Popover'\nPopover.styles = defaultStyles\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkXTQKWY7W_cjs = require('./chunk-XTQKWY7W.cjs');
|
|
4
|
+
var chunkL75OQKEI_cjs = require('./chunk-L75OQKEI.cjs');
|
|
5
|
+
var r = require('react');
|
|
6
|
+
|
|
7
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
|
|
9
|
+
var r__default = /*#__PURE__*/_interopDefault(r);
|
|
10
|
+
|
|
11
|
+
var n=({isBlock:t,children:o,...s})=>r__default.default.createElement(chunkXTQKWY7W_cjs.c,{type:"ul",...s,"data-list":`unstyled ${t?"block":""}`},o),L=({id:t,styles:o,classes:s,children:i,...m})=>r__default.default.createElement(chunkXTQKWY7W_cjs.c.ListItem,{type:"li",id:t,classes:s,styles:o,...m},i),e=({children:t,...o})=>r__default.default.createElement(chunkL75OQKEI_cjs.a,{as:"nav",...o},t),N=e;e.displayName="Nav";e.List=n;e.Item=L;
|
|
12
|
+
|
|
13
|
+
exports.a = n;
|
|
14
|
+
exports.b = L;
|
|
15
|
+
exports.c = e;
|
|
16
|
+
exports.d = N;
|
|
17
|
+
//# sourceMappingURL=out.js.map
|
|
18
|
+
//# sourceMappingURL=chunk-2LTJ7HHX.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/nav/nav.tsx"],"names":["React","NavList","isBlock","children","props","list_default","NavItem","id","styles","classes","Nav","ui_default","nav_default"],"mappings":"6EAEA,OAAOA,MAAW,QAgBX,IAAMC,EAAU,CAAC,CAAE,QAAAC,EAAS,SAAAC,EAAU,GAAGC,CAAM,IAElDJ,EAAA,cAACK,EAAA,CAAK,KAAK,KAAM,GAAGD,EAAO,YAAW,YAAYF,EAAU,QAAU,EAAE,IACrEC,CACH,EAeSG,EAAU,CAAC,CACtB,GAAAC,EACA,OAAAC,EACA,QAAAC,EACA,SAAAN,EACA,GAAGC,CACL,IAEIJ,EAAA,cAACK,EAAK,SAAL,CACC,KAAK,KACL,GAAIE,EACJ,QAASE,EACT,OAAQD,EACP,GAAGJ,GAEHD,CACH,EAWSO,EAAM,CAAC,CAAE,SAAAP,EAAU,GAAGC,CAAM,IAErCJ,EAAA,cAACW,EAAA,CAAG,GAAG,MAAO,GAAGP,GACdD,CACH,EAIGS,EAAQF,EACfA,EAAI,YAAc,MAClBA,EAAI,KAAOT,EACXS,EAAI,KAAOJ","sourcesContent":["import UI from '../ui'\nimport List from '../list/list'\nimport React from 'react'\n\nexport type NavListProps = React.ComponentProps<typeof List> & {\n isBlock?: boolean\n}\nexport type NavItemProps = React.ComponentProps<typeof List.ListItem>\n\nexport type NavProps = React.ComponentProps<typeof UI>\n\n/**\n * Renders a NavList component.\n * @param {Object} props - The props for the component.\n * @param {ReactNode} props.children - The child elements.\n * @param {Object} props - Additional props to spread to the List component.\n * @returns {JSX.Element} The rendered NavList component.\n */\nexport const NavList = ({ isBlock, children, ...props }: NavListProps) => {\n return (\n <List type=\"ul\" {...props} data-list={`unstyled ${isBlock ? 'block' : ''}`}>\n {children}\n </List>\n )\n}\n\n/**\n * Renders a NavItem component.\n * @param {Object} props - The props for the component.\n * @param {string} [props.id] - The id for the component.\n * @param {Object} [props.styles] - The styles for the component.\n * @param {string} [props.classes] - The classes for the component.\n * @param {ReactNode} props.children - The child elements.\n * @param {boolean} [props.inline=true] - Whether the item should display inline.\n * @param {Object} props - Additional props to spread to the ListItem component.\n * @returns {JSX.Element} The rendered NavItem component.\n */\nexport const NavItem = ({\n id,\n styles,\n classes,\n children,\n ...props\n}: NavItemProps) => {\n return (\n <List.ListItem\n type=\"li\"\n id={id}\n classes={classes}\n styles={styles}\n {...props}\n >\n {children}\n </List.ListItem>\n )\n}\n\n/**\n * Renders a Nav component.\n * @param {Object} props - The props for the component.\n * @param {ReactNode} props.children - The child elements.\n * @param {Object} props - Additional props to spread to the UI component.\n * @returns {JSX.Element} The rendered Nav component.\n */\nexport const Nav = ({ children, ...props }: NavProps) => {\n return (\n <UI as=\"nav\" {...props}>\n {children}\n </UI>\n )\n}\n\nexport default Nav\nNav.displayName = 'Nav'\nNav.List = NavList\nNav.Item = NavItem\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { c } from './chunk-SMYRLO3E.js';
|
|
2
|
+
import { a } from './chunk-KUKIVRC2.js';
|
|
3
|
+
import r from 'react';
|
|
4
|
+
|
|
5
|
+
var n=({isBlock:t,children:o,...s})=>r.createElement(c,{type:"ul",...s,"data-list":`unstyled ${t?"block":""}`},o),L=({id:t,styles:o,classes:s,children:i,...m})=>r.createElement(c.ListItem,{type:"li",id:t,classes:s,styles:o,...m},i),e=({children:t,...o})=>r.createElement(a,{as:"nav",...o},t),N=e;e.displayName="Nav";e.List=n;e.Item=L;
|
|
6
|
+
|
|
7
|
+
export { n as a, L as b, e as c, N as d };
|
|
8
|
+
//# sourceMappingURL=out.js.map
|
|
9
|
+
//# sourceMappingURL=chunk-2Y7W75TT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/nav/nav.tsx"],"names":["React","NavList","isBlock","children","props","list_default","NavItem","id","styles","classes","Nav","ui_default","nav_default"],"mappings":"2EAEA,OAAOA,MAAW,QAgBX,IAAMC,EAAU,CAAC,CAAE,QAAAC,EAAS,SAAAC,EAAU,GAAGC,CAAM,IAElDJ,EAAA,cAACK,EAAA,CAAK,KAAK,KAAM,GAAGD,EAAO,YAAW,YAAYF,EAAU,QAAU,EAAE,IACrEC,CACH,EAeSG,EAAU,CAAC,CACtB,GAAAC,EACA,OAAAC,EACA,QAAAC,EACA,SAAAN,EACA,GAAGC,CACL,IAEIJ,EAAA,cAACK,EAAK,SAAL,CACC,KAAK,KACL,GAAIE,EACJ,QAASE,EACT,OAAQD,EACP,GAAGJ,GAEHD,CACH,EAWSO,EAAM,CAAC,CAAE,SAAAP,EAAU,GAAGC,CAAM,IAErCJ,EAAA,cAACW,EAAA,CAAG,GAAG,MAAO,GAAGP,GACdD,CACH,EAIGS,EAAQF,EACfA,EAAI,YAAc,MAClBA,EAAI,KAAOT,EACXS,EAAI,KAAOJ","sourcesContent":["import UI from '../ui'\nimport List from '../list/list'\nimport React from 'react'\n\nexport type NavListProps = React.ComponentProps<typeof List> & {\n isBlock?: boolean\n}\nexport type NavItemProps = React.ComponentProps<typeof List.ListItem>\n\nexport type NavProps = React.ComponentProps<typeof UI>\n\n/**\n * Renders a NavList component.\n * @param {Object} props - The props for the component.\n * @param {ReactNode} props.children - The child elements.\n * @param {Object} props - Additional props to spread to the List component.\n * @returns {JSX.Element} The rendered NavList component.\n */\nexport const NavList = ({ isBlock, children, ...props }: NavListProps) => {\n return (\n <List type=\"ul\" {...props} data-list={`unstyled ${isBlock ? 'block' : ''}`}>\n {children}\n </List>\n )\n}\n\n/**\n * Renders a NavItem component.\n * @param {Object} props - The props for the component.\n * @param {string} [props.id] - The id for the component.\n * @param {Object} [props.styles] - The styles for the component.\n * @param {string} [props.classes] - The classes for the component.\n * @param {ReactNode} props.children - The child elements.\n * @param {boolean} [props.inline=true] - Whether the item should display inline.\n * @param {Object} props - Additional props to spread to the ListItem component.\n * @returns {JSX.Element} The rendered NavItem component.\n */\nexport const NavItem = ({\n id,\n styles,\n classes,\n children,\n ...props\n}: NavItemProps) => {\n return (\n <List.ListItem\n type=\"li\"\n id={id}\n classes={classes}\n styles={styles}\n {...props}\n >\n {children}\n </List.ListItem>\n )\n}\n\n/**\n * Renders a Nav component.\n * @param {Object} props - The props for the component.\n * @param {ReactNode} props.children - The child elements.\n * @param {Object} props - Additional props to spread to the UI component.\n * @returns {JSX.Element} The rendered Nav component.\n */\nexport const Nav = ({ children, ...props }: NavProps) => {\n return (\n <UI as=\"nav\" {...props}>\n {children}\n </UI>\n )\n}\n\nexport default Nav\nNav.displayName = 'Nav'\nNav.List = NavList\nNav.Item = NavItem\n"]}
|