@imdz/react 0.0.0-stage → 0.2.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 +21 -0
- package/OFL.txt +189 -0
- package/README.md +85 -2
- package/dist/accordion.d.ts +13 -0
- package/dist/accordion.js +12 -0
- package/dist/alert.d.ts +7 -0
- package/dist/alert.js +11 -0
- package/dist/avatar.d.ts +8 -0
- package/dist/avatar.js +21 -0
- package/dist/badge.d.ts +6 -0
- package/dist/badge.js +11 -0
- package/dist/button.d.ts +8 -0
- package/dist/button.js +11 -0
- package/dist/card.d.ts +6 -0
- package/dist/card.js +11 -0
- package/dist/checkbox.d.ts +3 -0
- package/dist/checkbox.js +12 -0
- package/dist/cx.d.ts +1 -0
- package/dist/cx.js +3 -0
- package/dist/dark.css +13 -0
- package/dist/dialog.d.ts +12 -0
- package/dist/dialog.js +24 -0
- package/dist/fonts/inter-latin-400-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-600-normal.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-latin-600-normal.woff2 +0 -0
- package/dist/fonts.css +24 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +17 -0
- package/dist/input.d.ts +7 -0
- package/dist/input.js +17 -0
- package/dist/progress.d.ts +8 -0
- package/dist/progress.js +13 -0
- package/dist/select.d.ts +7 -0
- package/dist/select.js +19 -0
- package/dist/skeleton.d.ts +7 -0
- package/dist/skeleton.js +12 -0
- package/dist/spinner.d.ts +7 -0
- package/dist/spinner.js +11 -0
- package/dist/style.d.ts +5 -0
- package/dist/style.js +26 -0
- package/dist/styles/accordion.d.ts +1 -0
- package/dist/styles/accordion.js +1 -0
- package/dist/styles/alert.d.ts +1 -0
- package/dist/styles/alert.js +1 -0
- package/dist/styles/avatar.d.ts +1 -0
- package/dist/styles/avatar.js +1 -0
- package/dist/styles/badge.d.ts +1 -0
- package/dist/styles/badge.js +1 -0
- package/dist/styles/button.d.ts +1 -0
- package/dist/styles/button.js +1 -0
- package/dist/styles/card.d.ts +1 -0
- package/dist/styles/card.js +1 -0
- package/dist/styles/checkbox.d.ts +1 -0
- package/dist/styles/checkbox.js +1 -0
- package/dist/styles/dialog.d.ts +1 -0
- package/dist/styles/dialog.js +1 -0
- package/dist/styles/field.d.ts +1 -0
- package/dist/styles/field.js +1 -0
- package/dist/styles/fonts.d.ts +1 -0
- package/dist/styles/fonts.js +1 -0
- package/dist/styles/progress.d.ts +1 -0
- package/dist/styles/progress.js +1 -0
- package/dist/styles/select.d.ts +1 -0
- package/dist/styles/select.js +1 -0
- package/dist/styles/skeleton.d.ts +1 -0
- package/dist/styles/skeleton.js +1 -0
- package/dist/styles/spinner.d.ts +1 -0
- package/dist/styles/spinner.js +1 -0
- package/dist/styles/switch.d.ts +1 -0
- package/dist/styles/switch.js +1 -0
- package/dist/styles/tabs.d.ts +1 -0
- package/dist/styles/tabs.js +1 -0
- package/dist/styles/textarea.d.ts +1 -0
- package/dist/styles/textarea.js +1 -0
- package/dist/styles/tooltip.d.ts +1 -0
- package/dist/styles/tooltip.js +1 -0
- package/dist/styles.css +872 -0
- package/dist/switch.d.ts +3 -0
- package/dist/switch.js +12 -0
- package/dist/tabs.d.ts +12 -0
- package/dist/tabs.js +36 -0
- package/dist/textarea.d.ts +7 -0
- package/dist/textarea.js +18 -0
- package/dist/tokens.css +49 -0
- package/dist/tooltip.d.ts +7 -0
- package/dist/tooltip.js +12 -0
- package/package.json +54 -4
- package/src/accordion.tsx +35 -0
- package/src/alert.tsx +33 -0
- package/src/avatar.tsx +37 -0
- package/src/badge.tsx +31 -0
- package/src/button.tsx +32 -0
- package/src/card.tsx +24 -0
- package/src/checkbox.tsx +18 -0
- package/src/cx.ts +3 -0
- package/src/dialog.tsx +61 -0
- package/src/index.ts +26 -0
- package/src/input.tsx +50 -0
- package/src/progress.tsx +45 -0
- package/src/select.tsx +55 -0
- package/src/skeleton.tsx +20 -0
- package/src/spinner.tsx +23 -0
- package/src/switch.tsx +23 -0
- package/src/tabs.tsx +91 -0
- package/src/textarea.tsx +53 -0
- package/src/tooltip.tsx +21 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ismael Morillas Díaz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/OFL.txt
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter) Inter-Italic[opsz,wght].ttf: Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
94
|
+
|
|
95
|
+
----------------------------------------
|
|
96
|
+
|
|
97
|
+
Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono) JetBrainsMono-Italic[wght].ttf: Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono)
|
|
98
|
+
|
|
99
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
100
|
+
This license is copied below, and is also available with a FAQ at:
|
|
101
|
+
http://scripts.sil.org/OFL
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
-----------------------------------------------------------
|
|
105
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
106
|
+
-----------------------------------------------------------
|
|
107
|
+
|
|
108
|
+
PREAMBLE
|
|
109
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
110
|
+
development of collaborative font projects, to support the font creation
|
|
111
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
112
|
+
open framework in which fonts may be shared and improved in partnership
|
|
113
|
+
with others.
|
|
114
|
+
|
|
115
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
116
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
117
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
118
|
+
redistributed and/or sold with any software provided that any reserved
|
|
119
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
120
|
+
however, cannot be released under any other type of license. The
|
|
121
|
+
requirement for fonts to remain under this license does not apply
|
|
122
|
+
to any document created using the fonts or their derivatives.
|
|
123
|
+
|
|
124
|
+
DEFINITIONS
|
|
125
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
126
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
127
|
+
include source files, build scripts and documentation.
|
|
128
|
+
|
|
129
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
130
|
+
copyright statement(s).
|
|
131
|
+
|
|
132
|
+
"Original Version" refers to the collection of Font Software components as
|
|
133
|
+
distributed by the Copyright Holder(s).
|
|
134
|
+
|
|
135
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
136
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
137
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
138
|
+
new environment.
|
|
139
|
+
|
|
140
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
141
|
+
writer or other person who contributed to the Font Software.
|
|
142
|
+
|
|
143
|
+
PERMISSION & CONDITIONS
|
|
144
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
145
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
146
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
147
|
+
Software, subject to the following conditions:
|
|
148
|
+
|
|
149
|
+
1) Neither the Font Software nor any of its individual components,
|
|
150
|
+
in Original or Modified Versions, may be sold by itself.
|
|
151
|
+
|
|
152
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
153
|
+
redistributed and/or sold with any software, provided that each copy
|
|
154
|
+
contains the above copyright notice and this license. These can be
|
|
155
|
+
included either as stand-alone text files, human-readable headers or
|
|
156
|
+
in the appropriate machine-readable metadata fields within text or
|
|
157
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
158
|
+
|
|
159
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
160
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
161
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
162
|
+
presented to the users.
|
|
163
|
+
|
|
164
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
165
|
+
Software shall not be used to promote, endorse or advertise any
|
|
166
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
167
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
168
|
+
permission.
|
|
169
|
+
|
|
170
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
171
|
+
must be distributed entirely under this license, and must not be
|
|
172
|
+
distributed under any other license. The requirement for fonts to
|
|
173
|
+
remain under this license does not apply to any document created
|
|
174
|
+
using the Font Software.
|
|
175
|
+
|
|
176
|
+
TERMINATION
|
|
177
|
+
This license becomes null and void if any of the above conditions are
|
|
178
|
+
not met.
|
|
179
|
+
|
|
180
|
+
DISCLAIMER
|
|
181
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
182
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
183
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
184
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
185
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
186
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
187
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
188
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
189
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,86 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @imdz/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Free, accessible React components in plain CSS. One command, then import
|
|
4
|
+
whatever you need: no Tailwind, no CSS to import, no config.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm i @imdz/react
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { Button, Dialog } from "@imdz/react";
|
|
12
|
+
|
|
13
|
+
export function Save() {
|
|
14
|
+
return <Button>Save</Button>;
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Docs and live examples: [imdz.dev](https://imdz.dev)
|
|
19
|
+
|
|
20
|
+
## Works everywhere
|
|
21
|
+
|
|
22
|
+
Any React 18 or 19 web project: Vite, Next.js (App Router with Server
|
|
23
|
+
Components, and Pages Router), React Router, Remix, Astro, Gatsby, Parcel,
|
|
24
|
+
Rsbuild… Each component brings its own styles and puts them on the page when
|
|
25
|
+
it renders, also on the server, so there is nothing for your bundler or
|
|
26
|
+
framework to set up. TypeScript types included.
|
|
27
|
+
|
|
28
|
+
Components: Accordion, Alert, Avatar, Badge, Button, Card, Checkbox, Dialog,
|
|
29
|
+
Input, Progress, Select, Skeleton, Spinner, Switch, Tabs, Textarea, Tooltip.
|
|
30
|
+
|
|
31
|
+
Classes start with `imdz-` (`imdz-button`, `imdz-button-secondary`…), so they
|
|
32
|
+
don't clash with yours.
|
|
33
|
+
|
|
34
|
+
## Theme
|
|
35
|
+
|
|
36
|
+
Every style reads a CSS variable with a built-in default. Override any of them
|
|
37
|
+
in your own CSS:
|
|
38
|
+
|
|
39
|
+
```css
|
|
40
|
+
:root {
|
|
41
|
+
--imdz-radius: 6px;
|
|
42
|
+
--imdz-font: "Inter", sans-serif;
|
|
43
|
+
--imdz-primary: #2563eb;
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Tokens: `--imdz-bg`, `--imdz-surface`, `--imdz-border`, `--imdz-text`,
|
|
48
|
+
`--imdz-muted`, `--imdz-primary`, `--imdz-on-primary`, `--imdz-success`,
|
|
49
|
+
`--imdz-warning`, `--imdz-danger`, `--imdz-on-danger`, `--imdz-focus`,
|
|
50
|
+
`--imdz-font`, `--imdz-font-mono`, `--imdz-radius` and `--imdz-tracking`.
|
|
51
|
+
|
|
52
|
+
### Dark mode
|
|
53
|
+
|
|
54
|
+
The defaults are the light theme. For dark mode, import `dark.css` once in your
|
|
55
|
+
main file and add the `dark` class (or `data-theme="dark"`) to `<html>`:
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import "@imdz/react/dark.css";
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Fonts
|
|
62
|
+
|
|
63
|
+
Components use Inter and JetBrains Mono (latin subset), loaded from jsDelivr.
|
|
64
|
+
Both are under the SIL Open Font License 1.1 (see `OFL.txt`). To use your own
|
|
65
|
+
fonts, set `--imdz-font` and `--imdz-font-mono`.
|
|
66
|
+
|
|
67
|
+
## Strict Content Security Policy
|
|
68
|
+
|
|
69
|
+
On React 19, styles are rendered as `<style>` tags. If your site's CSP blocks
|
|
70
|
+
inline styles, import the stylesheet once in your main file instead:
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import "@imdz/react/styles.css";
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Notes
|
|
77
|
+
|
|
78
|
+
- With React 18, styles are added in the browser when a component mounts, so
|
|
79
|
+
server-rendered pages can show unstyled components for an instant. React 19
|
|
80
|
+
doesn't have this problem.
|
|
81
|
+
- With Tailwind, a utility in `className` can lose against the component's own
|
|
82
|
+
CSS when both set the same property. Use the important modifier (`h-12!`).
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
MIT
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type AccordionItem = {
|
|
3
|
+
heading: string;
|
|
4
|
+
content: ReactNode;
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type AccordionProps = {
|
|
8
|
+
items: AccordionItem[];
|
|
9
|
+
/** If set, only one section can be open at a time. */
|
|
10
|
+
name?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function Accordion(props: AccordionProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "./cx.js";
|
|
3
|
+
import { Style } from "./style.js";
|
|
4
|
+
import { css as fontsCss } from "./styles/fonts.js";
|
|
5
|
+
import { css as accordionCss } from "./styles/accordion.js";
|
|
6
|
+
/** Collapsible sections built on the native details element. */
|
|
7
|
+
function AccordionBase({ items, name, className }) {
|
|
8
|
+
return (_jsx("div", { className: cx("imdz-accordion", className), children: items.map((item) => (_jsxs("details", { name: name, open: item.defaultOpen, className: "imdz-accordion-item", children: [_jsx("summary", { className: "imdz-accordion-summary", children: item.heading }), _jsx("div", { className: "imdz-accordion-content", children: item.content })] }, item.heading))) }));
|
|
9
|
+
}
|
|
10
|
+
export function Accordion(props) {
|
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsx(Style, { id: "fonts", css: fontsCss }), _jsx(Style, { id: "accordion", css: accordionCss }), _jsx(AccordionBase, { ...props })] }));
|
|
12
|
+
}
|
package/dist/alert.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export type AlertVariant = "info" | "success" | "warning" | "danger";
|
|
3
|
+
export type AlertProps = Omit<HTMLAttributes<HTMLDivElement>, "title"> & {
|
|
4
|
+
variant?: AlertVariant;
|
|
5
|
+
heading?: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare function Alert(props: AlertProps): import("react").JSX.Element;
|
package/dist/alert.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "./cx.js";
|
|
3
|
+
import { Style } from "./style.js";
|
|
4
|
+
import { css as fontsCss } from "./styles/fonts.js";
|
|
5
|
+
import { css as alertCss } from "./styles/alert.js";
|
|
6
|
+
function AlertBase({ variant = "info", heading, className, children, ...props }) {
|
|
7
|
+
return (_jsxs("div", { role: variant === "danger" ? "alert" : "status", className: cx("imdz-alert", variant !== "info" && `imdz-alert-${variant}`, className), ...props, children: [heading && _jsx("p", { className: "imdz-alert-title", children: heading }), _jsx("div", { children: children })] }));
|
|
8
|
+
}
|
|
9
|
+
export function Alert(props) {
|
|
10
|
+
return (_jsxs(_Fragment, { children: [_jsx(Style, { id: "fonts", css: fontsCss }), _jsx(Style, { id: "alert", css: alertCss }), _jsx(AlertBase, { ...props })] }));
|
|
11
|
+
}
|
package/dist/avatar.d.ts
ADDED
package/dist/avatar.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "./cx.js";
|
|
3
|
+
import { Style } from "./style.js";
|
|
4
|
+
import { css as fontsCss } from "./styles/fonts.js";
|
|
5
|
+
import { css as avatarCss } from "./styles/avatar.js";
|
|
6
|
+
function AvatarBase({ name, src, size = "md", className }) {
|
|
7
|
+
const classes = cx("imdz-avatar", size === "lg" && "imdz-avatar-lg", className);
|
|
8
|
+
if (src) {
|
|
9
|
+
return (_jsx("span", { className: classes, children: _jsx("img", { src: src, alt: name }) }));
|
|
10
|
+
}
|
|
11
|
+
const initials = name
|
|
12
|
+
.split(/\s+/)
|
|
13
|
+
.filter(Boolean)
|
|
14
|
+
.slice(0, 2)
|
|
15
|
+
.map((word) => word[0])
|
|
16
|
+
.join("");
|
|
17
|
+
return (_jsx("span", { className: classes, role: "img", "aria-label": name, children: initials }));
|
|
18
|
+
}
|
|
19
|
+
export function Avatar(props) {
|
|
20
|
+
return (_jsxs(_Fragment, { children: [_jsx(Style, { id: "fonts", css: fontsCss }), _jsx(Style, { id: "avatar", css: avatarCss }), _jsx(AvatarBase, { ...props })] }));
|
|
21
|
+
}
|
package/dist/badge.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export type BadgeVariant = "neutral" | "primary" | "success" | "warning" | "danger";
|
|
3
|
+
export type BadgeProps = HTMLAttributes<HTMLSpanElement> & {
|
|
4
|
+
variant?: BadgeVariant;
|
|
5
|
+
};
|
|
6
|
+
export declare function Badge(props: BadgeProps): import("react").JSX.Element;
|
package/dist/badge.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "./cx.js";
|
|
3
|
+
import { Style } from "./style.js";
|
|
4
|
+
import { css as fontsCss } from "./styles/fonts.js";
|
|
5
|
+
import { css as badgeCss } from "./styles/badge.js";
|
|
6
|
+
function BadgeBase({ variant = "neutral", className, ...props }) {
|
|
7
|
+
return (_jsx("span", { className: cx("imdz-badge", variant !== "neutral" && `imdz-badge-${variant}`, className), ...props }));
|
|
8
|
+
}
|
|
9
|
+
export function Badge(props) {
|
|
10
|
+
return (_jsxs(_Fragment, { children: [_jsx(Style, { id: "fonts", css: fontsCss }), _jsx(Style, { id: "badge", css: badgeCss }), _jsx(BadgeBase, { ...props })] }));
|
|
11
|
+
}
|
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes } from "react";
|
|
2
|
+
export type ButtonVariant = "primary" | "secondary" | "ghost" | "danger";
|
|
3
|
+
export type ButtonSize = "sm" | "md" | "lg";
|
|
4
|
+
export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
size?: ButtonSize;
|
|
7
|
+
};
|
|
8
|
+
export declare function Button(props: ButtonProps): import("react").JSX.Element;
|
package/dist/button.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "./cx.js";
|
|
3
|
+
import { Style } from "./style.js";
|
|
4
|
+
import { css as fontsCss } from "./styles/fonts.js";
|
|
5
|
+
import { css as buttonCss } from "./styles/button.js";
|
|
6
|
+
function ButtonBase({ variant = "primary", size = "md", type = "button", className, ...props }) {
|
|
7
|
+
return (_jsx("button", { type: type, className: cx("imdz-button", variant !== "primary" && `imdz-button-${variant}`, size !== "md" && `imdz-button-${size}`, className), ...props }));
|
|
8
|
+
}
|
|
9
|
+
export function Button(props) {
|
|
10
|
+
return (_jsxs(_Fragment, { children: [_jsx(Style, { id: "fonts", css: fontsCss }), _jsx(Style, { id: "button", css: buttonCss }), _jsx(ButtonBase, { ...props })] }));
|
|
11
|
+
}
|
package/dist/card.d.ts
ADDED
package/dist/card.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "./cx.js";
|
|
3
|
+
import { Style } from "./style.js";
|
|
4
|
+
import { css as fontsCss } from "./styles/fonts.js";
|
|
5
|
+
import { css as cardCss } from "./styles/card.js";
|
|
6
|
+
function CardBase({ heading, footer, className, children, ...props }) {
|
|
7
|
+
return (_jsxs("div", { className: cx("imdz-card", className), ...props, children: [heading && _jsx("h3", { className: "imdz-card-title", children: heading }), _jsx("div", { className: "imdz-card-body", children: children }), footer && _jsx("div", { className: "imdz-card-footer", children: footer })] }));
|
|
8
|
+
}
|
|
9
|
+
export function Card(props) {
|
|
10
|
+
return (_jsxs(_Fragment, { children: [_jsx(Style, { id: "fonts", css: fontsCss }), _jsx(Style, { id: "card", css: cardCss }), _jsx(CardBase, { ...props })] }));
|
|
11
|
+
}
|
package/dist/checkbox.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "./cx.js";
|
|
3
|
+
import { Style } from "./style.js";
|
|
4
|
+
import { css as fontsCss } from "./styles/fonts.js";
|
|
5
|
+
import { css as checkboxCss } from "./styles/checkbox.js";
|
|
6
|
+
/** The checkbox label goes as children. */
|
|
7
|
+
function CheckboxBase({ className, children, ...props }) {
|
|
8
|
+
return (_jsxs("label", { className: cx("imdz-checkbox", className), children: [_jsx("input", { type: "checkbox", className: "imdz-checkbox-input", ...props }), _jsx("span", { children: children })] }));
|
|
9
|
+
}
|
|
10
|
+
export function Checkbox(props) {
|
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsx(Style, { id: "fonts", css: fontsCss }), _jsx(Style, { id: "checkbox", css: checkboxCss }), _jsx(CheckboxBase, { ...props })] }));
|
|
12
|
+
}
|
package/dist/cx.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cx(...classes: (string | false | null | undefined)[]): string;
|
package/dist/cx.js
ADDED
package/dist/dark.css
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
.dark,
|
|
2
|
+
[data-theme="dark"] {
|
|
3
|
+
--imdz-bg: #000000;
|
|
4
|
+
--imdz-surface: #0d0d0d;
|
|
5
|
+
--imdz-border: #2e2e2e;
|
|
6
|
+
--imdz-text: #ffffff;
|
|
7
|
+
--imdz-muted: #9a9a9a;
|
|
8
|
+
--imdz-success: #5dffa0;
|
|
9
|
+
--imdz-warning: #ffd166;
|
|
10
|
+
--imdz-danger: #ff5c6c;
|
|
11
|
+
--imdz-on-danger: #000000;
|
|
12
|
+
color-scheme: dark;
|
|
13
|
+
}
|
package/dist/dialog.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type DialogProps = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
/** Called on close: with Escape, with the close button or when open becomes false. */
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
heading: ReactNode;
|
|
7
|
+
footer?: ReactNode;
|
|
8
|
+
closeLabel?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export declare function Dialog(props: DialogProps): import("react").JSX.Element;
|
package/dist/dialog.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useId, useRef } from "react";
|
|
4
|
+
import { cx } from "./cx.js";
|
|
5
|
+
import { Style } from "./style.js";
|
|
6
|
+
import { css as fontsCss } from "./styles/fonts.js";
|
|
7
|
+
import { css as dialogCss } from "./styles/dialog.js";
|
|
8
|
+
function DialogBase({ open, onClose, heading, footer, closeLabel = "Close", className, children, }) {
|
|
9
|
+
const ref = useRef(null);
|
|
10
|
+
const titleId = useId();
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const element = ref.current;
|
|
13
|
+
if (!element)
|
|
14
|
+
return;
|
|
15
|
+
if (open && !element.open)
|
|
16
|
+
element.showModal();
|
|
17
|
+
if (!open && element.open)
|
|
18
|
+
element.close();
|
|
19
|
+
}, [open]);
|
|
20
|
+
return (_jsxs("dialog", { ref: ref, className: cx("imdz-dialog", className), "aria-labelledby": titleId, onClose: onClose, children: [_jsxs("header", { className: "imdz-dialog-header", children: [_jsx("h2", { id: titleId, className: "imdz-dialog-title", children: heading }), _jsx("button", { type: "button", className: "imdz-dialog-close", "aria-label": closeLabel, onClick: onClose, children: "\u00D7" })] }), _jsx("div", { className: "imdz-dialog-body", children: children }), footer && _jsx("footer", { className: "imdz-dialog-footer", children: footer })] }));
|
|
21
|
+
}
|
|
22
|
+
export function Dialog(props) {
|
|
23
|
+
return (_jsxs(_Fragment, { children: [_jsx(Style, { id: "fonts", css: fontsCss }), _jsx(Style, { id: "dialog", css: dialogCss }), _jsx(DialogBase, { ...props })] }));
|
|
24
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/fonts.css
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: "imdz Inter";
|
|
3
|
+
font-style: normal;
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
font-display: swap;
|
|
6
|
+
src: url(./fonts/inter-latin-400-normal.woff2) format("woff2");
|
|
7
|
+
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
8
|
+
}
|
|
9
|
+
@font-face {
|
|
10
|
+
font-family: "imdz Inter";
|
|
11
|
+
font-style: normal;
|
|
12
|
+
font-weight: 600;
|
|
13
|
+
font-display: swap;
|
|
14
|
+
src: url(./fonts/inter-latin-600-normal.woff2) format("woff2");
|
|
15
|
+
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
16
|
+
}
|
|
17
|
+
@font-face {
|
|
18
|
+
font-family: "imdz JetBrains Mono";
|
|
19
|
+
font-style: normal;
|
|
20
|
+
font-weight: 600;
|
|
21
|
+
font-display: swap;
|
|
22
|
+
src: url(./fonts/jetbrains-mono-latin-600-normal.woff2) format("woff2");
|
|
23
|
+
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
24
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { Accordion, type AccordionItem, type AccordionProps, } from "./accordion.js";
|
|
2
|
+
export { Alert, type AlertProps, type AlertVariant } from "./alert.js";
|
|
3
|
+
export { Avatar, type AvatarProps } from "./avatar.js";
|
|
4
|
+
export { Badge, type BadgeProps, type BadgeVariant } from "./badge.js";
|
|
5
|
+
export { Button, type ButtonProps, type ButtonSize, type ButtonVariant, } from "./button.js";
|
|
6
|
+
export { Card, type CardProps } from "./card.js";
|
|
7
|
+
export { Checkbox, type CheckboxProps } from "./checkbox.js";
|
|
8
|
+
export { Dialog, type DialogProps } from "./dialog.js";
|
|
9
|
+
export { Input, type InputProps } from "./input.js";
|
|
10
|
+
export { Progress, type ProgressProps } from "./progress.js";
|
|
11
|
+
export { Select, type SelectProps } from "./select.js";
|
|
12
|
+
export { Skeleton, type SkeletonProps } from "./skeleton.js";
|
|
13
|
+
export { Spinner, type SpinnerProps } from "./spinner.js";
|
|
14
|
+
export { Switch, type SwitchProps } from "./switch.js";
|
|
15
|
+
export { Tabs, type TabItem, type TabsProps } from "./tabs.js";
|
|
16
|
+
export { Textarea, type TextareaProps } from "./textarea.js";
|
|
17
|
+
export { Tooltip, type TooltipProps } from "./tooltip.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { Accordion, } from "./accordion.js";
|
|
2
|
+
export { Alert } from "./alert.js";
|
|
3
|
+
export { Avatar } from "./avatar.js";
|
|
4
|
+
export { Badge } from "./badge.js";
|
|
5
|
+
export { Button, } from "./button.js";
|
|
6
|
+
export { Card } from "./card.js";
|
|
7
|
+
export { Checkbox } from "./checkbox.js";
|
|
8
|
+
export { Dialog } from "./dialog.js";
|
|
9
|
+
export { Input } from "./input.js";
|
|
10
|
+
export { Progress } from "./progress.js";
|
|
11
|
+
export { Select } from "./select.js";
|
|
12
|
+
export { Skeleton } from "./skeleton.js";
|
|
13
|
+
export { Spinner } from "./spinner.js";
|
|
14
|
+
export { Switch } from "./switch.js";
|
|
15
|
+
export { Tabs } from "./tabs.js";
|
|
16
|
+
export { Textarea } from "./textarea.js";
|
|
17
|
+
export { Tooltip } from "./tooltip.js";
|
package/dist/input.d.ts
ADDED
package/dist/input.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { cx } from "./cx.js";
|
|
5
|
+
import { Style } from "./style.js";
|
|
6
|
+
import { css as fontsCss } from "./styles/fonts.js";
|
|
7
|
+
import { css as fieldCss } from "./styles/field.js";
|
|
8
|
+
function InputBase({ label, hint, error, id, className, ...props }) {
|
|
9
|
+
const generatedId = useId();
|
|
10
|
+
const inputId = id ?? generatedId;
|
|
11
|
+
const message = error || hint;
|
|
12
|
+
const messageId = `${inputId}-message`;
|
|
13
|
+
return (_jsxs("div", { className: "imdz-field", children: [label && (_jsx("label", { className: "imdz-field-label", htmlFor: inputId, children: label })), _jsx("input", { id: inputId, className: cx("imdz-field-input", className), "aria-invalid": error ? true : undefined, "aria-describedby": message ? messageId : undefined, ...props }), message && (_jsx("p", { id: messageId, className: error ? "imdz-field-error" : "imdz-field-hint", children: message }))] }));
|
|
14
|
+
}
|
|
15
|
+
export function Input(props) {
|
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsx(Style, { id: "fonts", css: fontsCss }), _jsx(Style, { id: "field", css: fieldCss }), _jsx(InputBase, { ...props })] }));
|
|
17
|
+
}
|