@unframed/cli 0.11.0 → 0.13.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.13.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,22 @@ 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` |
52
+ | Empty state: Fills an empty list or page with a message and what to do next. | `<uf-empty-state>` | `@unframed/core/empty-state` |
51
53
  | File upload: Lets users choose files to upload. | `<uf-file-upload>` | `@unframed/core/file-upload` |
52
54
  | Icon: Shows a small symbol. | `<uf-icon>` | `@unframed/core/icon` |
53
55
  | Input: Lets users enter a single line of text. | `<uf-input>` | `@unframed/core/input` |
56
+ | Multi-select: Lets users search a list and pick several options. | `<uf-multi-select>` | `@unframed/core/multi-select` |
57
+ | Number input: Lets users enter a number, or step it with buttons. | `<uf-number-input>` | `@unframed/core/number-input` |
54
58
  | Pagination: Moves between the pages of a long list. | `<uf-pagination>` | `@unframed/core/pagination` |
55
59
  | Popover: Shows floating content next to a trigger. | `<uf-popover>` | `@unframed/core/popover` |
56
60
  | Progress: Shows how far a task has got. | `<uf-progress>` | `@unframed/core/progress` |
57
61
  | Radio group: Lets users pick exactly one option from a list. | `<uf-radio-group>` `<uf-radio>` | `@unframed/core/radio-group` `@unframed/core/radio` |
62
+ | Segmented control: Picks one of a few options, side by side. | `<uf-segmented-control>` | `@unframed/core/segmented-control` |
58
63
  | Select: Lets users pick one option from a dropdown list. | `<uf-select>` | `@unframed/core/select` |
64
+ | Skeleton: Holds the place of content while it loads. | `<uf-skeleton>` | `@unframed/core/skeleton` |
59
65
  | Slider: Lets users pick a number in a range. | `<uf-slider>` | `@unframed/core/slider` |
60
66
  | Spinner: Shows that something is loading. | `<uf-spinner>` | `@unframed/core/spinner` |
61
67
  | 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.13.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
@@ -1511,6 +1572,75 @@ Arrow keys move, typing a letter jumps to an item, Escape closes.
1511
1572
  | `checkmark` | The check shown for checked checkbox items. |
1512
1573
  | `label` | The label wrapper. |
1513
1574
 
1575
+ ## Empty state
1576
+
1577
+ What to show where content would be: an empty list, no search results, a
1578
+ first visit. An icon, a heading, a short explanation and what to do next.
1579
+
1580
+ The `heading` attribute is bold text. For a real heading in the page's
1581
+ outline, put an `<h2>` or `<h3>` in the `heading` slot.
1582
+
1583
+ Tags: `<uf-empty-state>`. Import: `import '@unframed/core/empty-state';` (or `npx @unframed/cli add empty-state` to copy the source).
1584
+
1585
+ ### Basic
1586
+
1587
+ An icon, a heading, a short explanation and what to do next.
1588
+
1589
+ ```html
1590
+ <uf-empty-state heading="No projects yet">
1591
+ Projects keep your files and your team together.
1592
+ <uf-button slot="actions">New project</uf-button>
1593
+ </uf-empty-state>
1594
+ ```
1595
+
1596
+ ### No search results
1597
+
1598
+ Another `icon`, and a real heading in the `heading` slot when it belongs in the page outline.
1599
+
1600
+ ```html
1601
+ <uf-empty-state icon="search">
1602
+ <h3 slot="heading">No results for “invoice 2019”</h3>
1603
+ Check the spelling, or try a shorter search.
1604
+ <uf-button slot="actions" variant="outline">Clear search</uf-button>
1605
+ </uf-empty-state>
1606
+ ```
1607
+
1608
+ ### `<uf-empty-state>` API
1609
+
1610
+ #### Attributes and properties
1611
+
1612
+ | Attribute | Property | Type | Default | Description |
1613
+ |---|---|---|---|---|
1614
+ | `heading` | | `string \| undefined` | | Bold text above the explanation. |
1615
+ | `icon` | | `string` | `'inbox'` | A built-in or registered icon name. An empty string hides the icon. |
1616
+
1617
+ #### Slots
1618
+
1619
+ | Slot | Description |
1620
+ |---|---|
1621
+ | (default) | The explanation. |
1622
+ | `heading` | The heading, when you need markup or a heading level. Overrides `heading`. |
1623
+ | `icon` | Replaces the icon. |
1624
+ | `actions` | Buttons or links, like "Create a project". |
1625
+
1626
+ #### CSS parts
1627
+
1628
+ | Part | Description |
1629
+ |---|---|
1630
+ | `base` | The empty state. |
1631
+ | `icon` | The icon. |
1632
+ | `heading` | The heading. |
1633
+ | `description` | The explanation. |
1634
+ | `actions` | The wrapper around the actions. |
1635
+
1636
+ #### CSS custom properties
1637
+
1638
+ | Property | Description |
1639
+ |---|---|
1640
+ | `--uf-empty-state-icon-size` | Size of the icon. |
1641
+ | `--uf-empty-state-icon-color` | Color of the icon. |
1642
+ | `--uf-empty-state-padding` | Space around the content. |
1643
+
1514
1644
  ## File upload
1515
1645
 
1516
1646
  Picks files to send with a form: from a button, or by dragging them onto the
@@ -1772,6 +1902,239 @@ Errors appear after the user edits the field or tries to submit.
1772
1902
  | `--uf-field-border-color` | Border color of the box. |
1773
1903
  | `--uf-field-radius` | Corner radius of the box. |
1774
1904
 
1905
+ ## Multi-select
1906
+
1907
+ A field to pick several options from a list you can search. The picked ones
1908
+ show as chips in the field, each with a remove button. Write options as plain
1909
+ `<option>` and `<optgroup>` children; `selected` ones start picked.
1910
+
1911
+ It follows the WAI-ARIA combobox pattern with a multi-select listbox: typing
1912
+ filters the list, arrow keys move through it, Enter picks or unpicks an
1913
+ option and keeps the list open, and Backspace in an empty field removes the
1914
+ last chip. With a `name`, every picked value is submitted with the form.
1915
+
1916
+ Tags: `<uf-multi-select>`. Import: `import '@unframed/core/multi-select';` (or `npx @unframed/cli add multi-select` to copy the source).
1917
+
1918
+ ### Basic
1919
+
1920
+ Type to filter, Enter or a click to pick, and the list stays open for the next one. Backspace removes the last chip. The value is an array, in the order of the options.
1921
+
1922
+ ```html
1923
+ <uf-multi-select name="toppings" label="Toppings" placeholder="Pick toppings">
1924
+ <option value="cheese" selected>Cheese</option>
1925
+ <option value="olives">Olives</option>
1926
+ <option value="basil">Basil</option>
1927
+ <option value="ham" disabled>Ham (sold out)</option>
1928
+ </uf-multi-select>
1929
+ ```
1930
+
1931
+ - With a `name`, every picked value is submitted under that name, like a native `<select multiple>`: read them with `formData.getAll(name)`.
1932
+
1933
+ ### Groups and validation
1934
+
1935
+ ```html
1936
+ <uf-multi-select name="languages" label="Languages" hint="Pick at least one." required>
1937
+ <optgroup label="Europe">
1938
+ <option>English</option>
1939
+ <option>Italian</option>
1940
+ </optgroup>
1941
+ <optgroup label="Asia">
1942
+ <option>Japanese</option>
1943
+ </optgroup>
1944
+ </uf-multi-select>
1945
+ ```
1946
+
1947
+ ### `<uf-multi-select>` API
1948
+
1949
+ #### Attributes and properties
1950
+
1951
+ | Attribute | Property | Type | Default | Description |
1952
+ |---|---|---|---|---|
1953
+ | `label` | | `string \| undefined` | | Visible label. |
1954
+ | `hint` | | `string \| undefined` | | Help text below the field. |
1955
+ | `placeholder` | | `string \| undefined` | | Placeholder text in the field, while nothing is picked. |
1956
+ | `size` | | `FieldSize` | `'md'` | Size of the field. |
1957
+ | `open` | | `boolean` | `false` | Whether the list is showing. |
1958
+ | `name` | | `string` | `''` | Name submitted with the form. |
1959
+ | `disabled` | | `boolean` | `false` | Disables the control. |
1960
+ | `required` | | `boolean` | `false` | Makes the control required for form submission. |
1961
+
1962
+ #### Properties only
1963
+
1964
+ | Property | Type | Description |
1965
+ |---|---|---|
1966
+ | `value` | `string[]` | The picked options' values, in the order of the options. |
1967
+ | `form` | `HTMLFormElement \| null` | Read-only. The form this control belongs to, if any. |
1968
+ | `validity` | `ValidityState` | Read-only. The control's validity state, like a native input's. |
1969
+ | `validationMessage` | `string` | Read-only. The error message shown when the value is invalid. |
1970
+ | `willValidate` | `boolean` | Read-only. Whether the control takes part in form validation. |
1971
+
1972
+ #### Methods
1973
+
1974
+ | Method | Description |
1975
+ |---|---|
1976
+ | `show()` | Opens the list. |
1977
+ | `hide()` | Closes the list. |
1978
+ | `checkValidity()` | Returns whether the value is valid, without showing an error. |
1979
+ | `reportValidity()` | Returns whether the value is valid, and shows the error if not. |
1980
+ | `setCustomValidity(message: string)` | Sets a custom error message. Pass an empty string to clear it. |
1981
+
1982
+ #### Events
1983
+
1984
+ | Event | Type | Description |
1985
+ |---|---|---|
1986
+ | `uf-show` | `Event` | The list opened. |
1987
+ | `uf-hide` | `Event` | The list closed. |
1988
+ | `input` | | Fired as the user types in the field (the search text, not the value). |
1989
+ | `change` | `Event` | Fired when an option is picked or removed. |
1990
+
1991
+ #### Slots
1992
+
1993
+ | Slot | Description |
1994
+ |---|---|
1995
+ | (default) | `<option>` and `<optgroup>` elements. They are read, not rendered. |
1996
+ | `label` | The label, when you need markup. Overrides `label`. |
1997
+ | `hint` | Help text below the field. Overrides `hint`. |
1998
+
1999
+ #### CSS parts
2000
+
2001
+ | Part | Description |
2002
+ |---|---|
2003
+ | `field` | The wrapper around label, control, hint and error. |
2004
+ | `form-label` | The label. |
2005
+ | `box` | The bordered box with the chips and the input. |
2006
+ | `chips` | The list of picked options. |
2007
+ | `chip` | A picked option. |
2008
+ | `chip-remove` | A chip's remove button. |
2009
+ | `input` | The native `<input>`. |
2010
+ | `toggle` | The button that opens the list. |
2011
+ | `listbox` | The floating list. |
2012
+ | `option` | Each option. |
2013
+ | `group-label` | Each group heading. |
2014
+ | `empty` | The "no results" message. |
2015
+ | `hint` | The hint text. |
2016
+ | `error` | The validation message. |
2017
+
2018
+ #### CSS custom properties
2019
+
2020
+ | Property | Description |
2021
+ |---|---|
2022
+ | `--uf-multi-select-max-height` | Maximum height of the list before it scrolls. |
2023
+ | `--uf-multi-select-chip-bg` | Background of the chips. |
2024
+ | `--uf-multi-select-chip-color` | Text color of the chips. |
2025
+ | `--uf-field-bg` | Background of the box. |
2026
+ | `--uf-field-border-color` | Border color of the box. |
2027
+ | `--uf-field-radius` | Corner radius of the box. |
2028
+
2029
+ ## Number input
2030
+
2031
+ A field for a number, with buttons to step it down and up. The value is a
2032
+ number, or `null` while the field is empty. Arrow keys step it too, Enter
2033
+ submits the form, and `min`, `max` and `step` validate it like a native
2034
+ number input.
2035
+
2036
+ The buttons are out of the tab order: arrow keys do the same from the field.
2037
+
2038
+ Tags: `<uf-number-input>`. Import: `import '@unframed/core/number-input';` (or `npx @unframed/cli add number-input` to copy the source).
2039
+
2040
+ ### Basic
2041
+
2042
+ The value is a number, or `null` while the field is empty. The buttons and the arrow keys step it, within `min` and `max`.
2043
+
2044
+ ```html
2045
+ <uf-number-input name="guests" label="Guests" hint="Up to 10" value="2" min="1" max="10"></uf-number-input>
2046
+ ```
2047
+
2048
+ ### Steps, units and validation
2049
+
2050
+ `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.
2051
+
2052
+ ```html
2053
+ <uf-number-input label="Price" value="9.5" step="0.5" min="0">
2054
+ <span slot="prefix">€</span>
2055
+ </uf-number-input>
2056
+ <uf-number-input label="Weight" value="250" step="50" min="0" required>
2057
+ <span slot="suffix">g</span>
2058
+ </uf-number-input>
2059
+ ```
2060
+
2061
+ ### `<uf-number-input>` API
2062
+
2063
+ #### Attributes and properties
2064
+
2065
+ | Attribute | Property | Type | Default | Description |
2066
+ |---|---|---|---|---|
2067
+ | `value` | `defaultValue` | `number \| null` | `null` | Initial value, restored on form reset. Set with the `value` attribute. |
2068
+ | `label` | | `string \| undefined` | | Visible label. |
2069
+ | `hint` | | `string \| undefined` | | Help text below the field. |
2070
+ | `placeholder` | | `string \| undefined` | | Placeholder text. |
2071
+ | `size` | | `FieldSize` | `'md'` | Size of the field. |
2072
+ | `readonly` | | `boolean` | `false` | Makes the field read-only, without the buttons doing anything. |
2073
+ | `min` | | `number \| null` | `null` | Lowest value. |
2074
+ | `max` | | `number \| null` | `null` | Highest value. |
2075
+ | `step` | | `number` | `1` | The buttons and arrow keys move by this much, and the value must be a multiple of it (from `min`). |
2076
+ | `name` | | `string` | `''` | Name submitted with the form. |
2077
+ | `disabled` | | `boolean` | `false` | Disables the control. |
2078
+ | `required` | | `boolean` | `false` | Makes the control required for form submission. |
2079
+
2080
+ #### Properties only
2081
+
2082
+ | Property | Type | Description |
2083
+ |---|---|---|
2084
+ | `value` | `number \| null` | Current value, or `null` while the field is empty. |
2085
+ | `form` | `HTMLFormElement \| null` | Read-only. The form this control belongs to, if any. |
2086
+ | `validity` | `ValidityState` | Read-only. The control's validity state, like a native input's. |
2087
+ | `validationMessage` | `string` | Read-only. The error message shown when the value is invalid. |
2088
+ | `willValidate` | `boolean` | Read-only. Whether the control takes part in form validation. |
2089
+
2090
+ #### Methods
2091
+
2092
+ | Method | Description |
2093
+ |---|---|
2094
+ | `stepUp(count?: unknown)` | Steps the value up by `step` (or `count` steps), like the plus button. |
2095
+ | `stepDown(count?: unknown)` | Steps the value down by `step` (or `count` steps), like the minus button. |
2096
+ | `checkValidity()` | Returns whether the value is valid, without showing an error. |
2097
+ | `reportValidity()` | Returns whether the value is valid, and shows the error if not. |
2098
+ | `setCustomValidity(message: string)` | Sets a custom error message. Pass an empty string to clear it. |
2099
+
2100
+ #### Events
2101
+
2102
+ | Event | Type | Description |
2103
+ |---|---|---|
2104
+ | `input` | `Event` | Fired on every keystroke and every step. |
2105
+ | `change` | `Event` | Fired when the value is committed: blur, Enter or a step. |
2106
+
2107
+ #### Slots
2108
+
2109
+ | Slot | Description |
2110
+ |---|---|
2111
+ | `label` | The label, when you need markup. Overrides `label`. |
2112
+ | `hint` | Help text below the field. Overrides `hint`. |
2113
+ | `prefix` | An icon or text before the number, like a currency. |
2114
+ | `suffix` | An icon or text after the number, like a unit. |
2115
+
2116
+ #### CSS parts
2117
+
2118
+ | Part | Description |
2119
+ |---|---|
2120
+ | `field` | The wrapper around label, control, hint and error. |
2121
+ | `form-label` | The label. |
2122
+ | `box` | The bordered box around the input and the buttons. |
2123
+ | `input` | The native `<input type="number">`. |
2124
+ | `steppers` | The wrapper around the two buttons. |
2125
+ | `decrement` | The minus button. |
2126
+ | `increment` | The plus button. |
2127
+ | `hint` | The hint text. |
2128
+ | `error` | The validation message. |
2129
+
2130
+ #### CSS custom properties
2131
+
2132
+ | Property | Description |
2133
+ |---|---|
2134
+ | `--uf-field-bg` | Background of the box. |
2135
+ | `--uf-field-border-color` | Border color of the box. |
2136
+ | `--uf-field-radius` | Corner radius of the box. |
2137
+
1775
2138
  ## Pagination
1776
2139
 
1777
2140
  Navigation between the pages of a list or table. Set `pages` and `page`; the
@@ -2080,6 +2443,109 @@ Arrow keys move the selection; only the selected radio is in the tab order.
2080
2443
  | `--uf-radio-size` | Size of the circle. |
2081
2444
  | `--uf-radio-checked-bg` | Color of the circle when checked. |
2082
2445
 
2446
+ ## Segmented control
2447
+
2448
+ A row of buttons for one choice among a few, like "List / Grid" or "Day /
2449
+ Week / Month". The choices are plain `<option>` children. One is always
2450
+ selected: the `value` attribute, an option marked `selected`, or the first.
2451
+
2452
+ It's a radio group for assistive tech: arrow keys move and select, Home and
2453
+ End jump to the ends, and it submits its value with a form.
2454
+
2455
+ Tags: `<uf-segmented-control>`. Import: `import '@unframed/core/segmented-control';` (or `npx @unframed/cli add segmented-control` to copy the source).
2456
+
2457
+ ### Basic
2458
+
2459
+ One choice among a few, always with one picked: the `value` attribute, a `selected` option, or the first. Arrow keys move and pick.
2460
+
2461
+ ```html
2462
+ <uf-segmented-control name="view" label="View" value="week">
2463
+ <option value="day">Day</option>
2464
+ <option value="week">Week</option>
2465
+ <option value="month">Month</option>
2466
+ <option value="year" disabled>Year</option>
2467
+ </uf-segmented-control>
2468
+ ```
2469
+
2470
+ - For more than five or six options, or long labels, use a select or a radio group instead.
2471
+
2472
+ ### Sizes
2473
+
2474
+ ```html
2475
+ <uf-segmented-control size="sm" label="Layout">
2476
+ <option>List</option>
2477
+ <option>Grid</option>
2478
+ </uf-segmented-control>
2479
+ ```
2480
+
2481
+ ### `<uf-segmented-control>` API
2482
+
2483
+ #### Attributes and properties
2484
+
2485
+ | Attribute | Property | Type | Default | Description |
2486
+ |---|---|---|---|---|
2487
+ | `value` | `defaultValue` | `string \| undefined` | | Initially selected value, restored on form reset. Set with the `value` attribute. |
2488
+ | `label` | | `string \| undefined` | | Visible label, also the group's accessible name. |
2489
+ | `hint` | | `string \| undefined` | | Help text below the options. |
2490
+ | `size` | | `FieldSize` | `'md'` | Size of the buttons. |
2491
+ | `name` | | `string` | `''` | Name submitted with the form. |
2492
+ | `disabled` | | `boolean` | `false` | Disables the control. |
2493
+ | `required` | | `boolean` | `false` | Makes the control required for form submission. |
2494
+
2495
+ #### Properties only
2496
+
2497
+ | Property | Type | Description |
2498
+ |---|---|---|
2499
+ | `value` | `string` | The selected option's value. |
2500
+ | `form` | `HTMLFormElement \| null` | Read-only. The form this control belongs to, if any. |
2501
+ | `validity` | `ValidityState` | Read-only. The control's validity state, like a native input's. |
2502
+ | `validationMessage` | `string` | Read-only. The error message shown when the value is invalid. |
2503
+ | `willValidate` | `boolean` | Read-only. Whether the control takes part in form validation. |
2504
+
2505
+ #### Methods
2506
+
2507
+ | Method | Description |
2508
+ |---|---|
2509
+ | `focus(options: FocusOptions)` | Moves focus to the selected option. |
2510
+ | `checkValidity()` | Returns whether the value is valid, without showing an error. |
2511
+ | `reportValidity()` | Returns whether the value is valid, and shows the error if not. |
2512
+ | `setCustomValidity(message: string)` | Sets a custom error message. Pass an empty string to clear it. |
2513
+
2514
+ #### Events
2515
+
2516
+ | Event | Type | Description |
2517
+ |---|---|---|
2518
+ | `input` | `Event` | The user picked another option. |
2519
+ | `change` | `Event` | The user picked another option. |
2520
+
2521
+ #### Slots
2522
+
2523
+ | Slot | Description |
2524
+ |---|---|
2525
+ | (default) | `<option>` elements. `disabled` options can't be picked. |
2526
+ | `label` | The label, when you need markup. Overrides `label`. |
2527
+ | `hint` | Help text below the options. Overrides `hint`. |
2528
+
2529
+ #### CSS parts
2530
+
2531
+ | Part | Description |
2532
+ |---|---|
2533
+ | `base` | The element with `role="radiogroup"`. |
2534
+ | `form-label` | The label. |
2535
+ | `options` | The row of buttons. |
2536
+ | `option` | One button. The selected one also has the part `selected`. |
2537
+ | `selected` | The selected button. |
2538
+ | `hint` | The hint text. |
2539
+
2540
+ #### CSS custom properties
2541
+
2542
+ | Property | Description |
2543
+ |---|---|
2544
+ | `--uf-segmented-control-bg` | Background behind the buttons. |
2545
+ | `--uf-segmented-control-selected-bg` | Background of the selected button. |
2546
+ | `--uf-segmented-control-selected-color` | Text color of the selected button. |
2547
+ | `--uf-segmented-control-radius` | Corner radius of the row. |
2548
+
2083
2549
  ## Select
2084
2550
 
2085
2551
  A dropdown built on the native `<select>`, so it gets the platform's
@@ -2173,6 +2639,67 @@ Built on the native `<select>`: write plain `<option>` and `<optgroup>` children
2173
2639
  | `--uf-field-border-color` | Border color of the box. |
2174
2640
  | `--uf-field-radius` | Corner radius of the box. |
2175
2641
 
2642
+ ## Skeleton
2643
+
2644
+ A grey placeholder in the shape of content that's still loading: lines of
2645
+ text, a block or a circle. It's decorative, hidden from assistive tech: mark
2646
+ the region that's loading with `aria-busy="true"`, and announce the result
2647
+ when it arrives.
2648
+
2649
+ Size it with `width` and `height` in CSS; `text` lines take the height of a
2650
+ line of text, and `circle` stays round.
2651
+
2652
+ Tags: `<uf-skeleton>`. Import: `import '@unframed/core/skeleton';` (or `npx @unframed/cli add skeleton` to copy the source).
2653
+
2654
+ ### Shapes
2655
+
2656
+ 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.
2657
+
2658
+ ```html
2659
+ <div aria-busy="true">
2660
+ <uf-skeleton shape="circle"></uf-skeleton>
2661
+ <uf-skeleton lines="3"></uf-skeleton>
2662
+
2663
+ <uf-skeleton shape="rect"></uf-skeleton>
2664
+ </div>
2665
+ ```
2666
+
2667
+ - Skeletons are hidden from screen readers. Mark the region that is loading with `aria-busy="true"`, and remove it when the content arrives.
2668
+
2669
+ ### A card while it loads
2670
+
2671
+ ```html
2672
+ <uf-card aria-busy="true">
2673
+ <uf-skeleton slot="media" shape="rect" style="height: 8rem"></uf-skeleton>
2674
+ <uf-skeleton slot="header" style="width: 60%"></uf-skeleton>
2675
+ <uf-skeleton lines="2"></uf-skeleton>
2676
+ </uf-card>
2677
+ ```
2678
+
2679
+ ### `<uf-skeleton>` API
2680
+
2681
+ #### Attributes and properties
2682
+
2683
+ | Attribute | Property | Type | Default | Description |
2684
+ |---|---|---|---|---|
2685
+ | `shape` | | `SkeletonShape` | `'text'` | `text` (lines of text), `rect` (a block, like an image) or `circle` (like an avatar). |
2686
+ | `lines` | | `number` | `1` | Number of lines of a `text` placeholder. |
2687
+
2688
+ #### CSS parts
2689
+
2690
+ | Part | Description |
2691
+ |---|---|
2692
+ | `base` | The placeholder, or the wrapper around its lines. |
2693
+ | `line` | One line of a `text` placeholder. |
2694
+
2695
+ #### CSS custom properties
2696
+
2697
+ | Property | Description |
2698
+ |---|---|
2699
+ | `--uf-skeleton-color` | Background of the placeholder. |
2700
+ | `--uf-skeleton-highlight` | Color of the shimmer that sweeps across it. |
2701
+ | `--uf-skeleton-radius` | Corner radius of `text` and `rect` placeholders. |
2702
+
2176
2703
  ## Slider
2177
2704
 
2178
2705
  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.13.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.13/dist/tokens.css" />
72
+ <script type="module" src="https://cdn.jsdelivr.net/npm/@unframed/core@0.13/+esm"></script>
73
73
  </head>
74
74
  <body>
75
75
  <uf-button variant="primary">It works</uf-button>