@unframed/cli 0.9.0 → 0.11.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/skill/unframed/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: Builds UI with Unframed web components (@unframed/core, @unframed/r
|
|
|
5
5
|
|
|
6
6
|
# Unframed UI
|
|
7
7
|
|
|
8
|
-
Unframed 0.
|
|
8
|
+
Unframed 0.11.0: accessible UI components as standard custom elements (Lit). Every tag starts with `uf-`. They work in plain HTML and every framework; React, Vue and Angular have wrapper packages for typed props, events and form bindings.
|
|
9
9
|
|
|
10
10
|
## Before writing code
|
|
11
11
|
|
|
@@ -35,6 +35,7 @@ Unframed 0.9.0: accessible UI components as standard custom elements (Lit). Ever
|
|
|
35
35
|
| Component | Tags | Import |
|
|
36
36
|
|---|---|---|
|
|
37
37
|
| Accordion: A stack of sections that expand and collapse. | `<uf-accordion>` `<uf-accordion-item>` | `@unframed/core/accordion` |
|
|
38
|
+
| Alert: Shows a message in the page, by meaning: info, success, warning or danger. | `<uf-alert>` | `@unframed/core/alert` |
|
|
38
39
|
| Avatar: Shows a person's picture, initials or icon. | `<uf-avatar>` | `@unframed/core/avatar` |
|
|
39
40
|
| Badge: Labels a status, a category or a count. | `<uf-badge>` | `@unframed/core/badge` |
|
|
40
41
|
| Breadcrumbs: Shows the path to the current page. | `<uf-breadcrumbs>` `<uf-breadcrumb-item>` | `@unframed/core/breadcrumbs` |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Unframed 0.
|
|
1
|
+
# Unframed 0.11.0 components
|
|
2
2
|
|
|
3
3
|
## Accordion
|
|
4
4
|
|
|
@@ -94,6 +94,119 @@ Add `multiple` to let several items stay open.
|
|
|
94
94
|
|---|---|
|
|
95
95
|
| `--uf-accordion-padding` | Horizontal padding of header and content. |
|
|
96
96
|
|
|
97
|
+
## Alert
|
|
98
|
+
|
|
99
|
+
A message in the page, like "Your trial ends in 3 days" or "We couldn't save
|
|
100
|
+
your changes". Unlike a toast it stays where it is until it's dismissed.
|
|
101
|
+
|
|
102
|
+
`warning` and `danger` alerts are announced right away (`role="alert"`), the
|
|
103
|
+
others politely (`role="status"`). Assistive tech announces an alert when it's
|
|
104
|
+
added to the page or shown, not when the page loads with it.
|
|
105
|
+
|
|
106
|
+
Tags: `<uf-alert>`. Import: `import '@unframed/core/alert';` (or `npx @unframed/cli add alert` to copy the source).
|
|
107
|
+
|
|
108
|
+
### Variants
|
|
109
|
+
|
|
110
|
+
Six colors by meaning, each with its icon. `info` is the default.
|
|
111
|
+
|
|
112
|
+
```html
|
|
113
|
+
<uf-alert>A new version is available.</uf-alert>
|
|
114
|
+
<uf-alert variant="success">Your changes were published.</uf-alert>
|
|
115
|
+
<uf-alert variant="warning">Your trial ends in 3 days.</uf-alert>
|
|
116
|
+
<uf-alert variant="danger">We couldn't charge your card.</uf-alert>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
- `warning` and `danger` alerts are announced right away, the others politely. Assistive tech announces an alert when it appears, so add it to the page (or `show()` it) when the message happens.
|
|
120
|
+
|
|
121
|
+
### Heading and actions
|
|
122
|
+
|
|
123
|
+
```html
|
|
124
|
+
<uf-alert variant="warning" heading="Your trial ends in 3 days">
|
|
125
|
+
Choose a plan to keep your projects and invoices.
|
|
126
|
+
<uf-button slot="actions" size="sm">Choose a plan</uf-button>
|
|
127
|
+
<uf-button slot="actions" size="sm" variant="ghost">Remind me later</uf-button>
|
|
128
|
+
</uf-alert>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Closable
|
|
132
|
+
|
|
133
|
+
`closable` adds a close button that hides the alert and emits `uf-hide`. `show()` brings it back.
|
|
134
|
+
|
|
135
|
+
```html
|
|
136
|
+
<uf-alert variant="success" closable>Your changes were saved.</uf-alert>
|
|
137
|
+
|
|
138
|
+
<script>
|
|
139
|
+
document.querySelector('uf-alert').addEventListener('uf-hide', () => console.log('closed'));
|
|
140
|
+
</script>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Without an icon, or with your own
|
|
144
|
+
|
|
145
|
+
```html
|
|
146
|
+
<uf-alert variant="neutral" without-icon>Maintenance on Sunday from 02:00 to 04:00 UTC.</uf-alert>
|
|
147
|
+
<uf-alert variant="accent">
|
|
148
|
+
<uf-icon slot="icon" name="user"></uf-icon>
|
|
149
|
+
John Smith shared a project with you.
|
|
150
|
+
</uf-alert>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### `<uf-alert>` API
|
|
154
|
+
|
|
155
|
+
#### Attributes and properties
|
|
156
|
+
|
|
157
|
+
| Attribute | Property | Type | Default | Description |
|
|
158
|
+
|---|---|---|---|---|
|
|
159
|
+
| `variant` | | `AlertVariant` | `'info'` | Color, icon and urgency, by meaning: `neutral`, `accent`, `info`, `success`, `warning` or `danger`. |
|
|
160
|
+
| `heading` | | `string \| undefined` | | Bold first line. |
|
|
161
|
+
| `closable` | | `boolean` | `false` | Shows a close button that hides the alert. |
|
|
162
|
+
| `without-icon` | `withoutIcon` | `boolean` | `false` | Hides the icon. |
|
|
163
|
+
|
|
164
|
+
#### Methods
|
|
165
|
+
|
|
166
|
+
| Method | Description |
|
|
167
|
+
|---|---|
|
|
168
|
+
| `show()` | Shows the alert again after it was hidden. |
|
|
169
|
+
| `hide()` | Hides the alert, like its close button. |
|
|
170
|
+
|
|
171
|
+
#### Events
|
|
172
|
+
|
|
173
|
+
| Event | Type | Description |
|
|
174
|
+
|---|---|---|
|
|
175
|
+
| `uf-show` | `Event` | The alert was shown with `show()`. |
|
|
176
|
+
| `uf-hide` | `Event` | The alert was hidden, with the close button or `hide()`. |
|
|
177
|
+
|
|
178
|
+
#### Slots
|
|
179
|
+
|
|
180
|
+
| Slot | Description |
|
|
181
|
+
|---|---|
|
|
182
|
+
| (default) | The message. |
|
|
183
|
+
| `heading` | The heading, when you need markup. Overrides `heading`. |
|
|
184
|
+
| `icon` | Replaces the variant's icon. |
|
|
185
|
+
| `actions` | Buttons or links below the message. |
|
|
186
|
+
|
|
187
|
+
#### CSS parts
|
|
188
|
+
|
|
189
|
+
| Part | Description |
|
|
190
|
+
|---|---|
|
|
191
|
+
| `base` | The alert. |
|
|
192
|
+
| `icon` | The icon. |
|
|
193
|
+
| `content` | The wrapper around the heading, message and actions. |
|
|
194
|
+
| `heading` | The heading. |
|
|
195
|
+
| `message` | The message. |
|
|
196
|
+
| `actions` | The wrapper around the actions. |
|
|
197
|
+
| `close-button` | The close button, when `closable` is set. |
|
|
198
|
+
|
|
199
|
+
#### CSS custom properties
|
|
200
|
+
|
|
201
|
+
| Property | Description |
|
|
202
|
+
|---|---|
|
|
203
|
+
| `--uf-alert-bg` | Background color. |
|
|
204
|
+
| `--uf-alert-border-color` | Border color. |
|
|
205
|
+
| `--uf-alert-color` | Text color. |
|
|
206
|
+
| `--uf-alert-icon-color` | Icon color. |
|
|
207
|
+
| `--uf-alert-radius` | Corner radius. |
|
|
208
|
+
| `--uf-alert-padding` | Space inside the alert. |
|
|
209
|
+
|
|
97
210
|
## Avatar
|
|
98
211
|
|
|
99
212
|
A picture of a person or an entity. Shows the image when it loads, the
|
|
@@ -207,7 +320,7 @@ Six colors by meaning, in three appearances: `soft` (the default), `solid` and `
|
|
|
207
320
|
|---|---|---|---|---|
|
|
208
321
|
| `variant` | | `BadgeVariant` | `'neutral'` | Color, by meaning: `neutral`, `accent`, `info`, `success`, `warning` or `danger`. |
|
|
209
322
|
| `appearance` | | `BadgeAppearance` | `'soft'` | `soft` (tinted background), `solid` (bold background) or `outline` (border only). |
|
|
210
|
-
| `size` | | `BadgeSize` | `'md'` | Size: `sm` or `
|
|
323
|
+
| `size` | | `BadgeSize` | `'md'` | Size: `sm`, `md` or `lg`. |
|
|
211
324
|
| `dot` | | `boolean` | `false` | Shows a status dot before the text. |
|
|
212
325
|
|
|
213
326
|
#### Slots
|
|
@@ -434,11 +547,11 @@ Every section is optional; empty ones take no space.
|
|
|
434
547
|
</uf-card>
|
|
435
548
|
```
|
|
436
549
|
|
|
437
|
-
###
|
|
550
|
+
### Appearance and orientation
|
|
438
551
|
|
|
439
552
|
```html
|
|
440
|
-
<uf-card
|
|
441
|
-
<uf-card
|
|
553
|
+
<uf-card appearance="elevated">…</uf-card>
|
|
554
|
+
<uf-card appearance="filled">…</uf-card>
|
|
442
555
|
<uf-card orientation="horizontal">
|
|
443
556
|
<img slot="media" src="/cover.png" alt="" />
|
|
444
557
|
Media beside the content.
|
|
@@ -451,7 +564,7 @@ Every section is optional; empty ones take no space.
|
|
|
451
564
|
|
|
452
565
|
| Attribute | Property | Type | Default | Description |
|
|
453
566
|
|---|---|---|---|---|
|
|
454
|
-
| `
|
|
567
|
+
| `appearance` | | `CardAppearance` | `'outline'` | `outline` (a border), `elevated` (a shadow, or an accent glow in dark mode) or `filled` (a tinted background). |
|
|
455
568
|
| `orientation` | | `CardOrientation` | `'vertical'` | `vertical`, or `horizontal` to put the media beside the content. |
|
|
456
569
|
|
|
457
570
|
#### Slots
|
|
@@ -526,6 +639,7 @@ Tags: `<uf-checkbox>`, `<uf-checkbox-group>`. Import: `import '@unframed/core/ch
|
|
|
526
639
|
| `hint` | | `string \| undefined` | | Help text below the label. |
|
|
527
640
|
| `checked` | `defaultChecked` | `boolean` | `false` | Initial state, restored on form reset. Set with the `checked` attribute. |
|
|
528
641
|
| `value` | | `string` | `'on'` | Value submitted with the form when checked. |
|
|
642
|
+
| `size` | | `FieldSize` | `'md'` | Size of the control and its label: `sm`, `md` or `lg`. |
|
|
529
643
|
| `name` | | `string` | `''` | Name submitted with the form. |
|
|
530
644
|
| `disabled` | | `boolean` | `false` | Disables the control. |
|
|
531
645
|
| `required` | | `boolean` | `false` | Makes the control required for form submission. |
|
|
@@ -599,12 +713,6 @@ Tags: `<uf-checkbox>`, `<uf-checkbox-group>`. Import: `import '@unframed/core/ch
|
|
|
599
713
|
|---|---|---|
|
|
600
714
|
| `value` | `string[]` | The values of the checked checkboxes (other than "select all"). |
|
|
601
715
|
|
|
602
|
-
#### Methods
|
|
603
|
-
|
|
604
|
-
| Method | Description |
|
|
605
|
-
|---|---|
|
|
606
|
-
| `sync()` | Updates "select all" to match the other checkboxes. Called automatically on user changes; call it after changing `checked` on a checkbox from code. |
|
|
607
|
-
|
|
608
716
|
#### Events
|
|
609
717
|
|
|
610
718
|
| Event | Type | Description |
|
|
@@ -732,6 +840,9 @@ Type to filter, arrow keys to move, Enter to pick.
|
|
|
732
840
|
| Property | Description |
|
|
733
841
|
|---|---|
|
|
734
842
|
| `--uf-combobox-max-height` | Maximum height of the list before it scrolls. |
|
|
843
|
+
| `--uf-field-bg` | Background of the box. |
|
|
844
|
+
| `--uf-field-border-color` | Border color of the box. |
|
|
845
|
+
| `--uf-field-radius` | Corner radius of the box. |
|
|
735
846
|
|
|
736
847
|
## Date picker
|
|
737
848
|
|
|
@@ -1442,6 +1553,7 @@ Without `multiple`, a new pick replaces the file. `required` makes the form ask
|
|
|
1442
1553
|
| `accept` | | `string \| undefined` | | Accepted files, as in a native file input: extensions (`.pdf`), MIME types (`image/png`) or wildcards (`image/*`), comma-separated. |
|
|
1443
1554
|
| `multiple` | | `boolean` | `false` | Lets users choose more than one file. |
|
|
1444
1555
|
| `max-size` | `maxSize` | `number \| undefined` | | Largest accepted file, in bytes, e.g. `5000000` for 5 MB. |
|
|
1556
|
+
| `size` | | `FieldSize` | `'md'` | Size of the drop zone: `sm`, `md` or `lg`. |
|
|
1445
1557
|
| `name` | | `string` | `''` | Name submitted with the form. |
|
|
1446
1558
|
| `disabled` | | `boolean` | `false` | Disables the control. |
|
|
1447
1559
|
| `required` | | `boolean` | `false` | Makes the control required for form submission. |
|
|
@@ -1703,7 +1815,7 @@ Long ranges collapse around the current page; the number of buttons stays the sa
|
|
|
1703
1815
|
| `pages` | | `number` | `1` | How many pages there are. |
|
|
1704
1816
|
| `siblings` | | `number` | `1` | How many pages to show on each side of the current one. |
|
|
1705
1817
|
| `label` | | `string \| undefined` | | Accessible name of the navigation, e.g. "Search results pages". Defaults to "Pagination", or its translation. |
|
|
1706
|
-
| `size` | | `PaginationSize` | `'md'` | Size: `sm` or `
|
|
1818
|
+
| `size` | | `PaginationSize` | `'md'` | Size: `sm`, `md` or `lg`. |
|
|
1707
1819
|
|
|
1708
1820
|
#### Events
|
|
1709
1821
|
|
|
@@ -1832,7 +1944,7 @@ Leave out `value` when the length of the work is not known.
|
|
|
1832
1944
|
| `label` | | `string \| undefined` | | Visible label, also the bar's accessible name. Without one, it's named "Progress". |
|
|
1833
1945
|
| `show-value` | `showValue` | `boolean` | `false` | Shows the percentage next to the label. |
|
|
1834
1946
|
| `variant` | | `ProgressVariant` | `'accent'` | Color, by meaning: `accent`, `success`, `warning` or `danger`. |
|
|
1835
|
-
| `size` | | `ProgressSize` | `'md'` | Height of the bar: `sm` or `
|
|
1947
|
+
| `size` | | `ProgressSize` | `'md'` | Height of the bar: `sm`, `md` or `lg`. |
|
|
1836
1948
|
|
|
1837
1949
|
#### Slots
|
|
1838
1950
|
|
|
@@ -1889,6 +2001,7 @@ Arrow keys move the selection; only the selected radio is in the tab order.
|
|
|
1889
2001
|
| `label` | | `string \| undefined` | | Visible group label. |
|
|
1890
2002
|
| `hint` | | `string \| undefined` | | Help text below the options. |
|
|
1891
2003
|
| `orientation` | | `'vertical' \| 'horizontal'` | `'vertical'` | Lays the options out in a column or a row. |
|
|
2004
|
+
| `size` | | `FieldSize` | `'md'` | Size of the radios and their labels: `sm`, `md` or `lg`. |
|
|
1892
2005
|
| `name` | | `string` | `''` | Name submitted with the form. |
|
|
1893
2006
|
| `disabled` | | `boolean` | `false` | Disables the control. |
|
|
1894
2007
|
| `required` | | `boolean` | `false` | Makes the control required for form submission. |
|
|
@@ -1965,7 +2078,7 @@ Arrow keys move the selection; only the selected radio is in the tab order.
|
|
|
1965
2078
|
| Property | Description |
|
|
1966
2079
|
|---|---|
|
|
1967
2080
|
| `--uf-radio-size` | Size of the circle. |
|
|
1968
|
-
| `--uf-radio-checked-
|
|
2081
|
+
| `--uf-radio-checked-bg` | Color of the circle when checked. |
|
|
1969
2082
|
|
|
1970
2083
|
## Select
|
|
1971
2084
|
|
|
@@ -2100,6 +2213,7 @@ A native range input underneath: arrow keys, Page Up/Down, Home and End, touch,
|
|
|
2100
2213
|
| `label` | | `string \| undefined` | | Visible label, also the slider's accessible name. |
|
|
2101
2214
|
| `hint` | | `string \| undefined` | | Help text below the slider. |
|
|
2102
2215
|
| `show-value` | `showValue` | `boolean` | `false` | Shows the current value next to the label. |
|
|
2216
|
+
| `size` | | `FieldSize` | `'md'` | Size of the track and handle: `sm`, `md` or `lg`. |
|
|
2103
2217
|
| `name` | | `string` | `''` | Name submitted with the form. |
|
|
2104
2218
|
| `disabled` | | `boolean` | `false` | Disables the control. |
|
|
2105
2219
|
| `required` | | `boolean` | `false` | Makes the control required for form submission. |
|
|
@@ -2153,7 +2267,7 @@ A native range input underneath: arrow keys, Page Up/Down, Home and End, touch,
|
|
|
2153
2267
|
|---|---|
|
|
2154
2268
|
| `--uf-slider-track-height` | Height of the track. |
|
|
2155
2269
|
| `--uf-slider-track-color` | Color of the track's empty part. |
|
|
2156
|
-
| `--uf-slider-
|
|
2270
|
+
| `--uf-slider-indicator-color` | Color of the track up to the handle. |
|
|
2157
2271
|
| `--uf-slider-thumb-size` | Diameter of the handle. |
|
|
2158
2272
|
|
|
2159
2273
|
## Spinner
|
|
@@ -2230,6 +2344,7 @@ Tags: `<uf-switch>`. Import: `import '@unframed/core/switch';` (or `npx @unframe
|
|
|
2230
2344
|
| `hint` | | `string \| undefined` | | Help text below the label. |
|
|
2231
2345
|
| `checked` | `defaultChecked` | `boolean` | `false` | Initial state, restored on form reset. Set with the `checked` attribute. |
|
|
2232
2346
|
| `value` | | `string` | `'on'` | Value submitted with the form when checked. |
|
|
2347
|
+
| `size` | | `FieldSize` | `'md'` | Size of the control and its label: `sm`, `md` or `lg`. |
|
|
2233
2348
|
| `name` | | `string` | `''` | Name submitted with the form. |
|
|
2234
2349
|
| `disabled` | | `boolean` | `false` | Disables the control. |
|
|
2235
2350
|
| `required` | | `boolean` | `false` | Makes the control required for form submission. |
|
|
@@ -2421,7 +2536,7 @@ Tags: `<uf-tabs>`, `<uf-tab>`, `<uf-tab-panel>`. Import: `import '@unframed/core
|
|
|
2421
2536
|
|
|
2422
2537
|
| Attribute | Property | Type | Default | Description |
|
|
2423
2538
|
|---|---|---|---|---|
|
|
2424
|
-
| `
|
|
2539
|
+
| `value` | | `string` | `''` | Name of the selected panel. Defaults to the first enabled tab. |
|
|
2425
2540
|
| `activation` | | `'auto' \| 'manual'` | `'auto'` | `auto` selects a tab as soon as it gets focus; `manual` waits for Enter or Space. |
|
|
2426
2541
|
| `orientation` | | `'horizontal' \| 'vertical'` | `'horizontal'` | Lays the tab list out horizontally or vertically. |
|
|
2427
2542
|
| `label` | | `string \| undefined` | | Accessible name for the tab list. |
|
|
@@ -2672,6 +2787,13 @@ Tags: `<uf-tooltip>`. Import: `import '@unframed/core/tooltip';` (or `npx @unfra
|
|
|
2672
2787
|
| `show()` | Shows the tooltip, unless it's disabled. |
|
|
2673
2788
|
| `hide()` | Hides the tooltip. |
|
|
2674
2789
|
|
|
2790
|
+
#### Events
|
|
2791
|
+
|
|
2792
|
+
| Event | Type | Description |
|
|
2793
|
+
|---|---|---|
|
|
2794
|
+
| `uf-show` | `Event` | The tooltip opened. |
|
|
2795
|
+
| `uf-hide` | `Event` | The tooltip closed. |
|
|
2796
|
+
|
|
2675
2797
|
#### Slots
|
|
2676
2798
|
|
|
2677
2799
|
| Slot | Description |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Using Unframed 0.
|
|
1
|
+
# Using Unframed 0.11.0 in each framework
|
|
2
2
|
|
|
3
3
|
## HTML & JavaScript
|
|
4
4
|
|
|
@@ -68,8 +68,8 @@ dialog.addEventListener('uf-hide', () => toast('Welcome aboard!', { variant: 'su
|
|
|
68
68
|
<!doctype html>
|
|
69
69
|
<html lang="en">
|
|
70
70
|
<head>
|
|
71
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@unframed/tokens@0.
|
|
72
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@unframed/core@0.
|
|
71
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@unframed/tokens@0.11/dist/tokens.css" />
|
|
72
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@unframed/core@0.11/+esm"></script>
|
|
73
73
|
</head>
|
|
74
74
|
<body>
|
|
75
75
|
<uf-button variant="primary">It works</uf-button>
|