@unframed/cli 0.11.0 → 0.12.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.
@@ -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.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.
8
+ Unframed 0.12.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
 
@@ -46,16 +46,19 @@ Unframed 0.11.0: accessible UI components as standard custom elements (Lit). Eve
46
46
  | Date picker: Lets users type or pick a date. | `<uf-date-picker>` `<uf-calendar>` | `@unframed/core/date-picker` `@unframed/core/calendar` |
47
47
  | Date range picker: Lets users type or pick a start and an end date. | `<uf-date-range-picker>` `<uf-calendar>` | `@unframed/core/date-range-picker` `@unframed/core/calendar` |
48
48
  | Dialog: Shows content in a modal window on top of the page. | `<uf-dialog>` | `@unframed/core/dialog` |
49
+ | Divider: Separates groups of content with a line. | `<uf-divider>` | `@unframed/core/divider` |
49
50
  | Drawer: A panel that slides in from an edge of the screen. | `<uf-drawer>` | `@unframed/core/drawer` |
50
51
  | Dropdown menu: Opens a menu of actions from a button. | `<uf-dropdown>` `<uf-menu>` `<uf-menu-item>` | `@unframed/core/dropdown` `@unframed/core/menu` |
51
52
  | File upload: Lets users choose files to upload. | `<uf-file-upload>` | `@unframed/core/file-upload` |
52
53
  | Icon: Shows a small symbol. | `<uf-icon>` | `@unframed/core/icon` |
53
54
  | Input: Lets users enter a single line of text. | `<uf-input>` | `@unframed/core/input` |
55
+ | Number input: Lets users enter a number, or step it with buttons. | `<uf-number-input>` | `@unframed/core/number-input` |
54
56
  | Pagination: Moves between the pages of a long list. | `<uf-pagination>` | `@unframed/core/pagination` |
55
57
  | Popover: Shows floating content next to a trigger. | `<uf-popover>` | `@unframed/core/popover` |
56
58
  | Progress: Shows how far a task has got. | `<uf-progress>` | `@unframed/core/progress` |
57
59
  | Radio group: Lets users pick exactly one option from a list. | `<uf-radio-group>` `<uf-radio>` | `@unframed/core/radio-group` `@unframed/core/radio` |
58
60
  | Select: Lets users pick one option from a dropdown list. | `<uf-select>` | `@unframed/core/select` |
61
+ | Skeleton: Holds the place of content while it loads. | `<uf-skeleton>` | `@unframed/core/skeleton` |
59
62
  | Slider: Lets users pick a number in a range. | `<uf-slider>` | `@unframed/core/slider` |
60
63
  | Spinner: Shows that something is loading. | `<uf-spinner>` | `@unframed/core/spinner` |
61
64
  | Switch: Turns a setting on or off. | `<uf-switch>` | `@unframed/core/switch` |
@@ -1,4 +1,4 @@
1
- # Unframed 0.11.0 components
1
+ # Unframed 0.12.0 components
2
2
 
3
3
  ## Accordion
4
4
 
@@ -1284,6 +1284,67 @@ Escape, the close button and any element with `data-dialog="close"` close it.
1284
1284
  | `--uf-dialog-radius` | Corner radius. |
1285
1285
  | `--uf-dialog-backdrop` | Backdrop color. |
1286
1286
 
1287
+ ## Divider
1288
+
1289
+ A line between groups of content, across or beside them. Assistive tech
1290
+ announces it as a separator. With a label ("or"), the label is read as plain
1291
+ text and the line around it is decorative.
1292
+
1293
+ Tags: `<uf-divider>`. Import: `import '@unframed/core/divider';` (or `npx @unframed/cli add divider` to copy the source).
1294
+
1295
+ ### Between sections, or with a label
1296
+
1297
+ ```html
1298
+ <section>Profile</section>
1299
+ <uf-divider></uf-divider>
1300
+ <section>Notifications</section>
1301
+
1302
+ <uf-divider>or</uf-divider>
1303
+ ```
1304
+
1305
+ - Screen readers announce a divider as a separator. A label is read as plain text, so keep it short, like "or".
1306
+
1307
+ ### Vertical
1308
+
1309
+ Between items in a row. It takes the height of the row.
1310
+
1311
+ ```html
1312
+ <div style="display: flex; align-items: center">
1313
+ <uf-button variant="link">Edit</uf-button>
1314
+ <uf-divider orientation="vertical"></uf-divider>
1315
+ <uf-button variant="link">Duplicate</uf-button>
1316
+ </div>
1317
+ ```
1318
+
1319
+ ### `<uf-divider>` API
1320
+
1321
+ #### Attributes and properties
1322
+
1323
+ | Attribute | Property | Type | Default | Description |
1324
+ |---|---|---|---|---|
1325
+ | `orientation` | | `DividerOrientation` | `'horizontal'` | `horizontal` (across the content) or `vertical` (between items in a row). |
1326
+
1327
+ #### Slots
1328
+
1329
+ | Slot | Description |
1330
+ |---|---|
1331
+ | (default) | An optional label in the middle of the line, like "or". |
1332
+
1333
+ #### CSS parts
1334
+
1335
+ | Part | Description |
1336
+ |---|---|
1337
+ | `base` | The line, or the wrapper around a labelled one. |
1338
+ | `label` | The label. |
1339
+
1340
+ #### CSS custom properties
1341
+
1342
+ | Property | Description |
1343
+ |---|---|
1344
+ | `--uf-divider-color` | Color of the line. |
1345
+ | `--uf-divider-width` | Thickness of the line. |
1346
+ | `--uf-divider-spacing` | Space before and after the line. |
1347
+
1287
1348
  ## Drawer
1288
1349
 
1289
1350
  A panel that slides in from an edge of the screen, for navigation, filters or
@@ -1772,6 +1833,115 @@ Errors appear after the user edits the field or tries to submit.
1772
1833
  | `--uf-field-border-color` | Border color of the box. |
1773
1834
  | `--uf-field-radius` | Corner radius of the box. |
1774
1835
 
1836
+ ## Number input
1837
+
1838
+ A field for a number, with buttons to step it down and up. The value is a
1839
+ number, or `null` while the field is empty. Arrow keys step it too, Enter
1840
+ submits the form, and `min`, `max` and `step` validate it like a native
1841
+ number input.
1842
+
1843
+ The buttons are out of the tab order: arrow keys do the same from the field.
1844
+
1845
+ Tags: `<uf-number-input>`. Import: `import '@unframed/core/number-input';` (or `npx @unframed/cli add number-input` to copy the source).
1846
+
1847
+ ### Basic
1848
+
1849
+ The value is a number, or `null` while the field is empty. The buttons and the arrow keys step it, within `min` and `max`.
1850
+
1851
+ ```html
1852
+ <uf-number-input name="guests" label="Guests" hint="Up to 10" value="2" min="1" max="10"></uf-number-input>
1853
+ ```
1854
+
1855
+ ### Steps, units and validation
1856
+
1857
+ `step` sets how much the buttons move, and the value must be a multiple of it. Put a unit or a currency in the `prefix` or `suffix` slot.
1858
+
1859
+ ```html
1860
+ <uf-number-input label="Price" value="9.5" step="0.5" min="0">
1861
+ <span slot="prefix">€</span>
1862
+ </uf-number-input>
1863
+ <uf-number-input label="Weight" value="250" step="50" min="0" required>
1864
+ <span slot="suffix">g</span>
1865
+ </uf-number-input>
1866
+ ```
1867
+
1868
+ ### `<uf-number-input>` API
1869
+
1870
+ #### Attributes and properties
1871
+
1872
+ | Attribute | Property | Type | Default | Description |
1873
+ |---|---|---|---|---|
1874
+ | `value` | `defaultValue` | `number \| null` | `null` | Initial value, restored on form reset. Set with the `value` attribute. |
1875
+ | `label` | | `string \| undefined` | | Visible label. |
1876
+ | `hint` | | `string \| undefined` | | Help text below the field. |
1877
+ | `placeholder` | | `string \| undefined` | | Placeholder text. |
1878
+ | `size` | | `FieldSize` | `'md'` | Size of the field. |
1879
+ | `readonly` | | `boolean` | `false` | Makes the field read-only, without the buttons doing anything. |
1880
+ | `min` | | `number \| null` | `null` | Lowest value. |
1881
+ | `max` | | `number \| null` | `null` | Highest value. |
1882
+ | `step` | | `number` | `1` | The buttons and arrow keys move by this much, and the value must be a multiple of it (from `min`). |
1883
+ | `name` | | `string` | `''` | Name submitted with the form. |
1884
+ | `disabled` | | `boolean` | `false` | Disables the control. |
1885
+ | `required` | | `boolean` | `false` | Makes the control required for form submission. |
1886
+
1887
+ #### Properties only
1888
+
1889
+ | Property | Type | Description |
1890
+ |---|---|---|
1891
+ | `value` | `number \| null` | Current value, or `null` while the field is empty. |
1892
+ | `form` | `HTMLFormElement \| null` | Read-only. The form this control belongs to, if any. |
1893
+ | `validity` | `ValidityState` | Read-only. The control's validity state, like a native input's. |
1894
+ | `validationMessage` | `string` | Read-only. The error message shown when the value is invalid. |
1895
+ | `willValidate` | `boolean` | Read-only. Whether the control takes part in form validation. |
1896
+
1897
+ #### Methods
1898
+
1899
+ | Method | Description |
1900
+ |---|---|
1901
+ | `stepUp(count?: unknown)` | Steps the value up by `step` (or `count` steps), like the plus button. |
1902
+ | `stepDown(count?: unknown)` | Steps the value down by `step` (or `count` steps), like the minus button. |
1903
+ | `checkValidity()` | Returns whether the value is valid, without showing an error. |
1904
+ | `reportValidity()` | Returns whether the value is valid, and shows the error if not. |
1905
+ | `setCustomValidity(message: string)` | Sets a custom error message. Pass an empty string to clear it. |
1906
+
1907
+ #### Events
1908
+
1909
+ | Event | Type | Description |
1910
+ |---|---|---|
1911
+ | `input` | `Event` | Fired on every keystroke and every step. |
1912
+ | `change` | `Event` | Fired when the value is committed: blur, Enter or a step. |
1913
+
1914
+ #### Slots
1915
+
1916
+ | Slot | Description |
1917
+ |---|---|
1918
+ | `label` | The label, when you need markup. Overrides `label`. |
1919
+ | `hint` | Help text below the field. Overrides `hint`. |
1920
+ | `prefix` | An icon or text before the number, like a currency. |
1921
+ | `suffix` | An icon or text after the number, like a unit. |
1922
+
1923
+ #### CSS parts
1924
+
1925
+ | Part | Description |
1926
+ |---|---|
1927
+ | `field` | The wrapper around label, control, hint and error. |
1928
+ | `form-label` | The label. |
1929
+ | `box` | The bordered box around the input and the buttons. |
1930
+ | `input` | The native `<input type="number">`. |
1931
+ | `steppers` | The wrapper around the two buttons. |
1932
+ | `decrement` | The minus button. |
1933
+ | `increment` | The plus button. |
1934
+ | `hint` | The hint text. |
1935
+ | `error` | The validation message. |
1936
+
1937
+ #### CSS custom properties
1938
+
1939
+ | Property | Description |
1940
+ |---|---|
1941
+ | `--uf-field-bg` | Background of the box. |
1942
+ | `--uf-field-border-color` | Border color of the box. |
1943
+ | `--uf-field-radius` | Corner radius of the box. |
1944
+
1775
1945
  ## Pagination
1776
1946
 
1777
1947
  Navigation between the pages of a list or table. Set `pages` and `page`; the
@@ -2173,6 +2343,67 @@ Built on the native `<select>`: write plain `<option>` and `<optgroup>` children
2173
2343
  | `--uf-field-border-color` | Border color of the box. |
2174
2344
  | `--uf-field-radius` | Corner radius of the box. |
2175
2345
 
2346
+ ## Skeleton
2347
+
2348
+ A grey placeholder in the shape of content that's still loading: lines of
2349
+ text, a block or a circle. It's decorative, hidden from assistive tech: mark
2350
+ the region that's loading with `aria-busy="true"`, and announce the result
2351
+ when it arrives.
2352
+
2353
+ Size it with `width` and `height` in CSS; `text` lines take the height of a
2354
+ line of text, and `circle` stays round.
2355
+
2356
+ Tags: `<uf-skeleton>`. Import: `import '@unframed/core/skeleton';` (or `npx @unframed/cli add skeleton` to copy the source).
2357
+
2358
+ ### Shapes
2359
+
2360
+ Lines of text (`lines`), a circle or a block (`rect`), sized with CSS. A shimmer sweeps across them, except for people who asked for less motion.
2361
+
2362
+ ```html
2363
+ <div aria-busy="true">
2364
+ <uf-skeleton shape="circle"></uf-skeleton>
2365
+ <uf-skeleton lines="3"></uf-skeleton>
2366
+
2367
+ <uf-skeleton shape="rect"></uf-skeleton>
2368
+ </div>
2369
+ ```
2370
+
2371
+ - Skeletons are hidden from screen readers. Mark the region that is loading with `aria-busy="true"`, and remove it when the content arrives.
2372
+
2373
+ ### A card while it loads
2374
+
2375
+ ```html
2376
+ <uf-card aria-busy="true">
2377
+ <uf-skeleton slot="media" shape="rect" style="height: 8rem"></uf-skeleton>
2378
+ <uf-skeleton slot="header" style="width: 60%"></uf-skeleton>
2379
+ <uf-skeleton lines="2"></uf-skeleton>
2380
+ </uf-card>
2381
+ ```
2382
+
2383
+ ### `<uf-skeleton>` API
2384
+
2385
+ #### Attributes and properties
2386
+
2387
+ | Attribute | Property | Type | Default | Description |
2388
+ |---|---|---|---|---|
2389
+ | `shape` | | `SkeletonShape` | `'text'` | `text` (lines of text), `rect` (a block, like an image) or `circle` (like an avatar). |
2390
+ | `lines` | | `number` | `1` | Number of lines of a `text` placeholder. |
2391
+
2392
+ #### CSS parts
2393
+
2394
+ | Part | Description |
2395
+ |---|---|
2396
+ | `base` | The placeholder, or the wrapper around its lines. |
2397
+ | `line` | One line of a `text` placeholder. |
2398
+
2399
+ #### CSS custom properties
2400
+
2401
+ | Property | Description |
2402
+ |---|---|
2403
+ | `--uf-skeleton-color` | Background of the placeholder. |
2404
+ | `--uf-skeleton-highlight` | Color of the shimmer that sweeps across it. |
2405
+ | `--uf-skeleton-radius` | Corner radius of `text` and `rect` placeholders. |
2406
+
2176
2407
  ## Slider
2177
2408
 
2178
2409
  Picks a number in a range by dragging a handle, or with the arrow keys. Built
@@ -1,4 +1,4 @@
1
- # Using Unframed 0.11.0 in each framework
1
+ # Using Unframed 0.12.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.11/dist/tokens.css" />
72
- <script type="module" src="https://cdn.jsdelivr.net/npm/@unframed/core@0.11/+esm"></script>
71
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@unframed/tokens@0.12/dist/tokens.css" />
72
+ <script type="module" src="https://cdn.jsdelivr.net/npm/@unframed/core@0.12/+esm"></script>
73
73
  </head>
74
74
  <body>
75
75
  <uf-button variant="primary">It works</uf-button>