opui-css 5.0.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +282 -276
- package/LICENSE +21 -21
- package/MIGRATING.md +127 -127
- package/README.md +87 -87
- package/astro/index.ts +46 -46
- package/components/AGENTS.md +248 -248
- package/components/Accordion/Accordion.astro +42 -42
- package/components/Anchor/Anchor.astro +51 -51
- package/components/Avatar/Avatar.astro +38 -38
- package/components/Badge/Badge.astro +59 -59
- package/components/Button/Button.astro +45 -45
- package/components/ButtonGroup/ButtonGroup.astro +29 -29
- package/components/Callout/Callout.astro +75 -75
- package/components/Card/Card.astro +36 -36
- package/components/Checkbox/Checkbox.astro +76 -76
- package/components/Checkbox/CheckboxInput.astro +32 -32
- package/components/Chip/Chip.astro +37 -37
- package/components/ClassicSelect/ClassicSelect.astro +83 -83
- package/components/DescriptionList/Description.astro +12 -12
- package/components/DescriptionList/DescriptionList.astro +22 -22
- package/components/DescriptionList/Item.astro +12 -12
- package/components/DescriptionList/Term.astro +12 -12
- package/components/DescriptionList/index.ts +12 -12
- package/components/Dialog/Dialog.astro +41 -41
- package/components/Divider/Divider.astro +17 -17
- package/components/Drawer/Drawer.astro +49 -49
- package/components/Drawer/DrawerFooter.astro +14 -14
- package/components/Drawer/DrawerHeader.astro +31 -31
- package/components/FieldDescription/FieldDescription.astro +13 -13
- package/components/FieldGroup/FieldGroup.astro +31 -31
- package/components/FieldLegend/FieldLegend.astro +15 -15
- package/components/FieldSet/FieldSet.astro +15 -15
- package/components/Form/Form.astro +15 -15
- package/components/IconButton/IconButton.astro +26 -26
- package/components/List/List.astro +36 -36
- package/components/ListItem/ListItem.astro +118 -118
- package/components/Progress/Progress.astro +41 -40
- package/components/Radio/Radio.astro +70 -70
- package/components/Radio/RadioInput.astro +24 -24
- package/components/Range/Range.astro +136 -136
- package/components/Select/Select.astro +106 -106
- package/components/Switch/Switch.astro +101 -101
- package/components/Switch/SwitchInput.astro +25 -25
- package/components/Table/Body.astro +13 -13
- package/components/Table/Cell.astro +13 -13
- package/components/Table/Column.astro +15 -15
- package/components/Table/ColumnGroup.astro +13 -13
- package/components/Table/Head.astro +13 -13
- package/components/Table/HeaderCell.astro +13 -13
- package/components/Table/Row.astro +13 -13
- package/components/Table/Table.astro +18 -18
- package/components/Table/index.ts +20 -20
- package/components/Tabs/Tabs.astro +28 -28
- package/components/Tabs/TabsItem.astro +47 -47
- package/components/Tabs/TabsPanel.astro +21 -21
- package/components/Tabs/TabsTab.astro +19 -19
- package/components/Tabs/index.ts +14 -14
- package/components/TextField/TextField.astro +128 -128
- package/components/Textarea/Textarea.astro +106 -106
- package/components/Toast/Toast.astro +42 -42
- package/components/ToggleButton/ToggleButton.astro +53 -53
- package/components/ToggleGroup/ToggleGroup.astro +49 -49
- package/components/Tooltip/Tooltip.astro +30 -30
- package/core/normalize.css +194 -194
- package/core/palette.css +59 -59
- package/core/utils.css +71 -71
- package/css/components/accordion.css +174 -174
- package/css/components/anchor.css +27 -27
- package/css/components/avatar.css +65 -65
- package/css/components/badge.css +107 -107
- package/css/components/button-group.css +179 -179
- package/css/components/button.css +215 -215
- package/css/components/callout.css +109 -109
- package/css/components/card.css +117 -117
- package/css/components/checkbox.css +205 -205
- package/css/components/chip.css +87 -87
- package/css/components/description-list.css +80 -80
- package/css/components/dialog.css +68 -68
- package/css/components/divider.css +20 -20
- package/css/components/drawer.css +171 -171
- package/css/components/form.css +146 -146
- package/css/components/icon-button.css +139 -139
- package/css/components/link.css +21 -21
- package/css/components/list.css +345 -345
- package/css/components/progress.css +102 -97
- package/css/components/radio.css +172 -172
- package/css/components/range.css +337 -337
- package/css/components/select.css +169 -169
- package/css/components/spinner.css +37 -37
- package/css/components/switch.css +268 -268
- package/css/components/table.css +179 -179
- package/css/components/tabs.css +83 -83
- package/css/components/text-field.css +450 -450
- package/css/components/text-input.css +64 -64
- package/css/components/textarea.css +24 -24
- package/css/components/toast.css +161 -161
- package/css/components/toggle-button.css +87 -87
- package/css/components/toggle-group.css +56 -56
- package/css/components/tooltip.css +67 -67
- package/css/components/typography.css +585 -585
- package/css/components.css +41 -41
- package/css/imports.css +16 -16
- package/css/js/checkbox.js +21 -21
- package/css/js/toast.js +94 -94
- package/css/theme.css +132 -132
- package/dist/op.css +65 -65
- package/dist/op.css.map +1 -1
- package/dist/opui.components.css +5159 -5154
- package/dist/opui.components.css.map +1 -1
- package/dist/opui.css +5668 -5663
- package/dist/opui.css.map +1 -1
- package/env.d.ts +14 -14
- package/open-props.css +9 -9
- package/package.json +81 -81
package/MIGRATING.md
CHANGED
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
# Migrating from v4 to v5
|
|
2
|
-
|
|
3
|
-
v5 prefixes every OPUI-owned class with `ui-`. The component prop API is unchanged; only the rendered class names change.
|
|
4
|
-
|
|
5
|
-
If you use the framework component (e.g. `<Button size="small" variant="outlined">`), you don't need to do anything — the component emits the prefixed classes for you.
|
|
6
|
-
|
|
7
|
-
If you use raw HTML or write CSS that targets library classes, you must rename every reference:
|
|
8
|
-
|
|
9
|
-
```diff
|
|
10
|
-
- <button class="button outlined small">Save</button>
|
|
11
|
-
+ <button class="ui-button ui-outlined ui-small">Save</button>
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
```diff
|
|
15
|
-
- .button.filled { /* override */ }
|
|
16
|
-
+ .ui-button.ui-filled { /* override */ }
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
The full list of renamed tokens is in [CHANGELOG.md](./CHANGELOG.md#500). Run a project-wide find/replace per token, then visually smoke test.
|
|
20
|
-
|
|
21
|
-
CSS custom properties (`--primary`, `--surface-default`, `--size-3`, …) are unchanged.
|
|
22
|
-
|
|
23
|
-
# Migrating from v3 to v4
|
|
24
|
-
|
|
25
|
-
v4 is a full re-platform.
|
|
26
|
-
|
|
27
|
-
## 1. `import "opui-css"` still works
|
|
28
|
-
|
|
29
|
-
The default export still resolves to a complete, ready-to-use stylesheet — just under a different filename. No code change needed unless you want one.
|
|
30
|
-
|
|
31
|
-
```diff
|
|
32
|
-
- import "opui-css" // resolved to dist/theme-two/theme-two.css
|
|
33
|
-
+ import "opui-css" // now resolves to dist/opui.css (single theme)
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
If you imported `theme-one` specifically, you need to either accept the new theme or vendor the v3 stylesheet into your repo:
|
|
37
|
-
|
|
38
|
-
```diff
|
|
39
|
-
- import "opui-css/theme-one"
|
|
40
|
-
- import "opui-css/theme-one/components"
|
|
41
|
-
+ import "opui-css" // or your own override layer
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## 2. `opui-css/open-props` is unchanged
|
|
45
|
-
|
|
46
|
-
```js
|
|
47
|
-
import "opui-css/open-props" // still points at compiled Open Props tokens
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## 3. The other `dist/` subpaths
|
|
51
|
-
|
|
52
|
-
| v3 | v4 |
|
|
53
|
-
| ---------------------------------------- | ----------------------------------- |
|
|
54
|
-
| `opui-css/dist/theme-two/theme-two.css` | `opui-css/dist/opui.css` |
|
|
55
|
-
| `opui-css/dist/theme-two/components.css` | `opui-css/dist/opui.components.css` |
|
|
56
|
-
| `opui-css/dist/theme-one/theme-one.css` | removed |
|
|
57
|
-
| `opui-css/dist/theme-one/components.css` | removed |
|
|
58
|
-
| `opui-css/dist/op.css` | `opui-css/dist/op.css` (unchanged) |
|
|
59
|
-
|
|
60
|
-
## 4. Source layout moved
|
|
61
|
-
|
|
62
|
-
If you were importing from `src/`:
|
|
63
|
-
|
|
64
|
-
```diff
|
|
65
|
-
- @import "opui-css/src/components/button.css";
|
|
66
|
-
+ @import "opui-css/css/components/button.css";
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
The component CSS now lives under `css/`. The pre-bundled output stays in `dist/`.
|
|
70
|
-
|
|
71
|
-
## 5. Pick a theme — there's only one
|
|
72
|
-
|
|
73
|
-
`theme-one` and `theme-two` are removed. The shipped theme lives in `css/theme.css`. To customise, override variables in a layer:
|
|
74
|
-
|
|
75
|
-
```css
|
|
76
|
-
@layer theme {
|
|
77
|
-
:root {
|
|
78
|
-
--primary: oklch(60% 0.2 250);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## 6. `open-props` is now a peer dependency
|
|
84
|
-
|
|
85
|
-
v3 had `open-props` as a regular dependency. v4 makes it a peer so you control the version:
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
pnpm add open-props
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
## 7. New: Astro components
|
|
92
|
-
|
|
93
|
-
```astro
|
|
94
|
-
---
|
|
95
|
-
import { Button, Dialog, Tabs } from "opui-css/astro"
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
<Button variant="primary">Save</Button>
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
`astro` is an _optional_ peer — only required if you actually import from `opui-css/astro`. Pure-CSS consumers won't see a peer warning.
|
|
102
|
-
|
|
103
|
-
Astro components emit prefixed `ui-` classes (see the v4 → v5 section at the top of this file). Raw HTML and CSS overrides must use those prefixed names.
|
|
104
|
-
|
|
105
|
-
## 8. Cascade layers
|
|
106
|
-
|
|
107
|
-
v4 declares the layer order in `css/imports.css` / `dist/opui.css`:
|
|
108
|
-
|
|
109
|
-
```css
|
|
110
|
-
@layer openprops, normalize, theme, components.root, components.extended, utils;
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
Put your overrides in a later layer or unlayered. If your app already declared `@layer` with a different order, reconcile or import `dist/opui.components.css` and own the layer order yourself.
|
|
114
|
-
|
|
115
|
-
## 9. Copy/paste is still supported
|
|
116
|
-
|
|
117
|
-
The source files under `components/` and `css/components/` are unminified and free to vendor in — the license is unchanged (MIT).
|
|
118
|
-
|
|
119
|
-
## 10. Pinning v3
|
|
120
|
-
|
|
121
|
-
If you're not ready to migrate, pin the last v3 release:
|
|
122
|
-
|
|
123
|
-
```json
|
|
124
|
-
{ "dependencies": { "opui-css": "3.3.5" } }
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
v3 will not receive further updates.
|
|
1
|
+
# Migrating from v4 to v5
|
|
2
|
+
|
|
3
|
+
v5 prefixes every OPUI-owned class with `ui-`. The component prop API is unchanged; only the rendered class names change.
|
|
4
|
+
|
|
5
|
+
If you use the framework component (e.g. `<Button size="small" variant="outlined">`), you don't need to do anything — the component emits the prefixed classes for you.
|
|
6
|
+
|
|
7
|
+
If you use raw HTML or write CSS that targets library classes, you must rename every reference:
|
|
8
|
+
|
|
9
|
+
```diff
|
|
10
|
+
- <button class="button outlined small">Save</button>
|
|
11
|
+
+ <button class="ui-button ui-outlined ui-small">Save</button>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```diff
|
|
15
|
+
- .button.filled { /* override */ }
|
|
16
|
+
+ .ui-button.ui-filled { /* override */ }
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The full list of renamed tokens is in [CHANGELOG.md](./CHANGELOG.md#500). Run a project-wide find/replace per token, then visually smoke test.
|
|
20
|
+
|
|
21
|
+
CSS custom properties (`--primary`, `--surface-default`, `--size-3`, …) are unchanged.
|
|
22
|
+
|
|
23
|
+
# Migrating from v3 to v4
|
|
24
|
+
|
|
25
|
+
v4 is a full re-platform.
|
|
26
|
+
|
|
27
|
+
## 1. `import "opui-css"` still works
|
|
28
|
+
|
|
29
|
+
The default export still resolves to a complete, ready-to-use stylesheet — just under a different filename. No code change needed unless you want one.
|
|
30
|
+
|
|
31
|
+
```diff
|
|
32
|
+
- import "opui-css" // resolved to dist/theme-two/theme-two.css
|
|
33
|
+
+ import "opui-css" // now resolves to dist/opui.css (single theme)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
If you imported `theme-one` specifically, you need to either accept the new theme or vendor the v3 stylesheet into your repo:
|
|
37
|
+
|
|
38
|
+
```diff
|
|
39
|
+
- import "opui-css/theme-one"
|
|
40
|
+
- import "opui-css/theme-one/components"
|
|
41
|
+
+ import "opui-css" // or your own override layer
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 2. `opui-css/open-props` is unchanged
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
import "opui-css/open-props" // still points at compiled Open Props tokens
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## 3. The other `dist/` subpaths
|
|
51
|
+
|
|
52
|
+
| v3 | v4 |
|
|
53
|
+
| ---------------------------------------- | ----------------------------------- |
|
|
54
|
+
| `opui-css/dist/theme-two/theme-two.css` | `opui-css/dist/opui.css` |
|
|
55
|
+
| `opui-css/dist/theme-two/components.css` | `opui-css/dist/opui.components.css` |
|
|
56
|
+
| `opui-css/dist/theme-one/theme-one.css` | removed |
|
|
57
|
+
| `opui-css/dist/theme-one/components.css` | removed |
|
|
58
|
+
| `opui-css/dist/op.css` | `opui-css/dist/op.css` (unchanged) |
|
|
59
|
+
|
|
60
|
+
## 4. Source layout moved
|
|
61
|
+
|
|
62
|
+
If you were importing from `src/`:
|
|
63
|
+
|
|
64
|
+
```diff
|
|
65
|
+
- @import "opui-css/src/components/button.css";
|
|
66
|
+
+ @import "opui-css/css/components/button.css";
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The component CSS now lives under `css/`. The pre-bundled output stays in `dist/`.
|
|
70
|
+
|
|
71
|
+
## 5. Pick a theme — there's only one
|
|
72
|
+
|
|
73
|
+
`theme-one` and `theme-two` are removed. The shipped theme lives in `css/theme.css`. To customise, override variables in a layer:
|
|
74
|
+
|
|
75
|
+
```css
|
|
76
|
+
@layer theme {
|
|
77
|
+
:root {
|
|
78
|
+
--primary: oklch(60% 0.2 250);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 6. `open-props` is now a peer dependency
|
|
84
|
+
|
|
85
|
+
v3 had `open-props` as a regular dependency. v4 makes it a peer so you control the version:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pnpm add open-props
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## 7. New: Astro components
|
|
92
|
+
|
|
93
|
+
```astro
|
|
94
|
+
---
|
|
95
|
+
import { Button, Dialog, Tabs } from "opui-css/astro"
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
<Button variant="primary">Save</Button>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`astro` is an _optional_ peer — only required if you actually import from `opui-css/astro`. Pure-CSS consumers won't see a peer warning.
|
|
102
|
+
|
|
103
|
+
Astro components emit prefixed `ui-` classes (see the v4 → v5 section at the top of this file). Raw HTML and CSS overrides must use those prefixed names.
|
|
104
|
+
|
|
105
|
+
## 8. Cascade layers
|
|
106
|
+
|
|
107
|
+
v4 declares the layer order in `css/imports.css` / `dist/opui.css`:
|
|
108
|
+
|
|
109
|
+
```css
|
|
110
|
+
@layer openprops, normalize, theme, components.root, components.extended, utils;
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Put your overrides in a later layer or unlayered. If your app already declared `@layer` with a different order, reconcile or import `dist/opui.components.css` and own the layer order yourself.
|
|
114
|
+
|
|
115
|
+
## 9. Copy/paste is still supported
|
|
116
|
+
|
|
117
|
+
The source files under `components/` and `css/components/` are unminified and free to vendor in — the license is unchanged (MIT).
|
|
118
|
+
|
|
119
|
+
## 10. Pinning v3
|
|
120
|
+
|
|
121
|
+
If you're not ready to migrate, pin the last v3 release:
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{ "dependencies": { "opui-css": "3.3.5" } }
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
v3 will not receive further updates.
|
package/README.md
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
# Open Props UI
|
|
2
|
-
|
|
3
|
-
A CSS UI library exploring how next-gen HTML & CSS features can change the way we create components. Built on top of [Open Props](https://open-props.style/) and ships [Astro](https://astro.build/) components alongside framework-agnostic CSS.
|
|
4
|
-
|
|
5
|
-
- Docs: [open-props-ui.netlify.app](https://open-props-ui.netlify.app/)
|
|
6
|
-
- Source: [github.com/felix-bohlin/ui](https://github.com/felix-bohlin/ui)
|
|
7
|
-
|
|
8
|
-
## Install
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
pnpm add opui-css open-props
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Peer dependencies:
|
|
15
|
-
|
|
16
|
-
- `astro` `^6` (only required if you use the Astro components)
|
|
17
|
-
- `open-props` `^1`
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
### Astro components
|
|
22
|
-
|
|
23
|
-
```astro
|
|
24
|
-
---
|
|
25
|
-
import "opui-css/css/imports.css"
|
|
26
|
-
import { Button, Card } from "opui-css/astro"
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
<Card>
|
|
30
|
-
<Button variant="primary">Click me</Button>
|
|
31
|
-
</Card>
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Plain HTML + CSS (no build step)
|
|
35
|
-
|
|
36
|
-
Drop a pre-bundled stylesheet into any page and use the documented class names:
|
|
37
|
-
|
|
38
|
-
```html
|
|
39
|
-
<link rel="stylesheet" href="https://unpkg.com/opui-css/dist/opui.css" />
|
|
40
|
-
|
|
41
|
-
<button class="ui-button ui-primary">Click me</button>
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
`dist/opui.css` is a single self-contained file (Open Props + normalize + theme + every component + utils, in the correct cascade layers). `dist/opui.components.css` is the same minus tokens and reset for users who already have those.
|
|
45
|
-
|
|
46
|
-
If you do have a bundler that resolves CSS `@import`s (Vite, Astro, webpack, …), import the source instead so you only ship what you use:
|
|
47
|
-
|
|
48
|
-
```css
|
|
49
|
-
@import "opui-css/css/imports.css"; /* same content as dist/opui.css */
|
|
50
|
-
@import "opui-css/css/components/button.css"; /* or pick à la carte */
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Cascade layers
|
|
54
|
-
|
|
55
|
-
The library defines this layer order:
|
|
56
|
-
|
|
57
|
-
```css
|
|
58
|
-
@layer openprops, normalize, theme, components.root, components.extended, utils;
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Wrap your own styles in a layer above `utils` (or unlayered) to override.
|
|
62
|
-
|
|
63
|
-
## Entry points
|
|
64
|
-
|
|
65
|
-
| Import | What it gives you |
|
|
66
|
-
| ----------------------------------- | --------------------------------------------- |
|
|
67
|
-
| `opui-css` | Pre-bundled: everything in one file (default) |
|
|
68
|
-
| `opui-css/open-props` | Pre-bundled: Open Props tokens only |
|
|
69
|
-
| `opui-css/dist/opui.css` | Same as default — explicit path |
|
|
70
|
-
| `opui-css/dist/opui.components.css` | Pre-bundled: components only |
|
|
71
|
-
| `opui-css/dist/op.css` | Same as `opui-css/open-props` — explicit path |
|
|
72
|
-
| `opui-css/css/imports.css` | Source: everything (resolved by your bundler) |
|
|
73
|
-
| `opui-css/css/components.css` | All component styles (no tokens / reset) |
|
|
74
|
-
| `opui-css/css/components/*.css` | One component at a time |
|
|
75
|
-
| `opui-css/core/normalize.css` | CSS reset |
|
|
76
|
-
| `opui-css/core/palette.css` | Extra OKLCH palette |
|
|
77
|
-
| `opui-css/core/utils.css` | Utility classes |
|
|
78
|
-
| `opui-css/astro` | All Astro components |
|
|
79
|
-
| `opui-css/components/*` | Individual Astro component sources |
|
|
80
|
-
|
|
81
|
-
## Contributing
|
|
82
|
-
|
|
83
|
-
See [`CONTRIBUTING.md`](./CONTRIBUTING.md) for the component-authoring pattern.
|
|
84
|
-
|
|
85
|
-
## License
|
|
86
|
-
|
|
87
|
-
[MIT](./LICENSE) © Felix Bohlin
|
|
1
|
+
# Open Props UI
|
|
2
|
+
|
|
3
|
+
A CSS UI library exploring how next-gen HTML & CSS features can change the way we create components. Built on top of [Open Props](https://open-props.style/) and ships [Astro](https://astro.build/) components alongside framework-agnostic CSS.
|
|
4
|
+
|
|
5
|
+
- Docs: [open-props-ui.netlify.app](https://open-props-ui.netlify.app/)
|
|
6
|
+
- Source: [github.com/felix-bohlin/ui](https://github.com/felix-bohlin/ui)
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pnpm add opui-css open-props
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Peer dependencies:
|
|
15
|
+
|
|
16
|
+
- `astro` `^6` (only required if you use the Astro components)
|
|
17
|
+
- `open-props` `^1`
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### Astro components
|
|
22
|
+
|
|
23
|
+
```astro
|
|
24
|
+
---
|
|
25
|
+
import "opui-css/css/imports.css"
|
|
26
|
+
import { Button, Card } from "opui-css/astro"
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
<Card>
|
|
30
|
+
<Button variant="primary">Click me</Button>
|
|
31
|
+
</Card>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Plain HTML + CSS (no build step)
|
|
35
|
+
|
|
36
|
+
Drop a pre-bundled stylesheet into any page and use the documented class names:
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
<link rel="stylesheet" href="https://unpkg.com/opui-css/dist/opui.css" />
|
|
40
|
+
|
|
41
|
+
<button class="ui-button ui-primary">Click me</button>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`dist/opui.css` is a single self-contained file (Open Props + normalize + theme + every component + utils, in the correct cascade layers). `dist/opui.components.css` is the same minus tokens and reset for users who already have those.
|
|
45
|
+
|
|
46
|
+
If you do have a bundler that resolves CSS `@import`s (Vite, Astro, webpack, …), import the source instead so you only ship what you use:
|
|
47
|
+
|
|
48
|
+
```css
|
|
49
|
+
@import "opui-css/css/imports.css"; /* same content as dist/opui.css */
|
|
50
|
+
@import "opui-css/css/components/button.css"; /* or pick à la carte */
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Cascade layers
|
|
54
|
+
|
|
55
|
+
The library defines this layer order:
|
|
56
|
+
|
|
57
|
+
```css
|
|
58
|
+
@layer openprops, normalize, theme, components.root, components.extended, utils;
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Wrap your own styles in a layer above `utils` (or unlayered) to override.
|
|
62
|
+
|
|
63
|
+
## Entry points
|
|
64
|
+
|
|
65
|
+
| Import | What it gives you |
|
|
66
|
+
| ----------------------------------- | --------------------------------------------- |
|
|
67
|
+
| `opui-css` | Pre-bundled: everything in one file (default) |
|
|
68
|
+
| `opui-css/open-props` | Pre-bundled: Open Props tokens only |
|
|
69
|
+
| `opui-css/dist/opui.css` | Same as default — explicit path |
|
|
70
|
+
| `opui-css/dist/opui.components.css` | Pre-bundled: components only |
|
|
71
|
+
| `opui-css/dist/op.css` | Same as `opui-css/open-props` — explicit path |
|
|
72
|
+
| `opui-css/css/imports.css` | Source: everything (resolved by your bundler) |
|
|
73
|
+
| `opui-css/css/components.css` | All component styles (no tokens / reset) |
|
|
74
|
+
| `opui-css/css/components/*.css` | One component at a time |
|
|
75
|
+
| `opui-css/core/normalize.css` | CSS reset |
|
|
76
|
+
| `opui-css/core/palette.css` | Extra OKLCH palette |
|
|
77
|
+
| `opui-css/core/utils.css` | Utility classes |
|
|
78
|
+
| `opui-css/astro` | All Astro components |
|
|
79
|
+
| `opui-css/components/*` | Individual Astro component sources |
|
|
80
|
+
|
|
81
|
+
## Contributing
|
|
82
|
+
|
|
83
|
+
See [`CONTRIBUTING.md`](./CONTRIBUTING.md) for the component-authoring pattern.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
[MIT](./LICENSE) © Felix Bohlin
|
package/astro/index.ts
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
export { default as Accordion } from "../components/Accordion/Accordion.astro"
|
|
2
|
-
export { default as Anchor } from "../components/Anchor/Anchor.astro"
|
|
3
|
-
export { default as Avatar } from "../components/Avatar/Avatar.astro"
|
|
4
|
-
export { default as Badge } from "../components/Badge/Badge.astro"
|
|
5
|
-
export { default as Button } from "../components/Button/Button.astro"
|
|
6
|
-
export { default as ButtonGroup } from "../components/ButtonGroup/ButtonGroup.astro"
|
|
7
|
-
export { default as Callout } from "../components/Callout/Callout.astro"
|
|
8
|
-
export { default as Card } from "../components/Card/Card.astro"
|
|
9
|
-
export { default as Checkbox } from "../components/Checkbox/Checkbox.astro"
|
|
10
|
-
export { default as CheckboxInput } from "../components/Checkbox/CheckboxInput.astro"
|
|
11
|
-
export { default as Chip } from "../components/Chip/Chip.astro"
|
|
12
|
-
export { default as ClassicSelect } from "../components/ClassicSelect/ClassicSelect.astro"
|
|
13
|
-
export { default as DescriptionList } from "../components/DescriptionList/index"
|
|
14
|
-
export { default as Dialog } from "../components/Dialog/Dialog.astro"
|
|
15
|
-
export { default as Divider } from "../components/Divider/Divider.astro"
|
|
16
|
-
export { default as Drawer } from "../components/Drawer/Drawer.astro"
|
|
17
|
-
export { default as DrawerFooter } from "../components/Drawer/DrawerFooter.astro"
|
|
18
|
-
export { default as DrawerHeader } from "../components/Drawer/DrawerHeader.astro"
|
|
19
|
-
export { default as FieldDescription } from "../components/FieldDescription/FieldDescription.astro"
|
|
20
|
-
export { default as FieldGroup } from "../components/FieldGroup/FieldGroup.astro"
|
|
21
|
-
export { default as FieldLegend } from "../components/FieldLegend/FieldLegend.astro"
|
|
22
|
-
export { default as FieldSet } from "../components/FieldSet/FieldSet.astro"
|
|
23
|
-
export { default as Form } from "../components/Form/Form.astro"
|
|
24
|
-
export { default as IconButton } from "../components/IconButton/IconButton.astro"
|
|
25
|
-
export { default as List } from "../components/List/List.astro"
|
|
26
|
-
export { default as ListItem } from "../components/ListItem/ListItem.astro"
|
|
27
|
-
export { default as Progress } from "../components/Progress/Progress.astro"
|
|
28
|
-
export { default as Radio } from "../components/Radio/Radio.astro"
|
|
29
|
-
export { default as RadioInput } from "../components/Radio/RadioInput.astro"
|
|
30
|
-
export { default as Range } from "../components/Range/Range.astro"
|
|
31
|
-
export { default as Select } from "../components/Select/Select.astro"
|
|
32
|
-
export { default as Switch } from "../components/Switch/Switch.astro"
|
|
33
|
-
export { default as SwitchInput } from "../components/Switch/SwitchInput.astro"
|
|
34
|
-
export { default as Tabs } from "../components/Tabs/index"
|
|
35
|
-
export {
|
|
36
|
-
TabsItem,
|
|
37
|
-
Tab as TabsTab,
|
|
38
|
-
Panel as TabsPanel,
|
|
39
|
-
} from "../components/Tabs/index"
|
|
40
|
-
export { default as Table } from "../components/Table/index"
|
|
41
|
-
export { default as Textarea } from "../components/Textarea/Textarea.astro"
|
|
42
|
-
export { default as TextField } from "../components/TextField/TextField.astro"
|
|
43
|
-
export { default as Toast } from "../components/Toast/Toast.astro"
|
|
44
|
-
export { default as Tooltip } from "../components/Tooltip/Tooltip.astro"
|
|
45
|
-
export { default as ToggleButton } from "../components/ToggleButton/ToggleButton.astro"
|
|
46
|
-
export { default as ToggleGroup } from "../components/ToggleGroup/ToggleGroup.astro"
|
|
1
|
+
export { default as Accordion } from "../components/Accordion/Accordion.astro"
|
|
2
|
+
export { default as Anchor } from "../components/Anchor/Anchor.astro"
|
|
3
|
+
export { default as Avatar } from "../components/Avatar/Avatar.astro"
|
|
4
|
+
export { default as Badge } from "../components/Badge/Badge.astro"
|
|
5
|
+
export { default as Button } from "../components/Button/Button.astro"
|
|
6
|
+
export { default as ButtonGroup } from "../components/ButtonGroup/ButtonGroup.astro"
|
|
7
|
+
export { default as Callout } from "../components/Callout/Callout.astro"
|
|
8
|
+
export { default as Card } from "../components/Card/Card.astro"
|
|
9
|
+
export { default as Checkbox } from "../components/Checkbox/Checkbox.astro"
|
|
10
|
+
export { default as CheckboxInput } from "../components/Checkbox/CheckboxInput.astro"
|
|
11
|
+
export { default as Chip } from "../components/Chip/Chip.astro"
|
|
12
|
+
export { default as ClassicSelect } from "../components/ClassicSelect/ClassicSelect.astro"
|
|
13
|
+
export { default as DescriptionList } from "../components/DescriptionList/index"
|
|
14
|
+
export { default as Dialog } from "../components/Dialog/Dialog.astro"
|
|
15
|
+
export { default as Divider } from "../components/Divider/Divider.astro"
|
|
16
|
+
export { default as Drawer } from "../components/Drawer/Drawer.astro"
|
|
17
|
+
export { default as DrawerFooter } from "../components/Drawer/DrawerFooter.astro"
|
|
18
|
+
export { default as DrawerHeader } from "../components/Drawer/DrawerHeader.astro"
|
|
19
|
+
export { default as FieldDescription } from "../components/FieldDescription/FieldDescription.astro"
|
|
20
|
+
export { default as FieldGroup } from "../components/FieldGroup/FieldGroup.astro"
|
|
21
|
+
export { default as FieldLegend } from "../components/FieldLegend/FieldLegend.astro"
|
|
22
|
+
export { default as FieldSet } from "../components/FieldSet/FieldSet.astro"
|
|
23
|
+
export { default as Form } from "../components/Form/Form.astro"
|
|
24
|
+
export { default as IconButton } from "../components/IconButton/IconButton.astro"
|
|
25
|
+
export { default as List } from "../components/List/List.astro"
|
|
26
|
+
export { default as ListItem } from "../components/ListItem/ListItem.astro"
|
|
27
|
+
export { default as Progress } from "../components/Progress/Progress.astro"
|
|
28
|
+
export { default as Radio } from "../components/Radio/Radio.astro"
|
|
29
|
+
export { default as RadioInput } from "../components/Radio/RadioInput.astro"
|
|
30
|
+
export { default as Range } from "../components/Range/Range.astro"
|
|
31
|
+
export { default as Select } from "../components/Select/Select.astro"
|
|
32
|
+
export { default as Switch } from "../components/Switch/Switch.astro"
|
|
33
|
+
export { default as SwitchInput } from "../components/Switch/SwitchInput.astro"
|
|
34
|
+
export { default as Tabs } from "../components/Tabs/index"
|
|
35
|
+
export {
|
|
36
|
+
TabsItem,
|
|
37
|
+
Tab as TabsTab,
|
|
38
|
+
Panel as TabsPanel,
|
|
39
|
+
} from "../components/Tabs/index"
|
|
40
|
+
export { default as Table } from "../components/Table/index"
|
|
41
|
+
export { default as Textarea } from "../components/Textarea/Textarea.astro"
|
|
42
|
+
export { default as TextField } from "../components/TextField/TextField.astro"
|
|
43
|
+
export { default as Toast } from "../components/Toast/Toast.astro"
|
|
44
|
+
export { default as Tooltip } from "../components/Tooltip/Tooltip.astro"
|
|
45
|
+
export { default as ToggleButton } from "../components/ToggleButton/ToggleButton.astro"
|
|
46
|
+
export { default as ToggleGroup } from "../components/ToggleGroup/ToggleGroup.astro"
|