@cyishere/react-uikit 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/LICENSE +15 -0
- package/README.md +102 -0
- package/dist/index.cjs +2397 -0
- package/dist/index.d.cts +960 -0
- package/dist/index.d.ts +960 -0
- package/dist/index.js +2351 -0
- package/dist/styles.css +86 -0
- package/less/components/Accordion/Accordion.less +16 -0
- package/less/components/Switcher/Switcher.less +66 -0
- package/less/components/UnstyledButton/UnstyledButton.less +19 -0
- package/less/index.less +4 -0
- package/package.json +88 -0
- package/scss/components/Accordion/Accordion.scss +16 -0
- package/scss/components/Switcher/Switcher.scss +66 -0
- package/scss/components/UnstyledButton/UnstyledButton.scss +19 -0
- package/scss/index.scss +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chen Yang
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# @cyishere/react-uikit
|
|
2
|
+
|
|
3
|
+
A SSR-safe React integration layer for the [UIkit CSS](https://getuikit.com/) framework.
|
|
4
|
+
|
|
5
|
+
`@cyishere/react-uikit` bridges the gap between React's declarative state model and UIkit's modern aesthetic. It is built from the ground up to respect React's virtual DOM, provide accessibility, and support smooth hydration.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Pure UIkit CSS visuals** — uses UIkit CSS classes as the authoritative styling layer.
|
|
10
|
+
- **SSR-safe by default** — no module-level `window`/`document` access. Works in Next.js, Remix, and Astro without hydration mismatches.
|
|
11
|
+
- **Declarative React ownership** — interactive components like `Switcher` and `Accordion` are fully rewritten in React, so UIkit JS never touches their nodes. JS-enhanced components like `Alert` and `OffCanvas` wrap UIkit's own JS with safe mount/unmount lifecycles and add React-side focus trapping and scroll locking.
|
|
12
|
+
- **Accessibility first** — WAI-ARIA patterns, ARIA attributes, and automatic keyboard/focus management (including focus trapping for overlays).
|
|
13
|
+
- **Typed** — ships with full TypeScript definitions and dual ESM/CJS builds.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Install the library together with its peer dependencies:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @cyishere/react-uikit uikit react react-dom
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Peer dependency requirements:
|
|
24
|
+
|
|
25
|
+
| Package | Version |
|
|
26
|
+
| :---------- | :-------- |
|
|
27
|
+
| `react` | `^19.0.0` |
|
|
28
|
+
| `react-dom` | `^19.0.0` |
|
|
29
|
+
| `uikit` | `^3.0.0` |
|
|
30
|
+
|
|
31
|
+
## Styling
|
|
32
|
+
|
|
33
|
+
This package depends on UIkit's stock CSS being loaded by your app, and ships its own small stylesheet for the components that need custom styles (`Switcher`, `Accordion`, and others).
|
|
34
|
+
|
|
35
|
+
Import both stylesheets once, in your application's root entry file (e.g. `main.tsx`, `_app.tsx`, or a root layout):
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import 'uikit/dist/css/uikit.min.css';
|
|
39
|
+
import '@cyishere/react-uikit/styles.css';
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
> **Important:** the stylesheet must be imported manually. This package is marked
|
|
43
|
+
> `"sideEffects": false` so bundlers can tree-shake unused JavaScript, which
|
|
44
|
+
> means CSS is **not** pulled in automatically when you import a component.
|
|
45
|
+
> Always add the `@cyishere/react-uikit/styles.css` import yourself.
|
|
46
|
+
|
|
47
|
+
### Using Less or Sass
|
|
48
|
+
|
|
49
|
+
If you compile your own styles, you can import the source partials instead of the prebuilt CSS so they participate in your UIkit theme:
|
|
50
|
+
|
|
51
|
+
```less
|
|
52
|
+
// Less
|
|
53
|
+
@import '@cyishere/react-uikit/less/index.less';
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```scss
|
|
57
|
+
// Sass
|
|
58
|
+
@import '@cyishere/react-uikit/scss/index.scss';
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { Accordion, Alert } from '@cyishere/react-uikit';
|
|
65
|
+
|
|
66
|
+
export default function App() {
|
|
67
|
+
return (
|
|
68
|
+
<div className="uk-container uk-margin-top">
|
|
69
|
+
<Alert className="uk-alert-success">Welcome to the modern UIkit React integration!</Alert>
|
|
70
|
+
|
|
71
|
+
<Accordion.Root showIcon>
|
|
72
|
+
<Accordion.Item>
|
|
73
|
+
<Accordion.Trigger>What is react-uikit?</Accordion.Trigger>
|
|
74
|
+
<Accordion.Panel>
|
|
75
|
+
It is a lightweight, SSR-safe React wrapper around UIkit CSS.
|
|
76
|
+
</Accordion.Panel>
|
|
77
|
+
</Accordion.Item>
|
|
78
|
+
</Accordion.Root>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Components
|
|
85
|
+
|
|
86
|
+
The library focuses on components that genuinely benefit from React ownership.
|
|
87
|
+
Purely presentational UIkit classes (e.g. `Button`, `Card`, `Label`) are
|
|
88
|
+
intentionally left to plain JSX and are not wrapped here.
|
|
89
|
+
|
|
90
|
+
- `Accordion`
|
|
91
|
+
- `Alert`
|
|
92
|
+
- `Close`
|
|
93
|
+
- `Grid`
|
|
94
|
+
- `Icon`
|
|
95
|
+
- `OffCanvas`
|
|
96
|
+
- `Switcher`
|
|
97
|
+
|
|
98
|
+
A `cn` class-name utility is also exported.
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
[ISC](./LICENSE) © Chen Yang
|